com.inline.feature.common
Class AbstractTypedFeatureSet

java.lang.Object
  |
  +--com.inline.feature.common.AbstractResourceListener
        |
        +--com.inline.feature.common.AbstractFeatureSet
              |
              +--com.inline.feature.common.AbstractTypedFeatureSet
Direct Known Subclasses:
JavaClassFeatureSet, JavaFieldFeatureSet, JavaFileFeatureSet, JavaMethodFeatureSet

public abstract class AbstractTypedFeatureSet
extends AbstractFeatureSet

Recommended superclass for FeatureSets handling Features of exactly one type.


Field Summary
protected  java.lang.String type
           
 
Fields inherited from class com.inline.feature.common.AbstractResourceListener
active, featureModel, parent, resourceAdapters, resourceSetAdapters, revalidate
 
Constructor Summary
AbstractTypedFeatureSet(Feature parent, java.lang.String type)
           
 
Method Summary
protected  void activate()
          Refreshes the set and then keeps it in sync until the feature is passivated.
protected abstract  Feature allocateFeature(java.lang.String signature)
          Override this method to allocate an instance of a Feature of the set's type.
 Feature allocateFeature(java.lang.String type, java.lang.String signature)
          Calls allocateFeature(signature).
 boolean canChangeSet()
          Override this to return false if the set is read-only.
protected  void featureAdded(Feature feature)
          Called by getFeatures() when it discovers that a new feature was added to the set.
protected  void featureRemoved(Feature feature)
          Called by getFeatures() when it discovers that a feature was removed from the set.
protected  void featureReplaced(Feature oldFeature, Feature newFeature)
          Called by getFeatures() when it discovers that one feature was replaced by another one.
 Feature getFeature(java.lang.String type, java.lang.String signature)
          Looks up the feature with the specified parameters
 com.sun.java.util.collections.Set getFeatureConstructors()
          Returns getFeatureConstructors(type)
 com.sun.java.util.collections.Set getFeatures()
          Returns the set of all features for this set.
 com.sun.java.util.collections.Set getFeatures(java.lang.String type)
          If the parameter matches this set's type, the method simply returns getFeatures().
protected abstract  com.sun.java.util.collections.Set getFeatureSignatures()
          Override this method to perform parsing of resources and build a set of signatures of all Features of the set's type found on the set's parent Feature.
protected  com.sun.java.util.collections.Set getPrimitiveFeatureConstructors(java.lang.String type)
          Override to specify a set of primitive feature constructors.
 Feature[] getSortedFeatures()
          Returns features sorted according to their DisplayProperty's preferences.
 java.lang.String getType()
          Returns the type of Features supported by this set.
 void insert(Feature feature)
          Inserts the supplied feature and all of its subfeatures into the model.
protected  boolean isDefaultPrimitiveFeatureConstructorAllowed()
          Override and return false if the simple feature constructor that allocates a new empty feature should not be provided.
 boolean isEmpty()
          This method exists for optimization purposes.
protected  void refresh()
          Call this from canChangeSet() to assure that dependencies are registered.
 void release()
          Releases all features in the set.
protected  void removeAll()
          Removes all features from the set.
 void resourceAdded(ResourceSetAdapter source, com.inline.resources.ResourceReference ref)
          Event handler for resource set adapters.
protected  void resourceChanged(ResourceAdapter adapter, java.lang.String property, java.lang.Object oldValue, java.lang.Object newValue)
          Event handler for resource adapters.
 void resourceRemoved(ResourceSetAdapter source, com.inline.resources.ResourceReference ref)
          Event handler for resource set adapters.
 java.lang.String toString()
           
 
Methods inherited from class com.inline.feature.common.AbstractFeatureSet
addFeatureSetListener, fireFeatureAdded, fireFeatureRemoved, fireFeatureReplaced, getDefaultFeatureConstructor, getFeatureConstructor, getFeatureConstructors, removeFeatureSetListener, shouldCheckHasChildren
 
Methods inherited from class com.inline.feature.common.AbstractResourceListener
getFeatureModel, getParent, invalidate, passivate, propertyChange, registerDependencies, registerResourceAdapter, registerResourceAdapter, registerResourceSetAdapter, registerResourceSetAdapter, unregisterResourceAdapter, unregisterResourceSetAdapter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

type

protected java.lang.String type
Constructor Detail

AbstractTypedFeatureSet

public AbstractTypedFeatureSet(Feature parent,
                               java.lang.String type)
