|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Feature constructors are used to create new Features and insert them into the FeatureModel. Note that FeatureConstructors are not used during the model parse process, FeatureSets allocate features directly in that case.
The process of creating a feature consists of several steps:
featureSet.getDefaultFeatureConstructor(type)
featureSet.getFeatureConstructor(type, name)
featureSet.getFeatureConstructors(type)
and then iterating
through the returned set looking for the wanted constructor.
construct()
. It will produce the new feature. At this point the
feature is not committed yet, it can be modified or even destroyed entirely without
any effect on the overall model.
insert(feature)
to include the new feature into the model.
This still has not made the feature persistent.
FeatureModel.commit()
to make the feature persistent.
This multi-phase commit allows creation of extensive feature trees and
then committing all new features at once.
FeatureSet.getDefaultFeatureConstructor(String)
Field Summary | |
static java.lang.String |
DISPLAY_TYPE_PREFIX
By convention, this string is used as the prefix of the FeatureConstructors display type. |
Method Summary | |
Feature |
construct()
Creates a new feature or features. |
Feature |
constructAndInsert()
Optional convenience method that constructs and immediately inserts a feature. |
FeatureModel |
getFeatureModel()
Returns the feature model that this constructor is associated with. |
java.lang.String |
getName()
Every constructor should have a name so it can be identified for programmatic feature construction. |
void |
insert(Feature feature)
Call this method with a feature constructed using the same constructor to insert it into the feature model. |
boolean |
isAddFeatureActionAllowed()
Can this constructor be used directly by an AddFeatureAction? |
boolean |
isDefault()
A feature constructor that can be used as the default one for the corresponding feature type should return true. |
boolean |
isEnabled()
Returns true if this constructor can construct a feature (for instance, it may not be able to construct a feature if the underlying resources are read-only). |
Methods inherited from interface com.inline.feature.ui.Displayable |
getDisplayProperties,
getDisplayType |
Field Detail |
public static final java.lang.String DISPLAY_TYPE_PREFIX
Method Detail |
public FeatureModel getFeatureModel()
public java.lang.String getName()
public boolean isDefault()
public boolean isEnabled()
public boolean isAddFeatureActionAllowed()
public Feature construct()
insert(feature)
to actually add the feature to the feature model. If you choose not to insert it
into the model after all, call feature.release()
.public void insert(Feature feature) throws InvalidFeatureException
featureModel.commit()
to make the new feature(s) persistent.public Feature constructAndInsert() throws InvalidFeatureException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |