|
@@ -68,16 +68,18 @@ import classes.HolonElement;
|
|
import classes.HolonObject;
|
|
import classes.HolonObject;
|
|
import classes.HolonSwitch;
|
|
import classes.HolonSwitch;
|
|
import classes.HolonTransformer;
|
|
import classes.HolonTransformer;
|
|
|
|
+import classes.IdCounter;
|
|
|
|
+import classes.IdCounterElem;
|
|
import ui.controller.Control;
|
|
import ui.controller.Control;
|
|
-import ui.model.Model;
|
|
|
|
-import ui.model.IdCounter;
|
|
|
|
-import ui.model.IdCounterElem;;
|
|
|
|
|
|
+import ui.model.Model;;
|
|
|
|
|
|
/**
|
|
/**
|
|
* Graphical User Interface.
|
|
* Graphical User Interface.
|
|
|
|
+ *
|
|
* @author Gruppe14
|
|
* @author Gruppe14
|
|
*
|
|
*
|
|
- * @param <E> Generic
|
|
|
|
|
|
+ * @param <E>
|
|
|
|
+ * Generic
|
|
*/
|
|
*/
|
|
public class GUI<E> implements CategoryListener {
|
|
public class GUI<E> implements CategoryListener {
|
|
|
|
|
|
@@ -87,9 +89,9 @@ public class GUI<E> implements CategoryListener {
|
|
|
|
|
|
private final JMenuBar menuBar = new JMenuBar();
|
|
private final JMenuBar menuBar = new JMenuBar();
|
|
private final JMenu mnNewMenu = new JMenu("File");
|
|
private final JMenu mnNewMenu = new JMenu("File");
|
|
- private final JMenu mnNewMenu_1 = new JMenu("Edit");
|
|
|
|
- private final JMenu mnNewMenu_2 = new JMenu("Options");
|
|
|
|
- private final JMenu mnNewMenu_3 = new JMenu("View");
|
|
|
|
|
|
+ private final JMenu mnNewMenuEdit = new JMenu("Edit");
|
|
|
|
+ private final JMenu mnNewMenuOptions = new JMenu("Options");
|
|
|
|
+ private final JMenu mnNewMenuView = new JMenu("View");
|
|
private final JMenu mnHelp = new JMenu("Help");
|
|
private final JMenu mnHelp = new JMenu("Help");
|
|
private final JMenuItem mntmOpen = new JMenuItem("Open");
|
|
private final JMenuItem mntmOpen = new JMenuItem("Open");
|
|
private final JMenuItem mntmNew = new JMenuItem("New");
|
|
private final JMenuItem mntmNew = new JMenuItem("New");
|
|
@@ -97,11 +99,11 @@ public class GUI<E> implements CategoryListener {
|
|
private final JMenuItem aboutUs = new JMenuItem("About Us");
|
|
private final JMenuItem aboutUs = new JMenuItem("About Us");
|
|
private final JMenuItem canvasSize = new JMenuItem("View Size");
|
|
private final JMenuItem canvasSize = new JMenuItem("View Size");
|
|
private final JSplitPane splitPane = new JSplitPane();
|
|
private final JSplitPane splitPane = new JSplitPane();
|
|
- private final JSplitPane splitPane_1 = new JSplitPane();
|
|
|
|
- private final JSplitPane splitPane_tree_console = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
|
|
|
|
|
|
+ private final JSplitPane splitPane1 = new JSplitPane();
|
|
|
|
+ private final JSplitPane splitPaneTreeConsole = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
|
|
|
|
|
|
private final JScrollPane canvasSP = new JScrollPane();
|
|
private final JScrollPane canvasSP = new JScrollPane();
|
|
- private final JScrollPane scrollPane_1 = new JScrollPane();
|
|
|
|
|
|
+ private final JScrollPane scrollPane1 = new JScrollPane();
|
|
private final JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
|
|
private final JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
|
|
private JPopupMenu popmenuEdit = new JPopupMenu();
|
|
private JPopupMenu popmenuEdit = new JPopupMenu();
|
|
private JMenuItem editItem = new JMenuItem("Edit Object");
|
|
private JMenuItem editItem = new JMenuItem("Edit Object");
|
|
@@ -117,12 +119,13 @@ public class GUI<E> implements CategoryListener {
|
|
private final JTree tree = new JTree();
|
|
private final JTree tree = new JTree();
|
|
/******************************************
|
|
/******************************************
|
|
************* Right Container*************
|
|
************* Right Container*************
|
|
- ******************************************/
|
|
|
|
- // Right Container: here comes the information about the HolonObject, such
|
|
|
|
- // as HolonElements Information, Properties and Consumption/Production graph
|
|
|
|
-
|
|
|
|
- private final JSplitPane split_HolonEl_Pro = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
|
|
|
|
- private final JSplitPane split_Graph_HolonEl = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
|
|
|
|
|
|
+ ******************************************
|
|
|
|
+ * Right Container: here comes the information about the HolonObject, such
|
|
|
|
+ * as HolonElements Information, Properties and Consumption/Production
|
|
|
|
+ * graph.
|
|
|
|
+ **/
|
|
|
|
+ private final JSplitPane splitHolonElPro = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
|
|
|
|
+ private final JSplitPane splitGraphHolonEl = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
|
|
|
|
|
|
// In this section are all the Holonelements that correspond to the clicked
|
|
// In this section are all the Holonelements that correspond to the clicked
|
|
// HolonObject with consumption/production, name and amount.
|
|
// HolonObject with consumption/production, name and amount.
|
|
@@ -140,9 +143,7 @@ public class GUI<E> implements CategoryListener {
|
|
// Table for Properties --> Cell with (0,1) is editable by CpsObjt and
|
|
// Table for Properties --> Cell with (0,1) is editable by CpsObjt and
|
|
// Cell(3,1) is editable by Edges
|
|
// Cell(3,1) is editable by Edges
|
|
private JTable tableProperties = new JTable() {
|
|
private JTable tableProperties = new JTable() {
|
|
- /**
|
|
|
|
- *
|
|
|
|
- */
|
|
|
|
|
|
+
|
|
private static final long serialVersionUID = 1L;
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -182,7 +183,7 @@ public class GUI<E> implements CategoryListener {
|
|
private AddElementPopUp addElementPopUp;
|
|
private AddElementPopUp addElementPopUp;
|
|
|
|
|
|
private final JPanel panel = new JPanel();
|
|
private final JPanel panel = new JPanel();
|
|
- private final JPanel panel_HolonEl = new JPanel();
|
|
|
|
|
|
+ private final JPanel panelHolonEl = new JPanel();
|
|
private final JComboBox comboBox = new JComboBox();
|
|
private final JComboBox comboBox = new JComboBox();
|
|
// private final JComboBox comboBoxGraph = new JComboBox();
|
|
// private final JComboBox comboBoxGraph = new JComboBox();
|
|
|
|
|
|
@@ -207,22 +208,21 @@ public class GUI<E> implements CategoryListener {
|
|
private Console console = new Console();
|
|
private Console console = new Console();
|
|
private MyCanvas canvas;
|
|
private MyCanvas canvas;
|
|
private UnitGraph unitGraph;
|
|
private UnitGraph unitGraph;
|
|
- private final JSplitPane splitPane_3 = new JSplitPane();
|
|
|
|
|
|
+ private final JSplitPane splitPane3 = new JSplitPane();
|
|
private final JSlider sizeSlider = new JSlider();
|
|
private final JSlider sizeSlider = new JSlider();
|
|
private final JLabel lblImageSize = new JLabel("Image Size");
|
|
private final JLabel lblImageSize = new JLabel("Image Size");
|
|
// Time Stuff
|
|
// Time Stuff
|
|
private TimePanel timePanel;
|
|
private TimePanel timePanel;
|
|
// Coord for all Cells with text
|
|
// Coord for all Cells with text
|
|
- private int yTHIS;
|
|
|
|
- private int xTHIS;
|
|
|
|
|
|
+ private int yThis;
|
|
|
|
+ private int xThis;
|
|
// Coord for all Cells with boolean values (checkbox)
|
|
// Coord for all Cells with boolean values (checkbox)
|
|
- private int yBTHIS;
|
|
|
|
- private int xBTHIS;
|
|
|
|
|
|
+ private int yBTis;
|
|
|
|
+ private int xBThis;
|
|
// Coord for the Edit-Modus in the PropertieTable
|
|
// Coord for the Edit-Modus in the PropertieTable
|
|
private int yProThis;
|
|
private int yProThis;
|
|
private int xProThis;
|
|
private int xProThis;
|
|
private AbstractCpsObject temp = null;
|
|
private AbstractCpsObject temp = null;
|
|
- private final JButton btnTest = new JButton("test");
|
|
|
|
private final JMenuItem mntmUndo = new JMenuItem("Undo");
|
|
private final JMenuItem mntmUndo = new JMenuItem("Undo");
|
|
private final JMenuItem mntmRedo = new JMenuItem("Redo");
|
|
private final JMenuItem mntmRedo = new JMenuItem("Redo");
|
|
private final JMenuItem mntmEditEdges = new JMenuItem("Edit Edges");
|
|
private final JMenuItem mntmEditEdges = new JMenuItem("Edit Edges");
|
|
@@ -232,6 +232,9 @@ public class GUI<E> implements CategoryListener {
|
|
|
|
|
|
/**
|
|
/**
|
|
* Create the application.
|
|
* Create the application.
|
|
|
|
+ *
|
|
|
|
+ * @param control
|
|
|
|
+ * the Controller
|
|
*/
|
|
*/
|
|
public GUI(Control control) {
|
|
public GUI(Control control) {
|
|
this.controller = control;
|
|
this.controller = control;
|
|
@@ -278,9 +281,6 @@ public class GUI<E> implements CategoryListener {
|
|
inputMap.put(KeyStroke.getKeyStroke("control Z"), cntrlZDown);
|
|
inputMap.put(KeyStroke.getKeyStroke("control Z"), cntrlZDown);
|
|
actionMap.put(cntrlZDown, new AbstractAction() {
|
|
actionMap.put(cntrlZDown, new AbstractAction() {
|
|
|
|
|
|
- /**
|
|
|
|
- *
|
|
|
|
- */
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -304,9 +304,9 @@ public class GUI<E> implements CategoryListener {
|
|
}
|
|
}
|
|
unitGraph.empty();
|
|
unitGraph.empty();
|
|
controller.addTextToConsole("undo", Color.BLACK, 12, false, false, true);
|
|
controller.addTextToConsole("undo", Color.BLACK, 12, false, false, true);
|
|
- } catch (IOException f) {
|
|
|
|
|
|
+ } catch (IOException eex) {
|
|
// TODO Auto-generated catch block
|
|
// TODO Auto-generated catch block
|
|
- f.printStackTrace();
|
|
|
|
|
|
+ eex.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -315,9 +315,6 @@ public class GUI<E> implements CategoryListener {
|
|
inputMap.put(KeyStroke.getKeyStroke("control Y"), cntrlYDown);
|
|
inputMap.put(KeyStroke.getKeyStroke("control Y"), cntrlYDown);
|
|
actionMap.put(cntrlYDown, new AbstractAction() {
|
|
actionMap.put(cntrlYDown, new AbstractAction() {
|
|
|
|
|
|
- /**
|
|
|
|
- *
|
|
|
|
- */
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -341,9 +338,9 @@ public class GUI<E> implements CategoryListener {
|
|
}
|
|
}
|
|
unitGraph.empty();
|
|
unitGraph.empty();
|
|
controller.addTextToConsole("redo", Color.BLACK, 12, false, false, true);
|
|
controller.addTextToConsole("redo", Color.BLACK, 12, false, false, true);
|
|
- } catch (IOException f) {
|
|
|
|
|
|
+ } catch (IOException ex) {
|
|
// TODO Auto-generated catch block
|
|
// TODO Auto-generated catch block
|
|
- f.printStackTrace();
|
|
|
|
|
|
+ ex.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -351,9 +348,7 @@ public class GUI<E> implements CategoryListener {
|
|
String cntrlADown = "controlA";
|
|
String cntrlADown = "controlA";
|
|
inputMap.put(KeyStroke.getKeyStroke("control A"), cntrlADown);
|
|
inputMap.put(KeyStroke.getKeyStroke("control A"), cntrlADown);
|
|
actionMap.put(cntrlADown, new AbstractAction() {
|
|
actionMap.put(cntrlADown, new AbstractAction() {
|
|
- /**
|
|
|
|
- *
|
|
|
|
- */
|
|
|
|
|
|
+
|
|
private static final long serialVersionUID = 1L;
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -369,9 +364,7 @@ public class GUI<E> implements CategoryListener {
|
|
String delDown = "delete";
|
|
String delDown = "delete";
|
|
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0, false), delDown);
|
|
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0, false), delDown);
|
|
actionMap.put(delDown, new AbstractAction() {
|
|
actionMap.put(delDown, new AbstractAction() {
|
|
- /**
|
|
|
|
- *
|
|
|
|
- */
|
|
|
|
|
|
+
|
|
private static final long serialVersionUID = 1L;
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -380,15 +373,6 @@ public class GUI<E> implements CategoryListener {
|
|
controller.delCanvasObject(cps);
|
|
controller.delCanvasObject(cps);
|
|
}
|
|
}
|
|
model.getSelectedCpsObjects().clear();
|
|
model.getSelectedCpsObjects().clear();
|
|
- /*
|
|
|
|
- * controller.setSelectedObjectID(0); for (int i =
|
|
|
|
- * tableModelHolonElementMulti.getRowCount() - 1; i > -1; i--) {
|
|
|
|
- * tableModelHolonElementMulti.removeRow(i); } for (int i =
|
|
|
|
- * tableModelHolonElementSingle.getRowCount() - 1; i > -1; i--)
|
|
|
|
- * { tableModelHolonElementSingle.removeRow(i); } for (int i =
|
|
|
|
- * tableModelProperties.getRowCount() - 1; i > -1; i--) {
|
|
|
|
- * tableModelProperties.removeRow(i); }
|
|
|
|
- */
|
|
|
|
canvas.repaint();
|
|
canvas.repaint();
|
|
unitGraph.empty();
|
|
unitGraph.empty();
|
|
}
|
|
}
|
|
@@ -398,9 +382,6 @@ public class GUI<E> implements CategoryListener {
|
|
inputMap.put(KeyStroke.getKeyStroke("control F"), cntrlFDown);
|
|
inputMap.put(KeyStroke.getKeyStroke("control F"), cntrlFDown);
|
|
actionMap.put(cntrlFDown, new AbstractAction() {
|
|
actionMap.put(cntrlFDown, new AbstractAction() {
|
|
|
|
|
|
- /**
|
|
|
|
- *
|
|
|
|
- */
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -415,9 +396,6 @@ public class GUI<E> implements CategoryListener {
|
|
inputMap.put(KeyStroke.getKeyStroke("control C"), cntrlCDown);
|
|
inputMap.put(KeyStroke.getKeyStroke("control C"), cntrlCDown);
|
|
actionMap.put(cntrlCDown, new AbstractAction() {
|
|
actionMap.put(cntrlCDown, new AbstractAction() {
|
|
|
|
|
|
- /**
|
|
|
|
- *
|
|
|
|
- */
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -435,9 +413,6 @@ public class GUI<E> implements CategoryListener {
|
|
inputMap.put(KeyStroke.getKeyStroke("control V"), cntrlVDown);
|
|
inputMap.put(KeyStroke.getKeyStroke("control V"), cntrlVDown);
|
|
actionMap.put(cntrlVDown, new AbstractAction() {
|
|
actionMap.put(cntrlVDown, new AbstractAction() {
|
|
|
|
|
|
- /**
|
|
|
|
- *
|
|
|
|
- */
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -451,9 +426,6 @@ public class GUI<E> implements CategoryListener {
|
|
inputMap.put(KeyStroke.getKeyStroke("control X"), cntrlXDown);
|
|
inputMap.put(KeyStroke.getKeyStroke("control X"), cntrlXDown);
|
|
actionMap.put(cntrlXDown, new AbstractAction() {
|
|
actionMap.put(cntrlXDown, new AbstractAction() {
|
|
|
|
|
|
- /**
|
|
|
|
- *
|
|
|
|
- */
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -481,11 +453,11 @@ public class GUI<E> implements CategoryListener {
|
|
|
|
|
|
mnNewMenu.add(mntmSave);
|
|
mnNewMenu.add(mntmSave);
|
|
|
|
|
|
- menuBar.add(mnNewMenu_1);
|
|
|
|
|
|
+ menuBar.add(mnNewMenuEdit);
|
|
|
|
|
|
- mnNewMenu_1.add(mntmUndo);
|
|
|
|
|
|
+ mnNewMenuEdit.add(mntmUndo);
|
|
|
|
|
|
- mnNewMenu_1.add(mntmRedo);
|
|
|
|
|
|
+ mnNewMenuEdit.add(mntmRedo);
|
|
mntmFindReplace.addActionListener(new ActionListener() {
|
|
mntmFindReplace.addActionListener(new ActionListener() {
|
|
public void actionPerformed(ActionEvent e) {
|
|
public void actionPerformed(ActionEvent e) {
|
|
try {
|
|
try {
|
|
@@ -493,28 +465,28 @@ public class GUI<E> implements CategoryListener {
|
|
SearchPopUp dialog = new SearchPopUp(controller, canvas);
|
|
SearchPopUp dialog = new SearchPopUp(controller, canvas);
|
|
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
|
|
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
|
|
dialog.setVisible(true);
|
|
dialog.setVisible(true);
|
|
- } catch (Exception e1) {
|
|
|
|
- e1.printStackTrace();
|
|
|
|
|
|
+ } catch (Exception ex) {
|
|
|
|
+ ex.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
- mnNewMenu_1.add(mntmFindReplace);
|
|
|
|
|
|
+ mnNewMenuEdit.add(mntmFindReplace);
|
|
mntmEditShowedInformation.addActionListener(new ActionListener() {
|
|
mntmEditShowedInformation.addActionListener(new ActionListener() {
|
|
public void actionPerformed(ActionEvent e) {
|
|
public void actionPerformed(ActionEvent e) {
|
|
try {
|
|
try {
|
|
ShowedInformationPopUp dialog = new ShowedInformationPopUp(canvas);
|
|
ShowedInformationPopUp dialog = new ShowedInformationPopUp(canvas);
|
|
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
|
|
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
|
|
dialog.setVisible(true);
|
|
dialog.setVisible(true);
|
|
- } catch (Exception e1) {
|
|
|
|
- e1.printStackTrace();
|
|
|
|
|
|
+ } catch (Exception ex) {
|
|
|
|
+ ex.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
- mnNewMenu_1.add(mntmEditShowedInformation);
|
|
|
|
|
|
+ mnNewMenuEdit.add(mntmEditShowedInformation);
|
|
|
|
|
|
- menuBar.add(mnNewMenu_2);
|
|
|
|
|
|
+ menuBar.add(mnNewMenuOptions);
|
|
mntmEditEdges.addActionListener(new ActionListener() {
|
|
mntmEditEdges.addActionListener(new ActionListener() {
|
|
public void actionPerformed(ActionEvent e) {
|
|
public void actionPerformed(ActionEvent e) {
|
|
EditEdgesPopUp edgePopUp = new EditEdgesPopUp();
|
|
EditEdgesPopUp edgePopUp = new EditEdgesPopUp();
|
|
@@ -524,9 +496,9 @@ public class GUI<E> implements CategoryListener {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
- mnNewMenu_2.add(mntmEditEdges);
|
|
|
|
|
|
+ mnNewMenuOptions.add(mntmEditEdges);
|
|
|
|
|
|
- mnNewMenu_2.add(mntmResetCategory);
|
|
|
|
|
|
+ mnNewMenuOptions.add(mntmResetCategory);
|
|
mntmResetCategory.addActionListener(new ActionListener() {
|
|
mntmResetCategory.addActionListener(new ActionListener() {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -541,9 +513,9 @@ public class GUI<E> implements CategoryListener {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
- menuBar.add(mnNewMenu_3);
|
|
|
|
|
|
+ menuBar.add(mnNewMenuView);
|
|
|
|
|
|
- mnNewMenu_3.add(canvasSize);
|
|
|
|
|
|
+ mnNewMenuView.add(canvasSize);
|
|
canvasSize.addActionListener(new ActionListener() {
|
|
canvasSize.addActionListener(new ActionListener() {
|
|
@Override
|
|
@Override
|
|
public void actionPerformed(ActionEvent e) {
|
|
public void actionPerformed(ActionEvent e) {
|
|
@@ -559,7 +531,7 @@ public class GUI<E> implements CategoryListener {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
- mnNewMenu_3.add(splitPane_3);
|
|
|
|
|
|
+ mnNewMenuView.add(splitPane3);
|
|
|
|
|
|
sizeSlider.setMinimum(15);
|
|
sizeSlider.setMinimum(15);
|
|
sizeSlider.setMaximum(115);
|
|
sizeSlider.setMaximum(115);
|
|
@@ -568,13 +540,12 @@ public class GUI<E> implements CategoryListener {
|
|
public void stateChanged(ChangeEvent e) {
|
|
public void stateChanged(ChangeEvent e) {
|
|
controller.setScale(sizeSlider.getValue());
|
|
controller.setScale(sizeSlider.getValue());
|
|
tree.setRowHeight(50);
|
|
tree.setRowHeight(50);
|
|
- canvas.objectSelectionHighlighting();
|
|
|
|
canvas.repaint();
|
|
canvas.repaint();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- splitPane_3.setRightComponent(sizeSlider);
|
|
|
|
|
|
+ splitPane3.setRightComponent(sizeSlider);
|
|
|
|
|
|
- splitPane_3.setLeftComponent(lblImageSize);
|
|
|
|
|
|
+ splitPane3.setLeftComponent(lblImageSize);
|
|
|
|
|
|
menuBar.add(mnHelp);
|
|
menuBar.add(mnHelp);
|
|
|
|
|
|
@@ -599,13 +570,13 @@ public class GUI<E> implements CategoryListener {
|
|
tableHolonElement.setColumnSelectionAllowed(true);
|
|
tableHolonElement.setColumnSelectionAllowed(true);
|
|
tableHolonElementScrollPane.setViewportView(tableHolonElement);
|
|
tableHolonElementScrollPane.setViewportView(tableHolonElement);
|
|
scrollElements.setLayout(new BorderLayout(0, 0));
|
|
scrollElements.setLayout(new BorderLayout(0, 0));
|
|
- scrollElements.add(panel_HolonEl, BorderLayout.NORTH);
|
|
|
|
|
|
+ scrollElements.add(panelHolonEl, BorderLayout.NORTH);
|
|
scrollElements.add(tableHolonElementScrollPane);
|
|
scrollElements.add(tableHolonElementScrollPane);
|
|
- panel_HolonEl.setLayout(new BoxLayout(panel_HolonEl, BoxLayout.X_AXIS));
|
|
|
|
|
|
+ panelHolonEl.setLayout(new BoxLayout(panelHolonEl, BoxLayout.X_AXIS));
|
|
toolBarHolonEl.add(btnAddHolEL);
|
|
toolBarHolonEl.add(btnAddHolEL);
|
|
toolBarHolonEl.add(btnDelHolEL);
|
|
toolBarHolonEl.add(btnDelHolEL);
|
|
toolBarHolonEl.setFloatable(false);
|
|
toolBarHolonEl.setFloatable(false);
|
|
- panel_HolonEl.add(toolBarHolonEl);
|
|
|
|
|
|
+ panelHolonEl.add(toolBarHolonEl);
|
|
|
|
|
|
// Set up of the Properties section
|
|
// Set up of the Properties section
|
|
Object[] colNames = { "Field", "Information" };
|
|
Object[] colNames = { "Field", "Information" };
|
|
@@ -739,8 +710,8 @@ public class GUI<E> implements CategoryListener {
|
|
// if any HolonElement is double-clicked --> Edit-Mode started
|
|
// if any HolonElement is double-clicked --> Edit-Mode started
|
|
// for selected HolonElement
|
|
// for selected HolonElement
|
|
if (e.getClickCount() == 2) {
|
|
if (e.getClickCount() == 2) {
|
|
- yTHIS = e.getY();
|
|
|
|
- xTHIS = e.getX();
|
|
|
|
|
|
+ yThis = e.getY();
|
|
|
|
+ xThis = e.getX();
|
|
}
|
|
}
|
|
// for single click and empty slot
|
|
// for single click and empty slot
|
|
if (e.getClickCount() == 1 && ele == null) {
|
|
if (e.getClickCount() == 1 && ele == null) {
|
|
@@ -748,8 +719,8 @@ public class GUI<E> implements CategoryListener {
|
|
holonEleNamesDisplayed = "None ";
|
|
holonEleNamesDisplayed = "None ";
|
|
}
|
|
}
|
|
elementGraph.setText(holonEleNamesDisplayed);
|
|
elementGraph.setText(holonEleNamesDisplayed);
|
|
- yBTHIS = e.getY();
|
|
|
|
- xBTHIS = e.getX();
|
|
|
|
|
|
+ yBTis = e.getY();
|
|
|
|
+ xBThis = e.getX();
|
|
|
|
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -761,14 +732,14 @@ public class GUI<E> implements CategoryListener {
|
|
@Override
|
|
@Override
|
|
public void propertyChange(PropertyChangeEvent evt) {
|
|
public void propertyChange(PropertyChangeEvent evt) {
|
|
try {
|
|
try {
|
|
- int yMouse = yTHIS;
|
|
|
|
- int yBMouse = yBTHIS;
|
|
|
|
|
|
+ int yMouse = yThis;
|
|
|
|
+ int yBMouse = yBTis;
|
|
int selectedValueY = (int) Math.floor(yMouse / 16);
|
|
int selectedValueY = (int) Math.floor(yMouse / 16);
|
|
int selectedValueBY = (int) Math.floor(yBMouse / 16);
|
|
int selectedValueBY = (int) Math.floor(yBMouse / 16);
|
|
// for multi-selection mode
|
|
// for multi-selection mode
|
|
if (model.getSelectedCpsObjects().size() > 1) {
|
|
if (model.getSelectedCpsObjects().size() > 1) {
|
|
- int selectedValueX = (int) Math.floor(xTHIS / (tableHolonElement.getWidth() / 6));
|
|
|
|
- int selectedValueBX = (int) Math.floor(xBTHIS / (tableHolonElement.getWidth() / 6));
|
|
|
|
|
|
+ int selectedValueX = (int) Math.floor(xThis / (tableHolonElement.getWidth() / 6));
|
|
|
|
+ int selectedValueBX = (int) Math.floor(xBThis / (tableHolonElement.getWidth() / 6));
|
|
if (getHolonObj(yMouse) != null) {
|
|
if (getHolonObj(yMouse) != null) {
|
|
// For last column (boolean with a checkbox)
|
|
// For last column (boolean with a checkbox)
|
|
if (selectedValueBX == 5) {
|
|
if (selectedValueBX == 5) {
|
|
@@ -800,8 +771,8 @@ public class GUI<E> implements CategoryListener {
|
|
}
|
|
}
|
|
} // For single-selection mode
|
|
} // For single-selection mode
|
|
else if (model.getSelectedCpsObjects().size() == 1) {
|
|
else if (model.getSelectedCpsObjects().size() == 1) {
|
|
- int selectedValueX = (int) Math.floor(xTHIS / (tableHolonElement.getWidth() / 5));
|
|
|
|
- int selectedValueBX = (int) Math.floor(xBTHIS / (tableHolonElement.getWidth() / 5));
|
|
|
|
|
|
+ int selectedValueX = (int) Math.floor(xThis / (tableHolonElement.getWidth() / 5));
|
|
|
|
+ int selectedValueBX = (int) Math.floor(xBThis / (tableHolonElement.getWidth() / 5));
|
|
if (getActualCps() != null && getActualCps().getClass() == HolonObject.class) {
|
|
if (getActualCps() != null && getActualCps().getClass() == HolonObject.class) {
|
|
// For last column (boolean with a checkbox)
|
|
// For last column (boolean with a checkbox)
|
|
if (selectedValueBX == 4) {
|
|
if (selectedValueBX == 4) {
|
|
@@ -1001,7 +972,7 @@ public class GUI<E> implements CategoryListener {
|
|
canvas.repaint();
|
|
canvas.repaint();
|
|
dragging = false;
|
|
dragging = false;
|
|
}
|
|
}
|
|
- } catch (Exception e2) {
|
|
|
|
|
|
+ } catch (Exception eex) {
|
|
}
|
|
}
|
|
frmCyberPhysical.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
|
frmCyberPhysical.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
|
}
|
|
}
|
|
@@ -1066,7 +1037,7 @@ public class GUI<E> implements CategoryListener {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- } catch (Exception e2) {
|
|
|
|
|
|
+ } catch (Exception eex) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -1080,9 +1051,9 @@ public class GUI<E> implements CategoryListener {
|
|
addObjectPopUP.setVisible(true);
|
|
addObjectPopUP.setVisible(true);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- scrollPane_1.setViewportView(tree);
|
|
|
|
|
|
+ scrollPane1.setViewportView(tree);
|
|
|
|
|
|
- scrollPane_1.setColumnHeaderView(panel);
|
|
|
|
|
|
+ scrollPane1.setColumnHeaderView(panel);
|
|
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
|
|
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
|
|
toolBar.setFloatable(false);
|
|
toolBar.setFloatable(false);
|
|
|
|
|
|
@@ -1216,11 +1187,11 @@ public class GUI<E> implements CategoryListener {
|
|
deleteRows(tableModelHolonElementMulti);
|
|
deleteRows(tableModelHolonElementMulti);
|
|
}
|
|
}
|
|
// For Objects the only editable cell is the name
|
|
// For Objects the only editable cell is the name
|
|
- ArrayList<CpsEdge> temp_array = temp.getConnections();
|
|
|
|
|
|
+ ArrayList<CpsEdge> tempArray = temp.getConnections();
|
|
// If the clicked object has connections
|
|
// If the clicked object has connections
|
|
- if (!temp_array.isEmpty()) {
|
|
|
|
|
|
+ if (!tempArray.isEmpty()) {
|
|
boolean first = true;
|
|
boolean first = true;
|
|
- for (CpsEdge temp2 : temp_array) {
|
|
|
|
|
|
+ for (CpsEdge temp2 : tempArray) {
|
|
if (first) {
|
|
if (first) {
|
|
first = false;
|
|
first = false;
|
|
if (temp.getID() != temp2.getA().getID()) {
|
|
if (temp.getID() != temp2.getA().getID()) {
|
|
@@ -1343,7 +1314,6 @@ public class GUI<E> implements CategoryListener {
|
|
unitGraph.empty();
|
|
unitGraph.empty();
|
|
elementGraph.setText("None ");
|
|
elementGraph.setText("None ");
|
|
canvas.tempCps = null;
|
|
canvas.tempCps = null;
|
|
- canvas.objectSelectionHighlighting();
|
|
|
|
canvas.repaint();
|
|
canvas.repaint();
|
|
IdCounter.resetCounter();
|
|
IdCounter.resetCounter();
|
|
IdCounterElem.resetCounter();
|
|
IdCounterElem.resetCounter();
|
|
@@ -1504,23 +1474,23 @@ public class GUI<E> implements CategoryListener {
|
|
unitGraph.repaint();
|
|
unitGraph.repaint();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- splitPane.setRightComponent(splitPane_1);
|
|
|
|
|
|
+ splitPane.setRightComponent(splitPane1);
|
|
splitPane.setDividerLocation(200);
|
|
splitPane.setDividerLocation(200);
|
|
- splitPane_1.setDividerLocation(500);
|
|
|
|
- splitPane_tree_console.setDividerLocation(500);
|
|
|
|
-
|
|
|
|
- splitPane.setLeftComponent(splitPane_tree_console);
|
|
|
|
- splitPane_tree_console.setLeftComponent(scrollPane_1);
|
|
|
|
- splitPane_tree_console.setRightComponent(console);
|
|
|
|
- splitPane_1.setLeftComponent(canvasSP);
|
|
|
|
- splitPane_1.setRightComponent(split_HolonEl_Pro);
|
|
|
|
-
|
|
|
|
- split_HolonEl_Pro.setDividerLocation(400);
|
|
|
|
- split_HolonEl_Pro.setTopComponent(split_Graph_HolonEl);
|
|
|
|
- split_HolonEl_Pro.setBottomComponent(scrollProperties);
|
|
|
|
- split_Graph_HolonEl.setDividerLocation(150);
|
|
|
|
- split_Graph_HolonEl.setTopComponent(scrollGraph);
|
|
|
|
- split_Graph_HolonEl.setBottomComponent(scrollElements);
|
|
|
|
|
|
+ splitPane1.setDividerLocation(500);
|
|
|
|
+ splitPaneTreeConsole.setDividerLocation(500);
|
|
|
|
+
|
|
|
|
+ splitPane.setLeftComponent(splitPaneTreeConsole);
|
|
|
|
+ splitPaneTreeConsole.setLeftComponent(scrollPane1);
|
|
|
|
+ splitPaneTreeConsole.setRightComponent(console);
|
|
|
|
+ splitPane1.setLeftComponent(canvasSP);
|
|
|
|
+ splitPane1.setRightComponent(splitHolonElPro);
|
|
|
|
+
|
|
|
|
+ splitHolonElPro.setDividerLocation(400);
|
|
|
|
+ splitHolonElPro.setTopComponent(splitGraphHolonEl);
|
|
|
|
+ splitHolonElPro.setBottomComponent(scrollProperties);
|
|
|
|
+ splitGraphHolonEl.setDividerLocation(150);
|
|
|
|
+ splitGraphHolonEl.setTopComponent(scrollGraph);
|
|
|
|
+ splitGraphHolonEl.setBottomComponent(scrollElements);
|
|
canvasSP.setViewportView(canvas);
|
|
canvasSP.setViewportView(canvas);
|
|
canvasSP.setColumnHeaderView(simMenu);
|
|
canvasSP.setColumnHeaderView(simMenu);
|
|
simMenu.setBackground(new Color(240, 240, 240));
|
|
simMenu.setBackground(new Color(240, 240, 240));
|
|
@@ -1530,20 +1500,25 @@ public class GUI<E> implements CategoryListener {
|
|
scrollGraph.setBorder(null);
|
|
scrollGraph.setBorder(null);
|
|
scrollElements.setBorder(null);
|
|
scrollElements.setBorder(null);
|
|
splitPane.setBorder(null);
|
|
splitPane.setBorder(null);
|
|
- splitPane_1.setBorder(null);
|
|
|
|
- splitPane_tree_console.setBorder(null);
|
|
|
|
- split_HolonEl_Pro.setBorder(null);
|
|
|
|
- split_Graph_HolonEl.setBorder(null);
|
|
|
|
- panel_HolonEl.setBorder(null);
|
|
|
|
|
|
+ splitPane1.setBorder(null);
|
|
|
|
+ splitPaneTreeConsole.setBorder(null);
|
|
|
|
+ splitHolonElPro.setBorder(null);
|
|
|
|
+ splitGraphHolonEl.setBorder(null);
|
|
|
|
+ panelHolonEl.setBorder(null);
|
|
|
|
|
|
tableHolonElementScrollPane.setBorder(null);
|
|
tableHolonElementScrollPane.setBorder(null);
|
|
|
|
|
|
frmCyberPhysical.getContentPane().add(timePanel, BorderLayout.SOUTH);
|
|
frmCyberPhysical.getContentPane().add(timePanel, BorderLayout.SOUTH);
|
|
}
|
|
}
|
|
|
|
|
|
- /*
|
|
|
|
|
|
+ /**
|
|
* adds a specific object type to selected Category also handles input
|
|
* adds a specific object type to selected Category also handles input
|
|
- * windows and illegal inputs
|
|
|
|
|
|
+ * windows and illegal inputs.
|
|
|
|
+ *
|
|
|
|
+ * @param objType
|
|
|
|
+ * type of the Object
|
|
|
|
+ * @param selectedNode
|
|
|
|
+ * The selected Node
|
|
*/
|
|
*/
|
|
public void addObjectAction(String objType, DefaultMutableTreeNode selectedNode) {
|
|
public void addObjectAction(String objType, DefaultMutableTreeNode selectedNode) {
|
|
if (selectedNode == null) {
|
|
if (selectedNode == null) {
|
|
@@ -1572,25 +1547,26 @@ public class GUI<E> implements CategoryListener {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * reloads the Categories from Model
|
|
|
|
|
|
+ * reloads the Categories from Model.
|
|
|
|
+ *
|
|
|
|
+ * @param categories
|
|
|
|
+ * the current categories
|
|
*/
|
|
*/
|
|
public void updateCategories(final ArrayList<Category> categories) {
|
|
public void updateCategories(final ArrayList<Category> categories) {
|
|
tree.setModel(new DefaultTreeModel(new DefaultMutableTreeNode("Categories") {
|
|
tree.setModel(new DefaultTreeModel(new DefaultMutableTreeNode("Categories") {
|
|
- /**
|
|
|
|
- *
|
|
|
|
- */
|
|
|
|
|
|
+
|
|
private static final long serialVersionUID = 1L;
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
|
|
{
|
|
{
|
|
- DefaultMutableTreeNode node_1;
|
|
|
|
|
|
+ DefaultMutableTreeNode node1;
|
|
for (Category c : categories) {
|
|
for (Category c : categories) {
|
|
- node_1 = new DefaultMutableTreeNode(c.getName());
|
|
|
|
|
|
+ node1 = new DefaultMutableTreeNode(c.getName());
|
|
|
|
|
|
// kann eventuell umgeändert werden
|
|
// kann eventuell umgeändert werden
|
|
for (AbstractCpsObject obj : c.getObjects()) {
|
|
for (AbstractCpsObject obj : c.getObjects()) {
|
|
- node_1.add(new DefaultMutableTreeNode(obj.getObjName()));
|
|
|
|
|
|
+ node1.add(new DefaultMutableTreeNode(obj.getObjName()));
|
|
}
|
|
}
|
|
- add(node_1);
|
|
|
|
|
|
+ add(node1);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
@@ -1598,7 +1574,10 @@ public class GUI<E> implements CategoryListener {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
+ * When changes are made to the Categories.
|
|
*
|
|
*
|
|
|
|
+ * @param categories
|
|
|
|
+ * the Categories
|
|
*/
|
|
*/
|
|
public void onChange(ArrayList<Category> categories) {
|
|
public void onChange(ArrayList<Category> categories) {
|
|
DefaultTreeModel model = (DefaultTreeModel) tree.getModel();
|
|
DefaultTreeModel model = (DefaultTreeModel) tree.getModel();
|
|
@@ -1607,15 +1586,16 @@ public class GUI<E> implements CategoryListener {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
+ * Get the Frame.
|
|
*
|
|
*
|
|
- * @return
|
|
|
|
|
|
+ * @return the Frame
|
|
*/
|
|
*/
|
|
public JFrame getFrmCyberPhysical() {
|
|
public JFrame getFrmCyberPhysical() {
|
|
return frmCyberPhysical;
|
|
return frmCyberPhysical;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * Getter for selected CpsObject
|
|
|
|
|
|
+ * Getter for selected CpsObject.
|
|
*
|
|
*
|
|
* @return selected CpsObject
|
|
* @return selected CpsObject
|
|
*/
|
|
*/
|
|
@@ -1626,7 +1606,7 @@ public class GUI<E> implements CategoryListener {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * Search for actual selected HolonElement
|
|
|
|
|
|
+ * Search for actual selected HolonElement.
|
|
*
|
|
*
|
|
* @param obj
|
|
* @param obj
|
|
* selected HolonObject, if obj==null means multi-selection
|
|
* selected HolonObject, if obj==null means multi-selection
|
|
@@ -1693,9 +1673,10 @@ public class GUI<E> implements CategoryListener {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * Search for clicked HolonObject through the mouse's y-Coord
|
|
|
|
|
|
+ * Search for clicked HolonObject through the mouse's y-Coord.
|
|
*
|
|
*
|
|
* @param yValue
|
|
* @param yValue
|
|
|
|
+ * the Y Coordination
|
|
* @return clicked HolonObject
|
|
* @return clicked HolonObject
|
|
*/
|
|
*/
|
|
private HolonObject getHolonObj(int yValue) {
|
|
private HolonObject getHolonObj(int yValue) {
|
|
@@ -1709,7 +1690,7 @@ public class GUI<E> implements CategoryListener {
|
|
|
|
|
|
/**
|
|
/**
|
|
* Update the HolonElement Table, that means erase all rows and add the new
|
|
* Update the HolonElement Table, that means erase all rows and add the new
|
|
- * rows with new data
|
|
|
|
|
|
+ * rows with new data.
|
|
*/
|
|
*/
|
|
private void refreshTableHolonElement() {
|
|
private void refreshTableHolonElement() {
|
|
// Update of the Information about the HolonElements - only for
|
|
// Update of the Information about the HolonElements - only for
|
|
@@ -1727,7 +1708,10 @@ public class GUI<E> implements CategoryListener {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * Erase all information of the HolonElement Model
|
|
|
|
|
|
+ * Erase all information of the HolonElement Model.
|
|
|
|
+ *
|
|
|
|
+ * @param t
|
|
|
|
+ * the Table
|
|
*/
|
|
*/
|
|
private void deleteRows(PropertyTable t) {
|
|
private void deleteRows(PropertyTable t) {
|
|
if (t.getRowCount() > 0) {
|
|
if (t.getRowCount() > 0) {
|
|
@@ -1739,9 +1723,9 @@ public class GUI<E> implements CategoryListener {
|
|
|
|
|
|
/**
|
|
/**
|
|
* Add the Information of the given ArrayList in the HolonElement Model as
|
|
* Add the Information of the given ArrayList in the HolonElement Model as
|
|
- * Name,Energy and Amount
|
|
|
|
|
|
+ * Name,Energy and Amount.
|
|
*
|
|
*
|
|
- * @param elements
|
|
|
|
|
|
+ * @param objects
|
|
* ArrayList to be displayed
|
|
* ArrayList to be displayed
|
|
*/
|
|
*/
|
|
private void fillElementTable(ArrayList<AbstractCpsObject> objects) {
|
|
private void fillElementTable(ArrayList<AbstractCpsObject> objects) {
|
|
@@ -1767,7 +1751,7 @@ public class GUI<E> implements CategoryListener {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * Update the information concerning properties of the selected CpsObject
|
|
|
|
|
|
+ * Update the information concerning properties of the selected CpsObject.
|
|
*/
|
|
*/
|
|
private void refreshTableProperties() {
|
|
private void refreshTableProperties() {
|
|
if (model.getSelectedCpsObjects().size() == 1) {
|
|
if (model.getSelectedCpsObjects().size() == 1) {
|
|
@@ -1780,6 +1764,12 @@ public class GUI<E> implements CategoryListener {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Adds a Popup.
|
|
|
|
+ *
|
|
|
|
+ * @param component Component
|
|
|
|
+ * @param popup PopupMenu
|
|
|
|
+ */
|
|
private static void addPopup(Component component, final JPopupMenu popup) {
|
|
private static void addPopup(Component component, final JPopupMenu popup) {
|
|
component.addMouseListener(new MouseAdapter() {
|
|
component.addMouseListener(new MouseAdapter() {
|
|
public void mousePressed(MouseEvent e) {
|
|
public void mousePressed(MouseEvent e) {
|