Update of /cvsroot/javanetsim/javaNetSim/guiUI
In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv32623/guiUI
Modified Files:
GuiNode.java MainScreen.java
Log Message:
Index: MainScreen.java
===================================================================
RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/MainScreen.java,v
retrieving revision 1.91
retrieving revision 1.92
diff -C2 -d -r1.91 -r1.92
*** MainScreen.java 6 Oct 2008 13:20:39 -0000 1.91
--- MainScreen.java 13 Oct 2008 19:49:15 -0000 1.92
***************
*** 778,781 ****
--- 778,783 ----
tempNode.addInterfaces(this, Sim.getNode(result));
+
+ tempNode.updateInterfacesMenu();
tempNode.setNodeLocation(inPoint);
***************
*** 2219,2222 ****
--- 2221,2225 ----
tempNode.setNodeLocation(pnt);
tempNode.setEnabled(false);
+ tempNode.updateInterfacesMenu();
Sandbox.add(tempNode);
Sandbox.setLayer((Component) tempNode, 3, 0);
***************
*** 2484,2487 ****
--- 2487,2492 ----
tempSwitch.setEnabled(true);
+
+ tempSwitch.updateInterfacesMenu();
Sandbox.add(tempSwitch);
***************
*** 2517,2520 ****
--- 2522,2527 ----
tempPC.setNodeLocation(pnt);
+
+ tempPC.updateInterfacesMenu();
Sandbox.add(tempPC);
***************
*** 2566,2569 ****
--- 2573,2578 ----
tempRouter.setEnabled(true);
+
+ tempRouter.updateInterfacesMenu();
Sandbox.add(tempRouter);
Index: GuiNode.java
===================================================================
RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/GuiNode.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** GuiNode.java 6 Oct 2008 13:20:39 -0000 1.8
--- GuiNode.java 13 Oct 2008 19:49:15 -0000 1.9
***************
*** 271,308 ****
});
- 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() {
--- 271,275 ----
***************
*** 339,342 ****
--- 306,353 ----
}
+ public void updateInterfacesMenu(){
+ try {
+ Object ints[] = controller.getInterfaces(lblNodeName.getText());
+
+ for (int i = 0; i < ints.length; i++) {
+ int int_type = Simulation.Sim.getNode(this.strNodeName).getIntType((String)ints[i]);
+
+ if(int_type != core.NetworkInterface.Console && int_type != core.NetworkInterface.Wireless){
+ 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);
+ }
+
+ if(int_type != core.NetworkInterface.Wireless){
+
+ 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();
+ }
+ }
+
public abstract void addInterfaces(MainScreen parent, Node node);
|