AVR Z-LINKŪ


GUI


Detailed Description

The GUI module is used to build the actual graphical components of the chat application such as: windows, dialogs, text boxes, buttons etc. These classes does not include any "control" code. All input from the user (button presses, text, check boxes etc.) is registered by two main graphical components and they will generate a set of associated events. This solution excludes that control/functional code resides inside the GUI. And it becomes easier for others to modify or change the GUI and still reuse the code for the radio interface.

The two main graphical components mentioned above are:


Functions

void gui::MainFrame.actionPerformed (ActionEvent ae)
 Function called whenever one of the MainFrame buttons are pressed.
void gui::ConfigurationDialog.actionPerformed (ActionEvent ae)
 Handles channel selection.
void gui::ChatWindow.actionPerformed (ActionEvent ae)
 This function is called whenever the "Send" or "Clear" buttons are pressed.
void gui::MainFrame.addChatTab (ChatWindow chatTab)
 Adds the chat tab (ChatWindow) to the MainFrame.
void gui::ChatWindow.addChatWindowEventListener (ChatWindowEventListener cweListener)
void gui::MainFrame.addMainFrameEventListener (MainFrameEventListener mfeListener)
void gui::MainFrame.appendDebugMessage (String msg)
 Append debug message to debug window.
void gui::ChatWindow.appendIncommingMessage (String iMsg)
 Will append an incomming message to the live traffic.
void gui::MainFrame.appendLiveTrafficIn (String msg)
 Append newly received message to debug window.
void gui::MainFrame.appendLiveTrafficOut (String msg)
 Append newly sent message to debug window.
void gui::ChatWindow.appendOutgoingMessage (String oMsg)
 Will append an outgoing message to the live traffic.
void gui::ChatWindow.appendTextToConversation (String msg)
 Appends a string to the live traffic.
 gui::ChatWindow.ChatWindow ()
 Class constructor. Builds a new chat tab.
static SerialPort gui::Dialogs.chooseSerialPort (MainFrame parentWindow)
 Dialog that prompts the user to select the SerialPort where the radio HW is connected.
void gui::ChatWindow.clearConversation ()
 Erases the contents of the live traffic window.
void gui::MainFrame.clearDebugMesasges ()
 Clear the debug messages.
void gui::ChatWindow.clearMessage ()
 Erases the text in the message JTextArea.
void gui::MainFrame.closeChatTab (ChatWindow chatTab)
 Close the ChatWindow tab.
 gui::ConfigurationDialog.ConfigurationDialog (MainFrame parent)
 Class constructor.
void gui::ChatWindow.disableMessageWindow ()
 Disables typing of text in the message JTextArea.
void gui::ChatWindow.enableMessageWindow ()
 Enables typing of text in the message JTextArea.
void gui::ChatWindow.fireChatWindowEvent (ChatWindowEvent event)
void gui::MainFrame.fireMainFrameEvent (MainFrameEvent event)
String gui::ChatWindow.getMessage ()
 Returns the content of the message JTextArea.
String[] gui::ConfigurationDialog.getUserChoices ()
 Returns the configurations selected by the user.
void gui::ConfigurationDialog.hideDialog ()
 Hides the ConfigurationDialog.
void gui::ConfigurationDialog.itemStateChanged (ItemEvent ie)
 Handle the Coordinator and end-device check boxes.
 gui::MainFrame.MainFrame ()
 MainFrame class constructor.
void gui::ConfigurationDialog.propertyChange (PropertyChangeEvent pce)
 This function is called whenever the state of the buttons of the ConfigurationDialog changes.
void gui::ChatWindow.removeChatWindowEventListener (ChatWindowEventListener cweListener)
void gui::MainFrame.removeMainFrameEventListener (MainFrameEventListener mfeListener)
static String[] gui::Dialogs.showConfigurationDialog (MainFrame parentWindow)
 Show the ConfigurationDialog.
static void gui::Dialogs.showErrorMessage (MainFrame parentWindow, String errorMessage)
 Show standard error message with configurable text.
static void gui::Dialogs.showPlainMessage (MainFrame parentWindow, String message)
 Prompt the user with a message.
