Package com.volantis.styling

Examples of com.volantis.styling.StylingFactory


        if (!deviceTablesCapable) {
            Styles styles = attributes.getStyles();           
           
            String value = horizontalAlignChecker.getAsString(styles);
            if (value != null) {
                StylingFactory factory = StylingFactory.getDefaultInstance();
                // Use the styles from the pane attributes. The styles
                // generated for the table elements (in super#openPane) will
                // only include the property values that are inherited when the
                // display property is one of the table keywords. Given that
                // we know we don't support tables and they will be converted
                // into p/div tags anyway, we might as well get the right
                // inherited styles here.
                Styles divStyles = factory.createInheritedStyles(styles,
                        DisplayKeywords.BLOCK);
                Element element = dom.openStyledElement("div", divStyles);
                element.setAttribute("align", value);
            }
        }
View Full Code Here


                DisplayKeywords.TABLE);

        addOptimizeAttribute(element, attributes.getPane());
        addPaneTableAttributes(element, attributes);

        StylingFactory factory = StylingFactory.getDefaultInstance();
        Styles rowStyles = factory.createInheritedStyles(tableStyles,
                DisplayKeywords.TABLE_ROW);
        dom.openStyledElement("tr", rowStyles);

        Styles cellStyles = factory.createInheritedStyles(rowStyles,
                DisplayKeywords.TABLE_CELL);

        // Move the padding style from the table to the cell. This is required
        // because we render cell padding as a cellpadding attribute on the
        // table and a padding CSS style. The cellpadding attribute is equivalent
        // to the padding style on the cell - applying the style to the table
        // results in the padding being set twice (once between the table and the
        // cell, once between the cell and its content).
        //
        // Note that we must do this after opening the table since the padding
        // information is required in order to specify the cellpadding attribute.
        moveProperty(tableStyles, cellStyles, StylePropertyDetails.PADDING_BOTTOM);
        moveProperty(tableStyles, cellStyles, StylePropertyDetails.PADDING_TOP);
        moveProperty(tableStyles, cellStyles, StylePropertyDetails.PADDING_LEFT);
        moveProperty(tableStyles, cellStyles, StylePropertyDetails.PADDING_RIGHT);

        Element cell = dom.openStyledElement("td", cellStyles);

        // Add the styles from the pane styles which were added to the table.
        // todo: This will cause the text-align style on the table to be
        // todo: ignored when generating the CSS (but will still be used for
        // todo: detecting inherited values. This should use the cell styles
        // todo: and copy the styles needed down from the table.
        addPaneCellAttributes(cell, tableStyles);

        // todo XDIME-CP check to see whether the tableStyles associated cannot be added to the td, if not then add the div, otherwise do not.
        if (supportsStyleSheets()) {
            Styles divStyles = factory.createInheritedStyles(cellStyles,
                    DisplayKeywords.BLOCK);
            Element div = dom.openStyledElement("div", divStyles);
            addCoreAttributes(div, attributes);
        } else {
            addCoreAttributes(element, attributes);
View Full Code Here

        Styles rowStyles = attributes.getStyles();

        // Create a table row with appropriate display
        dom.openStyledElement("tr", rowStyles, DisplayKeywords.TABLE_ROW);

        StylingFactory factory = StylingFactory.getDefaultInstance();
        Styles cellStyles = factory.createInheritedStyles(rowStyles,
                DisplayKeywords.TABLE_CELL);
        Element element = dom.openStyledElement("td", cellStyles);

        addRowIteratorPaneCellAttributes(element, attributes);
    }
View Full Code Here

                    DisplayKeywords.TABLE);

            addOptimizeAttribute(table,
                                 attributes.getPane().getOptimizationLevel());

            StylingFactory factory = StylingFactory.getDefaultInstance();
            Styles rowStyles = factory.createInheritedStyles(styles,
                    DisplayKeywords.TABLE_ROW);
            dom.openStyledElement("tr", rowStyles);
            Styles cellStyles = factory.createInheritedStyles(styles,
                    DisplayKeywords.TABLE_CELL);
            element = dom.openStyledElement("td", cellStyles);
            generatedPaneTable = true;
        }
