org.progeeks.meta.swing
Class AbstractPropertyUI

java.lang.Object
  extended by org.progeeks.meta.swing.AbstractPropertyUI
All Implemented Interfaces:
MetaPropertyUI
Direct Known Subclasses:
AbstractPropertyEditor, ColorRenderer, DefaultPropertyRenderer

public abstract class AbstractPropertyUI
extends java.lang.Object
implements MetaPropertyUI

Base implementation of the MetaPropertyUI interface. Provides some default behavior to make creating MetaPropertyUI implementations easier.

Version:
$Revision: 1.8 $
Author:
Paul Speed

Constructor Summary
AbstractPropertyUI()
           
 
Method Summary
protected  PropertyMutator getPropertyMutator()
          Provides subclasses access to the PropertyMutator.
abstract  java.awt.Component getUIComponent()
          Returns the component that renders the associated property mutator's value.
 MetaPropertyContext getViewContext()
          Returns the MetaPropertyContext for which this MetaPropertyUI is a participant.
 void initializeView(MetaPropertyContext viewContext)
          Initializes this MetaPropertyUI as a participant in the specified MetaPropertyContext's hierarchy.
 boolean isLabeled()
          Returns true if the UI component provides its own label.
 boolean isSingleColumn()
          Returns true if the UI component fits the standard Label:Component display method.
protected  void propertyChanged(java.beans.PropertyChangeEvent event)
          Called when the value contained in the mutator changes.
 void release()
          Releases any listeners or resources associated with this MetaPropertyUI.
protected  void releaseComponent()
          Implemented by subclasses to release any component-related resources.
protected  void resetComponentValue()
          Called to set the component value to a default state.
protected abstract  void setComponentValue(java.lang.Object value)
          Called to set the current value displayed in the component.
 void setPropertyMutator(PropertyMutator mutator)
          Sets this MetaPropertyUI instance to reflect value of the specified property mutator.
protected  void setPropertyValue(java.lang.Object value)
          Called to set the current property value.
protected  boolean setupToolTipText(PropertyMutator mutator, boolean apply)
          Called to setup the tooltip text when the mutator is set.
protected  void terminateView()
          Called by the release method to remove any listeners that may have been registered with the view context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractPropertyUI

public AbstractPropertyUI()
Method Detail

initializeView

public void initializeView(MetaPropertyContext viewContext)
Initializes this MetaPropertyUI as a participant in the specified MetaPropertyContext's hierarchy. The default implementation just sets the internal MetaPropertyContext reference. Subclasses should rememeber to call the super.initializeView() method.

Specified by:
initializeView in interface MetaPropertyUI

terminateView

protected void terminateView()
Called by the release method to remove any listeners that may have been registered with the view context. Default implementation does nothing.


getViewContext

public MetaPropertyContext getViewContext()
Returns the MetaPropertyContext for which this MetaPropertyUI is a participant.

Specified by:
getViewContext in interface MetaPropertyUI

setPropertyMutator

public void setPropertyMutator(PropertyMutator mutator)
Sets this MetaPropertyUI instance to reflect value of the specified property mutator. If any previously associated property mutator exists, it will be replaced and any internal renderer data structures will be reset accordingly. Any component that was returned from a getUIComponent() call will be reused.

Specified by:
setPropertyMutator in interface MetaPropertyUI

getPropertyMutator

protected PropertyMutator getPropertyMutator()
Provides subclasses access to the PropertyMutator.


setupToolTipText

protected boolean setupToolTipText(PropertyMutator mutator,
                                   boolean apply)
Called to setup the tooltip text when the mutator is set. If apply is true then the text should be applied if it is false then the text should be cleared. Returns true if the tooltip text was applicable, whether cleared or not. ie: in the default case, that the component is a JComponent and that the property description is different than it's name. Default implementation uses the property description if it is different than getName().


setPropertyValue

protected void setPropertyValue(java.lang.Object value)
Called to set the current property value. The default implementation will not set the property value if it is the same as the current property value either by reference or .equals().


setComponentValue

protected abstract void setComponentValue(java.lang.Object value)
Called to set the current value displayed in the component.


resetComponentValue

protected void resetComponentValue()
Called to set the component value to a default state. The default implementation calls setComponentValue(null).


isSingleColumn

public boolean isSingleColumn()
Returns true if the UI component fits the standard Label:Component display method. Otherwise, the container will use a different layout strategy for this control. Default implementation returns true.

Specified by:
isSingleColumn in interface MetaPropertyUI

isLabeled

public boolean isLabeled()
Returns true if the UI component provides its own label. Default implementation returns false.

Specified by:
isLabeled in interface MetaPropertyUI

getUIComponent

public abstract java.awt.Component getUIComponent()
Returns the component that renders the associated property mutator's value.

Specified by:
getUIComponent in interface MetaPropertyUI

propertyChanged

protected void propertyChanged(java.beans.PropertyChangeEvent event)
Called when the value contained in the mutator changes. The default implementation ignores property changes if the value is the same as the current cached value either by reference or by .equals().


releaseComponent

protected void releaseComponent()
Implemented by subclasses to release any component-related resources. Default implementation does nothing.


release

public void release()
Releases any listeners or resources associated with this MetaPropertyUI.

Specified by:
release in interface MetaPropertyUI


Copyright © 2002-2003 Paul Speed. All Rights Reserved.