irc.Irc Class Reference

Collaboration diagram for irc.Irc:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 Irc (JvnObject jo)

Static Public Member Functions

static void main (String argv[])

Protected Attributes

TextArea text
TextField data
JvnObject sentence


Detailed Description

This class is a simple demonstration of the Javanaise system. It defines an IRC system, where people can read and write messages. Of course, messages are stored as JvnObjects and use the Javanaise protocol.

Definition at line 22 of file Irc.java.


Constructor & Destructor Documentation

irc.Irc.Irc ( JvnObject  jo  ) 

Constructor: creates the frame and the frame's contents.

Parameters:
jo the JVN object representing the Chat

Definition at line 61 of file Irc.java.

References irc.Irc.data, irc.Irc.sentence, and irc.Irc.text.

Referenced by irc.Irc.main().

00061                                  {
00062                 // Create frame
00063                 sentence = jo;
00064                 Frame frame=new Frame("Javanaise Client: IRC");
00065                 frame.addWindowListener(new WindowAdapter() {
00066                         public void windowClosing(WindowEvent e) {
00067                                 e.getWindow().dispose();
00068                                 try {
00069                                         JvnServerImpl.jvnGetServer().jvnTerminate();
00070                                 } catch (JvnException je) {}
00071                                 System.exit(0);
00072                         }
00073                 });
00074                 frame.setLayout(new BorderLayout(1,1));
00075 
00076                 // Create and add texts
00077                 Panel texts = new Panel(new GridLayout(1,1));
00078                 text=new TextArea(10,60);
00079                 text.setEditable(false);
00080                 text.setForeground(Color.red);
00081                 text.setBackground(Color.black);
00082                 texts.add(text);
00083                 data=new TextField(40);
00084                 texts.add(data);
00085 
00086                 // Create and add buttons
00087                 Panel buttons = new Panel(new GridLayout(1,1));
00088                 Button read_and_unlock_button = new Button("Read + unlock");
00089                 read_and_unlock_button.addActionListener(new ButtonListenerJvn1(this, ButtonType.ReadAndUnlock));
00090                 buttons.add(read_and_unlock_button);
00091                 Button read_button = new Button("Read");
00092                 read_button.addActionListener(new ButtonListenerJvn1(this, ButtonType.Read));
00093                 buttons.add(read_button);
00094                 Button unlock_button = new Button("Unlock");
00095                 unlock_button.addActionListener(new ButtonListenerJvn1(this, ButtonType.Unlock));
00096                 buttons.add(unlock_button);
00097                 Button write_button = new Button("Write");
00098                 write_button.addActionListener(new ButtonListenerJvn1(this, ButtonType.Write));
00099                 buttons.add(write_button);
00100                 Button write_and_unlock_button = new Button("Write + unlock");
00101                 write_and_unlock_button.addActionListener(new ButtonListenerJvn1(this, ButtonType.WriteAndUnlock));
00102                 buttons.add(write_and_unlock_button);
00103 
00104                 // Add texts + buttons and display frame
00105                 frame.add(texts, BorderLayout.CENTER);
00106                 frame.add(buttons, BorderLayout.SOUTH);
00107                 frame.setSize(500,200);
00108                 frame.setVisible(true);
00109         }

Here is the caller graph for this function:


Member Function Documentation

static void irc.Irc.main ( String  argv[]  )  [static]

Main method: creates a JVN object named IRC for representing the IRC application

Definition at line 30 of file Irc.java.

References jvn.JvnException.getMessage(), irc.Irc.Irc(), jvn.JvnServerImpl.jvnCreateObject(), jvn.JvnServerImpl.jvnLookupObject(), jvn.JvnServerImpl.jvnRegisterObject(), and jvn.JvnObject.jvnUnLock().

00030                                                {
00031                 try {
00032                         // initialize JVN
00033                         JvnServerImpl js = JvnServerImpl.jvnGetServer();
00034 
00035                         if (js == null) {
00036                                 System.out.println("IRC problem : cannot create server!");
00037                         }
00038                         else {
00039                                 // look up the IRC object in the JVN server
00040                                 // if not found, create it, and register it in the JVN server
00041                                 JvnObject jo = js.jvnLookupObject("IRC",JvnObject.class);
00042                                 if (jo == null) {
00043                                         jo = js.jvnCreateObject(new Sentence());
00044                                         // after creation, I have a write lock on the object
00045                                         jo.jvnUnLock();
00046                                         js.jvnRegisterObject("IRC", jo);
00047                                 }
00048                                 // create the graphical part of the Chat application
00049                                 new Irc(jo);
00050                         }
00051                 } catch (JvnException je) {
00052                         System.out.println("IRC problem : " + je.getMessage());
00053                 }
00054         }

Here is the call graph for this function:


Member Data Documentation

TextArea irc.Irc.text [protected]

Definition at line 23 of file Irc.java.

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

TextField irc.Irc.data [protected]

Definition at line 24 of file Irc.java.

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

JvnObject irc.Irc.sentence [protected]

Definition at line 25 of file Irc.java.

Referenced by irc.Irc.Irc(), 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