Browse Source

Adds ToolTips to PortEditorPanel

Andreas T. Meyer-Berg 5 years ago
parent
commit
67bb51e7ad

+ 33 - 3
src/main/java/de/tu_darmstadt/tk/SmartHomeNetworkSim/view/popups/PortEditorPanel.java

@@ -102,9 +102,11 @@ public class PortEditorPanel extends JPanel
         editPanel.setFont(editPanel.getFont().deriveFont(Font.ITALIC));
         editPanel.setLayout(null);
         
+        String portNumberToolTip = "<html>Number of this port, should be a 16bit short [0 - 65335].<br> A Port describes the Endpoint of an Connection.</html>";
         JLabel lblPortnumber = new JLabel("PortNumber:");
         lblPortnumber.setHorizontalAlignment(SwingConstants.RIGHT);
         lblPortnumber.setBounds(10, 10, 110, 20);
+        lblPortnumber.setToolTipText(portNumberToolTip);
         editPanel.add(lblPortnumber);
          
         JScrollPane portsScrollPane = new JScrollPane(editPanel);
@@ -116,18 +118,22 @@ public class PortEditorPanel extends JPanel
         tfPortNumber.addFocusListener(this);
         tfPortNumber.addActionListener(this);
         tfPortNumber.addMouseListener(this);
+        tfPortNumber.setToolTipText(portNumberToolTip);
         
         JLabel lblProtocol = new JLabel("Protocol:");
         lblProtocol.setHorizontalAlignment(SwingConstants.RIGHT);
         lblProtocol.setBounds(10, 40, 110, 20);
+        lblProtocol.setToolTipText("Protocol which this Port participates in.");
         editPanel.add(lblProtocol);
         
         lblProtocolName = new JLabel("Protocol");
-        lblProtocolName.setBounds(130, 40, 60, 20);;
+        lblProtocolName.setBounds(130, 40, 60, 20);
+        lblProtocolName.setToolTipText("Name of the protocol, which is performed via this Port.");
         editPanel.add(lblProtocolName);
 
         JButton btnEditConnection = new JButton("Edit");
         btnEditConnection.setBounds(200, 40, 60, 20);
+        btnEditConnection.setToolTipText("Edit the Connection & Protocol performed via this port.");
         editPanel.add(btnEditConnection);
         btnEditConnection.addActionListener(a->{
         	if(list.getSelectedValue()==null||list.getSelectedValue().getConnection()==null)
@@ -135,10 +141,16 @@ public class PortEditorPanel extends JPanel
         	new ConnectionCreationDialog(list.getSelectedValue().getConnection(), controller, this);
         });
         
+        String toolTipStatus = "<html>Status of this port, how it is acting:<br>"
+        		+" * sending: Port sends packets & responds to incoming packets<br>"
+        		+" * open: Port responds to incoming packets, but will not initialize new packets, without trigger<br>"
+        		+" * closed: Port won't send or respond to packets<br>"
+        		+"</html>";
         JLabel lblStatus = new JLabel("Status:");
         lblStatus.setHorizontalAlignment(SwingConstants.RIGHT);
         //lblStatus.setBounds(66, 66, 56, 16);
-        lblStatus.setBounds(10, 70, 110, 20);;
+        lblStatus.setBounds(10, 70, 110, 20);
+        lblStatus.setToolTipText(toolTipStatus);
         editPanel.add(lblStatus);
         
         cmbStatus = new JComboBox<String>();
@@ -151,11 +163,13 @@ public class PortEditorPanel extends JPanel
         cmbStatus.addFocusListener(this);
         cmbStatus.addActionListener(this);
         cmbStatus.addMouseListener(this);
+        cmbStatus.setToolTipText(toolTipStatus);
         
-        
+        String toolTipTrigger = "<html>Interval between to triggers of this port.<br> This port will sent a new outgoing packet every *triggerIntervall* milliseconds.<html>";
         JLabel lblTriggerInterval = new JLabel("Trigger Interval:");
         lblTriggerInterval.setHorizontalAlignment(SwingConstants.RIGHT);
         lblTriggerInterval.setBounds(10, 100, 110, 20);
+        lblTriggerInterval.setToolTipText(toolTipTrigger);
         editPanel.add(lblTriggerInterval);
         
         tfTriggerInterval = new JTextField();
