コード例 #1
0
ファイル: SectionChooser.java プロジェクト: ndwns/rstudio
  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);
  }
コード例 #2
0
 @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();
 }
コード例 #3
0
  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);
      }
    }
  }
コード例 #4
0
ファイル: CalendarWidget.java プロジェクト: esoco/gwt-cal
 public void fireSelectionEvent(Appointment appointment) {
   view.onAppointmentSelected(appointment);
   SelectionEvent.fire(this, appointment);
 }