Skip to content
Snippets Groups Projects
Commit e7d26595 authored by Philipp Spohr's avatar Philipp Spohr
Browse files

[Insert generic commit message here]

parent de17a6ef
No related branches found
No related tags found
No related merge requests found
......@@ -47,12 +47,6 @@ public class YoshikoResult {
this.flags = flags;
}
public void dispose() {
flags.delete();
originalGraph.dispose();
}
//___________SETTER GETTER_____________//
/**
......
......@@ -66,7 +66,7 @@ public class ClusterView extends JPanel {
//SYMBOLIC LINKS
private YoshikoCluster cluster;
private final YoshikoCluster cluster;
public ClusterView(YoshikoCluster c) throws Exception {
......@@ -158,4 +158,14 @@ public class ClusterView extends JPanel {
};
//____________SETTER GETTER ________________//
public boolean isSelected() {
return isSelected;
}
public YoshikoCluster getCluster() {
return cluster;
}
}
......@@ -10,6 +10,7 @@ import javax.swing.Scrollable;
import org.slf4j.Logger;
import de.hhu.ba.yoshikoWrapper.graphModel.YoshikoCluster;
import de.hhu.ba.yoshikoWrapper.logging.YoshikoLogger;
@SuppressWarnings("serial")
......@@ -62,4 +63,15 @@ public class ClusterViewList extends JPanel implements Scrollable {
return ret;
}
public ArrayList<YoshikoCluster> getSelectedClusters() {
ArrayList<YoshikoCluster> ret = new ArrayList<YoshikoCluster>();
ArrayList<ClusterView> cv = getClusterViews();
for (ClusterView v : cv) {
if (v.isSelected()) {
ret.add(v.getCluster());
}
}
return ret;
}
}
......@@ -78,6 +78,7 @@ NetworkAboutToBeDestroyedListener
//MACRO
//TODO: (Nächstes Leben) find a good solution with Swing that scales the panel and respects layout
private static final int HACKFIX_FIXED_WIDTH = 128+256;
private final JTabbedPane tabbedPane;
......@@ -87,22 +88,31 @@ NetworkAboutToBeDestroyedListener
private BasicCollapsiblePanel marker;
private final JLabel invalidLabel;
private ArrayList<SolutionTab> solutionTabs;
private final ArrayList<SolutionTab> solutionTabs;
private final YoshikoResult result;
private boolean isValid;
public ResultPanel(YoshikoResult result) throws Exception {
this.result = result;
this.isValid = true;
//Init subcomponents
invalidLabel = new JLabel();
tabbedPane = new JTabbedPane();
solutionTabs = new ArrayList<SolutionTab>();
for (YoshikoSolution s : result.getSolutions()) {
SolutionTab tab = new SolutionTab(s);
tabbedPane.add(
LocalizationManager.get("solution")+" "+(s.getId()+1),
tab
); }
);
//Save reference
solutionTabs.add(tab);
}
if (result.getFlags().getIlpGenerated()) {
//TODO: Move to MarkerPanel for better codestyle
......@@ -163,7 +173,7 @@ NetworkAboutToBeDestroyedListener
.addComponent(tabbedPane,HACKFIX_FIXED_WIDTH, PREFERRED_SIZE,Short.MAX_VALUE)
.addComponent(destroyButton,DEFAULT_SIZE, DEFAULT_SIZE,DEFAULT_SIZE);
verticalGroup
.addComponent(invalidLabel,DEFAULT_SIZE, DEFAULT_SIZE,PREFERRED_SIZE)
.addComponent(invalidLabel,DEFAULT_SIZE, PREFERRED_SIZE,Short.MAX_VALUE)
.addComponent(tabbedPane,DEFAULT_SIZE, DEFAULT_SIZE,PREFERRED_SIZE)
.addComponent(destroyButton,DEFAULT_SIZE, DEFAULT_SIZE,PREFERRED_SIZE);
......@@ -195,13 +205,15 @@ NetworkAboutToBeDestroyedListener
if (dialogResult != JOptionPane.YES_OPTION) {
return;
}
result.dispose();
CyCore.registrar.unregisterService(this,CytoPanelComponent.class);
removeAll();
super.setVisible(false);
}
private void invalidateResult() {
if (isValid) {
isValid = false;
}
invalidLabel.setText(LocalizationManager.get("invalidated"));
invalidLabel.setForeground(Color.RED);
for (SolutionTab t: solutionTabs) {
......
......@@ -27,12 +27,14 @@ import static javax.swing.GroupLayout.PREFERRED_SIZE;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.GroupLayout.Group;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;
......@@ -56,7 +58,7 @@ public class SolutionTab extends JPanel {
//SWING COMPONENTS
private final JScrollPane scrollPane;
private final ClusterViewList scrollPaneContent;
private final ClusterViewList clusterViewList;
private final JLabel clusterCount;
private final JButton createClusterView;
private final JButton createMetaGraph;
......@@ -82,14 +84,14 @@ public class SolutionTab extends JPanel {
this.solution = s;
//Declaration of Swing Components
scrollPaneContent = new ClusterViewList();
clusterViewList = new ClusterViewList();
for (YoshikoCluster c: solution.cluster) {
ClusterView clusterView = new ClusterView(c);
scrollPaneContent.add(clusterView);
clusterViewList.add(clusterView);
}
scrollPane = new JScrollPane(scrollPaneContent);
scrollPane = new JScrollPane(clusterViewList);
clusterCount = new JLabel(LocalizationManager.get("clusterFound")+" "+s.cluster.size());
......@@ -105,9 +107,20 @@ public class SolutionTab extends JPanel {
@Override
public void actionPerformed(ActionEvent e) {
ArrayList<YoshikoCluster> selectedClusters = clusterViewList.getSelectedClusters();
if (selectedClusters.isEmpty()) {
JOptionPane.showMessageDialog(null,
LocalizationManager.get("optionpane_title"),
LocalizationManager.get("noClustersSelected"),
JOptionPane.INFORMATION_MESSAGE
);
return;
}
CyCore.dialogTaskManager.execute(
new TaskIterator(1,
new CreateClusterViews(solution.getClusters())
new CreateClusterViews(
selectedClusters
)
)
);
}
......@@ -133,7 +146,7 @@ public class SolutionTab extends JPanel {
//Layout
scrollLayout = new GroupLayout(scrollPaneContent);
scrollLayout = new GroupLayout(clusterViewList);
horizontalGroup_scrollLayout = scrollLayout.createParallelGroup();
verticalGroup_scrollLayout = scrollLayout.createSequentialGroup();
......@@ -144,12 +157,12 @@ public class SolutionTab extends JPanel {
scrollLayout.setAutoCreateContainerGaps(true);
scrollLayout.setAutoCreateGaps(true);
for (ClusterView v: scrollPaneContent.getClusterViews()) {
for (ClusterView v: clusterViewList.getClusterViews()) {
horizontalGroup_scrollLayout.addComponent(v);
verticalGroup_scrollLayout.addComponent(v);
}
scrollPaneContent.setLayout(scrollLayout);
clusterViewList.setLayout(scrollLayout);
layout = new GroupLayout(this);
......
......@@ -44,6 +44,7 @@ icTooltip = This value is used to determine what the algorithm pays when inserti
ilpMarker = ILP Properties
incompleteResult = This run yielded no usable result!
instance = Instance
invalidated = No longer valid, original graph changed!
lastInstanceGap = Gap (Current Instance):
libFail = Failed to load library! Make sure you got the right file. The required version for this version of the wrapper is:
libraryPanel = Library
......@@ -55,6 +56,8 @@ noLibMessage = There is no Yoshiko Library currently loaded! You might have to s
noLibTitle = Library not loaded!
noMappingHint = You haven't mapped the cost value to a column in your edge table.\nYoshiko runs significantly faster and generates better solutions if you map values.
nodes = Nodes
optionpane_title = Yoshiko Info
noClustersSelected = You have not selected any clusters
notOptimal = Optimality not guaranteed
nrSolutions = Number of Solutions:
operationMode = Operation Mode
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment