|
@@ -24,6 +24,7 @@ import javax.swing.tree.TreeNode;
|
|
|
import DataSets.GraphDataSet;
|
|
|
import DataSets.PropertyDataSet;
|
|
|
import classes.HolonObject;
|
|
|
+import classes.TrackedDataSet;
|
|
|
import interfaces.GraphListener;
|
|
|
import ui.controller.Control;
|
|
|
|
|
@@ -52,6 +53,12 @@ import java.awt.FlowLayout;
|
|
|
import java.awt.BorderLayout;
|
|
|
|
|
|
public class splitPane extends JSplitPane implements GraphListener {
|
|
|
+ //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;
|
|
|
+
|
|
|
private JTextField graphNrTxtField;
|
|
|
private JTextField redField;
|
|
|
private JTextField greenField;
|
|
@@ -62,6 +69,7 @@ public class splitPane extends JSplitPane implements GraphListener {
|
|
|
private DefaultMutableTreeNode wholeHolon;
|
|
|
private Hashtable<String, GraphDataSet> objectHashtable;
|
|
|
private Hashtable<String, StatisticGraphPanel> graphHashtable;
|
|
|
+ private Hashtable<String, Integer> propValTable;
|
|
|
private JPanel colorPanel;
|
|
|
private PropertyDataSet currentProperty = new PropertyDataSet();
|
|
|
private JComboBox colorComboBox;
|
|
@@ -74,6 +82,10 @@ public class splitPane extends JSplitPane implements GraphListener {
|
|
|
this.controller = cont;
|
|
|
objectHashtable = new Hashtable<String, GraphDataSet>();
|
|
|
graphHashtable = new Hashtable<String, StatisticGraphPanel>();
|
|
|
+ propValTable = new Hashtable<String, Integer>();
|
|
|
+ propValTable.put("total Production", PRODUCTION);
|
|
|
+ propValTable.put("total Consumption", CONSUMPTION);
|
|
|
+ propValTable.put("number of activated Elements", ACTIVATED_ELEMENTS);
|
|
|
|
|
|
JScrollPane dataPane = new JScrollPane();
|
|
|
setLeftComponent(dataPane);
|
|
@@ -348,8 +360,9 @@ public class splitPane extends JSplitPane implements GraphListener {
|
|
|
return;
|
|
|
}else{
|
|
|
if(selectedNode.getLevel() == 3){
|
|
|
+ StatisticGraphPanel tmp = null;
|
|
|
if(!graphHashtable.containsKey(graphNrTxtField.getText()) && graphNrTxtField.getText().length() > 0){
|
|
|
- StatisticGraphPanel tmp = new StatisticGraphPanel(controller.getModel(), controller, graphNrTxtField.getText(),
|
|
|
+ tmp = new StatisticGraphPanel(controller.getModel(), controller, graphNrTxtField.getText(),
|
|
|
graphHashtable);
|
|
|
tmp.setPreferredSize(new Dimension(280,150));
|
|
|
tmp.setMaximumSize(new Dimension(1000,150));
|
|
@@ -361,6 +374,13 @@ public class splitPane extends JSplitPane implements GraphListener {
|
|
|
graphPanel.updateUI();
|
|
|
graphHashtable.put(graphNrTxtField.getText(), tmp);
|
|
|
}
|
|
|
+ if(tmp != null){
|
|
|
+ String object = ((DefaultMutableTreeNode)selectedNode.getParent()).toString();
|
|
|
+ String property = selectedNode.toString();
|
|
|
+ GraphDataSet dataSet = objectHashtable.get(object);
|
|
|
+ TrackedDataSet tds = new TrackedDataSet(dataSet.getObject(), propValTable.get(property), currentProperty.getColor());
|
|
|
+ tmp.addObjec(tds);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -538,10 +558,10 @@ public class splitPane extends JSplitPane implements GraphListener {
|
|
|
graphPanel.revalidate();
|
|
|
graphPanel.updateUI();
|
|
|
graphScrollPane.setViewportView(graphPanel);
|
|
|
- repaintGraph();
|
|
|
+ repaintTree();
|
|
|
}
|
|
|
@Override
|
|
|
- public void repaintGraph() {
|
|
|
+ public void repaintTree() {
|
|
|
treeModel.reload();
|
|
|
}
|
|
|
@Override
|
|
@@ -600,6 +620,12 @@ public class splitPane extends JSplitPane implements GraphListener {
|
|
|
colorPanel.setBackground(Color.WHITE);
|
|
|
}
|
|
|
|
|
|
+ public void repaintGraphs(){
|
|
|
+ for(StatisticGraphPanel sg: graphHashtable.values()){
|
|
|
+ sg.repaint();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private static void addPopup(Component component, final JPopupMenu popup) {
|
|
|
component.addMouseListener(new MouseAdapter() {
|
|
|
public void mousePressed(MouseEvent e) {
|