net.sf.jzeno.echo
Class DefaultConstructionHintsInterpreter

java.lang.Object
  extended by net.sf.jzeno.echo.DefaultConstructionHintsInterpreter
All Implemented Interfaces:
ConstructionHintsInterpreter

public class DefaultConstructionHintsInterpreter
extends java.lang.Object
implements ConstructionHintsInterpreter


Constructor Summary
DefaultConstructionHintsInterpreter()
           
 
Method Summary
 void executeHints(java.lang.Object target, java.lang.String constructionHints)
           A string of hints that consists of a list of comma separated property assignments.
 java.util.Map extractKeyValuePairs(java.lang.String hints)
           Chops up a list of construction hints, and returns a map that associates the property name, with it's value (or a List of values if an object notation is used eg. font={Arial,8,1}).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultConstructionHintsInterpreter

public DefaultConstructionHintsInterpreter()
Method Detail

executeHints

public void executeHints(java.lang.Object target,
                         java.lang.String constructionHints)

A string of hints that consists of a list of comma separated property assignments. This method applies such a list of construction hints, in order, on the specified target java bean. If a property requires an object instantiation, this can be achieved by using object notation like such :

  •  font={Arial,BOLD,8}
     

Constants that appear on the target type are also supported. For example a DynaTable supports a widthUnits property that should be set with a constant that appears on the DynaTable class itself (DynaTable.PIXEL_UNITS). Setting this property can be done as such :

 width=100,widthUnits=PIXEL_UNITS
 

If a property uses object notation constants within the object notation should occur on the type of the property.

Special characters such as ' { and = can be escaped by enclosing them in quotes. Examples:

  •  toolTipText=a text',' that will be shown as tool tip.
     
  •  text='{'a text with accolades'}'
     
  •  text=equals can be escaped too. '='
     
  •  text='''quoted text'''
     

The reason for having construction hints are : the ability to specify components without actually instantiating them (as in the case of a ConstructionList of a DynaTable, allowing the details of construction/reuse/etc.. to be left to a component's inner working), and to allow short-hand notation, to make construction code more readable, more compact.

Specified by:
executeHints in interface ConstructionHintsInterpreter

extractKeyValuePairs

public java.util.Map extractKeyValuePairs(java.lang.String hints)

Chops up a list of construction hints, and returns a map that associates the property name, with it's value (or a List of values if an object notation is used eg. font={Arial,8,1}).

Specified by:
extractKeyValuePairs in interface ConstructionHintsInterpreter