com.novell.application.console.snapin
Interface DisplayNameSnapinRev2

All Superinterfaces:
DisplayNameSnapin, Snapin

public interface DisplayNameSnapinRev2
extends DisplayNameSnapin

Provides the display name associated with a specified ObjectEntry.

Snap-ins may implement this interface to provide the display name in a short or fully qualified format. If the DisplayNameSnapinRev2 interface is not implemented, the getDisplayName() method in the DisplayNameSnapin will be used. If it does not exist, the oe's default name will be used.


Fields inherited from class com.novell.application.console.snapin.DisplayNameSnapin
FULLY_QUALIFIED, SHORT
 
Method Summary
 java.lang.String getDisplayName(ObjectEntry entry, int displayStyle)
          Returns the display name associated with the specified ObjectEntry in the tree in the specified display format (SHORT or FULLY_QUALIFIED)
 
Methods inherited from interface com.novell.application.console.snapin.DisplayNameSnapin
getDisplayName, getDisplayName
 
Methods inherited from interface com.novell.application.console.snapin.Snapin
getSnapinDescription, getSnapinName, initSnapin, shutdownSnapin
 

Method Detail

getDisplayName

public java.lang.String getDisplayName(ObjectEntry entry,
                                       int displayStyle)
Returns the display name associated with the specified ObjectEntry in the tree in the specified display format (SHORT or FULLY_QUALIFIED)

You must return the display name that the shell will use to display the specified ObjectEntry in the tree or view. The name of the object is displayed next to an image representing the object. The name may be either a short name or one that is "fully qualified" for the namespace.

You can return null if there is no display name being provided and you want the default display name to be used. A default display name is returned for the specified entry only if no other registered snap-in has been defined that provides a name for that type of entry. Otherwise, a search of all available snap-ins is conducted. The first one that provides a name for the specified entry is used to return the display name.

The following code snippet provides an example.


     public String getDisplayName(ObjectEntry entry, int displayStyle)
     {
         String name = entry.getName();
         if(name.equals(""))
         {
             return "InvalidEntry";
         };
         if(displayStyle == DisplayNameSnapin.FULLY_QUALIFIED)
         {
             return name;
         }
         int slash = name.lastIndexOf(File.separator);
         if (slash > -1)
         {
             name = name.substring(slash + 1);
         }
         if(name.equals(""));
         {
             return "";
         };
         return name;
     }
 
Parameters:
entry - The specified ObjectEntry for which to get the name that will be displayed in the tree or view.
displayStyle - The desired display style for the resulting name. Options are: DisplayNameSnapin.SHORT or DisplayNameSnapin.FULLY_QUALIFIED.
Returns:
The name as a String that will be displayed for the object, or null if no display name is being provided.
See Also:
Shell.getDisplayName(com.novell.application.console.snapin.ObjectEntry)


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