Adding Custom Icons and Labels to an Object Collection Node
You can customize any object collection node that you have created by adding a new icon and label. To add an icon or label representation to an object collection node, you must create a separate extension called an object representation extension. An object representation extension can specify one or more icons and labels to display for a given object type, and the conditions under which each icon and label are displayed. For example, you can specify three different icons for a single object type, and have each icon appear under different conditions.
Defining an Object Representation Extension
Object representation extensions must reference a common extension point, named vise.inventory.representationspecs. Object representation extensions must specify this extension point in the extension definition, and provide a data object of type com.vmware.ui.objectrepresentation.model.ObjectRepresentationSpec.
An object representation extension specifies the target object type and an array of objects of type com.vmware.ui.objectrepresentation.model.IconLabelSpec. Each IconLabelSpec object in the array represents one icon and label set for the object, and can define the conditions for when that icon and label set appears.
Example: Object Representation Extension for Rack Object shows an example extension definition for an object representation extension. In the example, the extension adds one new icon and label set for a custom object called a Rack.
Example: Object Representation Extension for Rack Object
<extension id="com.vmware.samples.rack.iconLabelSpecCollection">
<extendedPoint>vise.inventory.representationspecs</extendedPoint>
<object>
<objectType>samples:Rack</objectType>
<specCollection>
<com.vmware.ui.objectrepresentation.model.IconLabelSpec>
<iconId>#{rack-empty}</iconId>
<labelId>#{empty}</labelId>
<conditionalProperties>
<String>!chassis</String>
</conditionalProperties>
</com.vmware.ui.objectrepresentation.model.IconLabelSpec>
</specCollection>
</object>
</extension>
 
ObjectRepresentationSpec Extension Object Properties lists the properties of the ObjectRepresentationSpec data object that you must set.
An array of objects of type com.vmware.ui.objectrepresentation.model.IconLabelSpec. Each IconLabelSpec object defines a single icon and label pair, along with the conditions under which that icon and label set appear.
Defining an Individual Icon and Label Set
Each IconLabelSpec object contains an icon ID, a label ID, and one or more conditional properties. The icon ID and label ID values specify the icon and label resources from your plug-in resource .SWF file.
Conditional properties govern when the icon and label appear in the Object Navigator. The <conditionalProperties> property of the IconLabelSpec object contains an array of properties to be evaluated as simple boolean properties. You can use the negation operator (!) to evaluate against the reverse of the boolean value.
In Example: Object Representation Extension for Rack Object, the property chassis is evaluated as a simple boolean, and the (!) operator is used. The icon and label set in the example is only displayed for Rack objects without an associated Chassis.
You can also use a more advanced <conditions> property in an IconLabelSpec object to describe more complex display conditions for your icon and label set. The <conditions> property functions identically to property query constraints in the vSphere Web Client Data Service. See Handling Constraints