.classpath | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java | 59 +++----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalLayout.java | 24 +--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/Portlet.java | 15 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletWindow.java | 35 ++--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/queue/AutodiscoveryPortlet.java | 74 +++++-----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/FavoriteResourcesPortlet.java | 24 +--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/graph/GraphPortlet.java | 20 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformSummaryPortlet.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java | 35 +++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/imported/RecentlyAddedResourcesPortlet.java | 48 +++---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/operations/OperationsPortlet.java | 32 +++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/problems/ProblemResourcesPortlet.java | 40 +++--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/InventorySummaryPortlet.java | 7
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/TagCloudPortlet.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/util/MashupPortlet.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/util/MessagePortlet.java | 2
17 files changed, 251 insertions(+), 174 deletions(-)
New commits:
commit 71cf1fc12fbb03223eb8525c8c5555afa3314fee
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Jan 7 15:22:36 2011 -0500
Dashboard work. multi_instance handling
- Apply pattern for better handling multiple instances of the same
portlet in the same dash, or across dashboards for the user.
- Let the portlet view factories return new instances as opposed
to a singleton view(the factories are still singletons). I'm not sure
what the intention was but I don't think this approach really held water,
it's better to have a distinct portlet view for each portlet window/
storedPortlet. It's more clear for rendering and, definitely, config
persistence. And I don't think has any impact on perf.
- Do not keep the "storedPortlet" in the view. Doing this causes stale
data in the view after a dashboard is persisted. Instead access the
storedPortlet via the parentWindow, which is guaranteed to be kept in
synch with the persisted entity.
- Let configurePortlet be called anytime the portlet view config changes.
- Remove some unnecessary view creation when updating the portletWindows
after dashboard persist.
- Change a variety of variable names for clarity. too many things were
called 'portlet' when in reality they were sometimes entities, sometimes
windows and sometimes views. A few other similar changes.
- Add a little jdoc and some more inline comments
- setOverflow(VISIBLE) for a few more portlets that were getting truncated.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
index 32c0b13..a6982b1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
@@ -60,7 +60,6 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIMenuButton;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableMenu;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
/**
* @author Greg Hinkle
@@ -76,7 +75,7 @@ public class DashboardView extends LocatableVLayout {
DynamicForm editForm;
IMenuButton addPortlet;
- Set<PortletWindow> portlets = new HashSet<PortletWindow>();
+ Set<PortletWindow> portletWindows = new HashSet<PortletWindow>();
private static String STOP = MSG.view_dashboards_portlets_refresh_none();
private static String REFRESH1 = MSG.view_dashboards_portlets_refresh_one_min();
private static String REFRESH5 = MSG.view_dashboards_portlets_refresh_multiple_min(String.valueOf(5));
@@ -131,7 +130,7 @@ public class DashboardView extends LocatableVLayout {
portalLayout.setWidth100();
portalLayout.setHeight100();
- loadPortlets();
+ loadPortletWindows();
addMember(editForm);
addMember(portalLayout);
@@ -188,9 +187,8 @@ public class DashboardView extends LocatableVLayout {
int numColumns = columns.length;
if (numColumns > 0) {
PortalColumn lastColumn = (PortalColumn) columns[numColumns - 1];
- for (Canvas portlet : lastColumn.getMembers()) {
- boolean removed = storedDashboard
- .removePortlet(((PortletWindow) portlet).getDashboardPortlet());
+ for (PortletWindow portletWindow : (PortletWindow[]) lastColumn.getMembers()) {
+ storedDashboard.removePortlet(portletWindow.getStoredPortlet());
}
portalLayout.removeMember(lastColumn);
numColItem.setValue(numColumns - 1);
@@ -317,21 +315,21 @@ public class DashboardView extends LocatableVLayout {
return editForm;
}
- private void loadPortlets() {
+ private void loadPortletWindows() {
int col = 0;
for (int i = 0; i < storedDashboard.getColumns(); i++) {
for (DashboardPortlet storedPortlet : storedDashboard.getPortlets(i)) {
- final PortletWindow portlet = new PortletWindow(extendLocatorId(storedPortlet.getPortletKey()), this,
- storedPortlet);
- portlets.add(portlet);
- portlet.setTitle(storedPortlet.getName());
+ final PortletWindow portletWindow = new PortletWindow(extendLocatorId(storedPortlet.getPortletKey()),
+ this, storedPortlet);
+ portletWindows.add(portletWindow);
+ portletWindow.setTitle(storedPortlet.getName());
- portlet.setHeight(storedPortlet.getHeight());
- portlet.setVisible(true);
+ portletWindow.setHeight(storedPortlet.getHeight());
+ portletWindow.setVisible(true);
- portalLayout.addPortlet(portlet, col);
+ portalLayout.addPortletWindow(portletWindow, col);
}
col++;
@@ -341,14 +339,14 @@ public class DashboardView extends LocatableVLayout {
private void addPortlet(String portletKey, String portletName) {
DashboardPortlet storedPortlet = new DashboardPortlet(portletName, portletKey, 250);
- final PortletWindow newPortlet = new PortletWindow(extendLocatorId(portletKey), this, storedPortlet);
- newPortlet.setTitle(portletName);
- newPortlet.setHeight(350);
- newPortlet.setVisible(false);
+ final PortletWindow newPortletWindow = new PortletWindow(extendLocatorId(portletKey), this, storedPortlet);
+ newPortletWindow.setTitle(portletName);
+ newPortletWindow.setHeight(350);
+ newPortletWindow.setVisible(false);
- portlets.add(newPortlet);
+ portletWindows.add(newPortletWindow);
- int columnIndex = portalLayout.addPortlet(newPortlet);
+ int columnIndex = portalLayout.addPortletWindow(newPortletWindow);
PortalColumn column = portalLayout.getPortalColumn(columnIndex);
storedDashboard.addPortlet(storedPortlet, columnIndex, column.getMembers().length - 1);
@@ -369,13 +367,13 @@ public class DashboardView extends LocatableVLayout {
outline.draw();
outline.bringToFront();
- outline.animateRect(newPortlet.getPageLeft(), newPortlet.getPageTop(), newPortlet.getVisibleWidth(), newPortlet
- .getViewportHeight(), new AnimationCallback() {
+ outline.animateRect(newPortletWindow.getPageLeft(), newPortletWindow.getPageTop(), newPortletWindow
+ .getVisibleWidth(), newPortletWindow.getViewportHeight(), new AnimationCallback() {
public void execute(boolean earlyFinish) {
// callback at end of animation - destroy placeholder and outline; show the new portlet
placeHolder.destroy();
outline.destroy();
- newPortlet.show();
+ newPortletWindow.show();
}
}, 750);
save();
@@ -425,20 +423,13 @@ public class DashboardView extends LocatableVLayout {
portletMap.put(key, PortletFactory.getRegisteredPortletFactory(key));
}
}
- for (PortletWindow portletWindow : portlets) {
+ for (PortletWindow portletWindow : portletWindows) {
for (DashboardPortlet portlet : result.getPortlets()) {
- if (equalsDashboardPortlet(portletWindow.getDashboardPortlet(), portlet)) {
- portletWindow.setDashboardPortlet(portlet);
+ if (equalsDashboardPortlet(portletWindow.getStoredPortlet(), portlet)) {
+ portletWindow.setStoredPortlet(portlet);
//restarting portlet auto-refresh with newest settings
- PortletViewFactory viewFactory = portletMap.get(portlet.getPortletKey());
-
- // TODO: Note, we're using a sequence generated ID here as a locatorId. This is not optimal for repeatable
- // tests as a change in the number of default portlets, or a change in test order could make a test
- // non-repeatable. But, at the moment we lack the infrastructure to generate a unique, predictable id.
- Portlet view = viewFactory.getInstance(SeleniumUtility.getSafeId(portlet.getPortletKey() + "-"
- + Integer.toString(portlet.getId())));
-
+ Portlet view = portletWindow.getView();
if (view instanceof AutoRefreshPortlet) {
((AutoRefreshPortlet) view).startRefreshCycle();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalLayout.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalLayout.java
index 65424e2..c8f158e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalLayout.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalLayout.java
@@ -58,8 +58,8 @@ public class PortalLayout extends LocatableHLayout {
int dropColumn = columnNumber;
Canvas target = EventHandler.getDragTarget();
- ((PortletWindow) target).getDashboardPortlet().setIndex(dropPosition);
- ((PortletWindow) target).getDashboardPortlet().setColumn(dropColumn);
+ ((PortletWindow) target).getStoredPortlet().setIndex(dropPosition);
+ ((PortletWindow) target).getStoredPortlet().setColumn(dropColumn);
int colNum = 0;
for (Canvas pcc : getMembers()) {
@@ -73,7 +73,7 @@ public class PortalLayout extends LocatableHLayout {
}
if (c instanceof PortletWindow) {
- DashboardPortlet dp = ((PortletWindow) c).getDashboardPortlet();
+ DashboardPortlet dp = ((PortletWindow) c).getStoredPortlet();
dp.setIndex(i++);
}
}
@@ -91,27 +91,27 @@ public class PortalLayout extends LocatableHLayout {
return ((PortalColumn) getMember(column));
}
- public int addPortlet(PortletWindow portlet) {
- int fewestPortletsColumnIndex = -1;
+ public int addPortletWindow(PortletWindow portletWindow) {
+ int fewestPortletsColumn = -1;
int fewestPortletsColumnCount = Integer.MAX_VALUE;
for (int i = 0, numColumns = getMembers().length; (i < numColumns); ++i) {
PortalColumn portletColumn = (PortalColumn) getMember(i);
int memberCount = portletColumn.getMembers().length;
if (fewestPortletsColumnCount > memberCount) {
- fewestPortletsColumnIndex = i;
+ fewestPortletsColumn = i;
fewestPortletsColumnCount = memberCount;
}
}
- addPortlet(portlet, fewestPortletsColumnIndex);
+ addPortletWindow(portletWindow, fewestPortletsColumn);
- return fewestPortletsColumnIndex;
+ return fewestPortletsColumn;
}
- public PortalColumn addPortlet(PortletWindow portlet, int columnIndex) {
+ public PortalColumn addPortletWindow(PortletWindow portletWindow, int column) {
- PortalColumn portalColumn = (PortalColumn) getMember(columnIndex);
- portalColumn.addMember(portlet);
+ PortalColumn portalColumn = (PortalColumn) getMember(column);
+ portalColumn.addMember(portletWindow);
return portalColumn;
}
@@ -128,7 +128,7 @@ public class PortalLayout extends LocatableHLayout {
if (p instanceof PortletWindow) {
PortletWindow portlet = (PortletWindow) p;
- p.setWidth(column.getWidth());
+ portlet.setWidth(column.getWidth());
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/Portlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/Portlet.java
index c102314..7e1c19b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/Portlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/Portlet.java
@@ -27,7 +27,22 @@ import org.rhq.core.domain.dashboard.DashboardPortlet;
*/
public interface Portlet {
+ /**
+ * Called to initially configure the portlet and may be subsequently called to update an
+ * existing portlet's configuration. A portlet's window will not change so it can be safely persisted
+ * by the portlet impl. But the storedPortlet is provided as a convenience and should not be
+ * persisted. Outside of this call a portlet impl should retrieve the storedPortlet from the portletWindow,
+ * if needed.
+ *
+ * @param portletWindow
+ * @param storedPortlet
+ */
void configure(PortletWindow portletWindow, DashboardPortlet storedPortlet);
+ /**
+ * A canvas displaying help text for the portlet.
+ *
+ * @return
+ */
Canvas getHelpCanvas();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletWindow.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletWindow.java
index 3277aeb..7659318 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletWindow.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletWindow.java
@@ -45,10 +45,16 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWindow;
*/
public class PortletWindow extends LocatableWindow {
+ private static final String RSS = "Rss";
+
+ // The dashboard in which this window is diplayed
private DashboardView dashboardView;
- private DashboardPortlet dashboardPortlet;
- private static String RSS = "Rss";
+ // A reference to the stored/persisted DashboardPortlet, so changes made to this will
+ // get persisted when the dashboard is persisted.
+ private DashboardPortlet storedPortlet;
+
+ // The actual portlet content view
private Portlet view;
private static final ClickHandler NO_OP_HANDLER = new ClickHandler() {
@@ -94,7 +100,7 @@ public class PortletWindow extends LocatableWindow {
super(locatorId);
this.dashboardView = dashboardView;
- this.dashboardPortlet = dashboardPortlet;
+ this.storedPortlet = dashboardPortlet;
setEdgeSize(2);
// if (!showFrame) {
@@ -138,7 +144,7 @@ public class PortletWindow extends LocatableWindow {
addDragResizeStopHandler(new DragResizeStopHandler() {
public void onDragResizeStop(DragResizeStopEvent dragResizeStopEvent) {
- PortletWindow.this.dashboardPortlet.setHeight(((Canvas) dragResizeStopEvent.getSource()).getHeight());
+ PortletWindow.this.storedPortlet.setHeight(((Canvas) dragResizeStopEvent.getSource()).getHeight());
PortletWindow.this.dashboardView.resize();
save();
@@ -148,7 +154,7 @@ public class PortletWindow extends LocatableWindow {
addCloseClickHandler(new CloseClickHandler() {
public void onCloseClick(CloseClientEvent closeClientEvent) {
- PortletWindow.this.dashboardView.removePortlet(PortletWindow.this.dashboardPortlet);
+ PortletWindow.this.dashboardView.removePortlet(PortletWindow.this.storedPortlet);
destroy();
}
});
@@ -162,21 +168,20 @@ public class PortletWindow extends LocatableWindow {
protected void onInit() {
super.onInit();
- view = PortletFactory.buildPortlet(this, dashboardPortlet);
+ view = PortletFactory.buildPortlet(this, storedPortlet);
Canvas canvas = (Canvas) view;
addItem(canvas);
settingsHandlerDelegate = new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
- new PortletSettingsWindow(extendLocatorId("Settings"), PortletWindow.this, dashboardPortlet, view)
- .show();
+ new PortletSettingsWindow(extendLocatorId("Settings"), PortletWindow.this, storedPortlet, view).show();
}
};
helpHandlerDelegate = new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
- new PortletHelpWindow(dashboardPortlet, view).show();
+ new PortletHelpWindow(storedPortlet, view).show();
}
};
}
@@ -189,12 +194,16 @@ public class PortletWindow extends LocatableWindow {
helpHandlerDelegate = handler;
}
- public DashboardPortlet getDashboardPortlet() {
- return dashboardPortlet;
+ public Portlet getView() {
+ return view;
+ }
+
+ public DashboardPortlet getStoredPortlet() {
+ return storedPortlet;
}
- public void setDashboardPortlet(DashboardPortlet dashboardPortlet) {
- this.dashboardPortlet = dashboardPortlet;
+ public void setStoredPortlet(DashboardPortlet storedPortlet) {
+ this.storedPortlet = storedPortlet;
}
public void save() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/queue/AutodiscoveryPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/queue/AutodiscoveryPortlet.java
index 885813e..33c0afa 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/queue/AutodiscoveryPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/queue/AutodiscoveryPortlet.java
@@ -57,50 +57,55 @@ public class AutodiscoveryPortlet extends ResourceAutodiscoveryView implements C
//ui attributes/properties/indentifiers
private static final String AUTODISCOVERY_PLATFORM_MAX = "auto-discovery-platform-max";
+
private String unlimited = MSG.common_label_unlimited();
private String defaultValue = unlimited;
- //portlet settings and datasource elements
- private DashboardPortlet storedPortlet;
+
+ // set on initial configuration, the window for this portlet view.
+ private PortletWindow portletWindow;
+
private AutodiscoveryQueueDataSource dataSource;
private Timer defaultReloader;
public AutodiscoveryPortlet(String locatorId) {
super(locatorId, true);
- }
- @Override
- protected void onInit() {
- super.onInit();
//initialize the datasource to include Portlet instance
this.dataSource = new AutodiscoveryQueueDataSource(getTreeGrid());
if (getTreeGrid() != null) {
getTreeGrid().setDataSource(getDataSource());
}
- if ((storedPortlet != null) && (storedPortlet.getConfiguration() != null)) {
- //loads/retrieves initial portlet settings for datasource
- String retrieved = null;
- //if settings already exist for this portlet
- if (storedPortlet.getConfiguration().getSimple(AUTODISCOVERY_PLATFORM_MAX) != null) {
- //retrieve and translate to int
- retrieved = storedPortlet.getConfiguration().getSimple(AUTODISCOVERY_PLATFORM_MAX).getStringValue();
- } else {//create setting
- storedPortlet.getConfiguration().put(new PropertySimple(AUTODISCOVERY_PLATFORM_MAX, defaultValue));
- retrieved = defaultValue;
- }
-
- if (retrieved.equals(unlimited)) {
- getDataSource().setMaximumPlatformsToDisplay(-1);
- } else {
- getDataSource().setMaximumPlatformsToDisplay(Integer.parseInt(retrieved));
- }
- }
}
- /** Implements configure action. Stores reference to the initiating DashboardPortlet.
+ /** Implements configure action. Stores reference to encompassing window.
*/
@Override
public void configure(PortletWindow portletWindow, DashboardPortlet storedPortlet) {
- this.storedPortlet = storedPortlet;
+ if (null == this.portletWindow && null != portletWindow) {
+ this.portletWindow = portletWindow;
+ }
+
+ if ((null == storedPortlet) || (null == storedPortlet.getConfiguration())) {
+ return;
+ }
+
+ // loads/retrieves initial portlet settings for datasource
+ String retrieved = null;
+
+ //if settings already exist for this portlet
+ if (storedPortlet.getConfiguration().getSimple(AUTODISCOVERY_PLATFORM_MAX) != null) {
+ //retrieve and translate to int
+ retrieved = storedPortlet.getConfiguration().getSimple(AUTODISCOVERY_PLATFORM_MAX).getStringValue();
+ } else {//create setting
+ storedPortlet.getConfiguration().put(new PropertySimple(AUTODISCOVERY_PLATFORM_MAX, defaultValue));
+ retrieved = defaultValue;
+ }
+
+ if (retrieved.equals(unlimited)) {
+ getDataSource().setMaximumPlatformsToDisplay(-1);
+ } else {
+ getDataSource().setMaximumPlatformsToDisplay(Integer.parseInt(retrieved));
+ }
}
public Canvas getHelpCanvas() {
@@ -113,6 +118,8 @@ public class AutodiscoveryPortlet extends ResourceAutodiscoveryView implements C
final LocatableDynamicForm form = new LocatableDynamicForm(extendLocatorId("Settings"));
form.setLayoutAlign(VerticalAlignment.CENTER);
+ final DashboardPortlet storedPortlet = portletWindow.getStoredPortlet();
+
//horizontal display component
LocatableHLayout row = new LocatableHLayout(extendLocatorId("auto-discovery.configuration"));
@@ -161,14 +168,14 @@ public class AutodiscoveryPortlet extends ResourceAutodiscoveryView implements C
form.addSubmitValuesHandler(new SubmitValuesHandler() {
//specify submit action.
public void onSubmitValues(SubmitValuesEvent event) {
+
if (form.getValue(AUTODISCOVERY_PLATFORM_MAX) != null) {
//persist this value to configuration
storedPortlet.getConfiguration().put(
new PropertySimple(AUTODISCOVERY_PLATFORM_MAX, form.getValue(AUTODISCOVERY_PLATFORM_MAX)));
- //save to datasource
- String value = form.getValue(AUTODISCOVERY_PLATFORM_MAX) + "";
- int maximumPlatformsToDisplay = value.equals(unlimited) ? -1 : Integer.parseInt(value);
- getDataSource().setMaximumPlatformsToDisplay(maximumPlatformsToDisplay);
+
+ configure(portletWindow, storedPortlet);
+
markForRedraw();
}
}
@@ -179,13 +186,10 @@ public class AutodiscoveryPortlet extends ResourceAutodiscoveryView implements C
public static final class Factory implements PortletViewFactory {
public static PortletViewFactory INSTANCE = new Factory();
- private static Portlet reference = null;
public final Portlet getInstance(String locatorId) {
- if (reference == null) {
- reference = new AutodiscoveryPortlet(locatorId);
- }
- return reference;
+
+ return new AutodiscoveryPortlet(locatorId);
}
}
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 a2eb4b5..7bb67c4 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
@@ -54,13 +54,14 @@ public class FavoriteResourcesPortlet extends ResourceSearchView implements Auto
public static final String CFG_TABLE_PREFS = "tablePreferences";
- private DashboardPortlet storedPortlet;
+ // set on initial configuration, the window for this portlet view.
private PortletWindow portletWindow;
+
private Timer defaultReloader;
public FavoriteResourcesPortlet(String locatorId) {
super(locatorId);
- setOverflow(Overflow.HIDDEN);
+ setOverflow(Overflow.VISIBLE);
setShowHeader(false);
setShowFooter(false);
@@ -85,7 +86,7 @@ public class FavoriteResourcesPortlet extends ResourceSearchView implements Auto
public void onFieldStateChanged(FieldStateChangedEvent fieldStateChangedEvent) {
String state = getListGrid().getViewState();
- storedPortlet.getConfiguration().put(new PropertySimple(CFG_TABLE_PREFS, state));
+ portletWindow.getStoredPortlet().getConfiguration().put(new PropertySimple(CFG_TABLE_PREFS, state));
portletWindow.save();
}
});
@@ -94,8 +95,13 @@ public class FavoriteResourcesPortlet extends ResourceSearchView implements Auto
}
public void configure(PortletWindow portletWindow, DashboardPortlet storedPortlet) {
- this.portletWindow = portletWindow;
- this.storedPortlet = 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();
@@ -110,14 +116,10 @@ public class FavoriteResourcesPortlet extends ResourceSearchView implements Auto
public static final class Factory implements PortletViewFactory {
public static PortletViewFactory INSTANCE = new Factory();
- private static Portlet reference;
public final Portlet getInstance(String locatorId) {
- //return GWT.create(FavoriteResourcesPortlet.class);
- if (reference == null) {
- reference = new FavoriteResourcesPortlet(locatorId);
- }
- return reference;
+
+ return new FavoriteResourcesPortlet(locatorId);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/graph/GraphPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/graph/GraphPortlet.java
index f9fa471..821fe56 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/graph/GraphPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/graph/GraphPortlet.java
@@ -49,8 +49,8 @@ public class GraphPortlet extends SmallGraphView implements CustomSettingsPortle
// A default displayed, persisted name for the portlet
public static final String NAME = MSG.view_portlet_defaultName_graph();
+ // set on initial configuration, the window for this portlet view.
private PortletWindow portletWindow;
- private DashboardPortlet storedPortlet;
public static final String CFG_RESOURCE_ID = "resourceId";
public static final String CFG_DEFINITION_ID = "definitionId";
@@ -62,8 +62,15 @@ public class GraphPortlet extends SmallGraphView implements CustomSettingsPortle
}
public void configure(PortletWindow portletWindow, DashboardPortlet storedPortlet) {
- this.portletWindow = portletWindow;
- this.storedPortlet = storedPortlet;
+
+ if (null == this.portletWindow && null != portletWindow) {
+ this.portletWindow = portletWindow;
+ }
+
+ if ((null == storedPortlet) || (null == storedPortlet.getConfiguration())) {
+ return;
+ }
+
if (storedPortlet.getConfiguration().getSimple(CFG_RESOURCE_ID) != null) {
setResourceId(storedPortlet.getConfiguration().getSimple(CFG_RESOURCE_ID).getIntegerValue());
setDefinitionId(storedPortlet.getConfiguration().getSimple(CFG_DEFINITION_ID).getIntegerValue());
@@ -76,6 +83,8 @@ public class GraphPortlet extends SmallGraphView implements CustomSettingsPortle
@Override
protected void onDraw() {
+ DashboardPortlet storedPortlet = portletWindow.getStoredPortlet();
+
if (storedPortlet.getConfiguration().getSimple(CFG_RESOURCE_ID) != null) {
super.onDraw();
} else {
@@ -104,6 +113,8 @@ public class GraphPortlet extends SmallGraphView implements CustomSettingsPortle
}
};
+ final DashboardPortlet storedPortlet = portletWindow.getStoredPortlet();
+
metric.setWidth(300);
metric.setValueField("id");
metric.setDisplayField("displayName");
@@ -150,6 +161,8 @@ public class GraphPortlet extends SmallGraphView implements CustomSettingsPortle
super.redraw();
removeMembers(getMembers());
+
+ DashboardPortlet storedPortlet = portletWindow.getStoredPortlet();
if (storedPortlet.getConfiguration().getSimple(CFG_RESOURCE_ID) != null) {
renderGraph();
} else {
@@ -162,7 +175,6 @@ public class GraphPortlet extends SmallGraphView implements CustomSettingsPortle
public final Portlet getInstance(String locatorId) {
- // always return a new instance of portlets with configuration
return new GraphPortlet(locatorId);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformSummaryPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformSummaryPortlet.java
index 7a41107..2a3f023 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformSummaryPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformSummaryPortlet.java
@@ -199,7 +199,7 @@ public class PlatformSummaryPortlet extends LocatableListGrid implements Portlet
}
public void configure(PortletWindow portletWindow, DashboardPortlet storedPortlet) {
- // TODO: Implement this method.
+ // This portlet has no configuration settings
}
public Canvas getHelpCanvas() {
@@ -344,6 +344,7 @@ public class PlatformSummaryPortlet extends LocatableListGrid implements Portlet
public static PortletViewFactory INSTANCE = new Factory();
public final Portlet getInstance(String locatorId) {
+
return new PlatformSummaryPortlet(locatorId);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java
index c71af20..b32390f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java
@@ -93,9 +93,13 @@ public class RecentAlertsPortlet extends AlertHistoryView implements CustomSetti
public static final String ALERT_LABEL_RESOURCE_INVENTORY = MSG.common_title_resource_inventory();
public static final int ALERT_RESOURCE_SELECTION_WIDTH = 800;
public static final String ID = "id";
+
+ // set on initial configuration, the window for this portlet view.
+ private PortletWindow portletWindow;
+
//shared private UI elements
private AlertResourceSelectorRegion resourceSelector;
- private DashboardPortlet storedPortlet = null;
+
private AlertPortletDataSource dataSource;
//instance ui widgets
private Canvas containerCanvas;
@@ -124,7 +128,15 @@ public class RecentAlertsPortlet extends AlertHistoryView implements CustomSetti
}
public void configure(PortletWindow portletWindow, DashboardPortlet storedPortlet) {
- this.storedPortlet = storedPortlet;
+
+ if (null == this.portletWindow && null != portletWindow) {
+ this.portletWindow = portletWindow;
+ }
+
+ if ((null == storedPortlet) || (null == storedPortlet.getConfiguration())) {
+ return;
+ }
+
//Operation range property - retrieve existing value
PropertySimple property = storedPortlet.getConfiguration().getSimple(ALERT_RANGE_DISPLAY_AMOUNT_VALUE);
if ((property != null) && (property.getStringValue() != null)) {
@@ -265,13 +277,14 @@ public class RecentAlertsPortlet extends AlertHistoryView implements CustomSetti
}
public DynamicForm getCustomSettingsForm() {
-
//root dynamic form instance
final LocatableDynamicForm form = new LocatableDynamicForm(extendLocatorId("custom-settings"));
form.setWidth(RecentAlertsPortlet.ALERT_RESOURCE_SELECTION_WIDTH + 40);//largest widget display + 40 for buttons
form.setHeight(400);
form.setMargin(5);
+ final DashboardPortlet storedPortlet = portletWindow.getStoredPortlet();
+
//vertical container
VLayout column = new VLayout();
@@ -506,7 +519,10 @@ public class RecentAlertsPortlet extends AlertHistoryView implements CustomSetti
storedPortlet.getConfiguration().put(new PropertyList(ALERT_RANGE_RESOURCE_IDS, list));
getDataSource().setAlertFilterResourceId(resourceSelector.getCurrentlyAssignedIds());
}
- refresh();//reload form with new data selections
+
+ configure(portletWindow, storedPortlet);
+
+ refresh();//reload form with new data selections
markForRedraw();
}
});
@@ -521,9 +537,9 @@ public class RecentAlertsPortlet extends AlertHistoryView implements CustomSetti
* @param portlet Container for configuration changes
* @param properties Variable list of keys used to verify or populate properties.
*/
- private void parseFormAndPopulateConfiguration(final DynamicForm form, DashboardPortlet portlet,
+ private void parseFormAndPopulateConfiguration(final DynamicForm form, DashboardPortlet storedPortlet,
String... properties) {
- if ((form != null) && (portlet != null)) {
+ if ((form != null) && (storedPortlet != null)) {
for (String property : properties) {
if (form.getValue(property) != null) {//if new value supplied
storedPortlet.getConfiguration().put(new PropertySimple(property, form.getValue(property)));
@@ -538,13 +554,10 @@ public class RecentAlertsPortlet extends AlertHistoryView implements CustomSetti
public static final class Factory implements PortletViewFactory {
public static PortletViewFactory INSTANCE = new Factory();
- private static Portlet reference;
public final Portlet getInstance(String locatorId) {
- if (reference == null) {
- reference = new RecentAlertsPortlet(locatorId);
- }
- return reference;
+
+ return new RecentAlertsPortlet(locatorId);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/imported/RecentlyAddedResourcesPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/imported/RecentlyAddedResourcesPortlet.java
index 59f702f..2e5b3ba 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/imported/RecentlyAddedResourcesPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/imported/RecentlyAddedResourcesPortlet.java
@@ -55,19 +55,23 @@ public class RecentlyAddedResourcesPortlet extends LocatableVLayout implements C
// A default displayed, persisted name for the portlet
public static final String NAME = MSG.view_portlet_defaultName_recentlyAddedResources();
- private boolean simple = true;
- private DashboardPortlet storedPortlet;
- private RecentlyAddedResourceDS dataSource;
- private TreeGrid treeGrid = null;
public static final String unlimited = MSG.common_label_unlimited();
public static final String defaultValue = unlimited;
private static final String RECENTLY_ADDED_SHOW_MAX = "recently-added-show-amount";
private static final String RECENTLY_ADDED_SHOW_HRS = "recently-added-time-range";
+
+ // set on initial configuration, the window for this portlet view.
+ private PortletWindow portletWindow;
+
+ private RecentlyAddedResourceDS dataSource;
+ private TreeGrid treeGrid = null;
+ private boolean simple = true;
private Timer defaultReloader;
public RecentlyAddedResourcesPortlet(String locatorId) {
super(locatorId);
+
//insert the datasource
this.dataSource = new RecentlyAddedResourceDS(this);
}
@@ -103,7 +107,14 @@ public class RecentlyAddedResourcesPortlet extends LocatableVLayout implements C
}
public void configure(PortletWindow portletWindow, DashboardPortlet storedPortlet) {
- this.storedPortlet = storedPortlet;
+
+ if (null == this.portletWindow && null != portletWindow) {
+ this.portletWindow = portletWindow;
+ }
+
+ if ((null == storedPortlet) || (null == storedPortlet.getConfiguration())) {
+ return;
+ }
if (storedPortlet.getConfiguration().getSimple(RECENTLY_ADDED_SHOW_MAX) != null) {
//retrieve and translate to int
@@ -139,7 +150,9 @@ public class RecentlyAddedResourcesPortlet extends LocatableVLayout implements C
public DynamicForm getCustomSettingsForm() {
final DynamicForm form = new DynamicForm();
- //-------------combobox for number of recently added resources to display on the dashboard
+ final DashboardPortlet storedPortlet = portletWindow.getStoredPortlet();
+
+ // combobox for number of recently added resources to display on the dashboard
final SelectItem maximumRecentlyAddedComboBox = new SelectItem(RECENTLY_ADDED_SHOW_MAX);
maximumRecentlyAddedComboBox.setTitle(MSG.common_title_show());
maximumRecentlyAddedComboBox.setHint("<nobr><b> " + MSG.view_portlet_recentlyAdded_setting_addedPlatforms()
@@ -152,7 +165,7 @@ public class RecentlyAddedResourcesPortlet extends LocatableVLayout implements C
//set width of dropdown display region
maximumRecentlyAddedComboBox.setWidth(100);
- //default selected value to 'unlimited'(live lists) and check both combobox settings here.
+ // default selected value to 'unlimited'(live lists) and check both combobox settings here.
String selectedValue = defaultValue;
if (storedPortlet != null) {
//if property exists retrieve it
@@ -162,10 +175,10 @@ public class RecentlyAddedResourcesPortlet extends LocatableVLayout implements C
storedPortlet.getConfiguration().put(new PropertySimple(RECENTLY_ADDED_SHOW_MAX, defaultValue));
}
}
- //prepopulate the combobox with the previously stored selection
+ // prepopulate the combobox with the previously stored selection
maximumRecentlyAddedComboBox.setDefaultValue(selectedValue);
- //------------- Build second combobox for timeframe for problem resources search.
+ // second combobox for timeframe for problem resources search.
final SelectItem maximumTimeRecentlyAddedComboBox = new SelectItem(RECENTLY_ADDED_SHOW_HRS);
maximumTimeRecentlyAddedComboBox.setTitle("Over ");
maximumTimeRecentlyAddedComboBox.setHint("<nobr><b> " + MSG.common_label_hours() + " </b></nobr>");
@@ -176,7 +189,7 @@ public class RecentlyAddedResourcesPortlet extends LocatableVLayout implements C
maximumTimeRecentlyAddedComboBox.setValueMap(acceptableTimeValues);
maximumTimeRecentlyAddedComboBox.setWidth(100);
- //set to default
+ // set to default
selectedValue = defaultValue;
if (storedPortlet != null) {
//if property exists retrieve it
@@ -186,13 +199,13 @@ public class RecentlyAddedResourcesPortlet extends LocatableVLayout implements C
storedPortlet.getConfiguration().put(new PropertySimple(RECENTLY_ADDED_SHOW_HRS, defaultValue));
}
}
- //prepopulate the combobox with the previously stored selection
+ // prepopulate the combobox with the previously stored selection
maximumTimeRecentlyAddedComboBox.setDefaultValue(selectedValue);
- //insert fields
+ // insert fields
form.setFields(maximumRecentlyAddedComboBox, maximumTimeRecentlyAddedComboBox);
- //submit handler
+ // submit handler
form.addSubmitValuesHandler(new SubmitValuesHandler() {
@Override
public void onSubmitValues(SubmitValuesEvent event) {
@@ -205,7 +218,7 @@ public class RecentlyAddedResourcesPortlet extends LocatableVLayout implements C
new PropertySimple(RECENTLY_ADDED_SHOW_HRS, form.getValue(RECENTLY_ADDED_SHOW_HRS)));
}
- configure(null, storedPortlet);
+ configure(portletWindow, storedPortlet);
redraw();
}
@@ -216,13 +229,10 @@ public class RecentlyAddedResourcesPortlet extends LocatableVLayout implements C
public static final class Factory implements PortletViewFactory {
public static PortletViewFactory INSTANCE = new Factory();
- private Portlet reference;
public final Portlet getInstance(String locatorId) {
- if (reference == null) {
- reference = new RecentlyAddedResourcesPortlet(locatorId);
- }
- return reference;
+
+ return new RecentlyAddedResourcesPortlet(locatorId);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/operations/OperationsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/operations/OperationsPortlet.java
index 2ae9084..5f099a6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/operations/OperationsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/operations/OperationsPortlet.java
@@ -69,15 +69,20 @@ public class OperationsPortlet extends LocatableVLayout implements CustomSetting
public static final String OPERATIONS_RANGE_SCHEDULED_ENABLED = "operations-scheduled-enabled";
public static final String OPERATIONS_RANGE_COMPLETED = "operations-range-completed";
public static final String OPERATIONS_RANGE_SCHEDULED = "operations-range-scheduled";
- private static String recentOperations = MSG.common_title_recent_operations();
- private static String scheduledOperations = MSG.common_title_scheduled_operations();
public static String RANGE_DISABLED_MESSAGE = MSG.view_portlet_operations_disabled();
//TODO: change this to use the Smart GWT default value.
public static String RANGE_DISABLED_MESSAGE_DEFAULT = MSG.common_msg_noItemsToShow();
+
+ private static String recentOperations = MSG.common_title_recent_operations();
+ private static String scheduledOperations = MSG.common_title_scheduled_operations();
+
+ // set on initial configuration, the window for this portlet view.
+ private PortletWindow portletWindow;
+
//ListGrids for operations
private LocatableListGrid recentOperationsGrid = null;
private LocatableListGrid scheduledOperationsGrid = null;
- private DashboardPortlet storedPortlet = null;
+
private RecentOperationsDataSource dataSourceCompleted;
private ScheduledOperationsDataSource dataSourceScheduled;
public static String unlimited = MSG.common_label_unlimited();
@@ -143,7 +148,15 @@ public class OperationsPortlet extends LocatableVLayout implements CustomSetting
@Override
public void configure(PortletWindow portletWindow, DashboardPortlet storedPortlet) {
- this.storedPortlet = storedPortlet;
+
+ if (null == this.portletWindow && null != portletWindow) {
+ this.portletWindow = portletWindow;
+ }
+
+ if ((null == storedPortlet) || (null == storedPortlet.getConfiguration())) {
+ return;
+ }
+
//Operation range property - retrieve existing value
PropertySimple property = storedPortlet.getConfiguration().getSimple(OPERATIONS_RANGE_COMPLETED);
if ((property != null) && (property.getStringValue() != null)) {
@@ -203,6 +216,8 @@ public class OperationsPortlet extends LocatableVLayout implements CustomSetting
//root dynamic form instance
final LocatableDynamicForm form = new LocatableDynamicForm(extendLocatorId("custom-settings"));
+ final DashboardPortlet storedPortlet = portletWindow.getStoredPortlet();
+
//vertical layout
VStack column = new VStack();
@@ -361,6 +376,8 @@ public class OperationsPortlet extends LocatableVLayout implements CustomSetting
.getValue(OPERATIONS_RANGE_SCHEDULED_ENABLED)));
}
+ configure(portletWindow, storedPortlet);
+
redraw();
}
});
@@ -370,13 +387,10 @@ public class OperationsPortlet extends LocatableVLayout implements CustomSetting
public static final class Factory implements PortletViewFactory {
public static PortletViewFactory INSTANCE = new Factory();
- private Portlet reference;
public final Portlet getInstance(String locatorId) {
- if (reference == null) {
- reference = new OperationsPortlet(locatorId);
- }
- return reference;
+
+ return new OperationsPortlet(locatorId);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/problems/ProblemResourcesPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/problems/ProblemResourcesPortlet.java
index 9227e30..6ab218b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/problems/ProblemResourcesPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/problems/ProblemResourcesPortlet.java
@@ -68,7 +68,10 @@ public class ProblemResourcesPortlet extends Table implements CustomSettingsPort
//keys for smart gwt elements. should be unique
public static final String PROBLEM_RESOURCE_SHOW_HRS = "max-problems-query-span";
public static final String PROBLEM_RESOURCE_SHOW_MAX = "max-problems-shown";
- private DashboardPortlet storedPortlet;
+
+ // set on initial configuration, the window for this portlet view.
+ private PortletWindow portletWindow;
+
//reference to datasource
private ProblemResourcesDataSource dataSource;
@@ -121,7 +124,14 @@ public class ProblemResourcesPortlet extends Table implements CustomSettingsPort
@Override
public void configure(PortletWindow portletWindow, DashboardPortlet storedPortlet) {
- this.storedPortlet = storedPortlet;
+ if (null == this.portletWindow && null != portletWindow) {
+ this.portletWindow = portletWindow;
+ }
+
+ if ((null == storedPortlet) || (null == storedPortlet.getConfiguration())) {
+ return;
+ }
+
int configuredValue = -1;
//determine configuration value for ProblemResourceShowMax
@@ -169,6 +179,8 @@ public class ProblemResourcesPortlet extends Table implements CustomSettingsPort
final LocatableDynamicForm form = new LocatableDynamicForm(extendLocatorId("custom-settings"));
+ final DashboardPortlet storedPortlet = portletWindow.getStoredPortlet();
+
//-------------combobox for number of resource to display on the dashboard
final SelectItem maximumProblemResourcesComboBox = new SelectItem(PROBLEM_RESOURCE_SHOW_MAX);
maximumProblemResourcesComboBox.setTitle(MSG.common_title_display());
@@ -184,14 +196,14 @@ public class ProblemResourcesPortlet extends Table implements CustomSettingsPort
//default selected value to 'unlimited'(live lists) and check both combobox settings here.
String selectedValue = defaultValue;
- if (storedPortlet != null) {
- //if property exists retrieve it
- if (storedPortlet.getConfiguration().getSimple(PROBLEM_RESOURCE_SHOW_MAX) != null) {
- selectedValue = storedPortlet.getConfiguration().getSimple(PROBLEM_RESOURCE_SHOW_MAX).getStringValue();
- } else {//insert default value
- storedPortlet.getConfiguration().put(new PropertySimple(PROBLEM_RESOURCE_SHOW_MAX, defaultValue));
- }
+
+ //if property exists retrieve it
+ if (storedPortlet.getConfiguration().getSimple(PROBLEM_RESOURCE_SHOW_MAX) != null) {
+ selectedValue = storedPortlet.getConfiguration().getSimple(PROBLEM_RESOURCE_SHOW_MAX).getStringValue();
+ } else {//insert default value
+ storedPortlet.getConfiguration().put(new PropertySimple(PROBLEM_RESOURCE_SHOW_MAX, defaultValue));
}
+
//prepopulate the combobox with the previously stored selection
maximumProblemResourcesComboBox.setDefaultValue(selectedValue);
@@ -227,6 +239,7 @@ public class ProblemResourcesPortlet extends Table implements CustomSettingsPort
@Override
public void onSubmitValues(SubmitValuesEvent event) {
+
if (form.getValue(PROBLEM_RESOURCE_SHOW_MAX) != null) {
storedPortlet.getConfiguration().put(
new PropertySimple(PROBLEM_RESOURCE_SHOW_MAX, form.getValue(PROBLEM_RESOURCE_SHOW_MAX)));
@@ -236,7 +249,7 @@ public class ProblemResourcesPortlet extends Table implements CustomSettingsPort
new PropertySimple(PROBLEM_RESOURCE_SHOW_HRS, form.getValue(PROBLEM_RESOURCE_SHOW_HRS)));
}
- configure(null, storedPortlet);
+ configure(portletWindow, storedPortlet);
refresh();
}
@@ -247,13 +260,10 @@ public class ProblemResourcesPortlet extends Table implements CustomSettingsPort
public static final class Factory implements PortletViewFactory {
public static PortletViewFactory INSTANCE = new Factory();
- private Portlet reference;
public final Portlet getInstance(String locatorId) {
- if (reference == null) {
- reference = new ProblemResourcesPortlet(locatorId);
- }
- return reference;
+
+ return new ProblemResourcesPortlet(locatorId);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/InventorySummaryPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/InventorySummaryPortlet.java
index e1d00bc..27db931 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/InventorySummaryPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/InventorySummaryPortlet.java
@@ -165,14 +165,9 @@ public class InventorySummaryPortlet extends LocatableVLayout implements AutoRef
public static final class Factory implements PortletViewFactory {
public static PortletViewFactory INSTANCE = new Factory();
- private Portlet reference;
public final Portlet getInstance(String locatorId) {
- // reuse the same portlet, it's not configurable
- if (reference == null) {
- reference = new InventorySummaryPortlet(locatorId);
- }
- return reference;
+ return new InventorySummaryPortlet(locatorId);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/TagCloudPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/TagCloudPortlet.java
index 4305eff..05503de 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/TagCloudPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/TagCloudPortlet.java
@@ -46,7 +46,7 @@ public class TagCloudPortlet extends TagCloudView implements Portlet {
}
public void configure(PortletWindow portletWindow, DashboardPortlet storedPortlet) {
- // TODO: Implement this method.
+ // This portlet has no configuration settings
}
public Canvas getHelpCanvas() {
@@ -57,6 +57,7 @@ public class TagCloudPortlet extends TagCloudView implements Portlet {
public static PortletViewFactory INSTANCE = new Factory();
public final Portlet getInstance(String locatorId) {
+
return new TagCloudPortlet(locatorId);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/util/MashupPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/util/MashupPortlet.java
index 776d87e..e624433 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/util/MashupPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/util/MashupPortlet.java
@@ -83,7 +83,7 @@ public class MashupPortlet extends LocatableHTMLPane implements ConfigurablePort
public static PortletViewFactory INSTANCE = new Factory();
public final Portlet getInstance(String locatorId) {
- //return GWT.create(MashupPortlet.class);
+
return new MashupPortlet(locatorId);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/util/MessagePortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/util/MessagePortlet.java
index 9c81d38..8da6a8b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/util/MessagePortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/util/MessagePortlet.java
@@ -78,7 +78,7 @@ public class MessagePortlet extends LocatableHTMLPane implements ConfigurablePor
public static PortletViewFactory INSTANCE = new Factory();
public final Portlet getInstance(String locatorId) {
- //return GWT.create(MessagePortlet.class);
+
return new MessagePortlet(locatorId);
}
}
commit 87d6c9364c4706f605c228cb0bccab90b8d2cd03
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Jan 7 15:02:44 2011 -0500
Up the smartgwt version in eclipse build
diff --git a/.classpath b/.classpath
index 477ee76..911691e 100644
--- a/.classpath
+++ b/.classpath
@@ -252,7 +252,7 @@
<classpathentry exported="true" kind="var" path="M2_REPO/org/fedorahosted/cobbler/cobbler4j/0.1/cobbler4j-0.1.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/com/google/gwt/gwt-user/2.0.4/gwt-user-2.0.4.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/com/google/gwt/gwt-dev/2.0.4/gwt-dev-2.0.4.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/com/smartgwt/smartgwt/2.2.RHQ2/smartgwt-2.2.RHQ2.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/com/smartgwt/smartgwt/2.4/smartgwt-2.4.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/com/google/code/gwt-log/gwt-log/3.0.4/gwt-log-3.0.4.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/ca/nanometrics/gflot/1.0.0/gflot-1.0.0.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/com/jcraft/jsch/0.1.29/jsch-0.1.29.jar"/>