net.sf.tacos.formatter
Class NumberJsFormatter

java.lang.Object
  extended by net.sf.tacos.formatter.NumberJsFormatter
All Implemented Interfaces:
JsFormatter

public class NumberJsFormatter
extends Object
implements JsFormatter

Javascript formatting renderer for numbers. The following parameters are allowed in the initializer:

Parameter Name Description Default
signed "true" if the sign must be specified. "false" if it can't, and "[true,false]" if either way is possible. [true,false]
separator Thousands separator. component's locale grouping separator.
places Mandatory decimal places. Null if decimals are optional. null
decimal Decimal separator. Component's locale decimal separator.
forceSeparator "true" if the separator must be specified when editing the number. false
roundedPlaces Number of decimal places to round to. Null if no rounding is required. null

Author:
lquijano

Field Summary
static String FORMATTER_SCRIPT_RESOURCE
          Classpath for formatter script.
 
Constructor Summary
NumberJsFormatter()
          Default constructor, required by BeanFactory.
NumberJsFormatter(String initializer)
          Constructor with initializer, required by BeanFactory.
 
Method Summary
 String getDecimal()
           
 String getForceSeparator()
           
 String getPlaces()
           
 String getRoundedPlaces()
           
 String getSeparator()
           
 String getSigned()
           
 void renderContributions(org.apache.tapestry.IRequestCycle cycle, org.apache.tapestry.engine.IScriptSource scriptSource, org.apache.tapestry.IComponent comp, String uniqueId)
          Renders the formatter contributions (usually JavaScript functions).
 void setDecimal(String decimal)
           
 void setForceSeparator(String forceSeparator)
           
 void setPlaces(String places)
           
 void setRoundedPlaces(String roundedPlaces)
           
 void setSeparator(String separator)
           
 void setSigned(String signed)
           
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FORMATTER_SCRIPT_RESOURCE

public static final String FORMATTER_SCRIPT_RESOURCE
Classpath for formatter script.

See Also:
Constant Field Values
Constructor Detail

NumberJsFormatter

public NumberJsFormatter()
Default constructor, required by BeanFactory.


NumberJsFormatter

public NumberJsFormatter(String initializer)
Constructor with initializer, required by BeanFactory.

Method Detail

renderContributions

public void renderContributions(org.apache.tapestry.IRequestCycle cycle,
                                org.apache.tapestry.engine.IScriptSource scriptSource,
                                org.apache.tapestry.IComponent comp,
                                String uniqueId)
Renders the formatter contributions (usually JavaScript functions).

Specified by:
renderContributions in interface JsFormatter
Parameters:
cycle - Tapestry request cycle.
scriptSource - Tapestry script source.
comp - the component.
uniqueId - optional unique Id to override the component's id.

getDecimal

public String getDecimal()
Returns:
Returns the decimal.

setDecimal

public void setDecimal(String decimal)
Parameters:
decimal - The decimal to set.

getForceSeparator

public String getForceSeparator()
Returns:
Returns the forceSeparator.

setForceSeparator

public void setForceSeparator(String forceSeparator)
Parameters:
forceSeparator - The forceSeparator to set.

getPlaces

public String getPlaces()
Returns:
Returns the places.

setPlaces

public void setPlaces(String places)
Parameters:
places - The places to set.

getRoundedPlaces

public String getRoundedPlaces()
Returns:
Returns the roundedPlaces.

setRoundedPlaces

public void setRoundedPlaces(String roundedPlaces)
Parameters:
roundedPlaces - The roundedPlaces to set.

getSeparator

public String getSeparator()
Returns:
Returns the separator.

setSeparator

public void setSeparator(String separator)
Parameters:
separator - The separator to set.

getSigned

public String getSigned()
Returns:
Returns the signed.

setSigned

public void setSigned(String signed)
Parameters:
signed - The signed to set.

toString

public String toString()

Overrides:
toString in class Object