irc.ButtonThreadJvn1 Class Reference

Collaboration diagram for irc.ButtonThreadJvn1:

Collaboration graph
[legend]

List of all members.

Public Member Functions

void run ()

Package Functions

 ButtonThreadJvn1 (Irc i, ButtonType b)

Private Attributes

Irc irc
ButtonType button


Detailed Description

This class defines a thread which is activated when any button is pressed. We do this using threads in order not to block the interface when the lock is being processed and let the user press any button at any time.

Definition at line 146 of file Irc.java.


Constructor & Destructor Documentation

irc.ButtonThreadJvn1.ButtonThreadJvn1 ( Irc  i,
ButtonType  b 
) [package]

Constructor: initialized the ButtonThread.

Parameters:
i IRC class to use.
b Which button has been pressed.

Definition at line 156 of file Irc.java.

References irc.ButtonThreadJvn1.button, and irc.ButtonThreadJvn1.irc.

00156                                                 {
00157                 irc = i;
00158                 button = b;
00159         }


Member Function Documentation

void irc.ButtonThreadJvn1.run (  ) 

Starts the thread.

See also:
Thread.run()

Definition at line 166 of file Irc.java.

References irc.ButtonThreadJvn1.button, irc.Irc.data, jvn.JvnException.getMessage(), irc.ButtonThreadJvn1.irc, jvn.JvnObject.jvnGetObjectState(), jvn.JvnObject.jvnLockRead(), jvn.JvnObject.jvnLockWrite(), jvn.JvnObject.jvnUnLock(), irc.Irc.sentence, and irc.Irc.text.

00166                           {
00167                 try {
00168                         if( button == ButtonType.Read || button == ButtonType.ReadAndUnlock ) {
00169                                 // lock the object in read mode
00170                                 irc.sentence.jvnLockRead();
00171 
00172                                 // invoke the method
00173                                 String s = ((Sentence)(irc.sentence.jvnGetObjectState())).read();
00174 
00175                                 // display the read value
00176                                 irc.data.setText(s);
00177                                 irc.text.append(s+"\n");
00178 
00179                                 if( button == ButtonType.ReadAndUnlock ) {
00180                                         // unlock the object
00181                                         irc.sentence.jvnUnLock();
00182                                 }
00183                         } else if( button == ButtonType.Unlock ) {
00184                                 // unlock the object
00185                                 irc.sentence.jvnUnLock();
00186                         } else if( button == ButtonType.Write || button == ButtonType.WriteAndUnlock ) {
00187                                 // get the value to be written from the buffer
00188                                 String s = irc.data.getText();
00189 
00190                                 // lock the object in write mode
00191                                 irc.sentence.jvnLockWrite();
00192 
00193                                 // invoke the method
00194                                 ((Sentence)(irc.sentence.jvnGetObjectState())).write(s);
00195 
00196                                 if( button == ButtonType.WriteAndUnlock ) {
00197                                         // unlock the object
00198                                         irc.sentence.jvnUnLock();
00199                                 }
00200                         }
00201                 } catch (JvnException je) {
00202                         System.out.println("Javanaise error while processing IRC button action: " + je.getMessage());
00203                 } catch( Exception e ) {
00204                         System.out.println( "Error while processing IRC button action: "+e);
00205                 }
00206         }

Here is the call graph for this function:


Member Data Documentation

Irc irc.ButtonThreadJvn1.irc [private]

Definition at line 147 of file Irc.java.

Referenced by irc.ButtonThreadJvn1.ButtonThreadJvn1(), and irc.ButtonThreadJvn1.run().

ButtonType irc.ButtonThreadJvn1.button [private]

Definition at line 148 of file Irc.java.

Referenced by irc.ButtonThreadJvn1.ButtonThreadJvn1(), and irc.ButtonThreadJvn1.run().


The documentation for this class was generated from the following file:
Generated on Wed Jan 2 10:15:57 2008 for Javanaise by  doxygen 1.5.4