protected String getFor(UIComponent component) { if (component instanceof HtmlOutputLabel) { return ((HtmlOutputLabel)component).getFor(); } return (String)component.getAttributes().get(JSFAttr.FOR_ATTR); }
protected String getFor(UIComponent component) { if (component instanceof HtmlOutputLabel) { return ((HtmlOutputLabel)component).getFor(); } return (String) component.getAttributes().get(JSFAttr.FOR_ATTR); }
protected String getFor(UIComponent component) { if (component instanceof HtmlOutputLabel) { return ((HtmlOutputLabel)component).getFor(); } return (String)component.getAttributes().get(JSFAttr.FOR_ATTR); }
protected String getFor(UIComponent component) { if (component instanceof HtmlOutputLabel) { return ((HtmlOutputLabel)component).getFor(); } return (String)component.getAttributes().get(JSFAttr.FOR_ATTR); }
HtmlOutputLabel htmlOutputLabel = (HtmlOutputLabel) child; if (uiComponent.getId().equals(htmlOutputLabel.getFor())) { Object labelValue = htmlOutputLabel.getValue();
HtmlOutputLabel htmlOutputLabel = (HtmlOutputLabel) child; if (uiComponent.getId().equals(htmlOutputLabel.getFor())) { Object labelValue = htmlOutputLabel.getValue();
HtmlOutputLabel htmlOutputLabel = (HtmlOutputLabel) child; if (uiComponent.getId().equals(htmlOutputLabel.getFor())) { Object labelValue = htmlOutputLabel.getValue();
final String target = ((HtmlOutputLabel) component).getFor(); if (target != null && !target.isEmpty()) { String label = (String) ((HtmlOutputLabel) component).getValue();
/** * Create a label component for the given <code>UIComponent</code>. Clients may override this * method to create a different type of label component. */ protected UIOutput createLabel( FacesContext context, UIComponent componentNeedingLabel ) { HtmlOutputLabel componentLabel = (HtmlOutputLabel) context.getApplication().createComponent( HtmlOutputLabel.COMPONENT_TYPE ); if ( componentNeedingLabel instanceof UIStub ) { // Not setFor on UIStub, because stubs never render id. However we can take a guess if // there's only one child component if ( componentNeedingLabel.getChildren().size() == 1 ) { componentLabel.setFor( componentNeedingLabel.getChildren().get( 0 ).getId() ); } } else if ( componentNeedingLabel.getId() != null ) { componentLabel.setFor( componentNeedingLabel.getId() ); } // Call .setParent before .setId to avoid 'unable to find component with id' warning and/or // 'duplicate component' error (depending on the JSF implementation) if ( componentLabel.getFor() != null ) { componentLabel.setParent( componentNeedingLabel.getParent() ); componentLabel.setId( componentLabel.getFor() + LABEL_ID_SUFFIX ); } return componentLabel; }
/** * Create a label component for the given <code>UIComponent</code>. Clients may override this * method to create a different type of label component. */ protected UIOutput createLabel( FacesContext context, UIComponent componentNeedingLabel ) { HtmlOutputLabel componentLabel = (HtmlOutputLabel) context.getApplication().createComponent( HtmlOutputLabel.COMPONENT_TYPE ); if ( componentNeedingLabel instanceof UIStub ) { // Not setFor on UIStub, because stubs never render id. However we can take a guess if // there's only one child component if ( componentNeedingLabel.getChildren().size() == 1 ) { componentLabel.setFor( componentNeedingLabel.getChildren().get( 0 ).getId() ); } } else if ( componentNeedingLabel.getId() != null ) { componentLabel.setFor( componentNeedingLabel.getId() ); } // Call .setParent before .setId to avoid 'unable to find component with id' warning and/or // 'duplicate component' error (depending on the JSF implementation) if ( componentLabel.getFor() != null ) { componentLabel.setParent( componentNeedingLabel.getParent() ); componentLabel.setId( componentLabel.getFor() + LABEL_ID_SUFFIX ); } return componentLabel; }
UIComponent maybe = children.get(j); if (maybe instanceof HtmlOutputLabel) { if (kid.getId().equals(((HtmlOutputLabel) maybe).getFor())) { needsLabel = false;
if (child instanceof HtmlOutputLabel) String forAttr = ((HtmlOutputLabel)child).getFor(); if (forAttr != null)
protected void encodeHtmlOutputLabelBegin(final FacesContext context, final HtmlOutputLabel htmlOutputLabel) throws IOException { final ResponseWriter writer = context.getResponseWriter(); writer.startElement(JsfConstants.LABEL_ELEM, htmlOutputLabel); RendererUtil.renderIdAttributeIfNecessary(writer, htmlOutputLabel, getIdForRender(context, htmlOutputLabel)); final String forAttr = htmlOutputLabel.getFor(); if (forAttr != null) { final UIComponent forComponent = htmlOutputLabel .findComponent(forAttr); if (forComponent == null) { throw new IllegalStateException("for Component [" + forAttr + "] does not found"); } final String forClientId = getIdForRender(context, forComponent); RendererUtil.renderAttribute(writer, JsfConstants.FOR_ATTR, forClientId, null); } renderRemainAttributes(htmlOutputLabel, writer, ignoreComponent); final String value = ValueHolderUtil.getValueForRender(context, htmlOutputLabel); writer.writeText(value, null); }