Package org.jboss.as.console.client.widgets.popups

Examples of org.jboss.as.console.client.widgets.popups.DefaultPopup


    public Widget asWidget() {

        final LayoutPanel layout = new LayoutPanel();
        layout.setStyleName("footer-panel");

        final PopupPanel toolsPopup = new DefaultPopup(DefaultPopup.Arrow.BOTTOM);


        final List<String[]> toolReference = new ArrayList<String[]>();
        toolReference.add(new String[]{"Management Model", "browser"});
        toolReference.add(new String[]{"Expression Resolver", "expressions"});

        if(Diagnostics.isEnabled())
            toolReference.add(new String[]{"Diagnostics", "debug-panel"});

        final VerticalPanel toolsList = new VerticalPanel();
        toolsList.getElement().setAttribute("width", "160px");

        for(final String[] tool : toolReference)
        {
            InlineLink browser = new InlineLink(tool[0]);
            browser.getElement().setAttribute("style", "margin:4px");
            browser.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent clickEvent) {
                    toolsPopup.hide();
                    placeManager.revealPlace(
                            new PlaceRequest(NameTokens.ToolsPresenter).with("name", tool[1])
                    );
                }
            });

            toolsList.add(browser);
        }
        toolsPopup.setWidget(toolsList);

        final HTML toolsLink = new HTML("Tools");
        toolsLink.addStyleName("footer-link");
        toolsLink.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent clickEvent) {

                int listHeight = toolsList.getWidgetCount() * 25;

                toolsPopup.setPopupPosition(
                        toolsLink.getAbsoluteLeft()-45,
                        toolsLink.getAbsoluteTop()-(listHeight-25)-50

                );

                toolsPopup.setWidth("165");
                toolsPopup.setHeight(listHeight +"");

                toolsPopup.show();
            }
        });

        HTML settings = new HTML(Console.CONSTANTS.common_label_settings());
        settings.addStyleName("footer-link");
View Full Code Here


    }

    public Widget asWidget() {

        final String panelId = "popup_"+ HTMLPanel.createUniqueId();
        popup = new DefaultPopup(DefaultPopup.Arrow.TOPLEFT);

        popup.getElement().setId(panelId);

        VerticalPanel layout = new VerticalPanel();
        layout.setStyleName("fill-layout-width");
View Full Code Here

        this.context = context;
    }

    public Widget asWidget() {
        final LayoutPanel layout = new LayoutPanel();
        final PopupPanel toolsPopup = new DefaultPopup(DefaultPopup.Arrow.BOTTOM);
        final List<String[]> toolReference = new ArrayList<String[]>();

        if(context.isSuperUser()) {
            toolReference.add(new String[]{"Management Model", "browser"});
        }

        toolReference.add(new String[]{"Expression Resolver", "expressions"});
        if (diagnostics.isEnabled()) {
            toolReference.add(new String[]{"Diagnostics", "debug-panel"});
        }

        // only enabled in dev mode
        if (!GWT.isScript()) {
            toolReference.add(new String[]{"Modelling", "mbui-workbench"});
            toolReference.add(new String[]{"Resource Access", "access-log"});
        }

        final VerticalPanel toolsList = new VerticalPanel();
        toolsList.getElement().setAttribute("width", "160px");
        for(final String[] tool : toolReference)
        {
            InlineLink browser = new InlineLink(tool[0]);
            browser.getElement().setAttribute("style", "margin:4px");
            browser.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent clickEvent) {
                    toolsPopup.hide();
                    placeManager.revealPlace(
                            new PlaceRequest.Builder().nameToken(NameTokens.ToolsPresenter).with("name", tool[1])
                                    .build());
                }
            });
            toolsList.add(browser);
        }
        toolsPopup.setWidget(toolsList);

        final HTML toolsLink = new HTML("<i class='icon-caret-up'></i>&nbsp;"+"Tools");
        toolsLink.addStyleName("footer-link");
        toolsLink.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent clickEvent) {
                int listHeight = toolsList.getWidgetCount() * 25;
                toolsPopup.setPopupPosition(
                        toolsLink.getAbsoluteLeft()-45,
                        toolsLink.getAbsoluteTop()-(listHeight-25)-50
                );
                toolsPopup.setWidth("165");
                toolsPopup.setHeight(listHeight +"");
                toolsPopup.show();
            }
        });

        HTML settings = new HTML("<i class='icon-wrench'></i>&nbsp;"+Console.CONSTANTS.common_label_settings());
        settings.addStyleName("footer-link");
