public class UIInputContainer extends UIComponentBase implements NamingContainer
Composite component definition example (minus layout):
<cc:interface componentType="org.jboss.seam.faces.InputContainer"/> <cc:implementation> <h:outputLabel id="label" value="#{cc.attrs.label}:" styleClass="#{cc.attrs.invalid ? 'invalid' : ''}"> <h:ouputText styleClass="required" rendered="#{cc.attrs.required}" value="*"/> </h:outputLabel> <cc:insertChildren/> <h:message id="message" errorClass="invalid message" rendered="#{cc.attrs.invalid}"/> </cc:implementation>
Composite component usage example:
<example:inputContainer id="name"> <h:inputText id="input" value="#{person.name}"/> </example:inputContainer>
Possible enhancements:
NOTE: Firefox does not properly associate a label with the target input if the input id contains a colon (:), the default separator character in JSF. JSF 2 allows developers to set the value via an initialization parameter (context-param in web.xml) keyed to javax.faces.SEPARATOR_CHAR. We recommend that you override this setting to make the separator an underscore (_).
Modifier and Type | Class and Description |
---|---|
static class |
UIInputContainer.InputContainerElements |
Modifier and Type | Field and Description |
---|---|
static String |
COMPONENT_TYPE
The standard component type for this component.
|
protected static String |
HTML_CLASS_ATTR_NAME |
protected static String |
HTML_ID_ATTR_NAME |
protected static String |
HTML_STYLE_ATTR_NAME |
BEANINFO_KEY, bindings, COMPOSITE_COMPONENT_TYPE_KEY, COMPOSITE_FACET_NAME, CURRENT_COMPONENT, CURRENT_COMPOSITE_COMPONENT, FACETS_KEY, VIEW_LOCATION_KEY
SEPARATOR_CHAR
Constructor and Description |
---|
UIInputContainer() |
Modifier and Type | Method and Description |
---|---|
void |
assignIds(UIInputContainer.InputContainerElements elements,
FacesContext context) |
void |
encodeBegin(FacesContext context) |
void |
encodeEnd(FacesContext context) |
protected void |
endContainerElement(FacesContext context) |
protected String |
generateLabel(UIInputContainer.InputContainerElements elements,
FacesContext context) |
String |
getContainerElementName() |
String |
getDefaultInputId() |
String |
getDefaultLabelId() |
String |
getDefaultMessageId() |
String |
getElementsAttributeName()
The name of the auto-generated composite component attribute that holds the elements in this input container.
|
String |
getEncloseAttributeName()
The name of the composite component attribute that holds a boolean indicating whether the component template should be
enclosed in an HTML element, so that it be referenced from JavaScript.
|
String |
getFamily() |
String |
getInvalidAttributeName()
The name of the auto-generated composite component attribute that holds a boolean indicating whether the the template
contains an invalid input.
|
String |
getLabelAttributeName()
The name of the composite component attribute that holds the string label for this set of inputs.
|
String |
getRequiredAttributeName()
The name of the auto-generated composite component attribute that holds a boolean indicating whether the template
contains a required input.
|
protected UIInputContainer.InputContainerElements |
scan(UIComponent component,
UIInputContainer.InputContainerElements elements,
FacesContext context)
Walk the component tree branch built by the composite component and locate the input container elements.
|
protected void |
startContainerElement(FacesContext context) |
protected void |
wire(UIInputContainer.InputContainerElements elements,
FacesContext context)
Wire the label and messages to the input(s)
|
addClientBehavior, addFacesListener, broadcast, clearInitialState, decode, encodeChildren, findComponent, getAttributes, getChildCount, getChildren, getClientBehaviors, getClientId, getDefaultEventName, getEventNames, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getParent, getRenderer, getRendererType, getRendersChildren, getValueBinding, invokeOnComponent, isRendered, isTransient, markInitialState, processDecodes, processRestoreState, processSaveState, processUpdates, processValidators, queueEvent, removeFacesListener, restoreAttachedState, restoreState, saveAttachedState, saveState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding
encodeAll, getClientId, getCompositeComponentParent, getContainerClientId, getCurrentComponent, getCurrentCompositeComponent, getListenersForEventClass, getNamingContainer, getResourceBundleMap, getStateHelper, getStateHelper, getValueExpression, initialStateMarked, isCompositeComponent, isInView, isVisitable, popComponentFromEL, processEvent, pushComponentToEL, setInView, setValueExpression, subscribeToEvent, unsubscribeFromEvent, visitTree
public static final String COMPONENT_TYPE
protected static final String HTML_ID_ATTR_NAME
protected static final String HTML_CLASS_ATTR_NAME
protected static final String HTML_STYLE_ATTR_NAME
public String getFamily()
getFamily
in class UIComponent
public String getInvalidAttributeName()
public String getRequiredAttributeName()
public String getLabelAttributeName()
public String getElementsAttributeName()
public String getEncloseAttributeName()
public String getContainerElementName()
public String getDefaultLabelId()
public String getDefaultInputId()
public String getDefaultMessageId()
public void encodeBegin(FacesContext context) throws IOException
encodeBegin
in class UIComponentBase
IOException
public void encodeEnd(FacesContext context) throws IOException
encodeEnd
in class UIComponentBase
IOException
protected void startContainerElement(FacesContext context) throws IOException
IOException
protected void endContainerElement(FacesContext context) throws IOException
IOException
protected String generateLabel(UIInputContainer.InputContainerElements elements, FacesContext context)
protected UIInputContainer.InputContainerElements scan(UIComponent component, UIInputContainer.InputContainerElements elements, FacesContext context)
public void assignIds(UIInputContainer.InputContainerElements elements, FacesContext context)
protected void wire(UIInputContainer.InputContainerElements elements, FacesContext context)
Copyright © 2012 Seam Framework. All Rights Reserved.