Browse Source

ElementTable fix for Objects without elements
edges thickness limited

Jessey Widhalm 8 years ago
parent
commit
e79b04125f
2 changed files with 8 additions and 5 deletions
  1. 6 3
      src/ui/view/GUI.java
  2. 2 2
      src/ui/view/MyCanvas.java

+ 6 - 3
src/ui/view/GUI.java

@@ -675,9 +675,9 @@ public class GUI<E> implements CategoryListener {
 				}
 				temp = getActualCps();
 				// Update of the Information about the HolonElements - only for
-				if (temp instanceof HolonObject) {
-					refreshTableHolonElement();
-				}
+				// if (temp instanceof HolonObject) {
+				// refreshTableHolonElement();
+				// }
 				// Update of the Information about the Properties - only for
 				// CpsObjects
 				// Erase old data
@@ -697,8 +697,11 @@ public class GUI<E> implements CategoryListener {
 						Object[] tempEnergy = { "Total Energy", ((HolonObject) temp).getCurrentEnergy() };
 						tableModelProperties.addRow(tempEnergy);
 					} else if (temp instanceof HolonTransformer) {
+						deleteRows();
 						Object[] tempRatioPerc = { "Ratio Type", true };
 						tableModelProperties.addRow(tempRatioPerc);
+					}else{
+						deleteRows();
 					}
 					tableModelProperties.setCellEditable(0, 1, true);
 					tableModelProperties.setCellEditable(2, 1, false);

+ 2 - 2
src/ui/view/MyCanvas.java

@@ -104,11 +104,11 @@ class MyCanvas extends JPanel implements MouseListener, MouseMotionListener {
 		if (drawEdge)
 			g2.drawLine(tempCps.getPosition().x + controller.getScaleDiv2(),
 					tempCps.getPosition().y + controller.getScaleDiv2(), x, y);
-
+	
 		for (CpsEdge con : model.getEdgesOnCanvas()) {
 			if (con.getA().getID() != model.getSelectedObjectID() && con.getB().getID() != model.getSelectedObjectID()
 					&& con != edgeHighlight) {
-				g2.setStroke(new BasicStroke(con.getFlow()/con.getCapacity()*4));
+				g2.setStroke(new BasicStroke(Math.min((con.getFlow()/con.getCapacity()*4),4)));
 				g2.drawLine(con.getA().getPosition().x + controller.getScaleDiv2(),
 						con.getA().getPosition().y + controller.getScaleDiv2(),
 						con.getB().getPosition().x + controller.getScaleDiv2(),