Example usage for com.vaadin.ui MenuBar MenuBar

List of usage examples for com.vaadin.ui MenuBar MenuBar

Introduction

In this page you can find the example usage for com.vaadin.ui MenuBar MenuBar.

Prototype

public MenuBar() 

Source Link

Document

Constructs an empty, horizontal menu.

Usage

From source file:com.vaadHL.window.base.FWindow.java

License:Apache License

protected MenuBar makeDefaultMenu() {
    MenuBar mb = super.makeMainMenu();
    if (mb == null)
        mb = new MenuBar();

    MenuItem menEd = mb.addItem(getI18S("mnEdition"), null);
    getAction(ActionsIds.AC_EDIT).attach(menEd.addItem(getI18S("btEdit"), null));
    getAction(ActionsIds.AC_DELETE).attach(menEd.addItem(getI18S("btDelete"), null));
    getAction(ActionsIds.AC_CREATE).attach(menEd.addItem(getI18S("btCreate"), null));

    MenuItem toolIt = mb.addItem(getI18S("mnTools"), null);
    addStateMenu(toolIt);//from ww  w . j a  va 2s.co  m
    return mb;
}

From source file:com.vaadHL.window.base.LWindow.java

License:Apache License

protected MenuBar makeDefaultMenu() {
    MenuBar mb = super.makeMainMenu();
    if (mb == null)
        mb = new MenuBar();

    MenuItem menEd = mb.addItem(getI18S("mnEdition"), null);

    if (isDetailsFunc())
        getAction(ActionsIds.AC_DETAILS).attach(menEd.addItem(getI18S("btDetails"), null));
    if (isAddFunc())
        getAction(ActionsIds.AC_CREATE).attach(menEd.addItem(getI18S("btCreate"), null));

    if (isDeleteFunc())
        getAction(ActionsIds.AC_DELETE).attach(menEd.addItem(getI18S("btDelete"), null));

    if (isEditFunc())
        getAction(ActionsIds.AC_EDIT).attach(menEd.addItem(getI18S("btEdit"), null));
    if (isViewFunc())
        getAction(ActionsIds.AC_VIEW).attach(menEd.addItem(getI18S("btView"), null));

    MenuItem toolIt = mb.addItem(getI18S("mnTools"), null);
    getAction(ActionsIds.AC_REFRESH).attach(toolIt.addItem(getI18S("mnRefresh"), null));
    getAction(ActionsIds.AC_DESELECT_ALL).attach(toolIt.addItem(getI18S("mnUnselAll"), null));
    addStateMenu(toolIt);//  w ww . j  a va  2s .co m
    return mb;
}

From source file:com.wintindustries.pfserver.interfaces.view.dashboard.DashboardMenu.java

private Component buildUserMenu() {
    final MenuBar settings = new MenuBar();
    settings.addStyleName("user-menu");
    final PFUser user = getCurrentUser();
    settingsItem = settings.addItem("", new ThemeResource("img/profile-pic-300px.jpg"), null);
    //    updateUserName(null);
    settingsItem.addItem("Edit Profile", new Command() {
        @Override//from   www  .  ja  v a 2s  .  co m
        public void menuSelected(final MenuItem selectedItem) {
            //   ProfilePreferencesWindow.open(user, false);
        }
    });
    settingsItem.addItem("Preferences", new Command() {
        @Override
        public void menuSelected(final MenuItem selectedItem) {
            //   ProfilePreferencesWindow.open(user, true);
        }
    });
    settingsItem.addSeparator();
    settingsItem.addItem("Sign Out", new Command() {
        @Override
        public void menuSelected(final MenuItem selectedItem) {
            //   DashboardEventBus.post(new UserLoggedOutEvent());
        }
    });
    return settings;
}

From source file:com.yoncabt.ebr.ui.MyVaadinUI.java

@Override
protected void init(VaadinRequest vaadinRequest) {
    HorizontalLayout hl = new HorizontalLayout();
    MenuBar mb = new MenuBar();
    hl.addComponent(mb);/*from  ww  w.  j  a  va 2  s  .c  o m*/
    setContent(hl);
    loginWindow.addSuccessListener(() -> {
        reportStatusWindow.setVisible(true);
        addWindow(reportStatusWindow);
    });
    addWindow(loginWindow);
}

From source file:com.yoncabt.ebr.ui.ReportWindow.java

