com.novell.application.console.snapin
Interface ViewSnapin

All Superinterfaces:
Snapin
All Known Subinterfaces:
ExtendedViewSnapin

public interface ViewSnapin
extends Snapin

Provides view snap-ins for the ConsoleOne shell.

Snap-ins must implement this interface to provide views for the associated ObjectType. New view snapins should implement ViewSnapinRev2 as well.

See Also:
ViewSnapinRev2

Method Summary
 java.lang.String getUniqueID()
          Returns the unique name of the view.
 java.awt.Component getView(ViewSnapinContext context)
          Returns the object derived from Component that will be used as the view in the shell.
 java.lang.String getViewMenuName()
          Returns the localized name for the view.
 void setInactive(java.awt.Component c)
          Provides a shell notification that the current view has become inactive.
 
Methods inherited from interface com.novell.application.console.snapin.Snapin
getSnapinDescription, getSnapinName, initSnapin, shutdownSnapin
 

Method Detail

getView

public java.awt.Component getView(ViewSnapinContext context)
Returns the object derived from Component that will be used as the view in the shell.

The Component object returned is associated with the ObjectEntry in the view context passed to the snap-in in the context parameter. The view snap-in developer should construct the return Component in the initSnapin() method, then in getView() the new tree selection should be cleared so that new data can be put in. That is, all Components in the view should be removed and a new set of Components set. The following code snippet provides an example.

     // Global variables set up in the initSnapin() method
     //   p -- The panel where the children will be displayed
     //   shell -- A ConsoleOne shell instance

     public Component getView(ViewSnapinContext viewContext)
     {
         // remove any existing components from the pane
         p.removeAll();

         // get enumeration of the selected ObjectEntry's children
         ObjectEntryEnumeration children = shell.getChildren(viewContext.getObjectEntry());

         // for each child, add it to the pane and set up a mouse listener
         while(children.hasMoreElements())
         {
             ObjectEntry child = children.next();
             MyLabel node = new MyLabel(child);
             node.addMouseListener(new MyMouseListener());
             p.add(node);
         };

         // return the reformatted pane
         return p;
     }
 
Parameters:
context - The context information passed to the snap-in.
Returns:
The Component to be shown in the shell as a view.
See Also:
ViewSnapinContext

getUniqueID

public java.lang.String getUniqueID()
Returns the unique name of the view.

In a view snap-in the getUniqueID() method is called before the initSnapin() method. Also, if a view is changed by ConsoleOne, the getViewMenuName() method is called before the initSnapin() method. Following is an implementation example.

     public String getUniqueID()
     {
         return "com.novell.sample.snapins.filesystem.FilesystemListView";
     }
 
Returns:
The unique, non-localized name of the view.

setInactive

public void setInactive(java.awt.Component c)
Provides a shell notification that the current view has become inactive.

An example implementation of setInactive() is as follows.

     public void setInactive(Component c){};
 
Parameters:
c - The instance of the view passed by the shell.

getViewMenuName

public java.lang.String getViewMenuName()
Returns the localized name for the view.

The getViewMenuName() method returns the language-dependent translated (localized) name that will be used as the text in the view menu. Use the ampersand '&' character to specify a mnemonic character. Following is an implementation example.

     public String getViewMenuName()
     {
         return "S&le Filesystem List View";
     };
 
Returns:
The localized name for the view.


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