|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--java.awt.Panel
|
+--java.applet.Applet
|
+--com.ibm.tspaces.examples.simple.AppletTst1
This class implements a simple Applet that interfaces with TSpaces.
Some things to note:
- It ensures that only one instance of the applet is
is running.
- It uses the destroy() interface to cleanup the connection
to the server.
| Field Summary | |
protected static java.lang.String |
_host
This is the Host where the TupleSpace Server is running |
protected static int |
_port
|
protected static boolean |
_started
This will be set true when start() called and set to false when stop() is called; |
protected TupleSpace |
_ts
This holds a reference to the current TupleSpace. |
protected static java.lang.String |
_tsName
The Space name |
java.awt.Frame |
appFrame
|
protected static java.awt.Color |
BACKGROUND_COLOR
|
protected static int |
HEIGHT
|
protected static int |
WIDTH
|
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT,
CENTER_ALIGNMENT,
LEFT_ALIGNMENT,
RIGHT_ALIGNMENT,
TOP_ALIGNMENT |
| Constructor Summary | |
AppletTst1()
The default constructor. |
|
| Method Summary | |
boolean |
call(java.lang.String eventName_,
java.lang.String tsName_,
int sequenceNumber_,
SuperTuple tuple_,
boolean isException_)
Process the callback from the server that notifies us when anyone (including ourselves) writes to the TupleSpace. |
void |
destroy()
destroy() is called when the applet is going to be permanently stoped We will decrement the instance count and if it is now zero we will cleanup the TSpaces connection. |
void |
init()
Initialization: This could be entered automatically when running as an applet or by being called from main() is being run from an application. |
static void |
main(java.lang.String[] args)
Run the AppletTst1 as an application. |
void |
paint(java.awt.Graphics g)
paint() is called to redisplay |
void |
run()
run: Is entered as as a result of a start thread It is not currently being used. |
void |
setupButtons(java.awt.Panel appPanel)
sets up some buttons that user can poke at Currently it only creates a "Write" button that causes a tuple to be written. |
boolean |
setupTS()
setup for TSpaces access |
void |
start()
start() is called when it is time for the applet to start doing stuff. |
void |
stop()
stop() is called when the applet is no longer visible so we no longer need to keep painting the screen, but we should still listen for events. |
| Methods inherited from class java.applet.Applet |
getAppletContext,
getAppletInfo,
getAudioClip,
getAudioClip,
getCodeBase,
getDocumentBase,
getImage,
getImage,
getLocale,
getParameter,
getParameterInfo,
isActive,
newAudioClip,
play,
play,
resize,
resize,
setStub,
showStatus |
| Methods inherited from class java.awt.Panel |
addNotify |
| Methods inherited from class java.awt.Container |
add,
add,
add,
add,
add,
addContainerListener,
addImpl,
countComponents,
deliverEvent,
doLayout,
findComponentAt,
findComponentAt,
getAlignmentX,
getAlignmentY,
getComponent,
getComponentAt,
getComponentAt,
getComponentCount,
getComponents,
getInsets,
getLayout,
getMaximumSize,
getMinimumSize,
getPreferredSize,
insets,
invalidate,
isAncestorOf,
layout,
list,
list,
locate,
minimumSize,
paintComponents,
paramString,
preferredSize,
print,
printComponents,
processContainerEvent,
processEvent,
remove,
remove,
removeAll,
removeContainerListener,
removeNotify,
setCursor,
setFont,
setLayout,
update,
validate,
validateTree |
| Methods inherited from class java.awt.Component |
action,
add,
addComponentListener,
addFocusListener,
addInputMethodListener,
addKeyListener,
addMouseListener,
addMouseMotionListener,
addPropertyChangeListener,
addPropertyChangeListener,
bounds,
checkImage,
checkImage,
coalesceEvents,
contains,
contains,
createImage,
createImage,
disable,
disableEvents,
dispatchEvent,
enable,
enable,
enableEvents,
enableInputMethods,
firePropertyChange,
getBackground,
getBounds,
getBounds,
getColorModel,
getComponentOrientation,
getCursor,
getDropTarget,
getFont,
getFontMetrics,
getForeground,
getGraphics,
getHeight,
getInputContext,
getInputMethodRequests,
getLocation,
getLocation,
getLocationOnScreen,
getName,
getParent,
getPeer,
getSize,
getSize,
getToolkit,
getTreeLock,
getWidth,
getX,
getY,
gotFocus,
handleEvent,
hasFocus,
hide,
imageUpdate,
inside,
isDisplayable,
isDoubleBuffered,
isEnabled,
isFocusTraversable,
isLightweight,
isOpaque,
isShowing,
isValid,
isVisible,
keyDown,
keyUp,
list,
list,
list,
location,
lostFocus,
mouseDown,
mouseDrag,
mouseEnter,
mouseExit,
mouseMove,
mouseUp,
move,
nextFocus,
paintAll,
postEvent,
prepareImage,
prepareImage,
printAll,
processComponentEvent,
processFocusEvent,
processInputMethodEvent,
processKeyEvent,
processMouseEvent,
processMouseMotionEvent,
remove,
removeComponentListener,
removeFocusListener,
removeInputMethodListener,
removeKeyListener,
removeMouseListener,
removeMouseMotionListener,
removePropertyChangeListener,
removePropertyChangeListener,
repaint,
repaint,
repaint,
repaint,
requestFocus,
reshape,
setBackground,
setBounds,
setBounds,
setComponentOrientation,
setDropTarget,
setEnabled,
setForeground,
setLocale,
setLocation,
setLocation,
setName,
setSize,
setSize,
setVisible,
show,
show,
size,
toString,
transferFocus |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Field Detail |
protected static boolean _started
protected static final int WIDTH
protected static final int HEIGHT
public java.awt.Frame appFrame
protected TupleSpace _ts
protected static java.awt.Color BACKGROUND_COLOR
protected static java.lang.String _host
protected static int _port
protected static java.lang.String _tsName
| Constructor Detail |
public AppletTst1()
| Method Detail |
public void init()
public void setupButtons(java.awt.Panel appPanel)
public boolean setupTS()
public void run()
public void paint(java.awt.Graphics g)
public void start()
public void stop()
public void destroy()
public boolean call(java.lang.String eventName_,
java.lang.String tsName_,
int sequenceNumber_,
SuperTuple tuple_,
boolean isException_)
eventName_ - the name of the event command that caused this call, that is the
name of the client side command of the thread that registered this call, e.g., in the
case of a read, this would be TupleSpace.READ, **not** TupleSpace.WRITE which is the
corresponding command that caused the actaul event.tsName_ - the name of the tuple space this command was executed on.sequenceNumber_ - the sequenceNumber for this event/commandtuple_ - the returned tuple or a Tuple with an exception insideisException_ - was the command processed normaly or was there an exceptionpublic static void main(java.lang.String[] args)
args - - command line arguments
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||