Package com.volantis.mcs.protocols.widgets

Examples of com.volantis.mcs.protocols.widgets.FoldingItemContext


        }

        // Retrieve current FoldingItem context.
        // This should not be null, since the Detail element
        // can only be inside the FoldingItem element.
        FoldingItemContext foldingItemContext =
            ((FoldingItemDefaultRenderer)getWidgetDefaultModule(protocol).getFoldingItemRenderer())
                .getCurrentContext();
       
        // Open outer <div> element.
      Element outerElement = openDivElement(attributes.getStyles(), getCurrentBuffer(protocol));
       
        // Generate an ID for it, if it's not already there.
        if (attributes.getId() == null) {
            attributes.setId(protocol.getMarinerPageContext().generateUniqueFCID());
        }
       
        outerElement.setAttribute("id", attributes.getId());
           
        // Store an ID in the FoldingItem context, so it can be
        // retrieved later, while rendering JavaScript code.
        foldingItemContext.setDetailsElementId(attributes.getId());

        // Lock an element, so it'll not be removed from the
        // DOM by any transformer/optimiser.
        setElementLocked(protocol, outerElement);
       
View Full Code Here


        }

        // Push new folding item context, making it a current one.
        pushContext();

        FoldingItemContext foldingItemContext = getCurrentContext();
       
        // different way of rendering markers - now each of them
        // rendered separately, moreover markers should be set both
        // for folding-item and for summary element
        Styles foldedMarkerStyles = getFoldedMarkerStyles(protocol, attributes);
        if(foldedMarkerStyles != null) {
            foldingItemContext.setFoldedMarkerStyles(foldedMarkerStyles);
        }

        Styles unfoldedMarkerStyles = getUnfoldedMarkerStyles(protocol, attributes);
        if(unfoldedMarkerStyles != null) {
            foldingItemContext.setUnfoldedMarkerStyles(unfoldedMarkerStyles);
        }

        require(MODULE, protocol, attributes);
       
        if (attributes.getId() == null) {
View Full Code Here

            require(WidgetScriptModules.BASE_AJAX, protocol, attributes);
        }

        closeDivElement(protocol);
       
        FoldingItemContext foldingItemContext = getCurrentContext();
                       
        DOMOutputBuffer currentBuffer = getCurrentBuffer(protocol);

        String textToScript;
        String textLoadAttr = "";
            LoadAttributes loadAttributes = ((FoldingItemAttributes) attributes)
                    .getLoadAttributes();
            if (loadAttributes != null) {
                textLoadAttr = ", load_src: " + createJavaScriptString(loadAttributes.getSrc())
                        + ", load_when: " + createJavaScriptString(loadAttributes.getWhen());
            }

            Styles styles = attributes.getStyles();
            StyleValue unfoldon = styles.getPropertyValues().getSpecifiedValue(StylePropertyDetails.MCS_TOGGLE_EVENT);

            StyleValue initial_state = styles.getPropertyValues().getSpecifiedValue(StylePropertyDetails.MCS_INITIAL_STATE);
           
            // Create instances of styles extractors.
            StylesExtractor stylesExtractor =
                createStylesExtractor(protocol, attributes.getStyles());
           
            StylesExtractor disappearStylesExtractor =
                createStylesExtractor(protocol, attributes.getStyles());
            disappearStylesExtractor.setPseudoClass(StatefulPseudoClasses.MCS_CONCEALED);
           
            StylesExtractor unfoldedStylesExtractor =
                createStylesExtractor(protocol, attributes.getStyles());
            unfoldedStylesExtractor.setPseudoClass(StatefulPseudoClasses.MCS_UNFOLDED);
           
            stylesExtractor.getJavaScriptStyles();
            unfoldedStylesExtractor.getJavaScriptStyles();

            StringBuffer textBuffer = new StringBuffer("Widget.register(")
                    .append(createJavaScriptString(attributes.getId()))
                    .append(",new Widget.FoldingItem(")
                    .append(createJavaScriptString(attributes.getId()))
                    .append(", {")
                    .append("delay: ").append(stylesExtractor.getTransitionInterval())
                    .append(", ").append(getDisappearableOptions(disappearStylesExtractor))
                    .append(", ").append(getAppearableOptions(stylesExtractor))
                   
                    // This part of code is used to apply unfolded style for the widget:folding-item
                    // element. As this is not required in the functional spec, the code is commented.
                    // In the future, if there'll be a requirement to specify unfolded styles
                    // for the widget:folding-item element, just uncomment this line and it'll work.
                    //+ ", unfoldedElementStyle: " + unfoldedStylesExtractor.getJavaScriptStyles()
                   
                    .append(", unfoldedFtElementStyle: ").append(foldingItemContext.getSummaryUnfoldedStyles())
                    .append(", ftElementId: ")
                    .append(createJavaScriptString(foldingItemContext.getSummaryElementId()))
                    .append(", fdElementId: ")
                    .append(createJavaScriptString(foldingItemContext.getDetailsElementId()))
                    .append(", foldedSpanId: ")
                    .append(createJavaScriptString(foldingItemContext.getFoldedMarkerId()))
                    .append(", unfoldedSpanId: ")
                    .append(createJavaScriptString(foldingItemContext.getUnfoldedMarkerId()))
                    .append(((unfoldon == null) ? ""
                            : ", unfoldon: "+ createJavaScriptString(unfoldon.getStandardCSS())))
                    .append(((initial_state == null) ? ""
                            : ", initial_state: "+ createJavaScriptString(initial_state.getStandardCSS())))
                    .append(textLoadAttr).append("}));");
