modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/FavoriteResourcesPortlet.java
| 24 +++++-----
1 file changed, 13 insertions(+), 11 deletions(-)
New commits:
commit beab6a18acbc371d63deda331f9b1715014c5a79
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Jan 19 11:56:51 2011 -0500
FavoriteResource Portlet Work - fixed configure() impl
...from the "how did this ever work at all" department. I guess something
must have changed in execution sequence that brought to the surface the
fact that this portlet was trying to set some listGrid state before the
listGrid was ready. Dashboards with this portlet would blow up.
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/FavoriteResourcesPortlet.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/FavoriteResourcesPortlet.java
index dcf5c60..d861fad 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/FavoriteResourcesPortlet.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/FavoriteResourcesPortlet.java
@@ -29,6 +29,7 @@ import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
+import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.events.FieldStateChangedEvent;
import com.smartgwt.client.widgets.grid.events.FieldStateChangedHandler;
@@ -69,6 +70,8 @@ public class FavoriteResourcesPortlet extends ResourceSearchView
implements Auto
@Override
protected void configureTable() {
+ super.configureTable();
+
Set<Integer> favoriteIds =
UserSessionManager.getUserPreferences().getFavoriteResources();
Integer[] favArray = favoriteIds.toArray(new Integer[favoriteIds.size()]);
@@ -91,23 +94,22 @@ public class FavoriteResourcesPortlet extends ResourceSearchView
implements Auto
}
});
- super.configureTable();
+ DashboardPortlet storedPortlet = portletWindow.getStoredPortlet();
+ if ((null != storedPortlet && null != storedPortlet.getConfiguration()))
{
+
+ PropertySimple tablePrefs =
storedPortlet.getConfiguration().getSimple(CFG_TABLE_PREFS);
+ ListGrid listGrid = getListGrid();
+ if (null != tablePrefs && null != listGrid) {
+ String state = tablePrefs.getStringValue();
+ listGrid.setViewState(state);
+ }
+ }
}
public void configure(PortletWindow portletWindow, DashboardPortlet storedPortlet) {
if (null == this.portletWindow && null != portletWindow) {
this.portletWindow = portletWindow;
}
-
- if ((null == storedPortlet) || (null == storedPortlet.getConfiguration())) {
- return;
- }
-
- if (storedPortlet.getConfiguration().getSimple(CFG_TABLE_PREFS) != null) {
- String state =
storedPortlet.getConfiguration().getSimple(CFG_TABLE_PREFS).getStringValue();
- getListGrid().setViewState(state);
- }
-
}
public Canvas getHelpCanvas() {
Show replies by date