private MenuBar createMenuBar() throws IOException, JRException {
    MenuBar mb = new MenuBar();
    File dir = new File(EBRConf.INSTANCE.getValue(EBRParams.REPORTS_JRXML_PATH, "/home/myururdurmaz/reports"));
    createMenuBar(mb.addItem("Raporlar", null), dir);
    return mb;/* ww  w  .j av  a2  s.co m*/
}

From source file:com.zklogtool.web.components.MainLayout.java

License:Apache License

@AutoGenerated
private VerticalLayout buildVerticalLayout_4() {
    // common part: create layout
    verticalLayout_4 = new VerticalLayout();
    verticalLayout_4.setImmediate(false);
    verticalLayout_4.setWidth("100.0%");
    verticalLayout_4.setHeight("100.0%");
    verticalLayout_4.setMargin(false);//from   ww  w .j a  va2  s .  c  o  m

    // menuBar_1
    menuBar_1 = new MenuBar();
    menuBar_1.setImmediate(false);
    menuBar_1.setWidth("100.0%");
    menuBar_1.setHeight("-1px");
    verticalLayout_4.addComponent(menuBar_1);

    // verticalLayout_2
    verticalLayout_2 = buildVerticalLayout_2();
    verticalLayout_4.addComponent(verticalLayout_2);
    verticalLayout_4.setExpandRatio(verticalLayout_2, 1.0f);

    return verticalLayout_4;
}

From source file:de.catma.CatmaApplication.java

License:Open Source License

@Override
public void init() {

    Properties properties = loadProperties();
    backgroundService = new BackgroundService(this);

    final Window mainWindow = new Window("CATMA 4.1 - CLA " + VERSION);
    mainWindow.addParameterHandler(this);
    HorizontalLayout mainLayout = new HorizontalLayout();
    mainLayout.setSizeUndefined();/*w  w w. j  a va  2  s  .  c o m*/
    mainLayout.setMargin(true);
    mainLayout.setSpacing(true);
    mainWindow.addStyleName("catma-mainwindow");

    mainWindow.setContent(mainLayout);
    MenuFactory menuFactory = new MenuFactory();
    try {
        initTempDirectory(properties);
        tagManager = new TagManager();

        repositoryManagerView = new RepositoryManagerView(new RepositoryManager(this, tagManager, properties));

        tagManagerView = new TagManagerView(tagManager);

        taggerManagerView = new TaggerManagerView();

        analyzerManagerView = new AnalyzerManagerView();

        visualizationManagerView = new VisualizationManagerView();

        defaultProgressIndicator = new ProgressIndicator();
        defaultProgressIndicator.setIndeterminate(true);
        defaultProgressIndicator.setEnabled(false);
        defaultProgressIndicator.setPollingInterval(500);
        progressWindow = new ProgressWindow(defaultProgressIndicator);

        menu = menuFactory.createMenu(mainLayout,
                new MenuFactory.MenuEntryDefinition("Repository Manager",
                        new RepositoryManagerWindow(repositoryManagerView)),
                new MenuFactory.MenuEntryDefinition("Tag Manager", new TagManagerWindow(tagManagerView)),
                new MenuFactory.MenuEntryDefinition("Tagger", new TaggerManagerWindow(taggerManagerView)),
                new MenuFactory.MenuEntryDefinition("Analyzer", new AnalyzerManagerWindow(analyzerManagerView)),
                new MenuFactory.MenuEntryDefinition("Visualizer",
                        new VisualizationManagerWindow(visualizationManagerView)));
        Link aboutLink = new Link("About", new ExternalResource("http://www.catma.de"));
        aboutLink.setTargetName("_blank");
        mainLayout.addComponent(aboutLink);
        mainLayout.setComponentAlignment(aboutLink, Alignment.TOP_RIGHT);
        mainLayout.setExpandRatio(aboutLink, 1.0f);

        Link helpLink = new Link("Help", new ExternalResource(getURL() + "manual/"));
        helpLink.setTargetName("_blank");
        mainLayout.addComponent(helpLink);
        mainLayout.setComponentAlignment(helpLink, Alignment.TOP_RIGHT);

        Label helpLabel = new Label();
        helpLabel.setIcon(new ClassResource("ui/resources/icon-help.gif", this));
        helpLabel.setWidth("20px");
        helpLabel.setDescription(
                "<h3>Hints</h3>" + "<p>Watch out for these little question mark icons while navigating "
                        + "through CATMA. They provide useful hints for managing the first "
                        + "steps within a CATMA component.</p>" + "<h4>Login</h4>"
                        + "Once you're logged in, you will see the Repository Manager, "
                        + "which will explain the first steps to you. "
                        + "Just hover your mouse over the question mark icons!");
        VerticalLayout helpWrapper = new VerticalLayout();
        helpWrapper.addComponent(helpLabel);
        helpWrapper.setComponentAlignment(helpLabel, Alignment.TOP_RIGHT);

        Animator helpAnimator = new Animator(helpWrapper);

        helpAnimator.setFadedOut(true);

        mainLayout.addComponent(helpAnimator);
        mainLayout.setComponentAlignment(helpAnimator, Alignment.TOP_RIGHT);
        helpAnimator.fadeIn(2000, 300);

        MenuBar loginLogoutMenu = new MenuBar();
        LoginLogoutCommand loginLogoutCommand = new LoginLogoutCommand(menu, repositoryManagerView, this);
        MenuItem loginLogoutitem = loginLogoutMenu.addItem("Login", loginLogoutCommand);
        loginLogoutCommand.setLoginLogoutItem(loginLogoutitem);

        mainLayout.addComponent(loginLogoutMenu);
        mainLayout.setComponentAlignment(loginLogoutMenu, Alignment.TOP_RIGHT);
        mainLayout.setWidth("100%");
    } catch (Exception e) {
        showAndLogError("The system could not be initialized!", e);
    }

    setMainWindow(mainWindow);

    setTheme("cleatheme");
}

