wt.clients.beans.explorer
Class WTBusinessObject

java.lang.Object
  extended bywt.clients.beans.explorer.WTBusinessObject
All Implemented Interfaces:
Explorable, Identifiable, ReferenceHolder, Serializable
Direct Known Subclasses:
ConfigurationItem, FolderBusinessObject, FolderedBusinessObject, InstanceItem, InstanceMasterItem, PartItem, PartItem, PartMasterItem, PartMasterItem, UnitItem, UnitMasterItem

public class WTBusinessObject
extends Object
implements Explorable, Serializable

This class is an adapter class for the Explorable interface. It can be subclassed to add in displaying objects in the WTExplorer, which requires that contained objects implement the Explorable interface. The getUses() method is invoked to show the children of the selected node. The getContents() method is invoked to show the contains for the selected node. The getIdentity() method is invoked to get the display text for the node.

Supported API: true

Extendable: true

See Also:
Serialized Form

Field Summary
private static IconCache iconCache
           
private  IconSelector myIconSelector
           
private  String myIdentity
           
private  WTObject myObject
           
private  ObjectReference myObjectReference
           
private  String openIconResource
           
private  Image standardIcon
           
private  String standardIconResource
           
 
Constructor Summary
WTBusinessObject()
          Constructs a default WTBusinessObject object
WTBusinessObject(String identity, ObjectReference ref, IconSelector ic)
          Constructs a WTBusinessObject object using the specified identity ObjectReference and IconSelector.
WTBusinessObject(String identity, WTObject object)
          Constructs a WTBusinessObject object using the specified identity and WTObject.
 
Method Summary
 Object getAttributeValue(Method aMethod)
          Get an attribute from an object instance.
 Object getAttributeValue(String aMethodName)
          Get an attribute from an object instance.
 Explorable[] getContents()
          Returns an array of Explorable objects contained by this object.
private  WTContext getContext()
           
 String getIdentity()
          Returns a String that represents the object instance.
 Object getObject()
          Gets the contained object.
 Image getOpenIcon()
          Returns an Image that symbolically represents the object instance or class.
 Image getStandardIcon()
          Returns an Image that symbolically represents the object instance or class.
 String getUniqueIdentity()
          Returns a String that uniquely represents the object instance.
 Explorable[] getUses()
          Returns an array of Explorable objects used by this object.
private  void initIconCache()
           
 void setIdentity(String identity)
          Inputs a String that represents the object instance.
 void setObject(Object object)
          Sets the contained object.
 void setObject(WTObject object)
          Sets the contained object.
 void setStandardIcon(Image icon)
           
 void setStandardIcon(String icon)
          Sets the Image that symbolically represents the object instance or class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

iconCache

private static IconCache iconCache

myIdentity

private String myIdentity

openIconResource

private String openIconResource

standardIconResource

private String standardIconResource

myObject

private WTObject myObject

myObjectReference

private ObjectReference myObjectReference

myIconSelector

private IconSelector myIconSelector

standardIcon

private Image standardIcon
Constructor Detail

WTBusinessObject

public WTBusinessObject(String identity,
                        WTObject object)
Constructs a WTBusinessObject object using the specified identity and WTObject.

Parameters:
identity - a string identifying the object
object - the contained WTObject

WTBusinessObject

public WTBusinessObject(String identity,
                        ObjectReference ref,
                        IconSelector ic)
Constructs a WTBusinessObject object using the specified identity ObjectReference and IconSelector. For use by liteweight business objects

Parameters:
identity - a string identifying the object
ref - the contained object's ObjectReference
ic - the contained object's IconSelector

WTBusinessObject

public WTBusinessObject()
Constructs a default WTBusinessObject object

Method Detail

getStandardIcon

public Image getStandardIcon()
Returns an Image that symbolically represents the object instance or class. For the WTExplorer, the Image should be 16x16 pixels. By convention, the background should be transparent which is readily supported by the GIF images. This method is used by WTExplorer during run-time.

