org.apache.myfaces.orchestra.dynaForm.jsf.guiBuilder.impl.jsf
Class JsfGuiBuilder

java.lang.Object
  extended by org.apache.myfaces.orchestra.dynaForm.jsf.guiBuilder.GuiBuilder
      extended by org.apache.myfaces.orchestra.dynaForm.jsf.guiBuilder.impl.jsf.JsfGuiBuilder
Direct Known Subclasses:
JsfGuiBuilderDecorator, MyFacesGuiBuilder

public class JsfGuiBuilder
extends GuiBuilder

A concrete subclass of GuiBuilder which knows how to build JSF components and add them to the current component tree.


Constructor Summary
protected JsfGuiBuilder()
           
 
Method Summary
static void addElementBuilder(Class<?> elementType, JsfGuiElementBuilder builder)
          Add a specialized builder.
protected  void attachLengthValidator(javax.faces.component.html.HtmlInputText cmp, int minSize, int maxSize)
           
protected  void attachRangeValidator(javax.faces.component.html.HtmlInputText cmp, Double minValue, Double maxValue)
           
protected  boolean buildField(MetaField field)
          actuallly build the fields gui component
static javax.faces.component.UIComponent cloneComponent(javax.faces.component.UIComponent uicomponent)
           
 void createInputBoolean(MetaField field)
          select a boolean
 void createInputDate(MetaField field)
          input date
 void createInputNumber(MetaField field)
          enter a number
 void createInputText(MetaField field)
          input field
 javax.faces.component.UIOutput createLabelFor(String labelKey, javax.faces.component.UIComponent cmp)
          Create a label for the specified component using the specified text.
 void createNative(MetaField field)
          this is when the user passed in a component to use for the this field
 void createOutputText(MetaField field)
          Output text using the field as value provider.
 javax.faces.component.UIParameter createParameter(String name, String value)
           
 void createSearchFor(MetaField field)
          search for component
 void createSearchForSelectMenu(MetaField field)
          search for component
 void createSelectOneMenu(MetaField field)
          select one menu
protected  String createValueBindingString(MetaField field)
           
 javax.faces.convert.Converter doCreateConverter(MetaField field)
           
 javax.faces.convert.DateTimeConverter doCreateDateConverter(MetaField field)
           
 javax.faces.component.UISelectBoolean doCreateInputBoolean(MetaField field)
           
 javax.faces.component.html.HtmlSelectBooleanCheckbox doCreateInputBooleanComponent()
           
 javax.faces.component.html.HtmlInputText doCreateInputDate(MetaField field)
           
 javax.faces.component.html.HtmlInputText doCreateInputDateComponent(MetaField field)
           
 javax.faces.component.html.HtmlInputText doCreateInputNumber(MetaField field)
           
 javax.faces.component.html.HtmlInputText doCreateInputText(MetaField field)
           
 javax.faces.component.html.HtmlInputText doCreateInputTextComponent()
           
 void doCreateNative(MetaField field, javax.faces.component.UIComponent uicomponent)
           
 javax.faces.component.html.HtmlOutputLabel doCreateOutputLabel(String labelKey)
          Create an HtmlOutputLabel component, ie some text that specifically describes another input component.
 javax.faces.component.html.HtmlOutputLabel doCreateOutputLabelComponent()
           
 javax.faces.component.html.HtmlOutputText doCreateOutputText(MetaField field)
           
 javax.faces.component.html.HtmlOutputText doCreateOutputText(String text)
          Create an HtmlOutputText component, ie a component that displays a string.
 javax.faces.component.html.HtmlOutputText doCreateOutputTextComponent()
           
 javax.faces.component.html.HtmlPanelGroup doCreatePanelGroupComponent()
           
 javax.faces.component.UIComponent doCreateSearchFor(MetaField field)
           
 javax.faces.component.UIInput doCreateSearchForSelectMenu(MetaField field)
           
 javax.faces.component.html.HtmlSelectManyListbox doCreateSelectManyListbox(MetaField field)
           
 javax.faces.component.html.HtmlSelectManyListbox doCreateSelectManyListboxComponent()
           
 javax.faces.component.html.HtmlSelectOneMenu doCreateSelectOneMenu(MetaField field)
           
 javax.faces.component.html.HtmlSelectOneMenu doCreateSelectOneMenuComponent()
           
 javax.faces.component.UIInput findInputComponent(javax.faces.component.UIComponent cmp)
          Return the first UIInput component in the tree of components starting at the specified node (including the node itself).
 void fireNewComponent(MetaField field, javax.faces.component.UIComponent cmp)
          jo, we made a component, create a possible label and fire its creation.
 String getBackingEntityPrefix()
           
protected  String getCleanedNameForId(String name)
          remove all not allowed characters for an jsf ID from the name
 javax.faces.context.FacesContext getContext()
           
 javax.el.ELContext getELContext()
           
