浏览代码

Merge branch 'Ohne_Drag_and_Drop' of https://git.tk.informatik.tu-darmstadt.de/carlos.garcia/praktikum-holons into Ohne_Drag_and_Drop

Edgardo Palza 8 年之前
父节点
当前提交
7f45967f37
共有 4 个文件被更改,包括 19 次插入25 次删除
  1. 6 15
      src/ui/view/AddObjectPopUp.java
  2. 6 3
      src/ui/view/GUI.java
  3. 2 2
      src/ui/view/MyCanvas.java
  4. 5 5
      src/ui/view/PropertyTable.java

+ 6 - 15
src/ui/view/AddObjectPopUp.java

@@ -276,23 +276,14 @@ public class AddObjectPopUp extends JDialog {
 	protected void copieFile() {
 		InputStream inStream = null;
 		OutputStream outStream = null;
-		String jarLocation = "";
 		try {
 			File source = new File(filePath);
-			// File dest = new File(System.getProperty("user.dir") +
-			// "/bin/Images/", selectedFile.getName());
-			// imagePath = "/Images/" + selectedFile.getName();
-			try {
-				jarLocation = getJarContainingFolder(this.getClass());
-			} catch (Exception e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-			File dest = new File(jarLocation + "/HolonGUI/Images/");
-			dest.mkdirs();
-
-			dest = new File(dest, selectedFile.getName());
-			imagePath = jarLocation + "/HolonGUI/Images/" + selectedFile.getName();
+			File dest = new File(System.getProperty("user.home") + "/HolonGUI/Images/");
+		
+			 dest.mkdirs();
+			 dest = new File(dest, selectedFile.getName());
+			 imagePath = "" + dest;
+			
 			inStream = new FileInputStream(source);
 			outStream = new FileOutputStream(dest);
 			byte[] buffer = new byte[1024];

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

@@ -693,9 +693,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
@@ -715,8 +715,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(),

+ 5 - 5
src/ui/view/PropertyTable.java

@@ -9,11 +9,11 @@ public class PropertyTable extends DefaultTableModel {
 	@Override
 	public Class<?> getColumnClass(int columnIndex) {
 		Class clazz = String.class;
-		switch (columnIndex) {
-		case 3:
-			clazz = Boolean.class;
-			break;
-		}
+			switch (columnIndex) {
+			case 3:
+				clazz = Boolean.class;
+				break;
+			}
 		return clazz;
 	}
 }