Package com.volantis.mcs.protocols.styles

Examples of com.volantis.mcs.protocols.styles.ValueHandlerToPropertyAdapter


    private final WMLRootConfiguration configuration;

    public WMLDOMTransformer(WMLRoot protocol, boolean honoursAlignment) {

        // Initialise the style value handlers.
        paragraphAlignHandler = new ValueHandlerToPropertyAdapter(
            StylePropertyDetails.TEXT_ALIGN,
            new KeywordValueHandler(
                    WMLParagraphAlignKeywordMapper.getDefaultInstance()));

        paragraphModeHandler = new DefaultingPropertyHandler(
                new ValueHandlerToPropertyAdapter(
                        StylePropertyDetails.WHITE_SPACE,
                        new KeywordValueHandler(WMLParagraphModeKeywordMapper
                                .getDefaultInstance())), "wrap");

        deviceHonoursAlignOnParagraphWhenModeNowrap = honoursAlignment;
View Full Code Here


    // Javadoc inherited.
    protected void initialiseStyleHandlers() {
        super.initialiseStyleHandlers();

        // Initialise the style value handlers.
        horizontalAlignChecker = new ValueHandlerToPropertyAdapter(
                StylePropertyDetails.TEXT_ALIGN,
                new KeywordValueHandler(
                        HTMLiModeDivHorizontalAlignKeywordMapper.
                                getDefaultInstance()),
                NoopPropertyUpdater.getDefaultInstance());

        horizontalAlignHandler = new ValueHandlerToPropertyAdapter(
                StylePropertyDetails.TEXT_ALIGN,
                new KeywordValueHandler(
                        HTMLiModeDivHorizontalAlignKeywordMapper.
                                getDefaultInstance()),
                PropertyClearer.getDefaultInstance());
View Full Code Here

    // Javadoc inherited.
    protected void initialiseStyleHandlers() {
        super.initialiseStyleHandlers();

        widthHandler = new ValueHandlerToPropertyAdapter(
            StylePropertyDetails.WIDTH,
            new PositivePixelLengthHandler());
        heightHandler = new ValueHandlerToPropertyAdapter(
            StylePropertyDetails.HEIGHT,
            new PositivePixelLengthHandler());

        lineHeightRenderer = new ValueHandlerToPropertyAdapter(
                StylePropertyDetails.LINE_HEIGHT,
                new PositivePixelLengthOrPercentageHandler());

        wordSpacingRenderer = new ValueHandlerToPropertyAdapter(
                StylePropertyDetails.WORD_SPACING,
                new PositivePixelLengthOrPercentageHandler());
    }
View Full Code Here

        // center and justify are both treated as center which is the default.
        DefaultKeywordMapper alignmentMapper = new DefaultKeywordMapper();
        alignmentMapper.addMapping(TextAlignKeywords.LEFT, "left");
        alignmentMapper.addMapping(TextAlignKeywords.RIGHT, "right");

        horizontalRuleAlignHandler = new ValueHandlerToPropertyAdapter(StylePropertyDetails.TEXT_ALIGN,
                new KeywordValueHandler(alignmentMapper));

        DefaultKeywordMapper shadeMapper = new DefaultKeywordMapper();
        shadeMapper.addMapping(BorderStyleKeywords.SOLID, "true");

        horizontalRuleShadeHandler = new ValueHandlerToPropertyAdapter(StylePropertyDetails.BORDER_TOP_STYLE,
                new KeywordValueHandler(shadeMapper));

        horizontalRuleSizeHandler = new ValueHandlerToPropertyAdapter(StylePropertyDetails.HEIGHT,
                new PositivePixelLengthHandler());

        // noWrap property
        // noWrapMapper maps "noWrap" to the NOWRAP value and will null to other
        // values
        final DefaultKeywordMapper noWrapMapper = new DefaultKeywordMapper();
        noWrapMapper.addMapping(WhiteSpaceKeywords.NOWRAP, "noWrap");

        noWrapHandler = new ValueHandlerToPropertyAdapter(StylePropertyDetails.WHITE_SPACE,
                new KeywordValueHandler(noWrapMapper));
    }
View Full Code Here

     * Initialise style handlers.
     */
    protected void initialiseStyleHandlers() {
        // Initialise style value handlers.
        colorValueHandler = new ColorHandler();
        colorHandler = new ValueHandlerToPropertyAdapter(
            StylePropertyDetails.COLOR, colorValueHandler);
        backgroundColorHandler = new ValueHandlerToPropertyAdapter(
            StylePropertyDetails.BACKGROUND_COLOR, colorValueHandler);
        backgroundComponentHandler = new BackgroundComponentHandler(
            context.getPolicyReferenceResolver(), context.getAssetResolver(),
            context.getTranscodableUrlResolver());

        // todo The instance created here is exactly the same as the one created in the BackgroundComponentHandler so reuse it.
        // This may not be sensible if there are issues with sharing code with state in it.
        mcsImageHandler = new ValueHandlerToPropertyAdapter(
            StylePropertyDetails.MCS_IMAGE,
            new BackgroundImageHandler(context.getPolicyReferenceResolver(),
                context.getAssetResolver(),
                context.getTranscodableUrlResolver()));

        // A border should only be rendered if the border style is not none
        // and the border width is valid.
        final ChoicePropertyHandler borderWidthHandler =
            new ChoicePropertyHandler();
        borderWidthHandler.addHandlers(PropertyGroups.BORDER_WIDTH_PROPERTIES,
                                       new PositivePixelLengthHandler());

        final ChoicePropertyHandler borderStyleHandler =
            new ChoicePropertyHandler();
        borderStyleHandler.addHandlers(PropertyGroups.BORDER_STYLE_PROPERTIES,
                new ValueRendererChecker() {
                    public void visit(StyleKeyword value,
                                      Object object) {
                        if (value != BorderStyleKeywords.NONE) {
                            string = "true";
                        }
                    }
                });

        borderHandler = new AbstractPropertyHandler() {
            public boolean isSignificant(PropertyValues propertyValues) {
                return borderStyleHandler.isSignificant(propertyValues) &&
                    borderWidthHandler.isSignificant(propertyValues);
            }

            public String getAsString(MutablePropertyValues propertyValues) {
                return borderStyleHandler.isSignificant(propertyValues) ?
                    borderWidthHandler.getAsString(propertyValues) : null;
            }
        };

        if (context.getDeviceName().endsWith("Netscape4")) {
            borderHandler = new DefaultingPropertyHandler(borderHandler, "0");
        }

        borderSpacingHandler = new AverageBorderSpacingRenderer();
        marginEdgeHandler = new PositivePixelLengthHandler();
        marginTopHandler =
            new ValueHandlerToPropertyAdapter(StylePropertyDetails.MARGIN_TOP,
                                              marginEdgeHandler);

        ChoicePropertyHandler choicePropertyHandler =
            new ChoicePropertyHandler();
        choicePropertyHandler.addHandlers(
View Full Code Here

                "valign",
                new KeywordValueHandler(
                        XHTMLBasicTableCellVerticalAlignKeywordMapper.getDefaultInstance()),
                PropertyClearer.getDefaultInstance());

        widthChecker = new ValueHandlerToPropertyAdapter(
                StylePropertyDetails.WIDTH,
                new PositivePixelLengthOrPercentageHandler(),
                new NoopPropertyUpdater());
        widthHandler = new ValueHandlerToPropertyAdapter(
                StylePropertyDetails.WIDTH,
                new PositivePixelLengthOrPercentageHandler(),
                PropertyClearer.getDefaultInstance());
        tableWidthChecker = new ValueHandlerToPropertyAdapter(
                StylePropertyDetails.WIDTH,
                new PositivePixelLengthOrPercentageHandler(100),
                new NoopPropertyUpdater());
        tableWidthHandler = new ValueHandlerToPropertyAdapter(
                StylePropertyDetails.WIDTH,
                new PositivePixelLengthOrPercentageHandler(100),
                PropertyClearer.getDefaultInstance());

        heightChecker = new ValueHandlerToPropertyAdapter(
                StylePropertyDetails.HEIGHT,
                new PositivePixelLengthOrPercentageHandler(),
                NoopPropertyUpdater.getDefaultInstance());
        heightHandler = new ValueHandlerToPropertyAdapter(
                StylePropertyDetails.HEIGHT,
                new PositivePixelLengthOrPercentageHandler(),
                PropertyClearer.getDefaultInstance());

        mcsRowsHandler = new ValueHandlerToPropertyAdapter(
                StylePropertyDetails.MCS_ROWS, new IntegerHandler());

        mcsColumnsHandler = new ValueHandlerToPropertyAdapter(
                StylePropertyDetails.MCS_COLUMNS, new IntegerHandler());

    }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.protocols.styles.ValueHandlerToPropertyAdapter

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.