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); }
public List<DisplayField> getDisplayFields() { List<DisplayField> displayFields = new ArrayList<DisplayField>(); int count = columnPanel.getWidgetCount(); for (int i = 1; i < count; i++) { Widget widget = columnPanel.getWidget(i); if (widget instanceof DisplayColumnWidget) { DisplayColumnWidget displayColumnWidget = (DisplayColumnWidget) widget; displayFields.add( new DisplayField( displayColumnWidget.getName(), displayColumnWidget.getText(), displayColumnWidget.getAggregateFunction(), displayColumnWidget.getDataType())); } } return displayFields; }