[rhq] 2 commits - .classpath modules/enterprise

Jay Shaughnessy jshaughn at fedoraproject.org
Tue Aug 7 15:33:51 UTC 2012


 .classpath                                                                                                                    |    1 
 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/AncestryUtil.java       |    2 
 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java |    6 
 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java |   84 +++++++---
 4 files changed, 72 insertions(+), 21 deletions(-)

New commits:
commit 1b21770ce8d938cce33f03b604b31f6fbc078c14
Author: Jay Shaughnessy <jshaughn at redhat.com>
Date:   Tue Aug 7 11:26:27 2012 -0400

    [Bug 846375 - Resource list views should have name field as initial sort and limit ancestry to client side sorting only]
    - Apply default initial sort on Name field for resource list views (using ResourceSearchView)
      - note, updated constructor chaining to be more efficient while adding
        default sort behavior. Removed an unused constructor.
    - Disable server-side sorting on Ancestry since sorting on the encoded
      value is not useful to the end user.  Allow client-side sorting when all
      rows are fetched, this gives the desired alpha sort on the display value.

diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/AncestryUtil.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/AncestryUtil.java
index 0313b46..15e7bc3 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/AncestryUtil.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/AncestryUtil.java
@@ -66,6 +66,8 @@ public abstract class AncestryUtil {
         ancestryField = new ListGridField(AncestryUtil.RESOURCE_ANCESTRY, CoreGUI.getMessages().common_title_ancestry());
         ancestryField.setAlign(Alignment.LEFT);
         ancestryField.setCellAlign(Alignment.LEFT);
+        // sorting on the encoded db value is not useful, limit to client sorting when we have all of the values
+        ancestryField.setCanSortClientOnly(true);
         setupAncestryListGridFieldCellFormatter(ancestryField);
         setupAncestryListGridFieldHover(ancestryField);
         return ancestryField;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
index 9bb1dfa..55271c6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
@@ -52,6 +52,7 @@ import org.rhq.core.domain.measurement.AvailabilityType;
 import org.rhq.core.domain.resource.Resource;
 import org.rhq.core.domain.resource.ResourceCategory;
 import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.util.PageControl;
 import org.rhq.core.domain.util.PageList;
 import org.rhq.enterprise.gui.coregui.client.CoreGUI;
 import org.rhq.enterprise.gui.coregui.client.ImageManager;
@@ -250,6 +251,11 @@ public class ResourceDatasource extends RPCDataSource<Resource, ResourceCriteria
         Log.debug(" *** ResourceCriteria Search String: " + getFilter(request, "search", String.class));
         criteria.setSearchExpression(getFilter(request, "search", String.class));
 
+        // filter out unsortable fields (i.e. fields sorted client-side only)
+        PageControl pageControl = getPageControl(request);
+        pageControl.removeOrderingField(AncestryUtil.RESOURCE_ANCESTRY);
+        criteria.setPageControl(pageControl);
+
         return criteria;
     }
 
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
index ed0a1ca..0e59b6d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
@@ -18,13 +18,38 @@
  */
 package org.rhq.enterprise.gui.coregui.client.inventory.resource;
 
+import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.AVAILABILITY;
+import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.CATEGORY;
+import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.CTIME;
+import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.DESCRIPTION;
+import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.ITIME;
+import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.KEY;
+import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.LOCATION;
+import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.MODIFIER;
+import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.MTIME;
+import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.NAME;
+import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.PLUGIN;
+import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.TYPE;
+import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.VERSION;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.EnumSet;
+import java.util.List;
+
 import com.google.gwt.user.client.rpc.AsyncCallback;
 import com.smartgwt.client.data.Criteria;
 import com.smartgwt.client.data.Record;
 import com.smartgwt.client.data.SortSpecifier;
+import com.smartgwt.client.types.SortDirection;
 import com.smartgwt.client.widgets.events.DoubleClickEvent;
 import com.smartgwt.client.widgets.events.DoubleClickHandler;
-import com.smartgwt.client.widgets.grid.*;
+import com.smartgwt.client.widgets.grid.CellFormatter;
+import com.smartgwt.client.widgets.grid.HoverCustomizer;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
 import org.rhq.core.domain.authz.Permission;
 import org.rhq.core.domain.criteria.ResourceCriteria;
 import org.rhq.core.domain.measurement.AvailabilityType;
@@ -34,7 +59,15 @@ import org.rhq.core.domain.search.SearchSubsystem;
 import org.rhq.enterprise.gui.coregui.client.CoreGUI;
 import org.rhq.enterprise.gui.coregui.client.LinkManager;
 import org.rhq.enterprise.gui.coregui.client.components.ReportExporter;
-import org.rhq.enterprise.gui.coregui.client.components.table.*;
+import org.rhq.enterprise.gui.coregui.client.components.table.EscapedHtmlCellFormatter;
+import org.rhq.enterprise.gui.coregui.client.components.table.IconField;
+import org.rhq.enterprise.gui.coregui.client.components.table.RecordExtractor;
+import org.rhq.enterprise.gui.coregui.client.components.table.ResourceAuthorizedTableAction;
+import org.rhq.enterprise.gui.coregui.client.components.table.ResourceCategoryCellFormatter;
+import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
+import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
+import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
 import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
 import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
 import org.rhq.enterprise.gui.coregui.client.report.DriftComplianceReportResourceSearchView;
