Package com.volantis.mcs.protocols.ticker.attributes

Examples of com.volantis.mcs.protocols.ticker.attributes.FeedAttributes


     * @param context
     */
    public FeedElement(XDIMEContextInternal context) {
        super(TickerElements.FEED, context);
       
        protocolAttributes = new FeedAttributes();       
    }
View Full Code Here


        return super.callOpenOnProtocol(context, attributes);
    }
   
    // Javadoc inherited
    protected void initialiseElementSpecificAttributes(XDIMEContextInternal context, XDIMEAttributes attributes) throws XDIMEException {
        FeedAttributes feedAttributes = (FeedAttributes) protocolAttributes;
       
        feedAttributes.setChannel(attributes.getValue("", "channel"));
        feedAttributes.setItemDisplay(attributes.getValue("", "item-display"));
    
        // Store the attributes in its parent, if it's feedable.
        XDIMEElementInternal parent = getParent();
       
        if (parent instanceof Feedable) {
View Full Code Here

           
            itemTemplateOutputBuffer = null;
        }
       
        // If this widget contains feed element, render the controller.
        FeedAttributes feedAttributes = ((CarouselAttributes)attributes).getFeedAttributes();
       
        if (feedAttributes != null) {

            // The controller class is defined in the vfc-ticker JavaScript
            // library, so we need to add the requirement here.
            require(ElementDefaultRenderer.WIDGET_TICKER, protocol, attributes);           

            StringWriter scriptWriter = new StringWriter();

            scriptWriter.write("Ticker.createCarouselController({");
            scriptWriter.write("carousel:Widget.getInstance(" + createJavaScriptString(attributes.getId()) + ")");
           
            if (feedAttributes.getChannel() != null) {
                scriptWriter.write(", channel:" + createJavaScriptString(feedAttributes.getChannel()));
            }

            if (feedAttributes.getItemDisplay() != null) {
                scriptWriter.write(", itemDisplayId:" + createJavaScriptString(feedAttributes.getItemDisplay()));
            }
           
            if (itemTemplateId != null) {
                scriptWriter.write(", itemTemplate:" + createJavaScriptWidgetReference(itemTemplateId));
               
View Full Code Here

        if (tickerTapeAttributes.getRefreshAttributes() != null ) {
            require(WidgetScriptModules.BASE_AJAX, protocol, attributes);
        }

        // If this widget contains feed, render the controller.
        FeedAttributes feedAttributes = tickerTapeAttributes.getFeedAttributes();
       
        String separatorId = null;

        if (feedAttributes != null) {
            // Apply the separator
            Styles separatorStyles = feedAttributes.getStyles();
           
            if (separatorStyles != null) {
                separatorStyles = separatorStyles.getNestedStyles(PseudoElements.MCS_ITEM);
               
                if (separatorStyles != null) {
                    separatorStyles = separatorStyles.getNestedStyles(PseudoElements.MCS_BETWEEN);                   
                   
                    if (separatorStyles != null) {
                        /* If the <feed> element contains styles specified for the
                         * ::mcs-item::mcs-between pseudo-element, render the separator.
                         *                       
                         * The rendered markup will look like:
                         * <span id="xxx">
                         *     <span style="xxx"> *** </span>
                         * </span>
                         */
                       
                        // First, create a span element which would act as a placeholder
                        // for the actual content of the separator.
                        Element placeholderSpan = getCurrentBuffer(protocol).openStyledElement("span",
                                StylingFactory.getDefaultInstance()
                                    .createInheritedStyles(
                                        protocol.getMarinerPageContext().getStylingEngine()
                                        .getStyles(), DisplayKeywords.NONE));

                        separatorId = protocol.getMarinerPageContext().generateUniqueFCID();
                       
                        placeholderSpan.setAttribute("id", separatorId);
                       
                        // Now, create a span element which would hold styles, and the actual
                        // separator content.
                        Element contentSpan = getCurrentBuffer(protocol).openStyledElement("span",
                                separatorStyles);

                        // Copy the content of the separator, if there's any.
                        StyleValue separatorContent = separatorStyles.getPropertyValues()
                                .getSpecifiedValue(StylePropertyDetails.CONTENT);
               
                        if (separatorContent != null) {
                            ((DOMProtocol)protocol).getInserter().insert(contentSpan, separatorContent);
                        }  
                       
                        // Close the content span.
                        getCurrentBuffer(protocol).closeElement("span");

                        // Close the placeholder span.
                        getCurrentBuffer(protocol).closeElement("span");
                    }
                }
            }           
        }
       
        RefreshAttributes refreshAttributes = ((TickerTapeAttributes) attributes)
                .getRefreshAttributes();
       
        // Read ticker-tape properties out of style attributes.
        StylesExtractor styles = createStylesExtractor(protocol, attributes.getStyles());
       
        // Prepare Javascript content.
        StringWriter scriptWriter = new StringWriter();
        scriptWriter.write(createJavaScriptWidgetRegistrationOpening(attributes.getId()));
       
        addCreatedWidgetId(attributes.getId());
       
        scriptWriter.write("new Widget.TickerTape(" + createJavaScriptString(attributes.getId()) + ", {");

        // Render scroll type: scroll, slide or alternating.
        scriptWriter.write("style:" + createJavaScriptString(styles.getMarqueeStyle()) + ",");
        scriptWriter.write("focusable:" + createJavaScriptString(styles.getFocusStyle()) + ",");

        // Render scroll attributes: direction, FPS & CPS.
        scriptWriter.write("scroll:{");
        scriptWriter.write("direction:" + createJavaScriptString(styles.getMarqueeDirection()) + ",");
        scriptWriter.write("framesPerSecond:" + styles.getFrameRate() + ",");
        scriptWriter.write("charsPerSecond:" + styles.getMarqueeSpeed());
        scriptWriter.write("}");   

        // Render refresh attributes: URL & interval.
        if (refreshAttributes != null) {
            scriptWriter.write(",refresh:{");
            scriptWriter.write("url:" + createJavaScriptString(refreshAttributes.getSrc()) + ",");
            scriptWriter.write("interval:" + createJavaScriptString(refreshAttributes.getInterval()));
            scriptWriter.write("}");
        }

        int repetitions = styles.getMarqueeRepetitions();
        scriptWriter.write(",repetitions:" + ((repetitions != Integer.MAX_VALUE) ?
                        Integer.toString(repetitions) : createJavaScriptString("infinite")));

        // Render closing parentheses.
        scriptWriter.write("})");
       
        scriptWriter.write(createJavaScriptWidgetRegistrationClosure());

        scriptWriter.write(";");
       
        // Render the item template outside Carousel content.
        if (itemTemplateOutputBuffer != null) {
            getCurrentBuffer(protocol).transferContentsFrom(itemTemplateOutputBuffer);
           
            itemTemplateOutputBuffer = null;
        }
       
        // If this widget contains feed, render the controller.
        if (feedAttributes != null) {

            // The controller class is defined in the vfc-ticker JavaScript
            // library, so we need to add the requirement here.
            require(ElementDefaultRenderer.WIDGET_TICKER, protocol, attributes);                       

            scriptWriter.write("Ticker.createTickerTapeController({tickerTape:Widget.getInstance(" +
                    createJavaScriptString(attributes.getId()) + ")");

            if (feedAttributes.getChannel() != null) {
                scriptWriter.write(", channel:" + createJavaScriptString(feedAttributes.getChannel()));
            }

            if (feedAttributes.getItemDisplay() != null) {
                scriptWriter.write(", itemDisplayId:" + createJavaScriptString(feedAttributes.getItemDisplay()));
            }
           
            if (separatorId != null) {
                scriptWriter.write(", separatorId:" + createJavaScriptString(separatorId));
            }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.protocols.ticker.attributes.FeedAttributes

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.