public void setCaption(String caption) { if (action.getShortcutCombination() != null) { StringBuilder sb = new StringBuilder(); sb.append(caption); if (action.getShortcutCombination() != null) { sb.append(" (").append(action.getShortcutCombination().format()).append(")"); } caption = sb.toString(); } menuItem.setText(caption); } }
public void doUpdateHistoryMenu() { int cnt = -2; for (MenuItem c : menuHistory.getChildren()) { if (cnt >= 0) { if (history.size() - cnt - 1 < 0) { c.setText(""); c.setDescription(""); c.setIcon(null); } else { String x = history.get(history.size() - cnt - 1); c.setText(MString.beforeIndex(x, '|')); c.setDescription(x); c.setIcon(VaadinIcons.ARROW_RIGHT); // FontAwesome.ARROW_RIGHT } } cnt++; } }
@Override public void bind(MenuItem field) { Command command = field.getCommand(); if (command != null && command instanceof CommandExt) { MessageSourceAccessor messageSourceAccessor = new MessageSourceAccessor(m_messageSource); field.setText(messageSourceAccessor.getMessage(field.getText(), field.getText())); m_maduraSessionManager.register(field); m_menuItems.add(field); } else { throw new RuntimeException("Menu item command is not a CommandExt"); } if (getItemDataSource() == null) { return; } configureMenuItem(field); }
log.t(t); menuUser.setText(name == null ? "?" : name);
menuHistory.setText(space.getDisplayName(locale)); menuLeave.setEnabled(true); currentSpace = space;
private Component buildUserMenu(final UiProperties uiProperties) { final MenuBar settings = new MenuBar(); settings.addStyleName("user-menu"); settings.setHtmlContentAllowed(true); final MenuItem settingsItem = settings.addItem("", getImage(uiProperties.isGravatar()), null); final String formattedTenant = UserDetailsFormatter.formatCurrentTenant(); if (!StringUtils.isEmpty(formattedTenant)) { settingsItem.setText(formattedTenant); UserDetailsFormatter.getCurrentTenant().ifPresent(tenant -> settingsItem.setDescription(i18n .getMessage("menu.user.description", tenant, UserDetailsFormatter.getCurrentUser().getUsername()))); } else { settingsItem.setText("..."); } settingsItem.setStyleName("user-menuitem"); final String logoutUrl = generateLogoutUrl(); settingsItem.addItem(i18n.getMessage("label.sign.out"), selectedItem -> Page.getCurrent().setLocation(logoutUrl)); return settings; }
private Component buildUserMenu(final UiProperties uiProperties) { final MenuBar settings = new MenuBar(); settings.addStyleName("user-menu"); settings.setHtmlContentAllowed(true); final MenuItem settingsItem = settings.addItem("", getImage(uiProperties.isGravatar()), null); final String formattedTenant = UserDetailsFormatter.formatCurrentTenant(); if (!StringUtils.isEmpty(formattedTenant)) { settingsItem.setText(formattedTenant); UserDetailsFormatter.getCurrentTenant().ifPresent(tenant -> settingsItem.setDescription(i18n .getMessage("menu.user.description", tenant, UserDetailsFormatter.getCurrentUser().getUsername()))); } else { settingsItem.setText("..."); } settingsItem.setStyleName("user-menuitem"); final String logoutUrl = generateLogoutUrl(); settingsItem.addItem(i18n.getMessage("label.sign.out"), selectedItem -> Page.getCurrent().setLocation(logoutUrl)); return settings; }
@Override public void setCaption(String caption) { delegateItem.setText(caption); }
private void cleanupMenu() { for (int i=0; i < menuSpace.length; i++) { menuSpace[i].removeChildren(); menuSpace[i].setText(""); menuSpace[i].setVisible(false); } }
protected void showOverview(boolean setLinking) { if (menuLeave != null) menuLeave.setEnabled(false); contentScreen.removeAllComponents(); cleanupMenu(); currentSpace = null; contentScreen.addComponent(overView); contentScreen.setExpandRatio(overView, 1f); menuHistory.setText(MNls.find(this, "menu.history=History")); if (setLinking) UI.getCurrent().getPage().setUriFragment(""); }
public void setCommonProperties(final MenuItem ret, final MaduraPropertyWrapper property, final MessageSource messageSource) { ret.setText(property.getLabel()); ret.setEnabled(property.isEnabled()); ret.setVisible(property.isVisible()); MessageSourceAccessor messageSourceAccessor = new MessageSourceAccessor(messageSource); ret.setDescription(messageSourceAccessor.getMessage(property.getDescription(), null,property.getDescription())); } public boolean isEnabled(boolean active) {
public void setCommonProperties(final MenuItem ret, final MaduraPropertyWrapper property, final MessageSource messageSource) { ret.setText(property.getLabel()); ret.setEnabled(property.isEnabled()); ret.setVisible(property.isVisible()); MessageSourceAccessor messageSourceAccessor = new MessageSourceAccessor(messageSource); ret.setDescription(messageSourceAccessor.getMessage(property.getDescription(), null,property.getDescription())); } public boolean isEnabled(boolean active) {
public void setCommonProperties(final MenuItem ret, final MaduraPropertyWrapper property, final MessageSource messageSource) { ret.setText(property.getLabel()); ret.setEnabled(property.isEnabled()); ret.setVisible(property.isVisible()); MessageSourceAccessor messageSourceAccessor = new MessageSourceAccessor(messageSource); ret.setDescription(messageSourceAccessor.getMessage(property.getDescription(), null,property.getDescription())); } @Override
public void setCommonProperties(final MenuItem ret, final MaduraPropertyWrapper property, final MessageSource messageSource) { ret.setText(property.getLabel()); ret.setEnabled(property.isEnabled()); ret.setVisible(property.isVisible()); MessageSourceAccessor messageSourceAccessor = new MessageSourceAccessor(messageSource); ret.setDescription(messageSourceAccessor.getMessage(property.getDescription(), null,property.getDescription())); }