protected void writeLabel(ResponseWriter writer, String label, boolean visible) throws IOException { writer.startElement("span", null); if (!visible) { writer.writeAttribute("class", "ui-helper-hidden", null); } writer.writeText(label, null); writer.endElement("span"); } }
protected void handleCommand(FacesContext context, Terminal terminal) throws IOException { String[] tokens = getValueTokens(context, terminal); String command = tokens[0]; String[] args = Arrays.copyOfRange(tokens, 1, tokens.length); MethodExpression commandHandler = terminal.getCommandHandler(); String result = (String) commandHandler.invoke(context.getELContext(), new Object[]{command, args}); ResponseWriter writer = context.getResponseWriter(); writer.writeText(result, null); }
protected void encodeItemLabel(final FacesContext context, final TriStateCheckbox checkbox) throws IOException { String label = checkbox.getItemLabel(); if (label != null) { ResponseWriter writer = context.getResponseWriter(); writer.startElement("span", null); writer.writeAttribute("class", HTML.CHECKBOX_LABEL_CLASS, null); writer.writeText(label, "itemLabel"); writer.endElement("span"); } }
protected void renderContent(FacesContext context, Link link) throws IOException { ResponseWriter writer = context.getResponseWriter(); Object value = link.getValue(); if (value != null) { if (link.isEscape()) { writer.writeText(value, "value"); } else { writer.write(value.toString()); } } else { renderChildren(context, link); } }
protected void encodeOption(FacesContext context, String label, String styleClass, boolean showLabels) throws IOException { ResponseWriter writer = context.getResponseWriter(); writer.startElement("div", null); writer.writeAttribute("class", styleClass, null); writer.startElement("span", null); if (showLabels) { writer.writeText(label, null); } else { writer.write(" "); } writer.endElement("span"); writer.endElement("div"); }
protected void renderContent(FacesContext context, LinkButton linkButton) throws IOException { ResponseWriter writer = context.getResponseWriter(); Object value = linkButton.getValue(); if (value != null) { if (linkButton.isEscape()) { writer.writeText(value, "value"); } else { writer.write(value.toString()); } } else { renderChildren(context, linkButton); } }
protected void encodeLabel(FacesContext context, SelectCheckboxMenu menu, List<SelectItem> selectItems, boolean valid) throws IOException { ResponseWriter writer = context.getResponseWriter(); String label = menu.getLabel(); String labelClass = !valid ? SelectCheckboxMenu.LABEL_CLASS + " ui-state-error" : SelectCheckboxMenu.LABEL_CLASS; if (label == null) { label = ""; } writer.startElement("span", null); writer.writeAttribute("class", SelectCheckboxMenu.LABEL_CONTAINER_CLASS, null); writer.startElement("label", null); writer.writeAttribute("class", labelClass, null); writer.writeText(label, null); writer.endElement("label"); writer.endElement("span"); }
protected void autoCompleteCommand(FacesContext context, Terminal terminal) throws IOException { String[] tokens = getValueTokens(context, terminal); String command = tokens[0]; String[] args = Arrays.copyOfRange(tokens, 1, tokens.length); TerminalAutoCompleteModel autoCompleteModel = terminal.getAutoCompleteModel(); ResponseWriter writer = context.getResponseWriter(); if (autoCompleteModel == null) { writer.write("null"); } else { TerminalAutoCompleteMatches matches = terminal.traverseAutoCompleteModel(autoCompleteModel, command, args); writer.writeText(matches.toString(), null); } }
public void render(FacesContext context, Pageable pageable, String linkClass, String iconClass, boolean disabled, String ariaLabel) throws IOException { ResponseWriter writer = context.getResponseWriter(); String styleClass = disabled ? linkClass + " ui-state-disabled" : linkClass; int textIndex = iconClass.indexOf("seek-"); String text = String.valueOf(iconClass.charAt(textIndex + 5)).toUpperCase(); String tabindex = (disabled) ? "-1" : "0"; writer.startElement("a", null); writer.writeAttribute("href", "#", null); writer.writeAttribute("class", styleClass, null); writer.writeAttribute(HTML.ARIA_LABEL, ariaLabel, null); writer.writeAttribute("tabindex", tabindex, null); writer.startElement("span", null); writer.writeAttribute("class", iconClass, null); writer.writeText(text, null); writer.endElement("span"); writer.endElement("a"); } }
@SuppressWarnings("unchecked") public void encodeSuggestions(FacesContext context, InputTextarea inputTextarea, String query) throws IOException { ResponseWriter writer = context.getResponseWriter(); List<Object> items = inputTextarea.getSuggestions(); writer.startElement("ul", inputTextarea); writer.writeAttribute("class", AutoComplete.LIST_CLASS, null); for (Object item : items) { writer.startElement("li", null); writer.writeAttribute("class", AutoComplete.ITEM_CLASS, null); writer.writeAttribute("data-item-value", item.toString(), null); writer.writeText(item, null); writer.endElement("li"); } writer.endElement("ul"); }
protected void encodeText(ResponseWriter writer, String text, String severity, boolean escape) throws IOException { writer.startElement("span", null); writer.writeAttribute("class", "ui-message-" + severity, null); if (text != null) { if (escape) { writer.writeText(text, null); } else { writer.write(text); } } writer.endElement("span"); }
protected void encodeNavigator(FacesContext facesContext, Wizard wizard, String id, String label, String buttonClass, String icon) throws IOException { ResponseWriter writer = facesContext.getResponseWriter(); writer.startElement("button", null); writer.writeAttribute("id", id, null); writer.writeAttribute("name", id, null); writer.writeAttribute("type", "button", null); writer.writeAttribute("class", HTML.BUTTON_TEXT_ICON_LEFT_BUTTON_CLASS + " " + buttonClass, null); //button icon String iconClass = HTML.BUTTON_LEFT_ICON_CLASS + " " + icon; writer.startElement("span", null); writer.writeAttribute("class", iconClass, null); writer.endElement("span"); //text writer.startElement("span", null); writer.writeAttribute("class", HTML.BUTTON_TEXT_CLASS, null); writer.writeText(label, "value"); writer.endElement("span"); writer.endElement("button"); }
protected void encodeButton(FacesContext context, String title, String styleClass, String icon, String labelDisplay) throws IOException { ResponseWriter writer = context.getResponseWriter(); boolean tooltip = labelDisplay.equals("tooltip"); String buttonClass = tooltip ? HTML.BUTTON_ICON_ONLY_BUTTON_CLASS : HTML.BUTTON_TEXT_ICON_LEFT_BUTTON_CLASS; writer.startElement("button", null); writer.writeAttribute("type", "button", null); writer.writeAttribute("class", buttonClass + " " + styleClass, null); if (tooltip) { writer.writeAttribute("title", title, null); } //icon writer.startElement("span", null); writer.writeAttribute("class", HTML.BUTTON_LEFT_ICON_CLASS + " " + icon, null); writer.endElement("span"); //text writer.startElement("span", null); writer.writeAttribute("class", HTML.BUTTON_TEXT_CLASS, null); writer.writeText(title, null); writer.endElement("span"); writer.endElement("button"); }
public void encodeMoreText(FacesContext context, AutoComplete ac) throws IOException { int colSize = ac.getColums().size(); String moreText = ac.getMoreText(); ResponseWriter writer = context.getResponseWriter(); if (colSize > 0) { writer.startElement("tr", null); writer.writeAttribute("class", AutoComplete.MORE_TEXT_TABLE_CLASS, null); writer.startElement("td", null); writer.writeAttribute("colspan", colSize, null); writer.writeText(moreText, "moreText"); writer.endElement("td"); writer.endElement("tr"); } else { writer.startElement("li", null); writer.writeAttribute("class", AutoComplete.MORE_TEXT_LIST_CLASS, null); writer.writeText(moreText, "moreText"); writer.endElement("li"); } } }
protected void encodeText(FacesContext context, Message uiMessage, String text, String severity) throws IOException { ResponseWriter writer = context.getResponseWriter(); writer.startElement("span", null); writer.writeAttribute("class", "ui-message-" + severity, null); writer.writeAttribute("id", uiMessage.getClientId(context) + '_' + severity, null); if (uiMessage.isEscape()) { writer.writeText(text, null); } else { writer.write(text); } writer.endElement("span"); }
@Override public void render(FacesContext context, Pageable pageable) throws IOException { ResponseWriter writer = context.getResponseWriter(); int currentPage = pageable.getPage(); int pageCount = pageable.getPageCount(); writer.startElement("select", null); writer.writeAttribute("class", UIData.PAGINATOR_JTP_SELECT_CLASS, null); writer.writeAttribute("value", pageable.getPage(), null); for (int i = 0; i < pageCount; i++) { writer.startElement("option", null); writer.writeAttribute("value", i, null); if (i == currentPage) { writer.writeAttribute("selected", "selected", null); } writer.writeText((i + 1), null); writer.endElement("option"); } writer.endElement("select"); }
protected void encodeItemLabel(FacesContext context, SelectBooleanCheckbox checkbox, String clientId) throws IOException { String label = checkbox.getItemLabel(); if (label != null) { ResponseWriter writer = context.getResponseWriter(); writer.startElement("span", null); writer.writeAttribute("class", HTML.CHECKBOX_LABEL_CLASS, null); if (checkbox.isEscape()) { writer.writeText(label, "itemLabel"); } else { writer.write(label); } writer.endElement("span"); } }
protected void encodeGroupLabel(FacesContext context, SelectManyCheckbox checkbox, SelectItemGroup group) throws IOException { ResponseWriter writer = context.getResponseWriter(); writer.startElement("span", null); writer.writeAttribute("class", "ui-selectmanycheckbox-item-group", null); if (group.isEscape()) { writer.writeText(group.getLabel(), null); } else { writer.write(group.getLabel()); } writer.endElement("span"); }
public void encodeFooter(FacesContext context, LayoutUnit unit) throws IOException { String footerText = unit.getFooter(); UIComponent footerFacet = unit.getFacet("footer"); if (footerText == null && footerFacet == null) { return; } ResponseWriter writer = context.getResponseWriter(); writer.startElement("div", null); writer.writeAttribute("class", Layout.UNIT_FOOTER_CLASS, null); writer.startElement("div", null); writer.writeAttribute("class", Layout.UNIT_FOOTER_TITLE_CLASS, null); if (footerFacet != null) { footerFacet.encodeAll(context); } else if (footerText != null) { writer.writeText(footerText, null); } writer.endElement("div"); writer.endElement("div"); }
protected void encodeLists(FacesContext context, MultiSelectListbox listbox, List<SelectItem> itemList) throws IOException { ResponseWriter writer = context.getResponseWriter(); SelectItem[] items = (itemList == null) ? null : itemList.toArray(new SelectItem[itemList.size()]); String header = listbox.getHeader(); String listStyleClass = MultiSelectListbox.LIST_CLASS; writer.startElement("div", listbox); writer.writeAttribute("class", MultiSelectListbox.LIST_CONTAINER_CLASS, null); if (header != null) { listStyleClass = listStyleClass + " ui-corner-bottom"; writer.startElement("div", listbox); writer.writeAttribute("class", MultiSelectListbox.LIST_HEADER_CLASS, null); writer.writeText(header, null); writer.endElement("div"); } else { listStyleClass = listStyleClass + " ui-corner-all"; } writer.startElement("ul", listbox); writer.writeAttribute("class", listStyleClass, null); renderARIARequired(context, listbox); if (items != null) { encodeListItems(context, listbox, items); } writer.endElement("ul"); writer.endElement("div"); }