Class LayoutFactory.BasicPropertyAdaptSupport
java.lang.Object
info.monitorenter.gui.chart.controls.LayoutFactory.BasicPropertyAdaptSupport
- All Implemented Interfaces:
PropertyChangeListener
,EventListener
- Enclosing class:
LayoutFactory
public static class LayoutFactory.BasicPropertyAdaptSupport
extends Object
implements PropertyChangeListener
Implementation for a
PropertyChangeListener
that adapts a
wrapped JComponent
to the following properties.
- background color ("background")
- foreground color (text color:"foreground")
- font ("font")
An instance will add itself as a
via
PropertyChangeListener
on the component to adapt to.
Component.addPropertyChangeListener(PropertyChangeListener)
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
Nested ClassesModifier and TypeClassDescriptionstatic interface
Interface to handle the removal of the
as a property change event listener.LayoutFactory.BasicPropertyAdaptSupport
static class
Implementation based on the event
sent with an old valueChart2D.PROPERTY_ADD_REMOVE_TRACE
that has to be matched.ITrace2D
static class
Implementation dummy that never will decide to remove the calling
to be removed.LayoutFactory.BasicPropertyAdaptSupport
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected WeakReference
<Component> The weak reference to the component to adapt properties on. -
Constructor Summary
ConstructorsConstructorDescriptionBasicPropertyAdaptSupport
(Component delegate, 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
Modifier and TypeMethodDescriptionprotected void
finalize()
Removes the listener for basic property changes from the component to adapt to.void
-
Field Details
-
m_delegate
The weak reference to the component to adapt properties on.
-
-
Constructor Details
-
BasicPropertyAdaptSupport
public BasicPropertyAdaptSupport(Component delegate, 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 Details
-
finalize
Removes the listener for basic property changes from the component to adapt to. -
propertyChange
- Specified by:
propertyChange
in interfacePropertyChangeListener
- See Also:
-