modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java
| 34 +++++++++-
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
| 6 +
2 files changed, 35 insertions(+), 5 deletions(-)
New commits:
commit e5b698ed50fdd6638999cb6e1ebcb2d63e1a6194
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Mar 24 15:54:48 2011 -0400
be more fault tolerant of invalid portlets that might be in the DB.
this happens during development as portlets are changed and removed.
could also happen when upgrading to a new version of RHQ that removed a portlet.
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java
index fa76473..520a948 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java
@@ -24,7 +24,11 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.Label;
+
import org.rhq.core.domain.dashboard.DashboardPortlet;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.groups.GroupAlertsPortlet;
import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.groups.GroupBundleDeploymentsPortlet;
@@ -53,6 +57,8 @@ import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.summary.Inventor
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.summary.TagCloudPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.util.MashupPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.util.MessagePortlet;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
/**
* @author Simeon Pinder
@@ -177,9 +183,31 @@ public class PortletFactory {
PortletViewFactory viewFactory =
registeredPortletFactoryMap.get(storedPortlet.getPortletKey());
if (viewFactory == null) {//check group view factory
viewFactory =
registeredGroupPortletFactoryMap.get(storedPortlet.getPortletKey());
- }
- if (viewFactory == null) {//check resource view factory
- viewFactory =
registeredResourcePortletFactoryMap.get(storedPortlet.getPortletKey());
+
+ if (viewFactory == null) {//check resource view factory
+ viewFactory =
registeredResourcePortletFactoryMap.get(storedPortlet.getPortletKey());
+
+ if (viewFactory == null) {
+ Message msg = new Message("Bad portlet: " + storedPortlet,
Severity.Warning);
+ CoreGUI.getMessageCenter().notify(msg);
+ class InvalidPortlet extends Label implements Portlet {
+ InvalidPortlet() {
+
super(CoreGUI.getMessages().view_portlet_factory_invalidPortlet());
+ }
+
+ @Override
+ public Canvas getHelpCanvas() {
+ return new Label(getContents());
+ }
+
+ @Override
+ public void configure(PortletWindow portletWindow,
DashboardPortlet storedPortlet) {
+ }
+ }
+ ;
+ return new InvalidPortlet();
+ }
+ }
}
Portlet view = viewFactory.getInstance(locatorId);
diff --git
a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index a149de8..b8ce183 100644
---
a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++
b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -1442,6 +1442,8 @@ view_dashboards_portlets_refresh_success2=Stopping reload for
portlets that auto
view_dashboardsManager_error1 = Failed to add new dashboard
view_dashboardsManager_message_title_details = <h1>Welcome to
RHQ</h1>\n<p>The RHQ project is an abstraction and plug-in based systems
management suite that provides extensible and integrated systems management for multiple
products and platforms across a set of core features. The project is designed with layered
modules that provide a flexible architecture for deployment. It delivers a core user
interface that delivers audited and historical management across an entire enterprise. A
Server/Agent architecture provides remote management and plugins implement all specific
support for managed products.</p>\n <p>This default dashboard can be edited by
clicking the (edit mode) button above.</p>
+view_portlet_factory_invalidPortlet = This is an obsolete portlet that is no longer
valid. Please delete it.
+
view_portlet_defaultName_autodiscovery = Discovery Queue
view_portlet_defaultName_favoriteResources = Favorite Resources
view_portlet_defaultName_resourceMetric = Resource Metric Graph
commit c599feb1ee9146f09f14db319efd07a4b7c6acd7
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Mar 24 15:49:55 2011 -0400
remove the ~, which was our old marker we used to use
diff --git
a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index 56b7270..a149de8 100644
---
a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++
b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -1418,7 +1418,7 @@ view_type_typeTreeLoadFailure = Failed to load resource type tree
data
# Tabs
view_tabs_invalidSubTab = Invalid subtab: {0}
-view_tabs_invalidTab = Invalid tab: {0}~
+view_tabs_invalidTab = Invalid tab: {0}
# Group Tree
group_tree_partialClusterTooltip = {0} out of {1} group members have a
''{2}'' resource
@@ -1513,7 +1513,7 @@ view_portlet_operations_config_scheduled_enable = Whether to enable
scheduled op
view_portlet_operations_config_scheduled_maximum = Maximum number of Scheduled operations
to display.
view_portlet_operations_config_completed = completed operations
view_portlet_operations_config_show_last = show Last
-view_portlet_operations_config_show_next = show Next~
+view_portlet_operations_config_show_next = show Next
view_portlet_operations_disabled = (Results currently disabled. Change settings to enable
results.
view_portlet_platform_platform_error_1 = Failed to load platform metrics
Show replies by date