org.apache.empire.jsf2.controls
Class InputControl

java.lang.Object
  extended by org.apache.empire.jsf2.controls.InputControl
Direct Known Subclasses:
CheckboxInputControl, SelectInputControl, TextAreaInputControl, TextInputControl

public abstract class InputControl
extends Object


Nested Class Summary
static interface InputControl.InputInfo
          This interface extends the value information by information about the input control used with the renderInput function
static interface InputControl.ValueInfo
          This interface allows access to a value and its metainformation used with the renderData function
 
Field Summary
static String CURRENCY_CODE_ATTRIBUTE
           
static String FORMAT_NULL
           
static String FORMAT_NULL_ATTRIBUTE
           
static String MAXVALUE_ATTRIBUTE
           
static String MINVALUE_ATTRIBUTE
           
static String NUMBER_FRACTION_DIGITS
           
static String NUMBER_GROUPSEP_ATTRIBUTE
           
static String NUMBER_TYPE_ATTRIBUTE
           
 
Constructor Summary
  InputControl()
           
protected InputControl(String name)
           
 
Method Summary
 void addRemoveDisabledStyle(javax.faces.component.UIInput input, boolean disabled)
           
 void addRemoveInvalidStyle(javax.faces.component.UIInput input, boolean invalid)
           
 void addRemoveStyle(javax.faces.component.UIInput input, String styleName, boolean setStyle)
           
protected  void clearSubmittedValue(javax.faces.component.UIInput input)
           
protected  void copyAttribute(InputControl.InputInfo ii, javax.faces.component.UIInput input, String name)
          copies a single attribute
protected  void copyAttributes(javax.faces.component.UIComponent parent, InputControl.InputInfo ii, javax.faces.component.UIInput input)
          copies standard input attributes such as styleClass, style, tabindex and event handlers (onclick, onblur, etc.) from the parent component to the input
protected  void copyAttributes(javax.faces.component.UIComponent parent, InputControl.InputInfo ii, javax.faces.component.UIInput input, String additonalStyle)
          copies standard input attributes such as styleClass, style, tabindex and event handlers (onclick, onblur, etc.) from the parent component to the input
protected abstract  void createInputComponents(javax.faces.component.UIComponent parent, InputControl.InputInfo ii, javax.faces.context.FacesContext context, List<javax.faces.component.UIComponent> compList)
           
protected  String escapeHTML(String text)
          escapes a String for html
protected  Object formatInputValue(Object value, InputControl.InputInfo ii)
          Override this to format a value for output
protected  String formatValue(InputControl.ValueInfo vi)
          Returns the value formated as a string This is a shortcut for formatString(vi.getValue(), vi) Derived classes may override formatString
protected  String formatValue(Object value, InputControl.ValueInfo vi)
          Returns the value formated as a string this is a simple default implementation that does no type-secific formatting Derived classes may override formatString an provide further formmatting see TextInputControl for details
protected  int getFormatInteger(InputControl.ValueInfo vi, String option, String columnAttributeName)
           
protected  Object getFormatOption(InputControl.ValueInfo vi, String option, String columnAttributeName)
           
protected  String getFormatString(InputControl.ValueInfo vi, String option, String columnAttributeName)
           
protected  javax.faces.component.UIInput getInputComponent(javax.faces.component.UIComponent parent)
          returns the first UIInput component that is a direct child of the parent component
 Object getInputValue(javax.faces.component.UIComponent comp, InputControl.InputInfo ii, boolean submitted)
           
 String getLabelForId(InputControl.InputInfo ii)
           
 String getName()
           
protected  boolean hasFormatOption(InputControl.ValueInfo vi, String option)
          checks if a particular formating option has been specified.
protected  Object parseInputValue(String value, InputControl.InputInfo ii)
           
 void postUpdateModel(javax.faces.component.UIComponent comp, InputControl.InputInfo ii, javax.faces.context.FacesContext fc)
           
 void renderInput(javax.faces.component.UIComponent comp, InputControl.InputInfo ii, javax.faces.context.FacesContext context, boolean encode)
           
 void renderValue(InputControl.ValueInfo vi, javax.faces.context.ResponseWriter writer)
           
protected  void setInputValue(javax.faces.component.UIInput input, InputControl.InputInfo ii)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NUMBER_TYPE_ATTRIBUTE

public static final String NUMBER_TYPE_ATTRIBUTE
See Also:
Constant Field Values

NUMBER_GROUPSEP_ATTRIBUTE

public static final String NUMBER_GROUPSEP_ATTRIBUTE
See Also:
Constant Field Values

NUMBER_FRACTION_DIGITS

public static final String NUMBER_FRACTION_DIGITS
See Also:
Constant Field Values

MINVALUE_ATTRIBUTE

public static final String MINVALUE_ATTRIBUTE
See Also:
Constant Field Values

MAXVALUE_ATTRIBUTE

public static final String MAXVALUE_ATTRIBUTE
See Also:
Constant Field Values

CURRENCY_CODE_ATTRIBUTE

