Package com.volantis.mcs.protocols.trans

Examples of com.volantis.mcs.protocols.trans.TransTableHelper


        Element t = containingCell.getParent().getElement();
        Element c = containingCell.getElement();
        String width = table.getAttributeValue("width");
        String rowspan = c.getAttributeValue("rowspan");
        String colspan = c.getAttributeValue("colspan");
        TransTableHelper h = TransTableHelper.getInstance();

        boolean canOptimize =
                h.isZero(table.getAttributeValue("border")) &&
                h.isZero(t.getAttributeValue("border")) &&
                ((rowspan == null) || "1".equals(rowspan)) &&
                ((colspan == null) || "1".equals(colspan)) &&
                h.match(table, t, "cellspacing") &&
                h.match(table, t, "cellpadding") &&
                ((width == null) || "100%".equals(width));

        if (canOptimize) {
            PropertyValues outerProps = null;
            PropertyValues innerProps = null;
            StyleValue styleWidth = null;
            if (t.getStyles() != null) {
                outerProps = t.getStyles().getPropertyValues();
            }
            if (table.getStyles() != null) {
                innerProps = table.getStyles().getPropertyValues();
                styleWidth = innerProps.getComputedValue(
                        StylePropertyDetails.WIDTH);
            }
           
            canOptimize = canOptimize &&
                    (innerProps == null || (styleWidth == null ||
                    styleWidth.equals(hundredPercent) ||
                    styleWidth == WidthKeywords.AUTO) &&
                    h.isBorderInsignificant(innerProps)) &&
                    (outerProps == null || h.isBorderInsignificant(outerProps)) &&
                    h.paddingMatches(innerProps, outerProps);
        }

        return canOptimize;
    }
View Full Code Here


     * Check whether a given table element has stylistic attributes.
     * @param table a table Element
     */
    private boolean hasStyleAttributes(Element table) {
        boolean hasStyleAttrs = false;
        TransTableHelper tth = TransTableHelper.getInstance();
        Iterator styleAttrs = STYLE_ATTRS.iterator();
        while(styleAttrs.hasNext() && !hasStyleAttrs) {
            String styleAttr = (String) styleAttrs.next();
            hasStyleAttrs = tth.tableHasAttribute(table, transFactory,
                    styleAttr, true);
        }

        return hasStyleAttrs;
    }
View Full Code Here

    protected boolean canOptimizeStyle(TransCell containingCell) {
        Element t = containingCell.getParent().getElement();
        Element c = containingCell.getElement();
        String rowspan = c.getAttributeValue("rowspan");
        String colspan = c.getAttributeValue("colspan");
        TransTableHelper h = TransTableHelper.getInstance();

        // Note that these tests are in "expense" order so common, simple
        // failures are detected before expending too much processing on
        // the more complex checks
        boolean canOptimize = (table.getAttributeValue("colwidths") == null) &&
            (t.getAttributeValue("colwidths") == null) &&
            (table.getAttributeValue("bgimage") == null) &&
            (t.getAttributeValue("bgimage") == null) &&
            (c.getAttributeValue("tabindex") == null) &&
            (c.getAttributeValue("id") == null) &&
            h.isZero(c.getAttributeValue("width")) &&
            h.isZero(c.getAttributeValue("height")) &&
            h.isZero(table.getAttributeValue("width")) &&
            h.isZero(table.getAttributeValue("height")) &&
            ((rowspan == null) || "1".equals(rowspan)) &&
            ((colspan == null) || "1".equals(colspan)) &&
            h.match(table, t, "rowgap") &&
            h.match(table, t, "colgap") &&
            h.match(table, t, "update") &&
            !h.tableContains(table, getFactory(), "onevent", false) &&
            !h.tableContains(t, getFactory(), "onevent", false) &&
            !h.tableHasId(table, getFactory(), false);

        if (canOptimize) {
            PropertyValues outerCellProps = null;
            PropertyValues tableProps = null;
            StyleValue outerCellWidth = null;
            StyleValue outerCellHeight = null;
            StyleValue tableWidth = null;
            StyleValue tableHeight = null;

            if (c.getStyles() != null) {
                outerCellProps = c.getStyles().getPropertyValues();
                outerCellWidth = outerCellProps.getComputedValue(
                        StylePropertyDetails.WIDTH);
                outerCellHeight = outerCellProps.getComputedValue(
                        StylePropertyDetails.HEIGHT);
            }
            if (table.getStyles() != null) {
                tableProps = table.getStyles().getPropertyValues();
                tableWidth = tableProps.getComputedValue(
                        StylePropertyDetails.WIDTH);
                tableHeight = tableProps.getComputedValue(
                        StylePropertyDetails.HEIGHT);
            }

            canOptimize = canOptimize &&
                    (tableProps == null ||
                    (tableWidth == null ||
                    h.isStyleValueZero(tableWidth)) &&
                    (tableHeight == null || h.isStyleValueZero(tableHeight))) &&
                    (outerCellProps == null ||
                    (outerCellWidth == null ||
                    h.isStyleValueZero(outerCellWidth)) &&
                    (outerCellHeight == null ||
                    h.isStyleValueZero(outerCellHeight)));
        }

        return canOptimize;
    }
