Package com.volantis.mcs.protocols.widgets.attributes

Examples of com.volantis.mcs.protocols.widgets.attributes.DismissAttributes


    private static final ExceptionLocalizer EXCEPTION_LOCALIZER =
            LocalizationFactory.createExceptionLocalizer(DismissElement.class);
   
    public DismissElement(XDIMEContextInternal context) {
        super(WidgetElements.DISMISS, context);
        protocolAttributes = new DismissAttributes();       
    }  
View Full Code Here


    }  
       
    protected void initialiseElementSpecificAttributes(XDIMEContextInternal context, XDIMEAttributes attributes)
        throws XDIMEException {

        DismissAttributes dismissAttrs = (DismissAttributes)protocolAttributes;

        // Propagate 'type' attribute
        dismissAttrs.setType(attributes.getValue("","type"));
       
        // Iterate the stack of XDIME elements from top to bottom,
        // looking for enclosing dismissable widget
        Dismissable widgetToDismiss = null;
        Stack stack = ((XDIMEContextImpl)context).getStack();
        // Start from the top of the stack.
        int elementIndex = stack.size() - 1;       
        while (elementIndex >= 0) {
            Object element = stack.elementAt(elementIndex);          
            if (element instanceof Dismissable) {
                widgetToDismiss = (Dismissable)element;
                dismissAttrs.setDismissableId(
                        widgetToDismiss.getDismissableId());
                break;
            }
            elementIndex--;
        }       
View Full Code Here

        DivAttributes divAttrs = new DivAttributes();
        divAttrs.setStyles(createCancelDialogButtonsDivStyles(protocol));
        openDivElement(protocol, divAttrs);
       
        // add first dialog button - yes
        DismissAttributes dismissAttributes = new DismissAttributes();
        dismissAttributes.setType("yes");
        dismissAttributes.setDismissableId(popupAttributes.getId());           
        // set default styles for dismis type yes
        dismissAttributes.setStyles(createCancelDialogButtonStyles(protocol));

        renderWidgetOpen(protocol, dismissAttributes);
        // TODO: should be localized
        currentBuffer.writeText("yes");
        renderWidgetClose(protocol, dismissAttributes);
        addUsedWidgetId(dismissAttributes.getId());

        // add second dialog button - no
        dismissAttributes = new DismissAttributes();
        dismissAttributes.setType("no");
        dismissAttributes.setDismissableId(popupAttributes.getId());
        // set default styles for dismis type no
        dismissAttributes.setStyles(createCancelDialogButtonStyles(protocol));

        renderWidgetOpen(protocol, dismissAttributes);
        // TODO: should be localized
        currentBuffer.writeText("no");
        renderWidgetClose(protocol, dismissAttributes);
        addUsedWidgetId(dismissAttributes.getId());

        closeDivElement(protocol);
       
        // close popup
        renderWidgetClose(protocol, popupAttributes);       
View Full Code Here

        // Render internal button
        renderWidgetClose(protocol, buttonAttributes);
        addUsedWidgetId(buttonAttributes.getId());

        // We need to access our attributes
        DismissAttributes dismissAttrs = (DismissAttributes)attributes;
       
        // If this happens, it is our bug, because all Dismissable widgets
        // must ensure that they have an id
        if (null == dismissAttrs.getDismissableId()) {
            throw new IllegalStateException("Id of widgets to dismiss not set");
        }
        addUsedWidgetId(dismissAttrs.getDismissableId());
       
        // Create the widget
        StringBuffer textBuffer
            = new StringBuffer(createJavaScriptWidgetRegistrationOpening(attributes.getId()))
            .append("new Widget.Dismiss(")
            .append(createJavaScriptString(dismissAttrs.getId()))
            .append(", ").append(createJavaScriptString(dismissAttrs.getType()))
            .append(", ").append(createJavaScriptWidgetReference(buttonAttributes.getId()))
            .append(", ").append(createJavaScriptWidgetReference(dismissAttrs.getDismissableId()))
            .append(")")
            .append(createJavaScriptWidgetRegistrationClosure());           
               
        writeJavaScript(textBuffer.toString());       
        addCreatedWidgetId(dismissAttrs.getId());       
    }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.protocols.widgets.attributes.DismissAttributes

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.