amber.client
Class RBase

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--java.applet.Applet
                          |
                          +--amber.client.RComponent
                                |
                                +--amber.client.RBase
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, BaseComponent, java.awt.event.ComponentListener, java.util.EventListener, java.awt.event.FocusListener, java.awt.image.ImageObserver, java.awt.event.ItemListener, java.awt.event.KeyListener, MbInterface, java.awt.MenuContainer, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, RContainer, java.io.Serializable, java.awt.event.TextListener, java.awt.event.WindowListener

public class RBase
extends RComponent
implements RContainer

Extension to RComponent that acts as a very simple panel. This version allows the HTML page to specify a single panel component which will be instantiated in this component. The panel component shares the same ID as this component and is given a set of constraints which cause the visual element to resize to the complete size of this object. This object is capable of instantiating a component which extends the BaseControl class. This control responds to a number of parameters. These define the panel component characteristics used when the child control is created. These are:

Version:
1.0.0
Author:
Dr. David J. Knowles
See Also:
ApplicationHandler, ComponentHandler, RComponent, BaseControl, Serialized Form

Inner classes inherited from class java.applet.Applet
java.applet.Applet.AccessibleApplet
 
Inner classes inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
protected  int[] coordinates
           
protected  XYLayout xyL
           
 
Fields inherited from class amber.client.RComponent
connectionModule, dataDecoder, dataEncoder, defaultFont, encoderBytes, eventEnabled, InvalidPageSubId, num, visualObject
 
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
RBase()
           
 
Method Summary
 void addComponent(Packet packet)
          This function is used to add a component to the panel.
protected  void addComponentToPanel(BaseControl item, int[] data)
          This function adds the instantiated component to the panel in the location and size specified by locationData.
