org.jgroups.demos.wb

Class Whiteboard

Implemented Interfaces:
ActionListener, ComponentListener, FocusListener, MembershipListener, MessageListener

public class Whiteboard
extends Applet
implements ActionListener, MessageListener, MembershipListener, ComponentListener, FocusListener

Shared whiteboard: members are represented by rectangles that contain their names and the OS/arch of the machine they are working on. The boxes can be moved by anyone and by clicking on them, messages can be sent to specific or all members. Whiteboard is both an application and an applet.

Author:
Bela Ban

Field Summary

RpcDispatcher
disp
String
groupname

Constructor Summary

Whiteboard()
Whiteboard(String properties)

Method Summary

void
actionPerformed(ActionEvent e)
void
addNode(String lbl, Address addr, int xloc, int yloc)
void
block()
Block sending and receiving of messages until viewAccepted() is called
void
componentHidden(ComponentEvent e)
void
componentMoved(ComponentEvent e)
void
componentResized(ComponentEvent e)
void
componentShown(ComponentEvent e)
void
destroy()
void
displayMessage(String sender, String msg)
void
focusGained(FocusEvent e)
void
focusLost(FocusEvent e)
byte[]
getState()
void
init()
static void
main(String[] args)
void
moveNode(Node n)
void
receive(Message m)
void
removeNode(Object addr)
void
repaint()
void
setState(byte[] new_state)
void
suspect(Address obj)
Called when a member is suspected
void
viewAccepted(View v)
Called by JGroups to notify the target object of a change of membership.

Field Details

disp

public RpcDispatcher disp


groupname

public final String groupname

Constructor Details

Whiteboard

public Whiteboard()


Whiteboard

public Whiteboard(String properties)

Method Details

actionPerformed

public void actionPerformed(ActionEvent e)


addNode

public void addNode(String lbl,
                    Address addr,
                    int xloc,
                    int yloc)


block

public void block()
Block sending and receiving of messages until viewAccepted() is called
Specified by:
block in interface MembershipListener


componentHidden

public void componentHidden(ComponentEvent e)


componentMoved

public void componentMoved(ComponentEvent e)


componentResized

public void componentResized(ComponentEvent e)


componentShown

public void componentShown(ComponentEvent e)


destroy

public void destroy()


displayMessage

public void displayMessage(String sender,
                           String msg)


focusGained

public void focusGained(FocusEvent e)


focusLost

public void focusLost(FocusEvent e)


getState

public byte[] getState()
Specified by:
getState in interface MessageListener


init

public void init()


main

public static void main(String[] args)


moveNode

public void moveNode(Node n)


receive

public void receive(Message m)
Specified by:
receive in interface MessageListener


removeNode

public void removeNode(Object addr)


repaint

public void repaint()


setState

public void setState(byte[] new_state)
Specified by:
setState in interface MessageListener


suspect

public void suspect(Address obj)
Called when a member is suspected
Specified by:
suspect in interface MembershipListener


viewAccepted

public void viewAccepted(View v)
Called by JGroups to notify the target object of a change of membership. No long running actions should be done in this callback in the case of Ensemble, as this would block Ensemble. If some long running action needs to be performed, it should be done in a separate thread (cf. ../Tests/QuoteServer.java).
Specified by:
viewAccepted in interface MembershipListener


Copyright B) 2001,2002 www.jgroups.com . All Rights Reserved.