View Full Code Here

        SafeHtml principal = new SafeHtmlBuilder().appendHtmlConstant("<div class='header-textlink'>"+userHtml+"</div>").toSafeHtml();
        final HTML userButton = new HTML(principal);
        userButton.getElement().setAttribute("style", "cursor:pointer");
        tools.add(userButton);

        final DefaultPopup menuPopup = new DefaultPopup(DefaultPopup.Arrow.TOP);

        ClickHandler clickHandler = new ClickHandler() {
            public void onClick(ClickEvent event) {

                int width = 120;
                int height = 50;

                menuPopup.setPopupPosition(
                        userButton.getAbsoluteLeft() - (width+2- userButton.getOffsetWidth()) ,
                        userButton.getAbsoluteTop() + 25
                );

                menuPopup.show();

                menuPopup.setWidth(width+"px");
                menuPopup.setHeight(height+"px");
            }
        };

        userButton.addClickHandler(clickHandler);
        HTML logoutHtml = new HTML("<i class='icon-signout'></i>&nbsp;" + Console.CONSTANTS.common_label_logout());
        logoutHtml.getElement().setAttribute("style", "cursor:pointer;padding-top:3px");
        logoutHtml.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {

                menuPopup.hide();

                Feedback.confirm(
                        Console.CONSTANTS.common_label_logout(),
                        Console.CONSTANTS.logout_confirm(),
                        new Feedback.ConfirmationHandler() {
                            @Override
                            public void onConfirmation(boolean isConfirmed) {
                                if (isConfirmed) {
                                    new LogoutCmd().execute();
                                }
                            }
                        }
                );
            }
        });

        logoutHtml.addStyleName("html-link");

        VerticalPanel usermenu = new VerticalPanel();
        usermenu.setStyleName("fill-layout-width");
        usermenu.addStyleName("user-menu");

        usermenu.add(new HTML("Roles:"));
        usermenu.add(new HTML(sb.toSafeHtml()));


        if(bootstrap.isSuperUser())
        {
            usermenu.add(new HTML("<hr/>"));
            HTML runAsBtn = new HTML();
            runAsBtn.addStyleName("html-link");

            SafeHtmlBuilder runAsRole = new SafeHtmlBuilder();
            runAsRole.appendHtmlConstant("<i class='icon-flag'></i>&nbsp;").appendEscaped("Run as");
            if (bootstrap.getRunAs()!=null) {
                runAsRole.appendHtmlConstant("&nbsp;").appendEscaped(bootstrap.getRunAs());
            } else {
                runAsRole.appendEscaped("...");
            }

            runAsBtn.setHTML(runAsRole.toSafeHtml());
            runAsBtn.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {

                    menuPopup.hide();

                    placeManager.revealPlace(
                            new PlaceRequest(NameTokens.ToolsPresenter).with("name", "run-as-role")
                    );


                }
            });
            usermenu.add(runAsBtn);
        }

        usermenu.add(new HTML("<hr/>"));
        usermenu.add(logoutHtml);
        menuPopup.setWidget(usermenu);

        top.add(tools);
        top.setWidgetRightWidth(tools, 15, Style.Unit.PX, 700, Style.Unit.PX);
        top.setWidgetTopHeight(tools, 2, Style.Unit.PX, 32, Style.Unit.PX);
        top.setWidgetHorizontalPosition(tools, Layout.Alignment.END);
