Exemple #1
0
 @UiHandler("species")
 public void handleSpeciesChange(ChangeEvent changeEvent) {
   if (singleSelectionModel.getSelectedObject() != null) {
     singleSelectionModel.getSelectedObject().setSpecies(species.getText());
     updateOrganismInfo();
   }
 }
Exemple #2
0
 @UiHandler("blatdb")
 public void handleBlatDbChange(ChangeEvent changeEvent) {
   if (singleSelectionModel.getSelectedObject() != null) {
     singleSelectionModel.getSelectedObject().setBlatDb(blatdb.getText());
     updateOrganismInfo();
   }
 }
Exemple #3
0
 @UiHandler("genus")
 public void handleGenusChange(ChangeEvent changeEvent) {
   if (singleSelectionModel.getSelectedObject() != null) {
     singleSelectionModel.getSelectedObject().setGenus(genus.getText());
     updateOrganismInfo();
   }
 }
Exemple #4
0
 @UiHandler("sequenceFile")
 public void handleOrganismDirectory(ChangeEvent changeEvent) {
   if (singleSelectionModel.getSelectedObject() != null) {
     singleSelectionModel.getSelectedObject().setDirectory(sequenceFile.getText());
     updateOrganismInfo();
   }
 }
  @Test
  public void click() {
    // Given
    final StringBuilder sb = new StringBuilder();

    // Add a selection model to handle user selection.
    final SingleSelectionModel<Contact> selectionModel = new SingleSelectionModel<Contact>();
    table.setSelectionModel(selectionModel);
    selectionModel.addSelectionChangeHandler(
        new SelectionChangeEvent.Handler() {
          public void onSelectionChange(SelectionChangeEvent event) {
            Contact selected = selectionModel.getSelectedObject();
            if (selected != null) {
              sb.append(selected.name).append(" : ").append(selected.address);
            }
          }
        });

    // When 1
    Browser.click(table, CONTACTS.get(0));

    // Then 1
    assertThat(sb.toString()).isEqualTo("Gael : 666 Evil");
    assertThat(table.getSelectionModel().isSelected(CONTACTS.get(0))).isTrue();

    // When 2 : deselect
    Browser.click(table, CONTACTS.get(0));

    // Then 2
    assertThat(sb.toString()).isEqualTo("Gael : 666 Evil");
    assertThat(table.getSelectionModel().isSelected(CONTACTS.get(0))).isFalse();
  }
