org.formaria.swt
Class Menu

java.lang.Object
  extended by org.eclipse.swt.widgets.Menu
      extended by org.formaria.swt.Menu
All Implemented Interfaces:
Appender, Actionable, TextHolder
Direct Known Subclasses:
MenuBar

public class Menu
extends org.eclipse.swt.widgets.Menu
implements TextHolder, Appender, Actionable

A wrapper for menus

Copyright (c) Formaria Ltd.,


Field Summary
protected  org.eclipse.swt.widgets.MenuItem cascadeMenu
           
 
Constructor Summary
Menu(MenuBar parent)
          Create a new menu
 
Method Summary
 void addSeparator()
          Adds a separator to this item.
 void append(java.lang.Object o, java.lang.String name)
          Appends the object o to this item
protected  void checkSubclass()
          Suppress the subclassing exception
 org.eclipse.swt.widgets.MenuItem getCascadeMenu()
          Get the cascade menu
 java.lang.Object getObject(java.lang.String name)
          Get a child object by name
 java.lang.String getText()
          Get the text/label of a component
 void setAction(java.lang.Object instance)
          Set an action object
 void setName(java.lang.String name)
          Set the name of this object
 void setText(java.lang.String text)
          Set the text/label of a component
 void setup()
          Do any final setup needed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cascadeMenu

protected org.eclipse.swt.widgets.MenuItem cascadeMenu
Constructor Detail

Menu

public Menu(MenuBar parent)
Create a new menu

Parameters:
parent - parent MenuBar
Method Detail

checkSubclass

protected void checkSubclass()
Suppress the subclassing exception


getCascadeMenu

public org.eclipse.swt.widgets.MenuItem getCascadeMenu()
Get the cascade menu

Returns:
the cascade menu

setAction

public void setAction(java.lang.Object instance)
Set an action object

Specified by:
setAction in interface Appender
Specified by:
setAction in interface Actionable
Parameters:
instance - the action object

setup

public void setup()
Do any final setup needed

Specified by:
setup in interface Appender

append

public void append(java.lang.Object o,
                   java.lang.String name)
Appends the object o to this item

Specified by:
append in interface Appender
Parameters:
o - the appended item
name - the name of the menu

addSeparator

public void addSeparator()
Adds a separator to this item.

Specified by:
addSeparator in interface Appender

getObject

public java.lang.Object getObject(java.lang.String name)
Get a child object by name

Specified by:
getObject in interface Appender
Parameters:
name - the item name
Returns:
the child item

setText

public void setText(java.lang.String text)
Set the text/label of a component

Specified by:
setText in interface TextHolder
Parameters:
text - the new text

getText

public java.lang.String getText()
Get the text/label of a component

Specified by:
getText in interface TextHolder
Returns:
the component's text

setName

public void setName(java.lang.String name)
Set the name of this object

Specified by:
setName in interface Appender
Parameters:
name - the item name