|
@@ -83,6 +83,7 @@ public class GUI implements CategoryListener {
|
|
|
private final JLabel maxGraph = new JLabel("100%");
|
|
|
private final JLabel medGraph = new JLabel("50%");
|
|
|
private final JLabel minGraph = new JLabel("0%");
|
|
|
+ private final JLabel elementGraph = new JLabel("None ");
|
|
|
|
|
|
private final JTree tree = new JTree();
|
|
|
private final JEditorPane dtrpnHereWillBe = new JEditorPane();
|
|
@@ -128,15 +129,18 @@ public class GUI implements CategoryListener {
|
|
|
private final JPanel panel = new JPanel();
|
|
|
private final JPanel panel_HolonEl = new JPanel();
|
|
|
private final JComboBox comboBox = new JComboBox();
|
|
|
+ private final JComboBox comboBoxGraph = new JComboBox();
|
|
|
|
|
|
|
|
|
private final JButton btnAdd = new JButton("+");
|
|
|
private final JButton btnDel = new JButton("-");
|
|
|
private final JButton btnAddHolEL = new JButton("+");
|
|
|
private final JButton btnDelHolEL = new JButton("-");
|
|
|
+ private final JButton resetGraphBtn = new JButton("Reset");
|
|
|
|
|
|
private final JToolBar toolBar = new JToolBar();
|
|
|
private final JToolBar toolBarHolonEl = new JToolBar();
|
|
|
+ private final JToolBar toolBarGraph = new JToolBar();
|
|
|
|
|
|
|
|
|
private boolean dragging = false;
|
|
@@ -279,8 +283,13 @@ public class GUI implements CategoryListener {
|
|
|
graphLabel.add(maxGraph);
|
|
|
graphLabel.add(medGraph);
|
|
|
graphLabel.add(minGraph);
|
|
|
-
|
|
|
+ toolBarGraph.add(elementGraph);
|
|
|
+ comboBoxGraph.setModel(new DefaultComboBoxModel(new String[] { "Day", "Month", "Year" }));
|
|
|
+ toolBarGraph.add(comboBoxGraph);
|
|
|
+ toolBarGraph.add(resetGraphBtn);
|
|
|
+ toolBarGraph.setFloatable(false);
|
|
|
scrollGraph.setRowHeaderView(graphLabel);
|
|
|
+ scrollGraph.setColumnHeaderView(toolBarGraph);
|
|
|
scrollElements.setLayout(new BorderLayout(0, 0));
|
|
|
scrollElements.add(panel_HolonEl, BorderLayout.NORTH);
|
|
|
scrollElements.add(tableHolonElementScrollPane);
|
|
@@ -303,6 +312,12 @@ public class GUI implements CategoryListener {
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
+ resetGraphBtn.addActionListener(new ActionListener() {
|
|
|
+
|
|
|
+ public void actionPerformed(ActionEvent arg0) {
|
|
|
+ testgraph.reset();
|
|
|
+ }
|
|
|
+ });
|
|
|
toolBarHolonEl.add(btnDelHolEL);
|
|
|
btnDelHolEL.addActionListener(new ActionListener() {
|
|
|
public void actionPerformed(ActionEvent arg0) {
|
|
@@ -320,7 +335,13 @@ public class GUI implements CategoryListener {
|
|
|
public void mousePressed(MouseEvent e) {
|
|
|
HolonObject obj = (HolonObject) getActualCps();
|
|
|
yValueElements = e.getY();
|
|
|
- testgraph.repaintWithNewElement(getActualHolonElement(obj, yValueElements));
|
|
|
+ HolonElement ele = getActualHolonElement(obj, yValueElements);
|
|
|
+ if (ele != null) {
|
|
|
+ elementGraph.setText(ele.getEleName() + " ");
|
|
|
+ testgraph.repaintWithNewElement(ele);
|
|
|
+ } else {
|
|
|
+ elementGraph.setText("None ");
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
frmCyberPhysical.getContentPane().setLayout(new BorderLayout(0, 0));
|
|
@@ -760,8 +781,10 @@ public class GUI implements CategoryListener {
|
|
|
}
|
|
|
|
|
|
public CpsObject getActualCps() {
|
|
|
- model.setSelectedCpsObject(canvas.tempCps);
|
|
|
- return canvas.tempCps;
|
|
|
+ int tempID = model.getSelectedObjectID();
|
|
|
+ CpsObject tempCps = controller.searchByID(tempID);
|
|
|
+ System.out.println(tempCps.getID());
|
|
|
+ return tempCps;
|
|
|
}
|
|
|
|
|
|
public HolonElement getActualHolonElement(HolonObject obj, int yValue) {
|