|
@@ -24,6 +24,7 @@ import javax.swing.JTextField;
|
|
import javax.swing.JComboBox;
|
|
import javax.swing.JComboBox;
|
|
import javax.swing.JButton;
|
|
import javax.swing.JButton;
|
|
import javax.swing.JTree;
|
|
import javax.swing.JTree;
|
|
|
|
+import java.awt.Color;
|
|
|
|
|
|
public class splitPane extends JSplitPane implements GraphListener {
|
|
public class splitPane extends JSplitPane implements GraphListener {
|
|
private JTextField graphNrTxtField;
|
|
private JTextField graphNrTxtField;
|
|
@@ -76,40 +77,47 @@ public class splitPane extends JSplitPane implements GraphListener {
|
|
JLabel lblG = new JLabel("G:");
|
|
JLabel lblG = new JLabel("G:");
|
|
|
|
|
|
JButton btnAdd = new JButton("Add");
|
|
JButton btnAdd = new JButton("Add");
|
|
|
|
+
|
|
|
|
+ JPanel colorPanel = new JPanel();
|
|
|
|
+ colorPanel.setBackground(Color.GRAY);
|
|
GroupLayout gl_panel = new GroupLayout(panel);
|
|
GroupLayout gl_panel = new GroupLayout(panel);
|
|
gl_panel.setHorizontalGroup(
|
|
gl_panel.setHorizontalGroup(
|
|
gl_panel.createParallelGroup(Alignment.LEADING)
|
|
gl_panel.createParallelGroup(Alignment.LEADING)
|
|
.addGroup(gl_panel.createSequentialGroup()
|
|
.addGroup(gl_panel.createSequentialGroup()
|
|
- .addContainerGap()
|
|
|
|
- .addGroup(gl_panel.createParallelGroup(Alignment.TRAILING, false)
|
|
|
|
- .addComponent(treeScrollPane, Alignment.LEADING)
|
|
|
|
- .addGroup(Alignment.LEADING, gl_panel.createSequentialGroup()
|
|
|
|
|
|
+ .addGroup(gl_panel.createParallelGroup(Alignment.LEADING)
|
|
|
|
+ .addGroup(gl_panel.createSequentialGroup()
|
|
|
|
+ .addContainerGap()
|
|
.addGroup(gl_panel.createParallelGroup(Alignment.LEADING)
|
|
.addGroup(gl_panel.createParallelGroup(Alignment.LEADING)
|
|
- .addComponent(lblGraph)
|
|
|
|
- .addComponent(lblObject)
|
|
|
|
- .addComponent(lblProperty)
|
|
|
|
- .addComponent(lblColor)
|
|
|
|
|
|
+ .addComponent(treeScrollPane, GroupLayout.DEFAULT_SIZE, 165, Short.MAX_VALUE)
|
|
.addGroup(gl_panel.createSequentialGroup()
|
|
.addGroup(gl_panel.createSequentialGroup()
|
|
- .addComponent(lblR)
|
|
|
|
|
|
+ .addGroup(gl_panel.createParallelGroup(Alignment.LEADING)
|
|
|
|
+ .addComponent(lblGraph)
|
|
|
|
+ .addComponent(lblObject)
|
|
|
|
+ .addComponent(lblProperty)
|
|
|
|
+ .addComponent(lblColor)
|
|
|
|
+ .addGroup(gl_panel.createSequentialGroup()
|
|
|
|
+ .addComponent(lblR)
|
|
|
|
+ .addPreferredGap(ComponentPlacement.RELATED)
|
|
|
|
+ .addComponent(redField, GroupLayout.PREFERRED_SIZE, 37, GroupLayout.PREFERRED_SIZE)))
|
|
.addPreferredGap(ComponentPlacement.RELATED)
|
|
.addPreferredGap(ComponentPlacement.RELATED)
|
|
- .addComponent(redField, GroupLayout.PREFERRED_SIZE, 37, GroupLayout.PREFERRED_SIZE)))
|
|
|
|
- .addPreferredGap(ComponentPlacement.RELATED)
|
|
|
|
- .addGroup(gl_panel.createParallelGroup(Alignment.LEADING, false)
|
|
|
|
- .addComponent(showObjectlbl, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
|
|
- .addComponent(showPropertylbl, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
|
|
- .addComponent(graphNrTxtField)
|
|
|
|
- .addGroup(gl_panel.createParallelGroup(Alignment.TRAILING, false)
|
|
|
|
- .addComponent(colorComboBox, Alignment.LEADING, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
|
|
- .addGroup(Alignment.LEADING, gl_panel.createSequentialGroup()
|
|
|
|
- .addComponent(lblB)
|
|
|
|
- .addPreferredGap(ComponentPlacement.RELATED)
|
|
|
|
- .addComponent(blueField, GroupLayout.PREFERRED_SIZE, 37, GroupLayout.PREFERRED_SIZE)
|
|
|
|
- .addPreferredGap(ComponentPlacement.RELATED)
|
|
|
|
- .addComponent(lblG)
|
|
|
|
- .addPreferredGap(ComponentPlacement.RELATED)
|
|
|
|
- .addComponent(greenField, GroupLayout.PREFERRED_SIZE, 37, GroupLayout.PREFERRED_SIZE))
|
|
|
|
- .addComponent(btnAdd, Alignment.LEADING)))))
|
|
|
|
- .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
|
|
|
|
|
+ .addGroup(gl_panel.createParallelGroup(Alignment.LEADING, false)
|
|
|
|
+ .addComponent(showObjectlbl, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
|
|
+ .addComponent(showPropertylbl, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
|
|
+ .addComponent(graphNrTxtField)
|
|
|
|
+ .addComponent(colorComboBox, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
|
|
+ .addGroup(gl_panel.createSequentialGroup()
|
|
|
|
+ .addComponent(lblB)
|
|
|
|
+ .addPreferredGap(ComponentPlacement.RELATED)
|
|
|
|
+ .addComponent(blueField, GroupLayout.PREFERRED_SIZE, 37, GroupLayout.PREFERRED_SIZE)
|
|
|
|
+ .addPreferredGap(ComponentPlacement.RELATED)
|
|
|
|
+ .addComponent(lblG)
|
|
|
|
+ .addPreferredGap(ComponentPlacement.RELATED)
|
|
|
|
+ .addComponent(greenField, GroupLayout.PREFERRED_SIZE, 37, GroupLayout.PREFERRED_SIZE))))
|
|
|
|
+ .addComponent(colorPanel, Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 150, GroupLayout.PREFERRED_SIZE)))
|
|
|
|
+ .addGroup(gl_panel.createSequentialGroup()
|
|
|
|
+ .addGap(67)
|
|
|
|
+ .addComponent(btnAdd)))
|
|
|
|
+ .addContainerGap())
|
|
);
|
|
);
|
|
gl_panel.setVerticalGroup(
|
|
gl_panel.setVerticalGroup(
|
|
gl_panel.createParallelGroup(Alignment.LEADING)
|
|
gl_panel.createParallelGroup(Alignment.LEADING)
|
|
@@ -140,13 +148,15 @@ public class splitPane extends JSplitPane implements GraphListener {
|
|
.addComponent(blueField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(blueField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(lblG)
|
|
.addComponent(lblG)
|
|
.addComponent(greenField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
|
.addComponent(greenField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
|
- .addPreferredGap(ComponentPlacement.RELATED, 19, Short.MAX_VALUE)
|
|
|
|
|
|
+ .addPreferredGap(ComponentPlacement.UNRELATED)
|
|
|
|
+ .addComponent(colorPanel, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE)
|
|
|
|
+ .addPreferredGap(ComponentPlacement.RELATED, 53, Short.MAX_VALUE)
|
|
.addComponent(btnAdd)
|
|
.addComponent(btnAdd)
|
|
- .addContainerGap())
|
|
|
|
|
|
+ .addGap(34))
|
|
);
|
|
);
|
|
|
|
|
|
objectTree = new JTree();
|
|
objectTree = new JTree();
|
|
- treeModel = new DefaultTreeModel(null);
|
|
|
|
|
|
+ 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 Production"));
|
|
@@ -199,11 +209,11 @@ public class splitPane extends JSplitPane implements GraphListener {
|
|
|
|
|
|
JScrollPane graphScrollPane = new JScrollPane();
|
|
JScrollPane graphScrollPane = new JScrollPane();
|
|
setRightComponent(graphScrollPane);
|
|
setRightComponent(graphScrollPane);
|
|
|
|
+ repaintGraph();
|
|
}
|
|
}
|
|
@Override
|
|
@Override
|
|
public void repaintGraph() {
|
|
public void repaintGraph() {
|
|
- // TODO Auto-generated method stub
|
|
|
|
-
|
|
|
|
|
|
+ treeModel.reload();
|
|
}
|
|
}
|
|
@Override
|
|
@Override
|
|
public void addTrackedObject(ArrayList<HolonObject> hlList) {
|
|
public void addTrackedObject(ArrayList<HolonObject> hlList) {
|
|
@@ -219,7 +229,6 @@ public class splitPane extends JSplitPane implements GraphListener {
|
|
}else{
|
|
}else{
|
|
objectsNode.add(new DefaultMutableTreeNode("empty"));
|
|
objectsNode.add(new DefaultMutableTreeNode("empty"));
|
|
}
|
|
}
|
|
- objectTree.repaint();
|
|
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|