|
@@ -210,6 +210,9 @@ public class GUI<E> implements CategoryListener {
|
|
// Coord for all Cells with boolean values (checkbox)
|
|
// Coord for all Cells with boolean values (checkbox)
|
|
private int yBTHIS;
|
|
private int yBTHIS;
|
|
private int xBTHIS;
|
|
private int xBTHIS;
|
|
|
|
+ // Coord for the Edit-Modus in the PropertieTable
|
|
|
|
+ private int yProThis;
|
|
|
|
+ private int xProThis;
|
|
private CpsObject temp = null;
|
|
private CpsObject temp = null;
|
|
private final JButton btnTest = new JButton("test");
|
|
private final JButton btnTest = new JButton("test");
|
|
private final JMenuItem mntmUndo = new JMenuItem("Undo");
|
|
private final JMenuItem mntmUndo = new JMenuItem("Undo");
|
|
@@ -843,6 +846,20 @@ public class GUI<E> implements CategoryListener {
|
|
/***********************
|
|
/***********************
|
|
* HolonElement Properties Actions
|
|
* HolonElement Properties Actions
|
|
**********************/
|
|
**********************/
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * Update of the mouse coord
|
|
|
|
+ */
|
|
|
|
+ tableProperties.addMouseListener(new MouseAdapter() {
|
|
|
|
+ public void mousePressed(MouseEvent e) {
|
|
|
|
+ if (e.getClickCount() == 2) {
|
|
|
|
+ yProThis = e.getY();
|
|
|
|
+ xProThis = e.getX();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* Update any change in the Property table
|
|
* Update any change in the Property table
|
|
*/
|
|
*/
|
|
@@ -851,17 +868,21 @@ public class GUI<E> implements CategoryListener {
|
|
public void propertyChange(PropertyChangeEvent evt) {
|
|
public void propertyChange(PropertyChangeEvent evt) {
|
|
try {
|
|
try {
|
|
Object temp;
|
|
Object temp;
|
|
|
|
+ Object btemp;
|
|
Point mousePos = tableProperties.getMousePosition();
|
|
Point mousePos = tableProperties.getMousePosition();
|
|
|
|
+ int selValueY = (int) Math.floor(yProThis / 16);
|
|
|
|
+ int selValueX = (int) Math.floor(xProThis / (tableProperties.getWidth() / 2));
|
|
|
|
+ temp = tableModelProperties.getValueAt(selValueY, selValueX);
|
|
if (getActualCps() != null) {
|
|
if (getActualCps() != null) {
|
|
- temp = tableModelProperties.getValueAt(mousePos.y / tableProperties.getRowHeight(),
|
|
|
|
- mousePos.x / (tableProperties.getWidth() / 2));
|
|
|
|
- if (getActualCps() instanceof HolonObject) {
|
|
|
|
- getActualCps().setName(temp.toString());
|
|
|
|
- } else if (getActualCps() instanceof HolonSwitch) {
|
|
|
|
- if (mousePos.y / tableProperties.getRowHeight() == 2) {
|
|
|
|
- Boolean bTemp = Boolean.parseBoolean(temp.toString());
|
|
|
|
- ((HolonSwitch) getActualCps()).setManualMode(bTemp);
|
|
|
|
- if (bTemp) {
|
|
|
|
|
|
+ if (getActualCps() instanceof HolonSwitch) {
|
|
|
|
+ btemp = tableModelProperties.getValueAt(mousePos.y / tableProperties.getRowHeight(),
|
|
|
|
+ mousePos.x / (tableProperties.getWidth() / 2));
|
|
|
|
+ if (mousePos.y / tableProperties.getRowHeight() == 0) {
|
|
|
|
+ getActualCps().setName(btemp.toString());
|
|
|
|
+ } else if (mousePos.y / tableProperties.getRowHeight() == 2) {
|
|
|
|
+ Boolean bbTemp = Boolean.parseBoolean(btemp.toString());
|
|
|
|
+ ((HolonSwitch) getActualCps()).setManualMode(bbTemp);
|
|
|
|
+ if (bbTemp) {
|
|
tableModelProperties.setCellEditable(3, 1, true);
|
|
tableModelProperties.setCellEditable(3, 1, true);
|
|
} else {
|
|
} else {
|
|
tableModelProperties.setCellEditable(3, 1, false);
|
|
tableModelProperties.setCellEditable(3, 1, false);
|
|
@@ -873,11 +894,13 @@ public class GUI<E> implements CategoryListener {
|
|
((HolonSwitch) getActualCps()).setManualState(bTemp);
|
|
((HolonSwitch) getActualCps()).setManualState(bTemp);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ } else if (getActualCps() instanceof HolonObject) {
|
|
|
|
+ getActualCps().setName(temp.toString());
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- temp = tableModelProperties.getValueAt(mousePos.y / tableProperties.getRowHeight(),
|
|
|
|
- mousePos.x / (tableProperties.getWidth() / 2));
|
|
|
|
- if (mousePos.y / tableProperties.getRowHeight() == 2) {
|
|
|
|
|
|
+
|
|
|
|
+ temp = tableModelProperties.getValueAt(selValueY, selValueX);
|
|
|
|
+ if (selValueY / tableProperties.getRowHeight() == 2) {
|
|
Float ftemp;
|
|
Float ftemp;
|
|
if (Float.parseFloat(temp.toString()) >= 0.0) {
|
|
if (Float.parseFloat(temp.toString()) >= 0.0) {
|
|
ftemp = Float.parseFloat(temp.toString());
|
|
ftemp = Float.parseFloat(temp.toString());
|
|
@@ -885,7 +908,7 @@ public class GUI<E> implements CategoryListener {
|
|
ftemp = model.getSelectedEdge().getCapacity();
|
|
ftemp = model.getSelectedEdge().getCapacity();
|
|
}
|
|
}
|
|
model.getSelectedEdge().setCapacity(ftemp);
|
|
model.getSelectedEdge().setCapacity(ftemp);
|
|
- } else if (mousePos.y / tableProperties.getRowHeight() == 3) {
|
|
|
|
|
|
+ } else if (selValueY / tableProperties.getRowHeight() == 3) {
|
|
Boolean bTemp = Boolean.parseBoolean(temp.toString());
|
|
Boolean bTemp = Boolean.parseBoolean(temp.toString());
|
|
model.getSelectedEdge().setState(bTemp);
|
|
model.getSelectedEdge().setState(bTemp);
|
|
}
|
|
}
|
|
@@ -1005,8 +1028,7 @@ public class GUI<E> implements CategoryListener {
|
|
DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) tree
|
|
DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) tree
|
|
.getPathForLocation(e.getX(), e.getY()).getLastPathComponent();
|
|
.getPathForLocation(e.getX(), e.getY()).getLastPathComponent();
|
|
if (selectedNode.getLevel() == 2) {
|
|
if (selectedNode.getLevel() == 2) {
|
|
- controller.searchCategoryObject(selectedNode.getParent().toString(),
|
|
|
|
- selectedNode.toString());
|
|
|
|
|
|
+ controller.searchCategoryObject(selectedNode.getParent().toString(), selectedNode.toString());
|
|
deleteRows(tableModelHolonElementSingle);
|
|
deleteRows(tableModelHolonElementSingle);
|
|
deleteRows(tableModelHolonElementMulti);
|
|
deleteRows(tableModelHolonElementMulti);
|
|
// if (selected instanceof HolonObject && selected !=
|
|
// if (selected instanceof HolonObject && selected !=
|