コード例 #1
0
ファイル: GroupEditor.java プロジェクト: hiekay/SpagoBI-V4x
  public GroupMembersTab(final IEditor editor) {
    super(constants.members());
    this.editor = editor;
    setText(constants.members());
    setIconStyle("icon-user");
    setClosable(false);

    // create groups table
    List<TableColumn> columns = new ArrayList<TableColumn>();
    TableColumn cbox = new CheckBoxTableColumn("mem_check");
    columns.add(cbox);
    TableColumn col = new TableColumn("User", constants.user(), 200);
    col.setMinWidth(75);
    col.setMaxWidth(400);
    columns.add(col);

    TableColumnModel cm = new TableColumnModel(columns);

    membersTable = new Table(cm);
    membersTable.setSelectionMode(SelectionMode.SINGLE);
    membersTable.setHorizontalScroll(true);
    // disable to allow CheckBox widget!
    membersTable.setBulkRender(false);
    membersTable.setAutoHeight(true);

    membersTable.addTableListener(
        new TableListener() {
          public void tableCellClick(TableEvent te) {
            editor.markDirty();
          }
        });

    add(membersTable);
  }
コード例 #2
0
ファイル: GroupEditor.java プロジェクト: hiekay/SpagoBI-V4x
 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);
   }
 }
コード例 #3
0
  public SearchPanel(PanelManager manager) {
    panelManager = manager;

    // BUILDING ALL FINAL STUFFS
    expandableResults = new ContentPanel();
    expandableResults.setStyleName("x-panel");
    expandableResults.setCollapsible(true);

    expandableSearch = new HorizontalPanel();

    advancedOptions = new ContentPanel();
    advancedOptions.setCollapsible(true);
    advancedOptions.setStyleName("x-panel");

    common = new CheckBox();
    sciName = new CheckBox();
    countryOfOcc = new CheckBox();
    countryOfOccText = new TextBox();
    assessor = new CheckBox();
    assessorText = new TextBox();
    table = new Table();
    table.setBulkRender(false);
    searchBox = new TextBox();
    searchBox.addKeyboardListener(
        new KeyboardListenerAdapter() {
          @Override
          public void onKeyPress(Widget sender, char keyCode, int modifiers) {
            if (keyCode == KEY_ENTER) searchButton.fireEvent(Events.Select);
          }
        });

    // setLayoutOnChange(true);
    build();
  }
コード例 #4
0
ファイル: GroupEditor.java プロジェクト: hiekay/SpagoBI-V4x
 private final XUser[] getAllUsers() {
   List<XUser> users = new ArrayList<XUser>();
   for (TableItem item : membersTable.getItems()) {
     users.add((XUser) item.getData(MEMBER_DATA));
   }
   return users.toArray(new XUser[0]);
 }
コード例 #5
0
ファイル: GroupEditor.java プロジェクト: hiekay/SpagoBI-V4x
 public void set(XObject input) {
   if (input instanceof XGroup) {
     XGroup group = (XGroup) input;
     membersTable.removeAll();
     List<String> userIDs = Arrays.asList(group.getUserIDs());
     setUsers(userIDs);
   }
 }
コード例 #6
0
ファイル: GroupEditor.java プロジェクト: hiekay/SpagoBI-V4x
 private final XRole[] getSelectedRoles() {
   // collect all selected roles:
   List<XRole> roles = new ArrayList<XRole>();
   for (TableItem item : rolesTable.getItems()) {
     boolean selected = false;
     Object colVal = item.getValue(0);
     if (colVal instanceof CheckBox) selected = ((CheckBox) colVal).getValue();
     else if (colVal instanceof Boolean) selected = ((Boolean) colVal).booleanValue();
     if (selected) roles.add((XRole) item.getData(ROLE_DATA));
   }
   return roles.toArray(new XRole[0]);
 }
