Package com.volantis.synergetics.cornerstone.utilities

Examples of com.volantis.synergetics.cornerstone.utilities.ReusableStringBuffer


        }

        try {
            ReusableStringWriter stringWriter =
                    (ReusableStringWriter) getWriter();
            ReusableStringBuffer buffer = stringWriter.getBuffer();
            buffer.setLength(0);
            renderValue(value);
            if (buffer.length() > 0) {
                return buffer;
            } else {
                return null;
            }
        }
View Full Code Here


    }

    public void renderValue(
            StyleValue value, Element element,
            String attributeName) {
        ReusableStringBuffer buffer = getRenderValue(value);
        if (buffer != null) {
            element.setAttribute(attributeName, buffer.toString());
        }
    }
View Full Code Here

    public void addTextAlign(Element element, String attribute) {
        StyleValue value = styles.getStyleValue(
                StylePropertyDetails.TEXT_ALIGN);
        if (value != null) {
            context.setKeywordMapper(getTextAlignKeywordMapper());
            ReusableStringBuffer buffer = context.getRenderValue(value);
            if (buffer != null) {
                String attrValue = buffer.toString();
                if ("c".equals(attrValue) || "r".equals(attrValue)) {
                    element.setAttribute("align", attrValue);
                }
            }
        }
View Full Code Here

    private String getFontFamily() {
        StyleList listValue = (StyleList) styles
                .getStyleValue(StylePropertyDetails.FONT_FAMILY);
        if (listValue != null && listValue.getList() != null) {
            Iterator i = listValue.getList().iterator();
            ReusableStringBuffer buffer = new ReusableStringBuffer();
            while (i.hasNext()) {
                StyleValue value = (StyleValue) i.next();
                context.setKeywordMapper(getFontFamilyKeywordMapper());
                if (buffer.length() == 0) {
                    buffer.append(context.getRenderValue(value));
                } else {
                    buffer.append(", ").append(context.getRenderValue(value));
                }
            }
            return (buffer.length() == 0 ? null : buffer.toString());
        }
        return null;
    }
View Full Code Here

        Element tableElement = dom.closeElement("table");

        // Add any alignment values to the table attributes
        TableState ts = (TableState)tableElement.getObject();
        ReusableStringBuffer alignBuffer = ts.getBuffer();
        if (alignBuffer.length() > 0) {
            tableElement.setAttribute("align", alignBuffer.toString());
        }
        ts.release();
        tableElement.setObject(null);

        // If the table contains a caption (which will be a BLOCH element as the
View Full Code Here

            Styles styles = attributes.getStyles();
            PropertyValues propertyValues = styles.getPropertyValues();
            StyleValue styleValue = propertyValues.getComputedValue(
                    StylePropertyDetails.TEXT_ALIGN);

            ReusableStringBuffer tableAlign = ts.getBuffer();
            if (styleValue == TextAlignKeywords.RIGHT) {
                tableAlign.append('R');
            } else if (styleValue == TextAlignKeywords.CENTER) {
                tableAlign.append('C');
            } else {
                tableAlign.append('L');
            }
        }

        addTitleAttribute(element, attributes, supportsTitleOnTD);
        addTableCellAttributes(element, attributes);
View Full Code Here

            element.setAttribute ("overscan", buffer.toString ());
        }
    }

    private ReusableStringBuffer getScriptKeyHandlerBody (boolean create) {
        ReusableStringBuffer buffer = (ReusableStringBuffer)
            getPageHead().getAttribute (SCRIPT_KEYHANDLER_BODY_NAME);
        if (buffer == null && create) {
            buffer = new ReusableStringBuffer (32);
            getPageHead().setAttribute (SCRIPT_KEYHANDLER_BODY_NAME, buffer);
        }

        return buffer;
    }
View Full Code Here

     * an access key script and an initial focus meta tag is these have
     * been specified.
     */
    protected void writePageHead() throws IOException {

        ReusableStringBuffer keyHandlerBody = getScriptKeyHandlerBody (false);
        if (keyHandlerBody != null && keyHandlerBody.length () != 0) {
            DOMOutputBuffer script = getScriptBuffer ();
            script.appendEncoded ("function onKeyOutHandler (){ ")
                .appendEncoded (keyHandlerBody.getChars (),
                                0, keyHandlerBody.length ())
                .appendEncoded ("return true; }" +
                        "window.onkeyout = onKeyOutHandler;");
        }

        super.writePageHead ();
View Full Code Here

        }
        if (!legalActions.contains (action)){
            throw new IllegalArgumentException ();
        }

        ReusableStringBuffer keyHandlerBody = getScriptKeyHandlerBody (true);

        keyHandlerBody.append ("if (navigator.input.curKey == ")
            .append (keyCode)
            .append (") { document.")
            .append (element)
            .append ("." + action + "(); return false; }");
View Full Code Here

        String keyCode = getPlainText (object);
        if (keyCode == null || link == null) {
            return;
        }

        ReusableStringBuffer keyHandlerBody = getScriptKeyHandlerBody (true);

        keyHandlerBody.append ("if (navigator.input.curKey == ")
            .append (keyCode)
            .append (") { window.location.href = \"")
            .append (link)
            .append ("\"; return false; }");
View Full Code Here

TOP

Related Classes of com.volantis.synergetics.cornerstone.utilities.ReusableStringBuffer

Copyright © 2018 www.massapicom. 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.