protected void encodeProgressStateProlog( FacesContext context, UIComponent component, ProgressBarState currentState) throws IOException { ResponseWriter responseWriter = context.getResponseWriter(); responseWriter.startElement(HtmlConstants.DIV_ELEM, component); responseWriter.writeAttribute( HtmlConstants.ID_ATTRIBUTE, component.getClientId(context) + ".rmng", null); responseWriter.writeAttribute( HtmlConstants.CLASS_ATTRIBUTE, HtmlUtil.concatClasses("rf-pb-rmng", component.getAttributes().get("remainingClass")), null); responseWriter.writeAttribute( HtmlConstants.STYLE_ATTRIBUTE, getContentStyle(currentState == ProgressBarState.progressState), null); responseWriter.startElement(HtmlConstants.DIV_ELEM, component); responseWriter.writeAttribute( HtmlConstants.CLASS_ATTRIBUTE, HtmlUtil.concatClasses("rf-pb-prgs", component.getAttributes().get("progressClass")), null); responseWriter.writeAttribute( HtmlConstants.ID_ATTRIBUTE, component.getClientId(context) + ".prgs", null); responseWriter.writeAttribute( HtmlConstants.STYLE_ATTRIBUTE, "width: " + getWidth(component) + "%", null); responseWriter.endElement(HtmlConstants.DIV_ELEM); }
public static void encodeItems( FacesContext facesContext, UIComponent component, Iterator<ClientSelectItem> clientSelectItems, String cssPrefix) throws IOException { AbstractSelectManyComponent select = (AbstractSelectManyComponent) component; String defaultItemCss = cssPrefix + ITEM_CSS; String defaultItemCssDis = cssPrefix + ITEM_CSS_DIS; if (clientSelectItems != null && clientSelectItems.hasNext()) { ResponseWriter writer = facesContext.getResponseWriter(); String clientId = component.getClientId(facesContext); while (clientSelectItems.hasNext()) { ClientSelectItem clientSelectItem = clientSelectItems.next(); String itemClientId = clientId + "Item" + clientSelectItem.getSortOrder(); clientSelectItem.setClientId(itemClientId); writer.startElement(HtmlConstants.DIV_ELEM, component); writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, itemClientId, null); String itemCss; if (!select.isDisabled()) { itemCss = HtmlUtil.concatClasses(select.getItemClass(), defaultItemCss); } else { itemCss = HtmlUtil.concatClasses(select.getItemClass(), defaultItemCss, defaultItemCssDis); } writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, itemCss, null); String label = clientSelectItem.getLabel(); if (label != null && label.trim().length() > 0) { writer.writeText(label, null); } else { writer.write("\u00a0"); } writer.endElement(HtmlConstants.DIV_ELEM); writer.write('\n'); } } }
@Override protected String getStyleClass(UIComponent component) { return HtmlUtil.concatClasses("rf-tbp", attributeAsString(component, "styleClass")); }
public static void encodeOneRow( FacesContext facesContext, UIComponent component, SelectManyRendererBase renderer, ClientSelectItem clientSelectItem, String cssPrefix) throws IOException { AbstractSelectManyComponent table = (AbstractSelectManyComponent) component; String defaultItemCss = cssPrefix + ITEM_CSS; String defaultItemCssDis = cssPrefix + ITEM_CSS_DIS; ResponseWriter writer = facesContext.getResponseWriter(); String clientId = table.getClientId(facesContext); String itemClientId = clientId + "Item" + clientSelectItem.getSortOrder(); clientSelectItem.setClientId(itemClientId); writer.startElement(HtmlConstants.TR_ELEMENT, table); writer.writeAttribute("id", itemClientId, null); String itemCss; if (!table.isDisabled()) { itemCss = HtmlUtil.concatClasses(table.getItemClass(), defaultItemCss); } else { itemCss = HtmlUtil.concatClasses(table.getItemClass(), defaultItemCss, defaultItemCssDis); } writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, itemCss, null); String cellClassName = cssPrefix + CELL_CSS; String[] columnClasses; if (table.getColumnClasses() != null) { columnClasses = table.getColumnClasses().split(","); } else { columnClasses = new String[0]; } int columnCounter = 0; Iterator<UIColumn> columnIterator = table.columns(); while (columnIterator.hasNext()) { UIColumn column = columnIterator.next(); if (column.isRendered()) { writer.startElement(HtmlConstants.TD_ELEM, table); Object width = column.getAttributes().get("width"); if (width != null) { writer.writeAttribute( "style", "width: " + HtmlDimensions.formatSize(width.toString()), null); } String columnClass; if (columnClasses.length > 0) { columnClass = HtmlUtil.concatClasses( cellClassName, columnClasses[columnCounter % columnClasses.length], column.getAttributes().get("styleClass")); } else { columnClass = HtmlUtil.concatClasses(cellClassName, column.getAttributes().get("styleClass")); } writer.writeAttribute("class", columnClass, null); renderer.renderChildren(facesContext, column); writer.endElement(HtmlConstants.TD_ELEM); columnCounter++; } } writer.endElement(HtmlConstants.TR_ELEMENT); }