[Javanetsim-cvs] javaNetSim/guiUI GuiExternalProxy.java, NONE, 1.1 MainScreen.java, 1.50, 1.51 Menu
Status: Beta
Brought to you by:
darkkey
From: Alexander B. <da...@us...> - 2006-11-22 21:18:43
|
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv22200/guiUI Modified Files: MainScreen.java MenuBar.java SandBox.java Added Files: GuiExternalProxy.java Removed Files: GuiExternalNAT.java Log Message: Index: MainScreen.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/MainScreen.java,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** MainScreen.java 8 Nov 2006 14:27:29 -0000 1.50 --- MainScreen.java 22 Nov 2006 21:18:38 -0000 1.51 *************** *** 127,131 **** import core.protocolsuite.tcp_ip.Telnet_client; import guiUI.RunCMD; ! --- 127,131 ---- import core.protocolsuite.tcp_ip.Telnet_client; import guiUI.RunCMD; ! import javax.swing.JViewport; *************** *** 214,218 **** private JFileChooser chooser = new JFileChooser(); ! //This is the consol window used to display feedback from the sim --- 214,218 ---- private JFileChooser chooser = new JFileChooser(); ! private JScrollPane scroller = new JScrollPane(); //This is the consol window used to display feedback from the sim *************** *** 346,356 **** this.setJMenuBar(new MenuBar(this)); ! ! ! // setup sandbox ! Sandbox = new SandBox(this); ! pSplit.setTopComponent(Sandbox); --- 346,365 ---- this.setJMenuBar(new MenuBar(this)); ! scroller = new JScrollPane(); ! ! //scroller.setVerticalScrollBar(new JScrollBar()); ! //scroller.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); ! //scroller.setHorizontalScrollBar(new JScrollBar()); ! //scroller.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); ! ! ! // setup sandbox ! Sandbox = new SandBox(this); ! ! scroller.getViewport().add(Sandbox); ! ! pSplit.setTopComponent(scroller); *************** *** 383,386 **** --- 392,397 ---- this.setSize(800, 600); + + this.setTitle("javaNetSim"); *************** *** 396,402 **** //this.setExtendedState(MAXIMIZED_BOTH); ! ! ! } --- 407,411 ---- //this.setExtendedState(MAXIMIZED_BOTH); ! } *************** *** 728,732 **** public void addExternalNAT(Point inPoint){ ! String result = JOptionPane.showInputDialog(this,"Please enter a NAT Gateway to External network name:","Create New NAT Gateway to External network", JOptionPane.PLAIN_MESSAGE); if(result != null){ --- 737,741 ---- public void addExternalNAT(Point inPoint){ ! String result = JOptionPane.showInputDialog(this,"Please enter a Proxy/Gateway to External network name:","Create New NAT Gateway to External network", JOptionPane.PLAIN_MESSAGE); if(result != null){ *************** *** 740,744 **** Sim.addExternalNAT(result); ! GuiExternalNAT tempEN = new GuiExternalNAT(result,this); tempEN.setNodeLocation(inPoint); --- 749,753 ---- Sim.addExternalNAT(result); ! GuiExternalProxy tempEN = new GuiExternalProxy(result,this); tempEN.setNodeLocation(inPoint); *************** *** 2161,2165 **** Sandbox.add(tempHub); ! Sandbox.setLayer(tempHub,3,0); GUInodeTable.put(strNodeName,tempHub); --- 2170,2175 ---- Sandbox.add(tempHub); ! Sandbox.setLayer((Component) tempHub,3,0); ! GUInodeTable.put(strNodeName,tempHub); *************** *** 2213,2217 **** GUInodeTable.put(strNodeName,tempRouter); ! }else if(strClassName.contains("GuiExternalNAT")){ deviceType = 2; --- 2223,2227 ---- GUInodeTable.put(strNodeName,tempRouter); ! }else if(strClassName.contains("GuiExternalProxy")){ deviceType = 2; *************** *** 2219,2223 **** Sim.addExternalNAT(strNodeName); ! GuiExternalNAT tempRouter = new GuiExternalNAT(strNodeName,this); tempRouter.setNodeLocation(pnt); --- 2229,2233 ---- Sim.addExternalNAT(strNodeName); ! GuiExternalProxy tempRouter = new GuiExternalProxy(strNodeName,this); tempRouter.setNodeLocation(pnt); *************** *** 2976,2984 **** Sandbox = null; ! Sandbox = new SandBox(this); ! ! pSplit.setTopComponent(Sandbox); pSplit.setDividerLocation(.8); --- 2986,2999 ---- Sandbox = null; + scroller = null; + + Sandbox = new SandBox(this); + scroller = new JScrollPane(); ! ! scroller.getViewport().add(Sandbox); + pSplit.setTopComponent(scroller); + pSplit.setDividerLocation(.8); *************** *** 3252,3259 **** --- 3267,3280 ---- String ip = JOptionPane.showInputDialog(this, "Server IP:", "Send msg over Echo.", JOptionPane.QUESTION_MESSAGE); + if(ip == null) return; + String port = JOptionPane.showInputDialog(this, "Server Port:", "Send msg over Echo.", JOptionPane.QUESTION_MESSAGE); + + if(port == null) return; String msg = JOptionPane.showInputDialog(this, "Message:", "Message.", JOptionPane.QUESTION_MESSAGE); + if(msg == null) return; + String cnt = JOptionPane.showInputDialog(this, "Quantity:", "How many times send.", JOptionPane.QUESTION_MESSAGE); *************** *** 3359,3366 **** --- 3380,3393 ---- String ip = JOptionPane.showInputDialog(this, "Server IP:", "Send msg over Echo.", JOptionPane.QUESTION_MESSAGE); + if(ip == null) return; + String port = JOptionPane.showInputDialog(this, "Server Port:", "Send msg over Echo.", JOptionPane.QUESTION_MESSAGE); + if(port == null) return; + String msg = JOptionPane.showInputDialog(this, "Message:", "Message.", JOptionPane.QUESTION_MESSAGE); + if(msg == null) return; + String cnt = JOptionPane.showInputDialog(this, "Quantity:", "How many times send.", JOptionPane.QUESTION_MESSAGE); --- GuiExternalNAT.java DELETED --- Index: MenuBar.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/MenuBar.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** MenuBar.java 8 Nov 2006 14:27:29 -0000 1.8 --- MenuBar.java 22 Nov 2006 21:18:38 -0000 1.9 *************** *** 55,59 **** private JMenuItem mnuHub = new JMenuItem("Hub ..."); private JMenuItem mnuSwitch = new JMenuItem("Switch ..."); ! private JMenuItem mnuExternalNAT = new JMenuItem("NAT Gateway to External Network..."); //Tools submenu --- 55,59 ---- private JMenuItem mnuHub = new JMenuItem("Hub ..."); private JMenuItem mnuSwitch = new JMenuItem("Switch ..."); ! private JMenuItem mnuExternalNAT = new JMenuItem("Proxy/Router to External Network..."); //Tools submenu *************** *** 126,130 **** mnuAdd.add(mnuHub); mnuAdd.add(mnuSwitch); ! //mnuAdd.add(mnuExternalNAT); mnuSimulation.add(mnuTools); --- 126,130 ---- mnuAdd.add(mnuHub); mnuAdd.add(mnuSwitch); ! mnuAdd.add(mnuExternalNAT); mnuSimulation.add(mnuTools); --- NEW FILE: GuiExternalProxy.java --- /* 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; /** * <P>The GuiRouter class is used to instantiate new Routers on the GUI</P> * * @author VC2 Team. * @since 15th November 2004 * @version v0.20 */ public class GuiExternalProxy extends NetworkLayerDevice { /** * @param inName The name of the router * @param inMainscreen The JFrame that the router will be created on */ public GuiExternalProxy(String inName, MainScreen inMainScreen){ super(inName, inMainScreen,"images/simulation/network_local.png"); } } Index: SandBox.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/SandBox.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SandBox.java 8 Nov 2006 14:27:29 -0000 1.2 --- SandBox.java 22 Nov 2006 21:18:38 -0000 1.3 *************** *** 33,36 **** --- 33,37 ---- import java.awt.*; import javax.swing.JLayeredPane; + import javax.swing.JDesktopPane; /** *************** *** 44,47 **** --- 45,50 ---- * @author Team VC2 */ + + public class SandBox extends JLayeredPane implements MouseListener, MouseMotionListener, ComponentListener{ *************** *** 82,92 **** this.addMouseMotionListener(this); this.setLayout(null); addComponentListener(this); pnlLinkLayer = new LinkLayerPanel(); ! setLayer(pnlLinkLayer,1,0); this.add(pnlLinkLayer); ! controller = inMainScreen; } /** * Adds a new line to the LinkLayerPanel --- 85,104 ---- this.addMouseMotionListener(this); this.setLayout(null); + //this. addComponentListener(this); pnlLinkLayer = new LinkLayerPanel(); ! ! this.setLayer(pnlLinkLayer,1,0); this.add(pnlLinkLayer); ! controller = inMainScreen; ! ! this.setPreferredSize(new Dimension(7000,7000)); } + + // public void setLayer(Object o, int y, int x) { + // ((GuiNode) o).setVisible(true); + // } + /** * Adds a new line to the LinkLayerPanel *************** *** 229,234 **** public void componentResized(ComponentEvent arg0){ ! pnlLinkLayer.setSize(this.getSize()); ! controller.updateNodesKnowledge(this.getSize()); } public void componentHidden(ComponentEvent arg0){} --- 241,246 ---- public void componentResized(ComponentEvent arg0){ ! pnlLinkLayer.setSize(this.getSize()); ! controller.updateNodesKnowledge(this.getSize()); } public void componentHidden(ComponentEvent arg0){} |