protected  String getFieldId(MetaField field)
           
 NewComponentListener getNewComponentListener()
           
 void initConverter(javax.faces.component.UIOutput cmp, MetaField field)
          setup a converter if required
 void initDefaults(javax.faces.component.UIComponent cmp, MetaField field)
          init global defaults like id
 void initInputDefaults(javax.faces.component.html.HtmlInputText cmp, MetaField field)
          setup all the validators, maxlength, size, ...
 void initInputDefaults(javax.faces.component.UIInput cmp, MetaField field)
          setup defaults for input fields like required
 void initOutputDefaults(javax.faces.component.UIOutput cmp, MetaField field)
          init global defaults for output fields
 void initSelections(MetaField field, javax.faces.component.UIComponent cmp)
          insert possible selection items
 void initValueBinding(javax.faces.component.UIComponent cmp, MetaField field)
          init the default value binding
 void setBackingEntityPrefix(String backingEntityPrefix)
           
 void setContext(javax.faces.context.FacesContext context)
           
 void setELContext(javax.el.ELContext elcontext)
           
 void setNewComponentListener(NewComponentListener newComponentListener)
           
 
Methods inherited from class org.apache.myfaces.orchestra.dynaForm.jsf.guiBuilder.GuiBuilder
getDestCmp, getLabelBundle, isFieldDisplayOnly, isIdAsDisplayOnly, setDestCmp, setFormDisplayOnly, setIdAsDisplayOnly, setLabelBundle, translateText
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JsfGuiBuilder

protected JsfGuiBuilder()
Method Detail

addElementBuilder

public static void addElementBuilder(Class<?> elementType,
                                     JsfGuiElementBuilder builder)
Add a specialized builder. This builder will be used instead of any default.


getBackingEntityPrefix

public String getBackingEntityPrefix()

setBackingEntityPrefix

public void setBackingEntityPrefix(String backingEntityPrefix)

getNewComponentListener

public NewComponentListener getNewComponentListener()

setNewComponentListener

public void setNewComponentListener(NewComponentListener newComponentListener)

setContext

public void setContext(javax.faces.context.FacesContext context)

getContext

public javax.faces.context.FacesContext getContext()

setELContext

public void setELContext(javax.el.ELContext elcontext)

getELContext

public javax.el.ELContext getELContext()

createOutputText

public void createOutputText(MetaField field)
Description copied from class: GuiBuilder
Output text using the field as value provider.

Specified by:
createOutputText in class GuiBuilder

createInputDate

public void createInputDate(MetaField field)
Description copied from class: GuiBuilder
input date

Specified by:
createInputDate in class GuiBuilder

createInputText

public void createInputText(MetaField field)
Description copied from class: GuiBuilder
input field

Specified by:
createInputText in class GuiBuilder

createInputNumber

public void createInputNumber(MetaField field)
Description copied from class: GuiBuilder
enter a number

Specified by:
createInputNumber in class GuiBuilder

createInputBoolean

public void createInputBoolean(MetaField field)
Description copied from class: GuiBuilder
select a boolean

Specified by:
createInputBoolean in class GuiBuilder

createSelectOneMenu

public void createSelectOneMenu(MetaField field)
Description copied from class: GuiBuilder
select one menu

Specified by:
createSelectOneMenu in class GuiBuilder

createSearchFor

public void createSearchFor(MetaField field)
Description copied from class: GuiBuilder
search for component

Specified by:
createSearchFor in class GuiBuilder

createSearchForSelectMenu

public void createSearchForSelectMenu(MetaField field)
Description copied from class: GuiBuilder
search for component

Specified by:
createSearchForSelectMenu in class GuiBuilder

createNative

public void createNative(MetaField field)
Description copied from class: GuiBuilder
this is when the user passed in a component to use for the this field

Specified by:
createNative in class GuiBuilder

cloneComponent

public static javax.faces.component.UIComponent cloneComponent(javax.faces.component.UIComponent uicomponent)

doCreateOutputText

public javax.faces.component.html.HtmlOutputText doCreateOutputText(MetaField field)

doCreateOutputTextComponent

public javax.faces.component.html.HtmlOutputText doCreateOutputTextComponent()

doCreateOutputLabel

public javax.faces.component.html.HtmlOutputLabel doCreateOutputLabel(String labelKey)
Create an HtmlOutputLabel component, ie some text that specifically describes another input component.

The labelKey parameter is translated using a resource-bundle if possible. If no translation is available then the labelKey text is used directly.


doCreateOutputText

public javax.faces.component.html.HtmlOutputText doCreateOutputText(String text)
Create an HtmlOutputText component, ie a component that displays a string.

