private Component createProfileEditorInvite() { VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); if (!SettingsManager.get().isSettingsEditorEnabled()) { layout.addComponent( new Label("No connection profiles defined and you are not allowed to create one.")); } else { Button createProfileLink = new Button( "Create profile", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { addProfile(); } }); createProfileLink.setStyleName(ValoTheme.BUTTON_LINK); Label line1 = new Label("No connection profiles defined."); line1.setSizeUndefined(); VerticalLayout inner = new VerticalLayout(); inner.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); inner.addComponents(line1, createProfileLink); layout.addComponents(inner); } return layout; }
private Component createProfileManagerToolbar(final Table profileSelector) { if (!SettingsManager.get().isSettingsEditorEnabled()) { return new Label(); } MenuBar toolbar = new MenuBar(); toolbar.addStyleName(ValoTheme.MENUBAR_BORDERLESS); createToolbarItem( toolbar, "Create Profile", FontAwesome.PLUS, new MenuBar.Command() { @Override public void menuSelected(MenuBar.MenuItem selectedItem) { addProfile(); } }); createToolbarItem( toolbar, "Edit Profile", FontAwesome.PENCIL, new MenuBar.Command() { @Override public void menuSelected(MenuBar.MenuItem selectedItem) { ConnectionProfile value = (ConnectionProfile) profileSelector.getValue(); if (value != null) { editProfile(value); } } }); createToolbarItem( toolbar, "Remove Profile", FontAwesome.TRASH_O, new MenuBar.Command() { @Override public void menuSelected(MenuBar.MenuItem selectedItem) { ConnectionProfile value = (ConnectionProfile) profileSelector.getValue(); if (value != null) { removeProfile(value); } } }); return toolbar; }
private void recreateRootLayout() { List<ConnectionProfile> profiles = SettingsManager.get().getConfiguration().getProfiles(); Component component = profiles.isEmpty() ? createProfileEditorInvite() : createConnectionSelectorLayout(); rootPanel.setContent(component); }