@@ -45,15 +78,9 @@ import org.rhq.enterprise.gui.coregui.client.util.message.Message;
 import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
 import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.EnumSet;
-import java.util.List;
-
-import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.*;
-
 /**
- * The list view for {@link Resource}s.
+ * The list view for {@link Resource}s. If not specified a default title is assigned.  If not specified the list will
+ * be initially sorted by resource name, ascending. 
  *
  * @author Jay Shaughnessy
  * @author Greg Hinkle
@@ -62,6 +89,8 @@ import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceD
 public class ResourceSearchView extends Table {
 
     private static final String DEFAULT_TITLE = MSG.common_title_resources();
+    private static final SortSpecifier[] DEFAULT_SORT_SPECIFIER = new SortSpecifier[] { new SortSpecifier("name",
+        SortDirection.ASCENDING) };
 
     private List<ResourceSelectListener> selectListeners = new ArrayList<ResourceSelectListener>();
 
@@ -71,23 +100,21 @@ public class ResourceSearchView extends Table {
      * A list of all Resources in the system.
      */
     public ResourceSearchView(String locatorId) {
-        this(locatorId, null);
-    }
-
-    public ResourceSearchView(String locatorId, String title, String[] excludeFields) {
-        this(locatorId, null, title, null, excludeFields);
+        this(locatorId, null, null, null, null, false);
     }
 
     /**
      * A Resource list filtered by a given criteria.
      */
     public ResourceSearchView(String locatorId, Criteria criteria) {
-        this(locatorId, criteria, DEFAULT_TITLE);
+        this(locatorId, criteria, null, null, null, false);
     }
 
+    /**
+     * A Resource list filtered by a given criteria and optionally exportable
+     */
     public ResourceSearchView(String locatorId, Criteria criteria, boolean exportable) {
-        this(locatorId, criteria);
-        this.exportable = exportable;
+        this(locatorId, criteria, null, null, null, exportable);
     }
 
     /**
@@ -96,7 +123,7 @@ public class ResourceSearchView extends Table {
      * @param headerIcons 24x24 icon(s) to be displayed in the header
      */
     public ResourceSearchView(String locatorId, Criteria criteria, String title, String... headerIcons) {
-        this(locatorId, criteria, title, null, null, headerIcons);
+        this(locatorId, criteria, title, null, null, false, headerIcons);
     }
 
     /**
@@ -106,7 +133,22 @@ public class ResourceSearchView extends Table {
      */
     public ResourceSearchView(String locatorId, Criteria criteria, String title, SortSpecifier[] sortSpecifier,
         String[] excludeFields, String... headerIcons) {
-        super(locatorId, title, criteria, sortSpecifier, excludeFields);
+
+        this(locatorId, criteria, title, sortSpecifier, excludeFields, false, headerIcons);
+    }
+
+    /**
+     * A Resource list filtered by a given criteria with the given title and optionally exportable.
+     *
+     * @param headerIcons 24x24 icon(s) to be displayed in the header
+     */
+    public ResourceSearchView(String locatorId, Criteria criteria, String title, SortSpecifier[] sortSpecifier,
+        String[] excludeFields, boolean exportable, String... headerIcons) {
+
+        super(locatorId, (null == title) ? DEFAULT_TITLE : title, criteria,
+            (null == sortSpecifier) ? DEFAULT_SORT_SPECIFIER : sortSpecifier, excludeFields);
+
+        this.exportable = exportable;
 
         for (String headerIcon : headerIcons) {
             addHeaderIcon(headerIcon);
@@ -309,7 +351,7 @@ public class ResourceSearchView extends Table {
     }
 
     private void addExportAction() {
-        addTableAction("Export",  MSG.common_button_reports_export(), new TableAction() {
+        addTableAction("Export", MSG.common_button_reports_export(), new TableAction() {
             @Override
             public boolean isEnabled(ListGridRecord[] selection) {
                 return true;


commit 076ffb39a33d57b6d42c331058f2551b1ebeb7bc
Author: Jay Shaughnessy <jshaughn at redhat.com>
Date:   Tue Aug 7 11:17:11 2012 -0400

    Add new scripting api module to eclipse source path

diff --git a/.classpath b/.classpath
index 443abde..0516dd7 100644
--- a/.classpath
+++ b/.classpath
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
 	<classpathentry kind="src" path="modules/common/ant-bundle/src/main/java"/>
+	<classpathentry kind="src" path="modules/enterprise/scripting/api/src/main/java"/>
 	<classpathentry kind="src" path="modules/cli-tests/src/main/java"/>
 	<classpathentry kind="src" path="modules/helpers/jeeGen/src/main/java"/>
 	<classpathentry kind="src" path="modules/helpers/bundleGen/src/main/java"/>




More information about the rhq-commits mailing list