[Javanetsim-cvs] javaNetSim/guiUI GuiPC.java, 1.9, 1.10 MainScreen.java, 1.93, 1.94
Status: Beta
Brought to you by:
darkkey
From: Alexander B. <da...@us...> - 2008-10-17 09:14:42
|
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18066/guiUI Modified Files: GuiPC.java MainScreen.java Log Message: Index: MainScreen.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/MainScreen.java,v retrieving revision 1.93 retrieving revision 1.94 diff -C2 -d -r1.93 -r1.94 *** MainScreen.java 13 Oct 2008 22:52:07 -0000 1.93 --- MainScreen.java 17 Oct 2008 09:10:16 -0000 1.94 *************** *** 133,147 **** private static final String HTM_PREFIX = "htm"; - private int Rcnt = 0, SWcnt = 0, PCcnt = 0, PRINTcnt = 0, HUBcnt = 0, - APcnt = 0; - // File used to save simulation private File simSaveFile; - // File used to save GUI object - - private File guiSaveFile; - // Simulation object --- 133,140 ---- *************** *** 467,474 **** --- 460,471 ---- nodeTemplates.put("PC", new nodeTemplate("PC", "PC", "images/simulation/mymac.png", "PC")); + nodeTemplates.put("Laptop", new nodeTemplate("Laptop", "Laptop", "images/simulation/laptop.png", "Laptop")); + nodeTemplates.put("Router", new nodeTemplate("Router", "Router", "images/simulation/router.png", "Router")); nodeTemplates.put("Switch", new nodeTemplate("Switch", "Switch", "images/simulation/switch.png", "Switch")); + nodeTemplates.put("MultilayerSwitch", new nodeTemplate("MultilayerSwitch", "Multilayer Switch", "images/simulation/mlswitch.png", "Multilayer Switch")); + nodeTemplates.put("Hub", new nodeTemplate("Hub", "Hub", "images/simulation/hub.png", "Hub")); *************** *** 755,759 **** String result = JOptionPane.showInputDialog(this, "Please enter a name for new " + className + ":", className ! + SWcnt); if (result != null) { --- 752,756 ---- String result = JOptionPane.showInputDialog(this, "Please enter a name for new " + className + ":", className ! + nodeTemplates.get(className).getCnt()); if (result != null) { *************** *** 765,769 **** try { ! SWcnt++; Sim.addNode(className, result, true); --- 762,766 ---- try { ! nodeTemplates.get(className).Inc(); Sim.addNode(className, result, true); *************** *** 1178,1197 **** if (Layer.contains("Network")) { colorRenderer.setRowColor(mConsole.getRowCount() - 1, ! this.NETWORK_LAYER_COLOR); } else if (Layer.contains("Link")) { colorRenderer.setRowColor(mConsole.getRowCount() - 1, ! this.LINK_LAYER_COLOR); } else if (Layer.contains("Transport")) { colorRenderer.setRowColor(mConsole.getRowCount() - 1, ! this.TRANSPORT_LAYER_COLOR); } else if (Layer.contains("Application")) { colorRenderer.setRowColor(mConsole.getRowCount() - 1, ! this.APPLICATION_LAYER_COLOR); } else if (Layer.contains("Hardware")) { colorRenderer.setRowColor(mConsole.getRowCount() - 1, ! this.HARDWARE_LAYER_COLOR); } else if (Layer.contains("*SYSTEM*")) { colorRenderer.setRowColor(mConsole.getRowCount() - 1, ! this.SYSTEM_LAYER_COLOR); } --- 1175,1194 ---- if (Layer.contains("Network")) { colorRenderer.setRowColor(mConsole.getRowCount() - 1, ! MainScreen.NETWORK_LAYER_COLOR); } else if (Layer.contains("Link")) { colorRenderer.setRowColor(mConsole.getRowCount() - 1, ! MainScreen.LINK_LAYER_COLOR); } else if (Layer.contains("Transport")) { colorRenderer.setRowColor(mConsole.getRowCount() - 1, ! MainScreen.TRANSPORT_LAYER_COLOR); } else if (Layer.contains("Application")) { colorRenderer.setRowColor(mConsole.getRowCount() - 1, ! MainScreen.APPLICATION_LAYER_COLOR); } else if (Layer.contains("Hardware")) { colorRenderer.setRowColor(mConsole.getRowCount() - 1, ! MainScreen.HARDWARE_LAYER_COLOR); } else if (Layer.contains("*SYSTEM*")) { colorRenderer.setRowColor(mConsole.getRowCount() - 1, ! MainScreen.SYSTEM_LAYER_COLOR); } *************** *** 1820,1823 **** --- 1817,1823 ---- strSave += "#data\n"; + + strSave += ((core.NetworkLayerDevice) Sim + .getNode(key)).getAllData(); strSave += "#enddata\n"; *************** *** 2300,2308 **** line = input.readLine(); if (line.contains("#data")) { ! line = input.readLine(); ! while (!line.contains("#enddata")) { line = input.readLine(); ! if (line == null) break; } } --- 2300,2330 ---- line = input.readLine(); if (line.contains("#data")) { ! ! boolean more_data = true; ! ! while(more_data){ ! String file; ! int lines; ! String data = ""; ! line = input.readLine(); ! if(line.contains("#enddata")){ ! more_data = false; break; + } + + file = line; + + lines = Integer.valueOf(input.readLine()); + + for(int i = 0; i<lines; i++){ + line = input.readLine(); + if (line == null || line.contains("#enddata")) + break; + data += line; + } + + ((core.NetworkLayerDevice) Sim + .getNode(strNodeName)).loadDataFile(file, lines, data); } } *************** *** 2670,2673 **** --- 2692,2701 ---- try { + + if(Sim.getNode(strNodeName) instanceof core.DataLinkLayerDevice) + Sim.getNode(strNodeName).ifacesLinkUP(); + else + Sim.getNode(strNodeName).ifacesUP(); + Route_entry r; *************** *** 2685,2694 **** Sim.addRoute(strNodeName, r); } ! ! Sim.getNode(strNodeName).ifacesUP(); Sim.execCmd(strNodeName, "write mem"); } catch (Exception e) { } } --- 2713,2723 ---- Sim.addRoute(strNodeName, r); } ! Sim.execCmd(strNodeName, "write mem"); } catch (Exception e) { } + + } Index: GuiPC.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/GuiPC.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** GuiPC.java 6 Oct 2008 13:20:39 -0000 1.9 --- GuiPC.java 17 Oct 2008 09:10:16 -0000 1.10 *************** *** 236,242 **** + "0", core.NetworkInterface.Console, false, 0); ! node.addNetworkInterface(core.NetworkInterface .getIntName(core.NetworkInterface.Wireless) ! + "0", core.NetworkInterface.Wireless, true, 0); } --- 236,242 ---- + "0", core.NetworkInterface.Console, false, 0); ! /*node.addNetworkInterface(core.NetworkInterface .getIntName(core.NetworkInterface.Wireless) ! + "0", core.NetworkInterface.Wireless, true, 0);*/ } |