|
@@ -34,8 +34,12 @@ import javax.swing.JLabel;
|
|
|
import javax.swing.JPanel;
|
|
|
import javax.swing.JProgressBar;
|
|
|
import javax.swing.JScrollPane;
|
|
|
+import javax.swing.JSeparator;
|
|
|
import javax.swing.JSplitPane;
|
|
|
+import javax.swing.border.EmptyBorder;
|
|
|
import javax.swing.text.NumberFormatter;
|
|
|
+
|
|
|
+import algorithm.objectiveFunction.TopologieObjectiveFunction;
|
|
|
import classes.AbstractCanvasObject;
|
|
|
import classes.Category;
|
|
|
import classes.Edge;
|
|
@@ -66,6 +70,9 @@ public abstract class TopologieAlgorithmFramework implements AddOn{
|
|
|
private JPanel content = new JPanel();
|
|
|
protected Console console = new Console();
|
|
|
private JPanel borderPanel = new JPanel();
|
|
|
+ private HashMap<String, JPanel> panelMap = new HashMap<String, JPanel>();
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
//Settings groupNode
|
|
@@ -149,8 +156,9 @@ public abstract class TopologieAlgorithmFramework implements AddOn{
|
|
|
JPanel parameterPanel = new JPanel(null);
|
|
|
parameterPanel.setPreferredSize(new Dimension(510,300));
|
|
|
borderPanel.setLayout(new BoxLayout(borderPanel, BoxLayout.PAGE_AXIS));
|
|
|
- addIntParameter("Repetitions", rounds, intInput -> rounds = intInput, () -> rounds, 1);
|
|
|
addIntParameter("Number of New Cables", amountOfNewCables, intInput -> amountOfNewCables = intInput, () -> amountOfNewCables, 0);
|
|
|
+ addSeperator();
|
|
|
+ addIntParameter("Repetitions", rounds, intInput -> rounds = intInput, () -> rounds, 1);
|
|
|
JScrollPane scrollPane = new JScrollPane(borderPanel);
|
|
|
scrollPane.setBounds(10, 0, 850, 292);
|
|
|
scrollPane.setBorder(BorderFactory.createEmptyBorder());
|
|
@@ -228,19 +236,24 @@ public abstract class TopologieAlgorithmFramework implements AddOn{
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
+ //addSeperator
|
|
|
+ protected void addSeperator() {
|
|
|
+ borderPanel.add(Box.createRigidArea(new Dimension(5, 5)));
|
|
|
+ borderPanel.add(new JSeparator());
|
|
|
+ borderPanel.add(Box.createRigidArea(new Dimension(5, 5)));
|
|
|
+ }
|
|
|
|
|
|
|
|
|
//int
|
|
|
protected void addIntParameter(String parameterName, int parameterValue, Consumer<Integer> setter, Supplier<Integer> getter) {
|
|
|
- this.addIntParameter(parameterName, parameterValue, setter, getter, Integer.MIN_VALUE, Integer.MAX_VALUE);
|
|
|
+ this.addIntParameter(parameterName, parameterValue, setter, getter, true, Integer.MIN_VALUE, Integer.MAX_VALUE);
|
|
|
}
|
|
|
|
|
|
protected void addIntParameter(String parameterName, int parameterValue, Consumer<Integer> setter, Supplier<Integer> getter, int parameterMinValue) {
|
|
|
- this.addIntParameter(parameterName, parameterValue, setter, getter, parameterMinValue, Integer.MAX_VALUE);
|
|
|
+ this.addIntParameter(parameterName, parameterValue, setter, getter, true, parameterMinValue, Integer.MAX_VALUE);
|
|
|
}
|
|
|
|
|
|
- protected void addIntParameter(String parameterName, int parameterValue, Consumer<Integer> setter, Supplier<Integer> getter, int parameterMinValue, int parameterMaxValue) {
|
|
|
+ protected void addIntParameter(String parameterName, int parameterValue, Consumer<Integer> setter, Supplier<Integer> getter, boolean visible, int parameterMinValue, int parameterMaxValue) {
|
|
|
JPanel singleParameterPanel = new JPanel();
|
|
|
singleParameterPanel.setLayout(new BoxLayout(singleParameterPanel, BoxLayout.LINE_AXIS));
|
|
|
singleParameterPanel.setAlignmentX(0.0f);
|
|
@@ -315,23 +328,24 @@ public abstract class TopologieAlgorithmFramework implements AddOn{
|
|
|
stepsSizeLabel.setEnabled(enabled);
|
|
|
stepsSizeTextField.setEnabled(enabled);
|
|
|
});
|
|
|
-
|
|
|
+ panelMap.put(parameterName, singleParameterPanel);
|
|
|
+ singleParameterPanel.setVisible(visible);
|
|
|
borderPanel.add(singleParameterPanel);
|
|
|
}
|
|
|
|
|
|
|
|
|
//double
|
|
|
protected void addDoubleParameter(String parameterName, double parameterValue, Consumer<Double> setter, Supplier<Double> getter) {
|
|
|
- this.addDoubleParameter(parameterName, parameterValue, setter, getter, Double.MIN_VALUE, Double.MAX_VALUE);
|
|
|
+ this.addDoubleParameter(parameterName, parameterValue, setter, getter, true, Double.MIN_VALUE, Double.MAX_VALUE);
|
|
|
}
|
|
|
|
|
|
|
|
|
protected void addDoubleParameter(String parameterName, double parameterValue, Consumer<Double> setter, Supplier<Double> getter, double parameterMinValue) {
|
|
|
- this.addDoubleParameter(parameterName, parameterValue, setter, getter, parameterMinValue, Double.MAX_VALUE);
|
|
|
+ this.addDoubleParameter(parameterName, parameterValue, setter, getter, true, parameterMinValue, Double.MAX_VALUE);
|
|
|
}
|
|
|
|
|
|
|
|
|
- protected void addDoubleParameter(String parameterName, double parameterValue, Consumer<Double> setter, Supplier<Double> getter, double parameterMinValue, double parameterMaxValue) {
|
|
|
+ protected void addDoubleParameter(String parameterName, double parameterValue, Consumer<Double> setter, Supplier<Double> getter, boolean visible, double parameterMinValue, double parameterMaxValue) {
|
|
|
JPanel singleParameterPanel = new JPanel();
|
|
|
singleParameterPanel.setLayout(new BoxLayout(singleParameterPanel, BoxLayout.LINE_AXIS));
|
|
|
singleParameterPanel.setAlignmentX(0.0f);
|
|
@@ -411,19 +425,25 @@ public abstract class TopologieAlgorithmFramework implements AddOn{
|
|
|
stepsSizeLabel.setEnabled(enabled);
|
|
|
stepsSizeTextField.setEnabled(enabled);
|
|
|
});
|
|
|
-
|
|
|
+ panelMap.put(parameterName, singleParameterPanel);
|
|
|
+ singleParameterPanel.setVisible(visible);
|
|
|
borderPanel.add(singleParameterPanel);
|
|
|
}
|
|
|
//boolean
|
|
|
- protected void addBooleanParameter(String parameterName, boolean parameterValue, Consumer<Boolean> setter){
|
|
|
+ protected void addBooleanParameter(String parameterName, boolean parameterValue, Consumer<Boolean> setter, List<String> showParameterNames, List<String> hideParameterNames){
|
|
|
JPanel singleParameterPanel = new JPanel();
|
|
|
+ panelMap.put(parameterName, singleParameterPanel);
|
|
|
singleParameterPanel.setLayout(new BoxLayout(singleParameterPanel, BoxLayout.LINE_AXIS));
|
|
|
singleParameterPanel.setAlignmentX(0.0f);
|
|
|
singleParameterPanel.add(new JLabel(parameterName + ": "));
|
|
|
singleParameterPanel.add(Box.createHorizontalGlue());
|
|
|
JCheckBox useGroupNodeCheckBox = new JCheckBox();
|
|
|
+ useGroupNodeCheckBox.addActionListener(actionEvent -> {
|
|
|
+ setter.accept(useGroupNodeCheckBox.isSelected());
|
|
|
+ showParameterNames.forEach(string -> panelMap.get(string).setVisible(useGroupNodeCheckBox.isSelected()));
|
|
|
+ hideParameterNames.forEach(string -> panelMap.get(string).setVisible(!useGroupNodeCheckBox.isSelected()));
|
|
|
+ });
|
|
|
useGroupNodeCheckBox.setSelected(parameterValue);
|
|
|
- useGroupNodeCheckBox.addActionListener(actionEvent -> setter.accept(useGroupNodeCheckBox.isSelected()));
|
|
|
singleParameterPanel.add(useGroupNodeCheckBox);
|
|
|
borderPanel.add(singleParameterPanel);
|
|
|
}
|
|
@@ -534,6 +554,7 @@ public abstract class TopologieAlgorithmFramework implements AddOn{
|
|
|
executeAlgoWithParameter();
|
|
|
|
|
|
}
|
|
|
+ TopologieObjectiveFunction.log.clear();
|
|
|
updateVisual();
|
|
|
runProgressbar.finishedCancel();
|
|
|
control.guiDisable(false);
|