static int gui::Dialogs.showRetryMessage (MainFrame parentWindow)
 Prompts the user with an option dialog to retry last command or to cancel.


Function Documentation

void gui.MainFrame.actionPerformed ( ActionEvent  ae  )  [inherited]

Function called whenever one of the MainFrame buttons are pressed.

Whenever a new ActionEvent occurs and the function is called, the event will be decoded and forwarded to the MainFrameEventListener. This is done to remove control code from the GUI.

Parameters:
ae ActionEvent that contains information about what button was pressed etc.

Definition at line 135 of file MainFrame.java.

References gui.MainFrame.fireMainFrameEvent().

00135                                                       {
00136                 //Read out event string.
00137                 int eventType;
00138                 String event = ae.getActionCommand( ).toString( );
00139                 
00140                 
00141                 //Connect button.
00142                 if( event.equals( "Connect" ) ){
00143                         
00144                         eventType = MainFrameEvent.CONNECT;
00145                 }
00146                 //Disconnect button.
00147                 else if( event.equals( "Disconnect" ) ){
00148                         
00149                         eventType = MainFrameEvent.DISCONNECT;
00150                 }
00151                 //Clear button.
00152                 else{
00153                         
00154                         eventType = MainFrameEvent.CLEAR_DEBUG;
00155                 }
00156                 
00157                 fireMainFrameEvent( new MainFrameEvent( eventType ) );
00158         }

Here is the call graph for this function:

void gui.ConfigurationDialog.actionPerformed ( ActionEvent  ae  )  [inherited]

Handles channel selection.

Parameters:
ae ActionEvent fired when a new item is selected from the channel drop down list.

Definition at line 135 of file ConfigurationDialog.java.

References gui.ConfigurationDialog.CHANNEL, gui.ConfigurationDialog.channelString, and gui.ConfigurationDialog.hexLookupTable.

00135                                                      {
00136                 
00137                 int i;
00138                 String channel = ( String ) ( ( JComboBox)ae.getSource( ) ).getSelectedItem( );
00139                 
00140                 for( i = 0; i < 16;i++ ){
00141                         
00142                         //Look for channel.
00143                         if( channel.equals( channelString[ i ] ) ){
00144                                 break;
00145                         }
00146                 }
00147                 
00148                 userChoices[ CHANNEL ] = hexLookupTable[ i ];
00149         }

void gui.ChatWindow.actionPerformed ( ActionEvent  ae  )  [inherited]

This function is called whenever the "Send" or "Clear" buttons are pressed.

The type of button pressed will be decoded and a new ChatWindowEvent will be fired. This event is then catched by the ChatWindowEventListener. The idea is to remove as much "functional" code as possible from the GUI.

Definition at line 219 of file ChatWindow.java.

References gui.ChatWindow.fireChatWindowEvent().

Referenced by gui.ChatWindow.ChatWindow().

00219                                                      {
00220 
00221                 String event = ae.getActionCommand( ).toString( );
00222                 
00223                 if( event.equals( "Send" ) ){
00224                         
00225                         fireChatWindowEvent( new ChatWindowEvent( ChatWindowEvent.SEND, message.getText( ) ) );
00226                 }
00227 
00228                 else{
00229                         
00230                         fireChatWindowEvent( new ChatWindowEvent( ChatWindowEvent.CLEAR, null ) );
00231                 }
00232         }

Here is the call graph for this function:

void gui.MainFrame.addChatTab ( ChatWindow  chatTab  )  [inherited]

Adds the chat tab (ChatWindow) to the MainFrame.

Parameters:
chatTab ChatWindow to be added.

Definition at line 167 of file MainFrame.java.

00167                                                     {
00168                 
00169                 background.addTab( "Chat", chatTab );
00170                 background.setSelectedComponent( chatTab );
00171         }

void gui.ChatWindow.addChatWindowEventListener ( ChatWindowEventListener  cweListener  )  [inherited]

This function adds a new ChatWindowEventListener to the queue of event listeners.

Parameters:
cweListener ChatWindowEventListener to be added.

Definition at line 242 of file ChatWindow.java.

00242                                                                                      {
00243                 ChatWindowEventListeners.add( ChatWindowEventListener.class, cweListener );
00244         }