Unlike doCreateOutputLabel, the parameter is the exact string to be displayed, not a key into a resource-bundle. This method is used to create components wrapping all sorts of strings, only some of which may be "translatable" via a resource bundle. If an output text component needs to contain translated text, then pass the translated value in as the parameter.


doCreateOutputLabelComponent

public javax.faces.component.html.HtmlOutputLabel doCreateOutputLabelComponent()

doCreateInputDate

public javax.faces.component.html.HtmlInputText doCreateInputDate(MetaField field)

doCreateInputDateComponent

public javax.faces.component.html.HtmlInputText doCreateInputDateComponent(MetaField field)

doCreateConverter

public javax.faces.convert.Converter doCreateConverter(MetaField field)

doCreateDateConverter

public javax.faces.convert.DateTimeConverter doCreateDateConverter(MetaField field)

doCreateInputText

public javax.faces.component.html.HtmlInputText doCreateInputText(MetaField field)

doCreateInputTextComponent

public javax.faces.component.html.HtmlInputText doCreateInputTextComponent()

doCreateInputBoolean

public javax.faces.component.UISelectBoolean doCreateInputBoolean(MetaField field)

doCreateInputBooleanComponent

public javax.faces.component.html.HtmlSelectBooleanCheckbox doCreateInputBooleanComponent()

doCreateInputNumber

public javax.faces.component.html.HtmlInputText doCreateInputNumber(MetaField field)

doCreateSelectOneMenu

public javax.faces.component.html.HtmlSelectOneMenu doCreateSelectOneMenu(MetaField field)

doCreateSelectManyListbox

public javax.faces.component.html.HtmlSelectManyListbox doCreateSelectManyListbox(MetaField field)

doCreateSelectOneMenuComponent

public javax.faces.component.html.HtmlSelectOneMenu doCreateSelectOneMenuComponent()

doCreateSelectManyListboxComponent

public javax.faces.component.html.HtmlSelectManyListbox doCreateSelectManyListboxComponent()

doCreateSearchFor

public javax.faces.component.UIComponent doCreateSearchFor(MetaField field)

doCreateSearchForSelectMenu

public javax.faces.component.UIInput doCreateSearchForSelectMenu(MetaField field)

doCreatePanelGroupComponent

public javax.faces.component.html.HtmlPanelGroup doCreatePanelGroupComponent()

doCreateNative

public void doCreateNative(MetaField field,
                           javax.faces.component.UIComponent uicomponent)

createParameter

public javax.faces.component.UIParameter createParameter(String name,
                                                         String value)

fireNewComponent

public void fireNewComponent(MetaField field,
                             javax.faces.component.UIComponent cmp)
jo, we made a component, create a possible label and fire its creation.


createLabelFor

public javax.faces.component.UIOutput createLabelFor(String labelKey,
                                                     javax.faces.component.UIComponent cmp)
Create a label for the specified component using the specified text.

If the component (or one of its children) is an input component, then an HtmlOutputLabel component is created, with the "for" attribute referencing the id of the input component. Otherwise a plain HtmlOutputText component is created.


findInputComponent

public javax.faces.component.UIInput findInputComponent(javax.faces.component.UIComponent cmp)
Return the first UIInput component in the tree of components starting at the specified node (including the node itself).


initDefaults

public void initDefaults(javax.faces.component.UIComponent cmp,
                         MetaField field)
init global defaults like id


getFieldId

protected String getFieldId(MetaField field)

getCleanedNameForId

protected String getCleanedNameForId(String name)
remove all not allowed characters for an jsf ID from the name


initOutputDefaults

public void initOutputDefaults(javax.faces.component.UIOutput cmp,
                               MetaField field)
init global defaults for output fields


initValueBinding

public void initValueBinding(javax.faces.component.UIComponent cmp,
                             MetaField field)
init the default value binding


createValueBindingString

protected String createValueBindingString(MetaField field)

initInputDefaults

public void initInputDefaults(javax.faces.component.html.HtmlInputText cmp,
                              MetaField field)
setup all the validators, maxlength, size, ... for HtmlInputText fields


attachRangeValidator

protected void attachRangeValidator(javax.faces.component.html.HtmlInputText cmp,
                                    Double minValue,
                                    Double maxValue)

attachLengthValidator

protected void attachLengthValidator(javax.faces.component.html.HtmlInputText cmp,
                                     int minSize,
                                     int maxSize)

initInputDefaults

public void initInputDefaults(javax.faces.component.UIInput cmp,
                              MetaField field)
setup defaults for input fields like required


initConverter

public void initConverter(javax.faces.component.UIOutput cmp,
                          MetaField field)
setup a converter if required


initSelections

public void initSelections(MetaField field,
                           javax.faces.component.UIComponent cmp)
insert possible selection items


buildField

protected boolean buildField(MetaField field)
Description copied from class: GuiBuilder
actuallly build the fields gui component

Overrides:
buildField in class GuiBuilder


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.