Example #1
0
 /** langRefresh */
 public void langRefresh() {
   searchButton.setHTML(Main.i18n("button.search"));
   cleanButton.setHTML(Main.i18n("button.clean"));
   saveSearchButton.setHTML(Main.i18n("button.save.search"));
   advancedView.setText(Main.i18n("search.view.advanced"));
   compactResultsView.setText(Main.i18n("search.view.compact.results"));
   showPropertyGroups.setText(Main.i18n("search.view.propety.groups"));
   saveUserNews.setText(Main.i18n("search.save.as.news"));
   resultsPageText.setHTML(Main.i18n("search.page.results"));
   searchTypeText.setHTML(Main.i18n("search.type"));
   controlSearch.langRefresh();
 }
  public void setLabels() {
    lblShow.setText(app.getLocalization().getPlain("Show"));
    showAuxiliaryObjects.setText(app.getLocalization().getPlain("AuxiliaryObjects"));

    lblSortMode.setText(app.getLocalization().getPlain("SortBy"));
    lblDescriptionMode.setText(app.getLocalization().getMenu("AlgebraDescriptions"));
    updateSortMode();
    updateDescription();
  }
 public static CheckBox addCheckBox(Panel p, String label, String infoMsg) {
   HorizontalPanel hp = new HorizontalPanel();
   CheckBox cb = new CheckBox(label);
   cb.setText(label);
   hp.add(cb);
   Image info = new Image(ImporterPlugin.RESOURCES.info());
   info.setTitle(infoMsg);
   hp.add(info);
   p.add(hp);
   return cb;
 }
Example #4
0
  @Test
  public void text() {
    // Arrange
    CheckBox cb = new CheckBox("foo");
    // Pre-Assert
    assertEquals("foo", cb.getText());

    // Act
    cb.setText("text");

    // Assert
    assertEquals("text", cb.getText());
  }
