Package org.andromda.cartridges.jsf.component.html

Examples of org.andromda.cartridges.jsf.component.html.HtmlPopupFrame


     */
    public void decode(
        final FacesContext context,
        final UIComponent component)
    {
        final HtmlPopupFrame command = (HtmlPopupFrame)component;
        final Map parameters = context.getExternalContext().getRequestParameterMap();
        final String popupAction = (String)parameters.get(PopupRenderer.POPUP_FRAME_HIDDEN);
        if (popupAction != null && popupAction.equals(getHiddenFieldOpen(
                    command,
                    context)))
        {
            final MethodBinding binding = command.getActionOpen();
            command.setAction(binding);
            final ActionEvent actionEvent = new ActionEvent(command);
            if (command.isImmediate())
            {
                command.queueEventImmediate(actionEvent);
            }
            else
            {
                command.queueEventNormal(actionEvent);
            }
        }
        else if (popupAction != null && popupAction.equals(getHiddenFieldClose(
                    command,
                    context)))
        {
            final MethodBinding binding = command.getActionClose();
            if (binding != null)
            {
                command.setAction(binding);
                ActionEvent actionEvent = new ActionEvent(command);
                command.queueEventImmediate(actionEvent);
            }
        }
    }
View Full Code Here


    public void encodeBegin(
        FacesContext context,
        UIComponent component)
        throws IOException
    {
        final HtmlPopupFrame command = (HtmlPopupFrame)component;
        if (command.isRendered())
        {
            final UIForm uiform = this.getForm(
                    context,
                    command);
            if (uiform == null)
            {
                throw new RuntimeException("JSF h:form needed to use this component");
            }

            final String formClientId = uiform.getClientId(context);

            // start differences from command link
            final ResponseWriter writer = context.getResponseWriter();
            commonJavascript(
                context,
                command);

            writer.startElement(
                "a",
                command);
            writer.writeAttribute(
                "href",
                "#",
                null);

            String form = "document.forms['" + formClientId + "']";

            StringBuffer buffer = new StringBuffer();
            buffer.append("showPopupFrame(");
            buffer.append(form);
            buffer.append(",this,event");
            buffer.append(",'");
            buffer.append(getHiddenFieldClose(
                    command,
                    context));
            buffer.append("','");
            buffer.append(command.getStyleClassFrame() == null ? "" : command.getStyleClassFrame());
            buffer.append("','");
            buffer.append(DEFAULT_STYLE);
            buffer.append(command.getStyleFrame() == null ? "" : command.getStyleFrame());
            buffer.append("',");
            buffer.append(command.getMouseHorizPos() == null ? "0" : command.getMouseHorizPos());
            buffer.append(",");
            buffer.append(command.getMouseVertPos() == null ? "0" : command.getMouseVertPos());
            buffer.append(",");
            buffer.append(command.getAbsolute() == null ? "false" : command.getAbsolute());
            buffer.append(",");
            buffer.append(command.getCenter() == null ? "false" : command.getCenter());
            buffer.append(",'");
            buffer.append(command.getHeight() == null ? "" : command.getHeight());
            buffer.append("','");
            buffer.append(command.getWidth() == null ? "" : command.getWidth());
            buffer.append("','");
            buffer.append(command.getScrolling() == null ? "auto" : command.getScrolling().toLowerCase());
            buffer.append("');");

            buffer.append(form);
            buffer.append(".target='");
            buffer.append("hiddenPopupFrameTarget");
            buffer.append("';");

            buffer.append(form);
            buffer.append(".elements['");
            buffer.append(POPUP_FRAME_HIDDEN);
            buffer.append("'].value='");
            buffer.append(getHiddenFieldOpen(
                    command,
                    context));
            buffer.append("';");

            buffer.append(form);
            buffer.append(".submit();");
            buffer.append(form);
            buffer.append(".elements['");
            buffer.append(POPUP_FRAME_HIDDEN);
            buffer.append("'].value='';");

            buffer.append(form);
            buffer.append(".target='';");

            buffer.append("return false;");

            writer.writeAttribute(
                "onclick",
                buffer.toString(),
                null);

            writer.writeAttribute(
                "id",
                command.getClientId(context),
                null);

            final String accesskey = command.getAccesskey();
            if (accesskey != null)
            {
                writer.writeAttribute(
                    "accesskey",
                    accesskey,
                    "accesskey");
            }

            final String directory = command.getDir();
            if (directory != null)
            {
                writer.writeAttribute(
                    "dir",
                    directory,
                    "dir");
            }

            final String lang = command.getLang();
            if (lang != null)
            {
                writer.writeAttribute(
                    "lang",
                    lang,
                    "lang");
            }

            final String tabindex = command.getTabindex();
            if (tabindex != null)
            {
                writer.writeAttribute(
                    "tabindex",
                    tabindex,
                    "tabindex");
            }

            final String title = command.getTitle();
            if (title != null)
            {
                writer.writeAttribute(
                    "title",
                    title,
                    "title");
            }

            final String styleClass = command.getStyleClass();
            if (styleClass != null)
            {
                writer.writeAttribute(
                    "class",
                    styleClass,
                    "styleClass");
            }

            final String style = command.getStyle();
            if (style != null)
            {
                writer.writeAttribute(
                    "style",
                    style,
View Full Code Here

    }

    protected void setProperties(UIComponent component)
    {
        super.setProperties(component);
        HtmlPopupFrame command = null;
        try
        {
            command = (HtmlPopupFrame)component;
        }
        catch (ClassCastException cce)
        {
            throw new IllegalStateException("Component " + component.toString() +
                " not expected type.  Expected: UICommand.  Perhaps you're missing a tag?");
        }

        if (value != null)
        {
            if (isValueReference(value))
            {
                ValueBinding binding = createValueBinding(value);
                command.setValueBinding(
                    "value",
                    binding);
            }
            else
            {
                command.setValue(value);
            }
        }
        if (accesskey != null)
        {
            if (isValueReference(accesskey))
            {
                ValueBinding binding = createValueBinding(accesskey);
                command.setValueBinding(
                    "accesskey",
                    binding);
            }
            else
            {
                command.getAttributes().put(
                    "accesskey",
                    accesskey);
            }
        }
        if (dir != null)
        {
            if (isValueReference(dir))
            {
                ValueBinding binding = createValueBinding(dir);
                command.setValueBinding(
                    "dir",
                    binding);
            }
            else
            {
                command.getAttributes().put(
                    "dir",
                    dir);
            }
        }
        if (lang != null)
        {
            if (isValueReference(lang))
            {
                ValueBinding binding = createValueBinding(lang);
                command.setValueBinding(
                    "lang",
                    binding);
            }
            else
            {
                command.getAttributes().put(
                    "lang",
                    lang);
            }
        }
        if (tabindex != null)
        {
            if (isValueReference(tabindex))
            {
                ValueBinding binding = createValueBinding(tabindex);
                command.setValueBinding(
                    "tabindex",
                    binding);
            }
            else
            {
                command.getAttributes().put(
                    "tabindex",
                    tabindex);
            }
        }
        if (title != null)
        {
            if (isValueReference(title))
            {
                ValueBinding binding = createValueBinding(title);
                command.setValueBinding(
                    "title",
                    binding);
            }
            else
            {
                command.getAttributes().put(
                    "title",
                    title);
            }
        }
        if (style != null)
        {
            if (isValueReference(style))
            {
                ValueBinding binding = createValueBinding(style);
                command.setValueBinding(
                    "style",
                    binding);
            }
            else
            {
                command.getAttributes().put(
                    "style",
                    style);
            }
        }
        if (styleClass != null)
        {
            if (isValueReference(styleClass))
            {
                ValueBinding binding = createValueBinding(styleClass);
                command.setValueBinding(
                    "styleClass",
                    binding);
            }
            else
            {
                command.getAttributes().put(
                    "styleClass",
                    styleClass);
            }
        }
        if (absolute != null)
        {
            if (isValueReference(absolute))
            {
                ValueBinding binding = createValueBinding(absolute);
                command.setValueBinding(
                    "absolute",
                    binding);
            }
            else
            {
                command.getAttributes().put(
                    "absolute",
                    absolute);
            }
        }
        if (actionClose != null)
        {
            if (isValueReference(actionClose))
            {
                final MethodBinding binding = this.createMethodBinding(
                        actionClose,
                        new Class[0]);
                command.setActionClose(binding);
            }
            else
            {
                throw new IllegalStateException("Invalid actionClose." + actionClose);
            }
        }
        if (actionOpen != null)
        {
            if (isValueReference(actionOpen))
            {
                final MethodBinding binding = this.createMethodBinding(
                        actionOpen,
                        new Class[0]);
                command.setActionOpen(binding);
            }
            else
            {
                throw new IllegalStateException("Invalid actionOpen." + actionOpen);
            }
        }
        if (center != null)
        {
            if (isValueReference(center))
            {
                ValueBinding binding = createValueBinding(center);
                command.setValueBinding(
                    "center",
                    binding);
            }
            else
            {
                command.getAttributes().put(
                    "center",
                    center);
            }
        }
        if (immediate != null)
        {
            if (isValueReference(immediate))
            {
                ValueBinding binding = createValueBinding(immediate);
                command.setValueBinding(
                    "immediate",
                    binding);
            }
            else
            {
                command.getAttributes().put(
                    "immediate",
                    immediate);
            }
        }
        if (height != null)
        {
            if (isValueReference(height))
            {
                ValueBinding binding = createValueBinding(height);
                command.setValueBinding(
                    "height",
                    binding);
            }
            else
            {
                command.getAttributes().put(
                    "height",
                    height);
            }
        }
        if (width != null)
        {
            if (isValueReference(width))
            {
                ValueBinding binding = createValueBinding(width);
                command.setValueBinding(
                    "width",
                    binding);
            }
            else
            {
                command.getAttributes().put(
                    "width",
                    width);
            }
        }
        if (mouseHorizPos != null)
        {
            if (isValueReference(mouseHorizPos))
            {
                ValueBinding binding = createValueBinding(mouseHorizPos);
                command.setValueBinding(
                    "mouseHorizPos",
                    binding);
            }
            else
            {
                command.getAttributes().put(
                    "mouseHorizPos",
                    mouseHorizPos);
            }
        }
        if (mouseVertPos != null)
        {
            if (isValueReference(mouseVertPos))
            {
                ValueBinding binding = createValueBinding(mouseVertPos);
                command.setValueBinding(
                    "mouseVertPos",
                    binding);
            }
            else
            {
                command.getAttributes().put(
                    "mouseVertPos",
                    mouseVertPos);
            }
        }
        if (styleClassFrame != null)
        {
            if (isValueReference(styleClassFrame))
            {
                ValueBinding binding = createValueBinding(styleClassFrame);
                command.setValueBinding(
                    "styleClassFrame",
                    binding);
            }
            else
            {
                command.getAttributes().put(
                    "styleClassFrame",
                    styleClassFrame);
            }
        }
        if (styleFrame != null)
        {
            if (isValueReference(styleFrame))
            {
                ValueBinding binding = createValueBinding(styleFrame);
                command.setValueBinding(
                    "styleFrame",
                    binding);
            }
            else
            {
                command.getAttributes().put(
                    "styleFrame",
                    styleFrame);
            }
        }
        if (scrolling != null)
        {
            if (isValueReference(scrolling))
            {
                ValueBinding binding = createValueBinding(scrolling);
                command.setValueBinding(
                    "scrolling",
                    binding);
            }
            else
            {
                command.getAttributes().put(
                    "scrolling",
                    scrolling);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.andromda.cartridges.jsf.component.html.HtmlPopupFrame

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.