void gui.MainFrame.addMainFrameEventListener ( MainFrameEventListener  mfeListener  )  [inherited]

This function adds a new MainFrameEventListener to the queue of event listeners.

Parameters:
mfeListener MainFrameEventListener to be added.

Definition at line 235 of file MainFrame.java.

00235                                                                                    {
00236                 MainFrameEventListeners.add( MainFrameEventListener.class, mfeListener );
00237         }

void gui.MainFrame.appendDebugMessage ( String  msg  )  [inherited]

Append debug message to debug window.

Parameters:
msg Message to append.

Definition at line 203 of file MainFrame.java.

00203                                                     {
00204                 debugMessages.append( "[DEBUG] " + msg + "\r\n" );
00205         }

void gui.ChatWindow.appendIncommingMessage ( String  iMsg  )  [inherited]

Will append an incomming message to the live traffic.

Function adds an arrow to indicate that the message is incomming (->).

Parameters:
iMsg Incomming message.

Definition at line 174 of file ChatWindow.java.

References gui.ChatWindow.appendTextToConversation().

Referenced by main.EventHandler.NewDataIndicationEvent().

00174                                                          {
00175                 appendTextToConversation( " -> " + iMsg + "\r\n" );
00176         }

Here is the call graph for this function:

void gui.MainFrame.appendLiveTrafficIn ( String  msg  )  [inherited]

Append newly received message to debug window.

Parameters:
msg Message to append.

Definition at line 213 of file MainFrame.java.

00213                                                      {
00214                 debugMessages.append( "[Traffic <- ] " + msg + "\r\n" );
00215         }

void gui.MainFrame.appendLiveTrafficOut ( String  msg  )  [inherited]

Append newly sent message to debug window.

Parameters:
msg Message to append.

Definition at line 223 of file MainFrame.java.

00223                                                       {
00224                 debugMessages.append( "[Traffic -> ] " + msg + "\r\n" );
00225         }

void gui.ChatWindow.appendOutgoingMessage ( String  oMsg  )  [inherited]

Will append an outgoing message to the live traffic.

Function adds an arrow to indicate that the message is incomming (<-).

Parameters:
oMsg Outgoing message.

Definition at line 188 of file ChatWindow.java.

References gui.ChatWindow.appendTextToConversation().

Referenced by main.EventHandler.sendMessage().

00188                                                         {
00189                 appendTextToConversation( " <- " + oMsg + "\r\n" );
00190         }

Here is the call graph for this function:

void gui.ChatWindow.appendTextToConversation ( String  msg  )  [inherited]

Appends a string to the live traffic.

Parameters:
msg String to be appended.

Definition at line 131 of file ChatWindow.java.

Referenced by gui.ChatWindow.appendIncommingMessage(), gui.ChatWindow.appendOutgoingMessage(), and main.EventHandler.MainFrameEvent().

00131                                                           {
00132                 
00133                 conversation.setText( conversation.getText( ) + msg );  
00134         }

gui.ChatWindow.ChatWindow (  )  [inherited]

Class constructor. Builds a new chat tab.

A new ChatWindow is a JPanel extension that defines the GUI where the end user can enter new messages and send them. Newly arrived messages from the other peer will be appended to the live traffic.

Definition at line 62 of file ChatWindow.java.

References gui.ChatWindow.actionPerformed(), and gui.ChatWindow.fireChatWindowEvent().