コード例 #7
0
ファイル: GroupEditor.java プロジェクト: hiekay/SpagoBI-V4x
  GroupRolesTab(final IEditor editor) {
    super(constants.roles());
    setText(constants.roles());
    setIconStyle("icon-role2");
    setClosable(false);

    // create roles table
    List<TableColumn> columns = new ArrayList<TableColumn>();
    TableColumn cbox = new CheckBoxTableColumn("role_check");
    columns.add(cbox);
    TableColumn col = new TableColumn("Role", constants.role(), 150);
    col.setMinWidth(75);
    col.setMaxWidth(300);
    columns.add(col);
    col = new TableColumn("Right", constants.right(), 100);
    col.setAlignment(HorizontalAlignment.LEFT);
    columns.add(col);
    col = new TableColumn("Description", constants.description(), 800);
    col.setMaxWidth(800);
    col.setAlignment(HorizontalAlignment.LEFT);
    columns.add(col);

    TableColumnModel cm = new TableColumnModel(columns);

    rolesTable = new Table(cm);
    rolesTable.setSelectionMode(SelectionMode.MULTI);
    rolesTable.setHorizontalScroll(true);
    rolesTable.setBulkRender(false);
    rolesTable.setAutoHeight(true);

    rolesTable.addTableListener(
        new TableListener() {
          public void tableCellClick(TableEvent te) {
            editor.markDirty();
          }
        });

    add(rolesTable);
  }
コード例 #8
0
ファイル: GroupEditor.java プロジェクト: hiekay/SpagoBI-V4x
 private final boolean isSelected(XUser user) {
   for (TableItem item : membersTable.getItems()) {
     XUser xu = (XUser) item.getData(MEMBER_DATA);
     if (xu.equals(user)) {
       boolean selected = false;
       Object colVal = item.getValue(0);
       if (colVal instanceof CheckBox) selected = ((CheckBox) colVal).getValue();
       else if (colVal instanceof Boolean) selected = ((Boolean) colVal).booleanValue();
       return selected;
     }
   }
   return false;
 }
コード例 #9
0
  protected void buildTable() {

    columns = new TableColumn[7];

    columns[0] = new TableColumn("Scientific Name", .27f);
    columns[0].setMinWidth(75);
    columns[0].setMaxWidth(300);

    columns[1] = new TableColumn("Common Name", .27f);
    columns[1].setMaxWidth(300);
    columns[1].setMinWidth(75);
    columns[1].setAlignment(HorizontalAlignment.LEFT);

    columns[2] = new TableColumn("Level", .1f);
    columns[2].setMaxWidth(50);
    columns[2].setMaxWidth(100);

    columns[3] = new TableColumn("Category", .1f);
    columns[3].setMaxWidth(50);
    columns[3].setMaxWidth(50);
    columns[3].setAlignment(HorizontalAlignment.RIGHT);

    columns[4] = new TableColumn("id", 0);
    columns[4].setHidden(true);

    columns[5] = new TableColumn("Family", .13f);
    columns[5].setMinWidth(75);
    columns[5].setMaxWidth(100);
    columns[5].setAlignment(HorizontalAlignment.RIGHT);

    columns[6] = new TableColumn("Genus", .13f);
    columns[6].setMinWidth(75);
    columns[6].setMaxWidth(100);
    columns[6].setAlignment(HorizontalAlignment.RIGHT);

    TableColumnModel cm = new TableColumnModel(columns);
    table.setColumnModel(cm);

    expandableResults.setLayout(new BorderLayout());
    expandableResults.add(table, new BorderLayoutData(LayoutRegion.CENTER));
    expandableResults.add(toolbar, new BorderLayoutData(LayoutRegion.SOUTH, 30));
  }
コード例 #10
0
  protected void setSelectionModelForTable() {
    table.setSelectionModel(
        new TableSelectionModel(SelectionMode.SINGLE) {
          @Override
          protected void onMouseDown(ContainerEvent ce) {
            super.onMouseDown(ce);

            TaxonomyCache.impl.fetchNode(
                (String) table.getSelectedItem().getValues()[4],
                true,
                new GenericCallback<TaxonNode>() {
                  public void onFailure(Throwable caught) {}

                  public void onSuccess(TaxonNode result) {
                    panelManager.taxonomicSummaryPanel.update(
                        (String) table.getSelectedItem().getValues()[4]);
                    WindowManager.get().hideAll();
                  }
                });
          }
        });
  }
コード例 #11
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();
                    }
                  });
            }
          });
  }