com.inline.feature
Interface Feature

All Known Implementing Classes:
AbstractFeature

public interface Feature
extends Displayable

Feature is the key interface in the InLine tool architecture; a feature is a node in a hierarchicaly organized feature model. A lot of methods declared by this interface are implemented by the class AbstractFeature. It is recommended, but not required, that you inherit all feature classes from that class.

The tree of features is rooted in the FeatureModel. Call featureModel.getRootFeature() to obtain the root of the tree. Then invoke feature.getChildren().getFeatureSet() recursively to traverse the tree.

Each feature has a unique identifier withing the model - its URL. Given a URL FeatureModel can find any feature.

Each feature represents some data in persistent resources it represents. For example, a JavaFieldFeature may represent a field declaration in a Java source file. The features representing those persistent resources are allocated lazily during the model parse process. When you traverse the tree or access features' properties the parsing occurs automatically behind the scenes. If any of the underlying resources change, that triggers invalidation of the model, which in turn restarts the parse process.

Features are capable of modifying underlying resources to reflect changes made their properties and to the feature tree structure. Individual changes made to the feature model do not automatically cause changes in the resources. To trigger that process call commit() on the model. Do not call commit() on individual features. That method will be called during the model commit process. It only represents one phase of the overall model commit process.

You can add and remove features. There are two situations when features are added to the model:

Note that features are only allocated directly using the new keyword by the corresponding FeatureSets and FeatureConstructors.

There are two situations when features are removed from the model:

See Also:
FeatureModel, FeatureSet, FeatureConstructor, AbstractFeature

Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Registration for property change events.
 boolean canChange(java.lang.String property)
          Returns true if the specified property is changeable.
 boolean canDelete()
          Returns true if the feature can be removed.
 void commit()
          Applies changes made to the feature's properties to the appropriate resources.
 com.sun.java.util.collections.Set getActions()
          Returns a list of FeatureAction objects that can be applied to this feature.
 FeatureSet getChildren()
          Get all the subfeatures for this feature.
 FeatureModel getFeatureModel()
          Returns the feature model that owns this feature
 com.sun.java.util.collections.List getMessages(java.lang.String messageType)
          Returns a list of FeatureMessage's of the specified type.
 Feature getParent()
          Get the parent for this feature.
 java.lang.String getSignature()
          Signature uniquely identifies a feature within the scope of the feature type within the feature model.
 java.lang.String getType()
          Returns the feature type.
 java.net.URL getURL()
          Returns a unique URL for the feature.
 void invalidate()
          Undo all changes made to the feature and restart the parsing process.
 boolean isMarkedForDeletion()
          Returns true if the feature has been marked for deletion.
 boolean isNew()
          Returns true if the feature is new and has not been committed yet.
 void markForDeletion()
          Marks the feature for deletion.
 void release()
          This method is called when the feature is removed from the feature tree.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 
Methods inherited from interface com.inline.feature.ui.Displayable
getDisplayProperties, getDisplayType
 

Method Detail

getFeatureModel

public FeatureModel getFeatureModel()
Returns the feature model that owns this feature

getURL

public java.net.URL getURL()
Returns a unique URL for the feature. The syntax of the URL is as follows:
     feature:type:signature
  

getType

public java.lang.String getType()
Returns the feature type.

The recommended type declaration syntax is:

      class MyFeature ... {
          public static final String TYPE = "foo-bar-myfeature";
          public String getType() { return TYPE; }
          ...
      }
  

getSignature

public java.lang.String getSignature()
Signature uniquely identifies a feature within the scope of the feature type within the feature model. Typically the signature is given to a feature at allocation time as a parameter of the feature's constructor.

Signature can not change during the lifetime of a feature. If it is required to change a feature's signature, that feature should be removed and a new feature with the changed signature created


getActions

public com.sun.java.util.collections.Set getActions()
Returns a list of FeatureAction objects that can be applied to this feature. Some of them may be disabled.
See Also:
FeatureAction

getParent

public Feature getParent()
Get the parent for this feature. Top-level features return null.

getChildren

public FeatureSet getChildren()
Get all the subfeatures for this feature.

canChange

public boolean canChange(java.lang.String property)
Returns true if the specified property is changeable.

isNew

public boolean isNew()
Returns true if the feature is new and has not been committed yet.

canDelete

public boolean canDelete()
Returns true if the feature can be removed.

markForDeletion

public void markForDeletion()
Marks the feature for deletion. A subsequent model commit will actually delete the underlying resource elements.

isMarkedForDeletion

public boolean isMarkedForDeletion()
Returns true if the feature has been marked for deletion.

commit

public void commit()
            throws InvalidFeatureException
Applies changes made to the feature's properties to the appropriate resources. If the feature is new, new elements are inserted in the resources. If the feature is marked for deletion, some elements are removed from the resources. If the feature's properties have changed, the corresponding changes are made to the resource elements.

Do not call this directly. Call feature.getFeatureModel().commit() instead.


getMessages

public com.sun.java.util.collections.List getMessages(java.lang.String messageType)
Returns a list of FeatureMessage's of the specified type. A typical kind of feature message is ConstraintViolation.
See Also:
FeatureMessage

release

public void release()
This method is called when the feature is removed from the feature tree. It should unregister itself from everything it was listening to and forward the release message to the child feature set.

invalidate

public void invalidate()
Undo all changes made to the feature and restart the parsing process.

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Registration for property change events.

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)