예제 #1
0
  public void onClick(ClickEvent event) {
    Object sender = event.getSource();

    if (sender == rootHTML) {
      JSONRequest request = new JSONRequest();
      request.doFetchURL(AoAPI.SURVEY_INPUT + survey.getId() + "/", this);
    } else if (promptMap.containsKey(sender)) {
      tree.setSelectedItem(null);
      TreeItem leaf = leaves.get(sender);
      leaf.getTree().setSelectedItem(leaf);
      Prompt p = promptMap.get(sender);
      Messages.get().displaySurveyInput(p, 0);
    }
  }
 @Override
 public void onSelection(SelectionEvent<TreeItem> event) {
   TreeItem item = event.getSelectedItem();
   currentlySelected = item;
   TreeItem child = item.getChild(0);
   if (child != null && child.getText().equals(DatasetWidget.LOADING)) {
     CategorySerializable cat = (CategorySerializable) item.getUserObject();
     Util.getRPCService().getCategories(cat.getID(), null, categoryCallback);
   }
   // Open the item.  Work around double firing bug.
   // http://code.google.com/p/google-web-toolkit/issues/detail?id=3660&q=Tree%20selection&colspec=ID%20Type%20Status%20Owner%20Milestone%20Summary%20Stars
   TreeItem selItem = event.getSelectedItem();
   TreeItem parent = selItem.getParentItem();
   selItem.getTree().setSelectedItem(parent, false); // null is ok
   if (parent != null) parent.setSelected(false); // not compulsory
   selItem.setState(!selItem.getState(), false);
 }