00062                             {
00063                 
00064                 this.setSize( new Dimension( 600, 400 ) );
00065                 this.setLayout( null );
00066                 
00067                 message = new JTextArea( "" );
00068                 message.setEditable( false );
00069                 
00070 //              Add enter to input map. So that it is possible to send messages using the eneter key.
00071                 message.getInputMap().put( KeyStroke.getKeyStroke( KeyEvent.VK_ENTER, 0),
00072                                                                                                                   "enter" );
00073 
00074 //              Connect the key event with an action.           
00075                 message.getActionMap( ).put( "enter", new AbstractAction( ){
00076            
00077 //                      Suppress warning
00078                         private static final long serialVersionUID = 1L;
00079 
00080                         public void actionPerformed( ActionEvent ae ){
00081                                 //Send new event to the EventHandler.
00082                                 fireChatWindowEvent( new ChatWindowEvent( ChatWindowEvent.ENTER, message.getText() ) );
00083             }
00084         } );
00085                 
00086                 conversation = new JTextArea( "" );
00087                 conversation.setEditable( false );
00088                 
00089                 JScrollPane conversationBackground = new JScrollPane( conversation );
00090                 conversationBackground.setBounds( 151, 10, 399, 260 );
00091                 
00092                 message.setBounds( 151, 272, 290, 64 );
00093                 
00094                 clear.setBounds( 450, 294, 100, 20 );
00095                 clear.addActionListener( this );
00096                 
00097                 send.setBounds( 450, 272, 100, 20 );
00098                 send.addActionListener( this );
00099                 
00100                 URL avrLogoURL = ChatWindow.class.getResource( "AVR_logo_black.gif" );
00101                 
00102                 ImageIcon avrLogo = new ImageIcon( avrLogoURL );
00103                 imageAVR = new JLabel( avrLogo );
00104                 imageAVR.setBounds( 8, 100, 135, 97 );
00105                 
00106                 URL atmelURL = ChatWindow.class.getResource( "Atmel_logo_black.gif" );
00107                 
00108                 ImageIcon atmelLogo = new ImageIcon( atmelURL );
00109                 imageAtmel = new JLabel( atmelLogo );
00110                 imageAtmel.setBounds( 8, 0, 135, 97 );
00111                 
00112                 textFont = new Font( "Monospaced", Font.BOLD, 14 );
00113                 conversation.setFont( textFont );
00114                 message.setFont( textFont );
00115                 
00116                 this.add( conversationBackground );
00117                 this.add( message );
00118                 this.add( clear );
00119                 this.add( send );
00120                 this.add( imageAVR );
00121                 this.add( imageAtmel );
00122         }

Here is the call graph for this function:

static SerialPort gui.Dialogs.chooseSerialPort ( MainFrame  parentWindow  )  [static, inherited]

Dialog that prompts the user to select the SerialPort where the radio HW is connected.

Parameters:
parentWindow Parent JFrame.
Returns:
Null if no valid SerialPort can be found. Else the SerialPort chosen by in the dialog.

Definition at line 40 of file Dialogs.java.

00040                                                                            {
00041                 
00042                 //Fetch available ports and convert into an array of strings.
00043                 Vector<String> portsAvailable = SerialPortUtilities.getSerialPortNames( );
00044                 
00045                 //No ports available.
00046                 if( portsAvailable.isEmpty( ) ){
00047                         
00048                         Dialogs.showErrorMessage( parentWindow, "No serial ports available.\r\n" +
00049                                                                                                         "Free one or more and try again." );
00050                         return null;
00051                 }
00052                 //Ports available.
00053                 else{
00054                 
00055                         Object[] serialPorts = portsAvailable.toArray( );
00056                         
00057                         //Prompt the user for his/her choice.
00058                         String result = showPortInputDialog( parentWindow, serialPorts );
00059                         
00060                         //Port is chosen, try to connect.
00061                         if( result != null ){
00062                                 return SerialPortUtilities.connectToSerialPort( result );
00063                         }
00064                         //Cancel or close window chosen.
00065                         else{
00066                                 return null;
00067                         }
00068                 }
00069         }

void gui.ChatWindow.clearConversation (  )  [inherited]

Erases the contents of the live traffic window.

Definition at line 141 of file ChatWindow.java.

Referenced by gui.MainFrame.closeChatTab(), main.EventHandler.MainFrameEvent(), and main.EventHandler.NewAssociationIndicationEvent().

00141                                         {
00142                 conversation.setText( "" );
00143         }

void gui.MainFrame.clearDebugMesasges (  )  [inherited]

Clear the debug messages.

Definition at line 192 of file MainFrame.java.

00192                                          {
00193                 debugMessages.setText( "" );
00194         }

void gui.ChatWindow.clearMessage (  )  [inherited]

Erases the text in the message JTextArea.

Definition at line 150 of file ChatWindow.java.

