info.monitorenter.gui.chart.controls
Class LayoutFactory.BasicPropertyAdaptSupport

java.lang.Object
  extended by info.monitorenter.gui.chart.controls.LayoutFactory.BasicPropertyAdaptSupport
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.util.EventListener
Enclosing class:
LayoutFactory

public static class LayoutFactory.BasicPropertyAdaptSupport
extends java.lang.Object
implements java.beans.PropertyChangeListener

Implementation for a PropertyChangeListener that adapts a wrapped JComponent to the following properties.

An instance will add itself as a PropertyChangeListener via Component.addPropertyChangeListener(PropertyChangeListener) on the component to adapt to.

However components should also be able to send property changes that make instances of this class garbage - collectable by removing them as a property change listener from them. The constructor given values mark those property changes that will cause instances of this class to remove themselves as a property change listener from the component listened to. These properties may be configured in glue code (as components are generic and should not be hard coded for tasks that are hooked to them).

Author:
Achim Westermann

Nested Class Summary
static interface LayoutFactory.BasicPropertyAdaptSupport.IRemoveAsListenerFromComponentCondition
          Interface to handle the removal of the LayoutFactory.BasicPropertyAdaptSupport as a property change event listener.
static class LayoutFactory.BasicPropertyAdaptSupport.RemoveAsListenerFromComponentIfTraceIsDropped
          Implementation based on the event Chart2D.PROPERTY_ADD_REMOVE_TRACE sent with an old value ITrace2D that has to be matched.
static class LayoutFactory.BasicPropertyAdaptSupport.RemoveAsListenerFromComponentNever
          Implementation dummy that never will decide to remove the calling LayoutFactory.BasicPropertyAdaptSupport to be removed.
 
Field Summary
protected  java.lang.ref.WeakReference<java.awt.Component> m_delegate
          The weak reference to the component to adapt properties on.
 
Constructor Summary
LayoutFactory.BasicPropertyAdaptSupport(java.awt.Component delegate, java.awt.Component adaptee, LayoutFactory.BasicPropertyAdaptSupport.IRemoveAsListenerFromComponentCondition quitListeningControl)
          Creates an instance that will listen to basic properties ("font","foreground","background") on the given component and install those on the delegate component.
 
Method Summary
protected  void finalize()
          Removes the listener for basic property changes from the component to adapt to.
 void propertyChange(java.beans.PropertyChangeEvent evt)
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_delegate

protected java.lang.ref.WeakReference<java.awt.Component> m_delegate
The weak reference to the component to adapt properties on.

Constructor Detail

LayoutFactory.BasicPropertyAdaptSupport

public LayoutFactory.BasicPropertyAdaptSupport(java.awt.Component delegate,
                                               java.awt.Component adaptee,
                                               LayoutFactory.BasicPropertyAdaptSupport.IRemoveAsListenerFromComponentCondition quitListeningControl)
Creates an instance that will listen to basic properties ("font","foreground","background") on the given component and install those on the delegate component.

Parameters:
delegate - The component to adapt the properties on.
adaptee - The peer component delegate will be adapted to.
quitListeningControl - Used to decide when to stop listening on the component (adaptee).
Method Detail

finalize

protected void finalize()
                 throws java.lang.Throwable
Removes the listener for basic property changes from the component to adapt to.

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable - if something goes wrong cleaning up.

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener
See Also:
PropertyChangeListener.propertyChange(java.beans.PropertyChangeEvent)


Copyright © 2001 - 2010 LGPL, All Rights Footloose.