com.novell.application.console.snapin
Class AbstractStatusBarSnapin

java.lang.Object
  |
  +--com.novell.application.console.snapin.AbstractStatusBarSnapin
All Implemented Interfaces:
Snapin, StatusBarSnapin

public abstract class AbstractStatusBarSnapin
extends java.lang.Object
implements StatusBarSnapin

Provides a simplified method of creating status bar snap-ins.

The AbstractStatusBarSnapin class is a simple implementation of the StatusBarSnapin interface. When extended it will create a snap-in to be placed in the shell's status bar. The AbstractStatusBarSnapin class implements methods from the StatusBarSnapin interface, allowing you to derive methods from this abstract class to create a status bar item with dynamic text within a 3-D border. All you have to do is return a text string in the getStatusBarText() method.

See Also:
StatusBarSnapin

Field Summary
protected  java.awt.Component component
          The Component that will be placed in the status bar.
protected  Shell shell
          Shell instance used to interact with the ConsoleOne shell.
 
Constructor Summary
AbstractStatusBarSnapin()
           
 
Method Summary
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.
abstract  java.lang.String getStatusBarText()
          Returns the text to be placed in the status bar item.
 boolean initAbstractSnapin(InitSnapinInfo info)
          Initializes the class that extends the AbstractStatusBarSnapin class.
 void refresh()
          Refreshes the status bar item's text by calling getStatusBarText and then redrawing the status bar item.
 void setStatusBarWidth(int width)
          Sets the width, in characters, of the status bar item.
 void shutdownAbstractSnapin()
          Shuts down the participating snap-in that extends the AbstractStatusBarSnapin class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

component

protected java.awt.Component component
The Component that will be placed in the status bar.

This Component is handled by the AbstractStatusBarSnapin class. Snap-ins do not have to create it or interact with it themselves, unless they desire.


shell

protected Shell shell
Shell instance used to interact with the ConsoleOne shell.

The shell instance is set in initSnapin(). Subclasses should use this variable to make shell calls.

Constructor Detail

AbstractStatusBarSnapin

public AbstractStatusBarSnapin()
Method Detail

getSnapinName

public abstract java.lang.String getSnapinName()
Returns the localized name of the snap-in.

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.

Returns:
The translated string object containing the name of the snap-in.
See Also:
Snapin.getSnapinName()

getSnapinDescription

public abstract java.lang.String getSnapinDescription()
Returns the description of the snap-in.

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.

Returns:
The translated string object containing the description of the snap-in.
See Also:
Snapin.getSnapinDescription()

initAbstractSnapin

public boolean initAbstractSnapin(InitSnapinInfo info)
Initializes the class that extends the AbstractStatusBarSnapin class.

Implement in the extending snap-in if there is anything that needs to be initialized when the snap-in is created.

Parameters:
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.
Returns:
A boolean set to true if the snap-in is able to successfully complete initialization, or false if initialization fails.
See Also:
Snapin.initSnapin(com.novell.application.console.snapin.InitSnapinInfo)

shutdownAbstractSnapin

public void shutdownAbstractSnapin()
Shuts down the participating snap-in that extends the AbstractStatusBarSnapin class.

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 classes shutdownSnapin() method before it performs any necessary clean up.

See Also:
Snapin.shutdownSnapin()

getStatusBarText

public abstract java.lang.String getStatusBarText()
Returns the text to be placed in the status bar item.

You should return the dynamic text that will appear within the 3D border of the status bar item. When the snap-in is first shown and every time refresh() is called getStatusBarItem will be called by the shell. For example, to display the size of a file named File in the status bar item:

     public String getStatusBarText()
     {
         String statusBarText = "File length: ";
         statusBarText += file.length();
         return statusBarText;
     }
 
Returns:
The text string to be placed in the status bar item.

refresh

public void refresh()
Refreshes the status bar item's text by calling getStatusBarText and then redrawing the status bar item.

Snap-ins can call refresh() at any time to change the text displayed in this status bar item. For example, to refresh the status bar item whenever a new item in the tree is selected, implement the ShellSelectionListener interface, add the class to the shell as a listener, then implement the treeSelectionChanged() method. The refresh() method is called as follows:

     public void treeSelectionChanged(ShellEvent event)
     {
         refresh();
     }
 

setStatusBarWidth

public void setStatusBarWidth(int width)
Sets the width, in characters, of the status bar item.

Snap-ins should call this method to set the width, in characters, of the status bar item.

Parameters:
width - The width of the status bar item in characters.


API Documentation Copyright © 1998-2003 Novell, Inc. All rights reserved.
ConsoleOne is a registered trademark of Novell Inc.
Generated December 9 2003 1727.