Specified by:
getStandardIcon in interface Identifiable
Returns:
Image to be displayed.
Since:
Windchill Foundation 1.0:
See Also:
Image

getOpenIcon

public Image getOpenIcon()
Returns an Image that symbolically represents the object instance or class. For the WTExplorer, the Image should be 16x16 pixels. By convention, the background should be transparent which is readily supported by the GIF images. This method is used by WTExplorer during run-time.

Specified by:
getOpenIcon in interface Identifiable
Returns:
Image to be displayed.
Since:
Windchill Foundation 1.0:
See Also:
Image

setStandardIcon

public void setStandardIcon(String icon)
Sets the Image that symbolically represents the object instance or class. For the WTQuery list, the Image should be 16x16 pixels. By convention, the background should be transparent which is readily supported by the GIF images. This method is used by WTQuery during run-time.

Parameters:
icon - Image to be associated with Object.
Since:
Windchill Foundation 1.0: WTQuery
See Also:
Image, getStandardIcon()

setStandardIcon

public void setStandardIcon(Image icon)

getObject

public Object getObject()
Gets the contained object.

Specified by:
getObject in interface ReferenceHolder
Returns:
the contained object

setObject

public void setObject(WTObject object)
Sets the contained object.

Parameters:
object - the contained object

setObject

public void setObject(Object object)
Sets the contained object.

Specified by:
setObject in interface ReferenceHolder
Parameters:
object - the object to contain

getUses

public Explorable[] getUses()
                     throws WTException
Returns an array of Explorable objects used by this object. This is a dummy implementation that should be overridden by the subclass.

Specified by:
getUses in interface Explorable
Returns:
an array of Explorable objects
Throws:
WTException
See Also:
Explorable

getContents

public Explorable[] getContents()
                         throws WTException
Returns an array of Explorable objects contained by this object. This is a dummy implementation that should be overridden by the subclass.

Specified by:
getContents in interface Explorable
Returns:
an array of Explorable objects
Throws:
WTException
See Also:
Explorable

getIdentity

public String getIdentity()
Returns a String that represents the object instance. For example, if a Document class had a name and revision that uniquely identified the object instance, getIdentity() could return getName() + ", " + getRevision(). This method is used by WTExplorer during run-time.

Specified by:
getIdentity in interface Identifiable
Returns:
the identity of the object. the result can be null.
Since:
Windchill Foundation 1.0: WTExplorer
See Also:
String

setIdentity

public void setIdentity(String identity)
Inputs a String that represents the object instance.

Parameters:
identity - the identity of the object.
Since:
Windchill Foundation 1.0: WTExplorer
See Also:
String, getIdentity()

getUniqueIdentity

public String getUniqueIdentity()
Returns a String that uniquely represents the object instance. This method is used by WTExplorer during run-time.

Specified by:
getUniqueIdentity in interface Identifiable
Returns:
the unique identity of the object.
Since:
Windchill Foundation 1.0: WTExplorer

getAttributeValue

public Object getAttributeValue(String aMethodName)
Get an attribute from an object instance. For example, if the Foo had an method public int getBar(), the getAttribute("getBar") would resolve to getBar method, and return the integer value as an Integer object. This method is used by WTQuery during run-time.

Parameters:
aMethodName - the string name of an attribute getter. This will be resolved as obj.aMethodName();
Returns:
Object if the name can be resolved value is returned. null otherwise.

getAttributeValue

public Object getAttributeValue(Method aMethod)
Get an attribute from an object instance. For example, if the Foo had an method public int getBar(), the getAttribute(getBar) would resolve to getBar method, and return the integer value as an Integer object. This method is used by WTQuery during run-time.

Parameters:
aMethod - the method which returns an attribute value.
Returns:
Object if the name can be resolved value is returned. null otherwise.

initIconCache

private void initIconCache()

getContext

private WTContext getContext()