View Full Code Here

     * Creates and returns new instance of FoldingItemContext.
     *
     * @return The FoldingItemContext.
     */
    private FoldingItemContext createContext() {
        return new FoldingItemContext();
    }
View Full Code Here

       
        if (!isWidgetSupported(protocol)) {
            return;
        }
       
        FoldingItemContext foldingItemContext =
            ((FoldingItemDefaultRenderer)getWidgetDefaultModule(protocol).getFoldingItemRenderer())
                .getCurrentContext();
       
        DOMOutputBuffer currentBuffer = getCurrentBuffer(protocol);
       
        // Render "summary" element
        Element element = openDivElement(attributes.getStyles(), currentBuffer);

        if (attributes.getId() == null) {
            attributes.setId(protocol.getMarinerPageContext().generateUniqueFCID());
        }

        element.setAttribute("id", attributes.getId());
       
        setElementLocked(protocol, element);
       
        foldingItemContext.setSummaryElementId(attributes.getId());

        // each marker (folded,unfolded) will be rendered separately
        // because marker could be also defined for folding-item
        // so its value is stored in folding-item context
        // if undefined for summary - value from folding-item is used (if defined)
        // if defined for summary - used no matter if defined for folding-item also

        Styles foldedMarkerStyles = getFoldedMarkerStyles(protocol, attributes);

        String foldedMarkerId = renderFoldedMarker(protocol, DEFAULT_FOLDED_MARKER, foldedMarkerStyles, foldingItemContext.getFoldedMarkerStyles());

        // the same scenario for unfolded
        Styles unfoldedMarkerStyles = getUnfoldedMarkerStyles(protocol, attributes);

        String unfoldedMarkerId = renderUnfoldedMarker(protocol, DEFAULT_UNFOLDED_MARKER, unfoldedMarkerStyles, foldingItemContext.getUnfoldedMarkerStyles());

       
        foldingItemContext.setFoldedMarkerId(foldedMarkerId);       
        foldingItemContext.setUnfoldedMarkerId(unfoldedMarkerId);
       
        // Retrieve unfolded styles for further rendering
        StylesExtractor stylesExtractor = createStylesExtractor(protocol, attributes.getStyles());
       
        stylesExtractor.setPseudoClass(StatefulPseudoClasses.MCS_UNFOLDED);
       
        String unfoldedStyles = stylesExtractor.getJavaScriptStyles();
       
        foldingItemContext.setSummaryUnfoldedStyles(unfoldedStyles);
    }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.protocols.widgets.FoldingItemContext

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.