|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--amber.client.panel.BaseControl
|
+--amber.client.panel.PMenu
Extension to BaseControl that presents the user with a menu system. In Java 1.1 Menu bars can only be attached to frames however pop up menus can be attached to any component. In a similar way to a panel this control acts as a holding area for a number of components. Unlike a Panel the menu items are not derived from BaseControl class. The system adds the menus using a parent/child relationship. Internally however the hierarchy is flattened into a simple list which contains a relationship between the visual object handle and the Amber ID of the control. When a packet comes into the menu the system identifies the corresponding MenuComponent and performs the operation on it. Events fired by the MenuComponent are handled in the normal way however the ID of the object is altered to point to the ID of the corresponding MenuComponent. Each MenuComponent held in the Menu has a unique ID in a similar way to the normal Remote Components. The menu itself has an ID which is used for messaging to the panel itself. As this appears to be a series of normal components to the server it is important that none of the ID's interfere with the those of any other component or subcomponent.
ApplicationHandler,
ComponentHandler,
BaseComponent,
BaseControl| Field Summary | |
static byte |
Add
Adds a MenuComponent to the menu. |
static byte |
AddShortCut
Adds a key short cut for the MenuItem in the menu. |
static byte |
GetCheckState
Returns the state of a CheckMenuItem in the menu. |
static byte |
GetCheckStateResponse
Return packet ID containing the state of a CheckMenuItem in the menu. |
static byte |
GetLabel
Returns the label of a MenuComponent in the menu. |
static byte |
GetLabelResponse
Return packet ID containing the label of a MenuComponent in the menu. |
static byte |
Insert
Inserts a MenuComponent to the parent menu at the specified location. |
protected java.util.Vector |
itemHandle
|
protected java.util.Vector |
itemId
|
static int |
Menu
Constant defining a type of possible menu. |
static int |
MenuBar
|
static int |
MenuCheckOff
|
static int |
MenuCheckOn
|
static int |
MenuItem
|
static int |
MenuTear
|
static int |
PopupMenu
Constant defining the type of base menu. |
static byte |
Remove
Removes a MenuComponent from the menu. |
static byte |
RemoveAll
Removes all MenuComponent from the menu. |
static byte |
RemoveBarShortCut
Removes a specified key short cut from the MenuItem in the MenuBar. |
static byte |
RemoveShortCut
Removes a key short cut from the MenuItem in the menu. |
static byte |
SetCheckState
Returns the check state of a CheckMenuItem in the menu. |
static byte |
SetEnabled
Set the menu item to enable/disable. |
static byte |
SetLabel
Sets the label for a MenuComponent in the menu. |
static byte |
ShowMenu
Shows the Menu at the specified location relative to the parent. |
| Fields inherited from class amber.client.panel.BaseControl |
dataDecoder, dataEncoder, encoderBytes, eventEnabled, mainEventHandler, nonVisualObject, panelParent, visualObject |
| Constructor Summary | |
PMenu()
|
|
| Method Summary | |
void |
addComponent(Packet packet)
This function is used to add a component to the panel. |
void |
addListeners(BaseComponent listener)
Add in the listener handlers to the input object. |
protected java.awt.MenuItem |
createItem(int type,
java.lang.String name)
This function creates a MenuItem as specified by the input parameters. |
protected java.awt.MenuComponent |
findItemById(int id)
This function is used to find the menu component to alter. |
java.awt.Container |
getContainer()
This function returns the container which holds the child objects. |
short |
getIdFromInternalObject(java.lang.Object source)
This function returns the ID of an object given the corresponding Visual Object returns -1 if no match. |
void |
init(RContainer mainParent,
int[] characteristics,
java.lang.String parameters)
This is the main initialisation function for this class. |
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. |
void |
parseParameters(java.lang.String parameter)
|
protected void |
performOperation(Packet packet,
java.awt.MenuComponent item)
This is the function which performs the operation on the specified MenuComponent. |
void |
processPacket(Packet packet)
This routine contains the logic to parse a packet and perform actions based on the packet's contents. |
void |
removeAllComponents()
This function is used to remove all sub components from the menu. |
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. |
void |
setDisplay(java.awt.Component display)
This defines the new visual object to display the menu on. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface amber.client.RContainer |
findBaseComponent, forwardPacket, getId, getNonVisualObject, getVisualObject, setEnabled, setVisible |
| Field Detail |
public static final byte Add
public static final byte Insert
public static final byte Remove
public static final byte AddShortCut
public static final byte RemoveShortCut
public static final byte SetLabel
public static final byte GetLabel
public static final byte GetLabelResponse
public static final byte SetCheckState
public static final byte GetCheckState
public static final byte GetCheckStateResponse
public static final byte ShowMenu
public static final byte RemoveAll
public static final byte SetEnabled
public static final byte RemoveBarShortCut
public static final int Menu
public static final int MenuTear
public static final int MenuItem
public static final int MenuCheckOff
public static final int MenuCheckOn
public static final int PopupMenu
public static final int MenuBar
protected java.util.Vector itemId
protected java.util.Vector itemHandle
| Constructor Detail |
public PMenu()
| Method Detail |
public void init(RContainer mainParent,
int[] characteristics,
java.lang.String parameters)
init in class BaseControlmainParent - RContainer handle to the panel this is a component of.characteristics - int [6] containing information useful to the component
in the order ID, eventMask, x, y, w, h.parameters - String containing any required parameters separated by '|'public void parseParameters(java.lang.String parameter)
parseParameters in class BaseControlpublic void addListeners(BaseComponent listener)
addListeners in class BaseControlprotected java.awt.MenuComponent findItemById(int id)
id - int containing the Amber ID of the MenuComponent to find.public void processPacket(Packet packet)
processPacket in interface RContainerprocessPacket in class BaseControlamber.client.RContainerpacket - Incoming Packet containing the command and all required parameters.public void internalProcessPacket(Packet packet)
internalProcessPacket in interface RContainerpacket - Incoming Packet containing the command and all required parameters.public void setDisplay(java.awt.Component display)
protected java.awt.MenuItem createItem(int type,
java.lang.String name)
type - int containing the MenuItem type to create.name - String containing the name of the component.public void addComponent(Packet packet)
addComponent in interface RContainerpacket - Packet containing the required information.public void removeComponent(Packet packet)
removeComponent in interface RContainerpacket - Packet containing the required information.public void setComponentBounds(Packet packet)
setComponentBounds in interface RContainerpacket - Packet containing the required information.public void removeAllComponents()
removeAllComponents in interface RContainer
protected void performOperation(Packet packet,
java.awt.MenuComponent item)
packet - The Packet containing the command to respond to.item - The MenuComponent to perform the operation on.public boolean isMyId(int id)
isMyId in interface RContainerisMyId in class BaseControlid - int containing the ID to check for.public short getIdFromInternalObject(java.lang.Object source)
getIdFromInternalObject in class BaseControlsource - Object handle to the object which fired the event.BaseControlpublic java.awt.Container getContainer()
getContainer in interface RContainer
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||