amber.server.component
Class ListHandler

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

public class ListHandler
extends ComponentHandler
implements java.io.Serializable

This class handles the requirements for the manipulation of the packets moving to and from a list component. It is designed to look like a standard list and interacts with the ApplicationInterface as if the list were running on the server rather than 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
ItemStringAn Item in the listYes 

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 AddStrings
           
static byte ClearAndFillList
           
static byte ClearList
           
static byte DeleteString
           
static byte GetSelectedIndex
           
static byte GetSelectedIndexes
           
static byte GetSelectedIndexesResponse
           
static byte GetSelectedIndexResponse
           
static byte GetSelectedString
           
static byte GetSelectedStringResponse
           
static byte InsertString
           
static byte ReplaceString
           
static byte SelectItem
           
static byte SetMultipleMode
           
 
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
ListHandler()
          Default constructor.
ListHandler(ApplicationInterface pageHandler)
          The initialising constructor.
ListHandler(int id, ApplicationInterface pageHandler)
          The initialising constructor.
 
Method Summary
 void add(java.lang.String item)
          Adds a line at the end of the list.
 void add(java.lang.String item, int index)
          Adds a line at the specified location in the list.
 void addItem(java.lang.String item)
          Adds a line at the end of the list.
 void addItem(java.lang.String item, int index)
          Adds a line at the specified location in the list.
 void delItem(int position)
          Removes the specified item from the list.
 void deselect(int index)
          Deselects the specified item in the list.
 java.lang.String getItem(int index)
          Returns the item associated with the specified index.
 int getItemCount()
          Returns the number of items in the list.
 java.lang.String[] getItems()
          Returns the items in the list as an array of strings.
 java.lang.String getPanelType()
          This function returns the panel component to use with this class.
 int getSelectedIndex()
          Returns the index of the selected item in the list.
 int[] getSelectedIndexes()
          Gets the multiple selected indexes of the list.
 java.lang.String getSelectedItem()
          Returns the item selected in in the list.
 boolean isMultipleMode()
          This returns what the handler thinks is the mode of the list.
 void remove(int position)
          Removes the specified item from the list.
 void removeAll()
          Removes all the items in the list.
 void replaceItem(java.lang.String newValue, int index)
           
 void select(int index)
          Selects the specified item in the list.
 void setDeselectedItem(java.lang.String item)
          Deselects the specified string in the list.
 void setMultipleMode(boolean mode)
          Sets the list to or from multiple select mode.
 void setSelectedItem(java.lang.String item)
          Selects the specified string in the list.
protected  void setSelection(int index, boolean state)
          Selects/deselects the specified item in the list.
 
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, handlePacket, 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

ClearList

public static final byte ClearList

AddStrings

public static final byte AddStrings

ClearAndFillList

public static final byte ClearAndFillList

GetSelectedIndex

public static final byte GetSelectedIndex

GetSelectedIndexResponse

public static final byte GetSelectedIndexResponse

GetSelectedString

public static final byte GetSelectedString

GetSelectedStringResponse

public static final byte GetSelectedStringResponse

InsertString

public static final byte InsertString

DeleteString

public static final byte DeleteString

SelectItem

public static final byte SelectItem

SetMultipleMode

public static final byte SetMultipleMode

GetSelectedIndexes

public static final byte GetSelectedIndexes

GetSelectedIndexesResponse

public static final byte GetSelectedIndexesResponse

ReplaceString

public static final byte ReplaceString
Constructor Detail

ListHandler

public ListHandler()
Default constructor.

ListHandler

