|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
A FeatureManager manages a set of Features for a single
DialogControl instance.
The functionality of FeatureManager is an integral part of
DialogControl. Every DialogControl is (per inheritence) a
FeatureManager!
When using Features, it is important, that the feature instances
are registered within the FeatureManager to work properly; otherwise
they cannot take part on the dialog lifecycle installed to.
A FeatureManager does support accessing installed Features
via key classes. Such a key class must be a superclass or interface of the concrete
Feature implementation and must implement Feature. This key class
must be provided on feature-registration (see installFeature(Class, Feature)
or installFeature(Class, Class)). If a feature is installed without a
key class, it cannot be retreived from the FeatureManager.
To remove a Feature instance from the FeatureManager eighter
dispose them (see Feature.dispose()) or uninstall them (see
uninstallFeature(Feature).
There are two ways of installing and accessing Features within
an application:
// Setup-code: getDialogControl().installFeature(VisualRepresentationFeature.class,new VisualRepresentationFeature()); // Access code (usually wrapped within a getter method) (VisualRepresentationFeature)getDialogControl().getFeature(VisualRepresentationFeature.class);
// Access code (usually wrapped within a getter method) (VisualRepresentationFeature)getDialogControl().requireFeature(VisualRepresentationFeature.class);
| Method Summary | |
Feature |
getFeature(java.lang.Class keyClass)
Returns the Feature associated with the given key class. |
boolean |
hasFeature(java.lang.Class keyClass)
Returns true, if a Feature is registered under the
given key class. |
Feature |
installFeature(java.lang.Class featureClass)
Installs an instance of the specified feature class. |
Feature |
installFeature(java.lang.Class keyClass,
java.lang.Class featureClass)
Installs an instance of the specified feature class under the given key class. |
Feature |
installFeature(java.lang.Class keyClass,
Feature feature)
Installs the specified feature under the given key class. |
Feature |
installFeature(Feature feature)
Installs the specified feature. |
Feature |
requireFeature(java.lang.Class featureClass)
Returns the feature associated with the given key class; if no such feature was registered before, a new instance of the given class will created and installed as Feature for it's concrete class
as feature key class. |
Feature |
uninstallFeature(Feature feature)
Uninstalls the specified feature instance. |
| Method Detail |
public Feature installFeature(Feature feature)
Feature cannote be accessed by
a key class, so therefore installFeature(Class, Feature) should
be called.
feature - the feature instance to be installed
Feature instance (the same than the parameter)public Feature installFeature(java.lang.Class keyClass, Feature feature)
Note: There must no feature installed with the given key class before, otherwise an assertion will be thrown.
keyClass - the key class to refer to the featurefeature - the feature instance to be installed
Feature instance (the same than the parameter)public Feature uninstallFeature(Feature feature)
feature - the feature instance to be uninstalled
Feature instancepublic Feature installFeature(java.lang.Class keyClass, java.lang.Class featureClass)
FeatureManager tries to create the feature instance using
the registered FeatureCreator's. It is assumed, that the
most specific FeatureCreator is added last.
The given feature class must be a subclass of the key class given.
Note: There must no feature installed with the given key class before, otherwise an assertion will be thrown.
keyClass - the key class to refer to the feature (if null, the
feature instance will be installed, but no mapping will be made)featureClass - the feature class to install an instance of
Feature instancepublic Feature installFeature(java.lang.Class featureClass)
installFeature(Class, Class).
The FeatureManager tries to create the feature instance using
the registered FeatureCreator's. It is assumed, that the
most specific FeatureCreator is added last.
featureClass - the feature class to install an instance of
Feature instanceinstallFeature(Class, Class)public boolean hasFeature(java.lang.Class keyClass)
true, if a Feature is registered under the
given key class.
keyClass - the key class to check containment forpublic Feature getFeature(java.lang.Class keyClass)
Feature associated with the given key class.
public Feature requireFeature(java.lang.Class featureClass)
Feature for it's concrete class
as feature key class.
featureClass - the key and concrete feature class
Feature associated with the given key class.installFeature(Class)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||