Exemple #6
0
 @UiHandler("organismName")
 public void handleOrganismNameChange(ChangeEvent changeEvent) {
   if (singleSelectionModel.getSelectedObject() != null) {
     singleSelectionModel.getSelectedObject().setName(organismName.getText());
     updateOrganismInfo();
   }
 }
  private void setDataObject(DataObject dataObject) {
    this.dataObject = dataObject;
    refreshObjectSelector(dataObject);

    // We create a new selection model due to a bug found in GWT when we change e.g. from one data
    // object with 9 rows
    // to one with 3 rows and the table was sorted.
    // Several tests has been done and the final workaround (not too bad) we found is to
    // 1) sort the table again
    // 2) create a new selection model
    // 3) populate the table with new items
    // 3) select the first row
    SingleSelectionModel selectionModel2 = new SingleSelectionModel<ObjectProperty>();
    dataObjectPropertiesTable.setSelectionModel(selectionModel2);

    selectionModel2.addSelectionChangeHandler(
        new SelectionChangeEvent.Handler() {

          @Override
          public void onSelectionChange(SelectionChangeEvent event) {
            ObjectProperty selectedProperty =
                ((SingleSelectionModel<ObjectProperty>)
                        dataObjectPropertiesTable.getSelectionModel())
                    .getSelectedObject();
            notifyFieldSelected(selectedProperty);
          }
        });

    List<ObjectProperty> dataObjectProperties =
        (dataObject != null)
            ? DataModelerUtils.getManagedProperties(dataObject)
            : Collections.<ObjectProperty>emptyList();

    ArrayList<ObjectProperty> sortBuffer = new ArrayList<ObjectProperty>();
    if (dataObject != null) {
      sortBuffer.addAll(dataObjectProperties);
    }
    Collections.sort(sortBuffer, new ObjectPropertyComparator("name"));

    dataObjectPropertiesProvider.getList().clear();
    dataObjectPropertiesProvider.getList().addAll(sortBuffer);
    dataObjectPropertiesProvider.flush();
    dataObjectPropertiesProvider.refresh();

    dataObjectPropertiesTable
        .getColumnSortList()
        .push(new ColumnSortList.ColumnSortInfo(dataObjectPropertiesTable.getColumn(2), true));

    if (dataObjectProperties.size() > 0) {
      dataObjectPropertiesTable.setKeyboardSelectedRow(0);
      selectionModel2.setSelected(sortBuffer.get(0), true);
    }

    // set the first row selected again. Sounds crazy, but's part of the workaround, don't remove
    // this line.
    if (dataObjectProperties.size() > 0) {
      dataObjectPropertiesTable.setKeyboardSelectedRow(0);
    }
  }
 private void showWorkersCellTable(String json) {
   jsonData = getJSONData(json);
   workers = new ArrayList<MyWorker>();
   Worker worker = null;
   for (int i = 1; i < jsonData.length(); i++) {
     worker = jsonData.get(i);
     String name = worker.getName();
     String username = worker.getUsername();
     String department = worker.getDepartment();
     int id = worker.getId();
     MyWorker w = new MyWorker(name, username, department, id);
     workers.add(w);
   }
   TextColumn<MyWorker> nameCol =
       new TextColumn<MyWorker>() {
         @Override
         public String getValue(MyWorker worker) {
           return worker.name;
         }
       };
   TextColumn<MyWorker> usernameCol =
       new TextColumn<MyWorker>() {
         @Override
         public String getValue(MyWorker worker) {
           return worker.username;
         }
       };
   TextColumn<MyWorker> deptCol =
       new TextColumn<MyWorker>() {
         @Override
         public String getValue(MyWorker worker) {
           return worker.department;
         }
       };
   CellTable<MyWorker> table = new CellTable<MyWorker>();
   final SingleSelectionModel<MyWorker> selectionModel = new SingleSelectionModel<MyWorker>();
   table.setSelectionModel(selectionModel);
   selectionModel.addSelectionChangeHandler(
       new SelectionChangeEvent.Handler() {
         public void onSelectionChange(SelectionChangeEvent e) {
           MyWorker choice = selectionModel.getSelectedObject();
           if (choice != null) {
             selectedWorker = choice;
           }
         }
       });
   table.addColumn(nameCol, "Name");
   table.addColumn(usernameCol, "Username");
   table.addColumn(deptCol, "Department");
   table.setRowCount(workers.size(), true);
   table.setRowData(0, workers);
   HorizontalPanel buttonPanel = new HorizontalPanel();
   buttonPanel.add(addButton);
   buttonPanel.add(editButton);
   buttonPanel.add(deleteButton);
   mainPanel.clear();
   mainPanel.add(buttonPanel);
   mainPanel.add(table);
 }
  /** Creates table what contains list of available commits. */
  private void createCommitsTable() {
    commits = new CellTable<Revision>(15, tableRes);

    Column<Revision, String> dateColumn =
        new Column<Revision, String>(new TextCell()) {
          @Override
          public String getValue(Revision revision) {
            return DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_MEDIUM)
                .format(new Date((long) revision.getCommitTime()));
          }

          @Override
          public void render(Cell.Context context, Revision revision, SafeHtmlBuilder sb) {
            sb.appendHtmlConstant(
                "<div id=\""
                    + UIObject.DEBUG_ID_PREFIX
                    + "git-reset-cellTable-"
                    + context.getIndex()
                    + "\">");
            super.render(context, revision, sb);
          }
        };
    Column<Revision, String> commiterColumn =
        new Column<Revision, String>(new TextCell()) {
          @Override
          public String getValue(Revision revision) {
            if (revision.getCommitter() == null) {
              return "";
            }
            return revision.getCommitter().getName();
          }
        };
    Column<Revision, String> commentColumn =
        new Column<Revision, String>(new TextCell()) {
          @Override
          public String getValue(Revision revision) {
            return revision.getMessage();
          }
        };

    commits.addColumn(dateColumn, locale.commitGridDate());
    commits.setColumnWidth(dateColumn, "20%");
    commits.addColumn(commiterColumn, locale.commitGridCommiter());
    commits.setColumnWidth(commiterColumn, "20%");
    commits.addColumn(commentColumn, locale.commitGridComment());
    commits.setColumnWidth(commentColumn, "60%");

    final SingleSelectionModel<Revision> selectionModel = new SingleSelectionModel<Revision>();
    selectionModel.addSelectionChangeHandler(
        new SelectionChangeEvent.Handler() {
          @Override
          public void onSelectionChange(SelectionChangeEvent event) {
            Revision selectedObject = selectionModel.getSelectedObject();
            delegate.onRevisionSelected(selectedObject);
          }
        });
    commits.setSelectionModel(selectionModel);
  }
  private CellList<String> configureUserList() {
    ArrayList<String> team = User.getStrTeam();
    userList.setText("");

    // Create a cell to render each value.
    TextCell textCell = new TextCell();

    // Create a CellList that uses the cell.
    CellList<String> cellList = new CellList<String>(textCell);
    cellList.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);

    // Add a selection model to handle user selection.
    final SingleSelectionModel<String> selectionModel = new SingleSelectionModel<String>();
    cellList.setSelectionModel(selectionModel);
    selectionModel.addSelectionChangeHandler(
        new SelectionChangeEvent.Handler() {
          public void onSelectionChange(SelectionChangeEvent event) {
            String selected = selectionModel.getSelectedObject();
            if (selected != null) {
              String str = userList.getText();
              if (str.contains(selected)) {
                // Remove the user that is already in the
                // textarea
                String strArray[] = str.split(",");
                String temp = "";
                for (int i = 0; i < strArray.length; i++) {
                  if (!strArray[i].equals(selected)) {
                    if (i != 0) {
                      temp = temp.concat(",");
                    }
                    temp = temp.concat(strArray[i]);
                  }
                }
                userList.setText(temp);
              } else {
                // Add the user to the textarea
                if (str.isEmpty()) {
                  userList.setText(selected);
                } else {
                  userList.setText(str + ", " + selected);
                }
              }
            }
            selectionModel.setSelected(selected, false);
            selectionModel.clear();
          }
        });

    // Set the total row count. This isn't strictly necessary, but it
    // affects paging calculations, so its good habit to keep the row count
    // up to date.
    cellList.setRowCount(team.size(), true);

    // Push the data into the widget.
    cellList.setRowData(0, User.getStrTeam());

    return cellList;
  }
