|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.sdm.quasar.client.core.dialog.AbstractFeature
Base implementation of Feature. This base class supports the dialog
lifecycle by providing protected lifecycle-methods to be overwritten by subclasses
(optional).
An AbstractFeature is initializes like this:
Code in the constructor will be executed before the feature will
be attached to the LifeCycle of a DialogControl (see Feature.attachDialogControl(DialogControl)).
So access to getDialogControl() is forbidden (throws an IllegalStateException)
and intialization should be limited to local set-up. Because of leazy intialization
support, features can initialize very lazy access and resource allocation. This
improves application speed, but requires more careful and robust implementation.
To make initialization, that depends on other Features or dialog
services, overwrite init(), where access to getDialogControl()
is allowed.
If a concrete feature wants to take part on the dialog's lifecycle, it just needs
to overwrite one of the lifecycle methods (prepare(), activate(),
deactivate() and release()). In opposite to these lifecycle
methods, a feature implementation must implement init(), to
initialize the feature (see above) and install and register features and services,
and dispose(), where the destruction code should uninstall and unregister
the things registered in the init() method.
Note: Never(!) call any lifecycle-method directly! Lifecycle methods are subject to implement, not to call.
Note: Because of the lifecycle-concept, the dispose() method
can be executed at any time and so should be implemented very robust.
AbstractFeature implements SystemInfoProvider, so just overwrite
collectSystemInfo(SystemInfoNode, SystemInfoOptions) and the information
provided at the given node will be displayed in the system overview dialog and
dumped by a system snapshot. This helps understanding and finding errors in large
applications!
| Constructor Summary | |
AbstractFeature()
Creates a new AbstractFeature.
|
|
| Method Summary | |
protected void |
activate()
Called when the dialog is activated. |
void |
attachDialogControl(DialogControl dialogControl)
Attaches the lifecycle of the Feature to the lifecycle of
the DialogControl given. |
void |
collectSystemInfo(SystemInfoNode root,
SystemInfoOptions options)
Builds the system information tree upon local information of the implementor. The system information tree can be used within development by inspecting the system; so implementors should append their internal state (depending on the details settings within SystemInfoOptions).
The information can be appended to the tree by adding new child
SystemInformationNodes to the root node given using the
SystemInfoNode.createChild(String) method and by setting information
attributes the these nodes or the given root node.
Subclasses should overwrite this method to append system informations |
protected void |
deactivate()
Called when the dialog is deactivated. |
protected abstract void |
dispose()
Called when the feature or dialog is disposed. |
void |
disposeFeature()
Detaches the lifecycle of the Feature from the lifecycle of
the DialogControl previouse given and disposes the feature.
|
protected DialogControl |
getDialogControl()
|
protected abstract void |
init()
Called when the feature is initializing. |
protected boolean |
isInitialized()
Returns true, iff this Feature instance is currently connected to
a DialogControl and wether the init(), nor the dispose()
methods are running. |
protected void |
prepare()
Called when the dialog is prepared. |
protected void |
release()
Called when the dialog is released. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public AbstractFeature()
AbstractFeature.
Note: After calling the constructor, it's important to call the
features attachDialogControl(DialogControl) method (normally done by the
DialogControl's reqireFeature() or installFeature()
methods) to connect the feature to the lifecycle of that dialog. In this case the
init() method of this feature will be called first (to enable initialization)
and then - depending on the dialog's state - the other lifecycle methods will be
called as necessary.
| Method Detail |
public final void attachDialogControl(DialogControl dialogControl)
FeatureFeature to the lifecycle of
the DialogControl given. The feature must not be attached twice.
Note: This method has to be called after the feature was completely created.
attachDialogControl in interface FeatureFeature.attachDialogControl(com.sdm.quasar.client.core.dialog.DialogControl)protected boolean isInitialized()
true, iff this Feature instance is currently connected to
a DialogControl and wether the init(), nor the dispose()
methods are running.
protected final DialogControl getDialogControl()
protected abstract void init()
DialogControl installed to. To access the
DialogControl use the getDialogControl() method.
Override this method to perform some action on initialization e.g. register public services.
protected abstract void dispose()
throws DisposeException
DisposeExceptionprotected void prepare()
LifeCycle.prepare(),
e.g. gain resource and provide services for childs.
The default implementation in AbstractFeature does nothing.
protected void activate()
LifeCycle.activate().
The default implementation in AbstractFeature does nothing.
protected void deactivate()
LifeCycle.deactivate()().
The default implementation in AbstractFeature does nothing.
protected void release()
LifeCycle.release()(),
e.g. unregister services.
The default implementation in AbstractFeature does nothing.
public void collectSystemInfo(SystemInfoNode root,
SystemInfoOptions options)
SystemInfoOptions).
The information can be appended to the tree by adding new child
SystemInformationNodes to the root node given using the
SystemInfoNode.createChild(String) method and by setting information
attributes the these nodes or the given root node.
Subclasses should overwrite this method to append system informations
collectSystemInfo in interface SystemInfoProviderroot - the SystemInfoNode to add information to (guaranteed to be not null)options - contains additional options, that might influence the amount of
information added to the tree (guaranteed to be not null)SystemInfoProvider.collectSystemInfo(com.sdm.quasar.client.core.common.sysinfo.SystemInfoNode, com.sdm.quasar.client.core.common.sysinfo.SystemInfoOptions)
public final void disposeFeature()
throws DisposeException
FeatureFeature from the lifecycle of
the DialogControl previouse given and disposes the feature.
After calling this method must not be used again.
Also attaching to a DialogControl is forbidden after calling this method.
disposeFeature in interface FeatureDisposeExceptionDisposable.dispose()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||