Method Detail

getType

public java.lang.String getType()
Returns the type of Features supported by this set.

refresh

protected void refresh()
Call this from canChangeSet() to assure that dependencies are registered.

getFeatureSignatures

protected abstract com.sun.java.util.collections.Set getFeatureSignatures()
Override this method to perform parsing of resources and build a set of signatures of all Features of the set's type found on the set's parent Feature.

getFeatures

public com.sun.java.util.collections.Set getFeatures(java.lang.String type)
If the parameter matches this set's type, the method simply returns getFeatures().

getFeature

public Feature getFeature(java.lang.String type,
                          java.lang.String signature)
Looks up the feature with the specified parameters

getFeatures

public com.sun.java.util.collections.Set getFeatures()
Returns the set of all features for this set. If the method is called the first time or after invalidate(), the method calls getFeatureSignatures() and updates the set of Features accordingly.

getSortedFeatures

public Feature[] getSortedFeatures()
Description copied from interface: FeatureSet
Returns features sorted according to their DisplayProperty's preferences.
Tags copied from interface: FeatureSet
See Also:
DisplayProperties

removeAll

protected void removeAll()
Removes all features from the set. This is called when the set returned by getFeatureSignatures() is empty.

isEmpty

public boolean isEmpty()
Description copied from interface: FeatureSet
This method exists for optimization purposes. Some FeatureSets will be able to answer this question without actually building a set of features.

allocateFeature

public Feature allocateFeature(java.lang.String type,
                               java.lang.String signature)
Calls allocateFeature(signature).

allocateFeature

protected abstract Feature allocateFeature(java.lang.String signature)
Override this method to allocate an instance of a Feature of the set's type.

canChangeSet

public boolean canChangeSet()
Override this to return false if the set is read-only. The default implementation returns true.

getPrimitiveFeatureConstructors

protected com.sun.java.util.collections.Set getPrimitiveFeatureConstructors(java.lang.String type)
Override to specify a set of primitive feature constructors. The default implementation returns the default feature constructor, but only if isDefaultPrimitiveFeatureConstructorAllowed() returns true.
Overrides:
getPrimitiveFeatureConstructors in class AbstractFeatureSet

getFeatureConstructors

public com.sun.java.util.collections.Set getFeatureConstructors()
Returns getFeatureConstructors(type)

isDefaultPrimitiveFeatureConstructorAllowed

protected boolean isDefaultPrimitiveFeatureConstructorAllowed()
Override and return false if the simple feature constructor that allocates a new empty feature should not be provided.

insert

public void insert(Feature feature)
Inserts the supplied feature and all of its subfeatures into the model.

release

public void release()
Releases all features in the set.
Overrides:
release in class AbstractResourceListener

featureReplaced

protected void featureReplaced(Feature oldFeature,
                               Feature newFeature)
Called by getFeatures() when it discovers that one feature was replaced by another one.

featureAdded

protected void featureAdded(Feature feature)
Called by getFeatures() when it discovers that a new feature was added to the set.

featureRemoved

protected void featureRemoved(Feature feature)
Called by getFeatures() when it discovers that a feature was removed from the set.

activate

protected void activate()
Refreshes the set and then keeps it in sync until the feature is passivated.
Overrides:
activate in class AbstractResourceListener
Tags copied from class: AbstractResourceListener
See Also:
AbstractFeature.addPropertyChangeListener(PropertyChangeListener), AbstractFeatureSet.addFeatureSetListener(FeatureSetListener)

resourceChanged

protected void resourceChanged(ResourceAdapter adapter,
                               java.lang.String property,
                               java.lang.Object oldValue,
                               java.lang.Object newValue)
Description copied from class: AbstractResourceListener
Event handler for resource adapters. Calls this.invalidate().
Overrides:
resourceChanged in class AbstractResourceListener

resourceAdded

public void resourceAdded(ResourceSetAdapter source,
                          com.inline.resources.ResourceReference ref)
Description copied from class: AbstractResourceListener
Event handler for resource set adapters. Calls this.invalidate().
Overrides:
resourceAdded in class AbstractResourceListener

resourceRemoved

public void resourceRemoved(ResourceSetAdapter source,
                            com.inline.resources.ResourceReference ref)
Description copied from class: AbstractResourceListener
Event handler for resource set adapters. Calls this.invalidate().
Overrides:
resourceRemoved in class AbstractResourceListener

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object