List of usage examples for com.vaadin.ui.themes ValoTheme BUTTON_BORDERLESS
String BUTTON_BORDERLESS
To view the source code for com.vaadin.ui.themes ValoTheme BUTTON_BORDERLESS.
Click Source Link
From source file:org.ikasan.dashboard.ui.administration.panel.RoleManagementPanel.java
License:BSD License
/** * Helper method to initialise behaviour of the role name field. * //from w w w. j a v a 2 s .c o m * @return */ protected void initRoleNameField() { // The policy field name is an autocomplete field. this.roleNameField = new AutocompleteField<Role>(); this.roleNameField.setWidth("80%"); // In order to have the auto complete work we must add a query listener. // The query listener gets activated when a user begins to type into // the field and hits the database looking for suggestions. roleNameField.setQueryListener(new AutocompleteQueryListener<Role>() { @Override public void handleUserQuery(AutocompleteField<Role> field, String query) { // Iterate over the returned results and add them as suggestions for (Role role : securityService.getRoleByNameLike(query)) { field.addSuggestion(role, role.getName()); } } }); // Once a suggestion is selected the listener below gets fired and we populate // associated fields as required. roleNameField.setSuggestionPickedListener(new AutocompleteSuggestionPickedListener<Role>() { @Override public void onSuggestionPicked(final Role pickedRole) { RoleManagementPanel.this.role = pickedRole; // Populate all the policy related fields. RoleManagementPanel.this.roleItem = new BeanItem<Role>(RoleManagementPanel.this.role); RoleManagementPanel.this.roleNameField.setPropertyDataSource(roleItem.getItemProperty("name")); RoleManagementPanel.this.descriptionField .setPropertyDataSource(roleItem.getItemProperty("description")); RoleManagementPanel.this.policyTable.removeAllItems(); for (final Policy policy : role.getPolicies()) { Button deleteButton = new Button(); deleteButton.setIcon(VaadinIcons.TRASH); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.setDescription("Remove Policy from this Role"); deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { Policy selectedPolicy = RoleManagementPanel.this.securityService .findPolicyByName(policy.getName()); Role selectedRole = RoleManagementPanel.this.securityService .findRoleByName(role.getName()); selectedRole.getPolicies().remove(selectedPolicy); RoleManagementPanel.this.saveRole(selectedRole); RoleManagementPanel.this.policyTable.removeItem(policy.getName()); } }); RoleManagementPanel.this.policyTable.addItem(new Object[] { policy.getName(), deleteButton }, policy.getName()); } RoleManagementPanel.this.associatedPrincipalsTable.removeAllItems(); logger.info("Trying to get pinciplas for role: " + role); List<IkasanPrincipal> principals = RoleManagementPanel.this.securityService .getAllPrincipalsWithRole(role.getName()); logger.info("Adding the following number of principals : " + principals.size()); for (final IkasanPrincipal ikasanPrincipal : principals) { Button deleteButton = new Button(); deleteButton.setIcon(VaadinIcons.TRASH); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.setDescription("Unassign this role from the given User/Group"); deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { Role selectedRole = RoleManagementPanel.this.securityService .findRoleByName(RoleManagementPanel.this.roleNameField.getText()); logger.info("Removing principal role: " + selectedRole); ikasanPrincipal.getRoles().remove(selectedRole); RoleManagementPanel.this.securityService.savePrincipal(ikasanPrincipal); RoleManagementPanel.this.associatedPrincipalsTable.removeItem(ikasanPrincipal); } }); RoleManagementPanel.this.associatedPrincipalsTable .addItem(new Object[] { ikasanPrincipal.getName(), deleteButton }, ikasanPrincipal); } } }); }
From source file:org.ikasan.dashboard.ui.administration.panel.RoleManagementPanel.java
License:BSD License
/** * /*from ww w . ja va2 s . co m*/ */ protected Layout initControlLayout() { this.newButton.setIcon(VaadinIcons.PLUS); this.newButton.setDescription("Create a New Role"); this.newButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); this.newButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); this.newButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { final NewRoleWindow newRoleWindow = new NewRoleWindow(securityService); UI.getCurrent().addWindow(newRoleWindow); newRoleWindow.addCloseListener(new Window.CloseListener() { // inline close-listener public void windowClose(CloseEvent e) { RoleManagementPanel.this.role = newRoleWindow.getRole(); RoleManagementPanel.this.roleItem = new BeanItem<Role>(RoleManagementPanel.this.role); RoleManagementPanel.this.roleNameField.setText(RoleManagementPanel.this.role.getName()); RoleManagementPanel.this.roleNameField .setPropertyDataSource(roleItem.getItemProperty("name")); RoleManagementPanel.this.descriptionField .setPropertyDataSource(roleItem.getItemProperty("description")); } }); } }); this.saveButton.setStyleName(ValoTheme.BUTTON_LINK); this.saveButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { try { RoleManagementPanel.this.save(); Notification.show("Saved"); } catch (RuntimeException e) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); Notification.show("Cauget exception trying to save a Policy!", sw.toString(), Notification.Type.ERROR_MESSAGE); } } }); this.deleteButton.setIcon(VaadinIcons.TRASH); this.deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); this.deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); this.deleteButton.setDescription("Delete the Current Role"); this.deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { try { RoleManagementPanel.this.securityService.deleteRole(role); RoleManagementPanel.this.roleNameField.setText(""); RoleManagementPanel.this.descriptionField.setValue(""); RoleManagementPanel.this.policyTable.removeAllItems(); Notification.show("Deleted"); } catch (RuntimeException e) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); Notification.show("Cauget exception trying to delete a Policy!", sw.toString(), Notification.Type.ERROR_MESSAGE); } } }); HorizontalLayout controlLayout = new HorizontalLayout(); controlLayout.setWidth("100%"); controlLayout.setHeight("20px"); Label spacerLabel = new Label(""); controlLayout.addComponent(spacerLabel); controlLayout.setExpandRatio(spacerLabel, 0.91f); controlLayout.addComponent(newButton); controlLayout.setExpandRatio(newButton, 0.045f); controlLayout.addComponent(deleteButton); controlLayout.setExpandRatio(deleteButton, 0.045f); return controlLayout; }
From source file:org.ikasan.dashboard.ui.administration.panel.RoleManagementPanel.java
License:BSD License
@Override public void enter(ViewChangeEvent event) { this.policyNameField.clearChoices(); this.roleNameField.clearChoices(); if (this.role != null) { RoleManagementPanel.this.associatedPrincipalsTable.removeAllItems(); logger.info("Trying to get pincipals for role: " + role); List<IkasanPrincipal> principals = RoleManagementPanel.this.securityService .getAllPrincipalsWithRole(role.getName()); logger.info("Adding the following number of principals : " + principals.size()); for (final IkasanPrincipal ikasanPrincipal : principals) { Button deleteButton = new Button(); deleteButton.setIcon(VaadinIcons.TRASH); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.setDescription("Unassign this role from the given User/Group"); deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { Role selectedRole = RoleManagementPanel.this.securityService .findRoleByName(RoleManagementPanel.this.roleNameField.getText()); logger.info("Removing principal role: " + selectedRole); ikasanPrincipal.getRoles().remove(selectedRole); RoleManagementPanel.this.securityService.savePrincipal(ikasanPrincipal); RoleManagementPanel.this.associatedPrincipalsTable.removeItem(ikasanPrincipal); }//w w w . ja v a2 s . c o m }); RoleManagementPanel.this.associatedPrincipalsTable .addItem(new Object[] { ikasanPrincipal.getName(), deleteButton }, ikasanPrincipal); } } }
From source file:org.ikasan.dashboard.ui.administration.panel.UserDirectoriesPanel.java
License:BSD License
protected void populateDirectoryTable(final AuthenticationMethod authenticationMethod) { Button test = new Button("Test"); test.setStyleName(BaseTheme.BUTTON_LINK); test.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { try { authenticationProviderFactory.testAuthenticationConnection(authenticationMethod); } catch (RuntimeException e) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw);/* ww w . ja va2 s .c om*/ Notification.show("Error occurred while testing connection!", sw.toString(), Notification.Type.ERROR_MESSAGE); return; } catch (Exception e) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); Notification.show("Error occurred while testing connection!", sw.toString(), Notification.Type.ERROR_MESSAGE); return; } Notification.show("Connection Successful!"); } }); final Button enableDisableButton = new Button(); if (authenticationMethod.isEnabled()) { enableDisableButton.setCaption("Disable"); } else { enableDisableButton.setCaption("Enable"); } enableDisableButton.setStyleName(BaseTheme.BUTTON_LINK); enableDisableButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { try { if (authenticationMethod.isEnabled()) { authenticationMethod.setEnabled(false); } else { authenticationMethod.setEnabled(true); } securityService.saveOrUpdateAuthenticationMethod(authenticationMethod); populateAll(); } catch (RuntimeException e) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); Notification.show("Error trying to enable/disable the authentication method!", sw.toString(), Notification.Type.ERROR_MESSAGE); return; } if (authenticationMethod.isEnabled()) { enableDisableButton.setCaption("Disable"); Notification.show("Enabled!"); } else { enableDisableButton.setCaption("Enable"); Notification.show("Disabled!"); } } }); Button delete = new Button("Delete"); delete.setStyleName(BaseTheme.BUTTON_LINK); delete.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { try { securityService.deleteAuthenticationMethod(authenticationMethod); List<AuthenticationMethod> authenticationMethods = securityService.getAuthenticationMethods(); directoryTable.removeAllItems(); long order = 1; for (final AuthenticationMethod authenticationMethod : authenticationMethods) { authenticationMethod.setOrder(order++); securityService.saveOrUpdateAuthenticationMethod(authenticationMethod); } populateAll(); } catch (RuntimeException e) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); Notification.show("Error trying to delete the authentication method!", sw.toString(), Notification.Type.ERROR_MESSAGE); return; } Notification.show("Deleted!"); } }); Button edit = new Button("Edit"); edit.setStyleName(BaseTheme.BUTTON_LINK); edit.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { UserDirectoryManagementPanel authMethodPanel = new UserDirectoryManagementPanel( authenticationMethod, securityService, authenticationProviderFactory, ldapService); Window window = new Window("Configure User Directory"); window.setModal(true); window.setHeight("90%"); window.setWidth("90%"); window.setContent(authMethodPanel); UI.getCurrent().addWindow(window); } }); Button synchronise = new Button("Synchronise"); synchronise.setStyleName(BaseTheme.BUTTON_LINK); synchronise.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { try { ldapService.synchronize(authenticationMethod); authenticationMethod.setLastSynchronised(new Date()); securityService.saveOrUpdateAuthenticationMethod(authenticationMethod); populateAll(); } catch (UnexpectedRollbackException e) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); logger.error("Most specific cause: " + e.getMostSpecificCause()); e.getMostSpecificCause().printStackTrace(); logger.error("Most specific cause: " + e.getRootCause()); e.getRootCause().printStackTrace(); Notification.show("Error occurred while synchronizing!", sw.toString(), Notification.Type.ERROR_MESSAGE); return; } catch (RuntimeException e) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); Notification.show("Error occurred while synchronizing!", sw.toString(), Notification.Type.ERROR_MESSAGE); return; } catch (Exception e) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); Notification.show("Error occurred while synchronizing!", sw.toString(), Notification.Type.ERROR_MESSAGE); return; } Notification.show("Synchronized!"); } }); GridLayout operationsLayout = new GridLayout(9, 2); operationsLayout.setWidth("250px"); operationsLayout.addComponent(enableDisableButton, 0, 0); operationsLayout.addComponent(new Label(" "), 1, 0); operationsLayout.addComponent(edit, 2, 0); operationsLayout.addComponent(new Label(" "), 3, 0); operationsLayout.addComponent(delete, 4, 0); operationsLayout.addComponent(new Label(" "), 5, 0); operationsLayout.addComponent(test, 6, 0); operationsLayout.addComponent(new Label(" "), 7, 0); operationsLayout.addComponent(synchronise, 8, 0); TextArea synchronisedTextArea = new TextArea(); synchronisedTextArea.setRows(3); synchronisedTextArea.setWordwrap(true); if (authenticationMethod.getLastSynchronised() != null) { synchronisedTextArea.setValue( "This directory was last synchronised at " + authenticationMethod.getLastSynchronised()); } else { synchronisedTextArea.setValue("This directory has not been synchronised"); } synchronisedTextArea.setSizeFull(); synchronisedTextArea.setReadOnly(true); operationsLayout.addComponent(synchronisedTextArea, 0, 1, 8, 1); HorizontalLayout orderLayout = new HorizontalLayout(); orderLayout.setWidth("50%"); if (authenticationMethod.getOrder() != 1) { Button upArrow = new Button(VaadinIcons.ARROW_UP); upArrow.addStyleName(ValoTheme.BUTTON_ICON_ONLY); upArrow.addStyleName(ValoTheme.BUTTON_BORDERLESS); upArrow.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { if (authenticationMethod.getOrder() != 1) { AuthenticationMethod upAuthMethod = securityService .getAuthenticationMethodByOrder(authenticationMethod.getOrder() - 1); upAuthMethod.setOrder(authenticationMethod.getOrder()); authenticationMethod.setOrder(authenticationMethod.getOrder() - 1); securityService.saveOrUpdateAuthenticationMethod(upAuthMethod); securityService.saveOrUpdateAuthenticationMethod(authenticationMethod); populateAll(); } } }); orderLayout.addComponent(upArrow); } long numberOfAuthMethods = securityService.getNumberOfAuthenticationMethods(); if (authenticationMethod.getOrder() != numberOfAuthMethods) { Button downArrow = new Button(VaadinIcons.ARROW_DOWN); downArrow.addStyleName(ValoTheme.BUTTON_ICON_ONLY); downArrow.addStyleName(ValoTheme.BUTTON_BORDERLESS); downArrow.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { long numberOfAuthMethods = securityService.getNumberOfAuthenticationMethods(); if (authenticationMethod.getOrder() != numberOfAuthMethods) { AuthenticationMethod downAuthMethod = securityService .getAuthenticationMethodByOrder(authenticationMethod.getOrder() + 1); downAuthMethod.setOrder(authenticationMethod.getOrder()); authenticationMethod.setOrder(authenticationMethod.getOrder() + 1); securityService.saveOrUpdateAuthenticationMethod(downAuthMethod); securityService.saveOrUpdateAuthenticationMethod(authenticationMethod); populateAll(); } } }); orderLayout.addComponent(downArrow); } this.directoryTable.addItem(new Object[] { authenticationMethod.getName(), "Microsoft Active Directory", orderLayout, operationsLayout }, authenticationMethod); }
From source file:org.ikasan.dashboard.ui.administration.panel.UserManagementPanel.java
License:BSD License
@SuppressWarnings("deprecation") protected void init() { this.setWidth("100%"); this.setHeight("100%"); VerticalLayout layout = new VerticalLayout(); layout.setSizeFull();//from w w w . java 2s . co m Panel securityAdministrationPanel = new Panel(); securityAdministrationPanel.addStyleName(ValoTheme.PANEL_BORDERLESS); securityAdministrationPanel.setHeight("100%"); securityAdministrationPanel.setWidth("100%"); GridLayout gridLayout = new GridLayout(2, 6); gridLayout.setMargin(true); gridLayout.setSpacing(true); gridLayout.setSizeFull(); Label mappingConfigurationLabel = new Label("User Management"); mappingConfigurationLabel.setStyleName(ValoTheme.LABEL_HUGE); gridLayout.addComponent(mappingConfigurationLabel, 0, 0, 1, 0); Label userSearchHintLabel = new Label(); userSearchHintLabel.setCaptionAsHtml(true); userSearchHintLabel.setCaption(VaadinIcons.QUESTION_CIRCLE_O.getHtml() + " Type into the Username, Firstname or Surname fields to find a user."); userSearchHintLabel.addStyleName(ValoTheme.LABEL_TINY); userSearchHintLabel.addStyleName(ValoTheme.LABEL_LIGHT); gridLayout.addComponent(userSearchHintLabel, 0, 1, 1, 1); Label usernameLabel = new Label("Username:"); usernameField.setWidth("40%"); final DragAndDropWrapper usernameFieldWrap = new DragAndDropWrapper(usernameField); usernameFieldWrap.setDragStartMode(DragStartMode.COMPONENT); firstName = new AutocompleteField<User>(); firstName.setWidth("40%"); surname = new AutocompleteField<User>(); surname.setWidth("40%"); final TextField department = new TextField(); department.setWidth("40%"); final TextField email = new TextField(); email.setWidth("40%"); final Table roleTable = new Table(); roleTable.addContainerProperty("Role", String.class, null); roleTable.addContainerProperty("", Button.class, null); roleTable.setHeight("520px"); roleTable.setWidth("250px"); usernameField.setQueryListener(new AutocompleteQueryListener<User>() { @Override public void handleUserQuery(AutocompleteField<User> field, String query) { for (User user : userService.getUserByUsernameLike(query)) { field.addSuggestion(user, user.getUsername()); } } }); usernameField.setSuggestionPickedListener(new AutocompleteSuggestionPickedListener<User>() { @Override public void onSuggestionPicked(User user) { UserManagementPanel.this.user = user; firstName.setText(user.getFirstName()); surname.setText(user.getSurname()); department.setValue(user.getDepartment()); email.setValue(user.getEmail()); final IkasanPrincipal principal = securityService.findPrincipalByName(user.getUsername()); roleTable.removeAllItems(); for (final Role role : principal.getRoles()) { Button deleteButton = new Button(); deleteButton.setIcon(VaadinIcons.TRASH); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { roleTable.removeItem(role); principal.getRoles().remove(role); securityService.savePrincipal(principal); userDropTable.removeItem(principal.getName()); } }); roleTable.addItem(new Object[] { role.getName(), deleteButton }, role); } associatedPrincipalsTable.removeAllItems(); for (IkasanPrincipal ikasanPrincipal : user.getPrincipals()) { if (!ikasanPrincipal.getType().equals("user")) { associatedPrincipalsTable.addItem(new Object[] { ikasanPrincipal.getName() }, ikasanPrincipal); } } } }); firstName.setQueryListener(new AutocompleteQueryListener<User>() { @Override public void handleUserQuery(AutocompleteField<User> field, String query) { for (User user : userService.getUserByFirstnameLike(query)) { field.addSuggestion(user, user.getFirstName() + " " + user.getSurname()); } } }); firstName.setSuggestionPickedListener(new AutocompleteSuggestionPickedListener<User>() { @Override public void onSuggestionPicked(User user) { UserManagementPanel.this.user = user; usernameField.setText(user.getUsername()); firstName.setText(user.getFirstName()); surname.setText(user.getSurname()); department.setValue(user.getDepartment()); email.setValue(user.getEmail()); final IkasanPrincipal principal = securityService.findPrincipalByName(user.getUsername()); roleTable.removeAllItems(); for (final Role role : principal.getRoles()) { Button deleteButton = new Button(); deleteButton.setIcon(VaadinIcons.TRASH); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { roleTable.removeItem(role); principal.getRoles().remove(role); securityService.savePrincipal(principal); userDropTable.removeItem(principal.getName()); } }); roleTable.addItem(new Object[] { role.getName(), deleteButton }, role); } associatedPrincipalsTable.removeAllItems(); for (IkasanPrincipal ikasanPrincipal : user.getPrincipals()) { if (!ikasanPrincipal.getType().equals("user")) { associatedPrincipalsTable.addItem(new Object[] { ikasanPrincipal.getName() }, ikasanPrincipal); } } } }); surname.setQueryListener(new AutocompleteQueryListener<User>() { @Override public void handleUserQuery(AutocompleteField<User> field, String query) { for (User user : userService.getUserBySurnameLike(query)) { field.addSuggestion(user, user.getFirstName() + " " + user.getSurname()); } } }); surname.setSuggestionPickedListener(new AutocompleteSuggestionPickedListener<User>() { @Override public void onSuggestionPicked(User user) { UserManagementPanel.this.user = user; usernameField.setText(user.getUsername()); firstName.setText(user.getFirstName()); surname.setText(user.getSurname()); department.setValue(user.getDepartment()); email.setValue(user.getEmail()); final IkasanPrincipal principal = securityService.findPrincipalByName(user.getUsername()); roleTable.removeAllItems(); for (final Role role : principal.getRoles()) { Button deleteButton = new Button(); deleteButton.setIcon(VaadinIcons.TRASH); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { roleTable.removeItem(role); principal.getRoles().remove(role); securityService.savePrincipal(principal); userDropTable.removeItem(principal.getName()); } }); roleTable.addItem(new Object[] { role.getName(), deleteButton }, role); associatedPrincipalsTable.removeAllItems(); for (IkasanPrincipal ikasanPrincipal : user.getPrincipals()) { if (!ikasanPrincipal.getType().equals("user")) { associatedPrincipalsTable.addItem(new Object[] { ikasanPrincipal.getName() }, ikasanPrincipal); } } } } }); GridLayout formLayout = new GridLayout(2, 5); formLayout.setSpacing(true); formLayout.setWidth("100%"); formLayout.setColumnExpandRatio(0, .1f); formLayout.setColumnExpandRatio(1, .8f); usernameLabel.setSizeUndefined(); formLayout.addComponent(usernameLabel, 0, 0); formLayout.setComponentAlignment(usernameLabel, Alignment.MIDDLE_RIGHT); formLayout.addComponent(usernameFieldWrap, 1, 0); Label firstNameLabel = new Label("First name:"); firstNameLabel.setSizeUndefined(); formLayout.addComponent(firstNameLabel, 0, 1); formLayout.setComponentAlignment(firstNameLabel, Alignment.MIDDLE_RIGHT); formLayout.addComponent(firstName, 1, 1); Label surnameLabel = new Label("Surname:"); surnameLabel.setSizeUndefined(); formLayout.addComponent(surnameLabel, 0, 2); formLayout.setComponentAlignment(surnameLabel, Alignment.MIDDLE_RIGHT); formLayout.addComponent(surname, 1, 2); Label departmentLabel = new Label("Department:"); departmentLabel.setSizeUndefined(); formLayout.addComponent(departmentLabel, 0, 3); formLayout.setComponentAlignment(departmentLabel, Alignment.MIDDLE_RIGHT); formLayout.addComponent(department, 1, 3); Label emailLabel = new Label("Email address:"); emailLabel.setSizeUndefined(); formLayout.addComponent(emailLabel, 0, 4); formLayout.setComponentAlignment(emailLabel, Alignment.MIDDLE_RIGHT); formLayout.addComponent(email, 1, 4); gridLayout.addComponent(formLayout, 0, 2, 1, 2); Label rolesAndGroupsHintLabel1 = new Label(); rolesAndGroupsHintLabel1.setCaptionAsHtml(true); rolesAndGroupsHintLabel1.setCaption(VaadinIcons.QUESTION_CIRCLE_O.getHtml() + " The Roles table below displays the roles that the user has. Roles can be deleted from this table."); rolesAndGroupsHintLabel1.addStyleName(ValoTheme.LABEL_TINY); rolesAndGroupsHintLabel1.addStyleName(ValoTheme.LABEL_LIGHT); rolesAndGroupsHintLabel1.setWidth(300, Unit.PIXELS); gridLayout.addComponent(rolesAndGroupsHintLabel1, 0, 3, 1, 3); Label rolesAndGroupsHintLabel2 = new Label(); rolesAndGroupsHintLabel2.setCaptionAsHtml(true); rolesAndGroupsHintLabel2.setCaption(VaadinIcons.QUESTION_CIRCLE_O.getHtml() + " The Groups table below displays all the LDAP groups that the user is a member of. You cannot manage these " + "from this application."); rolesAndGroupsHintLabel2.addStyleName(ValoTheme.LABEL_TINY); rolesAndGroupsHintLabel2.addStyleName(ValoTheme.LABEL_LIGHT); rolesAndGroupsHintLabel2.setWidth(300, Unit.PIXELS); gridLayout.addComponent(rolesAndGroupsHintLabel2, 0, 4, 1, 4); final ClientSideCriterion acceptCriterion = new SourceIs(usernameField); userDropTable.addContainerProperty("Members", String.class, null); userDropTable.addContainerProperty("", Button.class, null); userDropTable.setHeight("715px"); userDropTable.setWidth("300px"); userDropTable.setDragMode(TableDragMode.ROW); userDropTable.setDropHandler(new DropHandler() { @Override public void drop(final DragAndDropEvent dropEvent) { if (rolesCombo.getValue() == null) { // Do nothing if there is no role selected logger.info("Ignoring drop: " + dropEvent); return; } // criteria verify that this is safe logger.info("Trying to drop: " + dropEvent); final WrapperTransferable t = (WrapperTransferable) dropEvent.getTransferable(); final AutocompleteField sourceContainer = (AutocompleteField) t.getDraggedComponent(); logger.info("sourceContainer.getText(): " + sourceContainer.getText()); Button deleteButton = new Button(); deleteButton.setIcon(VaadinIcons.TRASH); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); final IkasanPrincipal principal = securityService.findPrincipalByName(sourceContainer.getText()); final Role roleToRemove = (Role) rolesCombo.getValue(); deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { userDropTable.removeItem(principal.getName()); principal.getRoles().remove(roleToRemove); securityService.savePrincipal(principal); if (UserManagementPanel.this.usernameField.getText().equals(principal.getName())) { roleTable.removeItem(roleToRemove); } } }); userDropTable.addItem(new Object[] { sourceContainer.getText(), deleteButton }, sourceContainer.getText()); principal.getRoles().add((Role) rolesCombo.getValue()); securityService.savePrincipal(principal); roleTable.removeAllItems(); for (final Role role : principal.getRoles()) { Button roleDeleteButton = new Button(); roleDeleteButton.setIcon(VaadinIcons.TRASH); roleDeleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); roleDeleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); roleDeleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { roleTable.removeItem(role); principal.getRoles().remove(role); securityService.savePrincipal(principal); userDropTable.removeItem(principal.getName()); } }); roleTable.addItem(new Object[] { role.getName(), roleDeleteButton }, role); } } @Override public AcceptCriterion getAcceptCriterion() { return AcceptAll.get(); } }); gridLayout.addComponent(roleTable, 0, 5); this.associatedPrincipalsTable.addContainerProperty("Groups", String.class, null); this.associatedPrincipalsTable.addItemClickListener(this.associatedPrincipalItemClickListener); associatedPrincipalsTable.setHeight("520px"); associatedPrincipalsTable.setWidth("400px"); gridLayout.addComponent(this.associatedPrincipalsTable, 1, 5); this.rolesCombo = new ComboBox("Roles"); this.rolesCombo.setWidth("90%"); this.rolesCombo.addValueChangeListener(new Property.ValueChangeListener() { public void valueChange(ValueChangeEvent event) { final Role role = (Role) event.getProperty().getValue(); if (role != null) { logger.info("Value changed got Role: " + role); List<IkasanPrincipal> principals = securityService.getAllPrincipalsWithRole(role.getName()); userDropTable.removeAllItems(); for (final IkasanPrincipal principal : principals) { Button deleteButton = new Button(); deleteButton.setIcon(VaadinIcons.TRASH); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { userDropTable.removeItem(principal.getName()); principal.getRoles().remove(role); securityService.savePrincipal(principal); if (UserManagementPanel.this.usernameField.getText().equals(principal.getName())) { roleTable.removeItem(role); } } }); userDropTable.addItem(new Object[] { principal.getName(), deleteButton }, principal.getName()); } } } }); Panel roleMemberPanel = new Panel(); roleMemberPanel.addStyleName(ValoTheme.PANEL_BORDERLESS); roleMemberPanel.setHeight("100%"); roleMemberPanel.setWidth("100%"); GridLayout roleMemberLayout = new GridLayout(); roleMemberLayout.setSpacing(true); roleMemberLayout.setWidth("100%"); Label roleMemberAssociationsLabel = new Label("Role/Member Associations"); roleMemberAssociationsLabel.setStyleName(ValoTheme.LABEL_HUGE); Label userDragHintLabel = new Label(); userDragHintLabel.setCaptionAsHtml(true); userDragHintLabel.setCaption(VaadinIcons.QUESTION_CIRCLE_O.getHtml() + " Drop users into the table below to assign them the role."); roleMemberLayout.addComponent(roleMemberAssociationsLabel); roleMemberLayout.addComponent(userDragHintLabel); roleMemberLayout.addComponent(this.rolesCombo); roleMemberLayout.addComponent(this.userDropTable); roleMemberPanel.setContent(roleMemberLayout); securityAdministrationPanel.setContent(gridLayout); layout.addComponent(securityAdministrationPanel); VerticalLayout roleMemberPanelLayout = new VerticalLayout(); roleMemberPanelLayout.setWidth("100%"); roleMemberPanelLayout.setHeight("100%"); roleMemberPanelLayout.setMargin(true); roleMemberPanelLayout.addComponent(roleMemberPanel); roleMemberPanelLayout.setSizeFull(); HorizontalSplitPanel hsplit = new HorizontalSplitPanel(); hsplit.setFirstComponent(layout); hsplit.setSecondComponent(roleMemberPanelLayout); // Set the position of the splitter as percentage hsplit.setSplitPosition(65, Unit.PERCENTAGE); hsplit.setLocked(true); this.setContent(hsplit); }
From source file:org.ikasan.dashboard.ui.framework.panel.ProfilePanel.java
License:BSD License
@Override public void enter(ViewChangeEvent event) { List<Role> roles = this.securityService.getAllRoles(); this.dashboadActivityTable.removeAllItems(); IkasanAuthentication ikasanAuthentication = (IkasanAuthentication) VaadinService.getCurrentRequest() .getWrappedSession().getAttribute(DashboardSessionValueConstants.USER); this.user = (User) ikasanAuthentication.getPrincipal(); usernameField.setValue(user.getUsername()); firstName.setValue(user.getFirstName()); surname.setValue(user.getSurname()); department.setValue(user.getDepartment()); email.setValue(user.getEmail());/*from w w w . j ava2s . co m*/ final IkasanPrincipal principal = securityService.findPrincipalByName(user.getUsername()); roleTable.removeAllItems(); for (final Role role : principal.getRoles()) { Button deleteButton = new Button(); deleteButton.setIcon(VaadinIcons.TRASH); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { roleTable.removeItem(role); principal.getRoles().remove(role); securityService.savePrincipal(principal); dashboadActivityTable.removeItem(principal.getName()); } }); roleTable.addItem(new Object[] { role.getName() }, role); associatedPrincipalsTable.removeAllItems(); for (IkasanPrincipal ikasanPrincipal : user.getPrincipals()) { if (!ikasanPrincipal.getType().equals("user")) { associatedPrincipalsTable.addItem(new Object[] { ikasanPrincipal.getName() }, ikasanPrincipal); } } } ArrayList<String> subjects = new ArrayList<String>(); subjects.add(SystemEventConstants.DASHBOARD_LOGIN_CONSTANTS); subjects.add(SystemEventConstants.DASHBOARD_LOGOUT_CONSTANTS); subjects.add(SystemEventConstants.DASHBOARD_SESSION_EXPIRED_CONSTANTS); List<SystemEvent> events = this.systemEventService.listSystemEvents(subjects, user.getUsername(), null, null); for (SystemEvent systemEvent : events) { SimpleDateFormat dateFormat = new SimpleDateFormat("dd MMM yyyy HH:mm:ss"); String date = dateFormat.format(systemEvent.getTimestamp()); dashboadActivityTable.addItem(new Object[] { systemEvent.getAction(), date }, systemEvent); } subjects = new ArrayList<String>(); subjects.add(SystemEventConstants.DASHBOARD_USER_ROLE_CHANGED_CONSTANTS); events = this.systemEventService.listSystemEvents(subjects, user.getUsername(), null, null); for (SystemEvent systemEvent : events) { SimpleDateFormat dateFormat = new SimpleDateFormat("dd MMM yyyy HH:mm:ss"); String date = dateFormat.format(systemEvent.getTimestamp()); this.permissionChangeTable.addItem(new Object[] { systemEvent.getAction(), date }, systemEvent); } }
From source file:org.ikasan.dashboard.ui.mappingconfiguration.component.MappingConfigurationConfigurationValuesTable.java
License:BSD License
/** * Method to add a record to the component. * /*from w ww .j a v a2 s . co m*/ * @throws MappingConfigurationServiceException */ public void addNewRecord() throws MappingConfigurationServiceException { Long sourceSystemGroupId = null; if (this.mappingConfiguration.getNumberOfParams() > 1) { sourceSystemGroupId = this.mappingConfigurationService.getNextSequenceNumber(); } TargetConfigurationValue targetConfigurationValue = new TargetConfigurationValue(); targetConfigurationValue.setTargetSystemValue("Add targetSystemValue"); this.mappingConfigurationService.saveTargetConfigurationValue(targetConfigurationValue); VerticalLayout tableCellLayout = new VerticalLayout(); SourceConfigurationValue sourceConfigurationValue = null; final Button deleteButton = new Button("Delete"); ArrayList<SourceConfigurationValue> sourceConfigurationValues = new ArrayList<SourceConfigurationValue>(); for (int i = 0; i < this.mappingConfiguration.getNumberOfParams(); i++) { sourceConfigurationValue = new SourceConfigurationValue(); sourceConfigurationValue.setSourceSystemValue("Add source system value"); sourceConfigurationValue.setSourceConfigGroupId(sourceSystemGroupId); sourceConfigurationValue.setTargetConfigurationValue(targetConfigurationValue); sourceConfigurationValue.setMappingConfigurationId(this.mappingConfiguration.getId()); sourceConfigurationValues.add(sourceConfigurationValue); this.mappingConfiguration.getSourceConfigurationValues().add(sourceConfigurationValue); BeanItem<SourceConfigurationValue> item = new BeanItem<SourceConfigurationValue>( sourceConfigurationValue); final TextField tf = new TextField(item.getItemProperty("sourceSystemValue")); tableCellLayout.addComponent(tf); tf.setReadOnly(true); tf.setWidth(300, Unit.PIXELS); } BeanItem<TargetConfigurationValue> targetConfigurationItem = new BeanItem<TargetConfigurationValue>( targetConfigurationValue); final TextField targetConfigurationTextField = new TextField( targetConfigurationItem.getItemProperty("targetSystemValue")); targetConfigurationTextField.setReadOnly(true); targetConfigurationTextField.setWidth(300, Unit.PIXELS); final DeleteRowAction action = new DeleteRowAction(sourceConfigurationValues, this.mappingConfiguration, this, this.mappingConfigurationService, this.systemEventService); deleteButton.setIcon(VaadinIcons.TRASH); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); deleteButton.setDescription("Delete this record"); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { IkasanMessageDialog dialog = new IkasanMessageDialog("Delete record", "This mapping configuration record will be permanently removed. " + "Are you sure you wish to proceed?.", action); UI.getCurrent().addWindow(dialog); } }); final IkasanAuthentication authentication = (IkasanAuthentication) VaadinService.getCurrentRequest() .getWrappedSession().getAttribute(DashboardSessionValueConstants.USER); if (authentication != null && (authentication.hasGrantedAuthority(SecurityConstants.ALL_AUTHORITY) || authentication.hasGrantedAuthority(SecurityConstants.EDIT_MAPPING_AUTHORITY)) || authentication.canAccessLinkedItem(PolicyLinkTypeConstants.MAPPING_CONFIGURATION_LINK_TYPE, mappingConfiguration.getId())) { deleteButton.setVisible(true); } else { deleteButton.setVisible(false); } Item item = this.container.addItemAt(0, sourceConfigurationValue); Property<Layout> sourceProperty = item.getItemProperty("Source Configuration Value"); sourceProperty.setValue(tableCellLayout); Property<TextField> targetProperty = item.getItemProperty("Target Configuration Value"); targetProperty.setValue(targetConfigurationTextField); Property<Button> deleteProperty = item.getItemProperty("Delete"); deleteProperty.setValue(deleteButton); this.mappingConfigurationService.saveMappingConfiguration(mappingConfiguration); this.setEditable(true); IkasanAuthentication principal = (IkasanAuthentication) VaadinService.getCurrentRequest() .getWrappedSession().getAttribute(DashboardSessionValueConstants.USER); logger.info("User: " + principal.getName() + " added new mapping configuration value for Mapping Configuration " + this.mappingConfiguration); systemEventService.logSystemEvent(MappingConfigurationConstants.MAPPING_CONFIGURATION_SERVICE, "Added new mapping configuration value for Mapping Configuration: " + this.mappingConfiguration, principal.getName()); }
From source file:org.ikasan.dashboard.ui.mappingconfiguration.component.MappingConfigurationConfigurationValuesTable.java
License:BSD License
/** * Method to help populate the table with values associated with the MappingConfiguration. * //from w ww .j a v a 2 s .c o m * @param mappingConfiguration */ public void populateTable(final MappingConfiguration mappingConfiguration) { this.mappingConfiguration = mappingConfiguration; Set<SourceConfigurationValue> sourceConfigurationValues = mappingConfiguration .getSourceConfigurationValues(); super.removeAllItems(); Iterator<SourceConfigurationValue> sourceConfigurationValueItr = sourceConfigurationValues.iterator(); ArrayList<SourceConfigurationValue> usedSourceConfigurationValues = new ArrayList<SourceConfigurationValue>(); ArrayList<SourceConfigurationValue> groupedSourceSystemValues = new ArrayList<SourceConfigurationValue>(); while (sourceConfigurationValueItr.hasNext()) { SourceConfigurationValue value = sourceConfigurationValueItr.next(); VerticalLayout tableCellLayout = new VerticalLayout(); for (int i = 0; i < this.mappingConfiguration.getNumberOfParams(); i++) { if (!usedSourceConfigurationValues.contains(value)) { groupedSourceSystemValues.add(value); BeanItem<SourceConfigurationValue> item = new BeanItem<SourceConfigurationValue>(value); final TextField tf = new TextField(item.getItemProperty("sourceSystemValue")); tf.setWidth(300, Unit.PIXELS); tableCellLayout.addComponent(tf); tf.setReadOnly(true); usedSourceConfigurationValues.add(value); Iterator<SourceConfigurationValue> partnerSourceConfigurationValueItr = sourceConfigurationValues .iterator(); while (partnerSourceConfigurationValueItr.hasNext()) { SourceConfigurationValue partnerSourceConfigurationValue = partnerSourceConfigurationValueItr .next(); if (partnerSourceConfigurationValue.getSourceConfigGroupId() != null && !usedSourceConfigurationValues.contains(partnerSourceConfigurationValue) && partnerSourceConfigurationValue.getId().compareTo(value.getId()) != 0 && partnerSourceConfigurationValue.getSourceConfigGroupId() .compareTo(value.getSourceConfigGroupId()) == 0) { groupedSourceSystemValues.add(partnerSourceConfigurationValue); item = new BeanItem<SourceConfigurationValue>(partnerSourceConfigurationValue); final TextField stf = new TextField(item.getItemProperty("sourceSystemValue")); stf.setWidth(300, Unit.PIXELS); tableCellLayout.addComponent(stf); stf.setReadOnly(true); usedSourceConfigurationValues.add(partnerSourceConfigurationValue); } } TargetConfigurationValue targetConfigurationValue = value.getTargetConfigurationValue(); BeanItem<TargetConfigurationValue> targetConfigurationItem = new BeanItem<TargetConfigurationValue>( targetConfigurationValue); final TextField targetConfigurationTextField = new TextField( targetConfigurationItem.getItemProperty("targetSystemValue")); targetConfigurationTextField.setReadOnly(true); targetConfigurationTextField.setWidth(300, Unit.PIXELS); final DeleteRowAction action = new DeleteRowAction(groupedSourceSystemValues, this.mappingConfiguration, this, this.mappingConfigurationService, this.systemEventService); final Button deleteButton = new Button("Delete"); deleteButton.setData(value); deleteButton.setIcon(VaadinIcons.TRASH); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); deleteButton.setDescription("Delete this record"); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { IkasanMessageDialog dialog = new IkasanMessageDialog("Delete record", "This mapping configuration record will be permanently removed. " + "Are you sure you wish to proceed?.", action); UI.getCurrent().addWindow(dialog); } }); final IkasanAuthentication authentication = (IkasanAuthentication) VaadinService .getCurrentRequest().getWrappedSession() .getAttribute(DashboardSessionValueConstants.USER); if (authentication != null && (authentication.hasGrantedAuthority(SecurityConstants.ALL_AUTHORITY) || authentication.hasGrantedAuthority(SecurityConstants.EDIT_MAPPING_AUTHORITY)) || authentication.canAccessLinkedItem( PolicyLinkTypeConstants.MAPPING_CONFIGURATION_LINK_TYPE, mappingConfiguration.getId())) { deleteButton.setVisible(true); } else { deleteButton.setVisible(false); } this.addItem(new Object[] { tableCellLayout, targetConfigurationTextField, deleteButton }, value); groupedSourceSystemValues = new ArrayList<SourceConfigurationValue>(); } } } }
From source file:org.ikasan.dashboard.ui.mappingconfiguration.listener.MappingSearchButtonClickListener.java
License:BSD License
@Override public void buttonClick(ClickEvent event) { saveRequiredMonitor.manageSaveRequired("searchResultsPanel"); String clientName = null;//from w w w .j a v a 2 s. c o m if (this.clientComboBox.getValue() != null) { clientName = ((ConfigurationServiceClient) this.clientComboBox.getValue()).getName(); } String typeName = null; if (this.typeComboBox.getValue() != null) { typeName = ((ConfigurationType) this.typeComboBox.getValue()).getName(); } String sourceContextName = null; if (this.sourceContextComboBox.getValue() != null) { sourceContextName = ((ConfigurationContext) this.sourceContextComboBox.getValue()).getName(); } String targetContextName = null; if (this.targetContextComboBox.getValue() != null) { targetContextName = ((ConfigurationContext) this.targetContextComboBox.getValue()).getName(); } List<MappingConfigurationLite> mappingConfigurations = this.mappingConfigurationService .getMappingConfigurationLites(clientName, typeName, sourceContextName, targetContextName); this.searchResultsTable.removeAllItems(); for (MappingConfigurationLite mappingConfiguration : mappingConfigurations) { final DeleteMappingConfigurationAction action = new DeleteMappingConfigurationAction( mappingConfiguration.getId(), this.searchResultsTable, this.mappingConfigurationService, this.systemEventService); final Button deleteButton = new Button(); deleteButton.setIcon(VaadinIcons.TRASH); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); deleteButton.setDescription("Delete this mapping configuration"); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { IkasanMessageDialog dialog = new IkasanMessageDialog("Delete record", "This mapping configuration record will be permanently removed. " + "Are you sure you wish to proceed?.", action); UI.getCurrent().addWindow(dialog); } }); this.visibilityGroup.registerComponent(SecurityConstants.ALL_AUTHORITY, deleteButton); this.searchResultsTable.addItem( new Object[] { mappingConfiguration.getConfigurationServiceClient().getName(), mappingConfiguration.getConfigurationType().getName(), mappingConfiguration.getSourceContext().getName(), mappingConfiguration.getTargetContext().getName(), deleteButton }, mappingConfiguration.getId()); } }
From source file:org.ikasan.dashboard.ui.mappingconfiguration.panel.MappingConfigurationPanel.java
License:BSD License
/** * Helper method to initialise this object. */// w w w . jav a 2 s. c o m @SuppressWarnings("serial") protected void init() { layout = new GridLayout(5, 6); layout.setSpacing(true); layout.setMargin(true); layout.setWidth("100%"); this.addStyleName(ValoTheme.PANEL_BORDERLESS); paramQueriesLayout = new VerticalLayout(); toolBarLayout = new HorizontalLayout(); toolBarLayout.setWidth("100%"); Button linkButton = new Button(); linkButton.setIcon(VaadinIcons.REPLY_ALL); linkButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); linkButton.setDescription("Return to search results"); linkButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); linkButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { Navigator navigator = new Navigator(UI.getCurrent(), menuLayout.getContentContainer()); for (IkasanUIView view : topLevelNavigator.getIkasanViews()) { navigator.addView(view.getPath(), view.getView()); } saveRequiredMonitor.manageSaveRequired("mappingView"); navigator = new Navigator(UI.getCurrent(), mappingNavigator.getContainer()); for (IkasanUIView view : mappingNavigator.getIkasanViews()) { navigator.addView(view.getPath(), view.getView()); } } }); toolBarLayout.addComponent(linkButton); toolBarLayout.setExpandRatio(linkButton, 0.865f); this.editButton.setIcon(VaadinIcons.EDIT); this.editButton.setDescription("Edit the mapping configuration"); this.editButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); this.editButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); this.editButton.setVisible(false); this.editButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { setEditable(true); mappingConfigurationFunctionalGroup.editButtonPressed(); } }); toolBarLayout.addComponent(this.editButton); toolBarLayout.setExpandRatio(this.editButton, 0.045f); this.saveButton.setIcon(VaadinIcons.HARDDRIVE); this.saveButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); this.saveButton.setDescription("Save the mapping configuration"); this.saveButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); this.saveButton.setVisible(false); this.saveButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { try { logger.info("Save button clicked!!"); save(); setEditable(false); Notification.show("Changes Saved!", "", Notification.Type.HUMANIZED_MESSAGE); mappingConfigurationFunctionalGroup.saveOrCancelButtonPressed(); } catch (InvalidValueException e) { // We can ignore this one as we have already dealt with the // validation messages using the validation framework. } catch (Exception e) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); Notification.show("Cauget exception trying to save a Mapping Configuration!", sw.toString(), Notification.Type.ERROR_MESSAGE); } } }); toolBarLayout.addComponent(this.saveButton); toolBarLayout.setExpandRatio(this.saveButton, 0.045f); this.cancelButton.setIcon(VaadinIcons.CLOSE_CIRCLE); this.cancelButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); this.cancelButton.setDescription("Cancel the current edit"); this.cancelButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); this.cancelButton.setVisible(false); this.cancelButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { setEditable(false); mappingConfigurationFunctionalGroup.saveOrCancelButtonPressed(); Navigator navigator = new Navigator(UI.getCurrent(), menuLayout.getContentContainer()); for (IkasanUIView view : topLevelNavigator.getIkasanViews()) { navigator.addView(view.getPath(), view.getView()); } saveRequiredMonitor.manageSaveRequired("mappingView"); navigator = new Navigator(UI.getCurrent(), mappingNavigator.getContainer()); for (IkasanUIView view : mappingNavigator.getIkasanViews()) { navigator.addView(view.getPath(), view.getView()); } } }); toolBarLayout.addComponent(this.cancelButton); toolBarLayout.setExpandRatio(this.cancelButton, 0.045f); FileDownloader fd = new FileDownloader(this.getMappingConfigurationExportStream()); fd.extend(exportMappingConfigurationButton); this.exportMappingConfigurationButton.setIcon(VaadinIcons.DOWNLOAD_ALT); this.exportMappingConfigurationButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); this.exportMappingConfigurationButton.setDescription("Export the current mapping configuration"); this.exportMappingConfigurationButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); toolBarLayout.addComponent(this.exportMappingConfigurationButton); toolBarLayout.setExpandRatio(this.exportMappingConfigurationButton, 0.045f); final GridLayout contentLayout = new GridLayout(1, 2); contentLayout.setWidth("100%"); contentLayout.addComponent(toolBarLayout); contentLayout.addComponent(createMappingConfigurationForm()); VerticalSplitPanel vpanel = new VerticalSplitPanel(contentLayout, createTableLayout(false)); vpanel.setStyleName(ValoTheme.SPLITPANEL_LARGE); paramQueriesLayout.setSpacing(true); Label configValueLabels = new Label("Source Configuration Value Queries:"); layout.addComponent(configValueLabels, 2, 2, 3, 2); Panel queryParamsPanel = new Panel(); queryParamsPanel.addStyleName(ValoTheme.PANEL_BORDERLESS); queryParamsPanel.setHeight(100, Unit.PIXELS); queryParamsPanel.setWidth(100, Unit.PERCENTAGE); queryParamsPanel.setContent(paramQueriesLayout); this.layout.addComponent(queryParamsPanel, 2, 3, 3, 5); vpanel.setSplitPosition(325, Unit.PIXELS); this.setContent(vpanel); this.setSizeFull(); }