Exemplo n.º 1
0
 public void set(XObject input) {
   if (input instanceof XGroup) {
     XGroup group = (XGroup) input;
     membersTable.removeAll();
     List<String> userIDs = Arrays.asList(group.getUserIDs());
     setUsers(userIDs);
   }
 }
Exemplo n.º 2
0
 public void set(XObject input) {
   if (input instanceof XGroup) {
     XGroup group = (XGroup) input;
     rolesTable.removeAll();
     boolean isAdm = group != null && group.getName() != null && group.getName().equals("admin");
     ((CheckBoxTableColumn) rolesTable.getColumnModel().getColumn(0)).setEnabled(!isAdm);
     List<String> roleIDs = Arrays.asList(group.getRoleIDs());
     setRoles(roleIDs);
   }
 }
Exemplo n.º 3
0
  public void fillTable() {
    table.removeAll();
    String fetchList = "";
    for (int i = start; i < start + NUMBER_OF_RESULTS && i < currentResults.getLength(); i++)
      fetchList += ((NativeElement) currentResults.item(i)).getAttribute("id") + ",";

    if (fetchList.length() > 0)
      TaxonomyCache.impl.fetchList(
          fetchList,
          new GenericCallback<String>() {
            public void onFailure(Throwable arg0) {
              WindowUtils.hideLoadingAlert();
              WindowUtils.errorAlert("Error loading results. Inconsistency in index table.");
            }

            public void onSuccess(String arg0) {
              List<String> assessmentList = new ArrayList<String>();
              final String[][] x = new String[20][7];
              for (int i = start;
                  i < start + NUMBER_OF_RESULTS && i < currentResults.getLength();
                  i++) {
                TaxonNode currentNode =
                    TaxonomyCache.impl.getNode(
                        ((NativeElement) currentResults.item(i)).getAttribute("id"));

                x[i - start][0] = currentNode.getFullName();
                if (currentNode.getCommonNames().size() > 0)
                  x[i - start][1] = (currentNode.getCommonNames().get(0)).getName().toLowerCase();
                else x[i - start][1] = "";
                x[i - start][2] = TaxonNode.getDisplayableLevel(currentNode.getLevel());
                x[i - start][4] = String.valueOf(currentNode.getId());
                if (currentNode.getAssessments().size() > 0) {
                  x[i - start][3] = String.valueOf(currentNode.getAssessments().get(0));
                  assessmentList.add(
                      currentNode.getAssessments().get(0)
                          + "_"
                          + BaseAssessment.PUBLISHED_ASSESSMENT_STATUS);
                } else x[i - start][3] = "N/A";
                if (currentNode.getFootprint().length >= 5)
                  x[i - start][5] = currentNode.getFootprint()[4];
                else x[i - start][5] = "N/A";
                if (currentNode.getFootprint().length >= 6)
                  x[i - start][6] = currentNode.getFootprint()[5];
                else x[i - start][5] = "N/A";
              }

              AssessmentCache.impl.fetchAssessments(
                  new AssessmentFetchRequest(assessmentList, null),
                  new GenericCallback<String>() {
                    public void onFailure(Throwable caught) {
                      for (int i = start;
                          i < start + NUMBER_OF_RESULTS && i < currentResults.getLength();
                          i++) {
                        x[i - start][3] = "N/A";
                        TableItem tItem = new TableItem(x[i - start]);
                        table.add(tItem);
                      }
                      // x[i-start][3] = "N/A";
                      // SysDebugger.getInstance().println("FAILURES!");
                      SysDebugger.getInstance().println(caught.getMessage());

                      layout();
                    }

                    public void onSuccess(String result) {
                      for (int i = start;
                          i < start + NUMBER_OF_RESULTS && i < currentResults.getLength();
                          i++) {
                        AssessmentData aData =
                            AssessmentCache.impl.getPublishedAssessment(x[i - start][3], false);
                        if (aData == null) x[i - start][3] = "N/A";
                        else x[i - start][3] = aData.getProperCategoryAbbreviation();
                        TableItem tItem = new TableItem(x[i - start]);
                        table.add(tItem);
                      }

                      layout();
                    }
                  });
            }
          });
  }