Esempio n. 1
0
 private Field createField(SelectionEvent<Integer> selectionEvent) {
   if (selectionEvent.getSelectedItem() == FieldData.TYPE_FACT) {
     return new FactAssignmentField(field.getName(), helper.getFieldType());
   } else {
     FieldData fieldData = new FieldData(field.getName(), "");
     applyFieldDataNature(fieldData, selectionEvent.getSelectedItem());
     return fieldData;
   }
 }
Esempio n. 2
0
  @Override
  public void onSelection(SelectionEvent<TreeItem> event) {
    if (event.getSelectedItem().getChildCount() != 0) {
      String label = event.getSelectedItem().asTreeItem().getText();
      String category = label.substring(0, label.lastIndexOf("(") - 1);

      if (category.equals("All feeds")) {
        controller.showAllFeeds();
      } else if (category.equals("Favorites")) {
        controller.showFavoriteFeeds();
      } else {
        controller.showAllForCategory(category);
      }
    }
  }
 // TODO to implement
 @Override
 public void handleMenuAction(SelectionEvent<TreeItem> event) {
   TreeItem item = event.getSelectedItem();
   if (item.getUserObject().equals(CATEGORY_MENU)) {
     getModuleListener().connectModule(new CategoryModuleActivity());
   }
 }
 @UiHandler("tabPanel")
 protected void onTabSelected(SelectionEvent<Integer> event) {
   if (presenter != null) {
     int index = event.getSelectedItem();
     presenter.onTabSelected(index);
   }
 }
 @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);
 }
Esempio n. 6
0
  // Show the associated widget in the deck panel
  public void onSelection(SelectionEvent<TreeItem> event) {
    TreeItem node = event.getSelectedItem();
    Object userObject = node.getUserObject();

    TabOpener opener = TabOpener.getInstance();

    if (userObject != null) {
      if (userObject instanceof PackageConfigData && !((PackageConfigData) userObject).isGlobal()) {
        PackageConfigData pc = (PackageConfigData) userObject;
        RulePackageSelector.currentlySelectedPackage = pc.name;

        String uuid = pc.uuid;
        opener.openPackageEditor(
            uuid,
            new Command() {
              public void execute() {
                // refresh the package tree.
                refreshTree();
              }
            });
      } else if (userObject instanceof String[]) {
        final String[] formats = (String[]) userObject;
        final PackageConfigData packageConfigData =
            (PackageConfigData) node.getParentItem().getUserObject();
        RulePackageSelector.currentlySelectedPackage = packageConfigData.name;
        String key = key(formats, packageConfigData);
        opener.openPackageViewAssets(
            packageConfigData.uuid,
            packageConfigData.name,
            key,
            formats.length == 0 ? null : Arrays.asList(formats),
            formats.length == 0 ? Boolean.TRUE : null,
            node.getText());
      } else if (userObject instanceof String) {
        // Ignore, there is no click event for this.
      } else {
        throw new IllegalArgumentException("The userObject (" + userObject + ") is not supported.");
      }
    }
  }
Esempio n. 7
0
  public void onSelection(SelectionEvent<TreeItem> event) {
    TreeItem item = event.getSelectedItem();

    if (item.getUserObject() instanceof Object[]) {
      Object[] o = (Object[]) item.getUserObject();
      final String snapName = ((SnapshotInfo) o[0]).name;
      PackageConfigData conf = (PackageConfigData) o[1];
      RepositoryServiceFactory.getPackageService()
          .listSnapshots(
              conf.name,
              new GenericCallback<SnapshotInfo[]>() {
                public void onSuccess(SnapshotInfo[] a) {
                  for (SnapshotInfo snap : a) {
                    if (snap.name.equals(snapName)) {
                      TabOpener opener = TabOpener.getInstance();
                      opener.openSnapshot(snap);
                      return;
                    }
                  }
                }
              });
    }
  }
Esempio n. 8
0
 @UiHandler("scrollerY")
 public void onZoomY(SelectionEvent<Long> event) {
   scrollerX.setZoomLevel(event.getSelectedItem());
 }
 @UiHandler("zoomToTrackMenu")
 public void onMenuSelection(SelectionEvent<Item> event) {
   style.setZoomToTrack(((CheckMenuItem) event.getSelectedItem()).isChecked());
 }
 @Override
 public void onSelection(SelectionEvent<String> stringSelectionEvent) {
   fact.getFieldData().add(new FieldPlaceHolder(stringSelectionEvent.getSelectedItem()));
   parent.renderEditor();
 }
Esempio n. 11
0
 @UiHandler("validatorTypeCB")
 void onComboBoxSelection(SelectionEvent<ArgumentValidatorType> event) {
   // On selection of a type, set appropriate card
   cardLC.setActiveWidget(validatorTypeToCardMap.get(event.getSelectedItem()));
 }