HtmlOutputLabel hol = new HtmlOutputLabel(); hol.setValue("label"); hol.setStyleClass("label"); tab.getChildren().add(hol);
private void createLabel() { if (isShowLabel()) { labelUser = new HtmlOutputLabel(); StringBuilder idGenerate = new StringBuilder(); idGenerate.append(getId()).append('-').append("label"); labelUser.setId(idGenerate.toString()); labelUser.setFor(inputUser.getId()); StringBuilder value = new StringBuilder(); value.append(getValue()).append(" :"); if (isRequired()) { value.append("*"); } labelUser.setValue(value.toString()); this.getChildren().add(labelUser); } }
/** * Build a label. * * @param property * The property. May not be null. * @param context * The jsf context. May not be null. */ public final void buildLabel(final PresentationPropertyDescriptor<?, ?> property, final RenderContext context) { Validate.notNull(property, AbstractRenderStrategy.PROPERTY_NULL); Validate.notNull(context, AbstractRenderStrategy.CONTEXT_NULL); this.label = new HtmlOutputLabel(); this.label.setId(this.createLabelName(context)); this.label.setFor(this.createInputName(context)); final StringBuilder builder = new StringBuilder(); builder.append(property.getDescription(context.getFacesContext().getViewRoot().getLocale())); if (property.isRequiredIndication()) { builder.append("*"); } builder.append(AbstractRenderStrategy.SEPARATOR); this.label.setValue(builder.toString()); this.label.setStyleClass(context.resolveStyleClass(JsfStyleClasses.FORM_OUTPUT_LABEL)); }
/** * Build a label. * * @param property * The property. May not be null. * @param context * The jsf context. May not be null. */ public final void buildLabel(final PropertyDescriptor<?, ?> property, final RenderContext context) { Validate.notNull(property, AbstractRenderStrategy.PROPERTY_NULL); Validate.notNull(context, AbstractRenderStrategy.CONTEXT_NULL); this.label = new HtmlOutputLabel(); this.label.setId(this.createLabelName(context)); this.label.setFor(this.createInputName(context)); String labelValue = property.getName(); if (property.adaptable(PresentationPropertyDescriptor.class)) { @SuppressWarnings("unchecked") final PresentationPropertyDescriptor<P, E> descriptor = property.adapt(PresentationPropertyDescriptor.class); labelValue = descriptor.getDescription(context.getFacesContext().getViewRoot().getLocale()); } final StringBuilder builder = new StringBuilder(); builder.append(labelValue); builder.append(AbstractRenderStrategy.SEPARATOR); this.label.setValue(builder.toString()); this.label.setStyleClass(context.resolveStyleClass(JsfStyleClasses.FORM_OUTPUT_LABEL)); }
/** * Build the label. * * @param property * The property. * @param context * The render context. * @param locale * The locale. */ public void buildLabel(final PresentationPropertyDescriptor<?, ?> property, final RenderContext context, final Locale locale) { this.label = new HtmlOutputLabel(); this.label.setId(this.compileLabelName(context.getPrefixDeque())); this.label.setFor(this.compileInputName(context.getPrefixDeque())); final StringBuilder builder = new StringBuilder(); builder.append(property.getDescription(locale)); builder.append(DefaultReadOnlyOutput.LABEL_SEPARATOR); this.label.setValue(builder.toString()); this.label.setStyleClass(context.resolveStyleClass(JsfStyleClasses.FORM_OUTPUT_LABEL)); }
/** * Build the label. * * @param property * The property. * @param context * The render context. */ public void buildLabel(final PropertyDescriptor<?, ?> property, final RenderContext context) { property.getName(); this.label = new HtmlOutputLabel(); this.label.setId(this.compileLabelName(context.getPrefixDeque())); this.label.setFor(this.compileInputName(context.getPrefixDeque())); String labelValue = property.getName(); if (property.adaptable(PresentationPropertyDescriptor.class)) { @SuppressWarnings("unchecked") final PresentationPropertyDescriptor<P, E> descriptor = property.adapt(PresentationPropertyDescriptor.class); labelValue = descriptor.getDescription(context.getFacesContext().getViewRoot().getLocale()); } final StringBuilder builder = new StringBuilder(); builder.append(labelValue); builder.append(DefaultReadOnlyOutput.LABEL_SEPARATOR); this.label.setValue(builder.toString()); this.label.setStyleClass(context.resolveStyleClass(JsfStyleClasses.FORM_OUTPUT_LABEL)); }
panel.setColumns(2); HtmlOutputLabel labelUser = new HtmlOutputLabel(); labelUser.setFor(USER_NAME); labelUser.setValue(Utils.getMessageResourceString(SecurityConst.BUNDLE_NAME, SecurityConst.USER_LOGIN, null, null)); HtmlOutputLabel labelPwd = new HtmlOutputLabel(); labelPwd.setFor(PWD_NAME); labelPwd.setValue(Utils.getMessageResourceString(SecurityConst.BUNDLE_NAME, SecurityConst.PWD_LOGIN, null, null));
private static void writeContent(List<String> row, StringListResponseWriter writer, FacesContext facesContext, int columnCount, UIComponent child) throws IOException { if (child instanceof HtmlCommandLink) { final HtmlOutputLabel label = new HtmlOutputLabel(); label.setValue(((HtmlCommandLink) child).getValue()); label.setRendered(child.isRendered()); label.encodeBegin(facesContext); label.encodeEnd(facesContext); } else if (child instanceof HtmlGraphicImage) { writer.writeText("", ""); //} else if (child instanceof UIInstructions) { // child.encodeBegin(facesContext); // child.encodeEnd(facesContext); // postCleanUp(row, columnCount); } else if (child instanceof HtmlPanelGroup || child instanceof HtmlOutputLink) { final UIComponentBase uiComponent = (UIComponentBase) child; if (uiComponent.isRendered()) { for (UIComponent uiChildComponent : uiComponent.getChildren()) { writeContent(row, writer, facesContext, columnCount, uiChildComponent); } } postCleanUp(row, columnCount); } else { child.encodeBegin(facesContext); child.encodeEnd(facesContext); } }