From source file:de.catma.ui.menu.MenuFactory.java

License:Open Source License

public Menu createMenu(final ComponentContainer componentContainer,
        final MenuEntryDefinition... menuEntryDefintions) {

    final MenuBar menuBar = new MenuBar();
    Menu menu = new Menu(menuBar);

    for (final MenuEntryDefinition menuEntryDefinition : menuEntryDefintions) {
        Command command = new Command() {

            public void menuSelected(MenuItem selectedItem) {
                if (menuEntryDefinition.getWindow().getParent() != null) {
                    menuEntryDefinition.getWindow().bringToFront();
                } else {
                    componentContainer.getWindow().addWindow(menuEntryDefinition.getWindow());
                    menuEntryDefinition.getWindow().setPosition();
                }/*from w w  w  .j av a2  s  . c om*/
            }
        };
        menu.addEntry(menuEntryDefinition.getWindow().getContent(), command);
        menuBar.addItem(menuEntryDefinition.getCaption(), command);
    }
    componentContainer.addComponent(menuBar);

    return menu;
}

From source file:de.catma.ui.repository.CorpusPanel.java

License:Open Source License

private Component createCorporaButtonPanel() {

    Panel corporaButtonsPanel = new Panel(new HorizontalLayout());
    corporaButtonsPanel.setStyleName(Reindeer.PANEL_LIGHT);
    ((HorizontalLayout) corporaButtonsPanel.getContent()).setSpacing(true);

    btCreateCorpus = new Button("Create Corpus");

    corporaButtonsPanel.addComponent(btCreateCorpus);
    MenuBar menuMoreCorpusActions = new MenuBar();
    miMoreCorpusActions = menuMoreCorpusActions.addItem("More actions...", null);
    miMoreCorpusActions.setEnabled(repository instanceof IndexedRepository);
    corporaButtonsPanel.addComponent(menuMoreCorpusActions);

    return corporaButtonsPanel;
}

From source file:de.catma.ui.repository.SourceDocumentPanel.java

License:Open Source License

private Component createDocumentButtonsPanel() {

    Panel documentButtonsPanel = new Panel(new HorizontalLayout());
    documentButtonsPanel.setStyleName(Reindeer.PANEL_LIGHT);

    ((HorizontalLayout) documentButtonsPanel.getContent()).setSpacing(true);

    btOpenDocument = new Button("Open Document");
    documentButtonsPanel.addComponent(btOpenDocument);
    btAddDocument = new Button("Add Document");
    documentButtonsPanel.addComponent(btAddDocument);

    MenuBar menuMoreDocumentActions = new MenuBar();
    miMoreDocumentActions = menuMoreDocumentActions.addItem("More actions...", null);
    documentButtonsPanel.addComponent(menuMoreDocumentActions);

    return documentButtonsPanel;
}