Thread: [Javanetsim-cvs] javaNetSim/guiUI ApplicationLayerDevice.java, 1.14, 1.15 GuiLaptop.java, 1.3, 1.4
Status: Beta
Brought to you by:
darkkey
From: Alexander B. <da...@us...> - 2008-10-27 16:09:08
|
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv8465/guiUI Modified Files: ApplicationLayerDevice.java GuiLaptop.java GuiNode.java GuiPC.java MainScreen.java Log Message: Index: MainScreen.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/MainScreen.java,v retrieving revision 1.103 retrieving revision 1.104 diff -C2 -d -r1.103 -r1.104 *** MainScreen.java 26 Oct 2008 15:37:40 -0000 1.103 --- MainScreen.java 27 Oct 2008 16:09:02 -0000 1.104 *************** *** 1936,1939 **** --- 1936,1992 ---- } + public void Terminal(String nodeName){ + + core.Node node = Sim.getNode(nodeName); + + try{ + + if(!(node instanceof core.NetworkLayerDevice)){ + JOptionPane.showMessageDialog(this, + "Invalid device type!", "Terminal", JOptionPane.ERROR_MESSAGE); + + return; + } + + core.ConsoleNetworkInterface cint1 = (core.ConsoleNetworkInterface)node.getNIC("cua0"); + + core.ConsoleLink lnk = (core.ConsoleLink)(cint1).getConnectedLink(); + + if(lnk == null){ + JOptionPane.showMessageDialog(this, + "Console interface has no connection!", "Terminal", JOptionPane.ERROR_MESSAGE); + } + + core.NetworkLayerDevice device = (core.NetworkLayerDevice)lnk.getParent(nodeName); + + core.ConsoleNetworkInterface cint2 = (core.ConsoleNetworkInterface)device.getNIC("cua0"); + + if(!device.On || !cint2.isUP() || !cint1.isUP()){ + JOptionPane.showMessageDialog(this, + "Console interface has no connection or is down!", "Terminal", JOptionPane.ERROR_MESSAGE); + } + + if(cint1.databits == cint2.databits && + cint1.flowcontrol == cint2.flowcontrol && + cint1.parity == cint2.parity && + cint1.speed == cint2.speed && + cint1.stopbits == cint2.stopbits && + cint1.speed == 9600 && + cint1.flowcontrol == core.ConsoleNetworkInterface.FLOWCONTROL_NONE){ + + RunCmd(device.getName()); + }else{ + JOptionPane.showMessageDialog(this, + "Incorrect port params!", "Terminal", JOptionPane.ERROR_MESSAGE); + } + + }catch(Exception e){ + JOptionPane.showMessageDialog(this, + "Unrecoverable error!", "Terminal", JOptionPane.ERROR_MESSAGE); + + } + + } + public void Export(){ JFileChooser chooser = new JFileChooser(); *************** *** 4549,4552 **** --- 4602,4608 ---- new SerPortProperties(this, NodeName, IntName, Sim, Sandbox); break; + case core.NetworkInterface.Console: + new ConsolePortProperties(this, NodeName, IntName, Sim); + break; case core.NetworkInterface.WAN: /* Index: GuiNode.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/GuiNode.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** GuiNode.java 26 Oct 2008 22:02:46 -0000 1.14 --- GuiNode.java 27 Oct 2008 16:09:02 -0000 1.15 *************** *** 338,342 **** int int_type = Simulation.Sim.getNode(this.strNodeName).getIntType((String)ints[i]); ! if(int_type != core.NetworkInterface.Console){ JMenuItem mnuI = new JMenuItem((String) ints[i]); mnuI.addActionListener(new ActionListener() { --- 338,342 ---- int int_type = Simulation.Sim.getNode(this.strNodeName).getIntType((String)ints[i]); ! if(int_type != core.NetworkInterface.Unknown){ JMenuItem mnuI = new JMenuItem((String) ints[i]); mnuI.addActionListener(new ActionListener() { Index: GuiPC.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/GuiPC.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** GuiPC.java 24 Oct 2008 16:18:48 -0000 1.12 --- GuiPC.java 27 Oct 2008 16:09:02 -0000 1.13 *************** *** 197,200 **** --- 197,203 ---- mnuAppLayer.addSeparator(); mnuAppLayer.add(mnuDHCPD); + + mnuAppLayer.addSeparator(); + mnuAppLayer.add(mnuTerminal); } Index: ApplicationLayerDevice.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/ApplicationLayerDevice.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ApplicationLayerDevice.java 24 Oct 2008 16:18:48 -0000 1.14 --- ApplicationLayerDevice.java 27 Oct 2008 16:09:02 -0000 1.15 *************** *** 21,24 **** --- 21,26 ---- protected JMenu mnuAppLayer = new JMenu("Applications"); + + protected JMenuItem mnuTerminal = new JMenuItem("Terminal"); private JMenuItem mnuDHCPC = new JMenuItem("Run DHCP Client"); *************** *** 51,54 **** --- 53,62 ---- } }); + + mnuTerminal.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + controller.Terminal(lblNodeName.getText()); + } + }); mnuAppLayer.add(mnuSNMPStartAgent); Index: GuiLaptop.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/GuiLaptop.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** GuiLaptop.java 24 Oct 2008 16:18:48 -0000 1.3 --- GuiLaptop.java 27 Oct 2008 16:09:02 -0000 1.4 *************** *** 172,175 **** --- 172,177 ---- mnuAppLayer.add(mnuPosixTelnet); + mnuAppLayer.addSeparator(); + mnuAppLayer.add(mnuTerminal); } |