irc.IrcJvn2 Class Reference

Collaboration diagram for irc.IrcJvn2:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 IrcJvn2 (JvnSentence jo)

Static Public Member Functions

static void main (String argv[])

Protected Attributes

TextArea text
TextField data
JvnSentence 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 24 of file IrcJvn2.java.


Constructor & Destructor Documentation

irc.IrcJvn2.IrcJvn2 ( JvnSentence  jo  ) 

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

Parameters:
jo the JVN object representing the Chat

Definition at line 63 of file IrcJvn2.java.

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

Referenced by irc.IrcJvn2.main().

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

Here is the caller graph for this function:


Member Function Documentation

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

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

Definition at line 32 of file IrcJvn2.java.

References jvn.JvnException.getMessage(), irc.IrcJvn2.IrcJvn2(), jvn.JvnServerImpl.jvnLookupObject(), jvn.JvnServerImpl.jvnRegisterObject(), and jvn.JvnObjectImpl.jvnUnLock().

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

Here is the call graph for this function:


Member Data Documentation

TextArea irc.IrcJvn2.text [protected]

Definition at line 25 of file IrcJvn2.java.

Referenced by irc.IrcJvn2.IrcJvn2(), and irc.ButtonThreadJvn2.run().

TextField irc.IrcJvn2.data [protected]

Definition at line 26 of file IrcJvn2.java.

Referenced by irc.IrcJvn2.IrcJvn2(), and irc.ButtonThreadJvn2.run().

JvnSentence irc.IrcJvn2.sentence [protected]

Definition at line 27 of file IrcJvn2.java.

Referenced by irc.IrcJvn2.IrcJvn2(), and irc.ButtonThreadJvn2.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