static java.lang.String coordToString(int offset, int[] data)
          This function converts the specified int array to the corresponding String form (i.e.
protected  void createAndAddComponent(java.lang.String className, int[] data, java.lang.String parameters)
          Create the component and add to the panel.
 BaseComponent findBaseComponent()
          This function is used to find the parent applet at the top of the chain.
 java.awt.Container getContainer()
          This function returns the container which holds the child objects.
 java.lang.Object getNonVisualObject()
          This function returns the non visual element associated with this container.
 java.awt.Component getVisualObject()
          This function returns the visual element associated with this container.
 void init()
          Main initialisation function for the applet.
 void internalProcessPacket(Packet packet)
          This function is to directly process the commands.
 boolean isMyId(int id)
          This function returns true if the id handed to it is to be handled here.
protected  boolean isSpecial(byte command)
           
 void processPacket(Packet packet)
          This function takes incoming packets and processes them passing them onto the component which needs it.
protected  void processParameters()
          This function parses all the input parameters and converts them to corresponding components and then adds them to the panel.
 void removeAllComponents()
          This function is used to remove all sub components from the panel.
 void removeComponent(Packet packet)
          This function is used to remove a component from the panel.
 void setComponentBounds(Packet packet)
          This function sets the location or size of the component.
 
Methods inherited from class amber.client.RComponent
actionPerformed, addBaseListeners, componentHidden, componentMoved, componentResized, componentShown, createDataInput, displayMessage, displayUrl, enableSpecifiedEvents, findApplet, focusGained, focusLost, forwardPacket, getAppletInfo, getDataInput, getId, getParameter, getSessionId, itemStateChanged, keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, sendEvent, setEnabled, setId, setMessageBoxReturn, setSessionId, setVisible, textValueChanged, waitForImage, waitForRegistration, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpened
 
Methods inherited from class java.applet.Applet
destroy, getAccessibleContext, getAppletContext, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start, stop
 
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, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFont, setLayout, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, 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, getGraphicsConfiguration, 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, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface amber.client.RContainer
forwardPacket, getId, setEnabled, setVisible
 
Methods inherited from interface amber.client.BaseComponent
getAudioClip, getAudioClip, getCodeBase, getImage, getImage
 

Field Detail

xyL

protected XYLayout xyL

coordinates

protected int[] coordinates
Constructor Detail

RBase

public RBase()
Method Detail

init

public void init()
Description copied from class: RComponent
Main initialisation function for the applet.
Overrides:
init in class RComponent

processParameters

protected void processParameters()
                          throws java.lang.ClassNotFoundException,
                                 java.lang.IllegalAccessException,
                                 java.lang.InstantiationException
This function parses all the input parameters and converts them to corresponding components and then adds them to the panel. Parameters are all of the following form:
Component : Class Name of the Panel Object to create.
Id : Id of the Object.
EventMask : The events the control responds to.
Parameters : The Parameters the control is initialised with.

createAndAddComponent

protected void createAndAddComponent(java.lang.String className,
                                     int[] data,
                                     java.lang.String parameters)
                              throws java.lang.ClassNotFoundException,
                                     java.lang.IllegalAccessException,
                                     java.lang.InstantiationException
Create the component and add to the panel.
Parameters:
className - String containing the name of the class to add.
data - int array [ 6 ] containing the coordinates of the component id, eventmask, x, y, w, h
parameters - String containing any parameters.
doTheLayout - boolean, true if the layout is to occur after adding the component.

addComponentToPanel

protected void addComponentToPanel(BaseControl item,
                                   int[] data)
This function adds the instantiated component to the panel in the location and size specified by locationData.
Parameters:
item - BaseControl to be added to the panel.
data - int array [ 6 ] containing the location and size of the component in the panel. The data is in the form id, eventmask, x,y,w,h
doTheLayout - boolean, true if the layout is to occur after adding the component.

coordToString

public static java.lang.String coordToString(int offset,
                                             int[] data)
This function converts the specified int array to the corresponding String form (i.e. n,n,n...).
Parameters:
offset - int containing the offset into the array to start.
data - int array containing the data to convert.
Returns:
String containing the converted data.

isMyId

public boolean isMyId(int id)
This function returns true if the id handed to it is to be handled here.
Specified by:
isMyId in interface RContainer
Overrides:
isMyId in class RComponent
Parameters:
id - int containing the ID to check for.
Returns:
boolean true if this component handles this ID.

isSpecial

protected boolean isSpecial(byte command)

processPacket

public void processPacket(Packet packet)
Description copied from interface: RContainer
This function takes incoming packets and processes them passing them onto the component which needs it. It also processes incoming packets which relate to this component.
Specified by:
processPacket in interface RContainer
Overrides:
processPacket in class RComponent
Following copied from interface: amber.client.RContainer
Parameters:
packet - Incoming Packet containing the command and all required parameters.

findBaseComponent

public BaseComponent findBaseComponent()
This function is used to find the parent applet at the top of the chain.
Specified by:
findBaseComponent in interface RContainer
Returns:
BaseComponent if found or null if not.

getVisualObject

public java.awt.Component getVisualObject()
This function returns the visual element associated with this container.
Specified by:
getVisualObject in interface RContainer
Returns:
Component which is the visual component.

getContainer

public java.awt.Container getContainer()
This function returns the container which holds the child objects.
Specified by:
getContainer in interface RContainer
Returns:
Container which holds the child objects.

getNonVisualObject

public java.lang.Object getNonVisualObject()
This function returns the non visual element associated with this container.
Specified by:
getNonVisualObject in interface RContainer
Returns:
Object which is the non visual component.

removeAllComponents

public void removeAllComponents()
This function is used to remove all sub components from the panel.
Specified by:
removeAllComponents in interface RContainer

setComponentBounds

public void setComponentBounds(Packet packet)
This function sets the location or size of the component. Packet structure: int id, int type, int x (width), int y (height), (int width, int height) bracketed objects optional types which are dependant on the type field.
Specified by:
setComponentBounds in interface RContainer
Parameters:
packet - Packet containing the required information.

removeComponent

public void removeComponent(Packet packet)
This function is used to remove a component from the panel. Packet structure contains the short id of the component to remove.
Specified by:
removeComponent in interface RContainer
Parameters:
packet - Packet containing the required information.

addComponent

public void addComponent(Packet packet)
This function is used to add a component to the panel. Packet structure: int id, int eventmask, int x, int y, int w, int h, string class, string parameters
Specified by:
addComponent in interface RContainer
Parameters:
packet - Packet containing the required information.

internalProcessPacket

public void internalProcessPacket(Packet packet)
Description copied from interface: RContainer
This function is to directly process the commands. No redirection will take place and the destination ID is considered irrelevant.
Specified by:
internalProcessPacket in interface RContainer
Following copied from interface: amber.client.RContainer
Parameters:
packet - Incoming Packet containing the command and all required parameters.


Copyright © 2002 Clearfield Research Ltd. All Rights Reserved.