public void init(Object leafObj)
{
this.leafObject = (ModelObject) leafObj;
ModelQualifier qualifier = leafObject.getQualifier();
PropertyNode modelNode = new PropertyNode();
ModelQualifier modelQualifier = ModelQualifier.constructModelQualifier(qualifier.getModel());
try
{
// Try to load the model. If it can be loaded, then store it
// in the node. This makes it possible to toggle between the
// display name and the name
Model model = ModelConnector.getInstance().getModelByQualifier(modelQualifier);
modelNode.setNodeMapper(displayMapper);
modelNode.setPropertyData(model);
}
catch (OpenBPException e)
{
modelNode.setNodeMapper(stringMapper);
modelNode.setPropertyData(modelQualifier.toString());
}
// Add properties for the comparator and the renderer
modelNode.addProperty(ITEMTYPE_KEY, ItemTypes.MODEL);
modelNode.addProperty(PRIORITY_KEY, new Integer(1));
list.add(modelNode);
// If the found references is no item, then add the item the
// model object belongs to a part of the 'tree path'
if (qualifier.getObjectPath() != null)
{
// Add the itemtype to the tree as a group
PropertyNode objectPathNode = new PropertyNode();
try
{
Item item = ModelConnector.getInstance().getItemByQualifier(qualifier, true);
objectPathNode.setNodeMapper(displayMapper);
objectPathNode.setPropertyData(item);
}
catch (OpenBPException e)
{
objectPathNode.setNodeMapper(stringMapper);
objectPathNode.setPropertyData(qualifier.getItem());
}
// Add properties for the comparator and the renderer
objectPathNode.addProperty(ITEMTYPE_KEY, qualifier.getItemType());
objectPathNode.addProperty(PRIORITY_KEY, new Integer(2));
list.add(objectPathNode);
}
}