|
@@ -57,10 +57,33 @@ import java.awt.BorderLayout;
|
|
|
|
|
|
public class splitPane extends JSplitPane implements GraphListener {
|
|
public class splitPane extends JSplitPane implements GraphListener {
|
|
// Property Integers
|
|
// Property Integers
|
|
- public static final int CONSUMPTION = 0;
|
|
|
|
- public static final int PRODUCTION = 1;
|
|
|
|
- public static final int ACTIVATED_ELEMENTS = 2;
|
|
|
|
- public static final int ON_OFF = 3;
|
|
|
|
|
|
+ public static final int CONS_OBJ_INT = 0;
|
|
|
|
+ public static final int PROD_OBJ_INT = 1;
|
|
|
|
+ public static final int ACTIVE_ELEMENTS_INT = 2;
|
|
|
|
+ public static final int SW_ACTIVE_INT = 3;
|
|
|
|
+ public static final int PROD_HOLON_INT = 4;
|
|
|
|
+ public static final int CONS_HOLON_INT = 5;
|
|
|
|
+ public static final int SUPPLIED_INT = 6;
|
|
|
|
+ public static final int NOT_SUPPLIED_INT = 7;
|
|
|
|
+ public static final int PART_SUPPLIED_INT = 8;
|
|
|
|
+ public static final int GRID_PROD_INT = 9;
|
|
|
|
+ public static final int GRID_CONS_INT = 10;
|
|
|
|
+
|
|
|
|
+ // Property Strings
|
|
|
|
+ public static final String TOT_PROD_HOLON = "total Holon Production";
|
|
|
|
+ public static final String TOT_CONS_HOLON = "total Holon Consumption";
|
|
|
|
+ public static final String SUPPLIED_OBJ = "Percentage of supplied Objects";
|
|
|
|
+ public static final String NOT_SUPPLIED_OBJ = "Percentage of not supplied Objects";
|
|
|
|
+ public static final String PART_SUPPLIED_OBJ = "Percentage of partially supplied Objects";
|
|
|
|
+
|
|
|
|
+ public static final String TOT_PROD_OBJ = "total Production";
|
|
|
|
+ public static final String TOT_CONS_OBJ = "total Consumption";
|
|
|
|
+ public static final String NR_ACTIVE_ELEMENTS = "active Elements";
|
|
|
|
+
|
|
|
|
+ public static final String SW_ACTIVE = "active";
|
|
|
|
+
|
|
|
|
+ public static final String TOT_PROD_GRID = "total Grid Production";
|
|
|
|
+ public static final String TOT_CONS_GRID = "total Grid Consumption";
|
|
|
|
|
|
// editable textfields
|
|
// editable textfields
|
|
private JTextField graphNrTxtField;
|
|
private JTextField graphNrTxtField;
|
|
@@ -78,6 +101,7 @@ public class splitPane extends JSplitPane implements GraphListener {
|
|
|
|
|
|
private Hashtable<String, GraphDataSet> objectHashtable;
|
|
private Hashtable<String, GraphDataSet> objectHashtable;
|
|
private Hashtable<String, StatisticGraphPanel> graphHashtable;
|
|
private Hashtable<String, StatisticGraphPanel> graphHashtable;
|
|
|
|
+ private Hashtable<String, PropertyDataSet> holonHashtable;
|
|
private Hashtable<String, Integer> propValTable;
|
|
private Hashtable<String, Integer> propValTable;
|
|
private JPanel colorPanel;
|
|
private JPanel colorPanel;
|
|
|
|
|
|
@@ -94,10 +118,27 @@ public class splitPane extends JSplitPane implements GraphListener {
|
|
this.controller = cont;
|
|
this.controller = cont;
|
|
objectHashtable = new Hashtable<String, GraphDataSet>();
|
|
objectHashtable = new Hashtable<String, GraphDataSet>();
|
|
graphHashtable = new Hashtable<String, StatisticGraphPanel>();
|
|
graphHashtable = new Hashtable<String, StatisticGraphPanel>();
|
|
|
|
+
|
|
|
|
+ holonHashtable = new Hashtable<String, PropertyDataSet>();
|
|
|
|
+ holonHashtable.put(TOT_PROD_HOLON, new PropertyDataSet());
|
|
|
|
+ holonHashtable.put(TOT_CONS_HOLON, new PropertyDataSet());
|
|
|
|
+ holonHashtable.put(SUPPLIED_OBJ, new PropertyDataSet());
|
|
|
|
+ holonHashtable.put(NOT_SUPPLIED_OBJ, new PropertyDataSet());
|
|
|
|
+ holonHashtable.put(PART_SUPPLIED_OBJ, new PropertyDataSet());
|
|
|
|
+
|
|
|
|
+ //propValTable associates the Strings to the numbers
|
|
propValTable = new Hashtable<String, Integer>();
|
|
propValTable = new Hashtable<String, Integer>();
|
|
- propValTable.put("total Production", PRODUCTION);
|
|
|
|
- propValTable.put("total Consumption", CONSUMPTION);
|
|
|
|
- propValTable.put("activated Elements", ACTIVATED_ELEMENTS);
|
|
|
|
|
|
+ propValTable.put(TOT_PROD_OBJ, PROD_OBJ_INT);
|
|
|
|
+ propValTable.put(TOT_CONS_OBJ, CONS_OBJ_INT);
|
|
|
|
+ propValTable.put(NR_ACTIVE_ELEMENTS, ACTIVE_ELEMENTS_INT);
|
|
|
|
+ propValTable.put(SW_ACTIVE, SW_ACTIVE_INT);
|
|
|
|
+ propValTable.put(TOT_PROD_HOLON, PROD_HOLON_INT);
|
|
|
|
+ propValTable.put(TOT_CONS_HOLON, CONS_HOLON_INT);
|
|
|
|
+ propValTable.put(SUPPLIED_OBJ, SUPPLIED_INT);
|
|
|
|
+ propValTable.put(NOT_SUPPLIED_OBJ, NOT_SUPPLIED_INT);
|
|
|
|
+ propValTable.put(PART_SUPPLIED_OBJ, PART_SUPPLIED_INT);
|
|
|
|
+ propValTable.put(TOT_PROD_GRID, GRID_PROD_INT);
|
|
|
|
+ propValTable.put(TOT_CONS_GRID, GRID_CONS_INT);
|
|
|
|
|
|
JScrollPane dataPane = new JScrollPane();
|
|
JScrollPane dataPane = new JScrollPane();
|
|
setLeftComponent(dataPane);
|
|
setLeftComponent(dataPane);
|
|
@@ -385,6 +426,9 @@ public class splitPane extends JSplitPane implements GraphListener {
|
|
JLabel lblG = new JLabel("G:");
|
|
JLabel lblG = new JLabel("G:");
|
|
|
|
|
|
JLabel lblB = new JLabel("B:");
|
|
JLabel lblB = new JLabel("B:");
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //======================== ADD BUTTON =============================//
|
|
|
|
|
|
JButton btnAdd = new JButton("Add");
|
|
JButton btnAdd = new JButton("Add");
|
|
btnAdd.addActionListener(new ActionListener() {
|
|
btnAdd.addActionListener(new ActionListener() {
|
|
@@ -422,6 +466,8 @@ public class splitPane extends JSplitPane implements GraphListener {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
+
|
|
|
|
+ //============================== ADD BUTTON END ==============================//
|
|
|
|
|
|
colorPanel = new JPanel();
|
|
colorPanel = new JPanel();
|
|
colorPanel.setBorder(new LineBorder(new Color(0, 0, 0)));
|
|
colorPanel.setBorder(new LineBorder(new Color(0, 0, 0)));
|
|
@@ -511,11 +557,11 @@ public class splitPane extends JSplitPane implements GraphListener {
|
|
treeModel = (DefaultTreeModel) objectTree.getModel();
|
|
treeModel = (DefaultTreeModel) objectTree.getModel();
|
|
DefaultMutableTreeNode root = new DefaultMutableTreeNode("Statistics");
|
|
DefaultMutableTreeNode root = new DefaultMutableTreeNode("Statistics");
|
|
wholeHolon = new DefaultMutableTreeNode("whole Holon");
|
|
wholeHolon = new DefaultMutableTreeNode("whole Holon");
|
|
- wholeHolon.add(new DefaultMutableTreeNode("total Production"));
|
|
|
|
- wholeHolon.add(new DefaultMutableTreeNode("total Consumption"));
|
|
|
|
- wholeHolon.add(new DefaultMutableTreeNode("Percentage of Supplied Objects"));
|
|
|
|
- wholeHolon.add(new DefaultMutableTreeNode("Percentage of not Supplied Objects"));
|
|
|
|
- wholeHolon.add(new DefaultMutableTreeNode("Percentage of partially Supplied Objects"));
|
|
|
|
|
|
+ wholeHolon.add(new DefaultMutableTreeNode(TOT_PROD_HOLON));
|
|
|
|
+ wholeHolon.add(new DefaultMutableTreeNode(TOT_CONS_HOLON));
|
|
|
|
+ wholeHolon.add(new DefaultMutableTreeNode(SUPPLIED_OBJ));
|
|
|
|
+ wholeHolon.add(new DefaultMutableTreeNode(NOT_SUPPLIED_OBJ));
|
|
|
|
+ wholeHolon.add(new DefaultMutableTreeNode(PART_SUPPLIED_OBJ));
|
|
|
|
|
|
objectsNode = new DefaultMutableTreeNode("Objects");
|
|
objectsNode = new DefaultMutableTreeNode("Objects");
|
|
objectsNode.add(new DefaultMutableTreeNode("empty"));
|
|
objectsNode.add(new DefaultMutableTreeNode("empty"));
|
|
@@ -545,7 +591,7 @@ public class splitPane extends JSplitPane implements GraphListener {
|
|
.getLastSelectedPathComponent();
|
|
.getLastSelectedPathComponent();
|
|
if (selectedNode.getLevel() == 2 && !selectedNode.getParent().toString().equals("whole Holon")) {
|
|
if (selectedNode.getLevel() == 2 && !selectedNode.getParent().toString().equals("whole Holon")) {
|
|
String object = selectedNode.toString();
|
|
String object = selectedNode.toString();
|
|
- controller.removeTrackingObj((HolonObject) objectHashtable.get(object).getObject());
|
|
|
|
|
|
+ controller.removeTrackingObj(objectHashtable.get(object).getObject());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -569,16 +615,29 @@ public class splitPane extends JSplitPane implements GraphListener {
|
|
if (selectedNode.getLevel() == 1) {
|
|
if (selectedNode.getLevel() == 1) {
|
|
disableFields();
|
|
disableFields();
|
|
currentProperty = null;
|
|
currentProperty = null;
|
|
|
|
+ graphNrTxtField.setText("");
|
|
showObjectlbl.setText(selectedNode.toString());
|
|
showObjectlbl.setText(selectedNode.toString());
|
|
}
|
|
}
|
|
if (selectedNode.getLevel() == 2) {
|
|
if (selectedNode.getLevel() == 2) {
|
|
if (((DefaultMutableTreeNode) selectedNode.getParent()).toString().equals("whole Holon")) {
|
|
if (((DefaultMutableTreeNode) selectedNode.getParent()).toString().equals("whole Holon")) {
|
|
enableFields();
|
|
enableFields();
|
|
- showPropertylbl.setText(selectedNode.toString());
|
|
|
|
- showObjectlbl.setText(selectedNode.getParent().toString());
|
|
|
|
|
|
+ String object = selectedNode.getParent().toString();
|
|
|
|
+ String property = selectedNode.toString();
|
|
|
|
+ currentProperty = holonHashtable.get(property);
|
|
|
|
+ Color color = currentProperty.getColor();
|
|
|
|
+
|
|
|
|
+ redField.setText(Integer.toString(color.getRed()));
|
|
|
|
+ greenField.setText(Integer.toString(color.getGreen()));
|
|
|
|
+ blueField.setText(Integer.toString(color.getBlue()));
|
|
|
|
+
|
|
|
|
+ showPropertylbl.setText(property);
|
|
|
|
+ showObjectlbl.setText(object);
|
|
|
|
+ graphNrTxtField.setText(currentProperty.getAssignedGraph());
|
|
|
|
+ colorPanel.setBackground(color);
|
|
} else {
|
|
} else {
|
|
disableFields();
|
|
disableFields();
|
|
currentProperty = null;
|
|
currentProperty = null;
|
|
|
|
+ graphNrTxtField.setText("");
|
|
showObjectlbl.setText(selectedNode.toString());
|
|
showObjectlbl.setText(selectedNode.toString());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -641,28 +700,28 @@ public class splitPane extends JSplitPane implements GraphListener {
|
|
|
|
|
|
//HolonObjects
|
|
//HolonObjects
|
|
if(abs instanceof HolonObject){
|
|
if(abs instanceof HolonObject){
|
|
- tmp.add(new DefaultMutableTreeNode("total Production"));
|
|
|
|
- tmp.add(new DefaultMutableTreeNode("total Consumption"));
|
|
|
|
- tmp.add(new DefaultMutableTreeNode("activated Elements"));
|
|
|
|
- tmpHash.put("total Production", new PropertyDataSet());
|
|
|
|
- tmpHash.put("total Consumption", new PropertyDataSet());
|
|
|
|
- tmpHash.put("activated Elements", new PropertyDataSet());
|
|
|
|
|
|
+ tmp.add(new DefaultMutableTreeNode(TOT_PROD_OBJ));
|
|
|
|
+ tmp.add(new DefaultMutableTreeNode(TOT_CONS_OBJ));
|
|
|
|
+ tmp.add(new DefaultMutableTreeNode(NR_ACTIVE_ELEMENTS));
|
|
|
|
+ tmpHash.put(TOT_PROD_OBJ, new PropertyDataSet());
|
|
|
|
+ tmpHash.put(TOT_CONS_OBJ, new PropertyDataSet());
|
|
|
|
+ tmpHash.put(NR_ACTIVE_ELEMENTS, new PropertyDataSet());
|
|
objectsNode.add(tmp);
|
|
objectsNode.add(tmp);
|
|
}
|
|
}
|
|
|
|
|
|
//HolonSwitches
|
|
//HolonSwitches
|
|
if(abs instanceof HolonSwitch){
|
|
if(abs instanceof HolonSwitch){
|
|
- tmp.add(new DefaultMutableTreeNode("activated"));
|
|
|
|
- tmpHash.put("activated", new PropertyDataSet());
|
|
|
|
|
|
+ tmp.add(new DefaultMutableTreeNode(SW_ACTIVE));
|
|
|
|
+ tmpHash.put(SW_ACTIVE, new PropertyDataSet());
|
|
switchesNode.add(tmp);
|
|
switchesNode.add(tmp);
|
|
}
|
|
}
|
|
|
|
|
|
//NodesOfNodes
|
|
//NodesOfNodes
|
|
if(abs instanceof CpsUpperNode){
|
|
if(abs instanceof CpsUpperNode){
|
|
- tmp.add(new DefaultMutableTreeNode("total Production"));
|
|
|
|
- tmp.add(new DefaultMutableTreeNode("total Consumption"));
|
|
|
|
- tmpHash.put("total Production", new PropertyDataSet());
|
|
|
|
- tmpHash.put("total Consumption", new PropertyDataSet());
|
|
|
|
|
|
+ tmp.add(new DefaultMutableTreeNode(TOT_PROD_GRID));
|
|
|
|
+ tmp.add(new DefaultMutableTreeNode(TOT_CONS_GRID));
|
|
|
|
+ tmpHash.put(TOT_PROD_GRID, new PropertyDataSet());
|
|
|
|
+ tmpHash.put(TOT_CONS_GRID, new PropertyDataSet());
|
|
gridsNode.add(tmp);
|
|
gridsNode.add(tmp);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -691,7 +750,6 @@ public class splitPane extends JSplitPane implements GraphListener {
|
|
redField.setText("");
|
|
redField.setText("");
|
|
greenField.setText("");
|
|
greenField.setText("");
|
|
blueField.setText("");
|
|
blueField.setText("");
|
|
- // graphNrTxtField.setText("");
|
|
|
|
colorComboBox.setSelectedIndex(0);
|
|
colorComboBox.setSelectedIndex(0);
|
|
}
|
|
}
|
|
|
|
|