Thread: [Javanetsim-cvs] javaNetSim/guiUI DataLinkLayerDevice.java, 1.3, 1.4 GuiNode.java, 1.2, 1.3 LinkPro
Status: Beta
Brought to you by:
darkkey
|
From: Alexander B. <da...@us...> - 2007-09-14 11:14:57
|
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv16192/guiUI Modified Files: DataLinkLayerDevice.java GuiNode.java LinkProperties.java MainScreen.java NetworkLayerDevice.java breakLinkDialog.java Log Message: Fixed Java 6 related bugs in several Dialogs, introduced new function: Turn On/Off network device... Index: LinkProperties.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/LinkProperties.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** LinkProperties.java 10 Nov 2006 19:40:15 -0000 1.6 --- LinkProperties.java 14 Sep 2007 11:14:51 -0000 1.7 *************** *** 123,127 **** btnCancel.setText("Cancel"); this.getRootPane().setDefaultButton(btnOk); ! this.setDefaultCloseOperation(JDialog.EXIT_ON_CLOSE); this.setLocationRelativeTo(null); this.setModal(true); --- 123,127 ---- btnCancel.setText("Cancel"); this.getRootPane().setDefaultButton(btnOk); ! this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); this.setLocationRelativeTo(null); this.setModal(true); Index: NetworkLayerDevice.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/NetworkLayerDevice.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** NetworkLayerDevice.java 28 Feb 2006 16:55:35 -0000 1.8 --- NetworkLayerDevice.java 14 Sep 2007 11:14:51 -0000 1.9 *************** *** 125,135 **** private JMenuItem mnuArp = new JMenuItem("Print ARP Table"); - private JMenuItem mnuLink = new JMenuItem("Links properties"); - - private JMenuItem mnuBreakLink = new JMenuItem("Break link"); - - - - /** --- 125,128 ---- *************** *** 227,241 **** }); ! mnuBreakLink.addActionListener(new ActionListener(){ ! ! public void actionPerformed(ActionEvent e){ ! ! controller.showBreakLinkDialog(lblNodeName.getText()); ! ! } ! ! }); ! ! mnuPR.addActionListener(new ActionListener(){ --- 220,224 ---- }); ! mnuPR.addActionListener(new ActionListener(){ *************** *** 249,266 **** }); - mnuLink.addActionListener(new ActionListener(){ - - public void actionPerformed(ActionEvent e){ - - controller.showLinkDialog(lblNodeName.getText()); - - } - - }); - - - - - mnuShowCounters.addActionListener(new ActionListener(){ --- 232,235 ---- *************** *** 309,316 **** GuiNodePopMenu.add(mnuPR); - GuiNodePopMenu.add(mnuBreakLink); - - GuiNodePopMenu.add(mnuLink); - GuiNodePopMenu.add(mnuProperties); --- 278,281 ---- Index: breakLinkDialog.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/breakLinkDialog.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** breakLinkDialog.java 13 Sep 2007 13:38:53 -0000 1.3 --- breakLinkDialog.java 14 Sep 2007 11:14:51 -0000 1.4 *************** *** 1,310 **** /* 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.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 enables to remove links from the devices * */ public class breakLinkDialog extends javax.swing.JDialog { private JPanel backpanel; private JLabel lblInterface; private JLabel lblNodeName; private JComboBox cmbNodeName; private JComboBox cmbInterface; private JLabel lblError; private JButton btnOk; private MainScreen controller; private Simulation Sim; private SandBox SBox; private String NodeName; private String Interface; private boolean ErrorFlag = true; public breakLinkDialog(JFrame frame, Object nodeArray[], int selectedIndex, Simulation Sim, SandBox SBox) { super(frame); setResizable(false); controller = (MainScreen)frame; this.Sim = Sim; this.SBox = SBox; setTitle("Break link"); initGUI(nodeArray,selectedIndex); final JPanel panel = new JPanel(); getContentPane().add(panel, BorderLayout.SOUTH); btnOk = new JButton(); btnOk.setEnabled(true); btnOk.setToolTipText("Disconnect selected link!"); 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.EXIT_ON_CLOSE); this.setLocationRelativeTo(null); this.setModal(true); this.setVisible(true); } private void initGUI(Object nodeArray[], int selectedIndex) { 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:"); } cmbNodeName = new JComboBox(nodeArray); cmbNodeName.setMinimumSize(new Dimension(100, 0)); cmbNodeName.setSelectedIndex(selectedIndex); cmbNodeName.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { selectNode(); } }); 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 JComboBox(); cmbInterface.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { selectInterface(); } }); cmbInterface.setEnabled(false); 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); 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("Error Message!!!! Error"); if(selectedIndex == 0){ selectNode(); } } } 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 { if(NodeName != null && Interface != null){ String str = Sim.disconnectLink(NodeName, Interface); SBox.removeLine(str); controller.addToConsole(NodeName +"'s link on interface "+Interface+" has been disconnected!\n"); } this.dispose(); } 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(); } /** * This method will generate the data within the Interface combobox based * on the node that is selected. It will also get the default gateway if there is one set * for the node and add the text to the text field * * @author luke_hamilton * @author Key * */ private void selectNode(){ //Remove all items before regenerating the combobox. //This is because if a users selects the node twice, it would add the interfaces twice. cmbInterface.removeAllItems(); NodeName = (String)cmbNodeName.getSelectedItem(); try { Object nics[] = Sim.getAllInterfaces(NodeName); //Get object array of interface names //Sort the array Arrays.sort(nics); for (int i = 0; i < nics.length; i++) { //Add them to the combobox cmbInterface.addItem(nics[i]); } cmbInterface.setEnabled(true); } catch (Exception e) { //This should never happen e.printStackTrace(); } } /** * This method enabled's the IP Address text field once the interface has been selected. * This will also check the selected interface to see if the ip address has already been set * if so entering that ip address into the text field and then getting the set subnet mask for that * ip address. * @author Key */ private void selectInterface(){ Interface = (String)cmbInterface.getSelectedItem(); } } --- 1,620 ---- /* + 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.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 enables to remove links from the devices + * + */ + public class breakLinkDialog extends javax.swing.JDialog { + private JPanel backpanel; + private JLabel lblInterface; + private JLabel lblNodeName; + private JComboBox cmbNodeName; + private JComboBox cmbInterface; + private JLabel lblError; + private JButton btnOk; + + private MainScreen controller; + private Simulation Sim; + private SandBox SBox; + + private String NodeName; + private String Interface; + + private boolean ErrorFlag = true; + + public breakLinkDialog(JFrame frame, Object nodeArray[], int selectedIndex, Simulation Sim, SandBox SBox) { + super(frame); + setResizable(false); + controller = (MainScreen)frame; + this.Sim = Sim; + this.SBox = SBox; + setTitle("Break link"); + initGUI(nodeArray,selectedIndex); + + final JPanel panel = new JPanel(); + getContentPane().add(panel, BorderLayout.SOUTH); + + btnOk = new JButton(); + btnOk.setEnabled(true); + btnOk.setToolTipText("Disconnect selected link!"); + 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(Object nodeArray[], int selectedIndex) { + 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:"); + } + + cmbNodeName = new JComboBox(nodeArray); + cmbNodeName.setMinimumSize(new Dimension(100, 0)); + cmbNodeName.setSelectedIndex(selectedIndex); + cmbNodeName.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + selectNode(); + } + }); + 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 JComboBox(); + cmbInterface.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + selectInterface(); + } + }); + cmbInterface.setEnabled(false); + + 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); + + 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("Error Message!!!! Error"); + + + if(selectedIndex == 0){ + selectNode(); + } + + } + } 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 { + + if(NodeName != null && Interface != null){ + String str = Sim.disconnectLink(NodeName, Interface); + SBox.removeLine(str); + controller.addToConsole(NodeName +"'s link on interface "+Interface+" has been disconnected!\n"); + + } + + + this.dispose(); + } 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(); + } + + /** + * This method will generate the data within the Interface combobox based + * on the node that is selected. It will also get the default gateway if there is one set + * for the node and add the text to the text field + * + * @author luke_hamilton + * @author Key + * + */ + private void selectNode(){ + + //Remove all items before regenerating the combobox. + //This is because if a users selects the node twice, it would add the interfaces twice. + cmbInterface.removeAllItems(); + + NodeName = (String)cmbNodeName.getSelectedItem(); + + try { + Object nics[] = Sim.getAllInterfaces(NodeName); //Get object array of interface names + + //Sort the array + Arrays.sort(nics); + + for (int i = 0; i < nics.length; i++) { //Add them to the combobox + cmbInterface.addItem(nics[i]); + } + cmbInterface.setEnabled(true); + + } catch (Exception e) { //This should never happen + e.printStackTrace(); + } + } + + /** + * This method enabled's the IP Address text field once the interface has been selected. + * This will also check the selected interface to see if the ip address has already been set + * if so entering that ip address into the text field and then getting the set subnet mask for that + * ip address. + * @author Key + */ + private void selectInterface(){ + Interface = (String)cmbInterface.getSelectedItem(); + } + + } + Index: DataLinkLayerDevice.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/DataLinkLayerDevice.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DataLinkLayerDevice.java 13 Sep 2007 13:38:52 -0000 1.3 --- DataLinkLayerDevice.java 14 Sep 2007 11:14:50 -0000 1.4 *************** *** 1,99 **** /* 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.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JMenuItem; /** * <P>The DataLinkLayerDevice class is an abstract class used for further classification of Data </P> * <P>link layer devices such as Hub's and Switches. * * @author VC2 Team. * @since 15th November 2004 * @version v0.20 */ public abstract class DataLinkLayerDevice extends GuiNode { private JMenuItem mnuProperties = new JMenuItem("Properties ..."); private JMenuItem mnuShowState = new JMenuItem("Show state"); private JMenuItem mnuReset = new JMenuItem("Reset"); ! private JMenuItem mnuLink = new JMenuItem("Links properties"); ! private JMenuItem mnuBreakLink = new JMenuItem("Break link"); ! ! /** * @param inName The name of the Data Link Layer Device * @param inMainscreen The JFrame that the router will be created on * @param imageLocation Location of the Image used on the GUI */ public DataLinkLayerDevice(String inName, MainScreen inMainScreen, String imageLocation) { super(inName, inMainScreen, imageLocation); mnuProperties.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ controller.showPropertiesDialog(lblNodeName.getText()); } }); ! mnuBreakLink.addActionListener(new ActionListener(){ ! public void actionPerformed(ActionEvent e){ ! controller.showBreakLinkDialog(lblNodeName.getText()); ! } ! }); ! mnuReset.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ controller.ResetHub(lblNodeName.getText()); } }); mnuShowState.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ controller.ShowHubState(lblNodeName.getText()); } }); ! mnuLink.addActionListener(new ActionListener(){ ! public void actionPerformed(ActionEvent e){ ! controller.showLinkDialog(lblNodeName.getText()); ! } ! }); GuiNodePopMenu.add(mnuProperties); GuiNodePopMenu.add(mnuShowState); ! GuiNodePopMenu.add(mnuReset); ! GuiNodePopMenu.add(mnuLink); ! GuiNodePopMenu.add(mnuBreakLink); } } --- 1,165 ---- /* + 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 endor... [truncated message content] |