com.inline.feature
Interface FeatureConstructor

All Known Implementing Classes:
AbstractFeatureConstructor

public interface FeatureConstructor
extends Displayable

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:

See Also:
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

DISPLAY_TYPE_PREFIX

public static final java.lang.String DISPLAY_TYPE_PREFIX
By convention, this string is used as the prefix of the FeatureConstructors display type.
Method Detail

getFeatureModel

public FeatureModel getFeatureModel()
Returns the feature model that this constructor is associated with.

getName

public java.lang.String getName()
Every constructor should have a name so it can be identified for programmatic feature construction.

isDefault

public boolean isDefault()
A feature constructor that can be used as the default one for the corresponding feature type should return true. There should be only one default constructor for each type withing the scope of the parent feature.

isEnabled

public 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).

isAddFeatureActionAllowed

public boolean isAddFeatureActionAllowed()
Can this constructor be used directly by an AddFeatureAction?

construct

public Feature construct()
Creates a new feature or features. You will need to call 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().

insert

public void insert(Feature feature)
            throws InvalidFeatureException
Call this method with a feature constructed using the same constructor to insert it into the feature model. If the feature has children at this point, all those features should be automatically inserted as well. Call featureModel.commit() to make the new feature(s) persistent.

constructAndInsert

public Feature constructAndInsert()
                           throws InvalidFeatureException
Optional convenience method that constructs and immediately inserts a feature. If the constuctor does not support this operation, it should throw UnsupportedOperationException.