Example #5
0
  private void buildAdvancedOptionsPanel() {
    advancedOptions.setHeading("Advanced Search Options");
    VerticalPanel vp = new VerticalPanel();
    advancedOptions.setLayout(new FillLayout());

    common.setChecked(true);
    common.setText("Search Common Names");

    sciName.setText("Search Scientific Names");
    sciName.setChecked(true);

    HorizontalPanel hp1 = new HorizontalPanel();
    countryOfOcc.setText("Country of Occurrence");
    hp1.add(countryOfOcc);
    hp1.add(countryOfOccText);

    HorizontalPanel hp2 = new HorizontalPanel();
    assessor.setText("Assessor");
    hp2.add(assessor);
    hp2.add(assessorText);

    common.setWidth("100px");
    sciName.setWidth("100px");

    // panel.add(showAdvanced);
    vp.add(new HTML("<b>Taxon Filters:</b>"));
    vp.add(common);
    vp.add(sciName);
    vp.add(new HTML("<hr><b>Assessment Filters:</b>"));
    vp.add(hp1);
    vp.add(hp2);
    advancedOptions.add(vp);

    // if(advancedSearch)/

  }
  public FilterComponent() {
    fullTextFilter = new FullTextMatcherFilterComponent("Contains Text");

    initWidget(uiBinder.createAndBindUi(this));

    try {
      com.google.gwt.dom.client.Element tr =
          disclosurePanel.getHeader().getElement().getFirstChildElement().getFirstChildElement();
      com.google.gwt.dom.client.Element labelTd = tr.getFirstChildElement().getNextSiblingElement();
      labelTd.getStyle().setColor("#f4faff");
    } catch (Exception e) {
      //            quite risky operation only for changing the color of a label - if it will fail
      // than it is better to ignore it and leave the black there and continue than fail the whole
      // app
    }

    activateFilter.setText(FILTERS_ACTIVE);

    new ModulesLyfecycleListenerHandler(Modules.BOARDS, this);
  }
  private Widget doInsertLogical() {
    HorizontalPanel hp = new HorizontalPanel();

    final CheckBox cb = new CheckBox();
    cb.setValue(editingCol.isInsertLogical());
    cb.setText("");
    cb.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent arg0) {
            if (sce.isGlobalVariable(editingCol.getBoundName())) {
              cb.setEnabled(false);
              editingCol.setInsertLogical(false);
            } else {
              editingCol.setInsertLogical(cb.getValue());
            }
          }
        });
    hp.add(cb);
    hp.add(new InfoPopup(constants.UpdateFact(), constants.UpdateDescription()));
    return hp;
  }
  private void drawLoginInputs() {

    // default
    tbConsumerSecret.setVisible(true);
    tbConsumerSecretPass.setVisible(false);

    // reset ui
    pUi.clear();

    cbRemberMe.setText("Remember Me");

    hAccountCreate = new Hyperlink("Create Account", "account_Create");

    tbConsumerKey.setTitle(inputLabel_ConsumerKey);
    tbConsumerSecret.setTitle(inputLabel_consumerSecret);
    tbConsumerSecretPass.setTitle(inputLabel_consumerSecret);

    // hide loading by default
    hideLoading();

    // main login inputs
    HorizontalPanel ploginItems = new HorizontalPanel();
    ploginItems.setWidth("100%");
    ploginItems.add(tbConsumerKey);
    ploginItems.add(tbConsumerSecret);
    ploginItems.add(tbConsumerSecretPass);
    ploginItems.add(bLogin);

    // login options
    HorizontalPanel pOptions = new HorizontalPanel();
    // pOptions.setSpacing(4);
    pOptions.add(cbRemberMe);
    pOptions.add(hForgotPassword);
    pOptions.add(hAccountCreate);

    VerticalPanel vp = new VerticalPanel();
    vp.setWidth("100%");
    vp.add(ploginItems);
    vp.add(pOptions);

    // TODO - move this to a floating overlay
    vp.add(pError);

    pUi.add(vp);

    drawInputLabel_key();
    drawInputLabel_secret();

    tbConsumerKey.addStyleName("login-Ui-InputConsumerKey");
    tbConsumerSecret.addStyleName("login-Ui-InputConsumerSecret");
    tbConsumerSecretPass.addStyleName("login-Ui-InputConsumerSecret");
    pOptions.setCellHorizontalAlignment(hForgotPassword, HorizontalPanel.ALIGN_RIGHT);
    pOptions.setCellHorizontalAlignment(hAccountCreate, HorizontalPanel.ALIGN_RIGHT);
    pOptions.setCellVerticalAlignment(hForgotPassword, VerticalPanel.ALIGN_BOTTOM);
    pOptions.setCellVerticalAlignment(hAccountCreate, VerticalPanel.ALIGN_BOTTOM);
    pOptions.addStyleName("login-Ui-InputOptions");
    pOptions.setWidth("100%");

    // vp.addStyleName("test1");
    // pOptions.addStyleName("test2");
  }
  private Widget buildLoginPanel(boolean openInNewWindowDefault) {
    userTextBox.setWidth("100%"); // $NON-NLS-1$
    passwordTextBox.setWidth("100%"); // $NON-NLS-1$
    usersListBox.setWidth("100%"); // $NON-NLS-1$

    userTextBox.setStyleName("login-panel-label");
    passwordTextBox.setStyleName("login-panel-label");
    newWindowChk.setStyleName("login-panel-label");

    VerticalPanel credentialsPanel = new VerticalPanel();

    credentialsPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    credentialsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
    SimplePanel spacer;
    if (showUsersList) {
      // populate default users list box
      addDefaultUsers();
      Label sampleUsersLabel = new Label(Messages.getString("sampleUser") + ":");
      sampleUsersLabel.setStyleName("login-panel-label");
      credentialsPanel.add(sampleUsersLabel); // $NON-NLS-1$ //$NON-NLS-2$
      credentialsPanel.add(usersListBox);
      spacer = new SimplePanel();
      spacer.setHeight("8px"); // $NON-NLS-1$
      credentialsPanel.add(spacer);
    }

    Label usernameLabel = new Label(Messages.getString("username") + ":");
    usernameLabel.setStyleName("login-panel-label");

    credentialsPanel.add(usernameLabel); // $NON-NLS-1$ //$NON-NLS-2$
    credentialsPanel.add(userTextBox);

    spacer = new SimplePanel();
    spacer.setHeight("8px"); // $NON-NLS-1$
    credentialsPanel.add(spacer);

    credentialsPanel.setCellHeight(spacer, "8px"); // $NON-NLS-1$
    HTML passwordLabel = new HTML(Messages.getString("password") + ":");
    passwordLabel.setStyleName("login-panel-label");
    credentialsPanel.add(passwordLabel); // $NON-NLS-1$ //$NON-NLS-2$
    credentialsPanel.add(passwordTextBox);

    boolean reallyShowNewWindowOption = showNewWindowOption;

    String showNewWindowOverride =
        Window.Location.getParameter("showNewWindowOption"); // $NON-NLS-1$
    if (showNewWindowOverride != null && !"".equals(showNewWindowOverride)) { // $NON-NLS-1$
      // if the override is set, we MUST obey it above all else
      reallyShowNewWindowOption = "true".equals(showNewWindowOverride); // $NON-NLS-1$
    } else if (getReturnLocation() != null && !"".equals(getReturnLocation())) { // $NON-NLS-1$
      StringTokenizer st = new StringTokenizer(getReturnLocation(), "?&"); // $NON-NLS-1$
      // first token will be ignored, it is 'up to the ?'
      for (int i = 1; i < st.countTokens(); i++) {
        StringTokenizer paramTokenizer = new StringTokenizer(st.tokenAt(i), "="); // $NON-NLS-1$
        if (paramTokenizer.countTokens() == 2) {
          // we've got a name=value token
          if (paramTokenizer.tokenAt(0).equalsIgnoreCase("showNewWindowOption")) { // $NON-NLS-1$
            reallyShowNewWindowOption = "true".equals(paramTokenizer.tokenAt(1)); // $NON-NLS-1$
            break;
          }
        }
      }
    }

    // New Window checkbox
    if (reallyShowNewWindowOption) {
      spacer = new SimplePanel();
      spacer.setHeight("8px"); // $NON-NLS-1$
      credentialsPanel.add(spacer);
      credentialsPanel.setCellHeight(spacer, "8px"); // $NON-NLS-1$

      newWindowChk.setText(Messages.getString("launchInNewWindow")); // $NON-NLS-1$

      String cookieCheckedVal = Cookies.getCookie("loginNewWindowChecked"); // $NON-NLS-1$
      if (cookieCheckedVal != null) {
        newWindowChk.setValue(Boolean.parseBoolean(cookieCheckedVal));
      } else {
        // default is false, per BISERVER-2384
        newWindowChk.setValue(openInNewWindowDefault);
      }

      credentialsPanel.add(newWindowChk);
    }

    userTextBox.setTabIndex(1);
    passwordTextBox.setTabIndex(2);
    if (reallyShowNewWindowOption) {
      newWindowChk.setTabIndex(3);
    }
    passwordTextBox.setText(""); // $NON-NLS-1$

    setFocusWidget(userTextBox);

    Image lockImage = new Image(GWT.getModuleBaseURL() + "images/icon_login_lock.png");
    HorizontalPanel loginPanel = new HorizontalPanel();
    loginPanel.setSpacing(5);
    loginPanel.setStyleName("login-panel");
    loginPanel.add(lockImage);
    loginPanel.add(credentialsPanel);

    return loginPanel;
  }
 public void setExpectsAnswerLabel(String expectsAnswerLabel) {
   expectsAnswerContainer.setText(expectsAnswerLabel);
 }
  public Widget draw() {

    titleWidget.setText(Utils.getStrippedStringWithEllipsis(group.getName()) + ": settings");

    // Main panel
    final VerticalPanel vp = new VerticalPanel();
    vp.setSize("100%", "100%");

    final TabMenu menu = new TabMenu();

    // Adds menu to the main panel
    vp.add(menu);
    vp.setCellHeight(menu, "30px");

    // IDS
    final Map<String, Integer> ids = new HashMap<String, Integer>();
    ids.put("group", groupId);

    // define GET ATTRIBUTES callback
    final GetAttributesV2 jsonCallback = new GetAttributesV2();
    jsonCallback.setIds(ids);
    if (!session.isGroupAdmin(groupId) && !session.isVoAdmin(group.getVoId()))
      jsonCallback.setCheckable(false);
    final CellTable<Attribute> table = jsonCallback.getEmptyTable();
    table.setWidth("100%");
    table.addStyleName("perun-table");
    ScrollPanel sp = new ScrollPanel(table);
    sp.addStyleName("perun-tableScrollPanel");
    session.getUiElements().resizePerunTable(sp, 350, this);
    vp.add(sp);

    // define GET RES. REQ ATTRIBUTES callback
    final GetResourceRequiredAttributesV2 reqAttrs =
        new GetResourceRequiredAttributesV2(
            null, JsonCallbackEvents.passDataToAnotherCallback(jsonCallback));

    // GROUP RESOURCES LISTBOX
    final ListBoxWithObjects<Resource> resourceDropDown = new ListBoxWithObjects<Resource>();
    resourceDropDown.setTitle(
        "By selecting a resource you will switch to either group-resource or member-resource setting (you must pick member too)");

    // fill table with group attributes on page load
    if (lastSelectedMemberId == 0 && lastSelectedResourceId == 0) {
      jsonCallback.retrieveData();
    } else {
      // load attrs by listbox selection after calls are done
      Scheduler.get()
          .scheduleFixedPeriod(
              new Scheduler.RepeatingCommand() {
                @Override
                public boolean execute() {
                  // load proper table if something was selected
                  if (resCallDone && memCallDone) {
                    // trigger change event
                    DomEvent.fireNativeEvent(Document.get().createChangeEvent(), resourceDropDown);
                    return false;
                  }
                  return true;
                }
              },
              200);
    }

    // fill resources listbox
    if (resources == null) {
      // get assigned resources
      GetAssignedResources resources =
          new GetAssignedResources(
              groupId,
              PerunEntity.GROUP,
              new JsonCallbackEvents() {
                public void onFinished(JavaScriptObject jso) {
                  ArrayList<Resource> resources = JsonUtils.jsoAsList(jso);
                  resourceDropDown.clear();
                  if (resources != null && !resources.isEmpty()) {
                    resources = new TableSorter<Resource>().sortByName(resources);
                    resourceDropDown.addNotSelectedOption();
                    for (int i = 0; i < resources.size(); i++) {
                      resourceDropDown.addItem(resources.get(i));
                      if (lastSelectedResourceId == resources.get(i).getId()) {
                        resourceDropDown.setSelected(resources.get(i), true);
                      }
                    }
                  } else {
                    resourceDropDown.addItem("No resources available");
                  }
                  resCallDone = true;
                }

                public void onError(PerunError error) {
                  resourceDropDown.clear();
                  resourceDropDown.addItem("Error while loading");
                  resCallDone = true;
                }

                public void onLoadingStart() {
                  resCallDone = false;
                  resourceDropDown.clear();
                  resourceDropDown.addItem("Loading...");
                }
              });
      resources.retrieveData();

    } else {
      // use predefined resources
      resourceDropDown.addNotSelectedOption();
      resources = new TableSorter<Resource>().sortByName(resources);
      resourceDropDown.addAllItems(resources);
    }

    // GROUP MEMBERS LISTBOX
    final ListBoxWithObjects<RichMember> membersDropDown = new ListBoxWithObjects<RichMember>();
    membersDropDown.setTitle(
        "By selecting a member you will switch to either member or member-resource settings (you must pick resource too)");

    // fill members listbox
    GetGroupRichMembers members =
        new GetGroupRichMembers(
            groupId,
            new JsonCallbackEvents() {
              public void onFinished(JavaScriptObject jso) {
                ArrayList<RichMember> mems = JsonUtils.jsoAsList(jso);
                membersDropDown.clear();
                if (mems != null && !mems.isEmpty()) {
                  mems = new TableSorter<RichMember>().sortByName(mems);
                  membersDropDown.addNotSelectedOption();
                  for (int i = 0; i < mems.size(); i++) {
                    membersDropDown.addItem(mems.get(i));
                    if (mems.get(i).getId() == lastSelectedMemberId) {
                      membersDropDown.setSelected(mems.get(i), true);
                    }
                  }
                } else {
                  membersDropDown.addItem("No members available");
                }
                memCallDone = true;
              }

              public void onError(PerunError error) {
                membersDropDown.clear();
                membersDropDown.addItem("Error while loading");
                memCallDone = true;
              }

              public void onLoadingStart() {
                memCallDone = false;
                membersDropDown.clear();
                membersDropDown.addItem("Loading...");
              }
            });
    members.retrieveData();

    // CHECKBOXES "FOR ALL MEMBERS"
    final CheckBox memChb = new CheckBox();
    memChb.setText("To all members");
    memChb.setVisible(false);
    memChb.setTitle("Uses this setting for all members of this group.");
    memChb.setValue(false);

    // SAVE CHANGES BUTTON
    final CustomButton saveChangesButton =
        TabMenu.getPredefinedButton(
            ButtonType.SAVE, ButtonTranslation.INSTANCE.saveChangesInAttributes());
    if (!session.isGroupAdmin(groupId) && !session.isVoAdmin(group.getVoId()))
      saveChangesButton.setEnabled(false);

    // click handler to save group and member-user attributes
    final ClickHandler saveAttrsClickHandler =
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            final ArrayList<Attribute> list = jsonCallback.getTableSelectedList();

            if (UiElements.cantSaveEmptyListDialogBox(list)) {

              // refresh table and disable button a event for GetAttributes
              final JsonCallbackEvents events =
                  JsonCallbackEvents.disableButtonEvents(
                      saveChangesButton, JsonCallbackEvents.refreshTableEvents(jsonCallback));

              if (memChb.getValue() == true) {
                // to all members selected
                UiElements.generateInfo(
                    WidgetTranslation.INSTANCE.saveConfirmTitle(),
                    "Same value(s) for selected attribute(s) will be set to ALL members of group.",
                    new ClickHandler() {
                      public void onClick(ClickEvent event) {
                        ArrayList<RichMember> memList = membersDropDown.getAllObjects();
                        for (int i = 0; i < memList.size(); i++) {
                          SetAttributes request = new SetAttributes();
                          if (i == memList.size() - 1) {
                            request.setEvents(events);
                          } else {
                            request.setEvents(
                                JsonCallbackEvents.disableButtonEvents(saveChangesButton));
                          }
                          Map<String, Integer> ids = new HashMap<String, Integer>();
                          ids.put("member", memList.get(i).getId());
                          ids.put("workWithUserAttributes", 1);
                          request.setAttributes(ids, list);
                        }
                      }
                    });
              } else {
                // just one group / memeber
                SetAttributes request = new SetAttributes(events);
                request.setAttributes(jsonCallback.getIds(), list);
              }
            }
          }
        };

    // click handler to save required attributes
    final ClickHandler saveReqAttrsClickHandler =
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            final ArrayList<Attribute> list = jsonCallback.getTableSelectedList();
            // check if not empty
            if (UiElements.cantSaveEmptyListDialogBox(list)) {

              // refresh table and disable button a event for GetResourceRequiredAttributes
              final JsonCallbackEvents events =
                  JsonCallbackEvents.disableButtonEvents(
                      saveChangesButton,
                      new JsonCallbackEvents() {
                        public void onFinished(JavaScriptObject jso) {
                          jsonCallback.clearTable();
                          // set back resourceToGetServicesFrom
                          Map<String, Integer> ids = reqAttrs.getIds();
                          if (ids.containsKey("resource")) {
                            ids.put("resourceToGetServicesFrom", ids.get("resource"));
                          }
                          if (ids.containsKey("user")) {
                            ids.put("workWithUserAttributes", 1);
                          }
                          if (ids.containsKey("resource") && ids.containsKey("group")) {
                            ids.put("workWithGroupAttributes", 1);
                          }
                          reqAttrs.setIds(ids);
                          reqAttrs.retrieveData();
                        }
                      });

              final SetAttributes request = new SetAttributes();

              if (memChb.getValue() == true) {
                // to all members selected
                UiElements.generateInfo(
                    WidgetTranslation.INSTANCE.saveConfirmTitle(),
                    "Same value(s) for selected attribute(s) will be set to ALL members of group.",
                    new ClickHandler() {
                      public void onClick(ClickEvent event) {
                        ArrayList<RichMember> memList = membersDropDown.getAllObjects();
                        for (int i = 0; i < memList.size(); i++) {
                          if (i == 0) {
                            events.onLoadingStart();
                          } // trigger disable button if first
                          Map<String, Integer> ids = new HashMap<String, Integer>();
                          ids.put("member", memList.get(i).getId());
                          ids.put("user", memList.get(i).getUserId());
                          ids.put("resource", resourceDropDown.getSelectedObject().getId());
                          ids.put("facility", resourceDropDown.getSelectedObject().getFacilityId());
                          if (i == memList.size() - 1) {
                            request.setEvents(events);
                          } // set events to last to get refresh and button enable
                          request.setAttributes(ids, list);
                        }
                      }
                    });
              } else {
                // group or member
                request.setEvents(events); // disable button events
                request.setAttributes(reqAttrs.getIds(), list);
              }
            }
          }
        };

    // REMOVE BUTTON
    final CustomButton removeButton =
        TabMenu.getPredefinedButton(
            ButtonType.REMOVE, ButtonTranslation.INSTANCE.removeAttributes());
    if (!session.isGroupAdmin(groupId) && !session.isVoAdmin(group.getVoId()))
      removeButton.setEnabled(false);

    // click handler to remove group and member-user attributes
    final ClickHandler removeAttrsClickHandler =
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            final ArrayList<Attribute> list = jsonCallback.getTableSelectedList();
            if (UiElements.cantSaveEmptyListDialogBox(list)) {

              // refresh table and disable button a event for GetAttributes
              final JsonCallbackEvents events =
                  JsonCallbackEvents.disableButtonEvents(
                      removeButton, JsonCallbackEvents.refreshTableEvents(jsonCallback));

              final RemoveAttributes request = new RemoveAttributes();

              if (memChb.getValue() == true) {
                // to all members selected
                UiElements.generateInfo(
                    WidgetTranslation.INSTANCE.deleteConfirmTitle(),
                    "Selected attribute(s) will be removed from ALL members of group.",
                    new ClickHandler() {
                      public void onClick(ClickEvent event) {
                        ArrayList<RichMember> memList = membersDropDown.getAllObjects();
                        for (int i = 0; i < memList.size(); i++) {
                          if (i == 0) {
                            events.onLoadingStart();
                          } // trigger disable button if first
                          Map<String, Integer> ids = new HashMap<String, Integer>();
                          ids.put("member", memList.get(i).getId());
                          ids.put("workWithUserAttributes", 1);
                          if (i == memList.size() - 1) {
                            request.setEvents(events);
                          } // set events to last to get refresh and button enable
                          request.removeAttributes(ids, list);
                        }
                      }
                    });
              } else {
                // just one group / memeber
                request.setEvents(events); // disable button events
                request.removeAttributes(jsonCallback.getIds(), list);
              }
            }
          }
        };

    // click handler to remove ResourceRequiredAttributes
    final ClickHandler removeReqAttrsClickHandler =
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            final ArrayList<Attribute> list = jsonCallback.getTableSelectedList();
            if (UiElements.cantSaveEmptyListDialogBox(list)) {

              // refresh table and disable button a event for GetAttributes
              final JsonCallbackEvents events =
                  JsonCallbackEvents.disableButtonEvents(
                      removeButton,
                      new JsonCallbackEvents() {
                        public void onFinished(JavaScriptObject jso) {
                          jsonCallback.clearTable();
                          // set back resourceToGetServicesFrom
                          Map<String, Integer> ids = reqAttrs.getIds();
                          if (ids.containsKey("resource")) {
                            ids.put("resourceToGetServicesFrom", ids.get("resource"));
                          }
                          if (ids.containsKey("user")) {
                            ids.put("workWithUserAttributes", 1);
                          }
                          if (ids.containsKey("resource") && ids.containsKey("group")) {
                            ids.put("workWithGroupAttributes", 1);
                          }
                          reqAttrs.setIds(ids);
                          reqAttrs.retrieveData();
                        }
                      });

              final RemoveAttributes request = new RemoveAttributes();

              if (memChb.getValue() == true) {
                // to all members selected
                UiElements.generateInfo(
                    WidgetTranslation.INSTANCE.deleteConfirmTitle(),
                    "Selected attribute(s) will be removed from ALL members of group.",
                    new ClickHandler() {
                      @Override
                      public void onClick(ClickEvent event) {
                        ArrayList<RichMember> memList = membersDropDown.getAllObjects();
                        for (int i = 0; i < memList.size(); i++) {
                          if (i == 0) {
                            events.onLoadingStart();
                          } // trigger disable button if first
                          Map<String, Integer> ids = new HashMap<String, Integer>();
                          ids.put("member", memList.get(i).getId());
                          ids.put("user", memList.get(i).getUserId());
                          ids.put("resource", resourceDropDown.getSelectedObject().getId());
                          ids.put("facility", resourceDropDown.getSelectedObject().getFacilityId());
                          if (i == memList.size() - 1) {
                            request.setEvents(events);
                          } // set events to last to get refresh and button enable
                          request.removeAttributes(ids, list);
                        }
                      }
                    });
              } else {
                // just one group / member
                request.setEvents(events); // disable button events
                request.removeAttributes(reqAttrs.getIds(), list);
              }
            }
          }
        };

    // SET NEW ATTR BUTTON
    final CustomButton setNewAttributeButton =
        TabMenu.getPredefinedButton(ButtonType.ADD, ButtonTranslation.INSTANCE.setNewAttributes());
    if (!session.isGroupAdmin(groupId) && !session.isVoAdmin(group.getVoId()))
      setNewAttributeButton.setEnabled(false);
    // click handler
    setNewAttributeButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            ids.clear();
            if (resourceDropDown.getSelectedIndex() > 0) {
              if (membersDropDown.getSelectedIndex() > 0) {
                ids.put("member", membersDropDown.getSelectedObject().getId());
                ids.put("user", membersDropDown.getSelectedObject().getUserId());
                ids.put("resource", resourceDropDown.getSelectedObject().getId());
                ids.put("facility", resourceDropDown.getSelectedObject().getFacilityId());
              } else {
                ids.put("resource", resourceDropDown.getSelectedObject().getId());
                ids.put("group", groupId);
                ids.put("workWithGroupAttributes", 1);
              }
            } else {
              if (membersDropDown.getSelectedIndex() > 0) {
                ids.put("member", membersDropDown.getSelectedObject().getId());
                ids.put("user", membersDropDown.getSelectedObject().getUserId());
              } else {
                ids.put("group", groupId);
              }
            }
            session
                .getTabManager()
                .addTabToCurrentTab(new SetNewAttributeTabItem(ids, jsonCallback.getList()), true);
          }
        });

    // ClickHandlersRegistration - save onClicks for GetAttributes
    final ArrayList<HandlerRegistration> clickHandlers = new ArrayList<HandlerRegistration>();
    clickHandlers.add(saveChangesButton.addClickHandler(saveAttrsClickHandler));
    clickHandlers.add(removeButton.addClickHandler(removeAttrsClickHandler));

    // DEFINE CHANGE HANDLER FOR ALL DROP DOWNS
    ChangeHandler changeHandler =
        new ChangeHandler() {
          public void onChange(ChangeEvent event) {

            int resIndex = resourceDropDown.getSelectedIndex();
            int memIndex = membersDropDown.getSelectedIndex();

            // no resource or member selected
            if (resIndex == 0 && memIndex == 0) {
              lastSelectedMemberId = 0;
              lastSelectedResourceId = 0;
              memChb.setValue(false);
              memChb.setVisible(false);
              jsonCallback.clearTable();
              ids.clear();
              ids.put("group", groupId);
              jsonCallback.setIds(ids);
              jsonCallback.retrieveData();
              for (HandlerRegistration handler : clickHandlers) {
                if (handler != null) {
                  handler.removeHandler();
                }
              }
              clickHandlers.add(saveChangesButton.addClickHandler(saveAttrsClickHandler));
              clickHandlers.add(removeButton.addClickHandler(removeAttrsClickHandler));
            }
            // no resource but member selected
            if (resIndex == 0 && memIndex > 0) {
              lastSelectedMemberId = membersDropDown.getSelectedObject().getId();
              lastSelectedResourceId = 0;
              memChb.setValue(false);
              memChb.setVisible(true);
              jsonCallback.clearTable();
              ids.clear();
              ids.put("member", membersDropDown.getSelectedObject().getId());
              ids.put("workWithUserAttributes", 1);
              jsonCallback.setIds(ids);
              jsonCallback.retrieveData();
              for (HandlerRegistration handler : clickHandlers) {
                if (handler != null) {
                  handler.removeHandler();
                }
              }
              clickHandlers.add(saveChangesButton.addClickHandler(saveAttrsClickHandler));
              clickHandlers.add(removeButton.addClickHandler(removeAttrsClickHandler));
            }
            // resource and no member selected
            if (resIndex > 0 && memIndex == 0) {
              lastSelectedMemberId = 0;
              lastSelectedResourceId = resourceDropDown.getSelectedObject().getId();
              memChb.setValue(false);
              memChb.setVisible(false);
              jsonCallback.clearTable();
              ids.clear();
              ids.put("group", groupId);
              ids.put("resource", resourceDropDown.getSelectedObject().getId());
              ids.put("resourceToGetServicesFrom", ids.get("resource"));
              ids.put("workWithGroupAttributes", 1);
              reqAttrs.setIds(ids);
              reqAttrs.retrieveData();
              // set ids back to make saveChanges work
              ids.remove("resourceToGetServicesFrom");
              reqAttrs.setIds(ids);
              for (HandlerRegistration handler : clickHandlers) {
                if (handler != null) {
                  handler.removeHandler();
                }
              }
              clickHandlers.add(saveChangesButton.addClickHandler(saveReqAttrsClickHandler));
              clickHandlers.add(removeButton.addClickHandler(removeReqAttrsClickHandler));
            }
            // resource and member selected
            if (resIndex > 0 && memIndex > 0) {
              lastSelectedMemberId = membersDropDown.getSelectedObject().getId();
              lastSelectedResourceId = resourceDropDown.getSelectedObject().getId();
              memChb.setValue(false);
              memChb.setVisible(true);
              jsonCallback.clearTable();
              ids.clear();
              ids.put("resource", resourceDropDown.getSelectedObject().getId());
              ids.put("resourceToGetServicesFrom", ids.get("resource"));
              ids.put("member", membersDropDown.getSelectedObject().getId());
              ids.put("workWithUserAttributes", 1);
              reqAttrs.setIds(ids);
              reqAttrs.retrieveData();
              // set ids back to make saveChanges work
              ids.clear();
              ids.put("member", membersDropDown.getSelectedObject().getId());
              ids.put("user", membersDropDown.getSelectedObject().getUser().getId());
              ids.put("facility", resourceDropDown.getSelectedObject().getFacilityId());
              ids.put("resource", resourceDropDown.getSelectedObject().getId());
              reqAttrs.setIds(ids);
              for (HandlerRegistration handler : clickHandlers) {
                if (handler != null) {
                  handler.removeHandler();
                }
              }
              clickHandlers.add(saveChangesButton.addClickHandler(saveReqAttrsClickHandler));
              clickHandlers.add(removeButton.addClickHandler(removeReqAttrsClickHandler));
            }
          }
        };

    // ADD CHANGE HANDLERS TO DROP-DOWN MENUS
    resourceDropDown.addChangeHandler(changeHandler);
    membersDropDown.addChangeHandler(changeHandler);

    // PUT ELEMENTS IN MENU
    menu.addWidget(saveChangesButton);
    // menu.addWidget(resChb);
    menu.addWidget(memChb);
    menu.addWidget(setNewAttributeButton);
    menu.addWidget(removeButton);
    menu.addWidget(new HTML("<strong>Resources:</strong>"));
    menu.addWidget(resourceDropDown);
    menu.addWidget(new HTML("<strong>Members:</strong>"));
    menu.addWidget(membersDropDown);

    this.contentWidget.setWidget(vp);

    return getWidget();
  }