Package com.ponysdk.ui.server.basic

Examples of com.ponysdk.ui.server.basic.PMenuBar


        items.clear();
        initUI();
    }

    private void initUI() {
        menuBar = new PMenuBar();
        menuBar.setStyleName("pony-ActionToolbar");
        menuBar.setStyleProperty("marginRight", ".5em");

        startMenuItem = new PMenuItem("<<");
        menuBar.addItem(startMenuItem);
View Full Code Here


    protected void onFirstShowPage() {
        super.onFirstShowPage();

        final PVerticalPanel panel = new PVerticalPanel();

        final PMenuBar menuBar1 = createMenuBar(false);
        final PMenuBar menuBar2 = createMenuBar(true);
        final PMenuBar menuBar3 = createMenuBar(true);
        final PMenuBar menuBar4 = createMenuBar(true);

        panel.add(new PLabel("Horizontal Menu Bar [Default Style]"));
        panel.add(menuBar1);
        panel.add(new PLabel("Vertical Menu Bar [Default Style]"));
        panel.add(menuBar2);
        panel.add(new PLabel("Vertical Menu Bar [Light Style]"));
        panel.add(menuBar3);
        panel.add(new PLabel("Vertical Menu Bar [Toolbar Style]"));
        panel.add(menuBar4);

        menuBar2.setStylePrimaryName("samplePopup");
        menuBar3.addStyleName(PonySDKTheme.MENUBAR_LIGHT);
        menuBar4.setStyleName("pony-ActionToolbar");

        examplePanel.setWidget(panel);
    }
View Full Code Here

        examplePanel.setWidget(panel);
    }

    private PMenuBar createMenuBar(final boolean vertical) {
        final PMenuBar menuBar = new PMenuBar();
        final PMenuBar fileBar = new PMenuBar(vertical);

        menuBar.addItem("File", fileBar);

        final PMenuItem newItem = new PMenuItem("New");
        newItem.setCommand(new PCommand() {

            @Override
            public void execute() {
                PNotificationManager.notify("Menu Selection, " + newItem.getText(), Notification.HUMANIZED);
            }
        });
        final PMenuItem openItem = new PMenuItem("Open");
        openItem.setCommand(new PCommand() {

            @Override
            public void execute() {
                PNotificationManager.notify("Menu Selection, " + openItem.getText(), Notification.HUMANIZED);
            }
        });

        final PMenuItem closeItem = new PMenuItem("Close");
        openItem.setCommand(new PCommand() {

            @Override
            public void execute() {
                PNotificationManager.notify("Menu Selection, " + closeItem.getText(), Notification.HUMANIZED);
            }
        });

        fileBar.addItem(newItem);
        fileBar.addItem(openItem);
        fileBar.addItem(closeItem);
        fileBar.addSeparator();

        final PMenuBar recentItem = new PMenuBar(vertical);

        fileBar.addItem("Recent", recentItem);

        final PMenuItem recent1 = new PMenuItem("recent1");
        recent1.setCommand(new PCommand() {

            @Override
            public void execute() {
                PNotificationManager.notify("Menu Selection, " + recent1.getText(), Notification.HUMANIZED);
            }
        });
        final PMenuItem recent2 = new PMenuItem("recent2");
        recent2.setCommand(new PCommand() {

            @Override
            public void execute() {
                PNotificationManager.notify("Menu Selection, " + recent2.getText(), Notification.HUMANIZED);
            }
        });

        recentItem.addItem(recent1);
        recentItem.addSeparator();
        recentItem.addItem(recent2);

        return menuBar;
    }