Referenced by main.EventHandler.ChatWindowEvent(), gui.MainFrame.closeChatTab(), and main.EventHandler.sendMessage().

00150                                    {
00151                 message.setText("");
00152         }

void gui.MainFrame.closeChatTab ( ChatWindow  chatTab  )  [inherited]

Close the ChatWindow tab.

Parameters:
chatTab ChatWindow instance to close.

Definition at line 180 of file MainFrame.java.

References gui.ChatWindow.clearConversation(), and gui.ChatWindow.clearMessage().

00180                                                       {
00181                 
00182                 chatTab.clearConversation( );
00183                 chatTab.clearMessage( );
00184                 background.remove( chatTab );
00185         }

Here is the call graph for this function:

gui.ConfigurationDialog.ConfigurationDialog ( MainFrame  parent  )  [inherited]

Class constructor.

The ConfigurationDialog defines the dialog where the end user chooses channel, PANID and role.

Parameters:
parent Referece to the calling JFrame. Needed by the JDialog super class.

Definition at line 77 of file ConfigurationDialog.java.

References gui.ConfigurationDialog.channelString.

00077                                                       {
00078                 
00079                 super( parent, true );
00080                 this.setTitle( "Device Options" );
00081                 
00082                 channels = new JComboBox( channelString );
00083                 channels.setEditable( false );
00084                 channels.setSelectedIndex( 0 );
00085                 channels.addActionListener( this );
00086                 
00087                 endDevice = new JCheckBox( "End Device" );
00088                 endDevice.setSelected( true );
00089                 endDevice.addItemListener( this );
00090                 
00091                 coordinator = new JCheckBox( "Coordinator" );
00092                 coordinator.setSelected( false );
00093                 coordinator.addItemListener( this );
00094                 
00095                 panID = new JTextField( "BAAD", 4 );
00096                 
00097                 Object[ ] inputFields = { chanString, channels, deviceString,
00098                                                                   endDevice, coordinator, panString, panID };
00099                 Object[ ] options = { buttonString1, buttonString2 };
00100                 
00101                 optionPane = new JOptionPane( inputFields,
00102                                                                           JOptionPane.QUESTION_MESSAGE,
00103                                                                           JOptionPane.OK_CANCEL_OPTION,
00104                                                                           null,
00105                                                                           options,
00106                                                                           options[ 0 ]);
00107                 
00108                 this.setContentPane( optionPane );
00109                 this.setDefaultCloseOperation( DO_NOTHING_ON_CLOSE );
00110                 
00111                 this.addWindowListener(new WindowAdapter() {
00112             public void windowClosing(WindowEvent we) {
00113                 
00114             /*
00115              * Instead of directly closing the window,
00116              * we're going to change the JOptionPane's
00117              * value property.
00118              */
00119                 optionPane.setValue( new Integer( 
00120                                     JOptionPane.CLOSED_OPTION ) );
00121             }
00122                 });
00123                 
00124                 optionPane.addPropertyChangeListener( this );
00125         }

void gui.ChatWindow.disableMessageWindow (  )  [inherited]

Disables typing of text in the message JTextArea.

Definition at line 206 of file ChatWindow.java.

Referenced by main.EventHandler.MainFrameEvent().

00206                                            {
00207                 message.setEditable( false );
00208         }

void gui.ChatWindow.enableMessageWindow (  )  [inherited]

Enables typing of text in the message JTextArea.

Definition at line 197 of file ChatWindow.java.

Referenced by main.EventHandler.MainFrameEvent(), and main.EventHandler.NewAssociationIndicationEvent().

00197                                           {
00198                 message.setEditable( true );
00199         }

void gui.ChatWindow.fireChatWindowEvent ( ChatWindowEvent  event  )  [protected, inherited]

When this function is called a new ChatWindowEvent is injected into the dispatcher queue to be handled by the associated ChatWindowEventListener.

Parameters:
event Inject new ChatWindowEvent instance to the dispatcher.

Definition at line 266 of file ChatWindow.java.

Referenced by gui.ChatWindow.actionPerformed(), and gui.ChatWindow.ChatWindow().

