public void changeSortOrder(Widget sender, int sortOrder) {

    if (sender instanceof DisplayColumnWidget) {
      DisplayColumnWidget displayColumnWidget = (DisplayColumnWidget) sender;
      SortColumnWidget sortWidget = sortColMap.get(displayColumnWidget);

      if (sortOrder != SortField.SORT_NULL) {
        if (sortWidget == null) {
          sortWidget = new SortColumnWidget(sortOrder, this);
          sortPanel.add(sortWidget);
          sortColMap.put(displayColumnWidget, sortWidget);
          dispColMap.put(sortWidget, displayColumnWidget);
        } else sortWidget.setSortOrder(sortOrder);

        sortWidget.setText(displayColumnWidget.getText());
      } else if (sortPanel.getWidgetIndex(sortWidget) > -1) {
        sortPanel.remove(sortWidget);
        dispColMap.remove(sortColMap.remove(displayColumnWidget));
      }
    } else if (sender instanceof SortColumnActionHyperlink) {
      SortColumnWidget sortWidget = (SortColumnWidget) sender.getParent().getParent();
      sortWidget.setSortOrder(sortOrder);
      dispColMap.get(sortWidget).setSortOrder(sortOrder);
    } else dispColMap.get((SortColumnWidget) sender).setSortOrder(sortOrder);
  }
Пример #2
0
 public void onDragEnd(DragEndEvent event) {
   endIndex = conditionsPanel.getWidgetIndex(event.getContext().draggable);
   if (endIndex == startIndex) {
     return;
   }
   ConditionCol52 conditionBeingMoved = pattern.getChildColumns().get(startIndex);
   dtableWidget.moveCondition(pattern, conditionBeingMoved, endIndex);
 }
  private void moveItemDown(VerticalPanel vertialPanel, Widget widget) {
    int index = vertialPanel.getWidgetIndex(widget);

    if (widget instanceof SortColumnWidget && index == vertialPanel.getWidgetCount() - 1) return;
    else if (widget instanceof DisplayColumnWidget && index == vertialPanel.getWidgetCount() - 2)
      return;

    vertialPanel.remove(widget);
    vertialPanel.insert(widget, index + 1);
  }
Пример #4
0
 public void onDragStart(DragStartEvent event) {
   startIndex = conditionsPanel.getWidgetIndex(event.getContext().draggable);
 }
 private void moveItemUp(VerticalPanel vertialPanel, Widget widget) {
   int index = vertialPanel.getWidgetIndex(widget);
   if (index == 1) return;
   vertialPanel.remove(widget);
   vertialPanel.insert(widget, index - 1);
 }