View Full Code Here

        Element t = containingCell.getParent().getElement();
        Element c = containingCell.getElement();
        String width = table.getAttributeValue("width");
        String rowspan = c.getAttributeValue("rowspan");
        String colspan = c.getAttributeValue("colspan");
        TransTableHelper h = TransTableHelper.getInstance();

        // Note that these tests are in "expense" order so common, simple
        // failures are detected before expending too much processing on
        // the more complex checks
        boolean canOptimize = (table.getAttributeValue("summary") == null) &&
            (c.getAttributeValue("id") == null) &&
            (table.getAttributeValue("onclick") == null) &&
            (table.getAttributeValue("ondblclick") == null) &&
            (table.getAttributeValue("onkeydown") == null) &&
            (table.getAttributeValue("onkeypress") == null) &&
            (table.getAttributeValue("onkeyup") == null) &&
            (table.getAttributeValue("onmousedown") == null) &&
            (table.getAttributeValue("onmousemove") == null) &&
            (table.getAttributeValue("onmouseout") == null) &&
            (table.getAttributeValue("onmouseover") == null) &&
            (table.getAttributeValue("onmouseup") == null) &&
            (t.getAttributeValue("onclick") == null) &&
            (t.getAttributeValue("ondblclick") == null) &&
            (t.getAttributeValue("onkeydown") == null) &&
            (t.getAttributeValue("onkeypress") == null) &&
            (t.getAttributeValue("onkeyup") == null) &&
            (t.getAttributeValue("onmousedown") == null) &&
            (t.getAttributeValue("onmousemove") == null) &&
            (t.getAttributeValue("onmouseout") == null) &&
            (t.getAttributeValue("onmouseover") == null) &&
            (t.getAttributeValue("onmouseup") == null) &&
            ((rowspan == null) || "1".equals(rowspan)) &&
            ((colspan == null) || "1".equals(colspan)) &&
            h.isZero(table.getAttributeValue("border")) &&
            h.isZero(t.getAttributeValue("border")) &&
            h.isZero(c.getAttributeValue("height")) &&
            h.isZero(c.getAttributeValue("width")) &&
            h.match(table, t, "cellspacing") &&
            h.match(table, t, "cellpadding") &&
            h.match(table, t, "dir") &&
            h.match(table, t, "frame") &&
            h.match(table, t, "lang") &&
            h.match(table, t, "rules") &&
            h.match(table, t, "style") &&
            ((table.getAttributeValue("title") == null) ||
             h.match(table, t, "title")) &&
            ((width == null) ||
             "100%".equals(width)) &&
            !h.tableHasId(table, getFactory(), false);

        return canOptimize && !areTableStylesSignificant(c, t, h);
    }
View Full Code Here

        Element t = containingCell.getParent().getElement();
        Element c = containingCell.getElement();
        String width = table.getAttributeValue("width");
        String rowspan = c.getAttributeValue("rowspan");
        String colspan = c.getAttributeValue("colspan");
        TransTableHelper h = TransTableHelper.getInstance();

        // Note that these tests are in "expense" order so common, simple
        // failures are detected before expending too much processing on
        // the more complex checks
        boolean canOptimize = (table.getAttributeValue("summary") == null) &&
            (c.getAttributeValue("id") == null) &&
            (table.getAttributeValue("onclick") == null) &&
            (table.getAttributeValue("ondblclick") == null) &&
            (table.getAttributeValue("onkeydown") == null) &&
            (table.getAttributeValue("onkeypress") == null) &&
            (table.getAttributeValue("onkeyup") == null) &&
            (table.getAttributeValue("onmousedown") == null) &&
            (table.getAttributeValue("onmousemove") == null) &&
            (table.getAttributeValue("onmouseout") == null) &&
            (table.getAttributeValue("onmouseover") == null) &&
            (table.getAttributeValue("onmouseup") == null) &&
            (t.getAttributeValue("onclick") == null) &&
            (t.getAttributeValue("ondblclick") == null) &&
            (t.getAttributeValue("onkeydown") == null) &&
            (t.getAttributeValue("onkeypress") == null) &&
            (t.getAttributeValue("onkeyup") == null) &&
            (t.getAttributeValue("onmousedown") == null) &&
            (t.getAttributeValue("onmousemove") == null) &&
            (t.getAttributeValue("onmouseout") == null) &&
            (t.getAttributeValue("onmouseover") == null) &&
            (t.getAttributeValue("onmouseup") == null) &&
            ((rowspan == null) || "1".equals(rowspan)) &&
            ((colspan == null) || "1".equals(colspan)) &&
            h.isZero(table.getAttributeValue("border")) &&
            h.isZero(t.getAttributeValue("border")) &&
            h.match(table, t, "cellspacing") &&
            h.match(table, t, "cellpadding") &&
            h.match(table, t, "dir") &&
            h.match(table, t, "frame") &&
            h.match(table, t, "lang") &&
            h.match(table, t, "rules") &&
            h.match(table, t, "style") &&
            ((table.getAttributeValue("title") == null) ||
             h.match(table, t, "title")) &&
            ((width == null) ||
             "100%".equals(width)) &&
            !h.tableHasId(table, getFactory(), false);

//        if (canOptimize) {
//            MutablePropertyValues rowProps = null;
//            MutablePropertyValues tableProps = null;
//            StyleValue styleWidth = null;
View Full Code Here

TOP

Related Classes of com.volantis.mcs.protocols.trans.TransTableHelper

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.