|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.novell.application.console.snapin.AbstractToolBarMenuSnapin
Provides a simplified method of creating simple toolbar and menu snap-ins.
The AbstractToolBarMenuSnapin class is a simple implementation of the MenuSnapin and ToolBarSnapin interfaces. Methods from both of these interfaces are implemented in the AbstractToolBarMenuSnapin class. You can then extend this abstract class, deriving its methods, to create specialized menu and toolbar items without having to implement all the methods yourself. The AbstractToolBarMenuSnapin class will create a snap-in that will place a single menu item in the shell's main menu as well as a button in the toolbar.
NOTE: You cannot use the AbstractToolBarMenuSnapin class to create and register a PopupMenuSnapin item. This is not a supported implementation.
ToolBarSnapin
Field Summary | |
protected javax.swing.JMenuItem |
menuItem
The menu item that will be placed in the main menu. |
protected Shell |
shell
Shell instance used to interact with the ConsoleOne shell. |
protected java.awt.Component |
toolBarItem
The Component that will be placed on the toolbar. |
Constructor Summary | |
AbstractToolBarMenuSnapin()
|
Method Summary | |
abstract void |
execute()
Called when the toolbar button is pressed or the menu item is selected. |
abstract javax.swing.Icon |
getIcon()
Returns the icon to be displayed in the toolbar button. |
java.lang.String |
getMenuLocation()
Returns the location of this menu item in the menu hierarchy. |
char |
getMenuMnemonic()
Deprecated. As of ConsoleOne version 1.2, use an ampersand (&) in the string returned from getMenuName() to specify the mnemonic. |
abstract java.lang.String |
getMenuName()
Returns the language-dependent translated menu display name as a String to be placed in the menu item. |
abstract java.lang.String |
getSnapinDescription()
Returns the description of the snap-in. |
abstract java.lang.String |
getSnapinName()
Returns the localized name of the snap-in. |
java.lang.String |
getToolTip()
Returns the localized string to be placed in the tool tip that will be displayed with the toolbar item. |
boolean |
initAbstractSnapin(InitSnapinInfo info)
Initializes the class that extends the AbstractToolBarMenuSnapin class. |
void |
setEnabled(boolean cond)
Enables or disables the toolbar button and menu item. |
void |
shutdownAbstractSnapin()
Shuts down the participating snap-in that extends the AbstractToolBarMenuSnapin class. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected java.awt.Component toolBarItem
This item is handled by AbstractToolBarMenuSnapin. Participating Snap-ins do not have to create it or interact with it themselves, unless that is desired.
protected javax.swing.JMenuItem menuItem
This menu item is handled by AbstractToolBarMenuSnapin. Snap-ins do not have to create it or interact with it themselves, unless they desire.
protected Shell shell
The shell instance is set in initSnapin(). Subclasses should use this variable to make shell calls.
Snapin.initSnapin(com.novell.application.console.snapin.InitSnapinInfo)
Constructor Detail |
public AbstractToolBarMenuSnapin()
Method Detail |
public abstract java.lang.String getSnapinName()
The getSnapinName() method returns the name for the selected snap-in. The shell displays the name you provide together with all the snap-ins of a given type. The user is then allowed to select which snap-ins should be set as active in the current configuration.
Snapin.getSnapinName()
public abstract java.lang.String getSnapinDescription()
The getSnapinDescription() method returns the description of the selected snap-in. The shell displays the description you provide in the configurator's description area. The description should be kept brief and concise.
Snapin.getSnapinDescription()
public boolean initAbstractSnapin(InitSnapinInfo info)
Implement in the extending snap-in if there is anything that needs to be initialized when the snap-in is created.
info
- Contains data the snap-in may use for initialization,
such as references to the shell and the snap-in type,
and may contain a reference to snap-in context data.Snapin.initSnapin(com.novell.application.console.snapin.InitSnapinInfo)
public void shutdownAbstractSnapin()
Implement in the extending snap-in if there is anything that needs to be cleaned up when the snap-in is destroyed. It will be called from this class's shutdownSnapin() method before it performs any necessary clean up.
Snapin.shutdownSnapin()
public java.lang.String getMenuLocation()
The default is to place the snap-in menu under the tools menu. Derived classes can override this to place the menu item in another location.
MenuSnapin.getMenuLocation()
public abstract void execute()
The following example will print a message when the toolbar button is pressed or the menu item is selected.
public void execute()
{
System.out.println("Snapin selected");
}
public abstract javax.swing.Icon getIcon()
The recommended image size is 24 x 24 pixels. The following example code snippet shows how to place an image from a resource bundle in the toolbar button.
public Icon getIcon()
{
ResourceBundle myBundle = ResourceBundle.getBundle("MyBundle");
Image image = (Image) myBundle.getObject("ToolbarButtonImage");
return new imageIcon(image);
}
public abstract java.lang.String getMenuName()
public String getMenuName()
{
return "E&xample Tool";
}
public java.lang.String getToolTip()
The getToolTip() method might be implemented as in the following example:
public String getToolTip()
{
return "Tool Tip";
}
public char getMenuMnemonic()
getMenuName()
to specify the mnemonic.public void setEnabled(boolean cond)
Snap-ins can call this at any time to enable and disable this snap-in tool.
cond
- Boolean set to true to enable the tool, or
false to disable it.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |