org.tm4j.tmnav.env .AbstractionEnviroment

Description

An AbstractionEnviroment manages the collaboration between an Abstractor and a Renderer.

An AbstractionEnviroment consists of

  • a current Renderer
  • the RendererDesc of the current Renderer
  • an AbstractorDesc
  • an AbstractionContext
  • a list of AbstractorDescs that are suitable for the current renderer
  • a list of SetableOptions that may be set in the current AbstractionContext. This list may be filtered by the current renderer.

Whenever the renderer is set to a new type, the list of available abstractors and the list of setable options is updated to comply with the requirements of the current renderer.
If the new renderer is not able to work with the current abstractor, the implementation tries to find another abstractor which is both suitable for the current renderer and available. If no such abstractor can be found, the current abstractor is set to null.

For every Abstractor-class, the instance maintains an AbstractionContext.
The context is cached when another abstractor is set as the current abstractor and it is reactivated when the original abstractor is reset.
Instances of this class send PropertyChange-Events for the following three events.
  • the rendererDesc has changed.
  • the abstractorDesc has changed.
  • the rendererDesc has changed and the abstractorDesc was changed implicitly. In this case, the property-attribute of the PropertyChangedEvent is set to the String "rendererDesc-abstractorDesc" and the old and new attributes does contain list with two entries each. The entry at position 0 is the rendererDesc and the entry at position 1 is the abstractorDesc.

Inheritance Hierarchy

Field Summary
PCE_ABSTRACTORDESC PropertyChangeEvent - the abstractorDesc has changed
PCE_BOTHDESCS PropertyChangeEvent - the rendererDesc has changed and the abstractorDesc was changed implicitly too
PCE_RENDERERDESC PropertyChangeEvent - the rendererDesc has changed
Method Summary
org.tm4j.panckoucke.abstraction.AbstractionContext getAbstractionContext()
returns the AbstractionContext that is currently used in this enviroment.

An AbstractionContext is bound to an Abstractor.
org.tm4j.tmnav.env.desc.AbstractorDesc getAbstractorDesc()
Returns the current AbstractorDescription or null if currently no AbstractorDescription is set.
java.beans.PropertyChangeSupport getChangeSupport()
org.tm4j.tmnav.app.TMNavRenderer getRenderer()
org.tm4j.tmnav.app.TMNavRenderer getRenderer(org.tm4j.tmnav.app.ui.RendererView rv)
Returns the current renderer.

If currently no renderer exists an new one is created with the help of the current rendererDescription.
The new renderer is the attached to the given rendererView.
For every instance of the AbstractionEnviroment, a renderer is instantiated only once and cached for further use.
org.tm4j.tmnav.env.desc.RendererDesc getRendererDesc()
Returns the current RendererDescription or null if currently no RendererDescription is set.
java.util.List getSuitableAbstractors()
returns all abstractor descriptions that are suitable for the current renderer.
void setAbstractorDesc(org.tm4j.tmnav.env.desc.AbstractorDesc newAbstractorDesc)
Set the description of the abstractor to use.

After the new abstractorDescription is set, a PropertyChange-event is fired.
This method does nothing if the new abstractor description does not differ from the old description.
void setRendererDesc(org.tm4j.tmnav.env.desc.RendererDesc rd)
Sets the RendererDesc that will be used to instantiate the renderer, the next time the #getRenderer(RendererView)-method is called.