public WidgetBuilder callback(String name, String signature, String callback) throws IOException { if (callback != null) { ResponseWriter rw = context.getResponseWriter(); rw.write(","); rw.write(name); rw.write(":"); rw.write(signature); rw.write("{"); rw.write(callback); rw.write("}"); } return this; }
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"); }
public void finish() throws IOException { ResponseWriter rw = context.getResponseWriter(); rw.write("});"); if (endFunction) { rw.write("});"); } rw.endElement("script"); } }
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); } }
protected void encodeRequiredIndicator(ResponseWriter writer, OutputLabel label) throws IOException { writer.startElement("span", label); writer.writeAttribute("class", OutputLabel.REQUIRED_FIELD_INDICATOR_CLASS, null); writer.write("*"); writer.endElement("span"); }
public WidgetBuilder returnCallback(String name, String signature, String callback) throws IOException { if (callback != null) { ResponseWriter rw = context.getResponseWriter(); rw.write(","); rw.write(name); rw.write(":"); rw.write(signature); rw.write("{return "); rw.write(callback); rw.write("}"); } return this; }
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"); }
public WidgetBuilder nativeAttr(String name, String value) throws IOException { if (value != null) { ResponseWriter rw = context.getResponseWriter(); rw.write(","); rw.write(name); rw.write(":"); rw.write(value); } return this; }
protected void encodeButton(FacesContext context, String title, String styleClass, String icon) throws IOException { ResponseWriter writer = context.getResponseWriter(); writer.startElement("button", null); writer.writeAttribute("type", "button", null); writer.writeAttribute("class", HTML.BUTTON_ICON_ONLY_BUTTON_CLASS + " " + styleClass, null); 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.write("ui-button"); writer.endElement("span"); writer.endElement("button"); }
public WidgetBuilder callback(String name, String callback) throws IOException { if (callback != null) { ResponseWriter rw = context.getResponseWriter(); rw.write(","); rw.write(name); rw.write(":"); rw.write(callback); } return this; }
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"); }
public WidgetBuilder attr(String name, Boolean value) throws IOException { if (value != null) { ResponseWriter rw = context.getResponseWriter(); rw.write(","); rw.write(name); rw.write(":"); rw.write(Boolean.toString(value)); } return this; }
protected void encodeButton(FacesContext context, String title, String styleClass, String icon) throws IOException { ResponseWriter writer = context.getResponseWriter(); writer.startElement("button", null); writer.writeAttribute("type", "button", null); writer.writeAttribute("class", HTML.BUTTON_ICON_ONLY_BUTTON_CLASS + " " + styleClass, null); 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.write("ui-button"); writer.endElement("span"); writer.endElement("button"); }
public WidgetBuilder attr(String name, int value, int defaultValue) throws IOException { if (value != defaultValue) { ResponseWriter rw = context.getResponseWriter(); rw.write(","); rw.write(name); rw.write(":"); rw.write(Integer.toString(value)); } return this; }
protected void encodeButton(FacesContext context, ColorPicker colorPicker, String clientId, String value) throws IOException { ResponseWriter writer = context.getResponseWriter(); writer.startElement("button", null); writer.writeAttribute("id", clientId + "_button", null); writer.writeAttribute("type", "button", null); writer.writeAttribute("class", HTML.BUTTON_TEXT_ONLY_BUTTON_CLASS, null); renderAccessibilityAttributes(context, colorPicker); //text writer.startElement("span", null); writer.writeAttribute("class", HTML.BUTTON_TEXT_CLASS, null); writer.write("<span id=\"" + clientId + "_livePreview\" " + "style=\"overflow:hidden;width:1em;height:1em;display:block;border:solid 1px #000;text-indent:1em;white-space:nowrap;"); if (value != null) { writer.write("background-color:#" + value); } writer.write("\">Live Preview</span>"); writer.endElement("span"); writer.endElement("button"); }
public WidgetBuilder attr(String name, Number value) throws IOException { if (value != null) { ResponseWriter rw = context.getResponseWriter(); rw.write(","); rw.write(name); rw.write(":"); rw.write(value.toString()); } return this; }
protected void encodeDropDown(FacesContext context, Carousel carousel, String name, String styleClass, int pageCount) throws IOException { ResponseWriter writer = context.getResponseWriter(); String template = carousel.getDropdownTemplate(); writer.startElement("select", null); writer.writeAttribute("name", name, null); writer.writeAttribute("class", styleClass, null); for (int i = 0; i < pageCount; i++) { writer.startElement("option", null); writer.writeAttribute("value", i + 1, null); writer.write(template.replaceAll("\\{page\\}", String.valueOf(i + 1))); writer.endElement("option"); } writer.endElement("select"); }
public WidgetBuilder attr(String name, double value, double defaultValue) throws IOException { if (value != defaultValue) { ResponseWriter rw = context.getResponseWriter(); rw.write(","); rw.write(name); rw.write(":"); rw.write(Double.toString(value)); } return this; }
protected void encodeOnloadScripts(ResponseWriter writer) throws IOException { List<String> scripts = PrimeRequestContext.getCurrentInstance().getScriptsToExecute(); if (!scripts.isEmpty()) { writer.startElement("script", null); writer.writeAttribute("type", "text/javascript", null); writer.write("$(function(){"); for (int i = 0; i < scripts.size(); i++) { writer.write(scripts.get(i)); writer.write(';'); } writer.write("});"); writer.endElement("script"); } }
public WidgetBuilder nativeAttr(String name, String value, String defaultValue) throws IOException { if (value != null && !value.equals(defaultValue)) { ResponseWriter rw = context.getResponseWriter(); rw.write(","); rw.write(name); rw.write(":"); rw.write(value); } return this; }