View Full Code Here

    public Widget asWidget() {

        final LayoutPanel layout = new LayoutPanel();
        layout.setStyleName("footer-panel");

        final PopupPanel toolsPopup = new DefaultPopup(DefaultPopup.Arrow.BOTTOM);


        final List<String[]> toolReference = new ArrayList<String[]>();
        toolReference.add(new String[]{"Management Model", "browser"});
        toolReference.add(new String[]{"Expression Resolver", "expressions"});

        if(diagnostics.isEnabled())
        {
            toolReference.add(new String[]{"Diagnostics", "debug-panel"});
        }

        // only enabled in dev mode
        if(!GWT.isScript())
        {
            toolReference.add(new String[] {"Modelling", "mbui-workbench"});
        }

        final VerticalPanel toolsList = new VerticalPanel();
        toolsList.getElement().setAttribute("width", "160px");

        for(final String[] tool : toolReference)
        {
            InlineLink browser = new InlineLink(tool[0]);
            browser.getElement().setAttribute("style", "margin:4px");
            browser.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent clickEvent) {
                    toolsPopup.hide();
                    placeManager.revealPlace(
                            new PlaceRequest(NameTokens.ToolsPresenter).with("name", tool[1])
                    );
                }
            });

            toolsList.add(browser);
        }
        toolsPopup.setWidget(toolsList);

        final HTML toolsLink = new HTML("<i class='icon-caret-up'></i>&nbsp;"+"Tools");
        toolsLink.addStyleName("footer-link");
        toolsLink.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent clickEvent) {

                int listHeight = toolsList.getWidgetCount() * 25;

                toolsPopup.setPopupPosition(
                        toolsLink.getAbsoluteLeft()-45,
                        toolsLink.getAbsoluteTop()-(listHeight-25)-50

                );

                toolsPopup.setWidth("165");
                toolsPopup.setHeight(listHeight +"");

                toolsPopup.show();
            }
        });

        HTML settings = new HTML("<i class='icon-wrench'></i>&nbsp;"+Console.CONSTANTS.common_label_settings());
        settings.addStyleName("footer-link");
View Full Code Here

        SafeHtml principal = new SafeHtmlBuilder().appendHtmlConstant("<div class='header-textlink'>"+userHtml+"</div>").toSafeHtml();
        final HTML userButton = new HTML(principal);
        userButton.getElement().setAttribute("style", "cursor:pointer");
        tools.add(userButton);

        final DefaultPopup menuPopup = new DefaultPopup(DefaultPopup.Arrow.TOP);

        ClickHandler clickHandler = new ClickHandler() {
            public void onClick(ClickEvent event) {

                int width = 120;
                int height = 50;

                menuPopup.setPopupPosition(
                        userButton.getAbsoluteLeft() - (width+2- userButton.getOffsetWidth()) ,
                        userButton.getAbsoluteTop() + 25
                );

                menuPopup.show();

                menuPopup.setWidth(width+"px");
                menuPopup.setHeight(height+"px");
            }
        };

        userButton.addClickHandler(clickHandler);
        HTML logoutHtml = new HTML("<i class='icon-signout'></i>&nbsp;" + Console.CONSTANTS.common_label_logout());
        logoutHtml.getElement().setAttribute("style", "cursor:pointer;padding-top:3px");
        logoutHtml.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {

                menuPopup.hide();

                Feedback.confirm(
                        Console.CONSTANTS.common_label_logout(),
                        Console.CONSTANTS.logout_confirm(),
                        new Feedback.ConfirmationHandler() {
                            @Override
                            public void onConfirmation(boolean isConfirmed) {
                                if (isConfirmed) {
                                    new LogoutCmd().execute();
                                }
                            }
                        }
                );
            }
        });

        logoutHtml.addStyleName("html-link");

        VerticalPanel usermenu = new VerticalPanel();
        usermenu.setStyleName("fill-layout-width");
        usermenu.addStyleName("user-menu");

        usermenu.add(new HTML("Roles:"));
        usermenu.add(new HTML(sb.toSafeHtml()));


        if(bootstrap.isSuperUser())
        {
            usermenu.add(new HTML("<hr/>"));
            HTML runAsBtn = new HTML();
            runAsBtn.addStyleName("html-link");

            SafeHtmlBuilder runAsRole = new SafeHtmlBuilder();
            runAsRole.appendHtmlConstant("<i class='icon-flag'></i>&nbsp;").appendEscaped("Run as");
            if (bootstrap.getRunAs()!=null) {
                runAsRole.appendHtmlConstant("&nbsp;").appendEscaped(bootstrap.getRunAs());
            } else {
                runAsRole.appendEscaped("...");
            }

            runAsBtn.setHTML(runAsRole.toSafeHtml());
            runAsBtn.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {

                    menuPopup.hide();

                    placeManager.revealPlace(
                            new PlaceRequest(NameTokens.ToolsPresenter).with("name", "run-as-role")
                    );


                }
            });
            usermenu.add(runAsBtn);
        }

        usermenu.add(new HTML("<hr/>"));
        usermenu.add(logoutHtml);
        menuPopup.setWidget(usermenu);

        top.add(tools);
        top.setWidgetRightWidth(tools, 15, Style.Unit.PX, 700, Style.Unit.PX);
        top.setWidgetTopHeight(tools, 2, Style.Unit.PX, 32, Style.Unit.PX);
        top.setWidgetHorizontalPosition(tools, Layout.Alignment.END);