public ListHandler(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.

ListHandler

public ListHandler(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

add

public void add(java.lang.String item)
         throws ComponentHandlerException
Adds a line at the end of the list.
Parameters:
item - String to add to the end of the list.
Throws:
ComponentHandlerException - containing the error information.

add

public void add(java.lang.String item,
                int index)
         throws ComponentHandlerException
Adds a line at the specified location in the list.
Parameters:
item - String to add to the end of the list.
index - int location to place the list item at.
Throws:
ComponentHandlerException - containing the error information.

addItem

public void addItem(java.lang.String item)
             throws ComponentHandlerException
Adds a line at the end of the list.
Parameters:
item - String to add to the end of the list.
Throws:
ComponentHandlerException - containing the error information.

addItem

public void addItem(java.lang.String item,
                    int index)
             throws ComponentHandlerException
Adds a line at the specified location in the list.
Parameters:
item - String to add to the end of the list.
index - int location to place the list item at.
Throws:
ComponentHandlerException - containing the error information.

replaceItem

public void replaceItem(java.lang.String newValue,
                        int index)
                 throws ComponentHandlerException
Throws:
ComponentHandlerException - containing the error information.

removeAll

public void removeAll()
               throws ComponentHandlerException
Removes all the items in the list.
Throws:
ComponentHandlerException - containing the error information.

delItem

public void delItem(int position)
             throws ComponentHandlerException
Removes the specified item from the list.
Parameters:
position - int index of the item to remove from the list.
Throws:
ComponentHandlerException - containing the error information.

remove

public void remove(int position)
            throws ComponentHandlerException
Removes the specified item from the list.
Parameters:
position - int index of the item to remove from the list.
Throws:
ComponentHandlerException - containing the error information.

getSelectedIndex

public int getSelectedIndex()
                     throws ComponentHandlerException
Returns the index of the selected item in the list.
Returns:
int index of the selected item or -1 if no item is selected
Throws:
ComponentHandlerException - containing the error information.

getSelectedItem

public java.lang.String getSelectedItem()
                                 throws ComponentHandlerException
Returns the item selected in in the list.
Returns:
String item selected, or null if no item is selected
Throws:
ComponentHandlerException - containing the error information.

setSelectedItem

public void setSelectedItem(java.lang.String item)
                     throws ComponentHandlerException
Selects the specified string in the list.
Parameters:
item - String item to select in the list.
Throws:
ComponentHandlerException - containing the error information.

setDeselectedItem

public void setDeselectedItem(java.lang.String item)
                       throws ComponentHandlerException
Deselects the specified string in the list.
Parameters:
item - String item to deselect in the list.
Throws:
ComponentHandlerException - containing the error information.

select

public void select(int index)
            throws ComponentHandlerException
Selects the specified item in the list.
Parameters:
index - int index of the list item to select.
Throws:
ComponentHandlerException - containing the error information.

deselect

public void deselect(int index)
              throws ComponentHandlerException
Deselects the specified item in the list.
Parameters:
index - int index of the list item to deselect.
Throws:
ComponentHandlerException - containing the error information.

setSelection

protected void setSelection(int index,
                            boolean state)
                     throws ComponentHandlerException
Selects/deselects the specified item in the list.
Parameters:
index - int index of the list item to select/deselect.
state - boolean state to set the list item to. true is selected, false is deselected.
Throws:
ComponentHandlerException - containing the error information.

setMultipleMode

public void setMultipleMode(boolean mode)
                     throws ComponentHandlerException
Sets the list to or from multiple select mode.
Parameters:
mode - boolean true if multiselection required.

isMultipleMode

public boolean isMultipleMode()
This returns what the handler thinks is the mode of the list. NOTE it is possible that this could be wrong.
Returns:
boolean containing the mode, true if multiple selections allowed.

getSelectedIndexes

public int[] getSelectedIndexes()
                         throws ComponentHandlerException
Gets the multiple selected indexes of the list.
Returns:
int [] containing the indexes. null if there is no selected indexes

getItemCount

public int getItemCount()
Returns the number of items in the list.
Returns:
int number of items.

getItem

public java.lang.String getItem(int index)
Returns the item associated with the specified index.
Parameters:
index - int index of the item to get.
Returns:
String item associated with the index.

getItems

public java.lang.String[] getItems()
Returns the items in the list as an array of strings.
Returns:
String [] items in the list.

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.