Exemple #11
0
 @UiHandler("deleteButton")
 public void handleDeleteOrganism(ClickEvent clickEvent) {
   if (Window.confirm(
       "Are you sure you want to delete " + singleSelectionModel.getSelectedObject().getName())) {
     deleteButton.setEnabled(false);
     deleteButton.setText("Processing");
     savingNewOrganism = true;
     OrganismRestService.deleteOrganism(
         new UpdateInfoListCallback(), singleSelectionModel.getSelectedObject());
     loadingDialog.show();
   }
 }
Exemple #12
0
  /** Initialize this example. */
  @ShowcaseSource
  @Override
  public Widget onInitialize() {
    Images images = GWT.create(Images.class);

    // Create a CellList.
    ContactCell contactCell = new ContactCell(images.contact());

    // Set a key provider that provides a unique key for each contact. If key is
    // used to identify contacts when fields (such as the name and address)
    // change.
    cellList = new CellList<ContactInfo>(contactCell, ContactDatabase.ContactInfo.KEY_PROVIDER);
    cellList.setPageSize(30);
    cellList.setKeyboardPagingPolicy(KeyboardPagingPolicy.INCREASE_RANGE);

    // Add a selection model so we can select cells.
    final SingleSelectionModel<ContactInfo> selectionModel =
        new SingleSelectionModel<ContactInfo>(ContactDatabase.ContactInfo.KEY_PROVIDER);
    cellList.setSelectionModel(selectionModel);
    selectionModel.addSelectionChangeHandler(
        new SelectionChangeEvent.Handler() {
          public void onSelectionChange(SelectionChangeEvent event) {
            contactForm.setContact(selectionModel.getSelectedObject());
          }
        });

    // Create the UiBinder.
    Binder uiBinder = GWT.create(Binder.class);
    Widget widget = uiBinder.createAndBindUi(this);

    // Add the CellList to the data provider in the database.
    ContactDatabase.get().addDataDisplay(cellList);

    // Set the cellList as the display of the pagers. This example has two
    // pagers. pagerPanel is a scrollable pager that extends the range when the
    // user scrolls to the bottom. rangeLabelPager is a pager that displays the
    // current range, but does not have any controls to change the range.
    pagerPanel.setDisplay(cellList);
    rangeLabelPager.setDisplay(cellList);

    // Handle events from the generate button.
    generateButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            ContactDatabase.get().generateContacts(50);
          }
        });

    return widget;
  }
  /**
   * Create a new EnumRadioEditor, for the provided enum class
   *
   * @param enumClass the enum class
   */
  public EnumRadioEditor(Class<E> enumClass) {
    this.handlerManager = new HandlerManager(this);
    peer =
        new EnumRadioCellTable<E>(
            enumClass, GWT.<EnumRadioCellTableResources>create(EnumRadioCellTableResources.class));

    // Selection Model
    selectionModel =
        new SingleSelectionModel<E>() {
          @Override
          public void setSelected(E object, boolean selected) {
            // enforce disabled set
            if (peer.getDisabledSet().contains(object)) {
              return;
            } else {
              super.setSelected(object, selected);
            }
          };
        };
    peer.setSelectionModel(selectionModel);
    selectionModel.addSelectionChangeHandler(
        new Handler() {
          @Override
          public void onSelectionChange(SelectionChangeEvent event) {
            E selectedObject = selectionModel.getSelectedObject();
            setValue(selectedObject);
            ValueChangeEvent.<E>fire(EnumRadioEditor.this, selectedObject);
          }
        });
  }
  @Inject
  BudgetSiderView(
      Binder uiBinder,
      BudgetCell budgetCell,
      Resources resources,
      SiderListStyle siderListResources) {
    this.keyProvider = setupKeyProvider();
    this.dataProvider = new ListDataProvider<Budget>(keyProvider);

    budgetList = new CellList<Budget>(budgetCell, siderListResources);
    selectionModel = new SingleSelectionModel<Budget>(keyProvider);

    // Init The UI Binder
    initWidget(uiBinder.createAndBindUi(this));

    // Set up CSS Style Classes
    addNew.setStylePrimaryName(resources.buttonStyleCss().button());
    addNew.setStyleName(resources.buttonStyleCss().medium(), true);
    addNew.setStyleName(resources.buttonStyleCss().gray(), true);

    budgetList.setKeyboardSelectionPolicy(
        HasKeyboardSelectionPolicy.KeyboardSelectionPolicy.DISABLED);
    budgetList.setSelectionModel(selectionModel);
    dataProvider.addDataDisplay(budgetList);

    selectionModel.addSelectionChangeHandler(
        new SelectionChangeEvent.Handler() {
          @Override
          public void onSelectionChange(SelectionChangeEvent selectionChangeEvent) {
            getUiHandlers().budgetSelected(selectionModel.getSelectedObject());
          }
        });
  }