00266                                                                    {
00267                 
00268                 Object[ ] listeners = ChatWindowEventListeners.getListenerList( );
00269                 int numberOfListeners = listeners.length;
00270                 
00271                 for( int i = 0; i < numberOfListeners; i+=2 ){
00272                         
00273                         if( listeners[ i ] == ChatWindowEventListener.class ){
00274                                 ( (ChatWindowEventListener)listeners[ i + 1 ] ).ChatWindowEvent( event );
00275                         }
00276                 }
00277         }

void gui.MainFrame.fireMainFrameEvent ( MainFrameEvent  event  )  [protected, inherited]

When this function is called a new MainFrameEvent is injected into the dispatcher queue to be handled by the associated MainFrameEventListener.

Parameters:
event Inject new MainFrameEvent instance to the dispatcher.

Definition at line 259 of file MainFrame.java.

Referenced by gui.MainFrame.actionPerformed().

00259                                                                  {
00260                 
00261                 Object[ ] listeners = MainFrameEventListeners.getListenerList( );
00262                 int numberOfListeners = listeners.length;
00263                 
00264                 for( int i = 0; i < numberOfListeners; i+=2 ){
00265                         
00266                         if( listeners[ i ] == MainFrameEventListener.class ){
00267                                 ( (MainFrameEventListener)listeners[ i + 1 ] ).MainFrameEvent( event );
00268                         }
00269                 }
00270         }

String gui.ChatWindow.getMessage (  )  [inherited]

Returns the content of the message JTextArea.

Returns:
Content of the message window.

Definition at line 160 of file ChatWindow.java.

00160                                    {
00161                 return message.getText( );
00162         }

String [ ] gui.ConfigurationDialog.getUserChoices (  )  [inherited]

Returns the configurations selected by the user.

Returns:
String array with the channel, PANID and role stored.

Definition at line 204 of file ConfigurationDialog.java.

Referenced by gui.Dialogs.showConfigurationDialog().

00204                                           {
00205                 return userChoices;
00206         }

void gui.ConfigurationDialog.hideDialog (  )  [inherited]

Hides the ConfigurationDialog.

Definition at line 278 of file ConfigurationDialog.java.

00278                                  {
00279                 this.setVisible( false );
00280         }

void gui.ConfigurationDialog.itemStateChanged ( ItemEvent  ie  )  [inherited]

Handle the Coordinator and end-device check boxes.

It is ensured that only one of the two device types can be selected at the same time.

Parameters:
ie ItemEvent that holds information about which of JCheckBoxes that were checked or not.

Definition at line 162 of file ConfigurationDialog.java.

References gui.ConfigurationDialog.COORDINATOR, gui.ConfigurationDialog.DEVICE_TYPE, and gui.ConfigurationDialog.END_DEVICE.

00162                                                     {
00163                 
00164                 Object source = ie.getItemSelectable( );
00165                 
00166                 if( source == endDevice ){
00167                         
00168                         if( ie.getStateChange( ) == ItemEvent.DESELECTED ){
00169                                 
00170                                 coordinator.setSelected( true );
00171                                 userChoices[ DEVICE_TYPE ] = deviceType[ COORDINATOR ];
00172                         }
00173                         
00174                         else{
00175                                 
00176                                 coordinator.setSelected( false );
00177                                 userChoices[ DEVICE_TYPE ] = deviceType[ END_DEVICE ];
00178                         }
00179                 }
00180                 
00181                 else{
00182                         
00183                         if( ie.getStateChange( ) == ItemEvent.DESELECTED ){
00184                                 
00185                                 endDevice.setSelected( true );
00186                                 userChoices[ DEVICE_TYPE ] = deviceType[ END_DEVICE ];
00187                         }
00188                         
00189                         else{
00190                                 
00191                                 endDevice.setSelected( false );
00192                                 userChoices[ DEVICE_TYPE ] = deviceType[ COORDINATOR ];
00193                         }
00194                 }
00195         }

gui.MainFrame.MainFrame (  )  [inherited]

MainFrame class constructor.

Starts a new MainFrame window. This window contains a debug field and some buttons that are used for starting the interaction with the radio HW.

Definition at line 69 of file MainFrame.java.

