amber.server.component
Class MenuComponentHandler

java.lang.Object
  |
  +--java.awt.Component
        |
        +--amber.server.component.ComponentHandler
              |
              +--amber.server.component.MenuComponentHandler
All Implemented Interfaces:
ApplicationInterface, java.awt.image.ImageObserver, java.awt.ItemSelectable, java.awt.MenuContainer, java.io.Serializable
Direct Known Subclasses:
MenuBarHandler, MenuItemHandler

public class MenuComponentHandler
extends ComponentHandler
implements java.io.Serializable

This class corresponds to a standard java.awt.MenuComponent component. It differs in terms of being Amber aware. For this reason the component communicates with the remote client to perform the standard operations.

Version:
1.0.0
Author:
Dr. David J. Knowles
See Also:
BaseComponent, Serialized Form

Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
protected  java.lang.String name
           
protected  MenuContainer parent
           
 
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
MenuComponentHandler()
           
MenuComponentHandler(ApplicationInterface pageHandler)
          The initialising constructor.
MenuComponentHandler(int id, ApplicationInterface pageHandler)
          The initialising constructor.
 
Method Summary
 int getId()
          Overridden function to ensure that the base id is altered to match the internal base offset.
 int getIdBaseOffset(int id)
          Converts the input ID into the corresponding ID given the base offset the main menu must use.
 MenuContainer getMenuParent()
          Returns the parent container for this menu component.
 java.lang.String getName()
          Gets the name of the menu component.
 java.lang.String getPanelType()
          This function returns the panel component to use with this class.
 MenuContainer getTopMenuParent()
          Returns the top parent container for this menu component.
 boolean isMyId(int inId)
          Checks that the unique ID passed to this page is handled by this ComponentHandler.
protected  java.lang.String paramString()
          Returns the parameter string representing the state of this menu component.
 int removeIdBaseOffset(int id)
          Converts the input ID into the corresponding internal ID by removing the menu base offset.
 void sendPacket(Packet packet)
          This function is sends the created packet to the ApplicationInterface for transmission.
protected  PacketData sendPacketAndBlock(Packet packet, byte responseId)
          This function is similar to sendPacket in that it sends the created packet to the PageHandle for transmission.
 void setName(java.lang.String name)
          Sets the name of the component to the specified string.
 java.lang.String toString()
          Returns a representation of this menu component as a 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, getLocation, getLog, getModalObject, getParentApplication, getParentContainer, getParentServer, getResponsePacket, getSelectedObjects, getSize, getTimeout, getValidId, getX, getY, handleMessages, handlePacket, internalForwardPacket, internalGetBounds, intToBoolean, isActive, isApplicationActive, isComponentModal, isConnected, isEnabled, 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, 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, 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, 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, setSize, setSize, show, show, size, transferFocus, update, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

parent

protected MenuContainer parent

name

protected java.lang.String name
Constructor Detail

MenuComponentHandler

public MenuComponentHandler()

MenuComponentHandler

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

MenuComponentHandler

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

getName

public java.lang.String getName()
Gets the name of the menu component.
Overrides:
getName in class java.awt.Component
Returns:
the name of the menu component.
Since:
JDK1.1
See Also:
MenuComponent.setName(java.lang.String)

setName

public void setName(java.lang.String name)
Sets the name of the component to the specified string.
Overrides:
setName in class java.awt.Component
Parameters:
name - the name of the menu component.
See Also:
MenuComponent.getName()

getMenuParent

public MenuContainer getMenuParent()
Returns the parent container for this menu component.
Returns:
Handle to the menu component containing this menu component, or null if this menu component is the outermost component, the menu bar itself.

getTopMenuParent

public MenuContainer getTopMenuParent()
Returns the top parent container for this menu component.
Returns:
the menu component containing all menu components.

getIdBaseOffset

public int getIdBaseOffset(int id)
Converts the input ID into the corresponding ID given the base offset the main menu must use.
Parameters:
id - int which is the menu item ID.
Returns:
int containing the ID with the base offset added.

removeIdBaseOffset

public int removeIdBaseOffset(int id)
Converts the input ID into the corresponding internal ID by removing the menu base offset.
Parameters:
id - int which is the menu item ID.
Returns:
int containing the ID with the base offset removed.

isMyId

public boolean isMyId(int inId)
Checks that the unique ID passed to this page is handled by this ComponentHandler.
Overrides:
isMyId in class ComponentHandler
Parameters:
id - int component handler ID.
Returns:
boolean if this is the correct ApplicationInterface.

getId

public int getId()
Overridden function to ensure that the base id is altered to match the internal base offset.
Overrides:
getId in class ComponentHandler
Returns:
int containing the ID with the base offset added.

paramString

protected java.lang.String paramString()
Returns the parameter string representing the state of this menu component. This string is useful for debugging.
Overrides:
paramString in class java.awt.Component
Returns:
the parameter string of this menu component.

toString

public java.lang.String toString()
Returns a representation of this menu component as a string.
Overrides:
toString in class java.awt.Component
Returns:
a string representation of this menu component.

sendPacket

public void sendPacket(Packet packet)
                throws ApplicationHandlerException
Description copied from class: ComponentHandler
This function is sends the created packet to the ApplicationInterface for transmission. The packet will only be sent if the component is active.
Overrides:
sendPacket in class ComponentHandler
Following copied from class: amber.server.component.ComponentHandler
Parameters:
packet - Packet containing the packet to send.
Throws:
ApplicationHandlerException - containing transmission errors.

sendPacketAndBlock

protected PacketData sendPacketAndBlock(Packet packet,
                                        byte responseId)
                                 throws ComponentHandlerException
This function is similar to sendPacket in that it sends the created packet to the PageHandle for transmission. This function also sets a mutex block to ensure that the component waits before receiving the response.
Overrides:
sendPacketAndBlock in class ComponentHandler
Parameters:
packet - Packet containing the packet to send.
responseId - byte response value expected.
Returns:
PacketData which is the responding packet. A failed transmission/response returns null.
Throws:
ComponentHandlerException - containing transmission errors.

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.