public BaseView(String title) { UI.getCurrent().getPage().setTitle(String.format("Analysis | %s", title)); setWidth(100, PERCENTAGE); setSpacing(true); setMargin(true); HorizontalLayout actionBarLayout = new HorizontalLayout(); actionBarLayout.setWidth(100, PERCENTAGE); MenuBar menu = new MenuBar(); menu.addItem("Search", (item) -> UI.getCurrent().setContent(new SearchView())); menu.addItem("Context Cloud", (item) -> UI.getCurrent().setContent(new ContextCloudView())); actionBarLayout.addComponent(menu); addComponent(actionBarLayout); }
public BaseView(String title) { UI.getCurrent().getPage().setTitle(String.format("Crawler Admin | %s", title)); setWidth(100, PERCENTAGE); setSpacing(true); setMargin(true); HorizontalLayout actionBarLayout = new HorizontalLayout(); actionBarLayout.setWidth(100, PERCENTAGE); MenuBar menu = new MenuBar(); MenuBar.MenuItem dataItem = menu.addItem("Configuration", null); dataItem.addItem("HTTP Sources", (item) -> UI.getCurrent().setContent(new HttpSourcesView())); dataItem.addItem("HTTP Source Tests", (item) -> UI.getCurrent().setContent(new HttpSourceTestsView())); dataItem.addItem("Named Queries", (item) -> UI.getCurrent().setContent(new NamedQueriesView())); dataItem.addItem("Import / Export", (item) -> UI.getCurrent().setContent(new ImportExportView())); menu.addItem("Page Analysis", (item) -> UI.getCurrent().setContent(new PageAnalysisView())); actionBarLayout.addComponent(menu); addComponent(actionBarLayout); }
public void setActiveItem(MenuItem item) { if (item != null && item instanceof RoutedMenuItem) { MenuBar.MenuItem selectedItem = null; for (MenuItem el : this.getItems()) { el.setChecked(false); if (item.equals(el)) { selectedItem = el; } } while (selectedItem != null && !selectedItem.isChecked()) { selectedItem.setChecked(true); selectedItem = selectedItem.getParent(); } } }
@Override public MenuItem createMenuItem(String id, String caption, @Nullable String icon, @Nullable Consumer<MenuItem> command) { checkNotNullArgument(id); checkItemIdDuplicate(id); MenuItem menuItem = new MenuItemImpl(this, id); MenuBar.MenuItem delegateItem = component.createMenuItem(caption, WebComponentsHelper.getIcon(icon), null); if (command != null) { delegateItem.setCommand(selectedItem -> command.accept(menuItem)); } ((MenuItemImpl) menuItem).setDelegateItem(delegateItem); menuItem.setCaption(caption); menuItem.setIcon(icon); menuItem.setCommand(command); return menuItem; }
@Override public void addChildItem(MenuItem menuItem) { MenuBar.MenuItem childItem = ((MenuItemImpl) menuItem).getDelegateItem(); if (childItem.getText() == null) { throw new IllegalArgumentException("Caption cannot be null"); } MenuBar.MenuItem delegateItem = this.getDelegateItem(); // The only place where the parent is set childItem.setParent(delegateItem); delegateItem.getChildren().add(childItem); menu.registerMenuItem(menuItem); menu.getComponent().markAsDirty(); }
@Override public void addChildItem(MenuItem menuItem, int index) { MenuBar.MenuItem childItem = ((MenuItemImpl) menuItem).getDelegateItem(); if (childItem.getText() == null) { throw new IllegalArgumentException("Caption cannot be null"); } MenuBar.MenuItem delegateItem = this.getDelegateItem(); // The only place where the parent is set childItem.setParent(delegateItem); delegateItem.getChildren().add(index, childItem); menu.registerMenuItem(menuItem); menu.getComponent().markAsDirty(); }
private void initLayout() { navBar = new NavBar(); viewContainer = new VerticalLayout(); viewContainer.addStyleName(DSTheme.VALO_CONTENT); viewContainer.addStyleName(DSTheme.CRUD_VIEW); // viewContainer.setSizeFull(); // DMenu menu = new DMenu(); // menu.setCenteredTabs(true); // menu.setFloatingMenu(true); // menu.setFloatingMenuItemAutoShow(true); // menu.setMenuItemsSameHeight(true); // menu.setMenuItemElementsSameHeight(true); // org.dussan.vaadin.dmenu.menuitem.MenuItem item1 = new // org.dussan.vaadin.dmenu.menuitem.MenuItem( "TAB 1" ); // MenuItemElement itemElement1 = new MenuItemElement( "ELEMENT 1", new // Label( "LABEL 1" ) ); // item1.addMenuItemElement( itemElement1 ); // menu.addMenuItem( item1 ); menuBar = new MenuBar(); menuItems = new HashMap<>(); VerticalLayout rightLayout = new VerticalLayout(); // rightLayout.addComponent(menu); rightLayout.addComponent(menuBar); rightLayout.addComponent(viewContainer); rightLayout.setSizeFull(); rightLayout.setExpandRatio(viewContainer, 1); rightLayout.addStyleName(DSTheme.SCROLLABLE); // Panel panel = new Panel(rightLayout); addComponents(navBar, rightLayout); setExpandRatio(rightLayout, 1); }
public void registerPath(Class<? extends AccessLevelView> viewClass, Resource icon, String title, String desc, String path, String cssClass, BooleanSupplier visibleCondition) { MenuBar.MenuItem item = menu.addItem(icon, title, desc, path, cssClass, selectedItem -> { if (selectedItem instanceof RoutedMenu.RoutedMenuItem) { selectedItem.setChecked(false); navigator.navigateTo(((RoutedMenu.RoutedMenuItem) selectedItem).getPath()); } else { menu.setActiveItem(selectedItem); } }); item.setVisible((visibleCondition == null || visibleCondition.getAsBoolean()) && (viewClass == null || AccessLevelView.hasAccessLevel(viewClass, accessLevelProvider.getCurrentAccessLevel()))); }
public MenuItem addItem(Resource icon, String title, String description, String path, String styleName, MenuBar.Command command) { MenuBar.MenuItem item = addItem(title == null ? "" : title, icon, command, path); if (styleName != null) { item.setStyleName(styleName); } item.setDescription(description == null ? "" : description); item.setCheckable(true); return item; }
public MenuBar.MenuItem getItemByPath(@NotNull String path) { for (MenuItem el : this.getItems()) { if (el instanceof RoutedMenuItem && path.equals(((RoutedMenuItem) el).getPath())) { return el; } } return null; }
private MenuBar.MenuItem addItem(String caption, Resource icon, MenuBar.Command command, String path) { if (caption == null) { throw new IllegalArgumentException("caption cannot be null"); } else { MenuBar.MenuItem newItem = new RoutedMenuItem(caption, icon, command, path); getItems().add(newItem); this.markAsDirty(); return newItem; } }
protected void assignTestIds(MenuItem menuItem, String id) { AppUI ui = (AppUI) component.getUI(); if (ui == null || !ui.isTestMode()) return; MenuBar.MenuItem delegateItem = ((MenuItemImpl) menuItem).getDelegateItem(); component.setCubaId(delegateItem, id); TestIdManager testIdManager = ui.getTestIdManager(); String testId = component.getId() + "_" + id; component.setTestId(delegateItem, testIdManager.reserveId(testId)); }
@Override public MenuItem createSeparator() { MenuItemImpl menuItem = new MenuItemImpl(this, null); menuItem.setSeparator(true); MenuBar.MenuItem separator = component.createSeparator(); menuItem.setDelegateItem(separator); return menuItem; }
@Override public void removeChildItem(MenuItem menuItem) { MenuBar.MenuItem childItem = ((MenuItemImpl) menuItem).getDelegateItem(); getDelegateItem().getChildren().remove(childItem); menu.unregisterItem(menuItem); }
@Override public void menuSelected(MenuBar.MenuItem selectedItem) { TaskModel.TASK_PRIORITY priority = TaskModel.TASK_PRIORITY.valueOf(selectedItem.getText()); if (!Objects.equals(task.getTaskPriority(), priority)) { HybridbpmUI.getBpmAPI().setTaskPriority(taskId, priority); loadForm(); } }
@Override public void menuSelected(MenuBar.MenuItem selectedItem) { if (selectedItem.equals(max)) { selectedItem.setIcon(dashboardPanel.isMaximized() ? FontAwesome.EXPAND : FontAwesome.COMPRESS); dashboardTab.toggleMaximized(dashboardPanel, !dashboardPanel.isMaximized()); dashboardPanel.setMaximized(!dashboardPanel.isMaximized()); } else if (selectedItem.equals(configure)) { openPanelConfigurationWindow(); } else if (selectedItem.equals(deletePanel)) { deletePanel(); } }
/** * Init Various View Buttons * * @param viewNames */ private void initViewButtons(Set<String> viewNames) { MenuBar menubar = new MenuBar(); menubar.setAutoOpen(false); MenuItem parent = menubar.addItem("Themes", null); addVariousThemes(parent); addComponent(menubar); for (String viewName : viewNames) { Button button = getViewButton(viewName); addComponent(button); } }
public HelpNavigation(Map<String, Command> commands, String helpUrl) { if (commands != null && !commands.isEmpty()) { MenuBar menuBar = new MenuBar(); MenuItem menu = menuBar.addItem("Menü", null); menu.setIcon(FontAwesome.NAVICON); for (Entry<String, Command> entry : commands.entrySet()) { menu.addItem(entry.getKey(), entry.getValue()); } addComponent(menuBar); setComponentAlignment(menuBar, Alignment.MIDDLE_CENTER); } if (MString.isSetTrim(helpUrl)) { Button helpBtn = new Button("Hilfe"); helpBtn.setIcon(FontAwesome.QUESTION); helpBtn.setDescription("Hier klicken, um Hilfe zu erhalten"); helpBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { getUI().getPage().open(helpUrl, "_blank", false); } }); addComponent(helpBtn); setComponentAlignment(helpBtn, Alignment.MIDDLE_CENTER); } setHeight(100, Unit.PERCENTAGE); setSpacing(true); }
@Override public void createOverviewPage(final VerticalLayout panelContent) { final MenuBar menuBar = new MenuBar(); panelContent.addComponent(menuBar); panelContent.setComponentAlignment(menuBar, Alignment.TOP_LEFT); panelContent.setExpandRatio(menuBar, ContentRatio.LARGE); addSourcesAndIndicatorsToMenu(menuBar.addItem("By Topic",VaadinIcons.LINE_CHART, null), getTopicIndicatorMap()); menuBar.setAutoOpen(true); }
@Override public void createPoliticianRankingMenuBar(final MenuBar menuBar) { initApplicationMenuBar(menuBar); applicationMenuItemFactory.addRankingMenu(menuBar); createPoliticianRankingTopics(menuBar.addItem(POLITICIAN_RANKING, VaadinIcons.BUG, null)); }
@Override public void createDocumentsMenuBar(final MenuBar menuBar) { initApplicationMenuBar(menuBar); applicationMenuItemFactory.addRankingMenu(menuBar); final MenuItem documentsItem = menuBar.addItem(DOCUMENTS, VaadinIcons.FILE, null); documentsItem.addItem("List all",VaadinIcons.GROUP, COMMAND_DOCUMENTS); documentsItem.addItem("Search Documents",VaadinIcons.GROUP, COMMAND_SEARCH_DOCUMENT); }
@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" }) @Override public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) { final VerticalLayout panelContent = createPanelContent(); final String pageId = getPageId(parameters); final DataContainer<ViewRiksdagenParty, String> dataContainer = getApplicationManager() .getDataContainer(ViewRiksdagenParty.class); final ViewRiksdagenParty viewRiksdagenParty = dataContainer .load(pageId); if (viewRiksdagenParty != null) { getPartyMenuItemFactory().createPartyMenuBar(menuBar, pageId); LabelFactory.createHeader2Label(panelContent,LEADER_HISTORY); final DataContainer<ViewRiksdagenPartyRoleMember, String> partyRoleMemberDataContainer = getApplicationManager() .getDataContainer(ViewRiksdagenPartyRoleMember.class); getGridFactory().createBasicBeanItemGrid( panelContent, ViewRiksdagenPartyRoleMember.class, partyRoleMemberDataContainer .getAllBy(ViewRiksdagenPartyRoleMember_.party, viewRiksdagenParty.getPartyId()), LEADER_HISTORY2, COLUMN_ORDER, HIDE_COLUMNS, LISTENER, null, null); pageCompleted(parameters, panel, pageId, viewRiksdagenParty); } return panelContent; }
/** * Creates the committeee ranking menu bar. * * @param menuBar * the menu bar */ @Override public void createCommitteeeRankingMenuBar(final MenuBar menuBar) { initApplicationMenuBar(menuBar); applicationMenuItemFactory.addRankingMenu(menuBar); createCommitteeRankingTopics(menuBar.addItem(COMMITTEE_RANKING_TEXT, null, null)); }
@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" }) @Override public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) { final VerticalLayout panelContent = createPanelContent(); final String pageId = getPageId(parameters); final DataContainer<ViewRiksdagenParty, String> dataContainer = getApplicationManager() .getDataContainer(ViewRiksdagenParty.class); final ViewRiksdagenParty viewRiksdagenParty = dataContainer.load(pageId); if (viewRiksdagenParty != null) { getPartyMenuItemFactory().createPartyMenuBar(menuBar, pageId); LabelFactory.createHeader2Label(panelContent, VOTE_HISTORY); getGridFactory().createBasicBeanItemNestedPropertiesGrid(panelContent, ViewRiksdagenVoteDataBallotPartySummary.class, viewRiksdagenVoteDataBallotPartySummaryChartDataManager.findByValue(pageId), BALLOTS, NESTED_PROPERTIES, COLUMN_ORDER, HIDE_COLUMNS, LISTENER, EMBEDDED_ID_BALLOT_ID, null); pageCompleted(parameters, panel, pageId, viewRiksdagenParty); } return panelContent; }
protected void initSortMenu() { MenuBar menuBar = new MenuBar(); menuBar.addStyleName(ExplorerLayout.STYLE_SEARCHBOX_SORTMENU); //TODO: Adding types of sorting manually and listener/events MenuItem rootItem = menuBar.addItem("Sort by", null); rootItem.addItem("Id", null); rootItem.addItem("Name", null); rootItem.addItem("Due date", null); rootItem.addItem("Creation date", null); layout.addComponent(menuBar); layout.setComponentAlignment(menuBar, Alignment.MIDDLE_RIGHT); }
@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" }) @Override public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) { final VerticalLayout panelContent = createPanelContent(); final String pageId = getPageId(parameters); final DataContainer<ViewRiksdagenCommittee, String> dataContainer = getApplicationManager() .getDataContainer(ViewRiksdagenCommittee.class); final ViewRiksdagenCommittee viewRiksdagenCommittee = dataContainer.load(pageId); if (viewRiksdagenCommittee != null) { getCommitteeMenuItemFactory().createCommitteeeMenuBar(menuBar, pageId); LabelFactory.createHeader2Label(panelContent, BALLOT_DECISION_SUMMARY); final DataContainer<ViewRiksdagenCommitteeBallotDecisionSummary, ViewRiksdagenCommitteeBallotDecisionPartyEmbeddedId> committeeBallotDecisionPartyDataContainer = getApplicationManager() .getDataContainer(ViewRiksdagenCommitteeBallotDecisionSummary.class); final List<ViewRiksdagenCommitteeBallotDecisionSummary> decisionPartySummaryList = committeeBallotDecisionPartyDataContainer .findOrderedListByProperty(ViewRiksdagenCommitteeBallotDecisionSummary_.org, pageId.toUpperCase(Locale.ENGLISH), ViewRiksdagenCommitteeBallotDecisionSummary_.createdDate); getGridFactory().createBasicBeanItemNestedPropertiesGrid(panelContent, ViewRiksdagenCommitteeBallotDecisionSummary.class, decisionPartySummaryList, COMMITTEE_BALLOT_DECISION_SUMMARY, NESTED_PROPERTIES, COLUMN_ORDER, HIDE_COLUMNS, LISTENER, BALLOT_ID, null); panel.setCaption(NAME + "::" + COMMITTEE + viewRiksdagenCommittee.getEmbeddedId().getDetail()); getPageActionEventHelper().createPageEvent(ViewAction.VISIT_COMMITTEE_VIEW, ApplicationEventGroup.USER, NAME, parameters, pageId); } return panelContent; }
@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" }) @Override public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) { final VerticalLayout panelContent = createPanelContent(); final String pageId = getPageId(parameters); final DataContainer<ViewRiksdagenCommittee, String> dataContainer = getApplicationManager() .getDataContainer(ViewRiksdagenCommittee.class); final ViewRiksdagenCommittee viewRiksdagenCommittee = dataContainer.load(pageId); if (viewRiksdagenCommittee != null) { getCommitteeMenuItemFactory().createCommitteeeMenuBar(menuBar, pageId); LabelFactory.createHeader2Label(panelContent, DECISION_SUMMARY); final DataContainer<ViewRiksdagenCommitteeDecisions, ViewRiksdagenCommitteeDecisionsEmbeddedId> committeeDecisionDataContainer = getApplicationManager() .getDataContainer(ViewRiksdagenCommitteeDecisions.class); final List<ViewRiksdagenCommitteeDecisions> decisionPartySummaryList = committeeDecisionDataContainer .findOrderedListByProperty(ViewRiksdagenCommitteeDecisions_.org, pageId, ViewRiksdagenCommitteeDecisions_.createdDate); getGridFactory().createBasicBeanItemNestedPropertiesGrid(panelContent, ViewRiksdagenCommitteeDecisions.class,decisionPartySummaryList, DECISION_SUMMARY, NESTED_PROPERTIES, COLUMN_ORDER, HIDE_COLUMNS, LISTENER, BALLOT_ID, null); panel.setCaption(NAME + "::" + COMMITTEE + viewRiksdagenCommittee.getEmbeddedId().getDetail()); getPageActionEventHelper().createPageEvent(ViewAction.VISIT_COMMITTEE_VIEW, ApplicationEventGroup.USER, NAME, parameters, pageId); } return panelContent; }
@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" }) @Override public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) { final VerticalLayout panelContent = createPanelContent(); final String pageId = getPageId(parameters); final DataContainer<ViewRiksdagenCommittee, String> dataContainer = getApplicationManager() .getDataContainer(ViewRiksdagenCommittee.class); final ViewRiksdagenCommittee viewRiksdagenCommittee = dataContainer.load(pageId); if (viewRiksdagenCommittee != null) { getCommitteeMenuItemFactory().createCommitteeeMenuBar(menuBar, pageId); LabelFactory.createHeader2Label(panelContent,MEMBER_HISTORY); final DataContainer<ViewRiksdagenCommitteeRoleMember, String> committeeRoleMemberDataContainer = getApplicationManager() .getDataContainer(ViewRiksdagenCommitteeRoleMember.class); getGridFactory().createBasicBeanItemGrid( panelContent, ViewRiksdagenCommitteeRoleMember.class, committeeRoleMemberDataContainer.getAllBy(ViewRiksdagenCommitteeRoleMember_.detail, viewRiksdagenCommittee.getEmbeddedId().getDetail()), MEMBER_HISTORY, COLUMN_ORDER, HIDE_COLUMNS, LISTENER, null, null); panel.setCaption(NAME + "::" + COMMITTEE + viewRiksdagenCommittee.getEmbeddedId().getDetail()); getPageActionEventHelper().createPageEvent(ViewAction.VISIT_COMMITTEE_VIEW, ApplicationEventGroup.USER, NAME, parameters, pageId); } return panelContent; }
@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" }) @Override public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) { final VerticalLayout panelContent = createPanelContent(); final String pageId = getPageId(parameters); final DataContainer<ViewRiksdagenCommittee, String> dataContainer = getApplicationManager() .getDataContainer(ViewRiksdagenCommittee.class); final ViewRiksdagenCommittee viewRiksdagenCommittee = dataContainer.load(pageId); if (viewRiksdagenCommittee != null) { getCommitteeMenuItemFactory().createCommitteeeMenuBar(menuBar, pageId); LabelFactory.createHeader2Label(panelContent,CURRENT_MEMBERS); final DataContainer<ViewRiksdagenCommitteeRoleMember, String> committeeRoleMemberDataContainer = getApplicationManager() .getDataContainer(ViewRiksdagenCommitteeRoleMember.class); getGridFactory().createBasicBeanItemGrid( panelContent, ViewRiksdagenCommitteeRoleMember.class,committeeRoleMemberDataContainer.findListByProperty( new Object[] { viewRiksdagenCommittee.getEmbeddedId().getDetail(), Boolean.TRUE }, ViewRiksdagenCommitteeRoleMember_.detail, ViewRiksdagenCommitteeRoleMember_.active), CURRENT_MEMBERS, COLUMN_ORDER, HIDE_COLUMNS, LISTENER, null, null); panel.setCaption(NAME + "::" + COMMITTEE + viewRiksdagenCommittee.getEmbeddedId().getDetail()); getPageActionEventHelper().createPageEvent(ViewAction.VISIT_COMMITTEE_VIEW, ApplicationEventGroup.USER, NAME, parameters, pageId); } return panelContent; }
@Override protected void init(final VaadinRequest request) { // Creating the Export Tool Bar MenuBar exportToolBar = createToolBar(); final VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); // Adding the Export Tool Bar to the Layout layout.addComponent(exportToolBar); /********* * Adding Components to the Layout namely Tables, Grids and Tree Table *******/ this.gridDefault = new Grid<>(DataModel.class); this.gridDefault.setDataProvider(new ListDataProvider<>(DataModelGenerator.generate(20))); this.gridDefault.setSizeFull(); this.gridDefault.setColumns(this.visibleColumns); this.gridMergedCells = new Grid<>(DataModel.class); this.gridMergedCells.setDataProvider(new ListDataProvider<>(DataModelGenerator.generate(20))); this.gridMergedCells.setColumns(this.visibleColumns); this.gridMergedCells.setSizeFull(); HeaderRow headerRow = this.gridMergedCells.addHeaderRowAt(0); HeaderCell joinHeaderColumns1 = headerRow.join("country", "productType"); joinHeaderColumns1.setText("mergedCell"); HeaderCell joinHeaderColumns2 = headerRow.join("cheapest", "contractor"); joinHeaderColumns2.setText("mergedCell"); FooterRow footerRow1 = this.gridMergedCells.addFooterRowAt(0); FooterCell joinFooterColumns1 = footerRow1.join("country", "productType"); joinFooterColumns1.setText("mergedCell"); FooterCell joinFooterColumns2 = footerRow1.join("cheapest", "contractor"); joinFooterColumns2.setText("mergedCell"); FooterRow footerRow2 = this.gridMergedCells.addFooterRowAt(0); for (int i = 0; i < this.visibleColumns.length; i++) { footerRow2.getCell(this.visibleColumns[i]) .setText(this.columnHeaders[i]); } this.gridFrozenColumns = new Grid<>(DataModel.class); this.gridFrozenColumns.setDataProvider(new ListDataProvider<>(DataModelGenerator.generate(20))); this.gridFrozenColumns.setColumns(this.visibleColumns); this.gridFrozenColumns.getColumn("country") .setWidth(300); this.gridFrozenColumns.getColumn("productType") .setWidth(300); this.gridFrozenColumns.getColumn("catalogue") .setWidth(300); this.gridFrozenColumns.setSizeFull(); this.gridFrozenColumns.setFrozenColumnCount(3); TabSheet tabSheet = new TabSheet(); tabSheet.setSizeFull(); tabSheet.addTab(this.gridDefault, "Grid (Default)"); tabSheet.addTab(this.gridMergedCells, "Grid (Merged Cells)"); tabSheet.addTab(this.gridFrozenColumns, "Grid (Frozen Columns&Rows)"); layout.addComponent(tabSheet); layout.setExpandRatio(tabSheet, 1); /********* * Adding Components to the Layout namely Tables, Grids and Tree Table *******/ /********* * Adding the above data to the containers or components *******/ setContent(layout); }
public MenuItem createSeparator() { MenuBar.MenuItem menuItem = createMenuItem("", null, null); setMenuItemSeparator(menuItem, true); return menuItem; }
@Override public void removeMenuItem(int index) { MenuBar.MenuItem delegateItem = component.getMenuItems().get(index); component.removeMenuItem(delegateItem); unregisterItem(viewModelMap.get(delegateItem)); }
public MenuBar.MenuItem getDelegateItem() { return delegateItem; }
public void setDelegateItem(MenuBar.MenuItem delegateItem) { this.delegateItem = delegateItem; }
public Menu(Navigator navigator) { this.navigator = navigator; setPrimaryStyleName(ValoTheme.MENU_ROOT); menuPart = new CssLayout(); menuPart.addStyleName(ValoTheme.MENU_PART); // header of the menu final HorizontalLayout top = new HorizontalLayout(); top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); top.addStyleName(ValoTheme.MENU_TITLE); top.setSpacing(true); Label title = new Label("My CRUD"); title.addStyleName(ValoTheme.LABEL_H3); title.setSizeUndefined(); Image image = new Image(null, new ThemeResource("img/table-logo.png")); image.setStyleName("logo"); top.addComponent(image); top.addComponent(title); menuPart.addComponent(top); // logout menu item MenuBar logoutMenu = new MenuBar(); logoutMenu.addItem("Logout", FontAwesome.SIGN_OUT, new Command() { @Override public void menuSelected(MenuItem selectedItem) { VaadinSession.getCurrent().getSession().invalidate(); Page.getCurrent().reload(); } }); logoutMenu.addStyleName("user-menu"); menuPart.addComponent(logoutMenu); // button for toggling the visibility of the menu when on a small screen final Button showMenu = new Button("Menu", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { if (menuPart.getStyleName().contains(VALO_MENU_VISIBLE)) { menuPart.removeStyleName(VALO_MENU_VISIBLE); } else { menuPart.addStyleName(VALO_MENU_VISIBLE); } } }); showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY); showMenu.addStyleName(ValoTheme.BUTTON_SMALL); showMenu.addStyleName(VALO_MENU_TOGGLE); showMenu.setIcon(FontAwesome.NAVICON); menuPart.addComponent(showMenu); // container for the navigation buttons, which are added by addView() menuItemsLayout = new CssLayout(); menuItemsLayout.setPrimaryStyleName(VALO_MENUITEMS); menuPart.addComponent(menuItemsLayout); addComponent(menuPart); }
@Override protected MenuBar makeMainMenu() { return makeDefaultMenu(); }
public MenuBar getMenuBar() { return menuBar; }
/** * Makes (does not display) the main window menu */ protected MenuBar makeMainMenu() { return null; }
@Secured({ "ROLE_ANONYMOUS" }) @Override public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) { final VerticalLayout content = createPanelContent(); final String pageId = getPageId(parameters); panel.setCaption(NAME + "::" + CITIZEN_INTELLIGENCE_AGENCY_MAIN); getMenuItemFactory().createMainPageMenuBar(menuBar); final VerticalLayout loginLayout = new VerticalLayout(); loginLayout.setSizeFull(); final Panel formPanel = new Panel(); formPanel.setSizeFull(); loginLayout.addComponent(formPanel); final FormLayout formContent = new FormLayout(); formContent.setIcon(VaadinIcons.SIGN_IN); formPanel.setContent(formContent); final LoginRequest loginRequest = new LoginRequest(); loginRequest.setOtpCode(""); loginRequest.setEmail(""); loginRequest.setUserpassword(""); loginRequest.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId()); final ClickListener loginListener = new ApplicationLoginListener(loginRequest); getFormFactory().addRequestInputFormFields(formContent, loginRequest, LoginRequest.class, AS_LIST, LOGIN, loginListener); final VerticalLayout overviewLayout = new VerticalLayout(); overviewLayout.setSizeFull(); content.addComponent(overviewLayout); content.setExpandRatio(overviewLayout, ContentRatio.LARGE); final ResponsiveRow grid = createGridLayout(overviewLayout); createRowComponent(grid,loginLayout,REGISTER_A_NEW_USER); panel.setCaption(NAME + "::" + CITIZEN_INTELLIGENCE_AGENCY_MAIN); getPageActionEventHelper().createPageEvent(ViewAction.VISIT_MAIN_VIEW, ApplicationEventGroup.USER, CommonsViews.MAIN_VIEW_NAME, parameters, pageId); return content; }