com.novell.application.console.snapin
Interface DisplayNameSnapin

All Superinterfaces:
Snapin
All Known Subinterfaces:
DisplayNameSnapinRev2

public interface DisplayNameSnapin
extends Snapin

Provides the display name associated with a specified ObjectEntry or ObjectType object.

Snap-ins must implement this interface to provide the display name for the specified ObjectEntry or ObjectType object. Two types of the getDisplayName method are available for snap-ins to use: One associated with a specified ObjectEntry object, and the other associated with a specified namespace and ObjectType object. The name for the object is displayed next to an icon representing the object. If the DisplayNameSnapin interface is not implemented a default name will be used.

See Also:
ObjectEntry, ObjectType

Field Summary
static int FULLY_QUALIFIED
          The user-readable fully-qualified version of the ObjectEntry object's name.
static int SHORT
          The user-readable short version of the ObjectEntry object's name.
 
Method Summary
 java.lang.String getDisplayName(ObjectEntry entry)
          Returns the display name associated with the specified ObjectEntry object in the tree.
 java.lang.String getDisplayName(java.lang.String namespace, java.lang.String type)
          Returns the display name associated with the specified namespace and object type.
 
Methods inherited from interface com.novell.application.console.snapin.Snapin
getSnapinDescription, getSnapinName, initSnapin, shutdownSnapin
 

Field Detail

SHORT

public static final int SHORT
The user-readable short version of the ObjectEntry object's name.
See Also:
DisplayNameSnapinRev2.getDisplayName(com.novell.application.console.snapin.ObjectEntry, int), Shell.getDisplayName(ObjectEntry, int)

FULLY_QUALIFIED

public static final int FULLY_QUALIFIED
The user-readable fully-qualified version of the ObjectEntry object's name.
See Also:
DisplayNameSnapinRev2.getDisplayName(com.novell.application.console.snapin.ObjectEntry, int), Shell.getDisplayName(ObjectEntry, int)
Method Detail

getDisplayName

public java.lang.String getDisplayName(java.lang.String namespace,
                                       java.lang.String type)
Returns the display name associated with the specified namespace and object type.

You must return the display name associated with the namespace and ObjectType that has the same name as the type parameter. The name should be a localized name for the specified type. For example, if you want to return a French name for a user, the object type parameter must be "user" and the string returned would be a French name for user.

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 type 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 provides an example:


    public String getDisplayName(String namespace, String type)
    {
        return type;
    }
 
Parameters:
namespace - The namespace with which the ObjectType object is associated.
type - The name of the ObjectType object whose name is to be displayed in the tree or view.
Returns:
The name to be displayed, or null if no name is provided.
See Also:
getDisplayName(com.novell.application.console.snapin.ObjectEntry), DisplayIconSnapin.getDisplayIcon(java.lang.String, java.lang.String), Shell.getDisplayName(java.lang.String, java.lang.String)

getDisplayName

public java.lang.String getDisplayName(ObjectEntry entry)
Returns the display name associated with the specified ObjectEntry object in the tree.

You must return the display name that the shell will use to display the specified ObjectEntry object in the tree or view. The name of the object is displayed next to an image representing the object.

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 provides an example:


     public String getDisplayName(ObjectEntry entry)
     {
         String name = entry.getName();
         if(name.equals(""))
         {
             return "InvalidEntry";
         };
         int slash = name.lastIndexOf(File.separator);
         if (slash > -1)
         {
             name = name.substring(slash + 1);
         }
         if(name.equals(""));
         {
             return "";
         };
         return name;
     }
 
Parameters:
entry - The ObjectEntry object whose name is to be displayed in the tree or view.
Returns:
The name that will be displayed for the object, or null if no display name is provided.
See Also:
getDisplayName(java.lang.String, java.lang.String), DisplayIconSnapin.getDisplayIcon(com.novell.application.console.snapin.ObjectEntry), 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.