Exemple #15
0
  @Override
  public void bind(CellTable<T> table) {
    for (FormAdapter<T> form : forms.values()) {
      form.bind(table);
    }

    SingleSelectionModel<T> selectionModel = (SingleSelectionModel<T>) table.getSelectionModel();
    final SingleSelectionModel<T> finalSelectionModel = selectionModel;

    selectionModel.addSelectionChangeHandler(
        new SelectionChangeEvent.Handler() {
          @Override
          public void onSelectionChange(SelectionChangeEvent event) {
            edit(finalSelectionModel.getSelectedObject());
          }
        });
  }
Exemple #16
0
 public void select(String key) {
   for (Property property : dataProvider.getList()) {
     if (property.getName().equals(key)) {
       selectionModel.setSelected(property, true);
       break;
     }
   }
 }
  private void onProblemSelected(Problem selectedProblem) {
    ProblemAndSubmissionReceipt[] data = page.getSession().get(ProblemAndSubmissionReceipt[].class);
    SingleSelectionModel<? super ProblemAndSubmissionReceipt> sm =
        (SingleSelectionModel<? super ProblemAndSubmissionReceipt>) cellTable.getSelectionModel();
    for (ProblemAndSubmissionReceipt p : data) {
      if (p.getProblem().getProblemId().equals(selectedProblem.getProblemId())) {
        // Found the selected problem, so change the selected row
        sm.clear();
        sm.setSelected(p, true);
        return;
      }
    }

    // The selected problem isn't being viewed currently,
    // so just clear the selection
    sm.clear();
  }
