diff options
2 files changed, 16 insertions, 10 deletions
diff --git a/src/com.gluster.storage.management.client/src/com/gluster/storage/management/client/constants/ClientConstants.java b/src/com.gluster.storage.management.client/src/com/gluster/storage/management/client/constants/ClientConstants.java index e253dfa5..32fb34fc 100644 --- a/src/com.gluster.storage.management.client/src/com/gluster/storage/management/client/constants/ClientConstants.java +++ b/src/com.gluster.storage.management.client/src/com/gluster/storage/management/client/constants/ClientConstants.java @@ -25,7 +25,7 @@ package com.gluster.storage.management.client.constants; */ public class ClientConstants { public static final String SYS_PROP_SERVER_URL = "gluster.server.url"; - public static final String DEFAULT_SERVER_URL = "https://localhost:8443/glustermg/linux.gtk.x86_64"; + public static final String DEFAULT_SERVER_URL = "https://10.1.11.61:8443/glustermg/linux.gtk.x86_64"; public static final String CONTEXT_ROOT = "glustermg"; public static final String REST_API_VERSION = "1.0.0"; diff --git a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/utils/TableViewerComparator.java b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/utils/TableViewerComparator.java index 3eb3c22a..7e11cc6f 100644 --- a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/utils/TableViewerComparator.java +++ b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/utils/TableViewerComparator.java @@ -19,49 +19,55 @@ package com.gluster.storage.management.console.utils; import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerSorter; +import org.eclipse.jface.viewers.ViewerComparator; import org.eclipse.swt.SWT; /** * Comparator for sorting contents of a table viewer */ -public class TableViewerComparator extends ViewerSorter { - private int propertyIndex; +public class TableViewerComparator extends ViewerComparator { + private int column = -1; private static final int ASCENDING = 0; private static final int DESCENDING = 1; + private static final int NONE = -1; private int direction = DESCENDING; public TableViewerComparator() { - this(ASCENDING); + this(NONE); } public TableViewerComparator(int direction) { - this.propertyIndex = 0; this.direction = direction; } public int getDirection() { - return direction == DESCENDING ? SWT.DOWN : SWT.UP; + return direction == DESCENDING ? SWT.DOWN : (direction == ASCENDING ? SWT.UP : SWT.NONE); } public void setColumn(int column) { - if (column == this.propertyIndex) { + if (column == this.column) { // Same column as last sort; toggle the direction direction = 1 - direction; } else { - // New column; do an ascending sort - this.propertyIndex = column; + // first column selection or new column; do an ascending sort direction = ASCENDING; + this.column = column; } } @Override public int compare(Viewer viewer, Object e1, Object e2) { + if(direction == NONE) { + // no sorting + return 0; + } + int result = super.compare(viewer, e1, e2); // If descending order, flip the direction if (direction == DESCENDING) { result = -result; } + return result; } } |