public static final String CURRENCY_CODE_ATTRIBUTE
See Also:
Constant Field Values

FORMAT_NULL

public static final String FORMAT_NULL
See Also:
Constant Field Values

FORMAT_NULL_ATTRIBUTE

public static final String FORMAT_NULL_ATTRIBUTE
See Also:
Constant Field Values
Constructor Detail

InputControl

public InputControl()

InputControl

protected InputControl(String name)
Method Detail

getName

public final String getName()

getLabelForId

public String getLabelForId(InputControl.InputInfo ii)

renderValue

public void renderValue(InputControl.ValueInfo vi,
                        javax.faces.context.ResponseWriter writer)
                 throws IOException
Throws:
IOException

renderInput

public void renderInput(javax.faces.component.UIComponent comp,
                        InputControl.InputInfo ii,
                        javax.faces.context.FacesContext context,
                        boolean encode)
                 throws IOException
Throws:
IOException

postUpdateModel

public void postUpdateModel(javax.faces.component.UIComponent comp,
                            InputControl.InputInfo ii,
                            javax.faces.context.FacesContext fc)

getInputValue

public Object getInputValue(javax.faces.component.UIComponent comp,
                            InputControl.InputInfo ii,
                            boolean submitted)

setInputValue

protected void setInputValue(javax.faces.component.UIInput input,
                             InputControl.InputInfo ii)

clearSubmittedValue

protected void clearSubmittedValue(javax.faces.component.UIInput input)

formatInputValue

protected Object formatInputValue(Object value,
                                  InputControl.InputInfo ii)
Override this to format a value for output

Parameters:
value -
ii -
Returns:

parseInputValue

protected Object parseInputValue(String value,
                                 InputControl.InputInfo ii)

createInputComponents

protected abstract void createInputComponents(javax.faces.component.UIComponent parent,
                                              InputControl.InputInfo ii,
                                              javax.faces.context.FacesContext context,
                                              List<javax.faces.component.UIComponent> compList)

getInputComponent

protected javax.faces.component.UIInput getInputComponent(javax.faces.component.UIComponent parent)
returns the first UIInput component that is a direct child of the parent component

Parameters:
parent - the parent component which node to search for
Returns:
the first child that is a UIInput

copyAttributes

protected void copyAttributes(javax.faces.component.UIComponent parent,
                              InputControl.InputInfo ii,
                              javax.faces.component.UIInput input,
                              String additonalStyle)
copies standard input attributes such as styleClass, style, tabindex and event handlers (onclick, onblur, etc.) from the parent component to the input

Parameters:
parent - (not used)
ii - the input info from which to obtain the attribute values
input - the input component on which to set the attributes
additonalStyle - additional style classes

copyAttributes

protected final void copyAttributes(javax.faces.component.UIComponent parent,
                                    InputControl.InputInfo ii,
                                    javax.faces.component.UIInput input)
copies standard input attributes such as styleClass, style, tabindex and event handlers (onclick, onblur, etc.) from the parent component to the input

Parameters:
parent - (not used)
ii - the input info
input - the input component on which to set the attributes

copyAttribute

protected void copyAttribute(InputControl.InputInfo ii,
                             javax.faces.component.UIInput input,
                             String name)
copies a single attribute

Parameters:
ii -
input -
name -

addRemoveDisabledStyle

public void addRemoveDisabledStyle(javax.faces.component.UIInput input,
                                   boolean disabled)

addRemoveInvalidStyle

public void addRemoveInvalidStyle(javax.faces.component.UIInput input,
                                  boolean invalid)

addRemoveStyle

public void addRemoveStyle(javax.faces.component.UIInput input,
                           String styleName,
                           boolean setStyle)

formatValue

protected String formatValue(Object value,
                             InputControl.ValueInfo vi)
Returns the value formated as a string this is a simple default implementation that does no type-secific formatting Derived classes may override formatString an provide further formmatting see TextInputControl for details

Parameters:
value - the value to be formatted
vi - Meta-information about the value
Returns:
the formatted value

formatValue

protected final String formatValue(InputControl.ValueInfo vi)
Returns the value formated as a string This is a shortcut for formatString(vi.getValue(), vi) Derived classes may override formatString


escapeHTML

protected String escapeHTML(String text)
escapes a String for html

Parameters:
text -
Returns:
the escaped html String

hasFormatOption

protected boolean hasFormatOption(InputControl.ValueInfo vi,
                                  String option)
checks if a particular formating option has been specified.

Parameters:
vi - the value info
option - the formating option to check
Returns:
true if the requested formating option has been specified or false otherwise

getFormatOption

protected Object getFormatOption(InputControl.ValueInfo vi,
                                 String option,
                                 String columnAttributeName)

getFormatString

protected String getFormatString(InputControl.ValueInfo vi,
                                 String option,
                                 String columnAttributeName)

getFormatInteger

protected int getFormatInteger(InputControl.ValueInfo vi,
                               String option,
                               String columnAttributeName)


Copyright © 2008–2014 Apache Software Foundation. All rights reserved.