Exemple #18
0
    public SingletonDialog(Set<String> singletonTypes, final SimpleCallback callback) {
      super(Console.CONSTANTS.selectResourceType());

      // Create a CellList that uses the cell.
      cellList =
          new CellList<String>(
              new TextCell() {
                @Override
                public void render(Context context, String data, SafeHtmlBuilder sb) {
                  String cssName =
                      (context.getIndex() % 2 > 0)
                          ? "combobox-item combobox-item-odd"
                          : "combobox-item";

                  if (data.equals(selectionModel.getSelectedObject()))
                    cssName += " combobox-item-selected";

                  sb.append(TEMPLATE.item(cssName, data));
                }
              });

      cellList.setStyleName("fill-layout-width");
      selectionModel = new SingleSelectionModel<String>();

      cellList.setSelectionModel(selectionModel);
      cellList.setRowCount(singletonTypes.size(), true);
      ArrayList<String> values = new ArrayList<String>(singletonTypes);
      cellList.setRowData(0, values);

      selectionModel.setSelected(values.get(0), true);

      VerticalPanel panel = new VerticalPanel();
      panel.setStyleName("fill-layout-width");
      panel.add(cellList.asWidget());
      Widget widget =
          new WindowContentBuilder(
                  panel,
                  new DialogueOptions(
                      Console.CONSTANTS.common_label_continue(),
                      new ClickHandler() {
                        @Override
                        public void onClick(ClickEvent event) {

                          SingletonDialog.this.hide();
                          callback.onSuccess(selectionModel.getSelectedObject());
                        }
                      },
                      Console.CONSTANTS.common_label_cancel(),
                      new ClickHandler() {
                        @Override
                        public void onClick(ClickEvent event) {
                          SingletonDialog.this.hide();
                        }
                      }))
              .build();

      setWidget(widget);
    }
  private SingleSelectionModel<Key> createSelectionModel() {
    final SingleSelectionModel<Key> selectionModel = new SingleSelectionModel<Key>();

    Handler selectionHandler =
        new Handler() {

          @Override
          public void onSelectionChange(SelectionChangeEvent event) {
            SingleSelectionModel<Key> selection = (SingleSelectionModel<Key>) event.getSource();

            selectedKey = selection.getSelectedObject();
          }
        };

    selectionModel.addSelectionChangeHandler(selectionHandler);

    return selectionModel;
  }
 /* (non-Javadoc)
  * @see mat.client.clause.clauseworkspace.presenter.XmlTreeDisplay#removeNode()
  */
 @Override
 public void removeNode() {
   if (selectedNode != null) {
     CellTreeNode parent = selectedNode.getParent();
     parent.removeChild(selectedNode);
     closeParentOpenNodes(cellTree.getRootTreeNode());
     selectionModel.setSelected(parent, true);
   }
 }
  public void activate(final Session session, final SubscriptionRegistrar subscriptionRegistrar) {
    // Subscribe to session ADDED_OBJECT events (so we will see when a course is selected)
    session.subscribe(Session.Event.ADDED_OBJECT, this, subscriptionRegistrar);

    // When a problem is selected, add it to the session
    final SingleSelectionModel<ProblemAndSubmissionReceipt> selectionModel =
        new SingleSelectionModel<ProblemAndSubmissionReceipt>();
    cellTable.setSelectionModel(selectionModel);
    selectionModel.addSelectionChangeHandler(
        new SelectionChangeEvent.Handler() {
          @Override
          public void onSelectionChange(SelectionChangeEvent event) {
            ProblemAndSubmissionReceipt selected = selectionModel.getSelectedObject();
            if (selected != null) {
              // Add the problem to the Session
              session.add(selected.getProblem());
            }
          }
        });

    // Load the exercise when the user double-clicks
    cellTable.addDomHandler(
        new DoubleClickHandler() {
          @Override
          public void onDoubleClick(DoubleClickEvent event) {
            Problem problem = session.get(Problem.class);
            if (problem != null) {
              // Switch to DevelopmentPage
              session.get(PageStack.class).push(PageId.DEVELOPMENT);
            }
          }
        },
        DoubleClickEvent.getType());

    // If there is already a Course selected, load its problems.
    // Otherwise, if there are problems already in the session, display them.
    CourseSelection courseSelection = session.get(CourseSelection.class);
    ProblemAndSubmissionReceipt[] problemList = session.get(ProblemAndSubmissionReceipt[].class);
    if (courseSelection != null) {
      loadProblemsForCourse(courseSelection);
    } else if (problemList != null) {
      displayLoadedProblems(problemList);
    }
  }
 /* (non-Javadoc)
  * @see mat.client.clause.clauseworkspace.presenter.XmlTreeDisplay#paste()
  */
 @Override
 public void paste() {
   if (selectedNode != null) {
     CellTreeNode pasteNode = copiedNode.cloneNode();
     selectedNode.appendChild(pasteNode);
     closeSelectedOpenNodes(cellTree.getRootTreeNode());
     selectionModel.setSelected(selectedNode, true);
     copiedNode = pasteNode;
   }
 }
