amber.server.component
Class LinkHandler

java.lang.Object
  |
  +--java.awt.Component
        |
        +--amber.server.component.ComponentHandler
              |
              +--amber.server.component.LinkHandler
All Implemented Interfaces:
ApplicationInterface, java.awt.image.ImageObserver, java.awt.ItemSelectable, java.awt.MenuContainer, java.io.Serializable

public class LinkHandler
extends ComponentHandler
implements java.io.Serializable

This class handles the requirements for the manipulation of the packets moving to and from an link component. This system is designed to act as an interface between the amber server and JavaScript running on the browser.

The remote client class also responds to information stored in the parameters field of the XYConstraints object when this handler is added to a panel. The allowed parameters are separated in the string by '|' characters. Any unused trailing parameters are optional and will assume default values, however the parameter order is fixed.

For example, if the component takes 4 parameters which are ints, a valid parameter string would be:

"1|2|3"

In this case the fourth parameter would assume the default value.

The parameter elements for this component are:

Component Parameters
NameTypeDescriptionRepeatsDefault

Version:
1.0.0
Author:
Dr. David J. Knowles
See Also:
ApplicationInterface, ComponentHandler, XYConstraints, Serialized Form

Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
static byte ClientInt
           
static byte ClientIntEvent
           
static byte ClientIntResponse
           
protected  LinkResponseInterface clientResponder
          Handle to the object to respond to client requests for data.
static byte ClientString
           
static byte ClientStringEvent
           
static byte ClientStringResponse
           
static byte RequestInt
           
static byte RequestString
           
static byte ServerInt
           
static byte ServerString
           
 
Fields inherited from class amber.server.component.ComponentHandler
actionCommand, active, ApplicationId, CancelReturn, dataEncoder, DefaultTimeout, enabledState, encoderBytes, id, InvalidId, MaximumId, NoReturn, OkCancelType, OkReturn, OkType, OkYesReturn, parentPage, responsePackets, timeoutValue, UnchangeableInvalidId, visibleState, YesNoCancelType, YesNoType, YesReturn
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
LinkHandler()
          Default constructor.
LinkHandler(ApplicationInterface pageHandler)
          The initialising constructor.
LinkHandler(int id, ApplicationInterface pageHandler)
          The initialising constructor.
 
Method Summary
 void addActionListener(LinkListener l)
           
protected  void fireLinkEventPerformed(LinkEvent e)
           
 int getClientInt()
          This function gets the client int.
 LinkResponseInterface getClientResponder()
          Sets who will respond to client requests for information.
 java.lang.String getClientString()
          This function gets the client string.
 java.lang.String getPanelType()
          This function returns the panel component to use with this class.
protected  void handlePacket(PacketData packet)
          This function handles the incoming packets from the component residing on the browser.
 void removeLinkListener(LinkListener l)
           
 void setClientResponder(LinkResponseInterface responder)
          Sets who will respond to client requests for information.
 void setServerInt(int value)
          This function sets the server int.
 void setServerString(java.lang.String value)
          This function sets the server string.
 
Methods inherited from class amber.server.component.ComponentHandler
addActionListener, addComponentListener, addEventMask, addFocusListener, addItemListener, addKeyListener, addMouseListener, addMouseMotionListener, addNotify, addReceivedPacket, addTextListener, addWindowListener, booleanToInt, createDataInput, directPacket, displayMessageBox, fireWindowActivated, fireWindowClosed, fireWindowClosing, fireWindowDeactivated, fireWindowDeiconified, fireWindowEvent, fireWindowIconified, fireWindowOpened, forceComponentGetUrl, forceComponentGetUrl, forwardEventPacket, generateActionEvent, generateFocusEvent, generateItemEvent, generateKeyEvent, generateMouseEvent, getActionCommand, getBounds, getComponentStructure, getDefaultParameters, getEventMask, getFontCharacteristics, getFontCharacteristics, getFontCharacteristics, getFontCharacteristics, getFontStyle, getId, getLocation, getLog, getModalObject, getParentApplication, getParentContainer, getParentServer, getResponsePacket, getSelectedObjects, getSize, getTimeout, getValidId, getX, getY, handleMessages, internalForwardPacket, internalGetBounds, intToBoolean, isActive, isApplicationActive, isComponentModal, isConnected, isEnabled, isMyId, isVisible, processActionEvent, processComponentEvent, processCurrentPacket, processEvent, processFocusEvent, processItemEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processNormalResponse, processTextEvent, queryMessageBox, removeActionListener, removeComponentListener, removeEventMask, removeFocusListener, removeItemListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removeTextListener, removeWindowListener, requestFocus, resetState, restart, sendPacket, sendPacketAndBlock, sendPendingPackets, setActionCommand, setActive, setBackground, setComponentModal, setConnectedState, setCursor, setEnabled, setEventMask, setFont, setFont, setFontStyle, setForeground, setForegroundBackground, setId, setLog, setModalObject, setParentApplication, setParentContainer, setParentServer, setTimeout, setVisible, setX, setY, shutDown, shutDownClient, shutDownClient, start
 
