modules/core/dbutils/pom.xml
| 2
modules/core/dbutils/src/main/scripts/dbsetup/dashboard-schema.xml
| 5
modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
| 44 +
modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java
| 15
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/DashboardCriteria.java
| 126 ++++
modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/Dashboard.java
| 56 ++
modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/DashboardCategory.java
| 68 ++
modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/DashboardPortlet.java
| 6
modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
| 13
modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java
| 13
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
| 58 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java
| 49 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/TitleBar.java
| 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
| 10
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardContainer.java
| 15
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
| 198 +++++--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java
| 45 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalLayout.java
| 38 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletWindow.java
| 12
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java
| 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/DashboardGWTService.java
| 11
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupContextMenu.java
| 113 ++--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
| 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java
| 260 +++++++++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
| 104 ++--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageBar.java
| 6
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java
| 62 --
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/DashboardGWTServiceImpl.java
| 19
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
| 4
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/dashboard/DashboardManagerBean.java
| 50 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/dashboard/DashboardManagerLocal.java
| 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/dashboard/DashboardManagerRemote.java
| 15
32 files changed, 1060 insertions(+), 374 deletions(-)
New commits:
commit dee7679746cc14917e38a776bd9f7b931e726bff
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Feb 25 10:34:39 2011 -0500
Combine the footer and the message bar such that all of the info is now
in one place. This hopefully makes better use of real estate, giving our
LHS and RHS panes about 30 more pixels vertically, while also improving
look and usability.
- Also, allow navigation changes to clear the message bar, on the asumption
that if the user is navigating he probably no longer needs the message
displayed.
- Also, get rid of the annoying labels that used to spew in the footer for each
messageCenter message. The messageBar and the MessageCenter button is
sufficient.
This checkin also has embedded a change such that InitializableView handling
(in renderView) is no tied to BookmarkableViews. The interfaces are handled
separately.
NOTE: It's still currently called the footer even though it's no longer
at the bottom. If accepted it will be renamed, probably to InfoBar.
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
index 2edcf48..24bbb81 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
@@ -54,7 +54,6 @@ import org.rhq.enterprise.gui.coregui.client.test.TestTopView;
import org.rhq.enterprise.gui.coregui.client.util.ErrorHandler;
import org.rhq.enterprise.gui.coregui.client.util.WidgetUtility;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
-import org.rhq.enterprise.gui.coregui.client.util.message.MessageBar;
import org.rhq.enterprise.gui.coregui.client.util.message.MessageCenter;
import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
@@ -86,8 +85,6 @@ public class CoreGUI implements EntryPoint,
ValueChangeHandler<String> {
private static ErrorHandler errorHandler = new ErrorHandler();
- private static MessageBar messageBar;
-
private static MessageCenter messageCenter;
private static String currentPath;
@@ -95,8 +92,6 @@ public class CoreGUI implements EntryPoint,
ValueChangeHandler<String> {
// @SuppressWarnings("unused")
// private static Canvas content;
- private RootCanvas rootCanvas;
-
private static ViewPath currentViewPath;
private static CoreGUI coreGUI;
@@ -109,6 +104,10 @@ public class CoreGUI implements EntryPoint,
ValueChangeHandler<String> {
// while also changing the main content. Typically we refresh only when the path is
not changed.
private static boolean pendingRefresh = false;
+ private RootCanvas rootCanvas;
+ private MenuBarView menuBarView;
+ private Footer footer;
+
public void onModuleLoad() {
String hostPageBaseURL = GWT.getHostPageBaseURL();
if (hostPageBaseURL.indexOf("/coregui/") == -1) {
@@ -162,10 +161,9 @@ public class CoreGUI implements EntryPoint,
ValueChangeHandler<String> {
public void buildCoreUI() {
// If the core gui is already built (eg. from previous login) skip the build and
just refire event
if (rootCanvas == null) {
- MenuBarView menuBarView = new MenuBarView("TopMenu");
+ menuBarView = new MenuBarView("TopMenu");
menuBarView.setWidth("100%");
-
- messageBar = new MessageBar();
+ footer = new Footer();
Canvas canvas = new Canvas(CONTENT_CANVAS_ID);
canvas.setWidth100();
@@ -173,12 +171,11 @@ public class CoreGUI implements EntryPoint,
ValueChangeHandler<String> {
rootCanvas = new RootCanvas();
rootCanvas.setOverflow(Overflow.HIDDEN);
- rootCanvas.addMember(menuBarView);
- rootCanvas.addMember(messageBar);
- //rootCanvas.addMember(breadCrumbTrailPane);
+ rootCanvas.addMember(menuBarView);
+ rootCanvas.addMember(footer);
rootCanvas.addMember(canvas);
- rootCanvas.addMember(new Footer());
+
rootCanvas.draw();
History.addValueChangeHandler(this);
@@ -360,6 +357,9 @@ public class CoreGUI implements EntryPoint,
ValueChangeHandler<String> {
public void renderView(final ViewPath viewPath) {
Window.setTitle(getViewPathTitle(viewPath));
+ // when navigating, clear any message, the user is probably no longer
interested
+ coreGUI.footer.getMessageBar().clearMessage(true);
+
// keep our CoreGUI session alive by refreshing the session timer each time
the user performs navigation
UserSessionManager.refresh();
@@ -405,25 +405,31 @@ public class CoreGUI implements EntryPoint,
ValueChangeHandler<String> {
contentCanvas.markForRedraw();
}
- if (this.currentCanvas instanceof BookmarkableView) {
- if (this.currentCanvas instanceof InitializableView) {
- final InitializableView initializableView = (InitializableView)
this.currentCanvas;
- new Timer() {
- final long startTime = System.currentTimeMillis();
+ if (this.currentCanvas instanceof InitializableView) {
+ final InitializableView initializableView = (InitializableView)
this.currentCanvas;
+ new Timer() {
+ final long startTime = System.currentTimeMillis();
- public void run() {
- if (initializableView.isInitialized()) {
- ((BookmarkableView)
currentCanvas).renderView(viewPath.next());
+ public void run() {
+ if (initializableView.isInitialized()) {
+ if (RootCanvas.this.currentCanvas instanceof
BookmarkableView) {
+ ((BookmarkableView)
RootCanvas.this.currentCanvas).renderView(viewPath.next());
} else {
- long elapsedMillis = System.currentTimeMillis() -
startTime;
- if (elapsedMillis < 10000) {
- schedule(100); // Reschedule the timer.
- }
+ RootCanvas.this.currentCanvas.markForRedraw();
+ }
+ } else {
+ long elapsedMillis = System.currentTimeMillis() -
startTime;
+ if (elapsedMillis < 10000) {
+ schedule(100); // Reschedule the timer.
}
}
- }.run(); // fire the timer immediately
+ }
+ }.run(); // fire the timer immediately
+ } else {
+ if (this.currentCanvas instanceof BookmarkableView) {
+ ((BookmarkableView)
this.currentCanvas).renderView(viewPath.next());
} else {
- ((BookmarkableView) currentCanvas).renderView(viewPath.next());
+ this.currentCanvas.markForRedraw();
}
}
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java
index a2b773f..1cfdd50 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java
@@ -21,10 +21,11 @@ package org.rhq.enterprise.gui.coregui.client;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.types.VerticalAlignment;
+import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
-import com.smartgwt.client.widgets.toolbar.ToolStripSeparator;
+import com.smartgwt.client.widgets.layout.HLayout;
+import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.alert.Alert;
import org.rhq.core.domain.criteria.AlertCriteria;
@@ -34,24 +35,27 @@ import org.rhq.enterprise.gui.coregui.client.alert.AlertHistoryView;
import org.rhq.enterprise.gui.coregui.client.footer.FavoritesButton;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.report.ReportTopView;
+import org.rhq.enterprise.gui.coregui.client.util.message.MessageBar;
import org.rhq.enterprise.gui.coregui.client.util.message.MessageCenterView;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableLabel;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableToolStrip;
/**
* @author Greg Hinkle
* @author Joseph Marques
*/
-public class Footer extends LocatableToolStrip {
+public class Footer extends LocatableHLayout {
private static final String LOCATOR_ID = "CoreFooter";
+ private MessageBar messageBar;
+
public Footer() {
super(LOCATOR_ID);
setHeight(30);
- setAlign(VerticalAlignment.CENTER);
+ setAlign(Alignment.LEFT);
setWidth100();
- setMembersMargin(10);
- setLayoutRightMargin(5);
+ setMembersMargin(5);
+ setBackgroundColor("#F1F2F3");
}
@Override
@@ -61,16 +65,25 @@ public class Footer extends LocatableToolStrip {
final MessageCenterView messageCenter = new
MessageCenterView(extendLocatorId(MessageCenterView.LOCATOR_ID));
final FavoritesButton favoritesButton = new
FavoritesButton(extendLocatorId("Favorites"));
final AlertsMessage alertsMessage = new
AlertsMessage(extendLocatorId("Alerts"));
+ messageBar = new MessageBar();
- addMember(messageCenter);
-
- addMember(new ToolStripSeparator());
+ // leave space for the RPC Activity Spinner
+ addMember(createHSpacer(16));
addMember(alertsMessage);
- addMember(new ToolStripSeparator());
+ addMember(messageBar);
+
+ VLayout favoritesLayout = new VLayout();
+ favoritesLayout.setHeight100();
+ favoritesLayout.setAutoWidth();
+ favoritesLayout.setAlign(Alignment.CENTER);
+ favoritesLayout.addMember(favoritesButton);
+ addMember(favoritesLayout);
+
+ addMember(messageCenter);
- addMember(favoritesButton);
+ addMember(createHSpacer(0));
alertsMessage.schedule(60000);
}
@@ -115,7 +128,7 @@ public class Footer extends LocatableToolStrip {
public static class AlertsMessage extends RefreshableLabel {
public AlertsMessage(String locatorId) {
super(locatorId);
- setHeight(30);
+ setHeight100();
setPadding(5);
setIcon("subsystems/alert/Alert_LOW_16.png");
@@ -154,4 +167,14 @@ public class Footer extends LocatableToolStrip {
}
}
+ public MessageBar getMessageBar() {
+ return messageBar;
+ }
+
+ private HLayout createHSpacer(int width) {
+ HLayout spacer = new HLayout();
+ spacer.setWidth(width);
+ return spacer;
+ }
+
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/TitleBar.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/TitleBar.java
index fe6c3b6..3ded730 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/TitleBar.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/TitleBar.java
@@ -48,7 +48,7 @@ public class TitleBar extends LocatableToolStrip {
super(parent.extendLocatorId("TitleBar"));
setWidth100();
- setHeight(37);
+ setHeight(30);
LocatableVLayout vLayout = new
LocatableVLayout(extendLocatorId("VLayout"));
vLayout.setAlign(VerticalAlignment.CENTER);
@@ -62,7 +62,7 @@ public class TitleBar extends LocatableToolStrip {
this.label.setIcon(icon);
this.label.setIconWidth(24);
this.label.setIconHeight(24);
- this.label.setAutoHeight();
+ this.label.setAutoHeight();
hLayout.addMember(this.label);
setVisible(false);
@@ -98,8 +98,8 @@ public class TitleBar extends LocatableToolStrip {
contents = "<span class='HeaderLabel'>" + title +
"</span>";
windowTitle = "RHQ: " + title;
}
- this.label.setContents(contents);
+ this.label.setContents(contents);
Window.setTitle(windowTitle);
}
-
+
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java
index 03f29e1..b255002 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java
@@ -56,14 +56,17 @@ public class FavoritesButton extends LocatableIMenuButton {
// this is the main menu - the "favorites" button shown in the UI the
user initially clicks
final Menu favoritesMenu = new Menu();
+ favoritesMenu.setSubmenuDirection("left");
setMenu(favoritesMenu);
- setShowMenuBelow(false);
setAutoFit(true);
// these are the child menus directly under the main favorites button
final Menu favoriteResourcesMenu = new Menu();
final Menu favoriteGroupsMenu = new Menu();
final Menu recentlyViewedMenu = new Menu();
+ favoriteResourcesMenu.setSubmenuDirection("left");
+ favoriteGroupsMenu.setSubmenuDirection("left");
+ recentlyViewedMenu.setSubmenuDirection("left");
MenuItem favoriteResourcesMenuItem = new MenuItem(MSG.favorites_resources(),
"Favorite_Resource_16.png");
favoriteResourcesMenuItem.setSubmenu(favoriteResourcesMenu);
favoriteResourcesMenu.setEmptyMessage(MSG.common_val_none());
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageBar.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageBar.java
index b28c6ce..29d7b75 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageBar.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageBar.java
@@ -34,6 +34,7 @@ import
org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableLabel;
* The message will be displayed for 30 seconds and then will be automatically cleared.
*
* @author Ian Springer
+ * @author Jay Shaughnessy
*/
public class MessageBar extends LocatableHLayout implements MessageCenter.MessageListener
{
private static final String LOCATOR_ID = "MessageBar";
@@ -59,7 +60,7 @@ public class MessageBar extends LocatableHLayout implements
MessageCenter.Messag
label.setAlign(Alignment.CENTER);
label.setWidth("600px");
- label.setHeight("25px");
+ label.setHeight("30px");
setLabelEmpty();
addMember(label);
@@ -121,6 +122,9 @@ public class MessageBar extends LocatableHLayout implements
MessageCenter.Messag
String styleName = (contents != null) ? message.getSeverity().getStyle() : null;
label.setStyleName(styleName);
+ // TODO: perhaps just set the text to green/orange/red along with the proper icon
and not have the defined
+ // color block...
+
// TODO: Create some custom edge images in green, yellow, red, etc. so we can add
nice rounded corners to the
// label.
//label.setShowEdges(true);
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java
index f9e7ec4..2564e1f 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java
@@ -21,14 +21,8 @@ package org.rhq.enterprise.gui.coregui.client.util.message;
import java.util.List;
import com.allen_sauer.gwt.log.client.Log;
-import com.google.gwt.user.client.Timer;
import com.smartgwt.client.types.Alignment;
-import com.smartgwt.client.types.AnimationEffect;
-import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.types.TitleOrientation;
-import com.smartgwt.client.types.VerticalAlignment;
-import com.smartgwt.client.widgets.AnimationCallback;
-import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.Window;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
@@ -36,8 +30,6 @@ import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.ButtonItem;
import com.smartgwt.client.widgets.form.fields.FormItemIcon;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
-import com.smartgwt.client.widgets.layout.LayoutSpacer;
-import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.menu.IMenuButton;
import com.smartgwt.client.widgets.menu.Menu;
import com.smartgwt.client.widgets.menu.MenuItem;
@@ -45,24 +37,23 @@ import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
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.LocatableWindow;
/**
* @author Greg Hinkle
*/
-public class MessageCenterView extends LocatableHLayout implements
MessageCenter.MessageListener {
+public class MessageCenterView extends LocatableVLayout implements
MessageCenter.MessageListener {
public static final String LOCATOR_ID = "MessageCenter";
public MessageCenterView(String locatorId) {
super(locatorId, 5);
setHeight100();
- //setAlign(Alignment.RIGHT);
- setAlign(VerticalAlignment.CENTER);
- setOverflow(Overflow.HIDDEN);
+ setAlign(Alignment.CENTER);
+ setAutoWidth();
}
@Override
@@ -74,10 +65,7 @@ public class MessageCenterView extends LocatableHLayout implements
MessageCenter
IMenuButton recentEventsButton = new
LocatableIMenuButton(extendLocatorId("RecentEvents"), MSG
.view_messageCenter_messageTitle(), recentEventsMenu);
- recentEventsButton.setTop(5);
- recentEventsButton.setShowMenuBelow(false);
recentEventsButton.setAutoFit(true);
- recentEventsButton.setValign(VerticalAlignment.CENTER);
recentEventsButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
@@ -103,14 +91,7 @@ public class MessageCenterView extends LocatableHLayout implements
MessageCenter
}
});
- VLayout vl = new VLayout();
- vl.setAutoWidth();
- vl.setAlign(Alignment.LEFT);
- vl.setAlign(VerticalAlignment.CENTER);
- vl.addMember(recentEventsButton);
-
- addMember(new LayoutSpacer());
- addMember(vl);
+ addMember(recentEventsButton);
}
private void showDetails(Message message) {
@@ -161,39 +142,6 @@ public class MessageCenterView extends LocatableHLayout implements
MessageCenter
public void onMessage(final Message message) {
if (!message.isTransient()) {
logMessage(message);
-
- final Label label = new Label(message.conciseMessage);
- label.setMargin(5);
- label.setAutoFit(true);
- label.setHeight(25);
- label.setWrap(false);
-
- String iconSrc = getSeverityIcon(message.severity);
-
- label.setIcon(iconSrc);
-
- label.setTooltip(message.detailedMessage);
-
- label.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- showDetails(message);
- }
- });
-
- addMember(label, 1);
- redraw();
-
- Timer hideTimer = new Timer() {
- @Override
- public void run() {
- label.animateHide(AnimationEffect.FADE, new AnimationCallback() {
- public void execute(boolean b) {
- label.destroy();
- }
- });
- }
- };
- hideTimer.schedule(10000);
}
}
commit 889e4fc6975de868e910e1b80a6cd6ea194ef78a
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Feb 25 10:19:51 2011 -0500
fix some jdoc links
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
index 822f817..57f3c6f 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
@@ -108,13 +108,13 @@ public abstract class TableSection<DS extends RPCDataSource>
extends Table<DS> i
}
}
- /*
- * The default implementation wraps the @{link getDetailsLinkColumnCellFormatter()}
column with the
- * @{link getDetailsLinkColumnCellFormatter()}. This is typically the 'name'
column linking to the detail
+ /**
+ * The default implementation wraps the {@link getDetailsLinkColumnCellFormatter()}
column with the
+ * {@link getDetailsLinkColumnCellFormatter()}. This is typically the 'name'
column linking to the detail
* view, given the 'id'. Also, establishes a double click handler for the row
which invokes
- * @{link showDetails()}</br>
+ * {@link showDetails()}</br>
* </br>
- * In general, in overrides, call super.configureTable *after* manipulating the
ListGrid fields.
+ * In general, in overrides, call super.configureTable *after* manipulating the
ListGrid fields.
*
* @see
org.rhq.enterprise.gui.coregui.client.components.table.Table#configureTable()
*/
commit c7bcef231eb74c9e7e50f699f574bee38fecb8c1
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Feb 25 10:19:23 2011 -0500
Infrastructure for Dashboard-based group and resource summary pages.
- Domain changes to support subject/resource/group relations for dashboards.
(subject was already there but added FK)
- Uses cascade delete for dashboard cleanup
- db-upgrade work, schema version 2.103
- added Criteria querying for Dashboards, removed now obsolete slsb calls
- fixed issues with portal column width configuration
1) no longer ignored
2) stored values were corrupt, now stored as expected
3) added underlying support for (future) ability to change column widths
- [Bug 661515] detach edit dash form from portlet layout so it it doesn't
scroll when on screen.
- A couple of small domain class changes for clarity or things I thought may help
smartgwt.
- tweak dash look+feel
NOTE: There is a bunch of temporary MessageCenter messaging for debugging.
This will be removed in a future commit...
NOTE: The actual group dash portlets still need definition. Currently
just using placeholders.
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index a2ae0c7..bf65ffb 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -22,7 +22,7 @@
<properties>
<scm.module.path>modules/core/dbutils/</scm.module.path>
- <db.schema.version>2.102</db.schema.version>
+ <db.schema.version>2.103</db.schema.version>
</properties>
<dependencies>
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/dashboard-schema.xml
b/modules/core/dbutils/src/main/scripts/dbsetup/dashboard-schema.xml
index 48c95a5..e6dd210 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/dashboard-schema.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/dashboard-schema.xml
@@ -8,7 +8,10 @@
<table name="RHQ_DASHBOARD">
<column name="ID" default="sequence-only"
initial="10001" primarykey="true" required="true"
type="INTEGER"/>
<column name="NAME" type="VARCHAR2" size="200"
required="true"/>
- <column name="SUBJECT_ID" type="INTEGER"
required="true"/>
+ <column name="SUBJECT_ID" type="INTEGER"
required="true" references="RHQ_SUBJECT"/>
+ <column name="RESOURCE_ID" type="INTEGER"
required="false" references="RHQ_RESOURCE"/>
+ <column name="GROUP_ID" type="INTEGER"
required="false" references="RHQ_RESOURCE_GROUP"/>
+ <column name="CATEGORY" type="VARCHAR2"
size="20" required="true"/>
<column name="SHARED" type="BOOLEAN"
required="true"/>
<column name="CONFIGURATION_ID" type="INTEGER"
required="false" references="RHQ_CONFIG"/>
</table>
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index 975c778..e9b78a8 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -3296,6 +3296,50 @@
</schema-directSQL>
</schemaSpec>
+ <schemaSpec version="2.103">
+ <!-- add FK for owning Subject -->
+ <schema-directSQL>
+ <statement desc="Creating RHQ_DASHBOARD foreign key relation
to RHQ_SUBJECT for resource dashboards">
+ ALTER TABLE RHQ_DASHBOARD
+ ADD CONSTRAINT RHQ_DB_SUBJECT_ID_FK
+ FOREIGN KEY (SUBJECT_ID)
+ REFERENCES RHQ_SUBJECT (ID)
+ </statement>
+ </schema-directSQL>
+
+ <!-- Support resource specific dashboards -->
+ <schema-addColumn table="RHQ_DASHBOARD"
column="RESOURCE_ID" columnType="INTEGER" />
+ <schema-directSQL>
+ <statement desc="Creating RHQ_DASHBOARD foreign key relation
to RHQ_RESOURCE for resource dashboards">
+ ALTER TABLE RHQ_DASHBOARD
+ ADD CONSTRAINT RHQ_DB_RESOURCE_ID_FK
+ FOREIGN KEY (RESOURCE_ID)
+ REFERENCES RHQ_RESOURCE (ID)
+ </statement>
+ </schema-directSQL>
+
+ <!-- Support group specific dashboards -->
+ <schema-addColumn table="RHQ_DASHBOARD"
column="GROUP_ID" columnType="INTEGER" />
+ <schema-directSQL>
+ <statement desc="Creating RHQ_DASHBOARD foreign key relation
to RHQ_RESOURCE_GROUP for group dashboards">
+ ALTER TABLE RHQ_DASHBOARD
+ ADD CONSTRAINT RHQ_DB_RG_ID_FK
+ FOREIGN KEY (GROUP_ID)
+ REFERENCES RHQ_RESOURCE_GROUP (ID)
+ </statement>
+ </schema-directSQL>
+
+ <!-- Add category for distinguishing what kind of dashboard this is
-->
+ <schema-addColumn table="RHQ_DASHBOARD"
column="CATEGORY" columnType="VARCHAR2" precision="20"/>
+ <schema-directSQL>
+ <statement desc="Set dashboard category for existing
dashboards to INVENTORY">
+ UPDATE RHQ_DASHBOARD
+ SET CATEGORY = 'INVENTORY'
+ </statement>
+ </schema-directSQL>
+ <schema-alterColumn table="RHQ_DASHBOARD"
column="CATEGORY" nullable="FALSE" />
+ </schemaSpec>
+
</dbupgrade>
</target>
</project>
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java
index 182b74b..dd66c1b 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java
@@ -50,6 +50,7 @@ import org.jetbrains.annotations.NotNull;
import org.rhq.core.domain.authz.Role;
import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.dashboard.Dashboard;
import org.rhq.core.domain.resource.group.ResourceGroup;
/**
@@ -305,10 +306,14 @@ public class Subject implements Serializable {
@ManyToMany
private java.util.Set<Role> ldapRoles;
- // When a subject is removed any owned groups should also be removed
+ // When a subject is removed any owned groups are removed manually, no cascade delete
for groups
@OneToMany(mappedBy = "subject", fetch = FetchType.LAZY)
private List<ResourceGroup> ownedGroups = null;
+ // When a subject is removed any owned dashboards are removed automatically
+ @OneToMany(mappedBy = "owner", fetch = FetchType.LAZY, cascade =
CascadeType.REMOVE)
+ private List<Dashboard> ownedDashboards = null;
+
@Transient
private Integer sessionId = null;
@@ -503,6 +508,14 @@ public class Subject implements Serializable {
this.ownedGroups = ownedGroups;
}
+ protected List<Dashboard> getOwnedDashboards() {
+ return ownedDashboards;
+ }
+
+ protected void setOwnedDashboards(List<Dashboard> ownedDashboards) {
+ this.ownedDashboards = ownedDashboards;
+ }
+
@Override
public String toString() {
return "Subject[id=" + id + ",name=" + name + "]";
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/DashboardCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/DashboardCriteria.java
new file mode 100644
index 0000000..e1ef74a
--- /dev/null
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/DashboardCriteria.java
@@ -0,0 +1,126 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.core.domain.criteria;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+
+import org.rhq.core.domain.dashboard.Dashboard;
+import org.rhq.core.domain.dashboard.DashboardCategory;
+import org.rhq.core.domain.util.PageOrdering;
+
+/**
+ * The criteria for fetching {@link Dashboard}s.
+ *
+ * @author Jay Shaughnessy
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@SuppressWarnings("unused")
+public class DashboardCriteria extends Criteria {
+ private static final long serialVersionUID = 1L;
+
+ private Integer filterId;
+ private DashboardCategory filterCategory = DashboardCategory.INVENTORY;
+ private Integer filterGroupId; // needs overrides
+ private String filterName;
+ private Integer filterOwnerId; // needs overrides
+ private Integer filterResourceId; // needs overrides
+ private Boolean filterShared;
+
+ private boolean fetchConfiguration;
+ private boolean fetchOwner;
+
+ private PageOrdering sortName;
+
+ /**
+ * Note: Default Criteria Settings:<br/>
+ * ownerId = sessionSubject (i.e. the caller)<br/>
+ * category = INVENTORY<br/>
+ */
+ public DashboardCriteria() {
+ filterOverrides.put("groupId", "group.id = ?");
+ filterOverrides.put("ownerId", "owner.id = ?");
+ filterOverrides.put("resourceId", "resource.id = ?");
+ }
+
+ @Override
+ public Class<Dashboard> getPersistentClass() {
+ return Dashboard.class;
+ }
+
+ public void addFilterId(Integer filterId) {
+ this.filterId = filterId;
+ }
+
+ /**
+ * If not set explicitly this defaults to {@link DashboardCategory.INVENTORY}.
+ * @param category
+ */
+ public void addFilterCategory(DashboardCategory category) {
+ this.filterCategory = category;
+ }
+
+ public DashboardCategory getFilterCategory() {
+ return this.filterCategory;
+ }
+
+ public void addFilterGroupId(Integer filterGroupId) {
+ this.filterGroupId = filterGroupId;
+ }
+
+ public void addFilterName(String filterName) {
+ this.filterName = filterName;
+ }
+
+ /**
+ * Requires MANAGE_INVENTORY to set. When not set defaults to dashboards owned by
the current user.
+ * @param filterOwnerId set to 0 for dashboards owned by anyone
+ */
+ public void addFilterOwnerId(Integer filterOwnerId) {
+ this.filterOwnerId = filterOwnerId;
+ }
+
+ public Integer getFilterOwnerId() {
+ return filterOwnerId;
+ }
+
+ public void addFilterResourceId(Integer filterResourceId) {
+ this.filterResourceId = filterResourceId;
+ }
+
+ public void addFilterShared(Boolean filterShared) {
+ this.filterShared = filterShared;
+ }
+
+ public void addSortName(PageOrdering sortName) {
+ addSortField("name");
+ this.sortName = sortName;
+ }
+
+ @Override
+ public boolean isInventoryManagerRequired() {
+ // presently only inventory managers can view/manage other people's
dashboards
+ return this.filterOwnerId != null;
+ }
+
+}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/Dashboard.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/Dashboard.java
index 2c2482e..622bd28 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/Dashboard.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/Dashboard.java
@@ -35,6 +35,8 @@ import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
@@ -54,9 +56,12 @@ import org.hibernate.annotations.Cascade;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.group.ResourceGroup;
/**
* @author Greg Hinkle
+ * @author Jay Shaughnessy
*/
@Entity
@SequenceGenerator(name = "RHQ_DASHBOARD_ID_SEQ", sequenceName =
"RHQ_DASHBOARD_ID_SEQ")
@@ -70,11 +75,16 @@ public class Dashboard implements Serializable {
@Column(name = "ID", nullable = false)
@GeneratedValue(strategy = GenerationType.AUTO, generator =
"RHQ_DASHBOARD_ID_SEQ")
@Id
- private int id;
+ private int id = 0;
@Column(name = "NAME", nullable = false)
private String name;
+ @Column(name = "CATEGORY", nullable = false)
+ @Enumerated(EnumType.STRING)
+ private DashboardCategory category;
+
+ // currently unused
@Column(name = "SHARED", nullable = false)
private boolean shared = false;
@@ -86,6 +96,14 @@ public class Dashboard implements Serializable {
@ManyToOne(fetch = FetchType.LAZY)
private Subject owner;
+ @JoinColumn(name = "RESOURCE_ID", nullable = true)
+ @ManyToOne(fetch = FetchType.LAZY)
+ private Resource resource;
+
+ @JoinColumn(name = "GROUP_ID", nullable = true)
+ @ManyToOne(fetch = FetchType.LAZY)
+ private ResourceGroup group;
+
@OneToMany(mappedBy = "dashboard", fetch = FetchType.EAGER)
@Cascade( { org.hibernate.annotations.CascadeType.PERSIST,
org.hibernate.annotations.CascadeType.MERGE,
org.hibernate.annotations.CascadeType.DELETE_ORPHAN })
@@ -128,6 +146,30 @@ public class Dashboard implements Serializable {
this.owner = owner;
}
+ public DashboardCategory getCategory() {
+ return category;
+ }
+
+ public void setCategory(DashboardCategory category) {
+ this.category = category;
+ }
+
+ protected Resource getResource() {
+ return resource;
+ }
+
+ protected void setResource(Resource resource) {
+ this.resource = resource;
+ }
+
+ public ResourceGroup getGroup() {
+ return group;
+ }
+
+ public void setGroup(ResourceGroup group) {
+ this.group = group;
+ }
+
public int getColumns() {
return configuration.getSimple(CFG_COLUMNS).getIntegerValue();
}
@@ -141,7 +183,15 @@ public class Dashboard implements Serializable {
}
public void setColumnWidths(String... columnWidths) {
- configuration.put(new PropertySimple(CFG_WIDTHS, columnWidths));
+ if (null == columnWidths || columnWidths.length == 0) {
+ return;
+ }
+
+ String widths = columnWidths[0];
+ for (int i = 1; i < columnWidths.length; ++i) {
+ widths += ("," + columnWidths[i]);
+ }
+ configuration.put(new PropertySimple(CFG_WIDTHS, widths));
}
public Configuration getConfiguration() {
@@ -158,7 +208,7 @@ public class Dashboard implements Serializable {
public List<DashboardPortlet> getPortlets(int column) {
- List<DashboardPortlet> columnPortlets = new
ArrayList<DashboardPortlet>();
+ ArrayList<DashboardPortlet> columnPortlets = new
ArrayList<DashboardPortlet>();
for (DashboardPortlet p : this.portlets) {
if (p.getColumn() == column) {
columnPortlets.add(p);
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/DashboardCategory.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/DashboardCategory.java
new file mode 100644
index 0000000..ed4a0ef
--- /dev/null
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/DashboardCategory.java
@@ -0,0 +1,68 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.core.domain.dashboard;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * A Dashboard category.
+ * <pre>
+ * INVENTORY : A dashboard for resources across a user's inventory.
+ * RESOURCE : A dashboard for a specific resource.
+ * GROUP : A dashboard for a specific resource group.
+ * </pre>
+ *
+ * @author Jay Shaughnessy
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlRootElement
+public enum DashboardCategory {
+ INVENTORY("Inventory"), RESOURCE("Resource"),
GROUP("Group");
+
+ private final String displayName;
+
+ DashboardCategory(String displayName) {
+ this.displayName = displayName;
+ }
+
+ /**
+ * A Java bean style getter to allow us to access the enum name from JSP or Facelets
pages (e.g.
+ * ${Resource.resourceType.category.name}).
+ *
+ * @return the enum name
+ */
+ public String getName() {
+ return name();
+ }
+
+ public String getDisplayName() {
+ return this.displayName;
+ }
+
+ @Override
+ public String toString() {
+ return this.displayName;
+ }
+}
\ No newline at end of file
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/DashboardPortlet.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/DashboardPortlet.java
index a83b061..b2906aa 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/DashboardPortlet.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/dashboard/DashboardPortlet.java
@@ -57,7 +57,7 @@ public class DashboardPortlet implements Serializable {
@Column(name = "ID", nullable = false)
@GeneratedValue(strategy = GenerationType.AUTO, generator =
"RHQ_DASHBOARD_PORTLET_ID_SEQ")
@Id
- private int id;
+ private int id = 0;
// A non-displayed, persisted identifier for the portlet.
@Column(name = "PORTLET_KEY")
@@ -68,10 +68,10 @@ public class DashboardPortlet implements Serializable {
private String name;
@Column(name = "COL")
- private int column;
+ private int column = 0;
@Column(name = "COL_INDEX")
- private int index;
+ private int index = 0;
@Column(name = "HEIGHT")
private int height = 300;
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
index dd14c13..b83f44c 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
@@ -68,6 +68,7 @@ import org.rhq.core.domain.content.InstalledPackage;
import org.rhq.core.domain.content.InstalledPackageHistory;
import org.rhq.core.domain.content.Repo;
import org.rhq.core.domain.content.ResourceRepo;
+import org.rhq.core.domain.dashboard.Dashboard;
import org.rhq.core.domain.event.EventSource;
import org.rhq.core.domain.measurement.Availability;
import org.rhq.core.domain.measurement.MeasurementSchedule;
@@ -1058,6 +1059,10 @@ public class Resource implements Comparable<Resource>,
Serializable {
@OneToMany(mappedBy = "autoGroupParentResource", fetch = FetchType.LAZY)
private List<ResourceGroup> autoGroupBackingGroups = null;
+ // When a group is removed any owned dashboards are removed automatically
+ @OneToMany(mappedBy = "resource", fetch = FetchType.LAZY, cascade =
CascadeType.REMOVE)
+ private Set<Dashboard> dashboards = null;
+
public Resource() {
}
@@ -1664,6 +1669,14 @@ public class Resource implements Comparable<Resource>,
Serializable {
this.autoGroupBackingGroups = autoGroupBackingGroups;
}
+ protected Set<Dashboard> getDashboards() {
+ return dashboards;
+ }
+
+ protected void setDashboards(Set<Dashboard> dashboards) {
+ this.dashboards = dashboards;
+ }
+
public int compareTo(Resource that) {
return this.name.compareTo(that.getName());
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java
index 0a34e0c..58f6b48 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java
@@ -59,6 +59,7 @@ import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Role;
import org.rhq.core.domain.bundle.BundleDestination;
import org.rhq.core.domain.configuration.group.AbstractGroupConfigurationUpdate;
+import org.rhq.core.domain.dashboard.Dashboard;
import org.rhq.core.domain.operation.GroupOperationHistory;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
@@ -472,6 +473,10 @@ public class ResourceGroup extends Group {
@ManyToMany(mappedBy = "resourceGroups", fetch = FetchType.LAZY, cascade =
CascadeType.REMOVE)
private Set<Tag> tags;
+ // When a group is removed any owned dashboards are removed automatically
+ @OneToMany(mappedBy = "group", fetch = FetchType.LAZY, cascade =
CascadeType.REMOVE)
+ private Set<Dashboard> dashboards = null;
+
/* no-arg constructor required by EJB spec */
protected ResourceGroup() {
}
@@ -719,6 +724,14 @@ public class ResourceGroup extends Group {
}
}
+ protected Set<Dashboard> getDashboards() {
+ return dashboards;
+ }
+
+ protected void setDashboards(Set<Dashboard> dashboards) {
+ this.dashboards = dashboards;
+ }
+
@PrePersist
@PreUpdate
void onPersist() {
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardContainer.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardContainer.java
new file mode 100644
index 0000000..d072595
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardContainer.java
@@ -0,0 +1,15 @@
+package org.rhq.enterprise.gui.coregui.client.dashboard;
+
+import java.util.Set;
+
+import org.rhq.core.domain.authz.Permission;
+
+public interface DashboardContainer {
+
+ public Set<Permission> getGlobalPermissions();
+
+ public boolean supportsDashboardNameEdit();
+
+ public void updateDashboardNames();
+
+}
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 3520afc..e57484b 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
@@ -53,10 +53,9 @@ 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.UserSessionManager;
-import org.rhq.enterprise.gui.coregui.client.components.form.ColorButtonItem;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.util.MeasurementUtility;
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.LocatableDynamicForm;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIMenuButton;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableMenu;
@@ -64,11 +63,12 @@ import
org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
/**
+ * @author Jay Shaughnessy
* @author Greg Hinkle
* @author Simeon Pinder
*/
public class DashboardView extends LocatableVLayout {
- private DashboardsView dashboardsView;
+ private DashboardContainer dashboardContainer;
private Dashboard storedDashboard;
boolean editMode = false;
@@ -77,15 +77,15 @@ public class DashboardView extends LocatableVLayout {
LocatableDynamicForm editForm;
IMenuButton addPortlet;
- Set<PortletWindow> portletWindows = new HashSet<PortletWindow>();
+ HashSet<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));
private static String REFRESH10 =
MSG.view_dashboards_portlets_refresh_multiple_min(String.valueOf(10));
private static Integer STOP_VALUE = 0;
- private static Integer REFRESH1_VALUE = 1 *
Long.valueOf(MeasurementUtility.MINUTES).intValue();
- private static Integer REFRESH5_VALUE = 5 *
Long.valueOf(MeasurementUtility.MINUTES).intValue();
- private static Integer REFRESH10_VALUE = 10 *
Long.valueOf(MeasurementUtility.MINUTES).intValue();
+ private static Integer REFRESH1_VALUE = 1 * 60000;
+ private static Integer REFRESH5_VALUE = 5 * 60000;
+ private static Integer REFRESH10_VALUE = 10 * 60000;
private HashMap<Integer, String> refreshMenuMappings;
private MenuItem[] refreshMenuItems;
@@ -97,26 +97,33 @@ public class DashboardView extends LocatableVLayout {
// the view is set to a Tab's pane.
private boolean isInitialized = false;
- public DashboardView(String locatorId, DashboardsView dashboardsView, Dashboard
storedDashboard) {
+ public DashboardView(String locatorId, DashboardContainer dashboardContainer,
Dashboard storedDashboard) {
super(locatorId);
- this.dashboardsView = dashboardsView;
+ this.dashboardContainer = dashboardContainer;
this.storedDashboard = storedDashboard;
- setOverflow(Overflow.AUTO);
- setPadding(5);
}
@Override
protected void onInit() {
-
if (!isInitialized) {
+ CoreGUI.getMessageCenter().notify(new Message("------->>
DashboardView.oninit()", Severity.Info)); // TODO
+
super.onInit();
- addMember(buildEditForm());
+
+ this.setWidth100();
+ this.setHeight100();
+
+ this.addMember(buildEditForm());
+ buildPortlets();
+
isInitialized = true;
}
}
- public void redraw() {
+ public void rebuild() {
+ CoreGUI.getMessageCenter().notify(new Message("------->>
DashboardView.rebuild()", Severity.Info)); // TODO
+
// destroy all of the portlets and recreate from scratch
portalLayout.removeFromParent();
portalLayout.destroy();
@@ -125,53 +132,89 @@ public class DashboardView extends LocatableVLayout {
buildPortlets();
}
+ public void redraw() {
+ CoreGUI.getMessageCenter().notify(new Message("------->>
DashboardView.redraw()", Severity.Info)); // TODO
+ super.redraw();
+ }
+
+ @Override
+ public void draw() {
+ CoreGUI.getMessageCenter().notify(new Message("------->>
DashboardView.draw()", Severity.Info)); // TODO
+ super.draw();
+ }
+
@Override
protected void onDraw() {
+ CoreGUI.getMessageCenter().notify(new Message("------->>
DashboardView.onDraw()", Severity.Info)); // TODO
super.onDraw();
- buildPortlets();
+
+ setEditMode(editMode);
}
public void buildPortlets() {
- setWidth100();
- setHeight100();
+ CoreGUI.getMessageCenter().notify(new Message("------->>
DashboardView.buildPortlets(1)", Severity.Info)); // TODO
+
+
this.setBackgroundColor(storedDashboard.getConfiguration().getSimpleValue(Dashboard.CFG_BACKGROUND,
"white"));
-
setBackgroundColor(storedDashboard.getConfiguration().getSimpleValue(Dashboard.CFG_BACKGROUND,
"white"));
+ CoreGUI.getMessageCenter().notify(new Message("------->>
DashboardView.buildPortlets(2)", Severity.Info)); // TODO
+ portalLayout = new PortalLayout(extendLocatorId("PortalLayout"), this,
storedDashboard.getColumns(),
+ storedDashboard.getColumnWidths());
- portalLayout = new PortalLayout(extendLocatorId("PortalLayout"), this,
storedDashboard.getColumns());
+ CoreGUI.getMessageCenter().notify(new Message("------->>
DashboardView.buildPortlets(3)", Severity.Info)); // TODO
+ portalLayout.setOverflow(Overflow.AUTO);
portalLayout.setWidth100();
portalLayout.setHeight100();
+ CoreGUI.getMessageCenter().notify(new Message("------->>
DashboardView.buildPortlets(4)", Severity.Info)); // TODO
+
loadPortletWindows();
+ CoreGUI.getMessageCenter().notify(new Message("------->>
DashboardView.buildPortlets(5)", Severity.Info)); // TODO
+
addMember(portalLayout);
+
+ CoreGUI.getMessageCenter().notify(new Message("------->>
DashboardView.buildPortlets(6)", Severity.Info)); // TODO
+ }
+
+ protected boolean canEditName() {
+ return true;
}
private DynamicForm buildEditForm() {
+ CoreGUI.getMessageCenter().notify(new Message("------->>
DashboardView.buildEditForm(1)", Severity.Info)); // TODO
+
editForm = new LocatableDynamicForm(extendLocatorId("Editor"));
+ editForm.setMargin(5);
editForm.setAutoWidth();
- editForm.setNumCols(12);
-
- TextItem nameItem = new TextItem("name",
MSG.common_title_dashboard_name());
- nameItem.setValue(storedDashboard.getName());
- nameItem.setWrapTitle(false);
- nameItem.addBlurHandler(new BlurHandler() {
- public void onBlur(BlurEvent blurEvent) {
- String val = (String) blurEvent.getItem().getValue();
- val = (null == val) ? "" : val.trim();
- if (!("".equals(val) || val.equals(storedDashboard.getName())))
{
- storedDashboard.setName(val);
- save();
- dashboardsView.updateNames();
+ editForm.setNumCols(canEditName() ? 12 : 10);
+
+ TextItem nameItem = null;
+
+ if (dashboardContainer.supportsDashboardNameEdit()) {
+ CoreGUI.getMessageCenter().notify(new Message("------->>
DashboardView.buildEditForm(2)", Severity.Info)); // TODO
+
+ nameItem = new TextItem("name",
MSG.common_title_dashboard_name());
+ nameItem.setValue(storedDashboard.getName());
+ nameItem.setWrapTitle(false);
+ nameItem.addBlurHandler(new BlurHandler() {
+ public void onBlur(BlurEvent blurEvent) {
+ String val = (String) blurEvent.getItem().getValue();
+ val = (null == val) ? "" : val.trim();
+ if (!("".equals(val) ||
val.equals(storedDashboard.getName()))) {
+ storedDashboard.setName(val);
+ save();
+ dashboardContainer.updateDashboardNames();
+ }
}
- }
- });
+ });
+ }
final StaticTextItem numColItem = new StaticTextItem();
numColItem.setTitle(MSG.common_title_columns());
numColItem.setValue(storedDashboard.getColumns());
ButtonItem addColumn = new ButtonItem("addColumn",
MSG.common_title_add_column());
- // addColumn.setIcon("silk/application_side_expand.png");
+
addColumn.setAutoFit(true);
addColumn.setStartRow(false);
addColumn.setEndRow(false);
@@ -323,29 +366,41 @@ public class DashboardView extends LocatableVLayout {
refreshCanvas.setStartRow(false);
refreshCanvas.setEndRow(false);
- editForm.setItems(nameItem, addCanvas, numColItem, addColumn, removeColumn,
picker, refreshCanvas);
+ if (null != nameItem) {
+ editForm.setItems(nameItem, addCanvas, numColItem, addColumn, removeColumn,
picker, refreshCanvas);
+ } else {
+ editForm.setItems(addCanvas, numColItem, addColumn, removeColumn, picker,
refreshCanvas);
+ }
updateRefreshMenu();
this.refreshMenuButton.markForRedraw();
- markForRedraw();
+ //this.markForRedraw();
+ CoreGUI.getMessageCenter().notify(new Message("------->>
DashboardView.buildEditForm(2)", Severity.Info)); // TODO
return editForm;
}
private void loadPortletWindows() {
+ CoreGUI.getMessageCenter().notify(new Message("------->>
DashboardView.loadPortletWindows(1)", Severity.Info)); // TODO
+
for (int i = 0; i < storedDashboard.getColumns(); i++) {
for (DashboardPortlet storedPortlet : storedDashboard.getPortlets(i)) {
String locatorId = getPortletLocatorId(portalLayout, storedPortlet);
- final PortletWindow portletWindow = new PortletWindow(locatorId, this,
storedPortlet);
- portletWindows.add(portletWindow);
- portletWindow.setTitle(storedPortlet.getName());
+ CoreGUI.getMessageCenter().notify(
+ new Message("------->>
DashboardView.loadPortletWindows(" + locatorId + ")", Severity.Info)); //
TODO
+
+ PortletWindow portletWindow = new PortletWindow(locatorId, this,
storedPortlet);
+ portletWindow.setTitle(storedPortlet.getName());
portletWindow.setHeight(storedPortlet.getHeight());
portletWindow.setVisible(true);
+ portletWindows.add(portletWindow);
portalLayout.addPortletWindow(portletWindow, i);
}
}
+
+ CoreGUI.getMessageCenter().notify(new Message("------->>
DashboardView.loadPortletWindows(2)", Severity.Info)); // TODO
}
/**
@@ -374,7 +429,7 @@ public class DashboardView extends LocatableVLayout {
return portalLayout.extendLocatorId(locatorId.toString());
}
- private void addPortlet(String portletKey, String portletName) {
+ protected void addPortlet(String portletKey, String portletName) {
DashboardPortlet storedPortlet = new DashboardPortlet(portletName, portletKey,
250);
storedDashboard.addPortlet(storedPortlet);
@@ -420,17 +475,17 @@ public class DashboardView extends LocatableVLayout {
storedDashboard.removePortlet(portlet);
// portlet remove means the portlet locations may have changed. The selenium
testing locators include
- // positioning info. So, in this case we have to take the hit and completely
redraw the dash.
+ // positioning info. So, in this case we have to take the hit and completely
refresh the dash.
AsyncCallback<Dashboard> callback = SeleniumUtility.getUseDefaultIds() ?
null : new AsyncCallback<Dashboard>() {
@Override
public void onFailure(Throwable caught) {
- redraw();
+ rebuild();
}
@Override
public void onSuccess(Dashboard result) {
- redraw();
+ rebuild();
}
};
save(callback);
@@ -489,15 +544,16 @@ public class DashboardView extends LocatableVLayout {
}
}
for (PortletWindow portletWindow : portletWindows) {
- for (DashboardPortlet portlet : result.getPortlets()) {
- if (equalsDashboardPortlet(portletWindow.getStoredPortlet(),
portlet)) {
- portletWindow.setStoredPortlet(portlet);
+ for (DashboardPortlet updatedPortlet : result.getPortlets()) {
+ if (equalsDashboardPortlet(portletWindow.getStoredPortlet(),
updatedPortlet)) {
+ portletWindow.setStoredPortlet(updatedPortlet);
- //restarting portlet auto-refresh with newest settings
+ // restarting portlet auto-refresh with newest settings
Portlet view = portletWindow.getView();
if (view instanceof AutoRefreshPortlet) {
((AutoRefreshPortlet) view).startRefreshCycle();
}
+ break;
}
}
}
@@ -507,35 +563,46 @@ public class DashboardView extends LocatableVLayout {
/**
* This is an enhanced equals for portlets that allows equality for unpersisted
portlets. At times (like addPortlet)
* a portlet may have been associated with its window prior to being persisted. In
this case we can consider
- * it equal if it is associated with the same dashboard and has the same positioning.
Note that key-name pairing
+ * it equal if it is associated with the same dashboard(1) and has the same
positioning. Note that key-name pairing
* can not be used for equality as a dashboard is allowed to have the same portlet
multiple times, with a default
* name. But they can not hold the same position.
+ * <pre>
+ * (1) Even the dashboard comparison has been made flexible. To allow for lazy
persist of the dashboard (to
+ * allow for the default group or resource dashboard to not be persisted) we
allow the dash comparison
+ * to be done by name if an entity id is 0. This should be safe as dashboard
names are set prior to
+ * persist, and should be unique for the session user.
*
- * @param portlet1
- * @param portlet2
+ * @param storedPortlet
+ * @param updatedPortlet
* @return
*/
- private boolean equalsDashboardPortlet(DashboardPortlet portlet1, DashboardPortlet
portlet2) {
+ private boolean equalsDashboardPortlet(DashboardPortlet storedPortlet,
DashboardPortlet updatedPortlet) {
- if (portlet1.equals(portlet2)) {
+ if (storedPortlet.equals(updatedPortlet)) {
return true;
}
- // make sure at least one portlet is not persisted
- if (portlet1.getId() > 0 && portlet2.getId() > 0) {
+ // make sure at least one portlet is not persisted for pseudo-equality
+ if (storedPortlet.getId() > 0 && updatedPortlet.getId() > 0) {
return false;
}
- // must match dash and position for psuedo-equality
- if (portlet1.getDashboard().getId() != portlet2.getDashboard().getId()) {
+ // must match position for pseudo-equality
+ if (storedPortlet.getColumn() != updatedPortlet.getColumn()) {
return false;
}
- if (portlet1.getColumn() != portlet2.getColumn()) {
+ if (storedPortlet.getIndex() != updatedPortlet.getIndex()) {
return false;
}
- if (portlet1.getIndex() != portlet2.getIndex()) {
+ // must match dash (ids if persisted, otherwise name) for pseudo-equality
+ boolean unpersistedDash = (storedPortlet.getDashboard().getId() == 0 ||
updatedPortlet.getDashboard().getId() == 0);
+ boolean dashMatchId = (!unpersistedDash &&
(storedPortlet.getDashboard().getId() == updatedPortlet
+ .getDashboard().getId()));
+ boolean dashMatchName = (unpersistedDash &&
storedPortlet.getDashboard().getName().equals(
+ updatedPortlet.getDashboard().getName()));
+ if (!(dashMatchId || dashMatchName)) {
return false;
}
@@ -568,7 +635,7 @@ public class DashboardView extends LocatableVLayout {
}
public Set<Permission> getGlobalPermissions() {
- return dashboardsView.getGlobalPermissions();
+ return dashboardContainer.getGlobalPermissions();
}
public void setEditMode(boolean editMode) {
@@ -578,7 +645,9 @@ public class DashboardView extends LocatableVLayout {
} else {
this.editForm.hide();
}
- markForRedraw();
+ this.editForm.markForRedraw();
+ this.portalLayout.show();
+ this.portalLayout.markForRedraw(); // TODO
}
public class UpdatePortletRefreshCallback implements AsyncCallback<Subject> {
@@ -614,7 +683,8 @@ public class DashboardView extends LocatableVLayout {
retrievedRefreshInterval =
UserSessionManager.getUserPreferences().getPageRefreshInterval();
}
String currentSelection = refreshMenuMappings.get(retrievedRefreshInterval);
- if (currentSelection != null) {//iterate over menu items and update icon
details
+ if (currentSelection != null) {
+ //iterate over menu items and update icon details
for (int i = 0; i < refreshMenuItems.length; i++) {
MenuItem menu = refreshMenuItems[i];
if (currentSelection.equals(menu.getTitle())) {
@@ -632,4 +702,8 @@ public class DashboardView extends LocatableVLayout {
this.refreshMenuButton.markForRedraw();
}
}
+
+ public Dashboard getStoredDashboard() {
+ return storedDashboard;
+ }
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java
index 9a4970e..f3d1c69 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java
@@ -24,6 +24,7 @@ package org.rhq.enterprise.gui.coregui.client.dashboard;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -45,8 +46,11 @@ import com.smartgwt.client.widgets.tab.events.TabSelectedHandler;
import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.criteria.DashboardCriteria;
import org.rhq.core.domain.dashboard.Dashboard;
+import org.rhq.core.domain.dashboard.DashboardCategory;
import org.rhq.core.domain.dashboard.DashboardPortlet;
+import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.InitializableView;
@@ -72,9 +76,10 @@ import
org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
+ * @author Jay Shaughnessy
* @author Greg Hinkle
*/
-public class DashboardsView extends LocatableVLayout implements BookmarkableView,
InitializableView {
+public class DashboardsView extends LocatableVLayout implements DashboardContainer,
BookmarkableView, InitializableView {
public static final ViewName VIEW_ID = new ViewName("Dashboards",
MSG.view_dashboards_title());
@@ -100,7 +105,7 @@ public class DashboardsView extends LocatableVLayout implements
BookmarkableView
private DashboardGWTServiceAsync dashboardService =
GWTServiceLookup.getDashboardService();
// Capture the user's global permissions for use by any dashboard or portlet that
may need it for rendering.
- private Set<Permission> globalPermissions;
+ private HashSet<Permission> globalPermissions;
private boolean initialized = false;
@@ -116,17 +121,18 @@ public class DashboardsView extends LocatableVLayout implements
BookmarkableView
protected void onInit() {
super.onInit();
- dashboardService.findDashboardsForSubject(new
AsyncCallback<List<Dashboard>>() {
+ DashboardCriteria criteria = new DashboardCriteria();
+ dashboardService.findDashboardsByCriteria(criteria, new
AsyncCallback<PageList<Dashboard>>() {
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError(MSG.view_dashboardsManager_error1(), caught);
}
- public void onSuccess(final List<Dashboard> result) {
+ public void onSuccess(final PageList<Dashboard> result) {
// now, a second async call to load global perms
new PermissionsLoader().loadExplicitGlobalPermissions(new
PermissionsLoadedListener() {
public void onPermissionsLoaded(Set<Permission> permissions) {
- globalPermissions = permissions;
+ globalPermissions = new HashSet<Permission>(permissions);
if (result.isEmpty()) {
// if the user has no dashboards persist a default dashboard
for him to work with. In
@@ -292,8 +298,10 @@ public class DashboardsView extends LocatableVLayout implements
BookmarkableView
Dashboard dashboard = new Dashboard();
dashboard.setName(MSG.common_title_default());
+ dashboard.setCategory(DashboardCategory.INVENTORY);
dashboard.setColumns(2);
- dashboard.setColumnWidths("32%", "68%");
+ // only leftmost column width is currently settable, the rest are equally divided
+ dashboard.setColumnWidths("32%");
dashboard.getConfiguration().put(new PropertySimple(Dashboard.CFG_BACKGROUND,
"#F1F2F3"));
// Left Column
@@ -355,10 +363,11 @@ public class DashboardsView extends LocatableVLayout implements
BookmarkableView
}
Dashboard dashboard = new Dashboard();
+ dashboard.setCategory(DashboardCategory.INVENTORY);
dashboard.setName(availableDashboardName);
-
dashboard.setColumns(2);
- dashboard.setColumnWidths("30%", "70%");
+ // only leftmost column width is currently settable, the rest are equally
divided
+ dashboard.setColumnWidths("32%");
dashboardService.storeDashboard(dashboard, new AsyncCallback<Dashboard>()
{
public void onFailure(Throwable caught) {
@@ -385,13 +394,6 @@ public class DashboardsView extends LocatableVLayout implements
BookmarkableView
});
}
- public void updateNames() {
- for (Tab t : tabSet.getTabs()) {
- DashboardView view = (DashboardView) t.getPane();
- t.setTitle(view.getDashboard().getName());
- }
- }
-
public void renderView(ViewPath viewPath) {
// make sure we have at least a default dashboard tab
if (null == tabSet || 0 == tabSet.getTabs().length) {
@@ -428,8 +430,19 @@ public class DashboardsView extends LocatableVLayout implements
BookmarkableView
return initialized;
}
- public Set<Permission> getGlobalPermissions() {
+ public HashSet<Permission> getGlobalPermissions() {
return globalPermissions;
}
+ public boolean supportsDashboardNameEdit() {
+ return true;
+ }
+
+ public void updateDashboardNames() {
+ for (Tab t : tabSet.getTabs()) {
+ DashboardView view = (DashboardView) t.getPane();
+ t.setTitle(view.getDashboard().getName());
+ }
+ }
+
}
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 87c3328..9a8b0dd 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
@@ -22,6 +22,8 @@
*/
package org.rhq.enterprise.gui.coregui.client.dashboard;
+import java.util.Arrays;
+
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.util.EventHandler;
import com.smartgwt.client.widgets.Canvas;
@@ -30,28 +32,43 @@ import com.smartgwt.client.widgets.events.DropHandler;
import org.rhq.core.domain.dashboard.Dashboard;
import org.rhq.core.domain.dashboard.DashboardPortlet;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
/**
* @author Greg Hinkle
+ * @author Jay Shaughnessy
*/
public class PortalLayout extends LocatableHLayout {
private DashboardView dashboardView;
- public PortalLayout(String locatorId, DashboardView dashboardView, int numColumns) {
+ /**
+ * @param locatorId
+ * @param dashboardView
+ * @param numColumns
+ * @param columnWidths Currently only the first column width is set, others are
ignored and share the remaining space
+ * evenly. If null column 0 defaults to 30%.
+ */
+ public PortalLayout(String locatorId, DashboardView dashboardView, int numColumns,
String[] columnWidths) {
super(locatorId);
- this.dashboardView = dashboardView;
+ CoreGUI.getMessageCenter().notify(
+ new Message("------->> PortalLayout(numColumns=" + numColumns
+ ",columnWidths="
+ + Arrays.toString(columnWidths) + ")")); // TODO
+ this.dashboardView = dashboardView;
+ setMargin(5);
setMembersMargin(6);
for (int i = 0; i < numColumns; i++) {
final PortalColumn column = new PortalColumn();
- if (i == 0) {
+ if (null != columnWidths && i < columnWidths.length) {
+ column.setWidth(columnWidths[i]);
+ } else if (i == 0) {
column.setWidth("30%");
}
- addMember(column);
final int columnNumber = i;
column.addDropHandler(new DropHandler() {
@@ -85,13 +102,13 @@ public class PortalLayout extends LocatableHLayout {
}
// drop means the portlet location has changed. The selenium testing
locators include positioning
- // info. So, in this case we have to take the hit and completely
redraw the dash.
+ // info. So, in this case we have to take the hit and completely
rebuild the dash.
AsyncCallback<Dashboard> callback =
SeleniumUtility.getUseDefaultIds() ? null
: new AsyncCallback<Dashboard>() {
@Override
public void onFailure(Throwable caught) {
- redraw();
+ rebuild();
}
@Override
@@ -103,7 +120,7 @@ public class PortalLayout extends LocatableHLayout {
target.removeFromParent();
target.destroy();
- redraw();
+ rebuild();
}
};
save(callback);
@@ -111,6 +128,9 @@ public class PortalLayout extends LocatableHLayout {
com.allen_sauer.gwt.log.client.Log.info("Rearranged column
indexes");
}
});
+
+ CoreGUI.getMessageCenter().notify(new Message("------->>
PortalLayout() adding column " + i)); // TODO
+ addMember(column);
}
}
@@ -130,8 +150,8 @@ public class PortalLayout extends LocatableHLayout {
this.dashboardView.save(callback);
}
- public void redraw() {
- this.dashboardView.redraw();
+ public void rebuild() {
+ this.dashboardView.rebuild();
}
public void resize() {
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 664b234..0f76e5b 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,6 +45,7 @@ import
org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWindow;
/**
* @author Greg Hinkle
+ * @author Jay Shaughnessy
*/
public class PortletWindow extends LocatableWindow {
@@ -121,17 +122,18 @@ public class PortletWindow extends LocatableWindow {
extendLocatorId("Settings"), HeaderControl.SETTINGS,
settingsHandler), new LocatableHeaderControl(
extendLocatorId("Help"), HeaderControl.HELP, helpHandler),
HeaderControls.CLOSE_BUTTON);
- // show either a shadow, or translucency, when dragging a portlet
- // (could do both at the same time, but these are not visually compatible
effects)
- // setShowDragShadow(true);
- setDragOpacity(30);
-
// enable predefined component animation
setAnimateMinimize(true);
// Window is draggable with "outline" appearance by default.
// "target" is the solid appearance.
+ setCanDrag(true);
setDragAppearance(DragAppearance.TARGET);
+ // show either a shadow, or translucency, when dragging a portlet
+ // (could do both at the same time, but these are not visually compatible
effects)
+ // setShowDragShadow(true);
+ setDragOpacity(30);
+ // can be dropped on a column
setCanDrop(true);
setCanDragResize(true);
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/DashboardGWTService.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/DashboardGWTService.java
index f56b97a..5d5efff 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/DashboardGWTService.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/DashboardGWTService.java
@@ -22,23 +22,20 @@
*/
package org.rhq.enterprise.gui.coregui.client.gwt;
-import java.util.List;
-
import com.google.gwt.user.client.rpc.RemoteService;
+import org.rhq.core.domain.criteria.DashboardCriteria;
import org.rhq.core.domain.dashboard.Dashboard;
+import org.rhq.core.domain.util.PageList;
/**
- * @author Greg Hinkle
+ * @author Jay Shaughnessy
*/
public interface DashboardGWTService extends RemoteService {
- List<Dashboard> findDashboardsForSubject() throws RuntimeException;
-
- List<Dashboard> findSharedDashboards() throws RuntimeException;
+ PageList<Dashboard> findDashboardsByCriteria(DashboardCriteria criteria) throws
RuntimeException;
Dashboard storeDashboard(Dashboard dashboard) throws RuntimeException;
void removeDashboard(int dashboardId) throws RuntimeException;
-
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupContextMenu.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupContextMenu.java
index 29c6590..65d4c88 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupContextMenu.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupContextMenu.java
@@ -23,7 +23,6 @@
package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail;
import java.util.EnumSet;
-import java.util.List;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.menu.Menu;
@@ -33,6 +32,7 @@ import com.smartgwt.client.widgets.menu.events.ClickHandler;
import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent;
import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.criteria.DashboardCriteria;
import org.rhq.core.domain.criteria.ResourceGroupCriteria;
import org.rhq.core.domain.dashboard.Dashboard;
import org.rhq.core.domain.dashboard.DashboardPortlet;
@@ -265,65 +265,68 @@ public class ResourceGroupContextMenu extends LocatableMenu {
MenuItem measurements = new
MenuItem(MSG.view_tree_common_contextMenu_measurements());
final Menu measurementsSubMenu = new Menu();
- GWTServiceLookup.getDashboardService().findDashboardsForSubject(new
AsyncCallback<List<Dashboard>>() {
- public void onFailure(Throwable caught) {
-
CoreGUI.getErrorHandler().handleError(MSG.view_tree_common_contextMenu_loadFail_dashboards(),
caught);
- }
+ DashboardCriteria criteria = new DashboardCriteria();
+ GWTServiceLookup.getDashboardService().findDashboardsByCriteria(criteria,
+ new AsyncCallback<PageList<Dashboard>>() {
+ public void onFailure(Throwable caught) {
+
CoreGUI.getErrorHandler().handleError(MSG.view_tree_common_contextMenu_loadFail_dashboards(),
+ caught);
+ }
- public void onSuccess(List<Dashboard> result) {
-
- if (type.getMetricDefinitions() != null) {
- for (final MeasurementDefinition def : type.getMetricDefinitions())
{
-
- MenuItem defItem = new MenuItem(def.getDisplayName());
- measurementsSubMenu.addItem(defItem);
- Menu defSubItem = new Menu();
- defItem.setSubmenu(defSubItem);
-
- for (final Dashboard d : result) {
- MenuItem addToDBItem = new
MenuItem(MSG.view_tree_common_contextMenu_addChartToDashboard(d
- .getName()));
- defSubItem.addItem(addToDBItem);
-
- addToDBItem.addClickHandler(new ClickHandler() {
- public void onClick(MenuItemClickEvent
menuItemClickEvent) {
-
- DashboardPortlet p = new
DashboardPortlet(def.getDisplayName() + " "
- + MSG.view_tree_common_contextMenu_chart(),
GraphPortlet.KEY, 250);
- p.getConfiguration().put(
- new
PropertySimple(GraphPortlet.CFG_RESOURCE_GROUP_ID, group.getId()));
- p.getConfiguration().put(
- new
PropertySimple(GraphPortlet.CFG_DEFINITION_ID, def.getId()));
-
- d.addPortlet(p);
-
-
GWTServiceLookup.getDashboardService().storeDashboard(d,
- new AsyncCallback<Dashboard>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(
-
MSG.view_tree_common_contextMenu_saveChartToDashboardFailure(),
- caught);
- }
-
- public void onSuccess(Dashboard result) {
- String msg = MSG
-
.view_tree_common_contextMenu_saveChartToDashboardSuccessful(result
- .getName());
- CoreGUI.getMessageCenter().notify(
- new Message(msg,
Message.Severity.Info));
- }
- });
-
- }
- });
+ public void onSuccess(PageList<Dashboard> result) {
- }
+ if (type.getMetricDefinitions() != null) {
+ for (final MeasurementDefinition def :
type.getMetricDefinitions()) {
+
+ MenuItem defItem = new MenuItem(def.getDisplayName());
+ measurementsSubMenu.addItem(defItem);
+ Menu defSubItem = new Menu();
+ defItem.setSubmenu(defSubItem);
+
+ for (final Dashboard d : result) {
+ MenuItem addToDBItem = new MenuItem(MSG
+
.view_tree_common_contextMenu_addChartToDashboard(d.getName()));
+ defSubItem.addItem(addToDBItem);
+
+ addToDBItem.addClickHandler(new ClickHandler() {
+ public void onClick(MenuItemClickEvent
menuItemClickEvent) {
+
+ DashboardPortlet p = new
DashboardPortlet(def.getDisplayName() + " "
+ + MSG.view_tree_common_contextMenu_chart(),
GraphPortlet.KEY, 250);
+ p.getConfiguration().put(
+ new
PropertySimple(GraphPortlet.CFG_RESOURCE_GROUP_ID, group.getId()));
+ p.getConfiguration().put(
+ new
PropertySimple(GraphPortlet.CFG_DEFINITION_ID, def.getId()));
+
+ d.addPortlet(p);
+
GWTServiceLookup.getDashboardService().storeDashboard(d,
+ new AsyncCallback<Dashboard>() {
+ public void onFailure(Throwable caught)
{
+
CoreGUI.getErrorHandler().handleError(
+
MSG.view_tree_common_contextMenu_saveChartToDashboardFailure(),
+ caught);
+ }
+
+ public void onSuccess(Dashboard result)
{
+ String msg = MSG
+
.view_tree_common_contextMenu_saveChartToDashboardSuccessful(result
+ .getName());
+ CoreGUI.getMessageCenter().notify(
+ new Message(msg,
Message.Severity.Info));
+ }
+ });
+
+ }
+ });
+
+ }
+
+ }
}
- }
- }
- });
+ }
+ });
measurements.setSubmenu(measurementsSubMenu);
return measurements;
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
index b42297b..89079ac 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
@@ -469,7 +469,7 @@ public class ResourceGroupDetailView extends
AbstractTwoLevelTabSetView<Resource
if ("AutoCluster".equals(viewPath.getCurrent().getPath())) {
super.renderView(viewPath.next());
} else {
- // we are traversing to to the Members subtab. Assume this is happening after
a save
+ // if we are traversing to the Members subtab assume this is happening after
a save,
// which means the group type and membership may have changed - get it so we
refresh everything.
if ((null != this.groupId) &&
this.inventoryTab.getName().equals(currentTabName)
&& this.inventoryMembers.getName().equals(currentSubTabName)) {
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java
index 8b34662..a240e45 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java
@@ -18,22 +18,69 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.summary;
-import com.smartgwt.client.widgets.Label;
+import java.util.Set;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.util.BooleanCallback;
+import com.smartgwt.client.util.SC;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.IButton;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.authz.Permission;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.criteria.DashboardCriteria;
+import org.rhq.core.domain.dashboard.Dashboard;
+import org.rhq.core.domain.dashboard.DashboardCategory;
+import org.rhq.core.domain.dashboard.DashboardPortlet;
+import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
-import org.rhq.enterprise.gui.coregui.client.RefreshableView;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.InitializableView;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoadedListener;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoader;
+import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
+import org.rhq.enterprise.gui.coregui.client.dashboard.DashboardContainer;
+import org.rhq.enterprise.gui.coregui.client.dashboard.DashboardView;
+import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.util.MessagePortlet;
+import org.rhq.enterprise.gui.coregui.client.gwt.DashboardGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+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.LocatableIButton;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableToolStrip;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
- * The content pane for the group Summary>Activity subtab.
+ * The content pane for the group Summary>Dashboard subtab.
*
- * @author Ian Springer
+ * @author Jay Shaughnessy
*/
-// TODO: Implement this.
-public class ActivityView extends LocatableVLayout implements RefreshableView {
+
+public class ActivityView extends LocatableVLayout implements DashboardContainer,
InitializableView {
+
+ private static final String DASHBOARD_NAME_PREFIX = "GroupDashboard_";
private ResourceGroupComposite groupComposite;
+ private DashboardGWTServiceAsync dashboardService =
GWTServiceLookup.getDashboardService();
+
+ private DashboardView dashboardView;
+
+ private LocatableToolStrip footer;
+ private IButton editButton;
+ private IButton resetButton;
+
+ // Capture the user's global permissions for use by any dashboard or portlet that
may need it for rendering.
+ private Set<Permission> globalPermissions;
+
+ private boolean editMode = false;
+
+ private boolean isInitialized = false;
+
public ActivityView(String locatorId, ResourceGroupComposite groupComposite) {
super(locatorId);
this.groupComposite = groupComposite;
@@ -41,15 +88,206 @@ public class ActivityView extends LocatableVLayout implements
RefreshableView {
@Override
protected void onInit() {
- super.onInit();
+ if (!isInitialized()) {
+ CoreGUI.getMessageCenter().notify(new Message("------->>
ActivityView.oninit()", Severity.Info)); // TODO
+
+ super.onInit();
+
+ // first async call to get global permissions
+ new PermissionsLoader().loadExplicitGlobalPermissions(new
PermissionsLoadedListener() {
+
+ public void onPermissionsLoaded(Set<Permission> permissions) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("------->> ActivityView.oninit(
gotGlobalPerms )", Severity.Info)); // TODO
+
+ globalPermissions = permissions;
+
+ // now make async call to look for customized dash for this user and
entity
+ DashboardCriteria criteria = new DashboardCriteria();
+ criteria.addFilterCategory(DashboardCategory.GROUP);
+
criteria.addFilterGroupId(groupComposite.getResourceGroup().getId());
+ dashboardService.findDashboardsByCriteria(criteria, new
AsyncCallback<PageList<Dashboard>>() {
+ public void onFailure(Throwable caught) {
+
CoreGUI.getErrorHandler().handleError(MSG.view_dashboardsManager_error1(), caught);
+ }
+
+ public void onSuccess(final PageList<Dashboard> result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("------->> ActivityView.oninit(
gotCriteriaResult )", Severity.Info)); // TODO
- Label label = new Label("<h3>Coming soon...</h3>");
- addMember(label);
+ Dashboard dashboard = result.isEmpty() ?
getDefaultDashboard() : result.get(0);
+ setDashboard(dashboard);
+
+ isInitialized = true;
+
+ // draw() may be done since onInit finishes asynchronously,
if so redraw
+ if (isDrawn()) {
+ markForRedraw();
+ }
+ }
+ });
+ }
+ });
+ }
+ }
+
+ @Override
+ public void draw() {
+ CoreGUI.getMessageCenter().notify(new Message("------->>
ActivityView.draw()", Severity.Info)); // TODO
+ super.draw();
+ }
+
+ @Override
+ public void redraw() {
+ CoreGUI.getMessageCenter().notify(new Message("------->>
ActivityView.redraw()", Severity.Info)); // TODO
+ super.redraw();
}
@Override
- public void refresh() {
- // TODO: Reload the data.
+ protected void onDraw() {
+ CoreGUI.getMessageCenter().notify(new Message("------->>
ActivityView.onDraw()", Severity.Info)); // TODO
+ super.onDraw();
+
+ /*
+ * If we really had something to do here we'd want to wait until the async
initialization was really over.
+ *
+ new Timer() {
+ final long startTime = System.currentTimeMillis();
+
+ public void run() {
+ if (isInitialized) {
+ CoreGUI.getMessageCenter().notify(new
Message("------->> ActivityView.onDraw( 1 )", Severity.Info)); // TODO
+
+ ActivityView.super.onDraw();
+ if (!dashboardView.isDrawn()) {
+ dashboardView.draw();
+ }
+ if (!dashboardView.isVisible()) {
+ dashboardView.show();
+ }
+ markForRedraw();
+ dashboardView.markForRedraw();
+
+ } else {
+ long elapsedMillis = System.currentTimeMillis() - startTime;
+ if (elapsedMillis < 10000) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("------->>
ActivityView.onDraw( 2 )", Severity.Info)); // TODO
+ schedule(100); // Reschedule the timer.
+ } else {
+ // give up and just do the draw()
+ CoreGUI.getMessageCenter().notify(
+ new Message("------->>
ActivityView.onDraw( 3 )", Severity.Info)); // TODO
+ ActivityView.super.onDraw();
+
+ }
+ }
+ }
+ }.run(); // fire the timer immediately
+ */
+ }
+
+ private void setDashboard(Dashboard dashboard) {
+ CoreGUI.getMessageCenter().notify(new Message("------->>
ActivityView.setDashboard()", Severity.Info)); // TODO
+
+ Canvas[] members = getMembers();
+ removeMembers(members);
+
+ dashboardView = new DashboardView(extendLocatorId(dashboard.getName()), this,
dashboard);
+ addMember(dashboardView);
+
+ footer = new LocatableToolStrip(extendLocatorId("Footer"));
+ footer.setPadding(5);
+ footer.setWidth100();
+ footer.setMembersMargin(15);
+
+ editButton = new LocatableIButton(footer.extendLocatorId("Mode"),
editMode ? MSG.common_title_view_mode() : MSG
+ .common_title_edit_mode());
+ editButton.setAutoFit(true);
+ editButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ editMode = !editMode;
+ editButton.setTitle(editMode ? MSG.common_title_view_mode() :
MSG.common_title_edit_mode());
+ dashboardView.setEditMode(editMode);
+ }
+ });
+
+ resetButton = new LocatableIButton(footer.extendLocatorId("Reset"),
MSG.common_button_reset());
+ resetButton.setAutoFit(true);
+ resetButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ String message = MSG.view_summaryDashboard_resetConfirm();
+
+ SC.ask(message, new BooleanCallback() {
+ public void execute(Boolean confirmed) {
+ if (confirmed) {
+ dashboardView.delete();
+ setDashboard(getDefaultDashboard());
+ markForRedraw();
+ }
+ }
+ });
+ }
+ });
+
+ footer.addMember(editButton);
+ footer.addMember(resetButton);
+
+ addMember(footer);
+ }
+
+ protected Dashboard getDefaultDashboard() {
+ CoreGUI.getMessageCenter().notify(new Message("------->>
ActivityView.getDefaultDashboard", Severity.Info)); // TODO
+
+ Subject sessionSubject = UserSessionManager.getSessionSubject();
+ ResourceGroup group = groupComposite.getResourceGroup();
+
+ Dashboard dashboard = new Dashboard();
+
+ //dashboard.getConfiguration().setProperties(new ArrayList<Property>()); //
replace the LinkedHashMap...
+
+ dashboard.setName(DASHBOARD_NAME_PREFIX + sessionSubject.getId() + "_"
+ group.getId());
+ dashboard.setCategory(DashboardCategory.GROUP);
+ dashboard.setGroup(group);
+ dashboard.setColumns(2);
+
+ // TODO, add real portlets
+ // set leftmost column and letthe rest be equally divided
+ dashboard.setColumnWidths("40%");
+ dashboard.getConfiguration().put(new PropertySimple(Dashboard.CFG_BACKGROUND,
"#F1F2F3"));
+
+ // Left Column
+ DashboardPortlet dummyLeft = new DashboardPortlet(MessagePortlet.NAME,
MessagePortlet.KEY, 220);
+ dummyLeft.getConfiguration().put(new PropertySimple("message",
"<br/>Coming Soon... :-)"));
+ dashboard.addPortlet(dummyLeft, 0, 0);
+
+ // right Column
+ DashboardPortlet dummyRight = new DashboardPortlet(MessagePortlet.NAME,
MessagePortlet.KEY, 220);
+ dummyRight.getConfiguration().put(new PropertySimple("message",
"<br/>Coming Soon... :-)"));
+ dashboard.addPortlet(dummyRight, 1, 0);
+
+ return dashboard;
+ }
+
+ @Override
+ public boolean isInitialized() {
+ return isInitialized;
+ }
+
+ public Set<Permission> getGlobalPermissions() {
+ return globalPermissions;
+ }
+
+ /**
+ * name update not supported because the name is derived from the entity id.
+ * @return
+ */
+ public boolean supportsDashboardNameEdit() {
+ return false;
+ }
+
+ public void updateDashboardNames() {
+ return;
}
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
index 24ccac1..98e5755 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
@@ -51,6 +51,7 @@ import com.smartgwt.client.widgets.tree.events.NodeContextClickEvent;
import com.smartgwt.client.widgets.tree.events.NodeContextClickHandler;
import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.criteria.DashboardCriteria;
import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.criteria.ResourceGroupCriteria;
import org.rhq.core.domain.criteria.ResourceTypeCriteria;
@@ -522,60 +523,67 @@ public class ResourceTreeView extends LocatableVLayout {
MenuItem measurements = new
MenuItem(MSG.view_tree_common_contextMenu_measurements());
final Menu measurementsSubMenu = new Menu();
- GWTServiceLookup.getDashboardService().findDashboardsForSubject(new
AsyncCallback<List<Dashboard>>() {
- public void onFailure(Throwable caught) {
-
CoreGUI.getErrorHandler().handleError(MSG.view_tree_common_contextMenu_loadFailed_dashboard(),
caught);
- }
+ DashboardCriteria criteria = new DashboardCriteria();
+ GWTServiceLookup.getDashboardService().findDashboardsByCriteria(criteria,
+ new AsyncCallback<PageList<Dashboard>>() {
+ public void onFailure(Throwable caught) {
+
CoreGUI.getErrorHandler().handleError(MSG.view_tree_common_contextMenu_loadFailed_dashboard(),
+ caught);
+ }
- public void onSuccess(List<Dashboard> result) {
-
- for (final MeasurementDefinition def : type.getMetricDefinitions()) {
-
- MenuItem defItem = new MenuItem(def.getDisplayName());
- measurementsSubMenu.addItem(defItem);
- Menu defSubItem = new Menu();
- defItem.setSubmenu(defSubItem);
-
- for (final Dashboard d : result) {
- MenuItem addToDBItem = new
MenuItem(MSG.view_tree_common_contextMenu_addChartToDashboard(d
- .getName()));
- defSubItem.addItem(addToDBItem);
-
- addToDBItem.addClickHandler(new ClickHandler() {
- public void onClick(MenuItemClickEvent menuItemClickEvent) {
- DashboardPortlet p = new
DashboardPortlet(def.getDisplayName() + " Chart",
- GraphPortlet.KEY, 250);
- p.getConfiguration().put(
- new PropertySimple(GraphPortlet.CFG_RESOURCE_ID,
resource.getId()));
- p.getConfiguration().put(
- new PropertySimple(GraphPortlet.CFG_DEFINITION_ID,
def.getId()));
-
- d.addPortlet(p);
-
- GWTServiceLookup.getDashboardService().storeDashboard(d,
- new AsyncCallback<Dashboard>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(
-
MSG.view_tree_common_contextMenu_saveChartToDashboardFailure(), caught);
- }
-
- public void onSuccess(Dashboard result) {
- CoreGUI.getMessageCenter().notify(
- new Message(MSG
-
.view_tree_common_contextMenu_saveChartToDashboardSuccessful(result
- .getName()),
Message.Severity.Info));
- }
- });
+ public void onSuccess(PageList<Dashboard> result) {
+
+ for (final MeasurementDefinition def : type.getMetricDefinitions())
{
+
+ MenuItem defItem = new MenuItem(def.getDisplayName());
+ measurementsSubMenu.addItem(defItem);
+ Menu defSubItem = new Menu();
+ defItem.setSubmenu(defSubItem);
+
+ for (final Dashboard d : result) {
+ MenuItem addToDBItem = new
MenuItem(MSG.view_tree_common_contextMenu_addChartToDashboard(d
+ .getName()));
+ defSubItem.addItem(addToDBItem);
+
+ addToDBItem.addClickHandler(new ClickHandler() {
+ public void onClick(MenuItemClickEvent
menuItemClickEvent) {
+ DashboardPortlet p = new
DashboardPortlet(def.getDisplayName() + " Chart",
+ GraphPortlet.KEY, 250);
+ p.getConfiguration().put(
+ new PropertySimple(GraphPortlet.CFG_RESOURCE_ID,
resource.getId()));
+ p.getConfiguration().put(
+ new
PropertySimple(GraphPortlet.CFG_DEFINITION_ID, def.getId()));
+
+ d.addPortlet(p);
+
+
GWTServiceLookup.getDashboardService().storeDashboard(d,
+ new AsyncCallback<Dashboard>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+
MSG.view_tree_common_contextMenu_saveChartToDashboardFailure(),
+ caught);
+ }
+
+ public void onSuccess(Dashboard result) {
+ CoreGUI
+ .getMessageCenter()
+ .notify(
+ new Message(
+ MSG
+
.view_tree_common_contextMenu_saveChartToDashboardSuccessful(result
+ .getName()),
Message.Severity.Info));
+ }
+ });
- }
- });
+ }
+ });
+
+ }
}
}
-
- }
- });
+ });
measurements.setSubmenu(measurementsSubMenu);
return measurements;
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/DashboardGWTServiceImpl.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/DashboardGWTServiceImpl.java
index c45ca10..3aa0910 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/DashboardGWTServiceImpl.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/DashboardGWTServiceImpl.java
@@ -22,9 +22,9 @@
*/
package org.rhq.enterprise.gui.coregui.server.gwt;
-import java.util.List;
-
+import org.rhq.core.domain.criteria.DashboardCriteria;
import org.rhq.core.domain.dashboard.Dashboard;
+import org.rhq.core.domain.util.PageList;
import org.rhq.core.util.exception.ThrowableUtil;
import org.rhq.enterprise.gui.coregui.client.gwt.DashboardGWTService;
import org.rhq.enterprise.gui.coregui.server.util.SerialUtility;
@@ -40,19 +40,10 @@ public class DashboardGWTServiceImpl extends AbstractGWTServiceImpl
implements D
private DashboardManagerLocal dashboardManager =
LookupUtil.getDashboardManagerLocal();
- public List<Dashboard> findDashboardsForSubject() throws RuntimeException {
- try {
- return
SerialUtility.prepare(dashboardManager.findDashboardsForSubject(getSessionSubject()),
- "DashboardManager.findDashboardsForSubject");
- } catch (Throwable t) {
- throw new RuntimeException(ThrowableUtil.getAllMessages(t));
- }
- }
-
- public List<Dashboard> findSharedDashboards() throws RuntimeException {
+ public PageList<Dashboard> findDashboardsByCriteria(DashboardCriteria criteria)
throws RuntimeException {
try {
- return
SerialUtility.prepare(dashboardManager.findSharedDashboards(getSessionSubject()),
- "DashboardManager.findSharedDashboards");
+ return
SerialUtility.prepare(dashboardManager.findDashboardsByCriteria(getSessionSubject(),
criteria),
+ "DashboardManager.findDashboardsByCriteria");
} catch (Throwable t) {
throw new RuntimeException(ThrowableUtil.getAllMessages(t));
}
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 2d4f866..940b293 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
@@ -1859,6 +1859,10 @@ view_summaryOverviewForm_message_descriptionChangeSuccess =
Description of Resou
view_summaryOverviewForm_error_locationChangeFailure = Failed to change location of
Resource with id {0} from [{1}] to [{2}].
view_summaryOverviewForm_message_locationChangeSuccess = Location of Resource with id {0}
was changed from [{1}] to [{2}].
+# Summary Dashboard
+#-----------------------------
+view_summaryDashboard_resetConfirm = Reset to default summary dashboard (lose local
changes)?
+
# Group Inventory>Members subtab
#-----------------------------------------
view_groupInventoryMembers_button_updateMembership = Update Membership...
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/dashboard/DashboardManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/dashboard/DashboardManagerBean.java
index db4c6b6..c4a007e 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/dashboard/DashboardManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/dashboard/DashboardManagerBean.java
@@ -22,31 +22,33 @@
*/
package org.rhq.enterprise.server.dashboard;
-import java.util.List;
-
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
-import javax.persistence.Query;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Permission;
+import org.rhq.core.domain.criteria.DashboardCriteria;
import org.rhq.core.domain.dashboard.Dashboard;
+import org.rhq.core.domain.dashboard.DashboardCategory;
+import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.auth.SubjectManagerBean;
import org.rhq.enterprise.server.authz.AuthorizationManagerLocal;
import org.rhq.enterprise.server.authz.PermissionException;
+import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
+import org.rhq.enterprise.server.util.CriteriaQueryRunner;
/**
- *
+ * @author Jay Shaughnessy
* @author Greg Hinkle
*/
@Stateless
-public class DashboardManagerBean implements DashboardManagerLocal,
DashboardManagerRemote{
+public class DashboardManagerBean implements DashboardManagerLocal,
DashboardManagerRemote {
@SuppressWarnings("unused")
private final Log log = LogFactory.getLog(SubjectManagerBean.class);
@@ -57,20 +59,30 @@ public class DashboardManagerBean implements DashboardManagerLocal,
DashboardMan
@EJB
private AuthorizationManagerLocal authorizationManager;
+ public PageList<Dashboard> findDashboardsByCriteria(Subject subject,
DashboardCriteria criteria) {
+ if (criteria.isInventoryManagerRequired()) {
+ if (!authorizationManager.isInventoryManager(subject)) {
+ throw new PermissionException("Subject [" + subject.getName()
+ + "] requires InventoryManager permission for requested query
criteria.");
+ }
- public List<Dashboard> findDashboardsForSubject(Subject subject) {
- Query query = entityManager.createQuery("SELECT d FROM Dashboard d WHERE
d.owner.id = :subjectId");
-
- query.setParameter("subjectId", subject.getId());
-
- return query.getResultList();
+ Integer ownerId = criteria.getFilterOwnerId();
+ if (null != ownerId && 0 == ownerId.intValue()) {
+ criteria.addFilterOwnerId(null);
+ }
+ } else {
+ criteria.addFilterOwnerId(subject.getId());
+ }
- }
+ if (null == criteria.getFilterCategory()) {
+ criteria.addFilterCategory(DashboardCategory.INVENTORY);
+ }
- public List<Dashboard> findSharedDashboards(Subject subject) {
- Query query = entityManager.createQuery("SELECT d FROM Dashboard d WHERE
d.shared = true");
+ CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject,
criteria);
- return query.getResultList();
+ CriteriaQueryRunner<Dashboard> queryRunner = new
CriteriaQueryRunner<Dashboard>(criteria, generator,
+ entityManager);
+ return queryRunner.execute();
}
public Dashboard storeDashboard(Subject subject, Dashboard dashboard) {
@@ -80,7 +92,8 @@ public class DashboardManagerBean implements DashboardManagerLocal,
DashboardMan
entityManager.persist(dashboard);
return dashboard;
} else {
- if (!authorizationManager.hasGlobalPermission(subject,
Permission.MANAGE_SETTINGS) && d.getOwner().getId() != subject.getId()) {
+ if (!authorizationManager.hasGlobalPermission(subject,
Permission.MANAGE_SETTINGS)
+ && d.getOwner().getId() != subject.getId()) {
throw new PermissionException("You may only alter dashboards you
own.");
}
return entityManager.merge(dashboard);
@@ -89,9 +102,10 @@ public class DashboardManagerBean implements DashboardManagerLocal,
DashboardMan
public void removeDashboard(Subject subject, int dashboardId) {
- Dashboard toDelete = entityManager.find(Dashboard.class,dashboardId);
+ Dashboard toDelete = entityManager.find(Dashboard.class, dashboardId);
- if (!authorizationManager.hasGlobalPermission(subject,
Permission.MANAGE_SETTINGS) && toDelete.getOwner().getId() != subject.getId()) {
+ if (!authorizationManager.hasGlobalPermission(subject,
Permission.MANAGE_SETTINGS)
+ && toDelete.getOwner().getId() != subject.getId()) {
throw new PermissionException("You may only delete dashboards you
own.");
}
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/dashboard/DashboardManagerLocal.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/dashboard/DashboardManagerLocal.java
index c915e5b..9a03ecb 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/dashboard/DashboardManagerLocal.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/dashboard/DashboardManagerLocal.java
@@ -25,7 +25,7 @@ package org.rhq.enterprise.server.dashboard;
import javax.ejb.Local;
/**
- * @author Greg Hinkle
+ * @author Jay Shaughnessy
*/
@Local
public interface DashboardManagerLocal extends DashboardManagerRemote {
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/dashboard/DashboardManagerRemote.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/dashboard/DashboardManagerRemote.java
index c51a9a5..2e42293 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/dashboard/DashboardManagerRemote.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/dashboard/DashboardManagerRemote.java
@@ -22,29 +22,22 @@
*/
package org.rhq.enterprise.server.dashboard;
-import java.util.List;
-import java.util.Set;
-
import javax.ejb.Remote;
import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.criteria.DashboardCriteria;
import org.rhq.core.domain.dashboard.Dashboard;
+import org.rhq.core.domain.util.PageList;
/**
- * @author Greg Hinkle
+ * @author Jay Shaughnessy
*/
@Remote
public interface DashboardManagerRemote {
-
- public List<Dashboard> findDashboardsForSubject(Subject subject);
-
- public List<Dashboard> findSharedDashboards(Subject subject);
+ public PageList<Dashboard> findDashboardsByCriteria(Subject subject,
DashboardCriteria criteria);
public Dashboard storeDashboard(Subject subject, Dashboard dashboard);
public void removeDashboard(Subject subject, int dashboardId);
-
-
-
}