intarsys runtime library

de.intarsys.tools.presentation
Class PropertyRenderer

java.lang.Object
  extended by de.intarsys.tools.presentation.PropertyRenderer
All Implemented Interfaces:
IPresentationHandler, IPresentationSupport, IPresentationSupportFactory, IFieldHandler

public class PropertyRenderer
extends Object
implements IPresentationSupport, IPresentationHandler, IFieldHandler, IPresentationSupportFactory

This is a *very* generic tool for displaying object state.

The PropertyRenderer represents the first class "field" (property) object, such as "age" of a person. In this role IPresentationSupport is implemented, so that you can ask for a label for this field, for example for display in a table.

In the role IPresentationHandler, the real value of the field within an object can be queried.


Field Summary
 
Fields inherited from interface de.intarsys.tools.presentation.IPresentationSupport
ATTR_DESCRIPTION, ATTR_ICON, ATTR_LABEL, ATTR_TIP
 
Constructor Summary
PropertyRenderer(String name, String label)
           
PropertyRenderer(String name, String label, Format format)
           
 
Method Summary
 IPresentationSupport createPresentationSupport(Object object)
          Create a IPresentationSupport instance that can be used to present object.
 String getDescription()
          A long, descriptive string representation.
 String getDescription(Object object)
          A long, descriptive string representation.
 IPresentationSupport getFieldPresentation()
           
 Format getFormat()
           
 String getIconName()
          A name for an icon.
 String getIconName(Object object)
          A name for an icon.
 String getLabel()
          A short string representation (suitable for example for use with an icon or menu item).
 String getLabel(Object object)
          A short string representation (suitable for example for use with an icon or menu item).
 String getName()
           
 String getTip()
          An "intermediate" length description (suitable for example with a tooltip).
 String getTip(Object object)
          An "intermediate" length description (suitable for example with a tooltip).
 Object getValue(Object object)
          Make a reflective read access to the field represented by this within the receiver.
 IPresentationSupport getValuePresentation(Object object)
           
 void setFormat(Format format)
           
 Object setValue(Object receiver, Object value)
          Make a reflective write access to the field represented by this within receiver.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyRenderer

public PropertyRenderer(String name,
                        String label)

PropertyRenderer

public PropertyRenderer(String name,
                        String label,
                        Format format)
Method Detail

createPresentationSupport

public IPresentationSupport createPresentationSupport(Object object)
Description copied from interface: IPresentationSupportFactory
Create a IPresentationSupport instance that can be used to present object.

Specified by:
createPresentationSupport in interface IPresentationSupportFactory
Parameters:
object - The object to be presented.
Returns:
Create a IPresentationSupport instance that can be used to present object.

getDescription

public String getDescription()
Description copied from interface: IPresentationSupport
A long, descriptive string representation.

Specified by:
getDescription in interface IPresentationSupport
Returns:
A long, descriptive string representation.

getDescription

public String getDescription(Object object)
Description copied from interface: IPresentationHandler
A long, descriptive string representation.

Specified by:
getDescription in interface IPresentationHandler
Returns:
A long, descriptive string representation.

getFieldPresentation

public IPresentationSupport getFieldPresentation()

getFormat

public Format getFormat()

getIconName

public String getIconName()
Description copied from interface: IPresentationSupport
A name for an icon.

Specified by:
getIconName in interface IPresentationSupport
Returns:
A name for an icon.

getIconName

public String getIconName(Object object)
Description copied from interface: IPresentationHandler
A name for an icon.

Specified by:
getIconName in interface IPresentationHandler
Returns:
A name for an icon.

getLabel

public String getLabel()
Description copied from interface: IPresentationSupport
A short string representation (suitable for example for use with an icon or menu item).

Specified by:
getLabel in interface IPresentationSupport
Returns:
A short string representation (suitable for example for use with an icon or menu item).

getLabel

public String getLabel(Object object)
Description copied from interface: IPresentationHandler
A short string representation (suitable for example for use with an icon or menu item).

Specified by:
getLabel in interface IPresentationHandler
Returns:
A short string representation (suitable for example for use with an icon or menu item).

getName

public String getName()

getTip

public String getTip()
Description copied from interface: IPresentationSupport
An "intermediate" length description (suitable for example with a tooltip).

Specified by:
getTip in interface IPresentationSupport
Returns:
An "intermediate" length description (suitable for example with a tooltip).

getTip

public String getTip(Object object)
Description copied from interface: IPresentationHandler
An "intermediate" length description (suitable for example with a tooltip).

Specified by:
getTip in interface IPresentationHandler
Returns:
An "intermediate" length description (suitable for example with a tooltip).

getValue

public Object getValue(Object object)
                throws FieldAccessException
Description copied from interface: IFieldHandler
Make a reflective read access to the field represented by this within the receiver.

Specified by:
getValue in interface IFieldHandler
Parameters:
object - The object hosting the field.
Returns:
The field value
Throws:
FieldAccessException

getValuePresentation

public IPresentationSupport getValuePresentation(Object object)

setFormat

public void setFormat(Format format)

setValue

public Object setValue(Object receiver,
                       Object value)
                throws FieldAccessException
Description copied from interface: IFieldHandler
Make a reflective write access to the field represented by this within receiver.

Specified by:
setValue in interface IFieldHandler
Parameters:
receiver - The object hosting the field.
value - The new value for the field
Returns:
The previous field value. This is an optional feature.
Throws:
FieldAccessException

intarsys runtime library

Copyright © 2012 intarsys consulting GmbH. All Rights Reserved.