Synergy Home Page

au.edu.swin.synergy.plugin.mod13.event
Class BAddMenuCE

java.lang.Object
  |
  +--java.util.EventObject
        |
        +--au.edu.swin.synergy.kernel.BCommandEvent
              |
              +--au.edu.swin.synergy.plugin.mod13.event.BWindowCE
                    |
                    +--au.edu.swin.synergy.plugin.mod13.event.BAddMenuCE

public class BAddMenuCE
extends BWindowCE

Add menu allows you to add an entire JMenu of components to the menu bar. It is recommended that you use BAddMenuItem instead and simply specify the name of the menu you want it to go in since adding an entire JMenu results in taking everything out of it and adding it to a BAddMenuItemCE event anyway.

The reason for this is because if two Menus exist, it needs to be merged into one in which case the specified location will be ignored and the existing location will be used and custom menu items may be lost.

For similar reasons there is no associated BRemoveMenuCE. Because the names of the menus can coincide with other plugins naming conventions, we can't assume that the plugin that initially created the menu is the only one that has items in it. Therefore, to remove a menu, the plugin must place all of the menu items in a BRemoveMenuItemCE and send that to the kernel.

This way if it is the only plugin with items in the menu, the menu will be removed, if not, the other plugins menu items will stay

If the menu doesn't exist it will simply be added as normal in the specified location.

See Also:
Serialized Form

Field Summary
static int kAlwaysRightAligned
          Using this policy will ensure that the menu is right aligned.
static int kNormalPolicy
          Using this location policy, the menu added will go after all the existing menus, but before the menus with the kAlwaysRightAligned policy.
 
Fields inherited from class au.edu.swin.synergy.kernel.BCommandEvent
connectionID, index, kBroadcast, kClient, kClientDone, kLocal, kServer, kServerDone, networkStatus, serialVersionUID
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
BAddMenuCE(Object source, BString menuName, JMenu fMenu)
          Creates a new add menu ce with the default location policy.
BAddMenuCE(Object source, BString menuName, JMenu fMenu, int locationPolicy)
          Creates a new add menu event with the specified location policy.
 
Method Summary
 int getLocationPolicy()
          This will return the requested location policy for this menu.
 JMenu getMenu()
          Please complete the missing tags for getMenu
 BString getMenuName()
          Gets the locale sensitive name of this menu
 BString getPreferredMnemonic()
          This will return the preferred mnemonic for this menu.
 void setPreferredMnemonic(BString preferredMnemonic)
          You can set the mnemonic you prefer for this menu here.
 
Methods inherited from class au.edu.swin.synergy.kernel.BCommandEvent
decrementThreadCount, doComplete, doInit, getAutoComplete, getCompletionObject, getCompletionStatus, getConnectionID, getIndex, getNetworkStatus, getPipe, getUndoable, setAutoComplete, setCompletionObject, setCompletionStatus, setConnectionID, setIndex, setNetworkStatus, setPipe, setThreadCount, setUndoable
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

kAlwaysRightAligned

public static final int kAlwaysRightAligned
Using this policy will ensure that the menu is right aligned. Any right aligned menus added after this will become the right most menu followed by this one and so on...

kNormalPolicy

public static final int kNormalPolicy
Using this location policy, the menu added will go after all the existing menus, but before the menus with the kAlwaysRightAligned policy.
Constructor Detail

BAddMenuCE

public BAddMenuCE(Object source,
                  BString menuName,
                  JMenu fMenu)
Creates a new add menu ce with the default location policy.
Parameters:
source - The source of the event
fMenu - The menu to add to the menu bart

BAddMenuCE

public BAddMenuCE(Object source,
                  BString menuName,
                  JMenu fMenu,
                  int locationPolicy)
Creates a new add menu event with the specified location policy.
Parameters:
source - The source of the event
menuName - The locale sensitive name of the menu
fMenu - The menu to add to the menu bart
locationPolicy - The location policy for the menu kAlwaysRightAligned, kNormalPolicy
Method Detail

getMenuName

public BString getMenuName()
Gets the locale sensitive name of this menu
Returns:
The locale sensntive name of the menu

getMenu

public JMenu getMenu()
Please complete the missing tags for getMenu
Parameters:
-  
Returns:
 
Throws:
-  
Pre Condition:
 
Post Condition:
 

getLocationPolicy

public int getLocationPolicy()
This will return the requested location policy for this menu.
Returns:
The location policy for this new menu

setPreferredMnemonic

public void setPreferredMnemonic(BString preferredMnemonic)
You can set the mnemonic you prefer for this menu here. It should be noted that if another menu already has the mnemonic specified it will be changed to the next available mnemonic.
Parameters:
preferredMnemonic - The preferred mnemonic for this menu

getPreferredMnemonic

public BString getPreferredMnemonic()
This will return the preferred mnemonic for this menu.
Returns:
The preferred mnemonic

Synergy Home Page