Package com.volantis.styling

Examples of com.volantis.styling.StylesMerger


     */
    private void separateMarkerAndContent(Element element,
                                          Styles markerStyles) {

        StylingFactory stylingFactory = StylingFactory.getDefaultInstance();
        StylesMerger stylesMerger = stylingFactory.getStylesMerger();

        Styles listItemStyles = element.getStyles();

        // Styles for the content are the same as the original styles for the
        // list item.
        Styles contentStyles = listItemStyles;

        // Styles for the list item are calculated by overriding the styles
        // for the list item with the styles from the marker. This will
        // modify and return the marker styles.
        listItemStyles = stylesMerger.merge(markerStyles, listItemStyles);

        // Update the list item styles associated with the element.
        element.setStyles(listItemStyles);

        DOMFactory domFactory = element.getDOMFactory();
View Full Code Here


                Element parent = dom.getCurrentElement();

                addCoreAttributes(parent, attributes);

                // preserve any Styles information on the pane element
                StylesMerger merger = StylingFactory.getDefaultInstance().
                        getStylesMerger();
                // save the display style property value as the parent.setStyles
                // may change it and we don't want that
                final StyleValue oldValue =
                    parent.getStyles().getPropertyValues().getStyleValue(
                        StylePropertyDetails.DISPLAY);
                parent.setStyles(merger.merge(attributes.getStyles(),
                        parent.getStyles()));
                parent.getStyles().getPropertyValues().
                    setComputedAndSpecifiedValue(StylePropertyDetails.DISPLAY, oldValue);
            } else if (rendering == PaneRendering.CREATE_ENCLOSING_ELEMENT) {
                // write out a div element so that the wrapped elements
View Full Code Here

        // Add the attributes which can only be added to a table cell.
        addPaneCellAttributes(element, styles);

        // preserve any Styles information on the pane element
        if (styles != null) {
            StylesMerger merger = StylingFactory.getDefaultInstance().
                    getStylesMerger();
            final Styles mergedStyles = merger.merge(
                    styles, element.getStyles());
            // restore the table-cell display style
            mergedStyles.getPropertyValues().setComputedValue(
                StylePropertyDetails.DISPLAY, DisplayKeywords.TABLE_CELL);
            mergedStyles.getPropertyValues().setSpecifiedValue(
View Full Code Here

         *                 <code>null</code>.
         */
        private void promoteStylesAsNeeded(Element innerDiv,
                                           Element outerDiv) {
            if (innerDiv.getStyles() != null) {
                StylesMerger merger = StylingFactory.
                        getDefaultInstance().getStylesMerger();
                outerDiv.setStyles(merger.merge(innerDiv.getStyles(),
                        outerDiv.getStyles()));
            }
        }
View Full Code Here

                setDisplayProperty(styles, DisplayKeywords.INLINE);
                if (styles != null) {
                    if (newParent.getName() != null) {
                        // new parent is not null named, and will appear in the
                        // output, therefore the styles can be pushed up
                        StylesMerger merger = StylingFactory.
                                getDefaultInstance().getStylesMerger();
                        newParent.setStyles(merger.merge(styles,
                                newParent.getStyles()));
                    } else {
                        // the new parent is null named, and will not appear in
                        // the output, so the styles should be pushed down to
                        // be preserved. merge the element's styles with those
                        // of its children
                        DescendantStylesMerger merger =
                                getDescendantStylesMerger();
                        merger.pushStylesDown(cell);
                    }
                }
                cell.setName(null);
                cell.addChildrenToTail(newParent);
            } else {
View Full Code Here

    }


    public void visit(Element element) {
        Element parent = element.getParent();
        StylesMerger merger = StylingFactory.
                getDefaultInstance().getStylesMerger();
        Styles mergedStyles = merger.merge(element.getStyles(),
                parent.getStyles());
        element.setStyles(mergedStyles);
    }
View Full Code Here

        }

        // preserve any originalParent Styles on the table too...
        final Styles originalParentStyles = originalParent.getStyles();
        if (originalParentStyles != null) {
            StylesMerger merger =
                    StylingFactory.getDefaultInstance().getStylesMerger();
            final Styles oldTableStyles = table.getStyles();
            final Styles tableStyles =
                    merger.merge(oldTableStyles, originalParentStyles);

            // Make sure that the table gets the correct display.
            tableStyles.getPropertyValues().setComputedValue(
                    StylePropertyDetails.DISPLAY, DisplayKeywords.TABLE);
            table.setStyles(tableStyles);
View Full Code Here

        // 1. containing row
        // 2. optional containing table section (header, footer or body)
        // 3. (great) containing table
        // 4. original cell

        StylesMerger merger = stylingFactory.getStylesMerger();
        Styles cellStyles = cell.getStyles();
        Styles mergedStyles;

        String[] attributes = getPreserveStyleAttributes();

        Element row = cell.getParent();
        Element tableSection = row.getParent();

        // 1. containing row
        preserveStyleAttributes(cell, row, attributes);
        mergedStyles = merger.merge(cellStyles, row.getStyles());

        if (tableSection != table) {
            // 2. optional containing table section
            preserveStyleAttributes(cell, tableSection, attributes);
            mergedStyles = merger.merge(mergedStyles, tableSection.getStyles());
        }

        // 3. containing table
        preserveStyleAttributes(cell, table, attributes);


        mergedStyles = merger.merge(mergedStyles, table.getStyles());

        // 4. original cell
        preserveStyleAttributes(cell, originalCell, attributes);
        if (firstRow) {
            mergeSizeAttribute(cell, originalCell, "width",
                    StylePropertyDetails.WIDTH, numberOfCells);
        }

        if (firstColumn) {
            mergeSizeAttribute(cell, originalCell, "height",
                    StylePropertyDetails.HEIGHT, numberOfCells);
        }

        StyleValue calculatedWidth = cell.getStyles().getPropertyValues()
                .getStyleValue(StylePropertyDetails.WIDTH);
        StyleValue calculatedHeight = cell.getStyles().getPropertyValues()
                .getStyleValue(StylePropertyDetails.HEIGHT);

        mergedStyles = merger.merge(mergedStyles, originalCell.getStyles());

        // update the cell with the merged styles
        MutablePropertyValues mergedValues =
            mergedStyles.getPropertyValues();
View Full Code Here

TOP

Related Classes of com.volantis.styling.StylesMerger

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.