View Full Code Here

            "", /* qName */
            "", /* type */
            "myId" /* value */
        );

        StylingFactory stylingFactory = StylingFactory.getDefaultInstance();
        elementStyles = stylingFactory.createStyles(null);

        // Setup XDIME processing environment
        pageCtxMock = new MarinerPageContextMock(
                "pageCtxMock", expectations);
       
View Full Code Here

        if ((parent.getHead() != table) || (parent.getTail() != table)) {
            Node child = parent.getHead();
            boolean previousNotTable = false;

            StylingFactory factory = StylingFactory.getDefaultInstance();
            Styles parentStyles = parent.getStyles();
            Styles tableStyles;
            if (parentStyles == null) {
               // This may occur if we are dealing with custom markup
                tableStyles = factory.createStyles (null);
                if (logger.isDebugEnabled ()) {
                    logger.debug("Encountered null styles on parent element "
                            + parent.getName ());
                }
            } else {
                tableStyles = factory.createInheritedStyles(parentStyles,
                        DisplayKeywords.TABLE);
            }
            newTable = allocateElement();
            newTable.setName(elementHelper.getTable());
            newTable.setStyles(tableStyles);
            newTable.setAttribute(OptimizationConstants.OPTIMIZATION_ATTRIBUTE,
                                  OptimizationConstants.OPTIMIZE_ALWAYS);

            while (child != null) {
                // Allocate a new row/cell within the new table to receive
                // the current td's first available child

                Styles rowStyles = factory.createInheritedStyles(tableStyles,
                        DisplayKeywords.TABLE_ROW);
                Element newRow = allocateElement();
                newRow.setName(elementHelper.getRow());
                newRow.setStyles(rowStyles);

                Styles cellStyles = factory.createInheritedStyles(rowStyles,
                        DisplayKeywords.TABLE_CELL);
                Element newCell = allocateElement();
                newCell.setName(elementHelper.getCell());
                newCell.setStyles(cellStyles);
View Full Code Here

        paneInstance.expects.getAttributes().returns(protocolPaneAttributes).any();
        return paneInstance;
    }

    private StylingEngine getStylingEngine() {
        StylingFactory stylingFactory = StylingFactory.getDefaultInstance();
        return stylingFactory.createStylingEngine();
    }
View Full Code Here

     * @param element source element for the styles
     * @param newElement target element which will recive the inherited
     *                   styles
     */
    protected void addInheritedStyles(Element element, Element newElement) {
        final StylingFactory stylingFactory =
            StylingFactory.getDefaultInstance();
        Styles newStyles =
            stylingFactory.createInheritedStyles(element.getStyles(),
                    DisplayKeywords.INLINE);

        newElement.setStyles(newStyles);
    }
View Full Code Here

     * @return
     */
    private StylingEngine createStyling() {

        // Create the styling engine.
        StylingFactory stylingFactory = StylingFactory.getDefaultInstance();

        StyleSheetCompilerFactory inlineCompilerFactory =
                new InlineStyleSheetCompilerFactory(null);

        StylingEngine stylingEngine = stylingFactory.createStylingEngine(inlineCompilerFactory);

        // Create a CSS compiler.
        CSSCompilerBuilder builder = new CSSCompilerBuilder();
        builder.setStyleSheetCompilerFactory(
                DefaultStyleSheetCompilerFactory.getDefaultInstance());
View Full Code Here

    public StylingEngine getStylingEngine() {

        if (stylingEngine == null) {

            // todo Remove this hack to obtain the styling factory lazily when this class is refactored properly.
            StylingFactory stylingFactory = getStylingFactoryLazily();

            // create styling engine
            //provide the styling engine with an InlineStyleSheetCompilerFactory
            //so that it can compile any style attributes.
            InlineStyleSheetCompilerFactory styleSheetCompilerFactory =
                    getInlineStyleSheetCompilerFactory();

            stylingEngine = stylingFactory.createStylingEngine(
                    styleSheetCompilerFactory);

            // Initialise the evaluation context.
            EvaluationContext context = stylingEngine.getEvaluationContext();
            context.setProperty(FormatReferenceFinder.class,
View Full Code Here

TOP

Related Classes of com.volantis.styling.StylingFactory

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.