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;
   }
 }
Beispiel #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);
      }
    }
  }
 @UiHandler("tabPanel")
 protected void onTabSelected(SelectionEvent<Integer> event) {
   if (presenter != null) {
     int index = event.getSelectedItem();
     presenter.onTabSelected(index);
   }
 }
 // TODO to implement
 @Override
 public void handleMenuAction(SelectionEvent<TreeItem> event) {
   TreeItem item = event.getSelectedItem();
   if (item.getUserObject().equals(CATEGORY_MENU)) {
     getModuleListener().connectModule(new CategoryModuleActivity());
   }
 }
 @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);
 }
Beispiel #6
0
  public void select(Integer index) {
    if (selectedIndex_ != null)
      inner_.getWidget(selectedIndex_).removeStyleName(res_.styles().activeSection());

    selectedIndex_ = index;

    if (index != null) inner_.getWidget(index).addStyleName(res_.styles().activeSection());

    SelectionEvent.fire(this, index);
  }
 @Override
 public void onBrowserEvent(Event event) {
   PerfTimer timer = PerfTimer.get(this, "onBrowserEvent");
   Element target = Element.as(event.getEventTarget());
   int index = getTargetItemIndex(target);
   if (index != -1) {
     // Don't need to support de-select since there is no gesture modifier
     Element.as(getElement().getChildNodes().getItem(selected))
         .removeClassName(AppResources.INSTANCE.css().selected());
     Element.as(getElement().getChildNodes().getItem(index))
         .addClassName(AppResources.INSTANCE.css().selected());
     SelectionEvent.fire(this, data.get(index));
     this.selected = index;
   }
   timer.end();
 }
  private void onSelection(RowClass row, int rowIndex, boolean fireEvents) {
    if (currentSelection != null && currentSelectionRowIndex >= 0) {
      getRowFormatter().setStyleName(currentSelectionRowIndex, "utils-dataTable-row");
      getRowFormatter()
          .addStyleName(
              currentSelectionRowIndex,
              currentSelectionRowIndex % 2 == 0
                  ? "utils-dataTable-row-even"
                  : "utils-dataTable-row-odd");
    }
    currentSelection = row;
    currentSelectionRowIndex = rowIndex;

    if (currentSelection != null) {
      // Select the item and fire the selection event.
      getRowFormatter().setStyleName(rowIndex, "utils-dataTable-row-selected");
      if (fireEvents) {
        SelectionEvent.fire(this, currentSelection);
      }
    }
  }
  // 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.");
      }
    }
  }
 @Override
 public HandlerRegistration addSelectionHandler(final SelectionHandler<EntitySuggestion> handler) {
   final HandlerRegistration handlerReg = addHandler(handler, SelectionEvent.getType());
   final HandlerRegistration delegateReg =
       delegate.addSelectionHandler(
           new SelectionHandler<SuggestOracle.Suggestion>() {
             @Override
             public void onSelection(SelectionEvent<SuggestOracle.Suggestion> event) {
               SuggestOracle.Suggestion suggestion = event.getSelectedItem();
               if (suggestion instanceof EntitySuggestion) {
                 SelectionEvent.fire(
                     PrimitiveDataEditorViewImpl.this, (EntitySuggestion) suggestion);
               }
             }
           });
   return new HandlerRegistration() {
     @Override
     public void removeHandler() {
       handlerReg.removeHandler();
       delegateReg.removeHandler();
     }
   };
 }
Beispiel #11
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;
                    }
                  }
                }
              });
    }
  }
Beispiel #12
0
    public void onSelection(SelectionEvent<Integer> ise) {
      TabBar tb = (TabBar) ise.getSource();
      int idx = tb.getSelectedTab();
      if (idx == cSelIdx) {
        tb.selectTab(-1, false);
        dropdown.close();
      } else {
        if (!tb.equals(leftToolbar)) {
          leftToolbar.selectTab(-1, false);
        }
        if (!tb.equals(centerToolbar)) {
          centerToolbar.selectTab(-1, false);
        }
        if (!tb.equals(rightToolbar)) {
          rightToolbar.selectTab(-1, false);
        }

        TabHolder th = findTab(idx, tb);
        if (th != null) {
          th.button.activate();
        }
      }
      buttonClicked = false;
    }
Beispiel #13
0
 public HandlerRegistration addSelectionHandler(SelectionHandler<Appointment> handler) {
   return addHandler(handler, SelectionEvent.getType());
 }
Beispiel #14
0
 public void fireSelectionEvent(Appointment appointment) {
   view.onAppointmentSelected(appointment);
   SelectionEvent.fire(this, appointment);
 }
 @Override
 public HandlerRegistration addSelectionHandler(
     SelectionHandler<Contact> contactSelectionHandler) {
   return addHandler(contactSelectionHandler, SelectionEvent.getType());
 }
 public HandlerRegistration addSelectionHandler(SelectionHandler<RowClass> handler) {
   return addHandler(handler, SelectionEvent.getType());
 }
 @UiHandler("zoomToTrackMenu")
 public void onMenuSelection(SelectionEvent<Item> event) {
   style.setZoomToTrack(((CheckMenuItem) event.getSelectedItem()).isChecked());
 }
Beispiel #18
0
 @UiHandler("validatorTypeCB")
 void onComboBoxSelection(SelectionEvent<ArgumentValidatorType> event) {
   // On selection of a type, set appropriate card
   cardLC.setActiveWidget(validatorTypeToCardMap.get(event.getSelectedItem()));
 }
 @Override
 public HandlerRegistration addSelectionHandler(SelectionHandler<String> handler) {
   return addHandler(handler, SelectionEvent.getType());
 }
 @UiHandler("scrollerY")
 public void onZoomY(SelectionEvent<Long> event) {
   scrollerX.setZoomLevel(event.getSelectedItem());
 }
 @Override
 public void onSelection(SelectionEvent<String> stringSelectionEvent) {
   fact.getFieldData().add(new FieldPlaceHolder(stringSelectionEvent.getSelectedItem()));
   parent.renderEditor();
 }
Beispiel #22
0
 public HandlerRegistration addSelectionHandler(SelectionHandler<Integer> handler) {
   return addHandler(handler, SelectionEvent.getType());
 }
Beispiel #23
0
 public HandlerRegistration addSelectionHandler(SelectionHandler<Suggestion> handler) {
   return addHandler(handler, SelectionEvent.getType());
 }