dominik.rieder 7 yıl önce
ebeveyn
işleme
8258e332cf

+ 4 - 1
src/ui/controller/SimulationManager.java

@@ -510,9 +510,11 @@ public class SimulationManager {
 	 * @param toCopy the ArrayList of CpsObjects co Copy
 	 */
 	public void copyObjects(ArrayList<AbstractCpsObject> toCopy) {
-		objectsToHandle = new ArrayList<AbstractCpsObject>();
 		for (AbstractCpsObject cps : toCopy) {
 			objectsToHandle.add(cps);
+			if(cps instanceof CpsUpperNode){
+				copyObjects(((CpsUpperNode)cps).getNodes());
+			}
 		}
 	}
 
@@ -554,6 +556,7 @@ public class SimulationManager {
 	 * Reset all Data to the current state of the Model.
 	 */
 	public void reset() {
+		objectsToHandle = new ArrayList<AbstractCpsObject>();
 		copyObjects(model.getObjectsOnCanvas());
 	}
 

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

@@ -130,6 +130,7 @@ public class GUI<E> implements CategoryListener {
 	private splitPane statSplitPane;
 	private JScrollPane statScrollPane;
 	private UpperNodeCanvas unc;
+	private JPanel contentPane;
 
 	private final JLabel maxGraph = new JLabel("100%");
 	private final JLabel medGraph = new JLabel("50%");
@@ -316,7 +317,7 @@ public class GUI<E> implements CategoryListener {
 			}
 		});
 
-		JPanel contentPane = (JPanel) frmCyberPhysical.getContentPane();
+		contentPane = (JPanel) frmCyberPhysical.getContentPane();
 
 		int condition = JComponent.WHEN_IN_FOCUSED_WINDOW;
 		InputMap inputMap = contentPane.getInputMap(condition);
@@ -587,7 +588,7 @@ public class GUI<E> implements CategoryListener {
 		mntmEditShowedInformation.addActionListener(new ActionListener() {
 			public void actionPerformed(ActionEvent e) {
 				try {
-					ShowedInformationPopUp dialog = new ShowedInformationPopUp(canvas);
+					ShowedInformationPopUp dialog = new ShowedInformationPopUp(canvas, contentPane);
 					dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
 					dialog.setVisible(true);
 				} catch (Exception ex) {

+ 5 - 1
src/ui/view/ShowedInformationPopUp.java

@@ -3,6 +3,7 @@ package ui.view;
 import java.awt.BorderLayout;
 
 import javax.swing.JDialog;
+import javax.swing.JFrame;
 import javax.swing.JPanel;
 import javax.swing.border.EmptyBorder;
 
@@ -27,6 +28,7 @@ public class ShowedInformationPopUp extends JDialog {
 	private JCheckBox objectEnergyCheckbox;
 	private JCheckBox connectionCheckbox;
 	private JCheckBox colorizedBorderCheckbox;
+	private JPanel toUpdate;
 
 	/**
 	 * Constructor.
@@ -34,7 +36,7 @@ public class ShowedInformationPopUp extends JDialog {
 	 * @param canvas
 	 *            the Canvas
 	 */
-	public ShowedInformationPopUp(MyCanvas canvas) {
+	public ShowedInformationPopUp(MyCanvas canvas, JPanel update) {
 		super((java.awt.Frame) null, true);
 		setModalityType(java.awt.Dialog.ModalityType.APPLICATION_MODAL);
 		this.setTitle(Languages.getLanguage()[31]);
@@ -44,6 +46,7 @@ public class ShowedInformationPopUp extends JDialog {
 		getContentPane().add(contentPanel, BorderLayout.CENTER);
 		contentPanel.setLayout(null);
 		this.canvas = canvas;
+		this.toUpdate = update;
 
 		objectEnergyCheckbox = new JCheckBox(Languages.getLanguage()[32]);
 		objectEnergyCheckbox.setBounds(19, 19, 300, 23);
@@ -92,5 +95,6 @@ public class ShowedInformationPopUp extends JDialog {
 	private void setInformation(boolean connection, boolean object, boolean borders) {
 		canvas.setShowedInformation(connection, object, borders);
 		canvas.repaint();
+		toUpdate.updateUI();
 	}
 }

+ 0 - 1
src/ui/view/UpperNodeCanvas.java

@@ -658,7 +658,6 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
 
 			// Border Highlighting
 			if(showedInformation[3]){
-				System.out.println("here");
 				g2.setColor(cps.getBorderColor());
 				if (g2.getColor() != Color.WHITE) {
 					g2.fillRect((int) ((borderPos >> 1) - model.getScaleDiv2() - scalediv20) - 3,