@@ -165,14 +179,20 @@ public class PortEditorPanel extends JPanel
         tfTriggerInterval.addFocusListener(this);
         tfTriggerInterval.addActionListener(this);
         tfTriggerInterval.addMouseListener(this);
+        tfTriggerInterval.setToolTipText(toolTipTrigger);
         
         JLabel lblTriggerIntervalUnit = new JLabel("ms");
         lblTriggerIntervalUnit.setBounds(270, 100, 50, 20);
         editPanel.add(lblTriggerIntervalUnit);
         
+        
+        String toolTipResponse = "<html>Time in milliseconds which this port needs to calculate<br>"
+        		+" and respond to an incoming packet.</html>";
+        
         JLabel lblResponseTime = new JLabel("Response Time:");
         lblResponseTime.setHorizontalAlignment(SwingConstants.RIGHT);
         lblResponseTime.setBounds(10, 130, 110, 20);
+        lblResponseTime.setToolTipText(toolTipResponse);
         editPanel.add(lblResponseTime);
         
         tfResponseTime = new JTextField();
@@ -182,14 +202,19 @@ public class PortEditorPanel extends JPanel
         tfResponseTime.addFocusListener(this);
         tfResponseTime.addActionListener(this);
         tfResponseTime.addMouseListener(this);
+        tfResponseTime.setToolTipText(toolTipResponse);
         
         JLabel lblResponseTimeUnit = new JLabel("ms");
         lblResponseTimeUnit.setBounds(270, 130, 50, 20);
         editPanel.add(lblResponseTimeUnit);
         
+        String toolTipLastTrigger = "<html>Timestep in milliseconds, where this port sent its last packet.<br>"
+        		+ "Just accounts for packets that originate from this port, no forwards or responses.</html>";
+        
         JLabel lblLasttrigger = new JLabel("LastTrigger:");
         lblLasttrigger.setHorizontalAlignment(SwingConstants.RIGHT);
         lblLasttrigger.setBounds(10, 160, 110, 20);
+        lblLasttrigger.setToolTipText(toolTipLastTrigger);
         editPanel.add(lblLasttrigger);
         
         tfLastTrigger = new JTextField();
@@ -199,20 +224,25 @@ public class PortEditorPanel extends JPanel
         tfLastTrigger.addFocusListener(this);
         tfLastTrigger.addActionListener(this);
         tfLastTrigger.addMouseListener(this);
+        tfLastTrigger.setToolTipText(toolTipLastTrigger);
         
         JLabel lblLastTriggerUnit = new JLabel("ms");
         lblLastTriggerUnit.setBounds(270, 160, 50, 20);
         editPanel.add(lblLastTriggerUnit);
         
+        String toolTipJitter = "<html>Jitter describes the differences between the minimum and maximum delay of a connection.<br>"
+                + "In this takes the Port may send packets jitter/2 ms earlier or later</html>";
         JLabel lblJitter = new JLabel("Jitter:");
         lblJitter.setHorizontalAlignment(SwingConstants.RIGHT);
         lblJitter.setBounds(10, 190, 110, 20);
+        lblJitter.setToolTipText(toolTipJitter);
         editPanel.add(lblJitter);
         
         tfJitter = new JTextField();
         tfJitter.setBounds(130, 190, 130, 20);
         editPanel.add(tfJitter);
         tfJitter.setColumns(10);
+        tfJitter.setToolTipText(toolTipJitter);
         
         JLabel lblJitterUnit = new JLabel("ms");
         lblJitterUnit.setBounds(270, 190, 50, 20);

+ 5 - 1
src/main/java/de/tu_darmstadt/tk/SmartHomeNetworkSim/view/popups/SettingsPopUp.java

@@ -107,12 +107,16 @@ public class SettingsPopUp extends JFrame {
 		chckbxDeviceNames.addActionListener(a->config.setShowSmartDeviceNames(chckbxDeviceNames.isSelected()));
 		chckbxDeviceNames.setToolTipText("True if SmartDevice names should be shown");
 		pVisualisation.add(chckbxDeviceNames);
-
+		
+		/**
+		 * Unused Tabs for further settings
+		 **
 		JPanel pImports = new JPanel();
 		tabbedPane.addTab("Imports", null, pImports, null);
 		
 		JPanel pSimulation = new JPanel();
 		tabbedPane.addTab("Simulation", null, pSimulation, null);
+		*/
 	}
 
 	/**