wt.clients.replication.unit
Class UnitUsageItem

java.lang.Object
  extended bywt.clients.replication.unit.UnitUsageItem
All Implemented Interfaces:
Explorable, Identifiable, ReferenceHolder, Updateable

public class UnitUsageItem
extends Object
implements Explorable, Updateable

UnitUsageItem is a model class for manipulating WTUnitUsageLinks.

UnitUsageItem implements the wt.explorer.Explorable interface to allow for use in the WTExplorer.

It contains many methods which it delegates to the contained uses Unit Item to allow for easy integration with the PartExplorer.



Supported API: false

Extendable: false

See Also:
WTExplorer, PartItem, wt.clients.replication.unit.PartExplorer, WTPartUsageLink

Field Summary
(package private) static DecimalFormat df
           
private  String id
           
private  boolean modified
           
private static int newUsageCounter
           
private  double quantity
           
private  QuantityUnit unit
           
private  WTPartUsageLink usageLink
           
private  UnitItem usedBy
           
private  PartItem uses
           
 
Constructor Summary
UnitUsageItem()
          Create an empty usage item.
UnitUsageItem(PartItem uses, UnitItem usedBy)
          Create a usage item between the specified part items.
UnitUsageItem(PartItem uses, UnitItem usedBy, WTPartUsageLink usage_link)
          Create a usage item between the specified part items using the specified usage link.
 
Method Summary
 void create()
          Create a new usage link using the contained information.
 void delete()
          Delete the usage link.
 Explorable[] getContents()
          Return the contents of the uses part item
static DecimalFormat getDecimalFormat()
           
 String getId()
          Get an identifier for this object.
 String getIdentity()
          Return the identity icon of the uses part item
 String getName()
          Return the name of the uses part item
 String getNumber()
          Return the number of the uses part item
 Object getObject()
          Get the contained object.
 Image getOpenIcon()
          Return the open icon of the uses part item
 WTPartUsageLink getPartUsageLink()
          Get the contained usage link.
 String getRevision()
          Return the revision of the uses part item
 Image getStandardIcon()
          Return the standard icon of the uses part item
 String getState()
          Return the state of the uses part item
 String getUniqueIdentity()
          Return the unique identity icon of the uses part item
 UnitItem getUsedBy()
          Get the used by unit item
 Explorable[] getUses()
          Return the objects used by the uses part item.
 PartItem getUsesPart()
          Get the uses part item
 String getVersion()
          Return the version of the uses part item
 boolean isModified()
          Return the modified flag
 void setModified(boolean modified_flag)
          Set the modified flag.
 void setObject(Object obj)
          Set the contained object.
 void setPartUsageLink(WTPartUsageLink usage_link)
          Set the contained usage link.
 void setUsedBy(UnitItem usedBy)
          Set the used by unit item
 void setUses(PartItem uses)
          Set the uses part item.
 void update()
          Update the usage link.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

usageLink

private WTPartUsageLink usageLink

newUsageCounter

private static int newUsageCounter

modified

private boolean modified

id

private String id

quantity

private double quantity

unit

private QuantityUnit unit

uses

private PartItem uses

usedBy

private UnitItem usedBy

df

static DecimalFormat df
Constructor Detail

UnitUsageItem

public UnitUsageItem()
Create an empty usage item.


UnitUsageItem

public UnitUsageItem(PartItem uses,
                     UnitItem usedBy)
Create a usage item between the specified part items.

Parameters:
uses - the uses part
usedBy - the usedBy unit

UnitUsageItem

public UnitUsageItem(PartItem uses,
                     UnitItem usedBy,
                     WTPartUsageLink usage_link)
Create a usage item between the specified part items using the specified usage link.

Parameters:
uses - the uses part
usedBy - the usedBy part
usage_link - the actual usage link
Method Detail

setModified

public void setModified(boolean modified_flag)
Set the modified flag.

Parameters:
modified_flag - the new value for the modified flag

isModified

public boolean isModified()
Return the modified flag

Returns:
true if modified

create

public void create()
            throws WTException
Create a new usage link using the contained information.

Specified by:
create in interface Updateable
Throws:
WTException
See Also:
WTException

update

public void update()
            throws WTException
Update the usage link.

Specified by:
update in interface Updateable
Throws:
WTException
See Also:
WTException

delete

public void delete()
            throws WTException
Delete the usage link.

Specified by:
delete in interface Updateable
Throws:
WTException
See Also:
WTException

setPartUsageLink

public void setPartUsageLink(WTPartUsageLink usage_link)
Set the contained usage link.

Parameters:
usage_link - the usage link to contain.

getPartUsageLink

public WTPartUsageLink getPartUsageLink()
Get the contained usage link.

Returns:
the contained usage link

setUses

public void setUses(PartItem uses)
Set the uses part item.

Parameters:
uses - the uses part item

getUsesPart

public PartItem getUsesPart()
Get the uses part item

Returns:
the uses part item

setUsedBy

public void setUsedBy(UnitItem usedBy)
Set the used by unit item

Parameters:
usedBy - the used by unit item

getUsedBy

public UnitItem getUsedBy()
Get the used by unit item

Returns:
the used by unit item

getId

public String getId()
Get an identifier for this object.

Returns:
an identifying string

getUses

public Explorable[] getUses()
                     throws WTException
Return the objects used by the uses part item.

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

getState

public String getState()
Return the state of the uses part item

Returns:
the state of the uses part item

getRevision

public String getRevision()
Return the revision of the uses part item

Returns:
the revision of the uses part item

getVersion

public String getVersion()
Return the version of the uses part item

Returns:
the version of the uses part item

getNumber

public String getNumber()
Return the number of the uses part item

Returns:
the number of the uses part item

getName

public String getName()
Return the name of the uses part item

Returns:
the name of the uses part item

getStandardIcon

public Image getStandardIcon()
Return the standard icon of the uses part item

Specified by:
getStandardIcon in interface Identifiable
Returns:
the standard icon of the uses part item

getOpenIcon

public Image getOpenIcon()
Return the open icon of the uses part item

Specified by:
getOpenIcon in interface Identifiable
Returns:
the open icon of the uses part item

getIdentity

public String getIdentity()
Return the identity icon of the uses part item

Specified by:
getIdentity in interface Identifiable
Returns:
the identity icon of the uses part item

getUniqueIdentity

public String getUniqueIdentity()
Return the unique identity icon of the uses part item

Specified by:
getUniqueIdentity in interface Identifiable
Returns:
the unique identity icon of the uses part item

getContents

public Explorable[] getContents()
                         throws WTException
Return the contents of the uses part item

Specified by:
getContents in interface Explorable
Returns:
an array of contents of the uses part item
Throws:
WTException
See Also:
WTException

setObject

public void setObject(Object obj)
Set the contained object.

Implements the ReferenceHolder interface.

Specified by:
setObject in interface ReferenceHolder
Parameters:
obj - the contained object

getObject

public Object getObject()
Get the contained object.

Implements the ReferenceHolder interface.

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

getDecimalFormat

public static DecimalFormat getDecimalFormat()