Ver Fonte

fix und new unoptimal gelöst :)

Kevin Trometer há 8 anos atrás
pai
commit
a23ba223a6
1 ficheiros alterados com 19 adições e 1 exclusões
  1. 19 1
      src/ui/view/GUI.java

+ 19 - 1
src/ui/view/GUI.java

@@ -42,6 +42,7 @@ import javax.swing.JTable;
 import javax.swing.JToolBar;
 import javax.swing.JTree;
 import javax.swing.SwingUtilities;
+import javax.swing.border.LineBorder;
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
 import javax.swing.table.DefaultTableModel;
@@ -122,7 +123,7 @@ public class GUI<E> implements CategoryListener {
 	private DefaultTableModel tableModelGraph = new DefaultTableModel();
 	private final JScrollPane scrollGraph = new JScrollPane();
 
-	private final Model model;
+	private Model model;
 	private final Control controller;
 
 	// Pop up Windows
@@ -454,6 +455,7 @@ public class GUI<E> implements CategoryListener {
 		/*
 		 * Reset the graph of the selected HolonElement
 		 */
+		resetGraphBtn.setBorder(new LineBorder(Color.BLACK));
 		resetGraphBtn.addActionListener(new ActionListener() {
 			public void actionPerformed(ActionEvent arg0) {
 				unitGraph.reset();
@@ -780,6 +782,22 @@ public class GUI<E> implements CategoryListener {
 
 		frmCyberPhysical.getContentPane().add(splitPane);
 
+		mntmNew.addActionListener(new ActionListener() {
+			
+			@Override
+			public void actionPerformed(ActionEvent arg0) {
+				model.getEdgesOnCanvas().removeAll(model.getEdgesOnCanvas());
+				model.getObjectsOnCanvas().removeAll(model.getObjectsOnCanvas());
+				controller.setSelectedObjectID(0);
+				controller.setSelecteEdge(null);
+				controller.setCurIteration(0);
+				unitGraph.empty();
+				canvas.tempCps = null;
+				canvas.objectSelectionHighlighting();
+				canvas.repaint();
+			}
+		});
+		
 		mntmOpen.addActionListener(new java.awt.event.ActionListener() {
 			@Override
 			public void actionPerformed(java.awt.event.ActionEvent evt) {