View Full Code Here

        setVisible(false);
        initUI();
    }

    private void initUI() {
        menuBar = new PMenuBar();
        addStyleName(PonySDKTheme.PAGE_NAVIGATION);
        add(menuBar);

        startMenuItem = new PMenuItem("<<");
        menuBar.addItem(startMenuItem);
View Full Code Here

        updateUI(new RequestHandler() {

            @Override
            public void onRequest() {

                final PMenuBar subMenuBar = new PMenuBar();
                subMenuBar.addItem("SubItem1");
                subMenuBar.addItem("SubItem2");
                subMenuBar.addItem("SubItem3", new PTestCommand(eventsListener, "Click on SubItem3"));
                subMenuBar.ensureDebugId("subMenuBar1");

                final PMenuBar menuBar1 = new PMenuBar();
                menuBar1.ensureDebugId("menuBar1");
                menuBar1.addItem("Item 1");
                menuBar1.addItem("Item 2", new PTestCommand(eventsListener, "Click on command 2"));
                menuBar1.addItem("Item 3 with <font color='red'>html</font>", true, new PTestCommand(eventsListener, "Click on command 3"));
                menuBar1.addItem("SubMenu", subMenuBar);

                PRootPanel.get().add(menuBar1);
                register(menuBar1);
                register(subMenuBar);
            }
        });

        WebElement menuBar = findElementById("menuBar1");

        List<WebElement> elements = menuBar.findElements(By.tagName("td"));
        Assert.assertEquals(4, elements.size());
        Assert.assertEquals("Item 1", elements.get(0).getText());
        Assert.assertEquals("Item 2", elements.get(1).getText());
        Assert.assertEquals("Item 3 with html", elements.get(2).getText());
        Assert.assertEquals("SubMenu", elements.get(3).getText());

        final WebElement font = elements.get(2).findElement(By.tagName("font"));
        Assert.assertEquals("red", font.getAttribute("color"));

        elements.get(1).click();
        PTestEvent e1 = eventsListener.poll();
        Assert.assertEquals("Click on command 2", e1.getBusinessMessage());

        elements.get(2).click();
        e1 = eventsListener.poll();
        Assert.assertEquals("Click on command 3", e1.getBusinessMessage());

        elements.get(3).click();

        WebElement subMenuBar1 = findElementById("subMenuBar1");
        elements = subMenuBar1.findElements(By.tagName("td"));
        Assert.assertEquals(3, elements.size());

        elements.get(2).click();
        e1 = eventsListener.poll();
        Assert.assertEquals("Click on SubItem3", e1.getBusinessMessage());

        // clear
        updateUI(new RequestHandler() {

            @Override
            public void onRequest() {
                final PMenuBar subMenuBar = get("subMenuBar1");
                subMenuBar.clearItems();
                subMenuBar.addItem("SubItem4");
            }
        });

        // open sub menubar
        menuBar = findElementById("menuBar1");
View Full Code Here

        pagingActivity.setEventBus(localEventBus);
        pagingActivity.start(complexListView.getPagingLayout());
    }

    protected void buildActions() {
        final PMenuBar actionBar = new PMenuBar();
        actionBar.setStyleName("pony-ActionToolbar");

        refreshButton = new PMenuItem("Refresh", new PCommand() {

            @Override
            public void execute() {
                refresh();
            }
        });
        actionBar.addItem(refreshButton);
        actionBar.addSeparator();

        resetButton = new PMenuItem("Reset", new PCommand() {

            @Override
            public void execute() {
                reset();
            }
        });

        actionBar.addItem(resetButton);

        if (complexListConfiguration.getExportConfiguration() != null) {
            actionBar.addSeparator();
            final PMenuBar exportListMenuBar = new PMenuBar(true);

            for (final Exporter<D> exporter : complexListConfiguration.getExportConfiguration().getExporters()) {
                final PMenuItem item = new PMenuItem(exporter.name(), new PCommand() {

                    @Override
                    public void execute() {

                        final SelectionResult<D> selectionResult = getSelectedData();
                        if (selectionResult.getSelectedData() != null && selectionResult.getSelectedData().isEmpty()) {
                            PNotificationManager.notify("Export failed, please select data to export", Notification.WARNING_MESSAGE);
                            return;
                        }
                        final Query query = createQuery(currentPage);
                        if (SelectionMode.FULL.equals(selectionMode)) {
                            query.setQueryMode(QueryMode.FULL_RESULT);
                        }
                        final ExportContext<D> exportContext = new ExportContext<D>(query, complexListConfiguration.getExportConfiguration().getExportableFields(), selectionResult);
                        exportContext.setExporter(exporter);

                        final Command<String> command = commandFactory.newExportCommand(ComplexListActivity.this, exportContext);
                        command.execute();
                    }
                });
                exportListMenuBar.addItem(item);
            }
            actionBar.addItem("Export", exportListMenuBar);

        }
View Full Code Here

            ensureDebugId(debugID);
        }
    }

    protected void buildPreferences() {
        final PMenuBar menuBar = new PMenuBar();
        final PMenuBar menuBarAction = new PMenuBar(true);
        menuBar.addItem("Preferences", menuBarAction);
        menuBar.setStyleName("pony-ActionToolbar");
        boolean hasPreferenceAction = false;
        if (complexListConfiguration.isCustomColumnEnabled()) {
            menuBarAction.addItem("Add Custom Column", new PCommand() {

                @Override
                public void execute() {
                    localEventBus.fireEvent(new ShowCustomColumnDescriptorFormEvent(this));

                }
            });
            hasPreferenceAction = true;
        }

        if (complexListConfiguration.isShowPreferences()) {
            menuBarAction.addItem(new PMenuItem("Order columns", new PCommand() {

                @Override
                public void execute() {

                    PConfirmDialog.show("Column Ordering", new PreferenceForm(descriptorsByCaption.values(), localEventBus, complexListConfiguration.getTableName()), new PConfirmDialogHandler() {
View Full Code Here

    private final PMenuItem selectAllMenuItem;
    private final PMenuItem selectNoneMenuItem;

    public DefaultActionSelectorView() {
        addStyleName(PonySDKTheme.MENUBAR_LIGHT);
        final PMenuBar menuBarAction = new PMenuBar(true);
        addItem("", menuBarAction);
        selectAllMenuItem = new PMenuItem(PString.get("list.selector.all"));
        selectAllMenuItem.setCommand(getSelectAllCommand());
        addItem(selectAllMenuItem);
        selectNoneMenuItem = new PMenuItem(PString.get("list.selector.none"));
        selectNoneMenuItem.setCommand(getSelectNoneCommand());

        menuBarAction.addItem(selectAllMenuItem);
        menuBarAction.addItem(selectNoneMenuItem);
    }
View Full Code Here

TOP

Related Classes of com.ponysdk.ui.server.basic.PMenuBar

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.