|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Provides the icons associated with a specified ObjectEntry or ObjectType.
Snap-ins must implement this interface to provide the icons for a specified ObjectEntry or object type. Two types of getDisplayIcon() method are provided: One associated with a specified ObjectEntry, and the other associated with a specified namespace and object type. The icon for the object is displayed next to the display name for the object.
| Method Summary | |
boolean |
doesIconChangePerEntry(ObjectType type)
Returns a boolean indicating if the icon can change depending on the ObjectEntry of the specified ObjectType. |
javax.swing.Icon |
getDisplayIcon(ObjectEntry entry)
Returns the snap-in icon associated with the specified ObjectEntry in the tree. |
javax.swing.Icon |
getDisplayIcon(java.lang.String namespace,
java.lang.String type)
Returns the snap-in icon associated with the specified namespace and object type. |
| Methods inherited from interface com.novell.application.console.snapin.Snapin |
getSnapinDescription,
getSnapinName,
initSnapin,
shutdownSnapin |
| Method Detail |
public javax.swing.Icon getDisplayIcon(java.lang.String namespace,
java.lang.String type)
You must return the icon (image) associated with the ObjectType that has the same name as the passed in 'type' String parameter. This should be the generic icon for that ObjectType. This method is called by ConsoleOne in response to a Shell.getDisplayIcon(String namespace, String type) call.
You can return null if there is no icon being provided and you want the default icon to be used. A default icon is returned for the specified entry type only if no other registered snap-in has been defined that provides an icon for that type of entry. Otherwise, a search of all available snap-ins is conducted. The first one that provides an icon for the specified entry is used to return the display icon.
Following is an example of the getDisplayIcon(namespace, type) implementation:
public Icon getDisplayIcon(String namespace, String type)
{
Icon icon = (Icon) icons.get(type);
if(icon == null)
{
Image i = null;
String path = "/com/novell/sample/snapins/filesystem/images/";
path += type + ".gif";
URL url = getClass().getResource(path);
if(url != null)
{
i = Toolkit.getDefaultToolkit().getImage(url);
icon = new ImageIcon(i);
icons.put(type, icon);
}
else
{
System.err.println("Image loading URL is null in
ZipNamespaceDisplay::getDisplayIcon");
}
}
return icon;
}
namespace - The namespace of the object type for the desired
display icon.type - The name of the ObjectType for which to get the icon.DisplayNameSnapin.getDisplayName(java.lang.String, java.lang.String),
Shell.getDisplayIcon(java.lang.String, java.lang.String)public javax.swing.Icon getDisplayIcon(ObjectEntry entry)
You should return the icon (image) that the shell will use to display the specified ObjectEntry in the tree or view. You can return NULL if this snap-in does not have the icon and you want the default icon to be used. A default icon is returned for the specified ObjectEntry only if no other registered snap-in has been defined that provides an icon for that ObjectEntry. Otherwise, a search of all available snap-ins is conducted. The first one that provides an icon for the specified entry is used to return the display icon.
Following is an example of the getDisplayIcon(entry) implementation:
public Icon getDisplayIcon(ObjectEntry entry)
{
return getDisplayIcon(entry.getObjectType().getNamespace()
.getUniqueID(), entry.getObjectType().getName());
}
entry - The specified ObjectEntry for which to get the icon that will be
displayed in the tree or view.DisplayNameSnapin.getDisplayName(com.novell.application.console.snapin.ObjectEntry),
Shell.getDisplayIcon(com.novell.application.console.snapin.ObjectEntry)public boolean doesIconChangePerEntry(ObjectType type)
If the same icon is always returned for a particular ObjectType, return false. If the icon can change depending on the ObjectEntry of the given ObjectType then return true. This way ConsoleOne can cache the icon, when possible, and use the same icon for all objects of the given type.
Following is an example of the doesIconChangePerEntry(type) implementation:
public boolean doesIconChangePerEntry(ObjectType type)
{
return false;
}
type - The ObjectType that is being queried for the icon information.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||