Examples of HtmlStringBuffer


Examples of org.apache.click.util.HtmlStringBuffer

        if (!headElements.contains(script)) {
            // Script must be executed as soon as browser dom is ready
            script.setExecuteOnDomReady(true);

            String contextPath = context.getRequest().getContextPath();
            HtmlStringBuffer buffer = new HtmlStringBuffer(150);
            buffer.append("new Ajax.Autocompleter(");
            buffer.append("'").append(fieldId).append("'");
            buffer.append(",'").append(fieldId).append("_auto_complete_div'");
            buffer.append(",'").append(contextPath).append(page.getPath()).append(
                "'");
            buffer.append(",").append(getAutoCompleteOptions()).append(");");
            script.setContent(buffer.toString());
            headElements.add(script);
        }
        return headElements;
    }
View Full Code Here

Examples of org.apache.click.util.HtmlStringBuffer

     * Render the suggested auto completion list to the servlet response.
     *
     * @param autoCompleteList the suggested list of auto completion values
     */
    protected void renderAutoCompleteList(List autoCompleteList) {
        HtmlStringBuffer buffer = new HtmlStringBuffer(10 + (autoCompleteList.size() * 20));

        buffer.append("<ul>");

        for (int i = 0; i < autoCompleteList.size(); i++) {
            String value = autoCompleteList.get(i).toString();
            buffer.append("<li>");
            buffer.appendEscaped(value);
            buffer.append("</li>");
        }

        buffer.append("</ul>");

        HttpServletResponse response = getContext().getResponse();

        response.setContentType(getPage().getContentType());

        try {
            PrintWriter writer = response.getWriter();
            writer.print(buffer.toString());
            writer.flush();
            writer.close();

            getPage().setPath(null);

View Full Code Here

Examples of org.apache.click.util.HtmlStringBuffer

     * Return the form buttons HTML string representation.
     *
     * @return the form buttons HTML string representation
     */
    public String getButtonsHtml() {
        HtmlStringBuffer buffer = new HtmlStringBuffer(256);

        renderButtons(buffer);

        return buffer.toString();
    }
View Full Code Here

Examples of org.apache.click.util.HtmlStringBuffer

     * @see org.apache.click.Control#getHtmlImports()
     *
     * @return the HTML head element import string
     */
    public String getHtmlImports() {
        HtmlStringBuffer buffer = new HtmlStringBuffer(255);

        buffer.append(super.getHtmlImports());
        String htmlImports = getControlLink().getHtmlImports();
        if (htmlImports != null) {
            buffer.append(htmlImports);
        }

        int firstRow = getFirstRow();
        int lastRow = getLastRow();

        for (int i = 0; i < getColumnList().size(); i++) {
            Column column = (Column) getColumnList().get(i);
            if (column instanceof FieldColumn) {
                Field field = ((FieldColumn) column).getField();

                for (int j = firstRow; j < lastRow; j++) {
                    field.setName(column.getName() + "_" + j);

                    htmlImports = field.getHtmlImports();
                    if (htmlImports != null) {
                        buffer.append(htmlImports);
                    }
                }
            }
        }

        return buffer.toString();
    }
View Full Code Here

Examples of org.apache.click.util.HtmlStringBuffer

        if (isValid() && getValue().length() > 0) {
            String value = getValue();
            String cardType = getCardType();

            // Strip spaces and '-' chars
            HtmlStringBuffer buffer = new HtmlStringBuffer(value.length());
            for (int i = 0, size = value.length(); i < size; i++) {
                char aChar = value.charAt(i);
                if (aChar != '-' && aChar != ' ') {
                    buffer.append(aChar);
                }
            }
            value = buffer.toString();

            final int length = value.length();

            // Shortest valid number is VISA with 13 digits
            if (length < 13) {
View Full Code Here

Examples of org.apache.click.util.HtmlStringBuffer

                }
            }
        }

        if (params != null && !params.isEmpty()) {
            HtmlStringBuffer buffer = new HtmlStringBuffer();

            for (Iterator i = params.keySet().iterator(); i.hasNext();) {
                String paramName = i.next().toString();
                Object paramValue = params.get(paramName);

                // Check for multivalued parameter
                if (paramValue instanceof String[]) {
                    String[] paramValues = (String[]) paramValue;
                    for (int j = 0; j < paramValues.length; j++) {
                        buffer.append(paramName);
                        buffer.append("=");
                        buffer.append(ClickUtils.encodeUrl(paramValues[j], context));
                        if (j < paramValues.length - 1) {
                            buffer.append("&");
                        }
                    }
                } else {
                    if (paramValue != null) {
                        buffer.append(paramName);
                        buffer.append("=");
                        buffer.append(ClickUtils.encodeUrl(paramValue, context));
                    }
                }
                if (i.hasNext()) {
                    buffer.append("&");
                }
            }

            if (buffer.length() > 0) {
                if (location.contains("?")) {
                    location += "&" + buffer.toString();
                } else {
                    location += "?" + buffer.toString();
                }
            }
        }

        redirect = location;
View Full Code Here

Examples of org.apache.click.util.HtmlStringBuffer

     * Return the Field focus JavaScript.
     *
     * @return the Field focus JavaScript
     */
    public String getFocusJavaScript() {
        HtmlStringBuffer buffer = new HtmlStringBuffer(32);

        buffer.append("setFocus('");
        buffer.append(getId());
        buffer.append("');");

        return buffer.toString();
    }
View Full Code Here

Examples of org.apache.click.util.HtmlStringBuffer

        if (!getRadioList().isEmpty()) {
            Radio radio = (Radio) getRadioList().get(0);
            id = radio.getId();
        }

        HtmlStringBuffer buffer = new HtmlStringBuffer(32);
        buffer.append("setFocus('");
        buffer.append(id);
        buffer.append("');");

        return buffer.toString();
    }
View Full Code Here

Examples of org.apache.click.util.HtmlStringBuffer

     * @see Object#toString()
     *
     * @return the HTML rendered RadioGroup string
     */
    public String toString() {
        HtmlStringBuffer buffer = new HtmlStringBuffer(getControlSizeEst());
        render(buffer);
        return buffer.toString();
    }
View Full Code Here

Examples of org.apache.click.util.HtmlStringBuffer

     * @return the HTML includes statements for the container and child Controls,
     * or null if no includes are available
     */
    public String getHtmlImports() {
        if (hasControls()) {
            HtmlStringBuffer buffer = new HtmlStringBuffer(0);
            for (int i = 0, size = getControls().size(); i < size; i++) {
                Control control = (Control) getControls().get(i);
                String htmlImports = control.getHtmlImports();
                if (htmlImports != null) {
                    buffer.append(htmlImports);
                }
            }
            return buffer.toString();
        }
        return null;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.