00069                             {
00070                 
00071 //              Set name on frame.
00072                 super( "AVR414: Peer-to-Peer Chat Application" );
00073             this.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
00074                 this.setSize( new Dimension( 600, 400 ) );
00075                 this.setResizable( false );
00076                 
00077                 JPanel connectAndDebug = new JPanel( );
00078                 connectAndDebug.setSize( new Dimension( 600, 400 ) );
00079                 connectAndDebug.setLayout( null );
00080                 connectAndDebug.setOpaque(true);
00081                 
00082                 //Add action Listeners
00083                 connect.setBounds( 8, 200, 135, 20 );
00084                 connect.addActionListener( this );
00085                 
00086                 disconnect.setBounds( 8, 225, 135, 20 );
00087                 disconnect.addActionListener( this );
00088                 
00089                 clearDebug.setBounds( 8, 250, 135, 20 );
00090                 clearDebug.addActionListener( this );
00091                 
00092                 URL avrLogoURL = gui.MainFrame.class.getResource( "AVR_logo_black.gif" );
00093                 
00094                 ImageIcon avrLogo = new ImageIcon( avrLogoURL );
00095         
00096                 imageAVR = new JLabel( avrLogo );
00097                 imageAVR.setBounds( 8, 100, 135, 97 );
00098                 
00099                 URL atmelURL = MainFrame.class.getResource( "Atmel_logo_black.gif" );
00100                 
00101                 ImageIcon atmelLogo = new ImageIcon( atmelURL );
00102                 imageAtmel = new JLabel( atmelLogo );
00103                 imageAtmel.setBounds( 8, 0, 135, 97 );
00104                 
00105                 debugMessages.setEditable( false );
00106                 JScrollPane right = new JScrollPane( debugMessages );
00107                 right.setBounds( 151, 10, 399, 260 );
00108                 
00109                 connectAndDebug.add( connect );
00110                 connectAndDebug.add( disconnect );
00111                 connectAndDebug.add( clearDebug );
00112                 connectAndDebug.add( right );
00113                 connectAndDebug.add( imageAVR );
00114                 connectAndDebug.add( imageAtmel );
00115                 
00116                 background.addTab( "Debug", connectAndDebug);
00117                 
00118                 this.add( background );
00119                 this.setVisible( true );
00120                 
00121                 this.repaint( );
00122         }

void gui.ConfigurationDialog.propertyChange ( PropertyChangeEvent  pce  )  [inherited]

This function is called whenever the state of the buttons of the ConfigurationDialog changes.

Parameters:
pce PropertyChangeEvent indicating what type of event that is to be handled.

Definition at line 216 of file ConfigurationDialog.java.

References gui.ConfigurationDialog.PANID.

00216                                                              {
00217                 
00218                 String property = pce.getPropertyName( );
00219                 
00220                 //Handle events generated when user presses the buttons.
00221                 //Buttons is not accessible with normal routines.
00222                 if( isVisible( ) && ( pce.getSource( ) == optionPane )
00223                     && ( JOptionPane.VALUE_PROPERTY.equals( property )
00224                     || JOptionPane.INPUT_VALUE_PROPERTY.equals( property ) ) ){
00225                         
00226                         Object value = optionPane.getValue( );
00227                         
00228                     if( value == JOptionPane.UNINITIALIZED_VALUE ){
00229                         //ignore reset
00230                         return;
00231                     }
00232 
00233                     //Reset the JOptionPane's value.
00234                     //If you don't do this, then if the user
00235                     //presses the same button next time, no
00236                     //property change event will be fired.
00237                     optionPane.setValue( JOptionPane.UNINITIALIZED_VALUE );
00238                     
00239                     //OK pressed
00240                     if( value.equals( buttonString1 ) ){
00241                         
00242                         String readPANID = panID.getText( );
00243                         readPANID.toUpperCase( );
00244                         
00245                         //Must be a four digit number.
00246                         if( readPANID.length(  ) < 5 ){
00247                                 
00248                                 for( int i = 0; i < readPANID.length( ); i++ ){
00249                                         
00250                                         if( !( ( ( readPANID.charAt( i ) >= '0' ) && ( readPANID.charAt( i ) <= '9' ) ) ||
00251                                                  ( ( readPANID.charAt( i ) >= 'A' ) && ( readPANID.charAt( i ) <= 'F' ) ) ) ){
00252                                                 
00253                                                 return;
00254                                         }
00255                                 }
00256                                 
00257                                 userChoices[ PANID ] = readPANID;
00258                                 this.hideDialog( );
00259                         }
00260                         
00261                         else{
00262                                 return;
00263                         }
00264                     }
00265                     
00266                     //Cancel Pressed or closing window.
00267                     else{
00268                         this.hideDialog( );
00269                     }
00270                 }
00271         }

