Package com.volantis.styling

Examples of com.volantis.styling.Styles


     * Verify that if the mcs-form-action-image property has a valid URL and
     * mcs-image is set to MarinerImageEnumeration#NONE, the
     * mcs-form-action-image url is returned from XHTMLBasic#getActionURL.
     */
    public void testGetActionURLWithMCSImageOfNoneAndMCSFormImage() {
        final Styles styles = StylesBuilder.getEmptyStyles();
        styles.getPropertyValues().setComputedValue(
                StylePropertyDetails.MCS_IMAGE,
                MCSImageKeywords.NONE);
        styles.getPropertyValues().setComputedValue(
                StylePropertyDetails.MCS_FORM_ACTION_IMAGE,
                styleValueFactory.getURI(null, FORM_IMAGE_URL));

        String url = protocol.getActionImageURL(styles);
        if (protocol.supportsImageButtons) {
View Full Code Here


    /**
     * Verify that if both the mcs-image and mcs-form-action-image properties
     * have null values, XHTMLBasic#getActionURL returns null.
     */
    public void testGetActionURLWithNoImages() {
        final Styles styles = StylesBuilder.getEmptyStyles();
        String url = protocol.getActionImageURL(styles);
        assertNull(url);
    }
View Full Code Here

     * Verify that if both the mcs-image and mcs-form-action-image properties
     * are set to MarinerImageEnumeration#NONE, XHTMLBasic#getActionURL returns
     * null.
     */
    public void testGetActionURLWithImagesSetToNone() {
        final Styles styles = StylesBuilder.getEmptyStyles();
        styles.getPropertyValues().setComputedValue(
                StylePropertyDetails.MCS_IMAGE,
                MCSImageKeywords.NONE);
        styles.getPropertyValues().setComputedValue(
                StylePropertyDetails.MCS_FORM_ACTION_IMAGE,
                MCSImageKeywords.NONE);
        String url = protocol.getActionImageURL(styles);
        assertNull(url);
    }
View Full Code Here

        privateSetUp();

        TableAttributes tableAttributes = new TableAttributes();
        tableAttributes.setStyles(StylesBuilder.getInitialValueStyles());
        CaptionAttributes captionAttributes = new CaptionAttributes();
        Styles captionStyles = StylesBuilder.getInitialValueStyles();
        captionStyles.getPropertyValues().setComputedValue(
                StylePropertyDetails.CAPTION_SIDE, captionSide);
        captionAttributes.setStyles(captionStyles);

        // Write an empty table with a caption
        protocol.openTable(buffer, tableAttributes);
View Full Code Here

        buffer.initialise();

        Pane pane = new Pane(canvasLayout);
        pane.setName(PANE_NAME);
        PaneAttributes paneAttributes = new PaneAttributes();
        Styles paneStyles = StylesBuilder.getSparseStyles("padding: 10px");
        paneAttributes.setStyles(paneStyles);
        paneAttributes.setPane(pane);

        protocol.openPaneTable(buffer, paneAttributes);
        Element tableElement = (Element) buffer.getRoot().getHead();
        assertTrue("Root element should be a table", "table".equals(tableElement.getName()));
        String cellPadding = tableElement.getAttributeValue("cellpadding");
        assertNotNull("Table should have cell padding attribute set", cellPadding);
        assertEquals("Cell padding should be 10 pixels", "10", cellPadding);

        Styles tableStyles = tableElement.getStyles();
        assertNull("Table should have no padding (bottom)",
                tableStyles.getPropertyValues().
                getSpecifiedValue(StylePropertyDetails.PADDING_BOTTOM));
        assertNull("Table should have no padding (top)",
                tableStyles.getPropertyValues().
                getSpecifiedValue(StylePropertyDetails.PADDING_TOP));
        assertNull("Table should have no padding (left)",
                tableStyles.getPropertyValues().
                getSpecifiedValue(StylePropertyDetails.PADDING_LEFT));
        assertNull("Table should have no padding (right)",
                tableStyles.getPropertyValues().
                getSpecifiedValue(StylePropertyDetails.PADDING_RIGHT));

        // We test for the computed values being null - the current
        // implementation sets them to null. In theory having the default value
        // for the computed value here should be acceptable.
        assertNull("Table should have no padding (bottom)",
                tableStyles.getPropertyValues().
                getComputedValue(StylePropertyDetails.PADDING_BOTTOM));
        assertNull("Table should have no padding (top)",
                tableStyles.getPropertyValues().
                getComputedValue(StylePropertyDetails.PADDING_TOP));
        assertNull("Table should have no padding (left)",
                tableStyles.getPropertyValues().
                getComputedValue(StylePropertyDetails.PADDING_LEFT));
        assertNull("Table should have no padding (right)",
                tableStyles.getPropertyValues().
                getComputedValue(StylePropertyDetails.PADDING_RIGHT));

        Element rowElement = (Element) tableElement.getHead();
        Element cellElement = (Element) rowElement.getHead();

        Styles cellStyles = cellElement.getStyles();
        StyleValue expectedPadding = StyleValueFactory.getDefaultInstance().
            getLength(null, 10, LengthUnit.PX);
        // Check the computed values for the table cell (since these are the
        // values that will be displayed
        assertEquals("Cell should have 10px padding (bottom)", expectedPadding,
                cellStyles.getPropertyValues().
                getComputedValue(StylePropertyDetails.PADDING_BOTTOM));
        assertEquals("Cell should have 10px padding (top)", expectedPadding,
                cellStyles.getPropertyValues().
                getComputedValue(StylePropertyDetails.PADDING_TOP));
        assertEquals("Cell should have 10px padding (left)", expectedPadding,
                cellStyles.getPropertyValues().
                getComputedValue(StylePropertyDetails.PADDING_LEFT));
        assertEquals("Cell should have 10px padding (right)", expectedPadding,
                cellStyles.getPropertyValues().
                getComputedValue(StylePropertyDetails.PADDING_RIGHT));
    }
View Full Code Here

        // =====================================================================
        //   Test Expectations
        // =====================================================================

        Styles styles = new StylesImpl();

        Styles nestedStyles = styles.getNestedStyles(pseudoStyleEntityMock);
        MutablePropertyValues nestedValues = nestedStyles.getPropertyValues();
        assertNotNull("Nested styles", nestedStyles);
        assertNotNull("Nested values", nestedValues);

        Styles foundStyles = styles.findNestedStyles(pseudoStyleEntityMock);
        MutablePropertyValues foundValues = foundStyles.getPropertyValues();
        assertSame("Found and got styles", nestedStyles, foundStyles);
        assertSame("Found and got values", nestedValues, foundValues);
    }
