Переглянути джерело

Fixes smaller bugs
* Nullpointer on Link visualization of new links
* LinkCreationPanel not refreshing GUI (wasn't required without link
visualization)

Andreas T. Meyer-Berg 5 роки тому
батько
коміт
80c2156703

+ 2 - 2
src/main/java/de/tu_darmstadt/tk/SmartHomeNetworkSim/view/VisualisationPanel.java

@@ -165,7 +165,7 @@ public class VisualisationPanel extends JPanel implements Observer {
 		/**
 		 * Angle per Link in "linkSlice degrees"
 		 */
-		int linkSlice = (int) Math.round(360.0 / numberOfLinks);
+		int linkSlice = Math.min((int) Math.round(360.0 / numberOfLinks),90);
 		/**
 		 * Map of links to Colors and position of the Color
 		 */
@@ -240,7 +240,7 @@ public class VisualisationPanel extends JPanel implements Observer {
 					 * Number and color of the current link
 					 */
 					Pair<Integer, Color> linkPos = linkColors.get(l);
-					if(l==null)continue;//Skip Links, which are not in the model
+					if(linkPos==null)continue;//Skip Links, which are not in the model
 					g.setColor(linkPos.getRight());
 					g.fillArc(x - config.getDeviceVisualizationRadius() - linkDim, y - config.getDeviceVisualizationRadius() - linkDim,
 							2 * config.getDeviceVisualizationRadius() - 1 + 2 * linkDim, 2 * config.getDeviceVisualizationRadius() - 1 + 2*linkDim,

+ 1 - 0
src/main/java/de/tu_darmstadt/tk/SmartHomeNetworkSim/view/popups/LinkCreationPanel.java

@@ -242,6 +242,7 @@ public class LinkCreationPanel extends JScrollPane{
 				newLink.setName(tfName.getText());
 				content.setVisible(false);
 				setVisible(false);
+				controller.notifyObservers();
 				if(frame != null){
 					frame.setVisible(false);
 					frame.dispose();