void gui.ChatWindow.removeChatWindowEventListener ( ChatWindowEventListener  cweListener  )  [inherited]

This function deletes a ChatWindowEventListener from the queue of event listeners.

Parameters:
cweListener ChatWindowEventListener to remove.

Definition at line 254 of file ChatWindow.java.

00254                                                                                         {
00255                 ChatWindowEventListeners.remove( ChatWindowEventListener.class, cweListener );
00256         }

void gui.MainFrame.removeMainFrameEventListener ( MainFrameEventListener  mfeListener  )  [inherited]

This function deletes a MainFrameEventListener from the queue of event listeners.

Parameters:
mfeListener MainFrameEventListener to remove.

Definition at line 247 of file MainFrame.java.

00247                                                                                       {
00248                 MainFrameEventListeners.remove( MainFrameEventListener.class, mfeListener );
00249         }

static String [] gui.Dialogs.showConfigurationDialog ( MainFrame  parentWindow  )  [static, inherited]

Show the ConfigurationDialog.

Parameters:
parentWindow Parent JFrame.
Returns:
String with user configurations (Channel, PANID and role).

Definition at line 149 of file Dialogs.java.

References gui.ConfigurationDialog.getUserChoices().

00149                                                                                 {
00150                 
00151                 ConfigurationDialog config = new ConfigurationDialog( parentWindow );
00152                 config.pack( );
00153                 config.setLocationRelativeTo( parentWindow );
00154                 config.setVisible(true);
00155                 
00156                 return config.getUserChoices( );
00157         }

Here is the call graph for this function:

static void gui.Dialogs.showErrorMessage ( MainFrame  parentWindow,
String  errorMessage 
) [static, inherited]

Show standard error message with configurable text.

Parameters:
parentWindow Parent JFrame.
errorMessage Error message to be displayed to the user.

Definition at line 97 of file Dialogs.java.

00097                                                                                           {
00098                 
00099                 JOptionPane.showMessageDialog( parentWindow, errorMessage, "ERROR",
00100                                                            JOptionPane.ERROR_MESSAGE);
00101         }

static void gui.Dialogs.showPlainMessage ( MainFrame  parentWindow,
String  message 
) [static, inherited]

Prompt the user with a message.

Parameters:
parentWindow Parent JFrame.
message Message to be displayed to the user.

Definition at line 111 of file Dialogs.java.

00111                                                                                      {
00112                 
00113                 JOptionPane.showMessageDialog( parentWindow, message, "System Message:",
00114                                                            JOptionPane.ERROR_MESSAGE);
00115         }

static int gui.Dialogs.showRetryMessage ( MainFrame  parentWindow  )  [static, inherited]

Prompts the user with an option dialog to retry last command or to cancel.

Parameters:
parentWindow Parent JFrame.
Returns:
0 if "Retry" button is pressed, 1 if "Cancel" is pressed.

Definition at line 126 of file Dialogs.java.

00126                                                                     {
00127                 
00128                 Object[] options = {"Retry", "Cancel"};
00129                 
00130         return JOptionPane.showOptionDialog( parentWindow,
00131                         "Communication timed out!" +
00132                         "do you wish to retry?",
00133                         "Retry",
00134                         JOptionPane.YES_NO_OPTION,
00135                         JOptionPane.QUESTION_MESSAGE,
00136                         null,
00137                         options,
00138                         options[0]);
00139         }

@DOC_TITLE@
Generated on Sat Dec 2 16:14:07 2006 for AVR414 User's Guide - ATAVRRZ502 - Accessory Kit by doxygen 1.4.7