@Override public void addComponent() { VerticalPanel verticalPanel = new VerticalPanel(); verticalPanel.setSpacing(10); FieldSet fieldSet = new FieldSet(); fieldSet.setHeading("Share Project to Users"); fieldSet.setWidth(GPProjectManagementWidget.COMPONENT_WIDTH - 25); this.projectNameLabel = new Label(); this.projectNameLabel.setStyleAttribute("font-size", "13"); this.ownerLabel = new Label(); this.ownerLabel.setStyleAttribute("font-size", "13"); this.organizationLabel = new Label(); this.organizationLabel.setStyleAttribute("font-size", "13"); fieldSet.add(this.projectNameLabel, new MarginData(10)); fieldSet.add(ownerLabel, new MarginData(10)); fieldSet.add(organizationLabel, new MarginData(10)); verticalPanel.add(fieldSet); // LayoutContainer labelListContainer = new LayoutContainer(new BorderLayout()); labelListContainer.setHeight(20); labelListContainer.setStyleAttribute("background-color", "white"); labelListContainer.setWidth(GPProjectManagementWidget.COMPONENT_WIDTH - 25); Label organizationUserLabel = new Label("Organization Users:"); organizationUserLabel.setStyleAttribute("font-size", "13"); organizationUserLabel.setStyleAttribute("font-weight", "bold"); labelListContainer.add(organizationUserLabel, new BorderLayoutData(Style.LayoutRegion.WEST)); Label projectSharedUserLabel = new Label("Project Shared Users:"); projectSharedUserLabel.setStyleAttribute("font-size", "13"); projectSharedUserLabel.setStyleAttribute("font-weight", "bold"); labelListContainer.add(projectSharedUserLabel, new BorderLayoutData(Style.LayoutRegion.EAST)); verticalPanel.add(labelListContainer); // final DualListField<GPSimpleUser> lists = new DualListField<GPSimpleUser>(); lists.setMode(Mode.INSERT); lists.setHeight("" + GPProjectManagementWidget.COMPONENT_HEIGHT / 1.75); lists.setStyleAttribute("margin-left", "11px"); lists.setHideLabel(Boolean.TRUE); ListField<GPSimpleUser> from = lists.getFromList(); from.setDisplayField(GPSimpleUserKeyValue.NAME.toString()); this.fromStore = new ListStore<GPSimpleUser>(); from.setStore(this.fromStore); ListField<GPSimpleUser> to = lists.getToList(); to.setDisplayField(GPSimpleUserKeyValue.NAME.toString()); this.toStore = new ListStore<GPSimpleUser>(); to.setStore(this.toStore); Button cancelButton = new Button( "GoTo Search Project", BasicWidgetResources.ICONS.gear(), new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { ShareProjectPanel.this.reset(); projectManagementWidget.showSearchProjectPanel(); } }); super.addButton(cancelButton); saveButton = new Button( "Save", BasicWidgetResources.ICONS.save(), new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { toStore.commitChanges(); List<Long> accountIDsProject = Lists.newArrayListWithCapacity(toStore.getModels().size()); IGPAccountDetail accountDetail = Registry.get(UserSessionEnum.ACCOUNT_DETAIL_IN_SESSION.name()); boolean test = false; for (GPSimpleUser user : toStore.getModels()) { if (user.getId().equals(accountDetail.getId())) { test = true; } accountIDsProject.add(user.getId()); } final boolean isShared = test; ShareProjectPanel.this.reset(); LayerRemote.Util.getInstance() .shareProjectToUsers( project.getId(), accountIDsProject, new AsyncCallback<Boolean>() { @Override public void onFailure(Throwable caught) { System.out.println("Error on saving user to share project"); } @Override public void onSuccess(Boolean result) { // System.out.println("Project is Shared: // " + isShared); if (project.isDefaultProject()) { GPClientProject projInSession = Registry.get(UserSessionEnum.CURRENT_PROJECT_ON_TREE.name()); if (isShared) { projInSession.setShared(Boolean.TRUE); } else { projInSession.setShared(Boolean.FALSE); } } project.setShared(Boolean.TRUE); loadData(project); } }); } }); super.addButton(saveButton); super.add(verticalPanel); super.add(lists, new FormData("98%")); LayoutContainer filterContainer = new LayoutContainer(new BorderLayout()); this.fromFilter = this.createServerFilter(this.fromFilter, fromStore, "Organization Users"); filterContainer.add(this.fromFilter, new BorderLayoutData(Style.LayoutRegion.WEST)); this.toFilter = this.createServerFilter(this.toFilter, toStore, "Sharing User List"); filterContainer.add(this.toFilter, new BorderLayoutData(Style.LayoutRegion.EAST)); filterContainer.setStyleAttribute("margin", "11px"); super.add(filterContainer); }