View Full Code Here

    }

    public Widget asWidget() {

        final String panelId = "popup_"+ HTMLPanel.createUniqueId();
        popup = new DefaultPopup(DefaultPopup.Arrow.TOPLEFT);
        popup.addStyleName("server-picker-popup");

        popup.getElement().setId(panelId);

        VerticalPanel layout = new VerticalPanel();
View Full Code Here

        String actualMessage = message.getConciseMessage().length()>40 ?
                message.getConciseMessage().substring(0, 40)+" ..." :
                message.getConciseMessage();

        displayPopup = new DefaultPopup(DefaultPopup.Arrow.RIGHTTOP);

        final HTML label = new HTML(message.getSeverity().getTag()+"&nbsp;"+actualMessage);

        label.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent clickEvent) {
View Full Code Here

    public Widget asWidget() {

        final LayoutPanel layout = new LayoutPanel();

        final PopupPanel toolsPopup = new DefaultPopup(DefaultPopup.Arrow.BOTTOM);

        final List<String[]> toolReference = new ArrayList<String[]>();

        if(context.isSuperUser()) {
            toolReference.add(new String[]{"Management Model", "browser"});
        }

        toolReference.add(new String[]{"Expression Resolver", "expressions"});

        if(diagnostics.isEnabled())
        {
            toolReference.add(new String[]{"Diagnostics", "debug-panel"});
        }

        // only enabled in dev mode
        if(!GWT.isScript())
        {
            toolReference.add(new String[] {"Modelling", "mbui-workbench"});
            toolReference.add(new String[] {"Resource Access", "access-log"});
        }


        final VerticalPanel toolsList = new VerticalPanel();
        toolsList.getElement().setAttribute("width", "160px");

        for(final String[] tool : toolReference)
        {
            InlineLink browser = new InlineLink(tool[0]);
            browser.getElement().setAttribute("style", "margin:4px");
            browser.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent clickEvent) {
                    toolsPopup.hide();
                    placeManager.revealPlace(
                            new PlaceRequest(NameTokens.ToolsPresenter).with("name", tool[1])
                    );
                }
            });

            toolsList.add(browser);
        }
        toolsPopup.setWidget(toolsList);

        final HTML toolsLink = new HTML("<i class='icon-caret-up'></i>&nbsp;"+"Tools");
        toolsLink.addStyleName("footer-link");
        toolsLink.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent clickEvent) {

                int listHeight = toolsList.getWidgetCount() * 25;

                toolsPopup.setPopupPosition(
                        toolsLink.getAbsoluteLeft()-45,
                        toolsLink.getAbsoluteTop()-(listHeight-25)-50

                );

                toolsPopup.setWidth("165");
                toolsPopup.setHeight(listHeight +"");
                toolsPopup.show();
            }
        });

        HTML settings = new HTML("<i class='icon-wrench'></i>&nbsp;"+Console.CONSTANTS.common_label_settings());
        settings.addStyleName("footer-link");
