public class IlvGeneralResource extends IlvSimpleResource implements IlvUserPropertyHolder
IlvGeneralResource
is an extension of IlvSimpleResource
that adds support for user-defined properties.
IlvGeneralResource
fires a ResourceUserPropertyEvent
both before and after a user-defined property is modified. Immediately
before a property is modified, IlvGeneralResource
fires an
aboutToChange ResourceUserPropertyEvent
to all
listeners
registered with the Gantt data model
.
This gives the listeners an opportunity to constrain or veto the proposed
property change. If the property change is not vetoed, then the change
is applied and IlvGeneralResource
fires a changed
ResourceUserPropertyEvent
to all listeners registered with the
Gantt data model.
IlvGeneralResource
predefines 3 properties that are
inherited from its IlvSimpleResource
superclass. These predefined
properties can be accessed through the getProperty(java.lang.String)
and
setProperty(java.lang.String, java.lang.Object)
methods in the same manner as user-defined properties.
However, the predefined properties fire specific event types. They
do not fire ResourceUserPropertyEvent
s as described
above for user-defined properties. The predefined events are shown in the
following table:
Property | Value Type | Equivalent getXXX Method | Equivalent setXXX Method | Event Type |
id |
String |
|
|
ResourceIDEvent |
name |
String |
|
|
ResourceNameEvent |
quantity |
Number |
|
|
ResourceQuantityEvent |
Modifier and Type | Class and Description |
---|---|
static class |
IlvGeneralResource.Factory
IlvGeneralResource.Factory is a factory that creates
instances of IlvGeneralResource . |
Modifier and Type | Field and Description |
---|---|
static String |
ID_PROPERTY
Identifies the resource's ID property.
|
static String |
NAME_PROPERTY
Identifies the resource's name property.
|
static String |
QUANTITY_PROPERTY
Identifies the resource's quantity property.
|
Constructor and Description |
---|
IlvGeneralResource(String id,
String name)
Creates a new
IlvGeneralResource from the specified ID and
name. |
IlvGeneralResource(String id,
String name,
float quantity)
Creates a new
IlvGeneralResource from the specified ID,
name, and quantity. |
Modifier and Type | Method and Description |
---|---|
Object |
getProperty(String property)
Returns the value of a user-defined property or
null if
the property does not exist. |
Collection<String> |
getPropertyNames()
Returns a collection that contains the names of all the properties of
this resource.
|
boolean |
isUserProperty(String name)
Returns
true if the property is a user-defined property. |
protected String |
paramString()
Returns a parameter string that represents the state of this resource.
|
Iterator<String> |
propertyNameIterator()
Returns an iterator over all the property names of this resource.
|
Object |
setProperty(String property,
Object value)
Stores a user-defined property in this resource's property table.
|
getID, getName, getQuantity, setID, setName, setQuantity
fireEvent, fireIDAboutToChange, fireIDChanged, fireNameAboutToChange, fireNameChanged, fireQuantityAboutToChange, fireQuantityChanged, getChildEventFilter, getGanttModel, processChildEvent, setGanttModelImpl, toString
public static final String ID_PROPERTY
public static final String NAME_PROPERTY
public static final String QUANTITY_PROPERTY
public IlvGeneralResource(String id, String name, float quantity)
IlvGeneralResource
from the specified ID,
name, and quantity.id
- The resource ID.name
- The descriptive resource name.quantity
- The quantity of the resource.public Object getProperty(String property)
null
if
the property does not exist.getProperty
in interface IlvUserPropertyHolder
property
- The name of the property.null
if the property
does not exist.setProperty(java.lang.String, java.lang.Object)
,
getPropertyNames()
public Object setProperty(String property, Object value)
setProperty
in interface IlvUserPropertyHolder
property
- The name of the property.value
- The value of the property. If the value is null
the property is removed.getProperty(java.lang.String)
,
getPropertyNames()
public Iterator<String> propertyNameIterator()
propertyNameIterator
in interface IlvUserPropertyHolder
public Collection<String> getPropertyNames()
public boolean isUserProperty(String name)
true
if the property is a user-defined property.isUserProperty
in interface IlvUserPropertyHolder
name
- The name of the property.true
if the property is a user-defined property,
false
otherwise.protected String paramString()
paramString
in class IlvAbstractResource
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.