Package com.vaadin.ui

Examples of com.vaadin.ui.MenuBar


        beans.setBeanIdProperty("id");

        final Form form = new Form();
        form.setLocale(Locale.GERMAN);
        final Table table = new Table(this.title, beans);
        MenuBar menu = createMenuBar(beans, table);
        layout.addComponent(menu);
       
        table.setSelectable(true);
        table.setImmediate(true);
        table.setVisibleColumns(VISIBLE_COLUMNS);
View Full Code Here


        });
        layout.addComponent(form);
    }

    private MenuBar createMenuBar(final BeanContainer<String, Task> beans, final Table table) {
        MenuBar menu = new MenuBar();
        menu.setImmediate(true);
        menu.addItem("Reload", new Command() {
            public void menuSelected(MenuItem selectedItem) {
                update(beans);
            }
        });
        menu.addItem("Add", new Command() {
            public void menuSelected(MenuItem selectedItem) {
                Task task = new Task();
                task.setId(UUID.randomUUID().toString());
                task.setTitle("New Task");
                task.setDescription("None");
                taskService.addTask(task);
                beans.addBean(task);
            }
        });
        menu.addItem("Delete", new Command() {
            public void menuSelected(MenuItem selectedItem) {
                String id = (String) table.getValue();
                taskService.deleteTask(id);
                table.removeItem(id);
            }
View Full Code Here

                ContentMode.HTML);
        title.setSizeUndefined();
        top.addComponent(title);
        top.setExpandRatio(title, 1);

        MenuBar settings = new MenuBar();
        settings.addStyleName("user-menu");
        StringGenerator sg = new StringGenerator();
        MenuItem settingsItem = settings.addItem(
                sg.nextString(true) + " " + sg.nextString(true)
                        + sg.nextString(false), new ThemeResource(
                        "../tests-valo/img/profile-pic-300px.jpg"), null);
        settingsItem.addItem("Edit Profile", null);
        settingsItem.addItem("Preferences", null);
View Full Code Here

        Label h1 = new Label("Dragging Components");
        h1.addStyleName("h1");
        addComponent(h1);

        MenuBar options = new MenuBar();
        options.setCaption("Drop Hints");
        addComponent(options);

        // Use these styles to hide irrelevant drag hints
        // Can be used either on a parent or directly on the DnDWrapper
        MenuItem opt = options.addItem("Vertical", new MenuBar.Command() {
            @Override
            public void menuSelected(MenuItem selectedItem) {
                if (selectedItem.isChecked()) {
                    sample.removeStyleName("no-vertical-drag-hints");
                } else {
                    sample.addStyleName("no-vertical-drag-hints");
                }
            }
        });
        opt.setCheckable(true);
        opt.setChecked(true);

        opt = options.addItem("Horizontal", new MenuBar.Command() {
            @Override
            public void menuSelected(MenuItem selectedItem) {
                if (selectedItem.isChecked()) {
                    sample.removeStyleName("no-horizontal-drag-hints");
                } else {
                    sample.addStyleName("no-horizontal-drag-hints");
                }
            }
        });
        opt.setCheckable(true);
        opt.setChecked(true);

        opt = options.addItem("Box", new MenuBar.Command() {
            @Override
            public void menuSelected(MenuItem selectedItem) {
                if (selectedItem.isChecked()) {
                    sample.removeStyleName("no-box-drag-hints");
                } else {
View Full Code Here

            sel.setItemIcon("Two", icon);
            gl.addComponent(sel);
        }

        // MenuBar, caption + item + sub-item icons
        MenuBar menu = new MenuBar();
        menu.setIcon(icon);
        menu.setCaption("MenuBar");
        MenuItem mi = menu.addItem("File", icon, null);
        MenuItem smi = mi.addItem("Item", icon, null);
        smi = mi.addItem("Item", icon, null);
        smi = smi.addItem("Item", icon, null);
        gl.addComponent(menu);
View Full Code Here

    private MenuBar menuBar;

    @Override
    public void setUp() {
        menuBar = new MenuBar();
        menuFile = menuBar.addItem("File", this);
        menuEdit = menuBar.addItem("Edit", this);
        menuEditCopy = menuEdit.addItem("Copy", this);
        menuEditCut = menuEdit.addItem("Cut", this);
        menuEditPaste = menuEdit.addItem("Paste", this);
View Full Code Here

        Label h1 = new Label("Menu Bars");
        h1.addStyleName("h1");
        addComponent(h1);

        MenuBar menuBar = getMenuBar();
        menuBar.setCaption("Normal style");
        addComponent(menuBar);

        menuBar = getMenuBar();
        menuBar.setCaption("Small style");
        menuBar.addStyleName("small");
        addComponent(menuBar);

        menuBar = getMenuBar();
        menuBar.setCaption("Borderless style");
        menuBar.addStyleName("borderless");
        addComponent(menuBar);

        menuBar = getMenuBar();
        menuBar.setCaption("Small borderless style");
        menuBar.addStyleName("borderless");
        menuBar.addStyleName("small");
        addComponent(menuBar);

        Label h2 = new Label("Drop Down Button");
        h2.addStyleName("h2");
        addComponent(h2);

        HorizontalLayout wrap = new HorizontalLayout();
        wrap.addStyleName("wrapping");
        wrap.setSpacing(true);
        addComponent(wrap);

        wrap.addComponent(getMenuButton("Normal", false));

        MenuBar split = getMenuButton("Small", false);
        split.addStyleName("small");
        wrap.addComponent(split);

        split = getMenuButton("Borderless", false);
        split.addStyleName("borderless");
        wrap.addComponent(split);

        split = getMenuButton("Themed", false);
        split.addStyleName("color1");
        wrap.addComponent(split);

        split = getMenuButton("Small", false);
        split.addStyleName("color1");
        split.addStyleName("small");
        wrap.addComponent(split);

        h2 = new Label("Split Button");
        h2.addStyleName("h2");
        addComponent(h2);

        wrap = new HorizontalLayout();
        wrap.addStyleName("wrapping");
        wrap.setSpacing(true);
        addComponent(wrap);

        wrap.addComponent(getMenuButton("Normal", true));

        split = getMenuButton("Small", true);
        split.addStyleName("small");
        wrap.addComponent(split);

        split = getMenuButton("Borderless", true);
        split.addStyleName("borderless");
        wrap.addComponent(split);

        split = getMenuButton("Themed", true);
        split.addStyleName("color1");
        wrap.addComponent(split);

        split = getMenuButton("Small", true);
        split.addStyleName("color1");
        split.addStyleName("small");
        wrap.addComponent(split);
    }
View Full Code Here

            public void menuSelected(MenuItem selectedItem) {
                Notification.show("Clicked " + selectedItem.getText());
            }
        };

        MenuBar menubar = new MenuBar();
        menubar.setWidth("100%");
        final MenuBar.MenuItem file = menubar.addItem("File", null);
        final MenuBar.MenuItem newItem = file.addItem("New", null);
        file.addItem("Open file...", click);
        file.addSeparator();

        newItem.addItem("File", click);
        newItem.addItem("Folder", click);
        newItem.addItem("Project...", click);

        file.addItem("Close", click);
        file.addItem("Close All", click);
        file.addSeparator();

        file.addItem("Save", click);
        file.addItem("Save As...", click);
        file.addItem("Save All", click);

        final MenuBar.MenuItem edit = menubar.addItem("Edit", null);
        edit.addItem("Undo", click);
        edit.addItem("Redo", click).setEnabled(false);
        edit.addSeparator();

        edit.addItem("Cut", click);
        edit.addItem("Copy", click);
        edit.addItem("Paste", click);
        edit.addSeparator();

        final MenuBar.MenuItem find = edit.addItem("Find/Replace", null);

        find.addItem("Google Search", click);
        find.addSeparator();
        find.addItem("Find/Replace...", click);
        find.addItem("Find Next", click);
        find.addItem("Find Previous", click);

        Command check = new Command() {
            @Override
            public void menuSelected(MenuItem selectedItem) {
                Notification.show(selectedItem.isChecked() ? "Checked"
                        : "Unchecked");
            }
        };

        final MenuBar.MenuItem view = menubar.addItem("View", null);
        view.addItem("Show Status Bar", check).setCheckable(true);
        MenuItem title = view.addItem("Show Title Bar", check);
        title.setCheckable(true);
        title.setChecked(true);
        view.addItem("Customize Toolbar...", click);
        view.addSeparator();

        view.addItem("Actual Size", click);
        view.addItem("Zoom In", click);
        view.addItem("Zoom Out", click);

        TestIcon testIcon = new TestIcon(50);

        MenuItem fav = menubar.addItem("", check);
        fav.setIcon(testIcon.get());
        fav.setStyleName("icon-only");
        fav.setCheckable(true);
        fav.setChecked(true);

        fav = menubar.addItem("", check);
        fav.setIcon(testIcon.get());
        fav.setStyleName("icon-only");
        fav.setCheckable(true);
        fav.setCheckable(true);

        menubar.addItem("Attach", click).setIcon(FontAwesome.PAPERCLIP);
        menubar.addItem("Undo", click).setIcon(FontAwesome.UNDO);
        MenuItem redo = menubar.addItem("Redo", click);
        redo.setIcon(FontAwesome.REPEAT);
        redo.setEnabled(false);
        menubar.addItem("Upload", click).setIcon(FontAwesome.UPLOAD);

        return menubar;
    }
View Full Code Here

        return menubar;
    }

    static MenuBar getToolBar() {
        MenuBar menubar = new MenuBar();
        menubar.setWidth("100%");

        MenuItem fav = menubar.addItem("", null);
        fav.setIcon(FontAwesome.ALIGN_LEFT);
        fav.setStyleName("icon-only");
        fav.setCheckable(true);
        // fav.setChecked(true);

        fav = menubar.addItem("", null);
        fav.setIcon(FontAwesome.ALIGN_CENTER);
        fav.setStyleName("icon-only");
        fav.setCheckable(true);

        fav = menubar.addItem("", null);
        fav.setIcon(FontAwesome.ALIGN_RIGHT);
        fav.setStyleName("icon-only");
        fav.setCheckable(true);

        MenuItem clip = menubar.addItem("", null);
        clip.setIcon(FontAwesome.PAPERCLIP);
        clip.setStyleName("icon-only");

        MenuItem undo = menubar.addItem("", null);
        undo.setIcon(FontAwesome.UNDO);
        undo.setStyleName("icon-only");

        MenuItem redo = menubar.addItem("", null);
        redo.setIcon(FontAwesome.REPEAT);
        redo.setEnabled(false);
        redo.setStyleName("icon-only");

        return menubar;
View Full Code Here

        return menubar;
    }

    static MenuBar getMenuButton(String caption, boolean splitButton) {
        MenuBar split = new MenuBar();
        MenuBar.MenuItem dropdown = split.addItem(caption, null);
        if (splitButton) {
            dropdown = split.addItem("", null);
        }
        dropdown.addItem("Another Action", null);
        dropdown.addItem("Secondary Action", null);
        dropdown.addSeparator();
        dropdown.addItem("Last Action", null);
View Full Code Here

TOP

Related Classes of com.vaadin.ui.MenuBar

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.