View Full Code Here

        SafeHtml principal = new SafeHtmlBuilder().appendHtmlConstant("<div class='header-textlink'>"+userHtml+"</div>").toSafeHtml();
        final HTML userButton = new HTML(principal);
        userButton.getElement().setAttribute("style", "cursor:pointer");
        tools.add(userButton);

        final DefaultPopup menuPopup = new DefaultPopup(DefaultPopup.Arrow.TOP);

        ClickHandler clickHandler = new ClickHandler() {
            public void onClick(ClickEvent event) {

                int width = 120;
                int height = 50;

                menuPopup.setPopupPosition(
                        userButton.getAbsoluteLeft() - (width+2- userButton.getOffsetWidth()) ,
                        userButton.getAbsoluteTop() + 25
                );

                menuPopup.show();

                menuPopup.setWidth(width+"px");
                menuPopup.setHeight(height+"px");
            }
        };

        userButton.addClickHandler(clickHandler);
        HTML logoutHtml = new HTML("<i class='icon-signout'></i>&nbsp;" + Console.CONSTANTS.common_label_logout());
        logoutHtml.getElement().setAttribute("style", "cursor:pointer;padding-top:3px");
        logoutHtml.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {

                menuPopup.hide();

                Feedback.confirm(
                        Console.CONSTANTS.common_label_logout(),
                        Console.CONSTANTS.logout_confirm(),
                        new Feedback.ConfirmationHandler() {
                            @Override
                            public void onConfirmation(boolean isConfirmed) {
                                if (isConfirmed) {
                                    new LogoutCmd().execute();
                                }
                            }
                        }
                );
            }
        });

        logoutHtml.addStyleName("html-link");

        VerticalPanel usermenu = new VerticalPanel();
        usermenu.setStyleName("fill-layout-width");
        usermenu.addStyleName("user-menu");

        usermenu.add(new HTML("Roles:"));
        usermenu.add(new HTML(sb.toSafeHtml()));


        if(bootstrap.isSuperUser())
        {
            usermenu.add(new HTML("<hr/>"));
            HTML runAsBtn = new HTML();
            runAsBtn.addStyleName("html-link");

            SafeHtmlBuilder runAsRole = new SafeHtmlBuilder();
            runAsRole.appendHtmlConstant("<i class='icon-flag'></i>&nbsp;").appendEscaped("Run as");
            if (bootstrap.getRunAs()!=null) {
                runAsRole.appendHtmlConstant("&nbsp;").appendEscaped(bootstrap.getRunAs());
            } else {
                runAsRole.appendEscaped("...");
            }

            runAsBtn.setHTML(runAsRole.toSafeHtml());
            runAsBtn.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {

                    menuPopup.hide();

                    placeManager.revealPlace(
                            new PlaceRequest(NameTokens.ToolsPresenter).with("name", "run-as-role")
                    );


                }
            });
            usermenu.add(runAsBtn);
        }

        usermenu.add(new HTML("<hr/>"));
        usermenu.add(logoutHtml);
        menuPopup.setWidget(usermenu);

        top.add(tools);
        top.setWidgetRightWidth(tools, 15, Style.Unit.PX, 700, Style.Unit.PX);
        top.setWidgetTopHeight(tools, 2, Style.Unit.PX, 32, Style.Unit.PX);
        top.setWidgetHorizontalPosition(tools, Layout.Alignment.END);
View Full Code Here

TOP

Related Classes of org.jboss.as.console.client.widgets.popups.DefaultPopup

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.