Examples of HtmlStringBuffer


Examples of org.apache.click.util.HtmlStringBuffer

    public String getSubmitScript(String formName) {
        if (formName == null) {
            throw new IllegalStateException("formName cannot be null.");
        }

        HtmlStringBuffer buffer = new HtmlStringBuffer(60);
        buffer.append("return");
        if (getForm().getValidate() && getForm().getJavaScriptValidation()) {
            buffer.append(" on_");
            buffer.append(getForm().getId());
            buffer.append("_submit() &&");
        }
        buffer.append(" Click.submitLinkAction(this, '");
        buffer.append(formName);
        buffer.append("');");
        return buffer.toString();
    }
View Full Code Here

Examples of org.apache.click.util.HtmlStringBuffer

     */
    public String getHref(Object value) {
        Context context = getContext();
        String uri = ClickUtils.getRequestURI(context.getRequest());

        HtmlStringBuffer buffer =
                new HtmlStringBuffer(uri.length() + getName().length() + 40);

        String prefix = getParameterPrefix();

        buffer.append(uri);
        buffer.append("?");
        buffer.append(ACTION_LINK);
        buffer.append("=");
        buffer.append(getName());
        if (value != null) {
            buffer.append("&");
            if (StringUtils.isNotBlank(prefix)) {
                // Value parameter is prefixed when SubmitLink is included
                // inside a Form
                buffer.append(prefix);
            }
            buffer.append(VALUE);
            buffer.append("=");
            buffer.append(ClickUtils.encodeUrl(value, context));
        }

        if (hasParameters()) {
            Iterator i = getParameters().keySet().iterator();
            while (i.hasNext()) {
                String name = i.next().toString();
                if (!name.equals(ACTION_LINK) && !name.equals(VALUE)) {
                    Object paramValue = getParameters().get(name);
                    if (paramValue instanceof String[]) {
                        String[] paramValues = (String[]) paramValue;
                        for (int j = 0; j < paramValues.length; j++) {
                            renderParameter(name, paramValues[j], prefix,
                                buffer, context);
                        }
                    } else {
                        renderParameter(name, paramValue, prefix, buffer,
                            context);
                    }
                }
            }
        }

        return context.getResponse().encodeURL(buffer.toString());
    }
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();

        buffer.append("setFocus('");
        buffer.append(getName() + "_0");
        buffer.append("');");

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

Examples of org.apache.click.util.HtmlStringBuffer

     *
     * @return the HTML head import statements for the control
     */
    public String getHtmlImports() {
        Context context = getContext();
        HtmlStringBuffer buffer = new HtmlStringBuffer(400);

        buffer.append(ClickUtils.createHtmlImport(HTML_IMPORTS, context));

        if (isSortable()) {
            buffer.append(ClickUtils.createHtmlImport(JS_SORT_HTML_IMPORTS,
                context));

            // Script to execute
            HtmlStringBuffer script = new HtmlStringBuffer(50);
            script.append("Sortable.create('");
            script.append(StringEscapeUtils.escapeJavaScript(getId()));
            script.append("_ul'");

            if (getHeight() != null) {
                script.append(", { scroll : '");
                script.append(StringEscapeUtils.escapeJavaScript(getId()));
                script.append("'}");
            }
            script.append(");");

            buffer.append("<script type=\"text/javascript\">");
            if (getHeight() != null) {
                buffer.append("Position.includeScrollOffset = true;");
            }
View Full Code Here

Examples of org.apache.click.util.HtmlStringBuffer

     * @return the HTML includes statements for the contained control stylesheet
     * and JavaScript files
     */
    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

Examples of org.apache.click.util.HtmlStringBuffer

     * is determined by {@link #getControlSizeEst()}.
     *
     * @return the HTML representation of this control
     */
    public String toString() {
        HtmlStringBuffer buffer = new HtmlStringBuffer(getControlSizeEst());
        render(buffer);
        return buffer.toString();
    }
View Full Code Here

Examples of org.apache.click.util.HtmlStringBuffer

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

Examples of org.apache.click.util.HtmlStringBuffer

        } else {
            values.put("back_color", "#FFFFFF");
        }
        values.put("value", getValue());

        HtmlStringBuffer textFieldAttributes = new HtmlStringBuffer(96);
        if (getShowTextField()) {
            textFieldAttributes.appendAttribute("size", getSize());
            textFieldAttributes.appendAttribute("title", getTitle());
            if (isReadonly()) {
                textFieldAttributes.appendAttributeReadonly();
            }
            textFieldAttributes.appendAttribute("maxlength", 7);

            if (isValid()) {
                removeStyleClass("error");
                if (isDisabled()) {
                    addStyleClass("disabled");
                } else {
                    removeStyleClass("disabled");
                }
            } else {
                addStyleClass("error");
            }
        }

        appendAttributes(textFieldAttributes);

        if (isDisabled()) {
            textFieldAttributes.appendAttributeDisabled();
        }
        values.put("attributes", textFieldAttributes.toString());

        // The image messages
        values.put("chooseColorMsg", getMessage("choose-color"));
        values.put("noColorMsg", getMessage("no-color"));
        values.put("closeMsg", getMessage("close"));
View Full Code Here

Examples of org.apache.click.util.HtmlStringBuffer

     * ColorPicker.htm template.
     *
     * @return a HTML rendered ColorPicker 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

            methodCache = new HashMap();
        }

        Object value = PropertyUtils.getValue(row, idProperty, methodCache);

        HtmlStringBuffer buffer = new HtmlStringBuffer();

        if (linksArray.length == 1) {
            AbstractLink link = linksArray[0];
            initLink(link, context, value);
            renderActionLink(buffer, link, context, row, value);

        } else {

            for (int i = 0; i < linksArray.length; i++) {
                AbstractLink link = linksArray[i];
                initLink(link, context, value);

                if (i > 0) {
                    if (StringUtils.isBlank(link.getImageSrc())) {
                        buffer.append(getLinkSeparator());
                    } else {
                        buffer.append(" ");
                    }
                }

                renderActionLink(buffer, link, context, row, value);
            }

        }
        return buffer.toString();
    }
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.