Exemple #23
0
 public void update(final List<Property> models) {
   dataProvider.setList(models);
   if (models.isEmpty()) {
     selectionModel.clear();
   } else {
     table.selectDefaultEntity();
   }
   SelectionChangeEvent.fire(
       selectionModel); // updates ModelNodeForm's editedEntity with current value
 }
Exemple #24
0
 @UiHandler("btnRemove")
 void removeRecord(ClickEvent e) {
   InputItem user = selectionModel.getSelectedObject();
   if (user != null) {
     changedRecs.remove(user.getId());
     removedRecs.put(user.getId(), user);
     recordStore.getList().remove(user);
     editMode(true);
   }
 }
  private SingleSelectionModel<OrganicationClient> setSelectionModel(
      CellTable<OrganicationClient> cellTable) {
    final SingleSelectionModel<OrganicationClient> selectionModel =
        new SingleSelectionModel<OrganicationClient>();

    SelectionChangeEvent.Handler selectionHandler =
        new SelectionChangeEvent.Handler() {
          @Override
          public void onSelectionChange(SelectionChangeEvent event) {
            OrganicationClient staff = selectionModel.getSelectedObject();
            if (!display.getSpecialTextBox().containsItem(staff)) {
              display.getSpecialTextBox().addItem(staff);
            }
          }
        };
    selectionModel.addSelectionChangeHandler(selectionHandler);
    // cellTable.setSelectionEnabled(true); // FIXME make sure it works
    cellTable.setSelectionModel(selectionModel);

    return selectionModel;
  }
 /* (non-Javadoc)
  * @see mat.client.clause.clauseworkspace.presenter.XmlTreeDisplay#addNode(java.lang.String, java.lang.String, short)
  */
 @Override
 public CellTreeNode addNode(String value, String label, short nodeType) {
   CellTreeNode childNode = null;
   if ((selectedNode != null)
       && (value != null)
       && (value.trim().length() > 0)) { // if nodeTex textbox is not empty
     childNode = selectedNode.createChild(value, label, nodeType);
     closeSelectedOpenNodes(cellTree.getRootTreeNode());
     selectionModel.setSelected(selectedNode, true);
   }
   return childNode;
 }
  public KscComboboxViewImpl() {
    initWidget(uiBinder.createAndBindUi(this));

    m_layoutPanel.setSize("100%", "23px");
    m_textBox.addKeyDownHandler(
        new KeyDownHandler() {

          @Override
          public void onKeyDown(KeyDownEvent event) {
            if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
              if (m_presenter != null) {
                m_presenter.onEnterKeyEvent();
              }
            }
          }
        });

    m_selectionModel = new SingleSelectionModel<KscReportDetail>();
    m_selectionModel.addSelectionChangeHandler(
        new SelectionChangeEvent.Handler() {

          @Override
          public void onSelectionChange(SelectionChangeEvent event) {
            m_presenter.onKscReportSelected();
          }
        });

    m_reportList = new CellList<KscReportDetail>(new KscReportDetailCell());
    m_reportList.setPageSize(10);
    m_reportList.getElement().getStyle().setFontSize(12, Unit.PX);
    m_reportList.setSelectionModel(m_selectionModel);

    m_dataList = new ListDataProvider<KscReportDetail>();
    m_dataList.addDataDisplay(m_reportList);

    m_pager = new SimplePager();
    m_pager.setStyleName("onms-table-no-borders-margin");
    m_pager.getElement().getStyle().setWidth(100, Unit.PCT);
    m_pager.setDisplay(m_reportList);

    FlowPanel flowPanel = new FlowPanel();
    flowPanel.add(m_reportList);
    flowPanel.add(m_pager);
    m_popupPanel = new PopupPanel();
    m_popupPanel.add(flowPanel);
    m_popupPanel.setAutoHideEnabled(true);
    m_popupPanel.setAnimationEnabled(true);
    m_popupPanel.setModal(false);
    m_popupPanel.getElement().getStyle().setBorderWidth(1, Unit.PX);
    m_popupPanel.getElement().getStyle().setBorderColor("#B5B8C8");
    m_popupPanel.getElement().getStyle().setPadding(1, Unit.PX);
  }
  @Override
  public void setData(BookSelectList data) {
    selectionPanel.clear();

    final SingleSelectionModel<BookInfo> selectionModel = new SingleSelectionModel<>();
    TreeViewModel browserModel =
        new BookSelectionTreeViewModel(data, data.getCategory(), selectionModel);

    BookSelectionBrowserResources css = GWT.create(BookSelectionBrowserResources.class);
    final RosaCellBrowser browser =
        new RosaCellBrowser(
            new CellBrowser.Builder<>(browserModel, null)
                .pageSize(Integer.MAX_VALUE)
                .resources(css));

    browser.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.BOUND_TO_SELECTION);
    browser.setSize("100%", "100%");

    int parent_width = getParent() == null ? DEFAULT_WIDTH : getParent().getOffsetWidth() - 30;
    browser.setDefaultColumnWidth(parent_width / 2);
    browser.setMinimumColumnWidth(300);

    // Open 2nd tier of browser by selecting first item
    browser.getRootTreeNode().setChildOpen(0, true, false);

    // Add cell browser to view
    selectionPanel.setWidget(browser);

    browser.setFirstColumnWidth(400.0);
    browser.hideLastDivider();

    selectionModel.addSelectionChangeHandler(
        new Handler() {
          @Override
          public void onSelectionChange(SelectionChangeEvent event) {
            presenter.goToDescription(selectionModel.getSelectedObject().id);
          }
        });
  }
 /**
  * On right click.
  *
  * @param value the value
  * @param event the event
  * @param element the element
  */
 public void onRightClick(CellTreeNode value, Event event, Element element) {
   clearMessages();
   selectedNode = value;
   selectionModel.setSelected(selectedNode, true);
   int x = element.getAbsoluteRight() - 10;
   int y = element.getAbsoluteBottom() + 5;
   popupPanel.setPopupPosition(x, y);
   popupPanel.setAnimationEnabled(true);
   //		popupPanel.setSize("175px", "75px");
   popupPanel.show();
   popupPanel.setStyleName("popup");
   clauseWorkspaceContextMenu.displayMenuItems(popupPanel);
 }
  public void update(Property prop) {
    permissionMapping = prop.getName();
    if (prop.getValue().hasDefined("permissions")) {
      List<ModelNode> models = prop.getValue().get("permissions").asList();
      table.setRowCount(models.size(), true);

      List<ModelNode> dataList = dataProvider.getList();
      dataList.clear(); // cannot call setList() as that breaks the sort handler
      dataList.addAll(models);
    } else {
      clearValues();
    }
    selectionModel.clear();
  }