Methods inherited from class java.awt.Component
action, add, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getListeners, getLocale, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPeer, getPreferredSize, getSize, getToolkit, getTreeLock, getWidth, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, remove, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, reshape, resize, resize, setBounds, setBounds, setComponentOrientation, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, update, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ClientString

public static final byte ClientString

ClientInt

public static final byte ClientInt

ClientStringResponse

public static final byte ClientStringResponse

ClientIntResponse

public static final byte ClientIntResponse

ClientStringEvent

public static final byte ClientStringEvent

ClientIntEvent

public static final byte ClientIntEvent

ServerString

public static final byte ServerString

ServerInt

public static final byte ServerInt

RequestString

public static final byte RequestString

RequestInt

public static final byte RequestInt

clientResponder

protected LinkResponseInterface clientResponder
Handle to the object to respond to client requests for data.
Constructor Detail

LinkHandler

public LinkHandler()
Default constructor.

LinkHandler

public LinkHandler(ApplicationInterface pageHandler)
The initialising constructor. This constructor dynamically requests a valid ID value from the ApplicationInterface.
Parameters:
pageHandler - The handle to the main ApplicationInterface which handles the functions of page overall. residing on the browser.

LinkHandler

public LinkHandler(int id,
                   ApplicationInterface pageHandler)
The initialising constructor.
Parameters:
id - The int containing the id of the corresponding remote component residing on the browser.
pageHandler - The handle to the main ApplicationInterface which handles the functions of page overall.
Method Detail

handlePacket

protected void handlePacket(PacketData packet)
                     throws ComponentHandlerException
This function handles the incoming packets from the component residing on the browser. This code may generate events if there is a requirement for the ApplicationInterface to handle the packet.
Overrides:
handlePacket in class ComponentHandler
Parameters:
packet - PacketData containing the packet to handle.
Throws:
ComponentHandlerException - containing the error information.

setServerString

public void setServerString(java.lang.String value)
                     throws ComponentHandlerException
This function sets the server string. Generates a packet which is sent to the remote client.
Parameters:
value - String containing the data to set the server string to.
Throws:
ComponentHandlerException - containing the error information.

setServerInt

public void setServerInt(int value)
                  throws ComponentHandlerException
This function sets the server int. Generates a packet which is sent to the remote client.
Parameters:
value - int containing the data to set the server int to.
Throws:
ComponentHandlerException - containing the error information.

getClientString

public java.lang.String getClientString()
                                 throws ComponentHandlerException
This function gets the client string. It sends a request and blocks until the remote responds.
Returns:
String containing the data in the client string.
Throws:
ComponentHandlerException - containing the error information.

getClientInt

public int getClientInt()
                 throws ComponentHandlerException
This function gets the client int. It sends a request and blocks until the remote responds.
Returns:
int containing the data in the client int.
Throws:
ComponentHandlerException - containing the error information.

removeLinkListener

public void removeLinkListener(LinkListener l)

addActionListener

public void addActionListener(LinkListener l)

fireLinkEventPerformed

protected void fireLinkEventPerformed(LinkEvent e)

getClientResponder

public LinkResponseInterface getClientResponder()
Sets who will respond to client requests for information.
Returns:
LinkResponseInterface who responds to the client requests.

setClientResponder

public void setClientResponder(LinkResponseInterface responder)
Sets who will respond to client requests for information.
Parameters:
responder - LinkResponseInterface who responds to the client requests.

getPanelType

public java.lang.String getPanelType()
This function returns the panel component to use with this class.
Overrides:
getPanelType in class ComponentHandler
Returns:
String containing the panel type to use.


Copyright © 2002 Clearfield Research Ltd. All Rights Reserved.