View Full Code Here

        return engine;
    }

    private StyleValue getContainerValue(
            StylingEngine engine, final StyleProperty property) {
        Styles styles = engine.getStyles();
        MutablePropertyValues propertyValues = styles.getPropertyValues();
        return propertyValues.getComputedValue(
                property);
    }
View Full Code Here

        renderer.open(buffer, item);

        AnchorAttributes attributes = (AnchorAttributes)PrivateAccessor.
                getField(renderer, "attributes");
        assertNotNull("MCS Attributes should not be null", attributes);
        Styles styles = attributes.getStyles();

        assertNotNull("The Styles on the MCS Attributes must not be null",
                styles);
        assertEquals("The styles on the MCS Attributes must be the same " +
                "as the styles on the ElementDetails",
View Full Code Here

        throws RendererException {

        MenuLabel label = item.getLabel();
        MenuIcon icon = label.getIcon();
        ElementDetails elementDetails = icon.getElementDetails();
        Styles styles = null;
        if (elementDetails != null) {
            styles = elementDetails.getStyles();
        }

        DOMOutputBuffer outputBuffer = (DOMOutputBuffer) buffer;
View Full Code Here

        // Build a very simple menu with a single item which contains a label
        // with some text and an icon.
        MenuModelBuilder builder = new ConcreteMenuModelBuilder();
        builder.startMenu();

        Styles menuStyles = StylesBuilder.getCompleteStyles(
                (imageStyle == null ? "" :
                "mcs-menu-image-style: " + imageStyle + "; ") +
                (textStyle == null ? "" :
                "mcs-menu-text-style: " + textStyle + "; ") +
                (orderStyle == null ? "" :
View Full Code Here

TOP

Related Classes of com.volantis.styling.Styles

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.