Exemplo n.º 1
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();
 }
Exemplo n.º 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);
      }
    }
  }
Exemplo n.º 4
0
 public void fireSelectionEvent(Appointment appointment) {
   view.onAppointmentSelected(appointment);
   SelectionEvent.fire(this, appointment);
 }