public class IlvGeneralConstraint extends IlvSimpleConstraint implements IlvUserPropertyHolder
IlvGeneralConstraint
is an extension of
IlvSimpleConstraint
that adds support for user-defined properties.
IlvGeneralConstraint
fires an
ConstraintUserPropertyEvent
both before and after a user-defined
property is modified. Immediately before a property is modified,
IlvGeneralConstraint
fires an aboutToChange
ConstraintUserPropertyEvent
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 IlvGeneralConstraint
fires a changed
ConstraintUserPropertyEvent
to all listeners registered with
the Gantt data model.
IlvGeneralConstraint
predefines 3 properties that are
inherited from its IlvSimpleConstraint
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 ConstraintUserPropertyEvent
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 |
constraintType |
IlvConstraintType |
|
|
ConstraintTypeEvent |
fromActivity |
IlvActivity |
|
||
toActivity |
IlvActivity |
|
Modifier and Type | Class and Description |
---|---|
static class |
IlvGeneralConstraint.Factory
IlvGeneralConstraint.Factory is a factory that creates
instances of IlvGeneralConstraint . |
Modifier and Type | Field and Description |
---|---|
static String |
FROM_ACTIVITY_PROPERTY
Identifies the constraint's from-activity property.
|
static String |
TO_ACTIVITY_PROPERTY
Identifies the constraint's to-activity property.
|
static String |
TYPE_PROPERTY
Identifies the constraint's type property.
|
Constructor and Description |
---|
IlvGeneralConstraint(IlvActivity fromActivity,
IlvActivity toActivity,
IlvConstraintType type)
Creates a new
IlvGeneralConstraint from the specified
from-activity, to-activity, and type. |
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 constraint.
|
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 constraint.
|
Iterator<String> |
propertyNameIterator()
Returns an iterator over all the property names of this constraint.
|
Object |
setProperty(String property,
Object value)
Stores a user-defined property in this constraint's property table.
|
getFromActivity, getToActivity, getType, setType
fireEvent, fireTypeAboutToChange, fireTypeChanged, getGanttModel, setGanttModelImpl, toString
public static final String TYPE_PROPERTY
public static final String FROM_ACTIVITY_PROPERTY
public static final String TO_ACTIVITY_PROPERTY
public IlvGeneralConstraint(IlvActivity fromActivity, IlvActivity toActivity, IlvConstraintType type)
IlvGeneralConstraint
from the specified
from-activity, to-activity, and type.fromActivity
- The source activity of the constraint.toActivity
- The destination activity of the constraint.type
- The type of the constraint.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
then 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 IlvAbstractConstraint
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.