Main Page   Packages   Class Hierarchy   Compound List   File List   Compound Members  

AddNodeDialog Class Reference

Inheritance diagram for AddNodeDialog::

ActionListener List of all members.

Public Methods

 AddNodeDialog (ActionListener action_listener)
void actionPerformed (ActionEvent event)

Private Attributes

ActionListener action_listener
Dialog add_node
Button button_ok
Button button_cancel
TextField node_field
String node_name
Frame dummy

Detailed Description

Add node dialog. If node with given name does not exist, new one with defined name is created.

Definition at line 862 of file Simulation.java.


Constructor & Destructor Documentation

AddNodeDialog::AddNodeDialog ( ActionListener action_listener ) [inline]
 

Default constructor. Reference to network panel is required.

Parameters:
action_listener   Reference to action listener.

Definition at line 891 of file Simulation.java.

00892     {
00893         this.action_listener = action_listener;
00894 
00895         dummy = new Frame();
00896         add_node = new Dialog(dummy, "Dodaj \u010dvor");
00897         button_ok = new Button("U redu");
00898         button_cancel = new Button("Odustani");
00899         node_field = new TextField("ime", 30);
00900 
00901         Label node_label = new Label("Ime \u010dvora", Label.RIGHT);
00902 
00903         add_node.setLayout(new BorderLayout());
00904         add_node.setLayout(new GridLayout(2,2));
00905         add_node.add(node_label);
00906         add_node.add(node_field);
00907         add_node.add(button_ok);
00908         add_node.add(button_cancel);
00909 
00910         node_field.addActionListener(this);
00911         button_ok.addActionListener(this);
00912         button_cancel.addActionListener(this);
00913 
00914         add_node.pack();
00915         add_node.setResizable(false);
00916         add_node.show();
00917     }


Member Function Documentation

void AddNodeDialog::actionPerformed ( ActionEvent event ) [inline]
 

Action handler. Wait for OK or Cancel button and then reads input and terminates dialog.

Definition at line 923 of file Simulation.java.

00924     {
00925         Object source = event.getSource();
00926 
00927         /*  node_field event */
00928         if (source == node_field)
00929             {
00930                 node_name = node_field.getText();
00931             }
00932         /*  button_ok event */
00933         if (source == button_ok)
00934             {
00935                 node_name = node_field.getText();
00936                 add_node.dispose();
00937                 action_listener.actionPerformed(new ActionEvent(this, 1, "OK"));
00938             }
00939         /*  button_cancel event */
00940         if (source == button_cancel)
00941             {
00942                 add_node.dispose();
00943                 action_listener.actionPerformed(new ActionEvent(this, 0, "Cancel"));
00944             }
00945     }


Member Data Documentation

ActionListener AddNodeDialog::action_listener [private]
 

Action listener.

Definition at line 867 of file Simulation.java.

Dialog AddNodeDialog::add_node [private]
 

Add node dialog box.

Definition at line 870 of file Simulation.java.

Button AddNodeDialog::button_cancel [private]
 

Add node Cancel button.

Definition at line 876 of file Simulation.java.

Button AddNodeDialog::button_ok [private]
 

Add node OK button.

Definition at line 873 of file Simulation.java.

Frame AddNodeDialog::dummy [private]
 

Dummy frame required to aviod null-parent exception.

Definition at line 885 of file Simulation.java.

TextField AddNodeDialog::node_field [private]
 

Node name field.

Definition at line 879 of file Simulation.java.

String AddNodeDialog::node_name [private]
 

Node name.

Definition at line 882 of file Simulation.java.


The documentation for this class was generated from the following file:
Generated at Thu Jun 28 03:04:22 2001 for Cyclops Network Simulator by doxygen1.2.7 written by Dimitri van Heesch, © 1997-2001