Change in ovirt-engine[master]: webadmin, userportal: Support column sorting

vszocs at redhat.com vszocs at redhat.com
Tue May 13 13:44:04 UTC 2014


Vojtech Szocs has submitted this change and it was merged.

Change subject: webadmin,userportal: Support column sorting
......................................................................


webadmin,userportal: Support column sorting

This patch introduces support for both server-side
and client-side sorting of UI table columns.

Similar to column resize feature, column sorting
must be enabled per-column for the given table.

SortableColumn provides API to enable both kinds
of sorting (this patch makes TextColumnWithTooltip
extend SortableColumn, we might want to do this
for more custom column types if necessary):

  // Enables server-side sorting via search query
  // ... SORTBY name ASC|DESC
  column.makeSortable('name');

  // Enables client-side sorting using comparator
  column.makeSortable(comparator);

In order for server-side sorting to work properly,
corresponding SearchableListModel must apply the
search options while executing "Search" query.

For example, in DataCenterListModel:

  @Override
  public boolean supportsServerSideSorting() {
    return true;
  }

  @Override
  protected void syncSearch() {
    String search;
    // search = getSearchString();
    search = applySortOptions(getSearchString());
    ...
  }

If a model doesn't support server-side sorting,
client-side sorting will be used as fall back.

It is the responsibility of UI developers to
ensure that columns marked as sortable are in
sync with sorting capability of the given model,
i.e. if the model doesn't support server-side
sorting, comparator must be used.

Change-Id: I141ea068fe90409852d34bea6fedb45d0d8a07ae
Signed-off-by: Vojtech Szocs <vszocs at redhat.com>
---
M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/ObjectUtils.java
M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/AbstractActionTable.java
A frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/SortableColumn.java
M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/column/TextColumnWithTooltip.java
M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/resize/ColumnResizeCellTable.java
M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/resize/HasResizableColumns.java
M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/resize/ResizableHeader.java
M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/SearchableListModel.java
M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/SortedListModel.java
9 files changed, 294 insertions(+), 88 deletions(-)

Approvals:
  Vojtech Szocs: Verified; Looks good to me, approved



-- 
To view, visit http://gerrit.ovirt.org/25910
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I141ea068fe90409852d34bea6fedb45d0d8a07ae
Gerrit-PatchSet: 9
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Vojtech Szocs <vszocs at redhat.com>
Gerrit-Reviewer: Alexander Wels <awels at redhat.com>
Gerrit-Reviewer: Daniel Erez <derez at redhat.com>
Gerrit-Reviewer: Einav Cohen <ecohen at redhat.com>
Gerrit-Reviewer: Gilad Chaplik <gchaplik at redhat.com>
Gerrit-Reviewer: Greg Sheremeta <gshereme at redhat.com>
Gerrit-Reviewer: Lior Vernia <lvernia at redhat.com>
Gerrit-Reviewer: Tomas Jelinek <tjelinek at redhat.com>
Gerrit-Reviewer: Vojtech Szocs <vszocs at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server



More information about the Engine-commits mailing list