Thread: [Javanetsim-cvs] javaNetSim/guiUI EthPortProperties.java, NONE, 1.1 GuiNode.java, 1.3, 1.4 LinkDial
Status: Beta
Brought to you by:
darkkey
From: Alexander B. <da...@us...> - 2007-10-13 12:57:07
|
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv30660/guiUI Modified Files: GuiNode.java LinkDialog.java LinkLayerPanel.java LinkProperties.java MainScreen.java NodePropertiesDialog.java SandBox.java SetTCPIPPropertiesDialog.java Added Files: EthPortProperties.java Removed Files: breakLinkDialog.java Log Message: Multiple changes in Link Layer, added DHCP D/C prototype, broadcast packets (+ forwarding), changed menu structure, added MAC address editing, Serial link type and more... Index: LinkProperties.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/LinkProperties.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** LinkProperties.java 14 Sep 2007 11:14:51 -0000 1.7 --- LinkProperties.java 13 Oct 2007 12:57:00 -0000 1.8 *************** *** 337,341 **** --- 337,343 ---- for (int i = 0; i < nics.length; i++) { //Add them to the combobox + if(Sim.getNode(NodeName).getIntType((String)nics[i]) == core.NetworkInterface.Ethernet10T ){ cmbInterface.addItem(nics[i]); + } } cmbInterface.setEnabled(true); Index: LinkLayerPanel.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/LinkLayerPanel.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** LinkLayerPanel.java 13 Sep 2007 13:38:52 -0000 1.2 --- LinkLayerPanel.java 13 Oct 2007 12:57:00 -0000 1.3 *************** *** 1,129 **** /* Java Firewall Simulator (jFirewallSim) Copyright (c) 2004, jFirewallSim development team All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of the Canberra Institute of Technology nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package guiUI; import java.awt.BasicStroke; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.geom.*; import java.awt.Color; import java.awt.Point; import java.util.Hashtable; import java.util.Enumeration; import javax.swing.JPanel; /** * This object is an extension of the Java Swing JPanel. * It has been extended so that we can overide the paint method * and use it to draw the various links. It will be inserted into the * bottom layer of a layered pane so that it always sits behind the * various Nodes being displayed on teh screen. * * @author bevan_calliess * */ public class LinkLayerPanel extends JPanel { final static String FAKELINE = new String("FakeLine"); final static BasicStroke stroke = new BasicStroke(3.0f); final static Color linkCol = Color.BLUE; private Hashtable LineTable = new Hashtable(); /** * This method will take the name of the Link and the starting * and ending points that it is drawn between. * A 2DLine object is created using these co-ordinates and then * it is added to a hashTable using the name as a key * so that it can be located and moved and/or removed as required. * @param inName Used as the key for the hashTable * @param inStart Used for the first set of co-ordinates p1x and p1y * @param inEnd Used for the second set of co-ordinates p2x and p2y */ ! public void addLine(String inName,Point inStart, Point inEnd){ ! Line2D.Double Line = new Line2D.Double(inStart.x,inStart.y,inEnd.x,inEnd.y); ! LineTable.put(inName,Line); repaint(); } /** * This method will remove a line from the hashtable so that * it will no longer be drawn. * @param inName */ public void removeLine(String inName){ LineTable.remove(inName); repaint(); } /** * This method is Used to move the co-ordinates of a particular * line in the hashTable. * * @param inName Key to the HashTable.(linkName) * @param inWhichEnd Which set of co_ordinates to move p1 or p2 * @param inPosition The position to move those cordinates to. */ public void moveLine(String inName,int inWhichEnd,Point inPosition){ if(LineTable.containsKey(inName)) { ! Line2D.Double myLine = (Line2D.Double)LineTable.get(inName); if(inWhichEnd == 1){ Point2D p1 = (Point2D)inPosition; ! Point2D p2 = myLine.getP2(); ! myLine.setLine(p1,p2); }else{ ! Point2D p1 = myLine.getP1(); Point2D p2 = (Point2D)inPosition; ! myLine.setLine(p1,p2); } repaint(); } } /** * Overides the standard paint method so that it * draws the various lines on the screen. */ public void paint(Graphics g) { super.paint(g); Graphics2D g2D = (Graphics2D)g; ! g2D.setStroke(stroke); ! g2D.setPaint(linkCol); ! Enumeration it = LineTable.elements(); ! ! while(it.hasMoreElements()){ ! Line2D.Double myLine = (Line2D.Double)it.nextElement(); ! g2D.draw(myLine); } } } --- 1,271 ---- /* + Java Firewall Simulator (jFirewallSim) + + Copyright (c) 2004, jFirewallSim development team All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, are + permitted provided that the following conditions are met: + + - Redistributions of source code must retain the above copyright notice, this list + of conditions and the following disclaimer. + - Redistributions in binary form must reproduce the above copyright notice, this list + of conditions and the following disclaimer in the documentation and/or other + materials provided with the distribution. + - Neither the name of the Canberra Institute of Technology nor the names of its + contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + package guiUI; + + import java.awt.BasicStroke; + import java.awt.Graphics; + import java.awt.Graphics2D; + import java.awt.geom.*; + import java.awt.Color; + import java.awt.Point; + import java.util.Hashtable; + import java.util.Enumeration; + + import javax.swing.JPanel; + + /** + * This object is an extension of the Java Swing JPanel. + * It has been extended so that we can overide the paint method + * and use it to draw the various links. It will be inserted into the + * bottom layer of a layered pane so that it always sits behind the + * various Nodes being displayed on teh screen. + * + * @author bevan_calliess + * + */ + + public class LinkLayerPanel extends JPanel { + + final static String FAKELINE = new String("FakeLine"); + final static BasicStroke stroke = new BasicStroke(3.0f); + final static Color linkCol = Color.BLUE; + + class LinkLine{ + public Line2D.Double Line; + public BasicStroke stroke; + public Color linkCol; + + public LinkLine(Line2D.Double inLine, BasicStroke instroke, Color inlinkCol){ + Line = inLine; + stroke = instroke; + linkCol = inlinkCol; + } + } + private Hashtable LineTable = new Hashtable(); + + + /** + * This method will take the name of the Link and the starting + * and ending points that it is drawn between. + * A 2DLine object is created using these co-ordinates and then + * it is added to a hashTable using the name as a key + * so that it can be located and moved and/or removed as required. + * @param inName Used as the key for the hashTable + * @param inStart Used for the first set of co-ordinates p1x and p1y + * @param inEnd Used for the second set of co-ordinates p2x and p2y + */ ! ! public void addLine(String inName,Point inStart, Point inEnd, int type){ ! ! switch(type){ ! case core.NetworkInterface.Ethernet10T: ! LineTable.put(inName,new LinkLine(new Line2D.Double(inStart.x,inStart.y,inEnd.x,inEnd.y), new BasicStroke(2.0f), Color.BLACK)); ! break; ! case core.NetworkInterface.Serial: ! LineTable.put(inName,new LinkLine(new Line2D.Double(inStart.x,inStart.y,inEnd.x,inEnd.y), new BasicStroke(3.0f), Color.BLUE)); ! break; ! } ! repaint(); + } + /** + * This method will remove a line from the hashtable so that + * it will no longer be drawn. + * @param inName + */ + public void removeLine(String inName){ + LineTable.remove(inName); + repaint(); + } + + /** + * This method is Used to move the co-ordinates of a particular + * line in the hashTable. + * + * @param inName Key to the HashTable.(linkName) + * @param inWhichEnd Which set of co_ordinates to move p1 or p2 + * @param inPosition The position to move those cordinates to. + */ + public void moveLine(String inName,int inWhichEnd,Point inPosition){ + if(LineTable.containsKey(inName)) + { ! ! LinkLine myLine = (LinkLine)LineTable.get(inName); ! if(inWhichEnd == 1){ + Point2D p1 = (Point2D)inPosition; ! ! Point2D p2 = myLine.Line.getP2(); ! ! myLine.Line.setLine(p1,p2); ! }else{ ! ! Point2D p1 = myLine.Line.getP1(); ! Point2D p2 = (Point2D)inPosition; ! ! myLine.Line.setLine(p1,p2); ! } + repaint(); + } + + } + + /** + * Overides the standard paint method so that it + * draws the various lines on the screen. + */ + public void paint(Graphics g) + { + super.paint(g); + Graphics2D g2D = (Graphics2D)g; ! Enumeration it = LineTable.elements(); ! ! while(it.hasMoreElements()){ ! ! LinkLine myLine = (LinkLine)it.nextElement(); ! ! g2D.setStroke(myLine.stroke); ! ! g2D.setPaint(myLine.linkCol); ! ! g2D.draw(myLine.Line); ! } + } + } + Index: LinkDialog.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/LinkDialog.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** LinkDialog.java 15 Sep 2007 11:34:58 -0000 1.3 --- LinkDialog.java 13 Oct 2007 12:57:00 -0000 1.4 *************** *** 103,112 **** txtLinkName.setText(inPC1 + "-TO-" + inPC2); lblFirstNode.setText(inPC1); ! pnlMessage.add(lblMessage); pnlLinkScreen.add(pnlMessage); ! pnlLinkInfo.add(lblNameLink); ! pnlLinkInfo.add(txtLinkName); pnlLinkScreen.add(pnlLinkInfo); pnlFirstNode.add(lblFirstNode, BorderLayout.NORTH); --- 103,113 ---- txtLinkName.setText(inPC1 + "-TO-" + inPC2); + txtLinkName.setVisible(false); lblFirstNode.setText(inPC1); ! pnlMessage.add(lblMessage); pnlLinkScreen.add(pnlMessage); ! //pnlLinkInfo.add(lblNameLink); ! //pnlLinkInfo.add(txtLinkName); pnlLinkScreen.add(pnlLinkInfo); pnlFirstNode.add(lblFirstNode, BorderLayout.NORTH); *************** *** 142,146 **** * @author Team VC2 */ ! public String getLinkName() { --- 143,147 ---- * @author Team VC2 */ ! public String getLinkName() { Index: NodePropertiesDialog.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/NodePropertiesDialog.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** NodePropertiesDialog.java 13 Sep 2007 13:38:52 -0000 1.2 --- NodePropertiesDialog.java 13 Oct 2007 12:57:00 -0000 1.3 *************** *** 1,128 **** --- 1,258 ---- /* + Java Firewall Simulator (jFirewallSim) + + Copyright (c) 2004, jFirewallSim development team All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, are + permitted provided that the following conditions are met: + + - Redistributions of source code must retain the above copyright notice, this list + of conditions and the following disclaimer. + - Redistributions in binary form must reproduce the above copyright notice, this list + of conditions and the following disclaimer in the documentation and/or other + materials provided with the distribution. + - Neither the name of the Canberra Institute of Technology nor the names of its + contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + package guiUI; + + import javax.swing.JButton; + import javax.swing.JDialog; + import javax.swing.JPanel; + import javax.swing.*; + import java.awt.event.*; + import java.awt.*; + import java.util.*; + import javax.swing.table.*; + + /** + * This class is used to display general information about a + * GUINode. It will display the IP Address information including + * default gateway and any Interface specific information such as + * the Current IP address and subnetmask. + * @author Michael + */ + public class NodePropertiesDialog extends JDialog implements ActionListener + { + + private JLabel lblNodeNameLabel = new JLabel("Node Name : "); + private JLabel lblNodeName = new JLabel(); + private JLabel lblGatewayLabel = new JLabel("Default Gateway : "); + private JLabel lblGatewayAddress = new JLabel(); + private JButton btnOK = new JButton("OK"); + + JPanel pnlNodeNameDetails = new JPanel(); + JPanel pnlGatewayDetails = new JPanel(); + + JPanel pnlOKButton = new JPanel(); + + public NodePropertiesDialog(JFrame frame, Vector inVectorMasterList){ + super(frame); + ArrayList aryColumnNames = new ArrayList(); + aryColumnNames.add("Name"); + aryColumnNames.add("Gateway"); + aryColumnNames.add("Interface Name"); + + aryColumnNames.add("Type"); + aryColumnNames.add("MAC Address"); + aryColumnNames.add("IP Address"); + aryColumnNames.add("Subnet Mask"); + aryColumnNames.add("Link Name"); + + Vector col = new Vector(aryColumnNames); + JTable tblInfo = new JTable(inVectorMasterList, col); + TableModel model = tblInfo.getModel(); + + // Remove the first 2 column names + lblNodeName.setText(tblInfo.getModel().getValueAt(0, 0).toString()); + tblInfo.getColumnModel().removeColumn(tblInfo.getColumnModel().getColumn(0)); + lblGatewayAddress.setText(tblInfo.getModel().getValueAt(0, 1).toString()); + tblInfo.getColumnModel().removeColumn(tblInfo.getColumnModel().getColumn(0)); + + //Makes uneditable + tblInfo.setEnabled(false); + tblInfo.getTableHeader().setReorderingAllowed(false); + JScrollPane scrPane = new JScrollPane(tblInfo); + + + //ArrayList temp = (ArrayList)inArrayMasterList.get(0); + //lblNodeName.setText((String)temp.get(0)); + //lblGatewayAddress.setText((String)temp.get(1)); + + JPanel pnlPropertiesScreen = (JPanel)this.getContentPane(); + pnlPropertiesScreen.setLayout(new BoxLayout(pnlPropertiesScreen, BoxLayout.Y_AXIS)); + pnlNodeNameDetails.setLayout(new FlowLayout()); + pnlOKButton.setLayout(new FlowLayout()); + + pnlNodeNameDetails.setPreferredSize(new Dimension(50,50)); + pnlNodeNameDetails.add(lblNodeNameLabel); + pnlNodeNameDetails.add(lblNodeName); + pnlGatewayDetails.add(lblGatewayLabel); + pnlGatewayDetails.add(lblGatewayAddress); + pnlPropertiesScreen.add(pnlNodeNameDetails); + pnlPropertiesScreen.add(pnlGatewayDetails); + pnlPropertiesScreen.add(scrPane); + pnlOKButton.add(btnOK); + pnlPropertiesScreen.add(pnlOKButton); + + this.setSize(700,200); + this.setLocationRelativeTo(null); + this.setModal(true); + this.setResizable(false); + btnOK.setToolTipText("Close the screen"); + + //Set default button to be btnOK + this.getRootPane().setDefaultButton(btnOK); + btnOK.addActionListener(this); + } + + + public void actionPerformed(ActionEvent e) + { + if(e.getSource() == btnOK) + { + + this.dispose(); + } + } + + } + Index: SetTCPIPPropertiesDialog.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/SetTCPIPPropertiesDialog.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** SetTCPIPPropertiesDialog.java 13 Sep 2007 13:38:53 -0000 1.7 --- SetTCPIPPropertiesDialog.java 13 Oct 2007 12:57:00 -0000 1.8 *************** *** 434,438 **** for (int i = 0; i < nics.length; i++) { //Add them to the combobox ! cmbInterface.addItem(nics[i]); } cmbInterface.setEnabled(true); --- 434,439 ---- for (int i = 0; i < nics.length; i++) { //Add them to the combobox ! if(Sim.getNode(NodeName).getIntType((String)nics[i]) == core.NetworkInterface.Ethernet10T ) ! cmbInterface.addItem(nics[i]); } cmbInterface.setEnabled(true); --- breakLinkDialog.java DELETED --- --- NEW FILE: EthPortProperties.java --- /* Java Network Simulator (javaNetSim) Copyright (c) 2007, 2006, 2005, Ice Team; All rights reserved. Copyright (c) 2004, jFirewallSim development team; All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of the Canberra Institute of Technology nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package guiUI; import core.InvalidLinkNameException; import core.InvalidNetworkInterfaceNameException; import core.InvalidNodeNameException; import core.Node; import core.NetworkLayerDevice; import javax.swing.JFrame; import javax.swing.JPanel; import java.awt.GridBagLayout; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JTextField; import java.awt.Insets; import java.awt.GridBagConstraints; import java.awt.BorderLayout; import javax.swing.JButton; import java.awt.Dimension; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.JComboBox; import core.Simulation; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.Color; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; import java.util.Arrays; import java.awt.Component; import javax.swing.SwingConstants; /** * * @author Key * * This class is a dialog that shows Ethernet Port Props * */ public class EthPortProperties extends javax.swing.JDialog { private JPanel backpanel; private JLabel lblInterface, cmbInterface; private JLabel lblNodeName, cmbNodeName; private JLabel lblError; private JButton btnOk; private JTextField txtMAC; private JLabel lblMAC; private MainScreen controller; private Simulation Sim; private SandBox SBox; private String NodeName=""; private String NodeInt=""; private boolean ErrorFlag = true; public EthPortProperties(JFrame frame, String inNodeName, String inNodeInt, Simulation Sim, SandBox SBox) { super(frame); this.NodeName = inNodeName; this.NodeInt = inNodeInt; setResizable(false); controller = (MainScreen)frame; this.Sim = Sim; this.SBox = SBox; setTitle("Ethernet Port Properties"); initGUI(inNodeName, inNodeInt); final JPanel panel = new JPanel(); getContentPane().add(panel, BorderLayout.SOUTH); btnOk = new JButton(); btnOk.setEnabled(true); btnOk.setToolTipText("Set options!"); btnOk.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { okButton(); } }); btnOk.setName("btnOK"); panel.add(btnOk); btnOk.setText("OK"); final JButton btnCancel = new JButton(); btnCancel.setToolTipText("Cancel changes"); btnCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { cancelButton(); } }); btnCancel.setName("btnCancel"); panel.add(btnCancel); btnCancel.setText("Cancel"); this.getRootPane().setDefaultButton(btnOk); this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); this.setLocationRelativeTo(null); this.setModal(true); this.setVisible(true); } private void initGUI(String NodeName, String NodeInt) { try { setSize(350, 225); { backpanel = new JPanel(); backpanel.setMinimumSize(new Dimension(200, 10)); this.getContentPane().add(backpanel, BorderLayout.CENTER); GridBagLayout backpanelLayout = new GridBagLayout(); backpanel.setPreferredSize(new java.awt.Dimension(264, 213)); backpanelLayout.columnWeights = new double[] {}; backpanelLayout.columnWidths = new int[] {}; backpanelLayout.rowWeights = new double[] {0.0}; backpanelLayout.rowHeights = new int[] {5,5,5,5}; backpanel.setLayout(backpanelLayout); { lblNodeName = new JLabel(); backpanel.add(lblNodeName, new GridBagConstraints( 0, 0, 1, 1, 0.0, 1.0, GridBagConstraints.LINE_END, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 21, 0)); lblNodeName.setText("Node Name:"); } { lblInterface = new JLabel(); backpanel.add(lblInterface, new GridBagConstraints( 0, 1, 1, 1, 0.0, 1.0, GridBagConstraints.LINE_END, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 27), 0, 0)); lblInterface.setText("Interface:"); } { lblMAC = new JLabel(); backpanel.add(lblMAC, new GridBagConstraints( 0, 2, 1, 1, 0.0, 1.0, GridBagConstraints.LINE_END, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 16), 0, 0)); lblMAC.setText("MAC Address:"); } { cmbNodeName = new JLabel(); cmbNodeName.setMinimumSize(new Dimension(100, 0)); cmbNodeName.setText(NodeName); final GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = GridBagConstraints.LINE_START; gridBagConstraints.gridy = 0; gridBagConstraints.gridx = 1; backpanel.add(cmbNodeName, gridBagConstraints); } { cmbInterface = new JLabel(); cmbInterface.setText(NodeInt); final GridBagConstraints gridBagConstraints_1 = new GridBagConstraints(); gridBagConstraints_1.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints_1.anchor = GridBagConstraints.LINE_START; gridBagConstraints_1.gridy = 1; gridBagConstraints_1.gridx = 1; backpanel.add(cmbInterface, gridBagConstraints_1); } txtMAC = new JTextField(); txtMAC.addFocusListener(new FocusAdapter() { public void actionPerformed(ActionEvent e) { lblError.setVisible(false); } }); txtMAC.setEnabled(true); final GridBagConstraints gridBagConstraints_3 = new GridBagConstraints(); gridBagConstraints_3.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints_3.anchor = GridBagConstraints.LINE_START; gridBagConstraints_3.gridy = 2; gridBagConstraints_3.gridx = 1; backpanel.add(txtMAC, gridBagConstraints_3); txtMAC.setText(Sim.getNode(NodeName).getMACAddress(NodeInt)); lblError = new JLabel(); lblError.setHorizontalTextPosition(SwingConstants.CENTER); lblError.setHorizontalAlignment(SwingConstants.CENTER); lblError.setAlignmentX(Component.CENTER_ALIGNMENT); lblError.setMinimumSize(new Dimension(100, 20)); lblError.setMaximumSize(new Dimension(100, 20)); lblError.setPreferredSize(new Dimension(100, 20)); lblError.setVisible(false); final GridBagConstraints gridBagConstraints_5 = new GridBagConstraints(); gridBagConstraints_5.anchor = GridBagConstraints.WEST; gridBagConstraints_5.insets = new Insets(0, 1, 0, 0); gridBagConstraints_5.fill = GridBagConstraints.BOTH; gridBagConstraints_5.gridwidth = 2; gridBagConstraints_5.gridy = 5; gridBagConstraints_5.gridx = 0; backpanel.add(lblError, gridBagConstraints_5); lblError.setText("Invalid MAC!"); } } catch (Exception e) { e.printStackTrace(); } } /** * This method is executed when the user hit's the enter button. * It will delete the link on selected interface. * * @author Key * */ private void okButton(){ try { String SC = txtMAC.getText(); if(SC.matches("[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]")){ NetworkLayerDevice temp = (NetworkLayerDevice)Sim.getNode(NodeName); temp.setMACAddress(NodeInt, SC); this.dispose(); }else{ lblError.setText("Invalid MAC Address!"); lblError.setForeground(Color.RED); lblError.setVisible(true); controller.shakeDiaLog(this); ErrorFlag = true; } } catch (Exception e) { e.printStackTrace(); } } /** * This method is executed when the user hits the cancel button * @author luke_hamilton * @author Key * */ private void cancelButton(){ this.dispose(); } } Index: SandBox.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/SandBox.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SandBox.java 16 Sep 2007 17:44:14 -0000 1.6 --- SandBox.java 13 Oct 2007 12:57:00 -0000 1.7 *************** *** 108,113 **** */ ! public void addLine(String inName,Point inStart, Point inEnd){ ! pnlLinkLayer.addLine(inName, inStart,inEnd); } --- 108,113 ---- */ ! public void addLine(String inName,Point inStart, Point inEnd, int type){ ! pnlLinkLayer.addLine(inName, inStart,inEnd, type); } Index: MainScreen.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/MainScreen.java,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** MainScreen.java 12 Oct 2007 21:06:39 -0000 1.67 --- MainScreen.java 13 Oct 2007 12:57:00 -0000 1.68 *************** *** 203,207 **** //private JTextArea pnlConsole = new JTextArea(); ! private JTextArea pnlNodeInformation = new JTextArea(); ColorRenderer colorRenderer; --- 203,207 ---- //private JTextArea pnlConsole = new JTextArea(); ! private JEditorPane pnlNodeInformation = new JEditorPane(); ColorRenderer colorRenderer; *************** *** 1119,1123 **** }else{ ! LinkDialog dlgLink = new LinkDialog(inNode1 ,inNode2,strFirstNodeInter, strSecondNodeInter); dlgLink.setTitle("Create Link between " + inNode1 + " and " + inNode2 + "?"); --- 1119,1123 ---- }else{ ! LinkDialog dlgLink = new LinkDialog(inNode1 , inNode2, strFirstNodeInter, strSecondNodeInter); dlgLink.setTitle("Create Link between " + inNode1 + " and " + inNode2 + "?"); *************** *** 1132,1175 **** if(dlgLink.getWasOKPressed()){ ! String strLinkName = dlgLink.getLinkName(); String strFirstNodeInterface = dlgLink.getFirstSelectedInterface(); String strSecondNodeInterface = dlgLink.getSecondSelectedInterface(); ! Sim.addEthernetLink(strLinkName,inNode1, strFirstNodeInterface, inNode2, strSecondNodeInterface); ! ! GuiNode tempFirstNode = (GuiNode)GUInodeTable.get(inNode1); ! ! ! Point FirstPoint = new Point((tempFirstNode.getX() + ! tempFirstNode.getWidth() / 2), (tempFirstNode.getY() + ! tempFirstNode.getHeight() / 2)); ! GuiNode tempSecondNode = (GuiNode)GUInodeTable.get(inNode2); ! Point SecondPoint = new Point((tempSecondNode.getX() + ! tempSecondNode.getWidth() / 2), (tempSecondNode.getY() + ! tempSecondNode.getHeight() / 2)); - - Sandbox.addLine(strLinkName, FirstPoint,SecondPoint); ! ! tempFirstNode.setConnectedLinkName(strLinkName,1, inNode2); ! tempSecondNode.setConnectedLinkName(strLinkName,2, inNode1); //pnlConsole.append("Added Link between "+ inNode1 +" and " + inNode2 + "\n"); ! } --- 1132,1185 ---- if(dlgLink.getWasOKPressed()){ ! String strFirstNodeInterface = dlgLink.getFirstSelectedInterface(); String strSecondNodeInterface = dlgLink.getSecondSelectedInterface(); + + String strLinkName = inNode1 + "-" + Sim.getNode(inNode1).getIntSType(strFirstNodeInterface) + "-" + inNode2; ! if( Sim.getNode(inNode1).getIntType(strFirstNodeInterface) == Sim.getNode(inNode2).getIntType(strSecondNodeInterface)){ ! ! GuiNode tempFirstNode = (GuiNode)GUInodeTable.get(inNode1); ! Point FirstPoint = new Point((tempFirstNode.getX() + ! tempFirstNode.getWidth() / 2), (tempFirstNode.getY() + ! tempFirstNode.getHeight() / 2)); ! GuiNode tempSecondNode = (GuiNode)GUInodeTable.get(inNode2); ! Point SecondPoint = new Point((tempSecondNode.getX() + ! tempSecondNode.getWidth() / 2), (tempSecondNode.getY() + ! tempSecondNode.getHeight() / 2)); ! ! switch(Sim.getNode(inNode1).getIntType(strFirstNodeInterface)){ ! case core.NetworkInterface.Ethernet10T: ! Sim.addEthernetLink(strLinkName,inNode1, strFirstNodeInterface, inNode2, strSecondNodeInterface); ! break; ! case core.NetworkInterface.Serial: ! Sim.addSerialLink(strLinkName,inNode1, strFirstNodeInterface, inNode2, strSecondNodeInterface); ! break; ! } ! ! Sandbox.addLine(strLinkName, FirstPoint, SecondPoint, Sim.getNode(inNode1).getIntType(strFirstNodeInterface)); ! tempFirstNode.setConnectedLinkName(strLinkName,1, inNode2); ! tempSecondNode.setConnectedLinkName(strLinkName,2, inNode1); //pnlConsole.append("Added Link between "+ inNode1 +" and " + inNode2 + "\n"); ! }else{ ! JOptionPane.showMessageDialog(this,"Cannot connect interfaces with different types!","Error!",JOptionPane.ERROR_MESSAGE); ! } } *************** *** 1242,1246 **** ! Sandbox.addLine(strLinkName, FirstPoint,SecondPoint); --- 1252,1256 ---- ! Sandbox.addLine(strLinkName, FirstPoint,SecondPoint, 0); //FIXME! *************** *** 1308,1317 **** catch(LowLinkException e){ ! insertInConsole("(none)", "(none)", "*SYSTEM*", e.toString()); } catch(CommunicationException e){ ! insertInConsole("(none)", "(none)", "*SYSTEM*", e.toString()); } --- 1318,1327 ---- catch(LowLinkException e){ ! insertInConsole(inNodeName, "Link", "*SYSTEM*", e.toString()); } catch(CommunicationException e){ ! insertInConsole(inNodeName, "Network", "*SYSTEM*", e.toString()); } *************** *** 1417,1421 **** //pnlConsole.append(pad(recording[1],15,' ')+packet+pad(recording[3],10,' ')+layer+recording[5]+ "\n"); ! System.out.println(pad(recording[1],15,' ')+packet+pad(recording[3],10,' ')+layer+recording[5]+ "\n"); insertInConsole(recording[1], packet, layer, recording[5]); } --- 1427,1431 ---- //pnlConsole.append(pad(recording[1],15,' ')+packet+pad(recording[3],10,' ')+layer+recording[5]+ "\n"); ! //System.out.println(pad(recording[1],15,' ')+packet+pad(recording[3],10,' ')+layer+recording[5]+ "\n"); insertInConsole(recording[1], packet, layer, recording[5]); } *************** *** 1482,1563 **** ! /** ! ! * Creates a Properties Dialog on the specific Node ! ! * @param String inNodeName The name node to show properties on ! ! */ ! ! ! ! public void showBreakLinkDialog(String inNodeName) ! ! { ! ! Object[] nodesArray = null; ! ! int selectedIndex = -1; ! ! ! ! //if null is passed from the menubar item ! ! //Get array of nodes from within the simulation ! ! if(inNodeName == null){ ! ! ArrayList Values = new ArrayList(); ! ! Enumeration enum1 = GUInodeTable.keys(); ! ! while(enum1.hasMoreElements()){ ! ! String key = (String)enum1.nextElement(); ! ! GuiNode tempNode = (GuiNode)GUInodeTable.get(key); ! ! if(tempNode instanceof NetworkLayerDevice){ ! ! Values.add(key); ! ! } ! ! } ! ! nodesArray = Values.toArray(); ! ! ! ! //Else pass the selected node name ! ! }else{ ! ! nodesArray = new Object[1]; ! ! nodesArray[0] = inNodeName; ! ! selectedIndex = 0; ! ! } ! ! ! ! //test that there are any node within the simulation ! ! if(nodesArray.length != 0){ ! ! new breakLinkDialog(this,nodesArray,selectedIndex,Sim,Sandbox); ! ! this.refreshNodeInformationTab(); ! ! }else ! ! JOptionPane.showMessageDialog(this,"There are currently no node's within the simulation","Warning!",JOptionPane.WARNING_MESSAGE); ! ! } ! ! ! --- 1492,1496 ---- ! *************** *** 1575,1579 **** { - Object[] nodesArray = null; --- 1508,1511 ---- *************** *** 1754,1758 **** public void addFakeLine(Point inPosition){ ! Sandbox.addLine(LinkLayerPanel.FAKELINE, inPosition, inPosition); } --- 1686,1690 ---- public void addFakeLine(Point inPosition){ ! Sandbox.addLine(LinkLayerPanel.FAKELINE, inPosition, inPosition, 0); } *************** *** 2474,2478 **** String strLinkName = iface[1]; ! if(deviceType==2){ if(!iface[2].contains("null")){ --- 2406,2410 ---- String strLinkName = iface[1]; ! if(deviceType==2 && !iface[2].contains("Not Applicable")){ if(!iface[2].contains("null")){ *************** *** 3037,3044 **** String strDefGate = (String)LineData.elementAt(1); String strInterfaceName = (String)LineData.elementAt(2); ! String strMAC = (String)LineData.elementAt(3); ! String strIP = (String)LineData.elementAt(4); ! String strSubnet = (String)LineData.elementAt(5); ! String strLinkName = (String)LineData.elementAt(6); if(!strCurrentNodeName.equals(strNodeName)) --- 2969,2977 ---- String strDefGate = (String)LineData.elementAt(1); String strInterfaceName = (String)LineData.elementAt(2); ! String strInterfaceType = (String)LineData.elementAt(3); ! String strMAC = (String)LineData.elementAt(4); ! String strIP = (String)LineData.elementAt(5); ! String strSubnet = (String)LineData.elementAt(6); ! String strLinkName = (String)LineData.elementAt(7); if(!strCurrentNodeName.equals(strNodeName)) *************** *** 3054,3057 **** --- 2987,2991 ---- out.append("\t<TR bgColor=#CCCCCC>\r\n"); out.append("\t<TD>Interface: " + strInterfaceName + "</TD>\r\n" + + "\t<TD>Type: " + strInterfaceType + "</TD>\r\n" + "\t<TD>MAC address: " + strMAC + "</TD>\r\n" + "\t<TD>IP address: " + strIP + "</TD>\r\n" + *************** *** 3236,3331 **** clearNodeInformation(); ! ! Enumeration enu = GUInodeTable.keys(); ! ! String strCurrentNodeName = ""; ! ! ! ! while(enu.hasMoreElements()) ! ! { ! ! try ! ! { ! ! Vector NodeData = Sim.getAllNodeInformation((String)enu.nextElement()); ! ! Iterator it = NodeData.iterator(); ! ! pnlNodeInformation.append(pad("", 130, '*')+" \n"); ! ! ! ! while(it.hasNext()) ! ! { ! ! Vector LineData = (Vector)it.next(); ! ! String strNodeName = pad((String)LineData.elementAt(0), 25, ' '); ! ! String strDG = pad((String)LineData.elementAt(1), 20, ' '); ! ! String strInterfaceName = pad((String)LineData.elementAt(2), 15, ' '); ! ! String strMAC = pad((String)LineData.elementAt(3), 25, ' '); ! ! String strIP = pad((String)LineData.elementAt(4), 25, ' '); ! ! String strSubnet = pad((String)LineData.elementAt(5), 20, ' '); ! ! String strLinkName = pad((String)LineData.elementAt(6), 45, ' '); ! ! ! ! ! ! if(!strCurrentNodeName.equals(strNodeName)) ! ! { ! ! ! ! strCurrentNodeName = strNodeName; ! ! pnlNodeInformation.append("Information for : " + strNodeName); ! ! pnlNodeInformation.append(" Default Gateway : " + strDG + "\n\n"); ! ! pnlNodeInformation.append("\tInterface MAC Address IP Address Subnet Mask Link Name \n"); ! ! } ! ! ! ! pnlNodeInformation.append("\t" + strInterfaceName); ! ! pnlNodeInformation.append(strMAC); ! ! pnlNodeInformation.append(strIP); ! ! pnlNodeInformation.append(strSubnet); ! ! pnlNodeInformation.append(strLinkName); ! ! pnlNodeInformation.append("\n"); ! ! ! ! } ! ! } ! ! catch(Exception e) ! ! { ! ! ! ! } ! ! } } --- 3170,3179 ---- clearNodeInformation(); ! ! StringBuffer temp = generate_html_node_info(); ! ! pnlNodeInformation.setContentType("text/html"); ! pnlNodeInformation.setText(temp.toString()); ! pnlNodeInformation.setEditable(false); } *************** *** 4097,4110 **** htmlText = htmlText + "<table border='0' cellpadding='1' cellspacing='5'>"; ! htmlText = htmlText + "<tr><td>Interface</td><td>MAC</td><td>IP</td><td>Netmask</td><td>Link To</td></tr>"; for(int i=0; i<VectorMasterList.size(); i++){ htmlText = htmlText + "<tr>"; ! Vector vecInterfaceInfo = (Vector) VectorMasterList.get(i); htmlText = htmlText + "<td>" + vecInterfaceInfo.get(2) + "</td>"; htmlText = htmlText + "<td>" + vecInterfaceInfo.get(3) + "</td>"; htmlText = htmlText + "<td>" + vecInterfaceInfo.get(4) + "</td>"; htmlText = htmlText + "<td>" + vecInterfaceInfo.get(5) + "</td>"; ! String lnk = (String) vecInterfaceInfo.get(6); lnk = lnk.replaceAll("-TO-" + inNodeName,""); lnk = lnk.replaceAll(inNodeName + "-TO-",""); --- 3945,3959 ---- htmlText = htmlText + "<table border='0' cellpadding='1' cellspacing='5'>"; ! htmlText = htmlText + "<tr><td>Interface</td><td>Type</td><td>MAC</td><td>IP</td><td>Netmask</td><td>Link To</td></tr>"; for(int i=0; i<VectorMasterList.size(); i++){ htmlText = htmlText + "<tr>"; ! Vector vecInterfaceInfo = (Vector) VectorMasterList.get(i); htmlText = htmlText + "<td>" + vecInterfaceInfo.get(2) + "</td>"; htmlText = htmlText + "<td>" + vecInterfaceInfo.get(3) + "</td>"; htmlText = htmlText + "<td>" + vecInterfaceInfo.get(4) + "</td>"; htmlText = htmlText + "<td>" + vecInterfaceInfo.get(5) + "</td>"; ! htmlText = htmlText + "<td>" + vecInterfaceInfo.get(6) + "</td>"; ! String lnk = (String) vecInterfaceInfo.get(7); lnk = lnk.replaceAll("-TO-" + inNodeName,""); lnk = lnk.replaceAll(inNodeName + "-TO-",""); *************** *** 4252,4256 **** */ ! public Cursor getCurrentSandboxCursor() --- 4101,4138 ---- */ ! public Object[] getInterfaces(String NodeName) throws InvalidNodeNameException{ ! Object nics[] = Sim.getAllInterfaces(NodeName); //Get object array of interface names ! Arrays.sort(nics); ! return nics; ! } ! ! public void showIntProps(String NodeName, String IntName){ ! try{ ! Node temp = Sim.getNode(NodeName); ! int itype = temp.getIntType(IntName); ! ! switch(itype){ ! case core.NetworkInterface.Ethernet10T: ! new EthPortProperties(this,NodeName, IntName,Sim,Sandbox); ! break; ! default: ! break; ! } ! ! this.refreshNodeInformationTab(); ! }catch(Exception e){ } ! } ! ! public void breakLink(String NodeName, String IntName){ ! if(JOptionPane.showConfirmDialog(this,"Disconnect link from port " + IntName + " on " + NodeName + "?","Confirm disconnect!",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION){ ! try{ ! String str = Sim.disconnectLink(NodeName, IntName); ! Sandbox.removeLine(str); ! this.refreshNodeInformationTab(); ! //controller.addToConsole(NodeName +"'s link on interface "+Interface+" has been disconnected!\n"); ! //^^^FIXME! ! }catch(Exception e){ } ! } ! } public Cursor getCurrentSandboxCursor() Index: GuiNode.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/GuiNode.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** GuiNode.java 14 Sep 2007 11:14:51 -0000 1.3 --- GuiNode.java 13 Oct 2007 12:57:00 -0000 1.4 *************** *** 121,124 **** --- 121,125 ---- protected JLabel lblIcon = new JLabel(); + protected String tmpName = ""; *************** *** 143,149 **** private JMenuItem mnuTurn = new JMenuItem("Turn Off"); ! private JMenuItem mnuLink = new JMenuItem("Links properties"); ! ! private JMenuItem mnuBreakLink = new JMenuItem("Break link"); private String strNodeName; --- 144,152 ---- private JMenuItem mnuTurn = new JMenuItem("Turn Off"); ! private JMenu mnuBreakLink = new JMenu("Disconnect link:"); ! ! private JMenuItem mnuLink = new JMenuItem("Links properties"); ! ! private JMenu mnuInt = new JMenu("Interface properties:"); private String strNodeName; *************** *** 302,315 **** }); ! mnuBreakLink.addActionListener(new ActionListener(){ ! public void actionPerformed(ActionEvent e){ ! controller.showBreakLinkDialog(lblNodeName.getText()); ! } ! }); mnuLink.addActionListener(new ActionListener(){ --- 305,343 ---- }); + ! try{ ! Object ints[] = controller.getInterfaces(lblNodeName.getText()); ! for(int i = 0; i < ints.length; i++){ ! JMenuItem mnuI = new JMenuItem((String) ints[i]); ! mnuI.addActionListener(new ActionListener(){ ! public void actionPerformed(ActionEvent e){ ! ! controller.showIntProps(lblNodeName.getText(), ((JMenuItem)e.getSource()).getText()); ! } ! }); ! mnuInt.add(mnuI); ! ! JMenuItem mnuDI = new JMenuItem((String) ints[i]); ! mnuDI.addActionListener(new ActionListener(){ ! ! public void actionPerformed(ActionEvent e){ ! ! controller.breakLink(lblNodeName.getText(), ((JMenuItem)e.getSource()).getText()); ! ! } ! ! }); ! mnuBreakLink.add(mnuDI); ! } ! ! }catch(Exception e){ ! e.printStackTrace(); ! } ! mnuLink.addActionListener(new ActionListener(){ *************** *** 322,329 **** }); GuiNodePopMenu.add(mnuDelete); GuiNodePopMenu.add(mnuTurn); - GuiNodePopMenu.add(mnuLink); GuiNodePopMenu.add(mnuBreakLink); mnuTurn.addActionListener(new ActionListener(){ --- 350,359 ---- }); + GuiNodePopMenu.add(mnuDelete); GuiNodePopMenu.add(mnuTurn); GuiNodePopMenu.add(mnuBreakLink); + GuiNodePopMenu.add(mnuLink); + GuiNodePopMenu.add(mnuInt); mnuTurn.addActionListener(new ActionListener(){ *************** *** 651,655 **** boolean ena = controller.isOn(lblNodeName.getText()); for(int i=2; i< GuiNodePopMenu.getSubElements().length; i++){ ! ((JMenuItem)GuiNodePopMenu.getSubElements()[i]).setEnabled(ena); } GuiNodePopMenu.show(e.getComponent(),e.getX(),e.getY()); --- 681,685 ---- boolean ena = controller.isOn(lblNodeName.getText()); for(int i=2; i< GuiNodePopMenu.getSubElements().length; i++){ ! ((JMenuItem)GuiNodePopMenu.getSubElements()[i]).setEnabled(ena); } GuiNodePopMenu.show(e.getComponent(),e.getX(),e.getY()); |