Class InputControl

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

public abstract class InputControl extends Object
  • Field Details

  • Constructor Details

    • InputControl

      protected InputControl(String name)
  • Method Details

    • getName

      public final String getName()
    • getCssStyleClass

      public final String getCssStyleClass()
    • getLabelForId

      public String getLabelForId(InputControl.InputInfo ii)
    • isCreatingComponents

      public boolean isCreatingComponents()
    • getInputCount

      protected int getInputCount(InputControl.InputInfo ii)
    • createInput

      public void createInput(javax.faces.component.UIComponent comp, InputControl.InputInfo ii, javax.faces.context.FacesContext context)
    • formatValue

      public String formatValue(Object value, InputControl.ValueInfo vi, boolean escapeHtml)
      Returns the formatted value Do not override this function, but override formatValue(Object, ValueInfo) instead.
      Parameters:
      value - the value to format
      vi - the valueInfo
      escapeHtml - when true the value will be escaped for Html
      Returns:
      the formatted value
    • renderValue

      public void renderValue(javax.faces.component.UIComponent comp, String tagName, StyleClass styleClass, String tooltip, InputControl.ValueInfo vi, javax.faces.context.FacesContext context) throws IOException
      Renders the control value with a surrounding HTML tag, if a tagName is supplied
      Parameters:
      comp - the JSF component
      tagName - the tag name of the HTML wrapper tag (optional)
      styleClass - the style class of the HTML wrapper tag (optional)
      tooltip - the title of the HTML wrapper tag (optional)
      vi - the value info
      context - the FacesContext
      Throws:
      IOException - from ResponseWriter
    • renderValue

      public void renderValue(Object value, InputControl.ValueInfo vi, javax.faces.context.ResponseWriter writer) throws IOException
      Renders the control value without a surrounding tag (Text only)
      Parameters:
      value - the value to render
      vi - the value info
      writer - the output writer
      Throws:
      IOException - from ResponseWriter
    • renderInput

      public void renderInput(javax.faces.component.UIComponent comp, InputControl.InputInfo ii, javax.faces.context.FacesContext context) throws IOException
      Renders the input element(s) for editing the underlying record value
      Parameters:
      comp - the JSF component
      ii - the input info
      context - the FacesContext
      Throws:
      IOException - from ResponseWriter
    • updateInputState

      public void updateInputState(javax.faces.component.UIComponent parent, InputControl.InputInfo ii, javax.faces.context.FacesContext context, javax.faces.event.PhaseId phaseId)
    • 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, javax.faces.component.UIInput input, boolean submitted)
    • getInputValue

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

      public Object getConvertedValue(javax.faces.component.UIComponent comp, InputControl.InputInfo ii, Object submittedValue)
    • initCssStyleClass

      protected String initCssStyleClass()
    • addDataValueStyle

      protected void addDataValueStyle(StyleClass styleClass, InputControl.ValueInfo vi, Object value)
      adds style attributes related to the current value
      Parameters:
      styleClass - the style class
      vi - the value info
      value - the current value
    • addAttachedObjects

      protected void addAttachedObjects(javax.faces.component.UIComponent parent, javax.faces.context.FacesContext context, InputControl.InputInfo ii, javax.faces.component.UIComponentBase inputComponent)
    • updateAttachedObjects

      protected void updateAttachedObjects(javax.faces.component.UIComponent parent, javax.faces.context.FacesContext context, InputControl.InputInfo ii, javax.faces.component.UIComponentBase inputComponent)
    • isInputValueExpressionEnabled

      protected boolean isInputValueExpressionEnabled()
    • setInputValue

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

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

      protected void setInputValueExpression(javax.faces.component.UIInput input, javax.el.ValueExpression value, InputControl.InputInfo ii)
    • restoreSubmittedValue

      protected boolean restoreSubmittedValue(javax.faces.component.UIInput input, InputControl.InputInfo ii)
    • clearSubmittedValue

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

      protected void clearLocalValues(javax.faces.context.FacesContext context, javax.faces.component.UIComponent comp)
    • formatInputValue

      protected Object formatInputValue(Object value, InputControl.InputInfo ii)
    • parseInputValue

      protected Object parseInputValue(String value, InputControl.InputInfo ii)
      Parses a value for a single input component
      Parameters:
      value - the value to parse
      ii - the input info
      Returns:
      the parsed and converted value
    • parseInputValue

      protected Object parseInputValue(Object[] values, InputControl.InputInfo ii)
      Parses a value for multiple input components All individual values must be combined to a single output value
      Parameters:
      values - the input values
      ii - the input info
      Returns:
      the combined value
    • createInputComponents

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

      protected abstract void updateInputState(List<javax.faces.component.UIComponent> compList, InputControl.InputInfo ii, javax.faces.context.FacesContext context, javax.faces.event.PhaseId phaseId)
    • getFirstInput

      protected javax.faces.component.UIInput getFirstInput(List<javax.faces.component.UIComponent> compList)
    • getInputComponents

      protected javax.faces.component.UIInput[] getInputComponents(javax.faces.component.UIComponent parent, InputControl.InputInfo ii)
    • setInputStyleClass

      protected void setInputStyleClass(javax.faces.component.UIInput input, StyleClass styleClass)
    • setInputStyleClass

      protected void setInputStyleClass(javax.faces.component.UIInput input, InputControl.InputInfo ii, StyleClass styleClass)
    • setInputStyleClass

      protected void setInputStyleClass(javax.faces.component.UIInput input, InputControl.InputInfo ii)
    • copyAttributes

      protected void copyAttributes(javax.faces.component.UIComponent parent, InputControl.InputInfo ii, javax.faces.component.UIInput input, String inputId)
    • copyAttributes

      protected void copyAttributes(javax.faces.component.UIComponent parent, InputControl.InputInfo ii, javax.faces.component.UIInput input)
    • copyAttribute

      protected void copyAttribute(InputControl.InputInfo ii, javax.faces.component.UIInput input, String name)
    • addRemoveValueNullStyle

      protected void addRemoveValueNullStyle(javax.faces.component.UIInput input, boolean nullValue)
    • addRemoveStyle

      protected 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
    • getOptionText

      protected String getOptionText(Options options, Object value, InputControl.ValueInfo vi)
      Returns the display text for an option
      Parameters:
      options - the options
      value - the value
      vi - the value info
      Returns:
      the display text or null if the option value could not be resolved
    • 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
    • hasFormatOption

      protected boolean hasFormatOption(InputControl.ValueInfo vi, String option, String columnAttributeName)
    • getFormatOption

      protected String getFormatOption(InputControl.ValueInfo vi, String option)
    • 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)