[rhq] modules/core
by Simeon Pinder
modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourceComposite.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit e34f00313d65d75fc5d7fb0e5f423be09942d259
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Fri Aug 13 19:35:28 2010 -0400
fix wsprovide failure in build.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourceComposite.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourceComposite.java
index 8b6f809..823a785 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourceComposite.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourceComposite.java
@@ -45,7 +45,7 @@ public class ResourceComposite implements Serializable {
@XmlElement
private Resource parent;
- @XmlElement
+ @XmlTransient
private ResourcePermission resourcePermission;
@XmlElement
13 years, 10 months
[rhq] modules/core modules/enterprise modules/plugins
by ips
modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java | 4
modules/core/domain/src/test/java/org/rhq/core/domain/configuration/test/DataSourceExample.java | 2
modules/enterprise/gui/coregui/pom.xml | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EnhancedDynamicForm.java | 36 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/TogglableTextItem.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java | 12
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/OverviewView.java | 241 -------
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/OverviewView.java | 241 +++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java | 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java | 160 +++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java | 160 -----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/overview/ResourceOverviewView.java | 61 --
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/overview/ResourceSummaryView.java | 289 ---------
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/DashboardView.java | 52 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewView.java | 302 ++++++++++
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/common/tag/FunctionTagLibrary.java | 2
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/DisambiguatedResourceLineageRenderer.java | 2
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/ResourceLineageRenderer.java | 2
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/taglib/InventoryHierarchyTag.java | 2
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/taglib/display/DisambiguatedResourceNameTag.java | 2
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/group/ResourceGroupTreeContextMenuUIBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/perspective/PerspectiveTarget.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java | 4
modules/plugins/cron/src/main/java/org/rhq/plugins/cron/CronComponent.java | 2
modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/serviceBinding/SetComponent.java | 2
27 files changed, 816 insertions(+), 785 deletions(-)
New commits:
commit 2d5cada01618a79e2819b7dbfeb763bc32a1620d
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Aug 13 18:56:30 2010 -0400
change how togglable form items are rendered (edit icon now only appears when you hover over the item); add missing updateResource() method to WebServicesManagerBean; move group Overview subtab from Inventory tab to Summary tab; rename some classes to make resource and group View classnames more consistent witheach other
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 9a8ff9d..d9ca343 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
@@ -74,7 +74,7 @@ import org.rhq.core.domain.tagging.Tag;
@NamedQuery(name = ResourceGroup.QUERY_FIND_ALL_FILTERED_COUNT, query = "SELECT count(DISTINCT g) "
+ "FROM ResourceGroup g JOIN g.roles r JOIN r.subjects s " //
+ "LEFT JOIN g.resourceType type " //
- + "LEFT JOIN g.implicitResources res " // used for inventory>overview "member in groups" section, authz-related
+ + "LEFT JOIN g.implicitResources res " // used for inventory>summary "member in groups" section, authz-related
+ "WHERE s = :subject " //
+ " AND g.visible = true "
+ " AND ( res.id = :resourceId OR :resourceId is null ) "
@@ -89,7 +89,7 @@ import org.rhq.core.domain.tagging.Tag;
+ " AND (type.category = :category OR :category is null) ) ) "),
@NamedQuery(name = ResourceGroup.QUERY_FIND_ALL_FILTERED_COUNT_ADMIN, query = "SELECT count(DISTINCT g) FROM ResourceGroup g "
+ "LEFT JOIN g.resourceType type "
- + "LEFT JOIN g.implicitResources res " // used for inventory>overview "member in groups" section, authz-related
+ + "LEFT JOIN g.implicitResources res " // used for inventory>summary "member in groups" section, authz-related
+ "WHERE ( g.groupCategory = :groupCategory OR :groupCategory is null ) "
+ " AND g.visible = true "
+ " AND ( res.id = :resourceId OR :resourceId is null ) "
diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/test/DataSourceExample.java b/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/test/DataSourceExample.java
index a9ca740..2f270a4 100644
--- a/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/test/DataSourceExample.java
+++ b/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/test/DataSourceExample.java
@@ -30,7 +30,7 @@ import org.rhq.core.domain.configuration.PropertySimple;
public class DataSourceExample {
/* This class exercises the Configuration domain model from a number of different actors and goals.
- * The following overview describes the different use cases of the domain model:
+ * The following summary describes the different use cases of the domain model:
*
* 1. Plugin populating a value set to describe the resource's current state 2. Plugin reading a value set to write
* the changes to the resource 3. Plugin Container creating a definition 4. Server storing a value set to the
diff --git a/modules/enterprise/gui/coregui/pom.xml b/modules/enterprise/gui/coregui/pom.xml
index ce9dfca..37e1993 100644
--- a/modules/enterprise/gui/coregui/pom.xml
+++ b/modules/enterprise/gui/coregui/pom.xml
@@ -27,7 +27,7 @@
<!-- If this is too much memory to allocate to your gwt:debug process then override this property in
in your settings.xml -->
- <gwt-plugin.extraJvmArgs>-Xms512M -Xmx512M</gwt-plugin.extraJvmArgs>
+ <gwt-plugin.extraJvmArgs>-Xms512M -Xmx512M -XX:PermSize=128M -XX:MaxPermSize=256M</gwt-plugin.extraJvmArgs>
<gwt-plugin.localWorkers>2</gwt-plugin.localWorkers>
</properties>
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 7cd621b..aa6c084 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
@@ -51,7 +51,7 @@ import org.rhq.enterprise.gui.coregui.client.dashboard.DashboardsView;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.ResourceGroupTopView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.InventoryView;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceView;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceTopView;
import org.rhq.enterprise.gui.coregui.client.menu.MenuBarView;
import org.rhq.enterprise.gui.coregui.client.report.ReportTopView;
import org.rhq.enterprise.gui.coregui.client.report.tag.TaggedView;
@@ -264,7 +264,7 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
} else if (breadcrumbName.equals("Inventory")) {
canvas = new InventoryView();
} else if (breadcrumbName.equals("Resource")) {
- canvas = new ResourceView();
+ canvas = new ResourceTopView();
} else if (breadcrumbName.equals("ResourceGroup")) {
canvas = new ResourceGroupTopView();
} else if (breadcrumbName.equals("Dashboard")) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java
index fc93906..0375213 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java
@@ -35,7 +35,7 @@ public class LinkManager {
if (GWT) {
return "#Resource/" + resourceId;
} else {
- return "/rhq/resource/summary/overview.xhtml?id=" + resourceId;
+ return "/rhq/resource/summary/summary.xhtml?id=" + resourceId;
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EnhancedDynamicForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EnhancedDynamicForm.java
index 02185e7..0ae01ce 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EnhancedDynamicForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EnhancedDynamicForm.java
@@ -23,16 +23,18 @@
package org.rhq.enterprise.gui.coregui.client.components.form;
import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.user.client.Timer;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.FormItemIfFunction;
import com.smartgwt.client.widgets.form.fields.FormItem;
import com.smartgwt.client.widgets.form.fields.FormItemIcon;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
-import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.form.fields.events.BlurEvent;
import com.smartgwt.client.widgets.form.fields.events.BlurHandler;
import com.smartgwt.client.widgets.form.fields.events.IconClickEvent;
import com.smartgwt.client.widgets.form.fields.events.IconClickHandler;
+import com.smartgwt.client.widgets.form.fields.events.ItemHoverEvent;
+import com.smartgwt.client.widgets.form.fields.events.ItemHoverHandler;
import com.smartgwt.client.widgets.form.fields.events.KeyPressEvent;
import com.smartgwt.client.widgets.form.fields.events.KeyPressHandler;
@@ -40,7 +42,12 @@ import java.util.ArrayList;
import java.util.List;
/**
- * TODO
+ * A subclass of SmartGWT's DynamicForm widget that provides the following additional feature:
+ *
+ * If any {@link TogglableTextItem}s are added to the form, they will initially be rendered as static text items, except
+ * when the user hovers over one of them, an edit icon will be displayed immediately to the right of it for five seconds.
+ * If the user clicks this icon, the form item will become editable and the user can update its value. Once the user
+ * hits Enter or switches focus somewhere outside the form item, the form item will become static again.
*
* @author Ian Springer
*/
@@ -80,20 +87,33 @@ public class EnhancedDynamicForm extends DynamicForm {
editIcon.setName("Edit");
editIcon.setSrc("[SKIN]/actions/edit.png");
staticTextItem.setIcons(editIcon);
- staticTextItem.setShowIcons(true);
+ staticTextItem.setShowIcons(false);
+ staticTextItem.setShowIfCondition(new FormItemIfFunction() {
+ public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
+ boolean editing = staticTextItem.getAttributeAsBoolean("editing");
+ return !editing;
+ }
+ });
staticTextItem.addIconClickHandler(new IconClickHandler() {
public void onIconClick(IconClickEvent iconClickEvent) {
if ("Edit".equals(iconClickEvent.getIcon().getName())) {
staticTextItem.setAttribute("editing", true);
+ staticTextItem.setShowIcons(false);
markForRedraw();
}
}
});
- staticTextItem.setShowIfCondition(new FormItemIfFunction() {
- public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- boolean editing = staticTextItem.getAttributeAsBoolean("editing");
- return !editing;
+ staticTextItem.addItemHoverHandler(new ItemHoverHandler() {
+ public void onItemHover(ItemHoverEvent itemHoverEvent) {
+ staticTextItem.setShowIcons(true);
+ markForRedraw();
+ new Timer() {
+ public void run() {
+ staticTextItem.setShowIcons(false);
+ markForRedraw();
+ }
+ }.schedule(5000);
}
});
staticTextItem.addClickHandler(new com.smartgwt.client.widgets.form.fields.events.ClickHandler() {
@@ -126,7 +146,7 @@ public class EnhancedDynamicForm extends DynamicForm {
itemsList.add(togglableTextItem);
} else {
itemsList.add(item);
- }
+ }
}
super.setItems((FormItem[]) itemsList.toArray(new FormItem[itemsList.size()]));
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/TogglableTextItem.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/TogglableTextItem.java
index 399cb7e..9807b35 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/TogglableTextItem.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/TogglableTextItem.java
@@ -29,7 +29,8 @@ import java.util.ArrayList;
import java.util.List;
/**
- * TODO
+ * This class should only be used on conjunction with an {@link EnhancedDynamicForm}. See that class's Javadoc for
+ * all the details.
*
* @author Ian Springer
*/
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 8fff6e2..e6b208c 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
@@ -23,6 +23,7 @@ import java.util.Set;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.docs.Members;
import com.smartgwt.client.types.Side;
import com.smartgwt.client.widgets.layout.VLayout;
@@ -42,7 +43,7 @@ import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSelectedE
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSelectedHandler;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSet;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.inventory.OverviewView;
+import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.summary.OverviewView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSearchView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
@@ -93,7 +94,7 @@ public class ResourceGroupDetailView extends VLayout implements BookmarkableView
monitoringTab.registerSubTabs("Graphs", "Tables", "Schedules", "Call Time");
inventoryTab = new TwoLevelTab("Inventory", "/images/icons/Inventory_grey_16.png");
- inventoryTab.registerSubTabs("Overview", "Members", "Connection Settings");
+ inventoryTab.registerSubTabs("Members", "Connection Settings");
operationsTab = new TwoLevelTab("Operations", "/images/icons/Operation_grey_16.png");
operationsTab.registerSubTabs("History", "Scheduled");
@@ -126,11 +127,11 @@ public class ResourceGroupDetailView extends VLayout implements BookmarkableView
this.titleBar.setGroup(groupComposite.getResourceGroup());
- // TODO: Implement the rest of the tabs.
-
// FullHTMLPane timelinePane = new FullHTMLPane("/rhq/resource/summary/timeline-plain.xhtml?id=" + resource.getId());
- // summaryTab.updateSubTab("Overview", new ResourceOverviewView(resource));
+ // summaryTab.updateSubTab("Overview", new DashboardView(resource));
// summaryTab.updateSubTab("Timeline", timelinePane);
+ summaryTab.updateSubTab("Overview", new OverviewView(this.groupComposite));
+
int groupId = this.groupComposite.getResourceGroup().getId();
monitoringTab.updateSubTab("Graphs", new FullHTMLPane("/rhq/group/monitor/graphs-plain.xhtml?groupId="
@@ -142,7 +143,6 @@ public class ResourceGroupDetailView extends VLayout implements BookmarkableView
monitoringTab.updateSubTab("Call Time", new FullHTMLPane("/rhq/group/monitor/response-plain.xhtml?groupId="
+ groupId));
- inventoryTab.updateSubTab("Overview", new OverviewView(this.groupComposite));
inventoryTab.updateSubTab("Members", ResourceSearchView.getMembersOf(groupId));
// inventoryTab.updateSubTab("Connection Settings", new GroupPluginConfigurationEditView(this.group.getId(), this.group.getResourceType().getId(), ConfigurationEditor.ConfigType.plugin));
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/OverviewView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/OverviewView.java
deleted file mode 100644
index 01faa2d..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/OverviewView.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2010 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 as published by
- * the Free Software Foundation version 2 of the License.
- *
- * 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 for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.inventory;
-
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.types.Alignment;
-import com.smartgwt.client.widgets.HTMLFlow;
-import com.smartgwt.client.widgets.form.fields.FormItem;
-import com.smartgwt.client.widgets.form.fields.StaticTextItem;
-import com.smartgwt.client.widgets.layout.HLayout;
-import com.smartgwt.client.widgets.layout.VLayout;
-import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.domain.resource.group.GroupDefinition;
-import org.rhq.core.domain.resource.group.ResourceGroup;
-import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.components.form.EnhancedDynamicForm;
-import org.rhq.enterprise.gui.coregui.client.components.form.TogglableTextItem;
-import org.rhq.enterprise.gui.coregui.client.components.form.ValueUpdatedHandler;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGroupGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-/**
- * The group Inventory>Overview subtab.
- *
- * @author Ian Springer
- */
-public class OverviewView extends VLayout {
- private ResourceGroupGWTServiceAsync resourceGroupService = GWTServiceLookup.getResourceGroupService();
- private ResourceGroupComposite groupComposite;
-
- public OverviewView(ResourceGroupComposite groupComposite) {
- super();
- this.groupComposite = groupComposite;
- }
-
- @Override
- protected void onInit() {
- super.onInit();
-
- final ResourceGroup group = this.groupComposite.getResourceGroup();
-
- HLayout spacer = new HLayout();
- spacer.setHeight(15);
- addMember(spacer);
-
- final EnhancedDynamicForm generalPropsForm = new EnhancedDynamicForm();
-
- List<FormItem> formItems = new ArrayList<FormItem>();
-
- // TODO: Uncomment the below header if we decide to add other stuff to this page besides the general props.
- //HeaderItem headerItem = new HeaderItem("header", "General Properties");
- //headerItem.setValue("General Properties");
- //formItems.add(headerItem);
-
- boolean dynamic = (group.getGroupDefinition() != null);
-
- final FormItem nameItem = (dynamic) ? new StaticTextItem() : new TogglableTextItem();
- nameItem.setName("name");
- nameItem.setTitle("Name");
- nameItem.setValue(group.getName());
- if (nameItem instanceof TogglableTextItem) {
- final TogglableTextItem togglableNameItem = (TogglableTextItem) nameItem;
- togglableNameItem.addValueUpdatedHandler(new ValueUpdatedHandler() {
- public void onValueUpdated(final String newName) {
- final String oldName = group.getName();
- if (newName.equals(oldName)) {
- return;
- }
- group.setName(newName);
- OverviewView.this.resourceGroupService.updateResourceGroup(group, new AsyncCallback<Void>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to change name of Resource group with id "
- + group.getId()
- + " from \"" + oldName + "\" to \"" + newName + "\".", caught);
- // We failed to update it on the Server, so change back the ResourceGroup and the form item
- // to the original value.
- group.setName(oldName);
- nameItem.setValue(oldName);
- }
-
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(new Message("Name of Resource group with id "
- + group.getId() + " was changed from \""
- + oldName + "\" to \"" + newName + "\".", Message.Severity.Info));
- }
- });
- }
- });
- }
- formItems.add(nameItem);
-
- StaticTextItem typeItem = new StaticTextItem("memberType", "Member Type");
- ResourceType type = group.getResourceType();
- if (type != null) {
- typeItem.setTooltip("Plugin: " + type.getPlugin() + "\n<br>" + "Type: " + type.getName());
- typeItem.setValue(type.getName() + " (" + type.getPlugin() + ")");
- } else {
- typeItem.setValue("<i>Mixed</i>");
- }
- formItems.add(typeItem);
-
- StaticTextItem countItem = new StaticTextItem("memberCount", "Member Count");
- long memberCount = this.groupComposite.getImplicitUp() + this.groupComposite.getImplicitDown();
- countItem.setValue(memberCount);
- formItems.add(countItem);
-
- final FormItem descriptionItem = (dynamic) ? new StaticTextItem() : new TogglableTextItem();
- descriptionItem.setName("description");
- descriptionItem.setTitle("Description");
- descriptionItem.setValue(group.getDescription());
- if (descriptionItem instanceof TogglableTextItem) {
- final TogglableTextItem togglableDescriptionItem = (TogglableTextItem) descriptionItem;
- togglableDescriptionItem.addValueUpdatedHandler(new ValueUpdatedHandler() {
- public void onValueUpdated(final String newDescription) {
- final String oldDescription = group.getDescription();
- if (newDescription.equals(oldDescription)) {
- return;
- }
- group.setDescription(newDescription);
- OverviewView.this.resourceGroupService.updateResourceGroup(group, new AsyncCallback<Void>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to change description of Resource group with id "
- + group.getId()
- + " from \"" + oldDescription + "\" to \"" + newDescription + "\".", caught);
- // We failed to update it on the Server, so change back the ResourceGroup and the form item
- // to the original value.
- group.setDescription(oldDescription);
- descriptionItem.setValue(oldDescription);
- }
-
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(new Message("Description of Resource group with id "
- + group.getId() + " was changed from \""
- + oldDescription + "\" to \"" + newDescription + "\".", Message.Severity.Info));
- }
- });
- }
- });
- }
- formItems.add(descriptionItem);
-
- final FormItem locationItem = (dynamic) ? new StaticTextItem() : new TogglableTextItem();
- locationItem.setName("location");
- locationItem.setTitle("Location");
- locationItem.setValue(group.getLocation());
- if (locationItem instanceof TogglableTextItem) {
- final TogglableTextItem togglableLocationItem = (TogglableTextItem) locationItem;
- togglableLocationItem.addValueUpdatedHandler(new ValueUpdatedHandler() {
- public void onValueUpdated(final String newLocation) {
- final String oldLocation = group.getLocation();
- if (newLocation.equals(oldLocation)) {
- return;
- }
- group.setLocation(newLocation);
- OverviewView.this.resourceGroupService.updateResourceGroup(group, new AsyncCallback<Void>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to change location of Resource group with id "
- + group.getId()
- + " from \"" + oldLocation + "\" to \"" + newLocation + "\".", caught);
- // We failed to update it on the Server, so change back the ResourceGroup and the form item
- // to the original value.
- group.setLocation(oldLocation);
- locationItem.setValue(oldLocation);
- }
-
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(new Message("Location of Resource group with id "
- + group.getId() + " was changed from \""
- + oldLocation + "\" to \"" + newLocation + "\".", Message.Severity.Info));
- }
- });
- }
- });
- }
- formItems.add(locationItem);
-
- StaticTextItem dynamicItem = new StaticTextItem("dynamic", "Dynamic?");
- dynamicItem.setValue(dynamic ? "yes" : "no");
- formItems.add(dynamicItem);
-
- StaticTextItem recursiveItem = new StaticTextItem("recursive", "Recursive?");
- recursiveItem.setValue((group.isRecursive()) ? "yes" : "no");
- formItems.add(recursiveItem);
-
- StaticTextItem createdItem = new StaticTextItem("created", "Created");
- createdItem.setValue(new Date(group.getCtime()));
- formItems.add(createdItem);
-
- StaticTextItem lastModifiedItem = new StaticTextItem("lastModified", "Last Modified");
- lastModifiedItem.setValue(new Date(group.getMtime()));
- formItems.add(lastModifiedItem);
-
- StaticTextItem lastModifiedByItem = new StaticTextItem("lastModifiedBy", "Last Modified By");
- lastModifiedByItem.setValue(group.getModifiedBy());
- formItems.add(lastModifiedByItem);
-
- if (dynamic) {
- StaticTextItem groupDefinitionItem = new StaticTextItem("groupDefinition", "Group Definition");
- GroupDefinition groupDefinition = group.getGroupDefinition();
- // TODO (ips): Make this a link to the group def.
- groupDefinitionItem.setValue(groupDefinition.getName());
- formItems.add(groupDefinitionItem);
- }
-
- generalPropsForm.setItems(formItems.toArray(new FormItem[formItems.size()]));
- addMember(generalPropsForm);
-
- if (dynamic) {
- spacer = new HLayout();
- spacer.setHeight(10);
- addMember(spacer);
-
- HTMLFlow note = new HTMLFlow();
- note.setContents("<b>*</b> Dynamic group names and descriptions are managed, and therefore are not editable.");
- note.setAlign(Alignment.CENTER);
- addMember(note);
- }
- }
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/OverviewView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/OverviewView.java
new file mode 100644
index 0000000..41de300
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/OverviewView.java
@@ -0,0 +1,241 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2010 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 as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * 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 for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.summary;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.widgets.HTMLFlow;
+import com.smartgwt.client.widgets.form.fields.FormItem;
+import com.smartgwt.client.widgets.form.fields.StaticTextItem;
+import com.smartgwt.client.widgets.layout.HLayout;
+import com.smartgwt.client.widgets.layout.VLayout;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.group.GroupDefinition;
+import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.components.form.EnhancedDynamicForm;
+import org.rhq.enterprise.gui.coregui.client.components.form.TogglableTextItem;
+import org.rhq.enterprise.gui.coregui.client.components.form.ValueUpdatedHandler;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGroupGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * The group Inventory>Overview subtab.
+ *
+ * @author Ian Springer
+ */
+public class OverviewView extends VLayout {
+ private ResourceGroupGWTServiceAsync resourceGroupService = GWTServiceLookup.getResourceGroupService();
+ private ResourceGroupComposite groupComposite;
+
+ public OverviewView(ResourceGroupComposite groupComposite) {
+ super();
+ this.groupComposite = groupComposite;
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+
+ final ResourceGroup group = this.groupComposite.getResourceGroup();
+
+ HLayout spacer = new HLayout();
+ spacer.setHeight(15);
+ addMember(spacer);
+
+ final EnhancedDynamicForm generalPropsForm = new EnhancedDynamicForm();
+
+ List<FormItem> formItems = new ArrayList<FormItem>();
+
+ // TODO: Uncomment the below header if we decide to add other stuff to this page besides the general props.
+ //HeaderItem headerItem = new HeaderItem("header", "General Properties");
+ //headerItem.setValue("General Properties");
+ //formItems.add(headerItem);
+
+ boolean dynamic = (group.getGroupDefinition() != null);
+
+ final FormItem nameItem = (dynamic) ? new StaticTextItem() : new TogglableTextItem();
+ nameItem.setName("name");
+ nameItem.setTitle("Name");
+ nameItem.setValue(group.getName());
+ if (nameItem instanceof TogglableTextItem) {
+ final TogglableTextItem togglableNameItem = (TogglableTextItem) nameItem;
+ togglableNameItem.addValueUpdatedHandler(new ValueUpdatedHandler() {
+ public void onValueUpdated(final String newName) {
+ final String oldName = group.getName();
+ if (newName.equals(oldName)) {
+ return;
+ }
+ group.setName(newName);
+ OverviewView.this.resourceGroupService.updateResourceGroup(group, new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to change name of Resource group with id "
+ + group.getId()
+ + " from \"" + oldName + "\" to \"" + newName + "\".", caught);
+ // We failed to update it on the Server, so change back the ResourceGroup and the form item
+ // to the original value.
+ group.setName(oldName);
+ nameItem.setValue(oldName);
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(new Message("Name of Resource group with id "
+ + group.getId() + " was changed from \""
+ + oldName + "\" to \"" + newName + "\".", Message.Severity.Info));
+ }
+ });
+ }
+ });
+ }
+ formItems.add(nameItem);
+
+ StaticTextItem typeItem = new StaticTextItem("memberType", "Member Type");
+ ResourceType type = group.getResourceType();
+ if (type != null) {
+ typeItem.setTooltip("Plugin: " + type.getPlugin() + "\n<br>" + "Type: " + type.getName());
+ typeItem.setValue(type.getName() + " (" + type.getPlugin() + ")");
+ } else {
+ typeItem.setValue("<i>Mixed</i>");
+ }
+ formItems.add(typeItem);
+
+ StaticTextItem countItem = new StaticTextItem("memberCount", "Member Count");
+ long memberCount = this.groupComposite.getImplicitUp() + this.groupComposite.getImplicitDown();
+ countItem.setValue(memberCount);
+ formItems.add(countItem);
+
+ final FormItem descriptionItem = (dynamic) ? new StaticTextItem() : new TogglableTextItem();
+ descriptionItem.setName("description");
+ descriptionItem.setTitle("Description");
+ descriptionItem.setValue(group.getDescription());
+ if (descriptionItem instanceof TogglableTextItem) {
+ final TogglableTextItem togglableDescriptionItem = (TogglableTextItem) descriptionItem;
+ togglableDescriptionItem.addValueUpdatedHandler(new ValueUpdatedHandler() {
+ public void onValueUpdated(final String newDescription) {
+ final String oldDescription = group.getDescription();
+ if (newDescription.equals(oldDescription)) {
+ return;
+ }
+ group.setDescription(newDescription);
+ OverviewView.this.resourceGroupService.updateResourceGroup(group, new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to change description of Resource group with id "
+ + group.getId()
+ + " from \"" + oldDescription + "\" to \"" + newDescription + "\".", caught);
+ // We failed to update it on the Server, so change back the ResourceGroup and the form item
+ // to the original value.
+ group.setDescription(oldDescription);
+ descriptionItem.setValue(oldDescription);
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(new Message("Description of Resource group with id "
+ + group.getId() + " was changed from \""
+ + oldDescription + "\" to \"" + newDescription + "\".", Message.Severity.Info));
+ }
+ });
+ }
+ });
+ }
+ formItems.add(descriptionItem);
+
+ final FormItem locationItem = (dynamic) ? new StaticTextItem() : new TogglableTextItem();
+ locationItem.setName("location");
+ locationItem.setTitle("Location");
+ locationItem.setValue(group.getLocation());
+ if (locationItem instanceof TogglableTextItem) {
+ final TogglableTextItem togglableLocationItem = (TogglableTextItem) locationItem;
+ togglableLocationItem.addValueUpdatedHandler(new ValueUpdatedHandler() {
+ public void onValueUpdated(final String newLocation) {
+ final String oldLocation = group.getLocation();
+ if (newLocation.equals(oldLocation)) {
+ return;
+ }
+ group.setLocation(newLocation);
+ OverviewView.this.resourceGroupService.updateResourceGroup(group, new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to change location of Resource group with id "
+ + group.getId()
+ + " from \"" + oldLocation + "\" to \"" + newLocation + "\".", caught);
+ // We failed to update it on the Server, so change back the ResourceGroup and the form item
+ // to the original value.
+ group.setLocation(oldLocation);
+ locationItem.setValue(oldLocation);
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(new Message("Location of Resource group with id "
+ + group.getId() + " was changed from \""
+ + oldLocation + "\" to \"" + newLocation + "\".", Message.Severity.Info));
+ }
+ });
+ }
+ });
+ }
+ formItems.add(locationItem);
+
+ StaticTextItem dynamicItem = new StaticTextItem("dynamic", "Dynamic?");
+ dynamicItem.setValue(dynamic ? "yes" : "no");
+ formItems.add(dynamicItem);
+
+ StaticTextItem recursiveItem = new StaticTextItem("recursive", "Recursive?");
+ recursiveItem.setValue((group.isRecursive()) ? "yes" : "no");
+ formItems.add(recursiveItem);
+
+ StaticTextItem createdItem = new StaticTextItem("created", "Created");
+ createdItem.setValue(new Date(group.getCtime()));
+ formItems.add(createdItem);
+
+ StaticTextItem lastModifiedItem = new StaticTextItem("lastModified", "Last Modified");
+ lastModifiedItem.setValue(new Date(group.getMtime()));
+ formItems.add(lastModifiedItem);
+
+ StaticTextItem lastModifiedByItem = new StaticTextItem("lastModifiedBy", "Last Modified By");
+ lastModifiedByItem.setValue(group.getModifiedBy());
+ formItems.add(lastModifiedByItem);
+
+ if (dynamic) {
+ StaticTextItem groupDefinitionItem = new StaticTextItem("groupDefinition", "Group Definition");
+ GroupDefinition groupDefinition = group.getGroupDefinition();
+ // TODO (ips): Make this a link to the group def.
+ groupDefinitionItem.setValue(groupDefinition.getName());
+ formItems.add(groupDefinitionItem);
+ }
+
+ generalPropsForm.setItems(formItems.toArray(new FormItem[formItems.size()]));
+ addMember(generalPropsForm);
+
+ if (dynamic) {
+ spacer = new HLayout();
+ spacer.setHeight(10);
+ addMember(spacer);
+
+ HTMLFlow note = new HTMLFlow();
+ note.setContents("<b>*</b> Dynamic group names and descriptions are managed, and therefore are not editable.");
+ note.setAlign(Alignment.CENTER);
+ addMember(note);
+ }
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index 2a7183e..24c2e00 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -41,7 +41,8 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configura
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration.ResourceConfigurationEditView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory.PluginConfigurationEditView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.GraphListView;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.overview.ResourceOverviewView;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary.DashboardView;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary.OverviewView;
import java.util.Set;
@@ -88,7 +89,7 @@ public class ResourceDetailView extends VLayout implements BookmarkableView, Res
topTabSet.setEdgeSize(0);
summaryTab = new TwoLevelTab("Summary", "/images/icons/Service_up_16.png");
- summaryTab.registerSubTabs("Overview", "Timeline");
+ summaryTab.registerSubTabs("Overview", "Dashboard", "Timeline");
monitoringTab = new TwoLevelTab("Monitoring", "/images/icons/Monitor_grey_16.png");
monitoringTab.registerSubTabs("Graphs", "Tables", "Traits", "Availability", "Schedules", "Call Time");
@@ -131,7 +132,8 @@ public class ResourceDetailView extends VLayout implements BookmarkableView, Res
final Resource resource = this.resourceComposite.getResource();
this.titleBar.setResource(resource);
- summaryTab.updateSubTab("Overview", new ResourceOverviewView(this.resourceComposite));
+ summaryTab.updateSubTab("Overview", new OverviewView(this.resourceComposite));
+ summaryTab.updateSubTab("Dashboard", new DashboardView(this.resourceComposite));
summaryTab.updateSubTab("Timeline", new FullHTMLPane("/rhq/resource/summary/timeline-plain.xhtml?id="
+ resource.getId()));
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java
new file mode 100644
index 0000000..efed5ff
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java
@@ -0,0 +1,160 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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 as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * 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 for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.layout.HLayout;
+
+import org.rhq.core.domain.criteria.ResourceCriteria;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.composite.ResourceComposite;
+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.ViewId;
+import org.rhq.enterprise.gui.coregui.client.ViewPath;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.InventoryView;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+
+import java.util.EnumSet;
+
+/**
+ * @author Greg Hinkle
+ */
+public class ResourceTopView extends HLayout implements BookmarkableView {
+
+ private Canvas contentCanvas;
+
+ private ResourceComposite currentResource;
+ //private Resource resourcePlatform;
+
+ private ResourceTreeView treeView;
+ private ResourceDetailView detailView = new ResourceDetailView();
+
+ private ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();
+
+
+ public ResourceTopView() {
+
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+
+ setWidth100();
+ setHeight100();
+
+ treeView = new ResourceTreeView();
+ addMember(treeView);
+
+ contentCanvas = new Canvas();
+ addMember(contentCanvas);
+
+ // created above
+// detailView = new ResourceDetailView();
+
+ treeView.addResourceSelectListener(detailView);
+
+ setContent(detailView);
+ }
+
+
+ public void setSelectedResource(final int resourceId, final ViewPath view) {
+ ResourceCriteria criteria = new ResourceCriteria();
+ criteria.addFilterId(resourceId);
+ criteria.fetchTags(true);
+ //criteria.fetchParentResource(true);
+ resourceService.findResourceCompositesByCriteria(criteria, new AsyncCallback<PageList<ResourceComposite>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getMessageCenter().notify(new Message("Resource with id [" + resourceId +
+ "] does not exist or is not accessible.", Message.Severity.Warning));
+
+ CoreGUI.goTo(InventoryView.VIEW_PATH);
+ }
+
+ public void onSuccess(PageList<ResourceComposite> result) {
+ if (result.isEmpty()) {
+ //noinspection ThrowableInstanceNeverThrown
+ onFailure(new Exception("Resource with id [" + resourceId + "] does not exist."));
+ } else {
+ final ResourceComposite resourceComposite = result.get(0);
+ loadResourceType(resourceComposite, view);
+ }
+ }
+ });
+ }
+
+
+ private void loadResourceType(final ResourceComposite resourceComposite, final ViewPath view) {
+ final Resource resource = resourceComposite.getResource();
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(
+ resource.getResourceType().getId(),
+ EnumSet.of(ResourceTypeRepository.MetadataType.content, ResourceTypeRepository.MetadataType.operations,
+ ResourceTypeRepository.MetadataType.events,
+ ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
+ new ResourceTypeRepository.TypeLoadedCallback() {
+ public void onTypesLoaded(ResourceType type) {
+ resource.setResourceType(type);
+ completeSetSelectedResource(resourceComposite, view);
+ }
+ });
+ }
+
+
+ private void completeSetSelectedResource(ResourceComposite resourceComposite, ViewPath viewPath) {
+ this.currentResource = resourceComposite;
+ this.treeView.setSelectedResource(resourceComposite.getResource(), viewPath.getCurrent());
+ this.detailView.onResourceSelected(resourceComposite);
+ }
+
+
+ public void setContent(Canvas newContent) {
+ if (contentCanvas.getChildren().length > 0)
+ contentCanvas.getChildren()[0].destroy();
+ contentCanvas.addChild(newContent);
+ contentCanvas.markForRedraw();
+ }
+
+
+ public void renderView(ViewPath viewPath) {
+ if (viewPath.isEnd()) {
+ // default detail view
+ viewPath.getViewPath().add(new ViewId("Summary"));
+ viewPath.getViewPath().add(new ViewId("Overview"));
+ }
+
+ Integer resourceId = Integer.parseInt(viewPath.getCurrent().getPath());
+
+ if (currentResource == null || currentResource.getResource().getId() != resourceId) {
+ // The previous history item did not already point to this Resource.
+ setSelectedResource(resourceId, viewPath);
+ }
+
+ viewPath.next();
+ this.treeView.renderView(viewPath);
+ this.detailView.renderView(viewPath);
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
deleted file mode 100644
index 39e748f..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 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 as published by
- * the Free Software Foundation version 2 of the License.
- *
- * 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 for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail;
-
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.layout.HLayout;
-
-import org.rhq.core.domain.criteria.ResourceCriteria;
-import org.rhq.core.domain.resource.Resource;
-import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.domain.resource.composite.ResourceComposite;
-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.ViewId;
-import org.rhq.enterprise.gui.coregui.client.ViewPath;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.InventoryView;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message;
-
-import java.util.EnumSet;
-
-/**
- * @author Greg Hinkle
- */
-public class ResourceView extends HLayout implements BookmarkableView {
-
- private Canvas contentCanvas;
-
- private ResourceComposite currentResource;
- //private Resource resourcePlatform;
-
- private ResourceTreeView treeView;
- private ResourceDetailView detailView = new ResourceDetailView();
-
- private ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();
-
-
- public ResourceView() {
-
- }
-
- @Override
- protected void onInit() {
- super.onInit();
-
- setWidth100();
- setHeight100();
-
- treeView = new ResourceTreeView();
- addMember(treeView);
-
- contentCanvas = new Canvas();
- addMember(contentCanvas);
-
- // created above
-// detailView = new ResourceDetailView();
-
- treeView.addResourceSelectListener(detailView);
-
- setContent(detailView);
- }
-
-
- public void setSelectedResource(final int resourceId, final ViewPath view) {
- ResourceCriteria criteria = new ResourceCriteria();
- criteria.addFilterId(resourceId);
- criteria.fetchTags(true);
- //criteria.fetchParentResource(true);
- resourceService.findResourceCompositesByCriteria(criteria, new AsyncCallback<PageList<ResourceComposite>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getMessageCenter().notify(new Message("Resource with id [" + resourceId +
- "] does not exist or is not accessible.", Message.Severity.Warning));
-
- CoreGUI.goTo(InventoryView.VIEW_PATH);
- }
-
- public void onSuccess(PageList<ResourceComposite> result) {
- if (result.isEmpty()) {
- //noinspection ThrowableInstanceNeverThrown
- onFailure(new Exception("Resource with id [" + resourceId + "] does not exist."));
- } else {
- final ResourceComposite resourceComposite = result.get(0);
- loadResourceType(resourceComposite, view);
- }
- }
- });
- }
-
-
- private void loadResourceType(final ResourceComposite resourceComposite, final ViewPath view) {
- final Resource resource = resourceComposite.getResource();
- ResourceTypeRepository.Cache.getInstance().getResourceTypes(
- resource.getResourceType().getId(),
- EnumSet.of(ResourceTypeRepository.MetadataType.content, ResourceTypeRepository.MetadataType.operations,
- ResourceTypeRepository.MetadataType.events,
- ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
- new ResourceTypeRepository.TypeLoadedCallback() {
- public void onTypesLoaded(ResourceType type) {
- resource.setResourceType(type);
- completeSetSelectedResource(resourceComposite, view);
- }
- });
- }
-
-
- private void completeSetSelectedResource(ResourceComposite resourceComposite, ViewPath viewPath) {
- this.currentResource = resourceComposite;
- this.treeView.setSelectedResource(resourceComposite.getResource(), viewPath.getCurrent());
- this.detailView.onResourceSelected(resourceComposite);
- }
-
-
- public void setContent(Canvas newContent) {
- if (contentCanvas.getChildren().length > 0)
- contentCanvas.getChildren()[0].destroy();
- contentCanvas.addChild(newContent);
- contentCanvas.markForRedraw();
- }
-
-
- public void renderView(ViewPath viewPath) {
- if (viewPath.isEnd()) {
- // default detail view
- viewPath.getViewPath().add(new ViewId("Summary"));
- viewPath.getViewPath().add(new ViewId("Overview"));
- }
-
- Integer resourceId = Integer.parseInt(viewPath.getCurrent().getPath());
-
- if (currentResource == null || currentResource.getResource().getId() != resourceId) {
- // The previous history item did not already point to this Resource.
- setSelectedResource(resourceId, viewPath);
- }
-
- viewPath.next();
- this.treeView.renderView(viewPath);
- this.detailView.renderView(viewPath);
- }
-
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/overview/ResourceOverviewView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/overview/ResourceOverviewView.java
deleted file mode 100644
index 92cd3ff..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/overview/ResourceOverviewView.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 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 as published by
- * the Free Software Foundation version 2 of the License.
- *
- * 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 for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.overview;
-
-import com.smartgwt.client.widgets.layout.VLayout;
-
-import org.rhq.core.domain.resource.composite.ResourceComposite;
-import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
-
-/**
- * @author Greg Hinkle
- */
-public class ResourceOverviewView extends VLayout implements ResourceSelectListener {
- private ResourceSummaryView summaryView;
- private FullHTMLPane summaryPane;
- private ResourceComposite resourceComposite;
-
- public ResourceOverviewView(ResourceComposite resourceComposite) {
- this.resourceComposite = resourceComposite;
- }
-
- @Override
- protected void onDraw() {
- super.onDraw();
-
- this.summaryView = new ResourceSummaryView();
- addMember(this.summaryView);
-
- this.summaryPane = new FullHTMLPane();
- addMember(this.summaryPane);
-
- if (this.resourceComposite != null) {
- onResourceSelected(this.resourceComposite);
- }
- }
-
- @Override
- public void onResourceSelected(ResourceComposite resourceComposite) {
- this.resourceComposite = resourceComposite;
- this.summaryView.onResourceSelected(resourceComposite);
- this.summaryPane.setContentsURL("/rhq/resource/summary/overview-plain.xhtml?id="
- + resourceComposite.getResource().getId());
- }
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/overview/ResourceSummaryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/overview/ResourceSummaryView.java
deleted file mode 100644
index 4d98f82..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/overview/ResourceSummaryView.java
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 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 as published by
- * the Free Software Foundation version 2 of the License.
- *
- * 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 for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.overview;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.EnumSet;
-import java.util.List;
-
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.util.SC;
-import com.smartgwt.client.widgets.form.fields.FormItem;
-import com.smartgwt.client.widgets.form.fields.HeaderItem;
-import com.smartgwt.client.widgets.form.fields.SpacerItem;
-import com.smartgwt.client.widgets.form.fields.StaticTextItem;
-
-import org.rhq.core.domain.measurement.DataType;
-import org.rhq.core.domain.measurement.DisplayType;
-import org.rhq.core.domain.measurement.MeasurementDataTrait;
-import org.rhq.core.domain.measurement.MeasurementDefinition;
-import org.rhq.core.domain.resource.Resource;
-import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.domain.resource.composite.ResourceComposite;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.components.form.EnhancedDynamicForm;
-import org.rhq.enterprise.gui.coregui.client.components.form.TogglableTextItem;
-import org.rhq.enterprise.gui.coregui.client.components.form.ValueUpdatedHandler;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message;
-
-/**
- * @author Greg Hinkle
- * @author Ian Springer
- */
-public class ResourceSummaryView extends EnhancedDynamicForm implements ResourceSelectListener {
-
- private ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();
- private ResourceComposite resourceComposite;
-
- @Override
- protected void onDraw() {
- super.onDraw();
-
- setLeft("10%");
- setWidth("80%");
- }
-
-
- public void onResourceSelected(ResourceComposite resourceComposite) {
-
- this.resourceComposite = resourceComposite;
- Resource resource = resourceComposite.getResource();
-
- // Load metric defs.
- ResourceTypeRepository.Cache.getInstance().getResourceTypes(resource.getResourceType().getId(),
- EnumSet.of(ResourceTypeRepository.MetadataType.measurements),
- new ResourceTypeRepository.TypeLoadedCallback() {
- public void onTypesLoaded(ResourceType type) {
- try {
- buildForm(type);
- loadTraitValues();
- } catch (Exception e) {
- SC.say("Form load failure");
- e.printStackTrace();
- }
- }
- });
- }
-
- private void loadTraitValues() {
- final Resource resource = resourceComposite.getResource();
- GWTServiceLookup.getMeasurementDataService().findCurrentTraitsForResource(
- resource.getId(),
- DisplayType.SUMMARY,
- new AsyncCallback<List<MeasurementDataTrait>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load traits for " + resource + ".",
- caught);
- }
-
- public void onSuccess(List<MeasurementDataTrait> result) {
- // TODO: Implement this method.
- for (MeasurementDataTrait trait : result) {
- String formId = trait.getName().replaceAll("\\.", "_").replaceAll(" ", "__");
- FormItem item = getItem(formId);
-
- if (item != null) {
- setValue(formId, trait.getValue());
- }
- }
- markForRedraw();
- }
- }
- );
-
- }
-
- private void buildForm(ResourceType type) {
- List<MeasurementDefinition> traits = new ArrayList<MeasurementDefinition>();
-
- for (MeasurementDefinition measurement : type.getMetricDefinitions()) {
- if (measurement.getDataType() == DataType.TRAIT && measurement.getDisplayType() == DisplayType.SUMMARY) {
- traits.add(measurement);
- }
- }
-
- Collections.sort(traits, new Comparator<MeasurementDefinition>() {
- public int compare(MeasurementDefinition o1, MeasurementDefinition o2) {
- return new Integer(o1.getDisplayOrder()).compareTo(o2.getDisplayOrder());
- }
- });
-
- List<FormItem> formItems = new ArrayList<FormItem>();
-
- HeaderItem headerItem = new HeaderItem("header", "Summary");
- headerItem.setValue("Summary");
- formItems.add(headerItem);
-
- StaticTextItem typeItem = new StaticTextItem("type", "Type");
- typeItem.setTooltip("Plugin: " + type.getPlugin() + "\n<br>" + "Type: " + type.getName());
- typeItem.setValue(type.getName() + " (" + type.getPlugin() + ")");
- formItems.add(typeItem);
-
- final Resource resource = this.resourceComposite.getResource();
- boolean modifiable = this.resourceComposite.getResourcePermission().isInventory();
-
- final FormItem nameItem = (modifiable) ? new TogglableTextItem() : new StaticTextItem();
- nameItem.setName("name");
- nameItem.setTitle("Name");
- nameItem.setValue(resource.getName());
- if (nameItem instanceof TogglableTextItem) {
- TogglableTextItem togglableNameItem = (TogglableTextItem) nameItem;
- togglableNameItem.addValueUpdatedHandler(new ValueUpdatedHandler() {
- public void onValueUpdated(final String newName) {
- final String oldName = resource.getName();
- if (newName.equals(oldName)) {
- return;
- }
- resource.setName(newName);
- ResourceSummaryView.this.resourceService.updateResource(resource, new AsyncCallback<Void>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to change name of Resource with id "
- + resource.getId()
- + " from \"" + oldName + "\" to \"" + newName + "\".", caught);
- // We failed to update it on the Server, so change back the Resource and the form item to
- // the original value.
- resource.setName(oldName);
- nameItem.setValue(oldName);
- }
-
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(new Message("Name of Resource with id "
- + resource.getId() + " was changed from \""
- + oldName + "\" to \"" + newName + "\".", Message.Severity.Info));
- }
- });
- }
- });
- }
- formItems.add(nameItem);
-
- final FormItem descriptionItem = (modifiable) ? new TogglableTextItem() : new StaticTextItem();
- descriptionItem.setName("description");
- descriptionItem.setTitle("Description");
- descriptionItem.setValue(resource.getDescription());
- if (descriptionItem instanceof TogglableTextItem) {
- TogglableTextItem togglableDescriptionItem = (TogglableTextItem) descriptionItem;
- togglableDescriptionItem.addValueUpdatedHandler(new ValueUpdatedHandler() {
- public void onValueUpdated(final String newDescription) {
- final String oldDescription = resource.getDescription();
- if (newDescription.equals(oldDescription)) {
- return;
- }
- resource.setDescription(newDescription);
- ResourceSummaryView.this.resourceService.updateResource(resource, new AsyncCallback<Void>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to change description of Resource with id "
- + resource.getId()
- + " from \"" + oldDescription + "\" to \"" + newDescription + "\".", caught);
- // We failed to update it on the Server, so change back the Resource and the form item to
- // the original value.
- resource.setDescription(oldDescription);
- descriptionItem.setValue(oldDescription);
- }
-
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(new Message("Description of Resource with id "
- + resource.getId() + " was changed from \""
- + oldDescription + "\" to \"" + newDescription + "\".", Message.Severity.Info));
- }
- });
- }
- });
- }
- formItems.add(descriptionItem);
-
- final FormItem locationItem = (modifiable) ? new TogglableTextItem() : new StaticTextItem();
- locationItem.setName("location");
- locationItem.setTitle("Location");
- locationItem.setValue(resource.getLocation());
- if (locationItem instanceof TogglableTextItem) {
- TogglableTextItem togglableNameItem = (TogglableTextItem) locationItem;
- togglableNameItem.addValueUpdatedHandler(new ValueUpdatedHandler() {
- public void onValueUpdated(final String newLocation) {
- final String oldLocation = resource.getLocation();
- if (newLocation.equals(oldLocation)) {
- return;
- }
- resource.setLocation(newLocation);
- ResourceSummaryView.this.resourceService.updateResource(resource, new AsyncCallback<Void>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to change location of Resource with id "
- + resource.getId()
- + " from \"" + oldLocation + "\" to \"" + newLocation + "\".", caught);
- // We failed to update it on the Server, so change back the Resource and the form item to
- // the original value.
- resource.setLocation(oldLocation);
- locationItem.setValue(oldLocation);
- }
-
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(new Message("Location of Resource with id "
- + resource.getId() + " was changed from \""
- + oldLocation + "\" to \"" + newLocation + "\".", Message.Severity.Info));
- }
- });
- }
- });
- }
- formItems.add(locationItem);
-
-
- StaticTextItem versionItem = new StaticTextItem("version", "Version");
- formItems.add(versionItem);
-
- StaticTextItem parentItem = new StaticTextItem("parent", "Parent");
- formItems.add(parentItem);
-
- for (MeasurementDefinition trait : traits) {
- String id = trait.getDisplayName().replaceAll("\\.", "_").replaceAll(" ", "__");
-
- StaticTextItem item = new StaticTextItem(id, trait.getDisplayName());
- item.setTooltip(trait.getDescription());
- formItems.add(item);
-// item.setValue("?");
- }
-
-// SectionItem section = new SectionItem("Summary", "Summary");
-// section.setTitle("Summary");
-// section.setDefaultValue("Summary");
-// section.setCanCollapse(true);
-// section.setCellStyle("HidablePlainSectionHeader");
-// section.setItemIds(itemIds.toArray(new String[itemIds.size()]));
-// formItems.add(0, section);
-
- formItems.add(new SpacerItem());
- setItems(formItems.toArray(new FormItem[formItems.size()]));
-
- setValue("type", type.getName() + " (" + type.getPlugin() + ")");
- setValue("name", resource.getName());
- setValue("description", resource.getDescription());
- setValue("location", resource.getLocation());
- setValue("version", (resource.getVersion() != null) ? resource.getVersion() : "<i>none</i>");
- Resource parentResource = resource.getParentResource();
- setValue("parent", parentResource != null ?
- ("<a href=\"#Resource/" + parentResource.getId() + "\">" +
- parentResource.getName() + "</a>") : "<i>none</i>");
- }
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/DashboardView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/DashboardView.java
new file mode 100644
index 0000000..c29deec
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/DashboardView.java
@@ -0,0 +1,52 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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 as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * 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 for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary;
+
+import org.rhq.core.domain.resource.composite.ResourceComposite;
+import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
+
+/**
+ * The Resource Summary>Dashboard tab.
+ *
+ * @author Greg Hinkle
+ */
+public class DashboardView extends FullHTMLPane implements ResourceSelectListener {
+ private ResourceComposite resourceComposite;
+
+ public DashboardView(ResourceComposite resourceComposite) {
+ this.resourceComposite = resourceComposite;
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+ if (this.resourceComposite != null) {
+ onResourceSelected(this.resourceComposite);
+ }
+ }
+
+ @Override
+ public void onResourceSelected(ResourceComposite resourceComposite) {
+ this.resourceComposite = resourceComposite;
+ setContentsURL("/rhq/resource/summary/summary-plain.xhtml?id="
+ + resourceComposite.getResource().getId());
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewView.java
new file mode 100644
index 0000000..ac2abc2
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewView.java
@@ -0,0 +1,302 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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 as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * 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 for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.EnumSet;
+import java.util.List;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.util.SC;
+import com.smartgwt.client.widgets.form.fields.FormItem;
+import com.smartgwt.client.widgets.form.fields.HeaderItem;
+import com.smartgwt.client.widgets.form.fields.SpacerItem;
+import com.smartgwt.client.widgets.form.fields.StaticTextItem;
+
+import org.rhq.core.domain.measurement.DataType;
+import org.rhq.core.domain.measurement.DisplayType;
+import org.rhq.core.domain.measurement.MeasurementDataTrait;
+import org.rhq.core.domain.measurement.MeasurementDefinition;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.composite.ResourceComposite;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.components.form.EnhancedDynamicForm;
+import org.rhq.enterprise.gui.coregui.client.components.form.TogglableTextItem;
+import org.rhq.enterprise.gui.coregui.client.components.form.ValueUpdatedHandler;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+
+/**
+ * The Resource Summary>Overview tab.
+ *
+ * @author Greg Hinkle
+ * @author Ian Springer
+ */
+public class OverviewView extends EnhancedDynamicForm implements ResourceSelectListener {
+
+ private ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();
+ private ResourceComposite resourceComposite;
+
+
+ public OverviewView(ResourceComposite resourceComposite) {
+ super();
+ this.resourceComposite = resourceComposite;
+ }
+
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+ setLeft("10%");
+ setWidth("80%");
+
+ if (this.resourceComposite != null) {
+ onResourceSelected(this.resourceComposite);
+ }
+ }
+
+
+ public void onResourceSelected(ResourceComposite resourceComposite) {
+
+ this.resourceComposite = resourceComposite;
+ Resource resource = resourceComposite.getResource();
+
+ // Load metric defs.
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(resource.getResourceType().getId(),
+ EnumSet.of(ResourceTypeRepository.MetadataType.measurements),
+ new ResourceTypeRepository.TypeLoadedCallback() {
+ public void onTypesLoaded(ResourceType type) {
+ try {
+ buildForm(type);
+ loadTraitValues();
+ } catch (Exception e) {
+ SC.say("Form load failure");
+ e.printStackTrace();
+ }
+ }
+ });
+ }
+
+ private void loadTraitValues() {
+ final Resource resource = resourceComposite.getResource();
+ GWTServiceLookup.getMeasurementDataService().findCurrentTraitsForResource(
+ resource.getId(),
+ DisplayType.SUMMARY,
+ new AsyncCallback<List<MeasurementDataTrait>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load traits for " + resource + ".",
+ caught);
+ }
+
+ public void onSuccess(List<MeasurementDataTrait> result) {
+ // TODO: Implement this method.
+ for (MeasurementDataTrait trait : result) {
+ String formId = trait.getName().replaceAll("\\.", "_").replaceAll(" ", "__");
+ FormItem item = getItem(formId);
+
+ if (item != null) {
+ setValue(formId, trait.getValue());
+ }
+ }
+ markForRedraw();
+ }
+ }
+ );
+
+ }
+
+ private void buildForm(ResourceType type) {
+ List<MeasurementDefinition> traits = new ArrayList<MeasurementDefinition>();
+
+ for (MeasurementDefinition measurement : type.getMetricDefinitions()) {
+ if (measurement.getDataType() == DataType.TRAIT && measurement.getDisplayType() == DisplayType.SUMMARY) {
+ traits.add(measurement);
+ }
+ }
+
+ Collections.sort(traits, new Comparator<MeasurementDefinition>() {
+ public int compare(MeasurementDefinition o1, MeasurementDefinition o2) {
+ return new Integer(o1.getDisplayOrder()).compareTo(o2.getDisplayOrder());
+ }
+ });
+
+ List<FormItem> formItems = new ArrayList<FormItem>();
+
+ HeaderItem headerItem = new HeaderItem("header", "Summary");
+ headerItem.setValue("Summary");
+ formItems.add(headerItem);
+
+ StaticTextItem typeItem = new StaticTextItem("type", "Type");
+ typeItem.setTooltip("Plugin: " + type.getPlugin() + "\n<br>" + "Type: " + type.getName());
+ typeItem.setValue(type.getName() + " (" + type.getPlugin() + ")");
+ formItems.add(typeItem);
+
+ final Resource resource = this.resourceComposite.getResource();
+ boolean modifiable = this.resourceComposite.getResourcePermission().isInventory();
+
+ final FormItem nameItem = (modifiable) ? new TogglableTextItem() : new StaticTextItem();
+ nameItem.setName("name");
+ nameItem.setTitle("Name");
+ nameItem.setValue(resource.getName());
+ if (nameItem instanceof TogglableTextItem) {
+ TogglableTextItem togglableNameItem = (TogglableTextItem) nameItem;
+ togglableNameItem.addValueUpdatedHandler(new ValueUpdatedHandler() {
+ public void onValueUpdated(final String newName) {
+ final String oldName = resource.getName();
+ if (newName.equals(oldName)) {
+ return;
+ }
+ resource.setName(newName);
+ OverviewView.this.resourceService.updateResource(resource, new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to change name of Resource with id "
+ + resource.getId()
+ + " from \"" + oldName + "\" to \"" + newName + "\".", caught);
+ // We failed to update it on the Server, so change back the Resource and the form item to
+ // the original value.
+ resource.setName(oldName);
+ nameItem.setValue(oldName);
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(new Message("Name of Resource with id "
+ + resource.getId() + " was changed from \""
+ + oldName + "\" to \"" + newName + "\".", Message.Severity.Info));
+ }
+ });
+ }
+ });
+ }
+ formItems.add(nameItem);
+
+ final FormItem descriptionItem = (modifiable) ? new TogglableTextItem() : new StaticTextItem();
+ descriptionItem.setName("description");
+ descriptionItem.setTitle("Description");
+ descriptionItem.setValue(resource.getDescription());
+ if (descriptionItem instanceof TogglableTextItem) {
+ TogglableTextItem togglableDescriptionItem = (TogglableTextItem) descriptionItem;
+ togglableDescriptionItem.addValueUpdatedHandler(new ValueUpdatedHandler() {
+ public void onValueUpdated(final String newDescription) {
+ final String oldDescription = resource.getDescription();
+ if (newDescription.equals(oldDescription)) {
+ return;
+ }
+ resource.setDescription(newDescription);
+ OverviewView.this.resourceService.updateResource(resource, new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to change description of Resource with id "
+ + resource.getId()
+ + " from \"" + oldDescription + "\" to \"" + newDescription + "\".", caught);
+ // We failed to update it on the Server, so change back the Resource and the form item to
+ // the original value.
+ resource.setDescription(oldDescription);
+ descriptionItem.setValue(oldDescription);
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(new Message("Description of Resource with id "
+ + resource.getId() + " was changed from \""
+ + oldDescription + "\" to \"" + newDescription + "\".", Message.Severity.Info));
+ }
+ });
+ }
+ });
+ }
+ formItems.add(descriptionItem);
+
+ final FormItem locationItem = (modifiable) ? new TogglableTextItem() : new StaticTextItem();
+ locationItem.setName("location");
+ locationItem.setTitle("Location");
+ locationItem.setValue(resource.getLocation());
+ if (locationItem instanceof TogglableTextItem) {
+ TogglableTextItem togglableNameItem = (TogglableTextItem) locationItem;
+ togglableNameItem.addValueUpdatedHandler(new ValueUpdatedHandler() {
+ public void onValueUpdated(final String newLocation) {
+ final String oldLocation = resource.getLocation();
+ if (newLocation.equals(oldLocation)) {
+ return;
+ }
+ resource.setLocation(newLocation);
+ OverviewView.this.resourceService.updateResource(resource, new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to change location of Resource with id "
+ + resource.getId()
+ + " from \"" + oldLocation + "\" to \"" + newLocation + "\".", caught);
+ // We failed to update it on the Server, so change back the Resource and the form item to
+ // the original value.
+ resource.setLocation(oldLocation);
+ locationItem.setValue(oldLocation);
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(new Message("Location of Resource with id "
+ + resource.getId() + " was changed from \""
+ + oldLocation + "\" to \"" + newLocation + "\".", Message.Severity.Info));
+ }
+ });
+ }
+ });
+ }
+ formItems.add(locationItem);
+
+
+ StaticTextItem versionItem = new StaticTextItem("version", "Version");
+ formItems.add(versionItem);
+
+ StaticTextItem parentItem = new StaticTextItem("parent", "Parent");
+ formItems.add(parentItem);
+
+ for (MeasurementDefinition trait : traits) {
+ String id = trait.getDisplayName().replaceAll("\\.", "_").replaceAll(" ", "__");
+
+ StaticTextItem item = new StaticTextItem(id, trait.getDisplayName());
+ item.setTooltip(trait.getDescription());
+ formItems.add(item);
+// item.setValue("?");
+ }
+
+// SectionItem section = new SectionItem("Summary", "Summary");
+// section.setTitle("Summary");
+// section.setDefaultValue("Summary");
+// section.setCanCollapse(true);
+// section.setCellStyle("HidablePlainSectionHeader");
+// section.setItemIds(itemIds.toArray(new String[itemIds.size()]));
+// formItems.add(0, section);
+
+ formItems.add(new SpacerItem());
+ setItems(formItems.toArray(new FormItem[formItems.size()]));
+
+ setValue("type", type.getName() + " (" + type.getPlugin() + ")");
+ setValue("name", resource.getName());
+ setValue("description", resource.getDescription());
+ setValue("location", resource.getLocation());
+ setValue("version", (resource.getVersion() != null) ? resource.getVersion() : "<i>none</i>");
+ Resource parentResource = resource.getParentResource();
+ setValue("parent", parentResource != null ?
+ ("<a href=\"#Resource/" + parentResource.getId() + "\">" +
+ parentResource.getName() + "</a>") : "<i>none</i>");
+ }
+}
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/common/tag/FunctionTagLibrary.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/common/tag/FunctionTagLibrary.java
index 7a5a8d5..e9f24fa 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/common/tag/FunctionTagLibrary.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/common/tag/FunctionTagLibrary.java
@@ -351,7 +351,7 @@ public class FunctionTagLibrary extends AbstractTagLibrary {
// needs to exist separately from getDefaultContextTabURL because only some facelets understand EntityContext
public static String getDefaultResourceTabURL() {
- return "/rhq/resource/summary/overview.xhtml";
+ return "/rhq/resource/summary/summary.xhtml";
}
public static String getDefaultGroupTabURL() {
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/DisambiguatedResourceLineageRenderer.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/DisambiguatedResourceLineageRenderer.java
index 60f5031..56d5465 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/DisambiguatedResourceLineageRenderer.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/DisambiguatedResourceLineageRenderer.java
@@ -40,7 +40,7 @@ import org.rhq.core.domain.resource.composite.DisambiguationReport;
* @author Lukas Krejci
*/
public class DisambiguatedResourceLineageRenderer extends Renderer {
- private static final String RESOURCE_URL = "/rhq/resource/summary/overview.xhtml";
+ private static final String RESOURCE_URL = "/rhq/resource/summary/summary.xhtml";
@Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/ResourceLineageRenderer.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/ResourceLineageRenderer.java
index 94e6614..33310b6 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/ResourceLineageRenderer.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/ResourceLineageRenderer.java
@@ -37,7 +37,7 @@ import org.rhq.enterprise.server.util.LookupUtil;
* @author Ian Springer
*/
public class ResourceLineageRenderer extends Renderer {
- private static final String BASE_RESOURCE_URL = "/rhq/resource/summary/overview.xhtml";
+ private static final String BASE_RESOURCE_URL = "/rhq/resource/summary/summary.xhtml";
private static final String SEPARATOR = " > ";
private ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/taglib/InventoryHierarchyTag.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/taglib/InventoryHierarchyTag.java
index 5e02e32..4f5bfa9 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/taglib/InventoryHierarchyTag.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/taglib/InventoryHierarchyTag.java
@@ -46,7 +46,7 @@ import org.rhq.enterprise.server.util.LookupUtil;
* @author Ian Springer
*/
public class InventoryHierarchyTag extends TagSupport {
- private static final String BASE_RESOURCE_URL = "/rhq/resource/summary/overview.xhtml";
+ private static final String BASE_RESOURCE_URL = "/rhq/resource/summary/summary.xhtml";
//private static final String BASE_GROUP_URL = "/Resource.do?type=GROUP";
private static final String BASE_GROUP_URL = "/rhq/group/inventory/view.xhtml";
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/taglib/display/DisambiguatedResourceNameTag.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/taglib/display/DisambiguatedResourceNameTag.java
index 1077aab..2efedc9 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/taglib/display/DisambiguatedResourceNameTag.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/taglib/display/DisambiguatedResourceNameTag.java
@@ -170,6 +170,6 @@ public class DisambiguatedResourceNameTag extends TagSupport {
}
public static String getDefaultResourceUrl(int resourceId) {
- return "/rhq/resource/summary/overview.xhtml?id=" + resourceId;
+ return "/rhq/resource/summary/summary.xhtml?id=" + resourceId;
}
}
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/group/ResourceGroupTreeContextMenuUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/group/ResourceGroupTreeContextMenuUIBean.java
index 34fb0a6..4650eef 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/group/ResourceGroupTreeContextMenuUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/group/ResourceGroupTreeContextMenuUIBean.java
@@ -175,7 +175,7 @@ public class ResourceGroupTreeContextMenuUIBean extends TreeContextMenuBase {
menuItem.setValue(res.getName());
menuItem.setId("groupMember_" + res.getId());
- String url = "/rhq/resource/summary/overview.xhtml?id=" + res.getId();
+ String url = "/rhq/resource/summary/summary.xhtml?id=" + res.getId();
menuItem.setSubmitMode("none");
menuItem.setOnclick("document.location.href='" + url + "'");
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/perspective/PerspectiveTarget.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/perspective/PerspectiveTarget.java
index 3bf4596..0ea233b 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/perspective/PerspectiveTarget.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/perspective/PerspectiveTarget.java
@@ -33,7 +33,7 @@ public enum PerspectiveTarget {
GROUP_MIXED("/rhq/group/inventory/view.xhtml?category=MIXED&groupId="), //
METRIC_TEMPLATE("/admin/platform/monitor/Config.do?mode=configure&id=", false, true), //
REPO("/rhq/content/repo.xhtml?mode=view&id="), //
- RESOURCE("/rhq/resource/summary/overview.xhtml?id="), //
+ RESOURCE("/rhq/resource/summary/summary.xhtml?id="), //
ROLE("/admin/role/RoleAdmin.do?mode=view&r="), //
SERVER("/rhq/ha/viewServer.xhtml?mode=view&serverId="), //
USER("/admin/user/UserAdmin.do?mode=view&u=");
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
index e5f2802..25ffa7b 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
@@ -835,6 +835,10 @@ public class WebservicesManagerBean implements WebservicesRemote {
return resourceManager.uninventoryResources(subject, resourceIds);
}
+ public Resource updateResource(Subject subject, Resource resource) {
+ return resourceManager.updateResource(subject, resource);
+ }
+
//RESOURCEMANAGER: END ----------------------------------
//RESOURCEGROUPMANAGER: BEGIN ----------------------------------
diff --git a/modules/plugins/cron/src/main/java/org/rhq/plugins/cron/CronComponent.java b/modules/plugins/cron/src/main/java/org/rhq/plugins/cron/CronComponent.java
index ae22c2f..a7cdba4 100644
--- a/modules/plugins/cron/src/main/java/org/rhq/plugins/cron/CronComponent.java
+++ b/modules/plugins/cron/src/main/java/org/rhq/plugins/cron/CronComponent.java
@@ -45,7 +45,7 @@ import org.rhq.augeas.util.GlobFilter;
import org.rhq.plugins.platform.PlatformComponent;
/**
- * Provides an overview of all entries in the crontabs split into hourly/daily/weekly/monthly entries.
+ * Provides an summary of all entries in the crontabs split into hourly/daily/weekly/monthly entries.
* Is able to create new cron tabs.
*
* @author Lukas Krejci
diff --git a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/serviceBinding/SetComponent.java b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/serviceBinding/SetComponent.java
index 5e02571..024d60d 100644
--- a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/serviceBinding/SetComponent.java
+++ b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/serviceBinding/SetComponent.java
@@ -192,7 +192,7 @@ public class SetComponent implements ResourceComponent<ManagerComponent>, Config
Configuration bindings = result.getComplexResults();
- //populate the resulting binding map so that the users have overview what the
+ //populate the resulting binding map so that the users have summary what the
//the bindings would look like if this binding set was active.
PropertyList resultingBindings = new PropertyList(RESULTING_BINDINGS_PROPERTY);
bindings.put(resultingBindings);
13 years, 10 months
[rhq] 2 commits - modules/core modules/enterprise
by ips
modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceSubCategory.java | 9 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java | 11 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java | 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java | 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java | 6 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGroupGWTService.java | 6 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java | 16 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/OverviewView.java | 36 ++++--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java | 21 ++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/overview/ResourceSummaryView.java | 37 ++++--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java | 17 ---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGroupGWTServiceImpl.java | 12 --
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java | 21 +++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java | 9 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationServerServiceImpl.java | 7 -
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java | 54 +++-------
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java | 14 --
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerRemote.java | 22 ----
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceNotFoundException.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java | 16 ++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerLocal.java | 7 -
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerRemote.java | 17 ---
22 files changed, 163 insertions(+), 179 deletions(-)
New commits:
commit 38aa7252752eb905b84127662e0149f6d470ba7b
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Aug 13 15:54:55 2010 -0400
get rid of new updateResource*Name, updateResource*Description, and updateResource*Location in resource and group managers, and use updateResource() and updateResourceGroup() instead
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceSubCategory.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceSubCategory.java
index 7714e39..80e92f6 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceSubCategory.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceSubCategory.java
@@ -50,7 +50,7 @@ import javax.persistence.Table;
import org.jetbrains.annotations.NotNull;
/**
- * Class representing a sub category, where a sub category is meant to group similar resource types together.
+ * Class representing a sub category, where a sub category is meant to group similar Resource types together.
*/
@Entity
@SequenceGenerator(name = "SEQ", sequenceName = "RHQ_RESOURCE_SUBCAT_ID_SEQ")
@@ -213,7 +213,7 @@ public class ResourceSubCategory implements Comparable<ResourceSubCategory>, Ser
}
/**
- * Updates the contents of this definition with values from the specified new defintion. The intention is for this
+ * Updates the contents of this definition with values from the specified new definition. The intention is for this
* to be used as a merge between this attached instance and a detached instance. The name and resourceType will NOT
* be updated as part of this call; they are used as identifiers and should already be the same if this merge is
* being performed.
@@ -246,10 +246,9 @@ public class ResourceSubCategory implements Comparable<ResourceSubCategory>, Ser
}
public void setChildSubCategories(List<ResourceSubCategory> childSubCategories) {
- if (childSubCategories == null) {
- throw new IllegalArgumentException("childSubCategories is null.");
+ if (childSubCategories != null) {
+ this.childSubCategories = childSubCategories;
}
- this.childSubCategories = childSubCategories;
}
public void setParentSubCategory(ResourceSubCategory parentSubCategory) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java
index 53741a9..f92e7d5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java
@@ -65,10 +65,4 @@ public interface ResourceGWTService extends RemoteService {
void unignoreResources(Integer[] resourceIds);
- void updateResourceName(int resourceId, String name);
-
- void updateResourceDescription(int resourceId, String description);
-
- void updateResourceLocation(int resourceId, String location);
-
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGroupGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGroupGWTService.java
index 9134199..3d78c78 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGroupGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGroupGWTService.java
@@ -46,10 +46,6 @@ public interface ResourceGroupGWTService extends RemoteService {
void deleteResourceGroup(int groupId);
- void updateResourceGroupName(int groupId, String name);
-
- void updateResourceGroupDescription(int groupId, String description);
-
- void updateResourceGroupLocation(int groupId, String location);
+ void updateResourceGroup(ResourceGroup group);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/OverviewView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/OverviewView.java
index e9078cd..01faa2d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/OverviewView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/OverviewView.java
@@ -85,13 +85,18 @@ public class OverviewView extends VLayout {
togglableNameItem.addValueUpdatedHandler(new ValueUpdatedHandler() {
public void onValueUpdated(final String newName) {
final String oldName = group.getName();
- OverviewView.this.resourceGroupService.updateResourceGroupName(group.getId(),
- newName, new AsyncCallback<Void>() {
+ if (newName.equals(oldName)) {
+ return;
+ }
+ group.setName(newName);
+ OverviewView.this.resourceGroupService.updateResourceGroup(group, new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError("Failed to change name of Resource group with id "
+ group.getId()
+ " from \"" + oldName + "\" to \"" + newName + "\".", caught);
- // We failed to update it on the Server, so change back the form item to the original value.
+ // We failed to update it on the Server, so change back the ResourceGroup and the form item
+ // to the original value.
+ group.setName(oldName);
nameItem.setValue(oldName);
}
@@ -99,7 +104,6 @@ public class OverviewView extends VLayout {
CoreGUI.getMessageCenter().notify(new Message("Name of Resource group with id "
+ group.getId() + " was changed from \""
+ oldName + "\" to \"" + newName + "\".", Message.Severity.Info));
- group.setName(newName);
}
});
}
@@ -131,13 +135,18 @@ public class OverviewView extends VLayout {
togglableDescriptionItem.addValueUpdatedHandler(new ValueUpdatedHandler() {
public void onValueUpdated(final String newDescription) {
final String oldDescription = group.getDescription();
- OverviewView.this.resourceGroupService.updateResourceGroupDescription(group.getId(),
- newDescription, new AsyncCallback<Void>() {
+ if (newDescription.equals(oldDescription)) {
+ return;
+ }
+ group.setDescription(newDescription);
+ OverviewView.this.resourceGroupService.updateResourceGroup(group, new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError("Failed to change description of Resource group with id "
+ group.getId()
+ " from \"" + oldDescription + "\" to \"" + newDescription + "\".", caught);
- // We failed to update it on the Server, so change back the form item to the original value.
+ // We failed to update it on the Server, so change back the ResourceGroup and the form item
+ // to the original value.
+ group.setDescription(oldDescription);
descriptionItem.setValue(oldDescription);
}
@@ -145,7 +154,6 @@ public class OverviewView extends VLayout {
CoreGUI.getMessageCenter().notify(new Message("Description of Resource group with id "
+ group.getId() + " was changed from \""
+ oldDescription + "\" to \"" + newDescription + "\".", Message.Severity.Info));
- group.setDescription(newDescription);
}
});
}
@@ -162,13 +170,18 @@ public class OverviewView extends VLayout {
togglableLocationItem.addValueUpdatedHandler(new ValueUpdatedHandler() {
public void onValueUpdated(final String newLocation) {
final String oldLocation = group.getLocation();
- OverviewView.this.resourceGroupService.updateResourceGroupLocation(group.getId(),
- newLocation, new AsyncCallback<Void>() {
+ if (newLocation.equals(oldLocation)) {
+ return;
+ }
+ group.setLocation(newLocation);
+ OverviewView.this.resourceGroupService.updateResourceGroup(group, new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError("Failed to change location of Resource group with id "
+ group.getId()
+ " from \"" + oldLocation + "\" to \"" + newLocation + "\".", caught);
- // We failed to update it on the Server, so change back the form item to the original value.
+ // We failed to update it on the Server, so change back the ResourceGroup and the form item
+ // to the original value.
+ group.setLocation(oldLocation);
locationItem.setValue(oldLocation);
}
@@ -176,7 +189,6 @@ public class OverviewView extends VLayout {
CoreGUI.getMessageCenter().notify(new Message("Location of Resource group with id "
+ group.getId() + " was changed from \""
+ oldLocation + "\" to \"" + newLocation + "\".", Message.Severity.Info));
- group.setLocation(newLocation);
}
});
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/overview/ResourceSummaryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/overview/ResourceSummaryView.java
index 56f84b6..4d98f82 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/overview/ResourceSummaryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/overview/ResourceSummaryView.java
@@ -50,6 +50,7 @@ import org.rhq.enterprise.gui.coregui.client.util.message.Message;
/**
* @author Greg Hinkle
+ * @author Ian Springer
*/
public class ResourceSummaryView extends EnhancedDynamicForm implements ResourceSelectListener {
@@ -152,13 +153,18 @@ public class ResourceSummaryView extends EnhancedDynamicForm implements Resource
togglableNameItem.addValueUpdatedHandler(new ValueUpdatedHandler() {
public void onValueUpdated(final String newName) {
final String oldName = resource.getName();
- ResourceSummaryView.this.resourceService.updateResourceName(resource.getId(),
- newName, new AsyncCallback<Void>() {
+ if (newName.equals(oldName)) {
+ return;
+ }
+ resource.setName(newName);
+ ResourceSummaryView.this.resourceService.updateResource(resource, new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError("Failed to change name of Resource with id "
+ resource.getId()
+ " from \"" + oldName + "\" to \"" + newName + "\".", caught);
- // We failed to update it on the Server, so change back the form item to the original value.
+ // We failed to update it on the Server, so change back the Resource and the form item to
+ // the original value.
+ resource.setName(oldName);
nameItem.setValue(oldName);
}
@@ -166,7 +172,6 @@ public class ResourceSummaryView extends EnhancedDynamicForm implements Resource
CoreGUI.getMessageCenter().notify(new Message("Name of Resource with id "
+ resource.getId() + " was changed from \""
+ oldName + "\" to \"" + newName + "\".", Message.Severity.Info));
- resource.setName(newName);
}
});
}
@@ -183,13 +188,18 @@ public class ResourceSummaryView extends EnhancedDynamicForm implements Resource
togglableDescriptionItem.addValueUpdatedHandler(new ValueUpdatedHandler() {
public void onValueUpdated(final String newDescription) {
final String oldDescription = resource.getDescription();
- ResourceSummaryView.this.resourceService.updateResourceDescription(resource.getId(),
- newDescription, new AsyncCallback<Void>() {
+ if (newDescription.equals(oldDescription)) {
+ return;
+ }
+ resource.setDescription(newDescription);
+ ResourceSummaryView.this.resourceService.updateResource(resource, new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError("Failed to change description of Resource with id "
+ resource.getId()
+ " from \"" + oldDescription + "\" to \"" + newDescription + "\".", caught);
- // We failed to update it on the Server, so change back the form item to the original value.
+ // We failed to update it on the Server, so change back the Resource and the form item to
+ // the original value.
+ resource.setDescription(oldDescription);
descriptionItem.setValue(oldDescription);
}
@@ -197,7 +207,6 @@ public class ResourceSummaryView extends EnhancedDynamicForm implements Resource
CoreGUI.getMessageCenter().notify(new Message("Description of Resource with id "
+ resource.getId() + " was changed from \""
+ oldDescription + "\" to \"" + newDescription + "\".", Message.Severity.Info));
- resource.setDescription(newDescription);
}
});
}
@@ -214,13 +223,18 @@ public class ResourceSummaryView extends EnhancedDynamicForm implements Resource
togglableNameItem.addValueUpdatedHandler(new ValueUpdatedHandler() {
public void onValueUpdated(final String newLocation) {
final String oldLocation = resource.getLocation();
- ResourceSummaryView.this.resourceService.updateResourceLocation(resource.getId(),
- newLocation, new AsyncCallback<Void>() {
+ if (newLocation.equals(oldLocation)) {
+ return;
+ }
+ resource.setLocation(newLocation);
+ ResourceSummaryView.this.resourceService.updateResource(resource, new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError("Failed to change location of Resource with id "
+ resource.getId()
+ " from \"" + oldLocation + "\" to \"" + newLocation + "\".", caught);
- // We failed to update it on the Server, so change back the form item to the original value.
+ // We failed to update it on the Server, so change back the Resource and the form item to
+ // the original value.
+ resource.setLocation(oldLocation);
locationItem.setValue(oldLocation);
}
@@ -228,7 +242,6 @@ public class ResourceSummaryView extends EnhancedDynamicForm implements Resource
CoreGUI.getMessageCenter().notify(new Message("Location of Resource with id "
+ resource.getId() + " was changed from \""
+ oldLocation + "\" to \"" + newLocation + "\".", Message.Severity.Info));
- resource.setLocation(newLocation);
}
});
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
index 56d91bd..c10254e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
@@ -127,7 +127,9 @@ public class ResourceGWTServiceImpl extends AbstractGWTServiceImpl implements Re
criteria);
List<Resource> resources = new ArrayList<Resource>(result.size());
- ObjectFilter.filterFieldsInCollection(resources, importantFieldsSet);
+ if (resources.size() > 1) {
+ ObjectFilter.filterFieldsInCollection(resources, importantFieldsSet);
+ }
return SerialUtility.prepare(result, "ResourceService.findResourceCompositesByCriteria");
} catch (Exception e) {
@@ -212,16 +214,5 @@ public class ResourceGWTServiceImpl extends AbstractGWTServiceImpl implements Re
public void unignoreResources(Integer[] resourceIds) {
discoveryBoss.unignoreResources(getSessionSubject(), resourceIds);
}
-
- public void updateResourceName(int resourceId, String name) {
- resourceManager.updateResourceName(getSessionSubject(), resourceId, name);
- }
-
- public void updateResourceDescription(int resourceId, String description) {
- resourceManager.updateResourceDescription(getSessionSubject(), resourceId, description);
- }
-
- public void updateResourceLocation(int resourceId, String location) {
- resourceManager.updateResourceLocation(getSessionSubject(), resourceId, location);
- }
+
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGroupGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGroupGWTServiceImpl.java
index d4dd777..31a4381 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGroupGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGroupGWTServiceImpl.java
@@ -31,7 +31,6 @@ import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
import org.rhq.enterprise.server.resource.group.definition.GroupDefinitionManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
-
/**
* @author Greg Hinkle
*/
@@ -75,15 +74,8 @@ public class ResourceGroupGWTServiceImpl extends AbstractGWTServiceImpl implemen
}
}
- public void updateResourceGroupName(int groupId, String name) {
- groupManager.updateResourceGroupName(getSessionSubject(), groupId, name);
- }
-
- public void updateResourceGroupDescription(int groupId, String description) {
- groupManager.updateResourceGroupDescription(getSessionSubject(), groupId, description);
+ public void updateResourceGroup(ResourceGroup group) {
+ groupManager.updateResourceGroup(getSessionSubject(), group);
}
- public void updateResourceGroupLocation(int groupId, String location) {
- groupManager.updateResourceGroupLocation(getSessionSubject(), groupId, location);
- }
}
\ No newline at end of file
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index 5051bdf..cb17046 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -285,6 +285,16 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
return result;
}
+ // local only
+ public void setResourceConfiguration(int resourceId, Configuration configuration) {
+ Resource resource = entityManager.find(Resource.class, resourceId);
+ if (resource == null) {
+ throw new ResourceNotFoundException("Resource [" + resourceId + "] does not exist.");
+ }
+ resource.setResourceConfiguration(configuration);
+ entityManager.merge(resource);
+ }
+
// Use new transaction because this only works if the resource in question has not
// yet been loaded by Hibernate. We want the query to return a non-proxied configuration,
// this is critical for remote API use.
@@ -2032,7 +2042,6 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
}
-
@SuppressWarnings("unchecked")
public PageList<ResourceConfigurationUpdate> findResourceConfigurationUpdatesByCriteria(
Subject subject, ResourceConfigurationUpdateCriteria criteria) {
@@ -2047,7 +2056,15 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
PageList<ResourceConfigurationUpdate> updates = queryRunner.execute();
-
return updates;
}
+
+
+ // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ //
+ // Remote Interface Impl
+ //
+ // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+ // ***TODO***: Move all remoted methods below this line.
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
index 495583e..fc61a48 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
@@ -490,6 +490,15 @@ public interface ConfigurationManagerLocal {
Configuration getResourceConfiguration(Subject subject, int resourceId);
/**
+ * This method is called when the plugin container reports a new Resource configuration after an external change was
+ * detected.
+ *
+ * @param resourceId the Resource's id
+ * @param configuration the updated configuration
+ */
+ void setResourceConfiguration(int resourceId, Configuration configuration);
+
+ /**
* @see ConfigurationManagerRemote#getPackageTypeConfigurationDefinition(Subject,int)
*/
ConfigurationDefinition getPackageTypeConfigurationDefinition(Subject subject, int packageTypeId);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationServerServiceImpl.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationServerServiceImpl.java
index 8932607..6ae1e16 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationServerServiceImpl.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationServerServiceImpl.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
+ * Copyright (C) 2005-2010 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -81,7 +81,10 @@ public class ConfigurationServerServiceImpl implements ConfigurationServerServic
}
Resource resource = update.getResource();
- resource.setResourceConfiguration(update.getConfiguration().deepCopy(false));
+ // First clone the config, zeroing out all id's.
+ Configuration configuration = update.getConfiguration().deepCopy(false);
+ configurationManager.setResourceConfiguration(resource.getId(), configuration);
+ resource.setResourceConfiguration(configuration);
resourceManager.updateResource(overlord, resource);
}
}
\ No newline at end of file
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
index 4804a73..7c34f0d 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
@@ -206,14 +206,29 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
}
public Resource updateResource(Subject user, Resource resource) {
+ Resource persistedResource = entityManager.find(Resource.class, resource.getId());
+ if (persistedResource == null) {
+ throw new ResourceNotFoundException(resource.getId());
+ }
+
if (!authorizationManager.hasResourcePermission(user, Permission.MODIFY_RESOURCE, resource.getId())) {
- throw new PermissionException("You do not have permission to modify resource");
+ throw new PermissionException("You do not have permission to modify Resource with id " + resource.getId()
+ + ".");
}
/*if (getResourceByParentAndKey(user, resource.getParentResource(), resource.getResourceKey()) != null)
* { throw new ResourceAlreadyExistsException("Resource with key '" + resource.getName() + "' already
* exists");}*/
- return entityManager.merge(resource);
+
+ persistedResource.setName(resource.getName());
+ persistedResource.setLocation(resource.getLocation());
+ persistedResource.setDescription(resource.getDescription());
+
+ // NOTE: Updating the mtime will tell the Agent it needs to sync this Resource.
+ persistedResource.setMtime(System.currentTimeMillis());
+ persistedResource.setModifiedBy(user.getName());
+
+ return entityManager.merge(persistedResource);
}
public List<Integer> uninventoryResources(Subject user, int[] resourceIds) {
@@ -2155,39 +2170,4 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
DisambiguationUpdateStrategy updateStrategy) {
return Disambiguator.disambiguate(results, updateStrategy, extractor, entityManager);
}
-
- public void updateResourceName(Subject subject, int resourceId, String name) {
- if (name == null) {
- throw new IllegalArgumentException("Resource name cannot be null.");
- }
- Resource resource = getResourceToBeModified(subject, resourceId);
- resource.setName(name);
- resource.setMtime(System.currentTimeMillis());
- }
-
- public void updateResourceDescription(Subject subject, int resourceId, String description) {
- Resource resource = getResourceToBeModified(subject, resourceId);
- resource.setDescription(description);
- resource.setMtime(System.currentTimeMillis());
- }
-
- public void updateResourceLocation(Subject subject, int resourceId, String location) {
- Resource resource = getResourceToBeModified(subject, resourceId);
- resource.setLocation(location);
- resource.setMtime(System.currentTimeMillis());
- }
-
- private Resource getResourceToBeModified(Subject subject, int resourceId) {
- Resource resource = entityManager.find(Resource.class, resourceId);
-
- if (resource == null) {
- throw new ResourceNotFoundException(resourceId);
- }
-
- if (!authorizationManager.hasResourcePermission(subject, Permission.MODIFY_RESOURCE, resourceId)) {
- throw new PermissionException("User [" + subject + "] does not have permission to modify Resource with id ["
- + resourceId + "].");
- }
- return resource;
- }
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java
index 3dd1fcb..d753c89 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java
@@ -74,10 +74,10 @@ public interface ResourceManagerLocal {
void createResource(Subject user, Resource resource, int parentId) throws ResourceAlreadyExistsException;
/**
- * Update an existing Resource.
+ * Update a Resource's editable properties (name, description, and location).
*
- * @param user the user updating the resource
- * @param resource the resource to be updated
+ * @param user the user updating the Resource
+ * @param resource the Resource to be updated
* @return the updated (attached) resource
*/
Resource updateResource(Subject user, Resource resource);
@@ -386,7 +386,7 @@ public interface ResourceManagerLocal {
* view of the platform inventory. This includes resource type and subcategory information
* as well as current availability and structure.
*
- * This method also returns placesholder {@link org.rhq.core.domain.resource.composite.LockedResourcerce}
+ * This method also returns placesholder {@link org.rhq.core.domain.resource.composite.LockedResource}
* objects for resources that a user should not have visibility to in order to keep the tree a
* directed graph.
*
@@ -455,10 +455,4 @@ public interface ResourceManagerLocal {
*/
<T> ResourceNamesDisambiguationResult<T> disambiguate(List<T> results, IntExtractor<? super T> resourceIdExtractor,
DisambiguationUpdateStrategy updateStrategy);
-
- void updateResourceName(Subject subject, int resourceId, String name);
-
- void updateResourceDescription(Subject subject, int resourceId, String description);
-
- void updateResourceLocation(Subject subject, int resourceId, String location);
}
\ No newline at end of file
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerRemote.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerRemote.java
index 2eb9d62..b3fbce0 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerRemote.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerRemote.java
@@ -100,6 +100,10 @@ public interface ResourceManagerRemote {
@WebParam(name = "subject") Subject subject, //
@WebParam(name = "resourceId") int resourceId);
+ Resource updateResource( //
+ @WebParam(name = "subject") Subject user, //
+ @WebParam(name = "resource") Resource resource);
+
/**
* Removes these resources from inventory. The resources may subsequently be rediscovered. Note that for
* each specified resource all children will also be removed, it it not necessary or recommended to
@@ -137,22 +141,4 @@ public interface ResourceManagerRemote {
Resource getParentResource( //
@WebParam(name = "subject") Subject subject, //
@WebParam(name = "resourceId") int resourceId);
-
- @WebMethod
- void updateResourceName( //
- @WebParam(name = "subject") Subject subject, //
- @WebParam(name = "resourceId") int resourceId, //
- @WebParam(name = "name") String name);
-
- @WebMethod
- void updateResourceDescription( //
- @WebParam(name = "subject") Subject subject, //
- @WebParam(name = "resourceId") int resourceId, //
- @WebParam(name = "description") String description);
-
- @WebMethod
- void updateResourceLocation( //
- @WebParam(name = "subject") Subject subject, //
- @WebParam(name = "resourceId") int resourceId, //
- @WebParam(name = "location") String location);
}
\ No newline at end of file
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceNotFoundException.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceNotFoundException.java
index 7c31d96..946d7e3 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceNotFoundException.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceNotFoundException.java
@@ -35,7 +35,7 @@ public class ResourceNotFoundException extends RuntimeException {
* @param resourceId a resource id
*/
public ResourceNotFoundException(int resourceId) {
- super("A resource with id " + resourceId + " does not exist in inventory.");
+ super("A Resource with id " + resourceId + " does not exist in inventory.");
}
public ResourceNotFoundException(String message) {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java
index 987015b..43c6f0f 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java
@@ -90,7 +90,6 @@ import org.rhq.enterprise.server.jaxb.adapter.ResourceGroupAdapter;
import org.rhq.enterprise.server.operation.GroupOperationSchedule;
import org.rhq.enterprise.server.operation.OperationManagerLocal;
import org.rhq.enterprise.server.resource.ResourceManagerLocal;
-import org.rhq.enterprise.server.resource.ResourceNotFoundException;
import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
@@ -175,9 +174,17 @@ public class ResourceGroupManagerBean implements ResourceGroupManagerLocal, Reso
throws ResourceGroupUpdateException {
int groupId = group.getId();
+ ResourceGroup attachedGroup = entityManager.find(ResourceGroup.class, groupId);
+ if (attachedGroup == null) {
+ throw new ResourceGroupNotFoundException(groupId);
+ }
+
+ if (!authorizationManager.hasGroupPermission(user, Permission.MODIFY_RESOURCE, groupId)) {
+ throw new PermissionException("User [" + user + "] does not have permission to modify Resource group with id ["
+ + groupId + "].");
+ }
if (changeType == null) {
- ResourceGroup attachedGroup = entityManager.find(ResourceGroup.class, groupId);
changeType = RecursivityChangeType.None;
if (attachedGroup.isRecursive() == true && group.isRecursive() == false) {
// making a recursive group into a "normal" group
@@ -189,9 +196,8 @@ public class ResourceGroupManagerBean implements ResourceGroupManagerLocal, Reso
// recursive bit didn't change
}
}
-
- long time = System.currentTimeMillis();
- group.setMtime(time);
+
+ group.setMtime(System.currentTimeMillis());
group.setModifiedBy(user.getName());
ResourceGroup newlyAttachedGroup = entityManager.merge(group);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerLocal.java
index 8ed40b6..9b0468b 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerLocal.java
@@ -138,10 +138,5 @@ public interface ResourceGroupManagerLocal {
ResourceGroup updateResourceGroup(Subject subject, ResourceGroup group);
PageList<ResourceGroup> findResourceGroupsByCriteria(Subject subject, ResourceGroupCriteria criteria);
-
- void updateResourceGroupName(Subject subject, int groupId, String name);
-
- void updateResourceGroupDescription(Subject subject, int groupId, String description);
-
- void updateResourceGroupLocation(Subject subject, int groupId, String location);
+
}
\ No newline at end of file
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerRemote.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerRemote.java
index 8907ea9..fdda4e2 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerRemote.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerRemote.java
@@ -97,21 +97,4 @@ public interface ResourceGroupManagerRemote {
@WebParam(name = "subject") Subject subject, //
@WebParam(name = "criteria") ResourceGroupCriteria criteria);
- @WebMethod
- void updateResourceGroupName( //
- @WebParam(name = "subject") Subject subject, //
- @WebParam(name = "groupId") int groupId, //
- @WebParam(name = "name") String name);
-
- @WebMethod
- void updateResourceGroupDescription( //
- @WebParam(name = "subject") Subject subject, //
- @WebParam(name = "groupId") int groupId, //
- @WebParam(name = "description") String description);
-
- @WebMethod
- void updateResourceGroupLocation( //
- @WebParam(name = "subject") Subject subject, //
- @WebParam(name = "groupId") int groupId, //
- @WebParam(name = "location") String location);
}
commit 8772b4ebacc2d74f66b24dd744ea843450da4082
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Aug 13 12:38:43 2010 -0400
only display Connection Settings subtab when appropriate; some failed attempts to get subtabs to deraw after selecting a different Resource
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
index eb66445..cda5761 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
@@ -20,6 +20,7 @@ package org.rhq.enterprise.gui.coregui.client.components.tab;
import java.util.HashSet;
import java.util.LinkedHashMap;
+import java.util.Map;
import java.util.Set;
import com.google.gwt.event.shared.HandlerManager;
@@ -40,7 +41,7 @@ public class SubTabLayout extends VLayout {
ToolStrip buttonBar;
- LinkedHashMap<String, Canvas> subtabs = new LinkedHashMap<String, Canvas>();
+ Map<String, Canvas> subtabs = new LinkedHashMap<String, Canvas>();
Set<String> disabledSubTabs = new HashSet<String>();
Canvas currentlyDisplayed;
@@ -115,11 +116,15 @@ public class SubTabLayout extends VLayout {
}
public void enableSubTab(String title) {
- disabledSubTabs.remove(title);
+ if (disabledSubTabs.remove(title)) {
+ markForRedraw();
+ }
}
public void disableSubTab(String title) {
- disabledSubTabs.add(title);
+ if (disabledSubTabs.add(title)) {
+ markForRedraw();
+ }
}
public void updateSubTab(String title, Canvas canvas) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java
index c335dc9..cc5cac4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java
@@ -28,6 +28,7 @@ public class TwoLevelTab extends Tab {
private SubTabLayout layout;
+
public TwoLevelTab(String title, String icon) {
super(title, icon);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java
index b12304c..e5cacf8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java
@@ -30,7 +30,6 @@ import com.smartgwt.client.widgets.tab.events.TabSelectedHandler;
*/
public class TwoLevelTabSet extends TabSet implements TabSelectedHandler, TwoLevelTabSelectedHandler {
-
public void setTabs(TwoLevelTab... tabs) {
super.setTabs(tabs);
for (TwoLevelTab tab : tabs) {
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 51c225a..8fff6e2 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
@@ -203,11 +203,16 @@ public class ResourceGroupDetailView extends VLayout implements BookmarkableView
private void completeTabUpdate() {
+ GroupCategory groupCategory = groupComposite.getResourceGroup().getGroupCategory();
+ Set<ResourceTypeFacet> facets = groupComposite.getResourceFacets().getFacets();
+
// Summary and Inventory tabs are always enabled.
topTabSet.enableTab(summaryTab);
topTabSet.enableTab(inventoryTab);
- GroupCategory groupCategory = groupComposite.getResourceGroup().getGroupCategory();
+ // Inventory>Connection Settings subtab is only enabled for compat groups that define conn props.
+ inventoryTab.setSubTabEnabled("Connection Settings",
+ groupCategory == GroupCategory.COMPATIBLE && facets.contains(ResourceTypeFacet.PLUGIN_CONFIGURATION));
// Monitoring and Alerts tabs are always enabled for compatible groups and always disabled for mixed groups.
if (groupCategory == GroupCategory.COMPATIBLE) {
@@ -219,8 +224,7 @@ public class ResourceGroupDetailView extends VLayout implements BookmarkableView
}
// Operations tab is only enabled for compatible groups of a type that supports the Operations facet.
- Set<ResourceTypeFacet> typeFacets = groupComposite.getResourceFacets().getFacets();
- if (typeFacets.contains(ResourceTypeFacet.OPERATION)) {
+ if (facets.contains(ResourceTypeFacet.OPERATION)) {
topTabSet.enableTab(operationsTab);
} else {
topTabSet.disableTab(operationsTab);
@@ -228,21 +232,21 @@ public class ResourceGroupDetailView extends VLayout implements BookmarkableView
// Configuration tab is only enabled for compatible groups of a type that supports the Configuration facet
// and when the current user has the CONFIGURE_READ permission.
- if (typeFacets.contains(ResourceTypeFacet.CONFIGURATION) && permissions.isConfigureRead()) {
+ if (facets.contains(ResourceTypeFacet.CONFIGURATION) && permissions.isConfigureRead()) {
topTabSet.enableTab(configurationTab);
} else {
topTabSet.disableTab(configurationTab);
}
// Events tab is only enabled for compatible groups of a type that supports the Events facet.
- if (typeFacets.contains(ResourceTypeFacet.EVENT)) {
+ if (facets.contains(ResourceTypeFacet.EVENT)) {
topTabSet.enableTab(eventsTab);
} else {
topTabSet.disableTab(eventsTab);
}
// only enable "Call Time" sub-tab for those that implement it
- monitoringTab.setSubTabEnabled("Call Time", typeFacets.contains(ResourceTypeFacet.CALL_TIME));
+ monitoringTab.setSubTabEnabled("Call Time", facets.contains(ResourceTypeFacet.CALL_TIME));
}
public void onTabSelected(TwoLevelTabSelectedEvent tabSelectedEvent) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index 5c2e94f..2a7183e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -23,8 +23,8 @@ import com.smartgwt.client.types.Side;
import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceTypeFacet;
import org.rhq.core.domain.resource.composite.ResourceComposite;
-import org.rhq.core.domain.resource.composite.ResourceFacets;
import org.rhq.core.domain.resource.composite.ResourcePermission;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
@@ -43,6 +43,8 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.GraphListView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.overview.ResourceOverviewView;
+import java.util.Set;
+
/**
* Right panel of the Resource view.
*
@@ -201,41 +203,44 @@ public class ResourceDetailView extends VLayout implements BookmarkableView, Res
private void completeTabUpdate() {
ResourcePermission permissions = this.resourceComposite.getResourcePermission();
- ResourceFacets facets = this.resourceComposite.getResourceFacets();
+ Set<ResourceTypeFacet> facets = this.resourceComposite.getResourceFacets().getFacets();
// Summary, Monitoring, Inventory, and Alerts tabs are always enabled.
- monitoringTab.setSubTabEnabled("Call Time", facets.isCallTime());
+ monitoringTab.setSubTabEnabled("Call Time", facets.contains(ResourceTypeFacet.CALL_TIME));
+
+ inventoryTab.setSubTabEnabled("Connection Settings", facets.contains(ResourceTypeFacet.PLUGIN_CONFIGURATION));
- if (facets.isOperation()) {
+ if (facets.contains(ResourceTypeFacet.OPERATION)) {
topTabSet.enableTab(operationsTab);
} else {
topTabSet.disableTab(operationsTab);
}
- if (facets.isConfiguration() && permissions.isConfigureRead()) {
+ if (facets.contains(ResourceTypeFacet.CONFIGURATION) && permissions.isConfigureRead()) {
topTabSet.enableTab(configurationTab);
} else {
topTabSet.disableTab(configurationTab);
}
- if (facets.isEvent()) {
+ if (facets.contains(ResourceTypeFacet.EVENT)) {
topTabSet.enableTab(eventsTab);
} else {
topTabSet.disableTab(eventsTab);
}
- if (facets.isContent()) {
+ if (facets.contains(ResourceTypeFacet.CONTENT)) {
topTabSet.enableTab(contentTab);
} else {
topTabSet.disableTab(contentTab);
}
-
if (topTabSet.getSelectedTab().getDisabled()) {
topTabSet.selectTab(0);
}
+ // TODO: This doesn't seem to actually be calling redraw(), draw(), or onDraw() on topTabSet, so subtab
+ // enablement isn't getting updated...
topTabSet.markForRedraw();
}
13 years, 10 months
[rhq] 2 commits - modules/core modules/enterprise
by mazz
modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertDefinition.java | 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java | 106 +++++-----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ConditionsAlertDefinitionForm.java | 25 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/DampeningAlertDefinitionForm.java | 21 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GeneralPropertiesAlertDefinitionForm.java | 59 +++--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/NotificationsAlertDefinitionForm.java | 21 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/RecoveryAlertDefinitionForm.java | 7
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsView.java | 19 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/SingleAlertDefinitionView.java | 1
9 files changed, 174 insertions(+), 93 deletions(-)
New commits:
commit 1c98f96a1d2751aacd48ff4ba6b07666906b7dc9
Merge: 761b250... 40fc34f...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Aug 13 13:17:53 2010 -0400
Merge branch 'alert-def-gwt'
commit 40fc34f2b200c1ea90e8faf26cae4f0bd2c03658
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Aug 13 13:16:08 2010 -0400
the general properties tab now works nicely.
starting the "edit" feature. still doesn't store anything to the DB yet
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertDefinition.java b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertDefinition.java
index 807d3d3..31be645 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertDefinition.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertDefinition.java
@@ -623,6 +623,14 @@ public class AlertDefinition implements Serializable {
this.deleted = deleted;
}
+ /**
+ * A definition is "read-only" with respect to updates that come from the group/template level.
+ * If "read only" is true, then changes to the parent group/template alert definition will not
+ * change this resource alert def. If read only is false, changes to the parent propagate to the
+ * child resource alert.
+ *
+ * @return read only flag
+ */
public boolean isReadOnly() {
return this.readOnly;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java
index 6c6aa9f..4a57272 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java
@@ -39,6 +39,7 @@ import org.rhq.enterprise.gui.coregui.client.components.table.Table.SelectionEna
public abstract class AbstractAlertDefinitionsView extends VLayout {
private SingleAlertDefinitionView singleAlertDefinitionView;
+ private Table alertDefinitionsTable;
public AbstractAlertDefinitionsView() {
setWidth100();
@@ -51,11 +52,11 @@ public abstract class AbstractAlertDefinitionsView extends VLayout {
super.onDraw();
Criteria criteria = getCriteria();
- final Table table = new Table(getTableTitle(), criteria);
- table.setDataSource(getAlertDefinitionDataSource());
- table.getListGrid().setUseAllDataSourceFields(true);
+ alertDefinitionsTable = new Table(getTableTitle(), criteria);
+ alertDefinitionsTable.setDataSource(getAlertDefinitionDataSource());
+ alertDefinitionsTable.getListGrid().setUseAllDataSourceFields(true);
- table.getListGrid().addSelectionChangedHandler(new SelectionChangedHandler() {
+ alertDefinitionsTable.getListGrid().addSelectionChangedHandler(new SelectionChangedHandler() {
public void onSelectionChanged(SelectionEvent selectionEvent) {
AlertDefinition alertDef = null;
ListGridRecord selectedRecord = null;
@@ -64,16 +65,11 @@ public abstract class AbstractAlertDefinitionsView extends VLayout {
selectedRecord = allSelections[0];
}
if (selectedRecord != null) {
- alertDef = ((AbstractAlertDefinitionsDataSource) table.getDataSource()).copyValues(selectedRecord);
- table.setHeight("33%");
- table.setShowResizeBar(true);
- singleAlertDefinitionView.setHeight("67%");
- singleAlertDefinitionView.show();
- singleAlertDefinitionView.setAlertDefinition(alertDef);
+ alertDef = ((AbstractAlertDefinitionsDataSource) alertDefinitionsTable.getDataSource())
+ .copyValues(selectedRecord);
+ showSingleAlertDefinitionView(alertDef);
} else {
- table.setHeight100();
- table.setShowResizeBar(false);
- singleAlertDefinitionView.hide();
+ hideSingleAlertDefinitionView();
}
markForRedraw();
}
@@ -81,49 +77,63 @@ public abstract class AbstractAlertDefinitionsView extends VLayout {
boolean permitted = isAllowedToModifyAlerts();
- table.addTableAction("New", (permitted) ? SelectionEnablement.ALWAYS : SelectionEnablement.NEVER, null,
- new TableAction() {
- public void executeAction(ListGridRecord[] selection) {
- newButtonPressed(selection);
- CoreGUI.refresh();
- }
- });
+ alertDefinitionsTable.addTableAction("New", (permitted) ? SelectionEnablement.ALWAYS
+ : SelectionEnablement.NEVER, null, new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ newButtonPressed(selection);
+ CoreGUI.refresh();
+ }
+ });
- table.addTableAction("Enable", (permitted) ? SelectionEnablement.ANY : SelectionEnablement.NEVER,
- "Are You Sure?", new TableAction() {
- public void executeAction(ListGridRecord[] selection) {
- enableButtonPressed(selection);
- CoreGUI.refresh();
- }
- });
+ alertDefinitionsTable.addTableAction("Enable", (permitted) ? SelectionEnablement.ANY
+ : SelectionEnablement.NEVER, "Are You Sure?", new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ enableButtonPressed(selection);
+ CoreGUI.refresh();
+ }
+ });
- table.addTableAction("Disable", (permitted) ? SelectionEnablement.ANY : SelectionEnablement.NEVER,
- "Are You Sure?", new TableAction() {
- public void executeAction(ListGridRecord[] selection) {
- disableButtonPressed(selection);
- }
- });
+ alertDefinitionsTable.addTableAction("Disable", (permitted) ? SelectionEnablement.ANY
+ : SelectionEnablement.NEVER, "Are You Sure?", new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ disableButtonPressed(selection);
+ }
+ });
- table.addTableAction("Delete", (permitted) ? SelectionEnablement.ANY : SelectionEnablement.NEVER,
- "Are You Sure?", new TableAction() {
- public void executeAction(ListGridRecord[] selection) {
- deleteButtonPressed(selection);
- CoreGUI.refresh();
- }
- });
+ alertDefinitionsTable.addTableAction("Delete", (permitted) ? SelectionEnablement.ANY
+ : SelectionEnablement.NEVER, "Are You Sure?", new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ deleteButtonPressed(selection);
+ CoreGUI.refresh();
+ }
+ });
- addMember(table);
+ addMember(alertDefinitionsTable);
- this.singleAlertDefinitionView = buildSingleAlertDefinitionView();
- this.singleAlertDefinitionView.hide();
- this.singleAlertDefinitionView.setWidth100();
- this.singleAlertDefinitionView.setHeight100();
- this.singleAlertDefinitionView.setMargin(10);
- addMember(this.singleAlertDefinitionView);
+ singleAlertDefinitionView = buildSingleAlertDefinitionView();
+ singleAlertDefinitionView.hide();
+ singleAlertDefinitionView.setWidth100();
+ singleAlertDefinitionView.setHeight100();
+ singleAlertDefinitionView.setMargin(10);
+ addMember(singleAlertDefinitionView);
}
protected SingleAlertDefinitionView getSingleAlertDefinitionView() {
- return this.singleAlertDefinitionView;
+ return singleAlertDefinitionView;
+ }
+
+ protected void showSingleAlertDefinitionView(AlertDefinition alertDef) {
+ alertDefinitionsTable.setHeight("33%");
+ alertDefinitionsTable.setShowResizeBar(true);
+ singleAlertDefinitionView.setHeight("67%");
+ singleAlertDefinitionView.show();
+ singleAlertDefinitionView.setAlertDefinition(alertDef);
+ }
+
+ protected void hideSingleAlertDefinitionView() {
+ alertDefinitionsTable.setHeight100();
+ alertDefinitionsTable.setShowResizeBar(false);
+ singleAlertDefinitionView.hide();
}
protected SingleAlertDefinitionView buildSingleAlertDefinitionView() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ConditionsAlertDefinitionForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ConditionsAlertDefinitionForm.java
index 3f91844..819260f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ConditionsAlertDefinitionForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ConditionsAlertDefinitionForm.java
@@ -38,6 +38,8 @@ public class ConditionsAlertDefinitionForm extends DynamicForm implements EditAl
private SelectItem conditionExpression;
+ private boolean formBuilt = false;
+
public ConditionsAlertDefinitionForm() {
this(null);
}
@@ -50,7 +52,7 @@ public class ConditionsAlertDefinitionForm extends DynamicForm implements EditAl
protected void onDraw() {
super.onDraw();
- if (conditionExpression == null) {
+ if (!formBuilt) {
buildForm();
setAlertDefinition(alertDefinition);
makeViewOnly();
@@ -59,12 +61,14 @@ public class ConditionsAlertDefinitionForm extends DynamicForm implements EditAl
@Override
public AlertDefinition getAlertDefinition() {
- return this.alertDefinition;
+ return alertDefinition;
}
@Override
public void setAlertDefinition(AlertDefinition alertDef) {
- this.alertDefinition = alertDef;
+ alertDefinition = alertDef;
+
+ buildForm();
if (alertDef == null) {
clearFormValues();
@@ -94,13 +98,20 @@ public class ConditionsAlertDefinitionForm extends DynamicForm implements EditAl
@Override
public void clearFormValues() {
conditionExpression.clearValue();
+
+ markForRedraw();
}
private void buildForm() {
- conditionExpression = new SelectItem("conditionExpression", "Fire alert when");
- conditionExpression.setValueMap(BooleanExpression.ALL.toString(), BooleanExpression.ANY.toString());
- conditionExpression.setDefaultValue(BooleanExpression.ALL.toString());
+ if (!formBuilt) {
- setFields(conditionExpression);
+ conditionExpression = new SelectItem("conditionExpression", "Fire alert when");
+ conditionExpression.setValueMap(BooleanExpression.ALL.toString(), BooleanExpression.ANY.toString());
+ conditionExpression.setDefaultValue(BooleanExpression.ALL.toString());
+
+ setFields(conditionExpression);
+
+ formBuilt = true;
+ }
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/DampeningAlertDefinitionForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/DampeningAlertDefinitionForm.java
index adf2173..5590af6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/DampeningAlertDefinitionForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/DampeningAlertDefinitionForm.java
@@ -34,6 +34,8 @@ public class DampeningAlertDefinitionForm extends DynamicForm implements EditAle
private AlertDefinition alertDefinition;
+ private boolean formBuilt = false;
+
public DampeningAlertDefinitionForm() {
this(null);
}
@@ -46,8 +48,7 @@ public class DampeningAlertDefinitionForm extends DynamicForm implements EditAle
protected void onDraw() {
super.onDraw();
- // TODO only build form if we didn't do it yet
- if (true) {
+ if (!formBuilt) {
buildForm();
setAlertDefinition(alertDefinition);
makeViewOnly();
@@ -56,12 +57,14 @@ public class DampeningAlertDefinitionForm extends DynamicForm implements EditAle
@Override
public AlertDefinition getAlertDefinition() {
- return this.alertDefinition;
+ return alertDefinition;
}
@Override
public void setAlertDefinition(AlertDefinition alertDef) {
- this.alertDefinition = alertDef;
+ alertDefinition = alertDef;
+
+ buildForm();
if (alertDef == null) {
clearFormValues();
@@ -90,10 +93,16 @@ public class DampeningAlertDefinitionForm extends DynamicForm implements EditAle
@Override
public void clearFormValues() {
// TODO component.clearValue();
+
+ markForRedraw();
}
private void buildForm() {
- // TODO build components
- // TODO setFields(components);
+ if (!formBuilt) {
+ // TODO build components
+ // TODO setFields(components);
+
+ formBuilt = true;
+ }
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GeneralPropertiesAlertDefinitionForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GeneralPropertiesAlertDefinitionForm.java
index 712013c..3b46437 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GeneralPropertiesAlertDefinitionForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GeneralPropertiesAlertDefinitionForm.java
@@ -23,6 +23,8 @@
package org.rhq.enterprise.gui.coregui.client.alert.definitions;
+import java.util.LinkedHashMap;
+
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.RadioGroupItem;
import com.smartgwt.client.widgets.form.fields.SelectItem;
@@ -75,12 +77,12 @@ public class GeneralPropertiesAlertDefinitionForm extends DynamicForm implements
@Override
public AlertDefinition getAlertDefinition() {
- return this.alertDefinition;
+ return alertDefinition;
}
@Override
public void setAlertDefinition(AlertDefinition alertDef) {
- this.alertDefinition = alertDef;
+ alertDefinition = alertDef;
buildForm();
@@ -93,7 +95,7 @@ public class GeneralPropertiesAlertDefinitionForm extends DynamicForm implements
descriptionTextField.setValue(alertDef.getDescription());
descriptionStatic.setValue(alertDef.getDescription());
- prioritySelection.setValue(alertDef.getPriority().getDisplayName());
+ prioritySelection.setValue(alertDef.getPriority().name());
priorityStatic.setValue(alertDef.getPriority().getDisplayName());
enabledSelection.setValue(alertDef.getEnabled() ? "Yes" : "No");
@@ -123,11 +125,15 @@ public class GeneralPropertiesAlertDefinitionForm extends DynamicForm implements
readOnlySelection.show();
readOnlyStatic.hide();
- Integer parentId = this.alertDefinition.getParentId();
- if ((parentId == null || parentId.intValue() == 0) && (this.alertDefinition.getGroupAlertDefinition() == null)) {
- readOnlySelection.hide();
+ if (alertDefinition != null) {
+ Integer parentId = alertDefinition.getParentId();
+ if ((parentId == null || parentId.intValue() == 0) && (alertDefinition.getGroupAlertDefinition() == null)) {
+ readOnlySelection.hide();
+ } else {
+ readOnlySelection.show();
+ }
} else {
- readOnlySelection.show();
+ readOnlySelection.hide();
}
readOnlyStatic.hide();
@@ -151,11 +157,15 @@ public class GeneralPropertiesAlertDefinitionForm extends DynamicForm implements
readOnlySelection.hide();
readOnlyStatic.show();
- Integer parentId = this.alertDefinition.getParentId();
- if ((parentId == null || parentId.intValue() == 0) && (this.alertDefinition.getGroupAlertDefinition() == null)) {
- readOnlyStatic.hide();
+ if (alertDefinition != null) {
+ Integer parentId = alertDefinition.getParentId();
+ if ((parentId == null || parentId.intValue() == 0) && (alertDefinition.getGroupAlertDefinition() == null)) {
+ readOnlyStatic.hide();
+ } else {
+ readOnlyStatic.show();
+ }
} else {
- readOnlyStatic.show();
+ readOnlyStatic.hide();
}
readOnlySelection.hide();
@@ -164,7 +174,14 @@ public class GeneralPropertiesAlertDefinitionForm extends DynamicForm implements
@Override
public void saveAlertDefinition() {
- // TODO Auto-generated method stub
+ alertDefinition.setName(nameTextField.getValue().toString());
+ alertDefinition.setDescription(descriptionTextField.getValue().toString());
+
+ String prioritySelected = prioritySelection.getValue().toString();
+ alertDefinition.setPriority(AlertPriority.valueOf(prioritySelected));
+
+ alertDefinition.setEnabled("Yes".equals(enabledSelection.getValue()));
+ alertDefinition.setReadOnly("Yes".equals(readOnlySelection.getValue()));
}
@Override
@@ -188,16 +205,21 @@ public class GeneralPropertiesAlertDefinitionForm extends DynamicForm implements
if (!formBuilt) {
nameTextField = new TextItem("name", "Name");
nameTextField.setWidth(300);
+ nameTextField.setDefaultValue("");
nameStatic = new StaticTextItem("nameStatic", "Name");
descriptionTextField = new TextAreaItem("description", "Description");
descriptionTextField.setWidth(300);
+ descriptionTextField.setDefaultValue("");
descriptionStatic = new StaticTextItem("descriptionStatic", "Description");
prioritySelection = new SelectItem("priority", "Priority");
- prioritySelection.setValueMap(AlertPriority.HIGH.getDisplayName(), AlertPriority.MEDIUM.getDisplayName(),
- AlertPriority.LOW.getDisplayName());
- prioritySelection.setDefaultValue(AlertPriority.MEDIUM.getDisplayName());
+ LinkedHashMap<String, String> priorities = new LinkedHashMap<String, String>(3);
+ priorities.put(AlertPriority.HIGH.name(), AlertPriority.HIGH.getDisplayName());
+ priorities.put(AlertPriority.MEDIUM.name(), AlertPriority.MEDIUM.getDisplayName());
+ priorities.put(AlertPriority.LOW.name(), AlertPriority.LOW.getDisplayName());
+ prioritySelection.setValueMap(priorities);
+ prioritySelection.setDefaultValue(AlertPriority.MEDIUM.name());
priorityStatic = new StaticTextItem("priorityStatic", "Priority");
enabledSelection = new RadioGroupItem("enabled", "Enabled");
@@ -205,11 +227,12 @@ public class GeneralPropertiesAlertDefinitionForm extends DynamicForm implements
enabledSelection.setDefaultValue("Yes");
enabledStatic = new StaticTextItem("enabledStatic", "Enabled");
- readOnlySelection = new RadioGroupItem("readOnly", "Read Only");
+ readOnlySelection = new RadioGroupItem("readOnly", "Protected");
readOnlySelection.setValueMap("Yes", "No");
readOnlySelection.setDefaultValue("Yes");
- readOnlySelection.setPrompt("If true, the parent definition will not override this alert definition");
- readOnlyStatic = new StaticTextItem("readOnlyStatic", "Read Only");
+ readOnlySelection
+ .setPrompt("If true, this definition is protected from being changed by the parent definition. In other words, the parent definition settings will not override this definition.");
+ readOnlyStatic = new StaticTextItem("readOnlyStatic", "Protected");
setFields(nameTextField, nameStatic, descriptionTextField, descriptionStatic, prioritySelection,
priorityStatic, enabledSelection, enabledStatic, readOnlySelection, readOnlyStatic);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/NotificationsAlertDefinitionForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/NotificationsAlertDefinitionForm.java
index 948656a..ab79d1c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/NotificationsAlertDefinitionForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/NotificationsAlertDefinitionForm.java
@@ -34,6 +34,8 @@ public class NotificationsAlertDefinitionForm extends DynamicForm implements Edi
private AlertDefinition alertDefinition;
+ private boolean formBuilt = false;
+
public NotificationsAlertDefinitionForm() {
this(null);
}
@@ -46,8 +48,7 @@ public class NotificationsAlertDefinitionForm extends DynamicForm implements Edi
protected void onDraw() {
super.onDraw();
- // TODO only build form if we didn't do it yet
- if (true) {
+ if (!formBuilt) {
buildForm();
setAlertDefinition(alertDefinition);
makeViewOnly();
@@ -56,12 +57,14 @@ public class NotificationsAlertDefinitionForm extends DynamicForm implements Edi
@Override
public AlertDefinition getAlertDefinition() {
- return this.alertDefinition;
+ return alertDefinition;
}
@Override
public void setAlertDefinition(AlertDefinition alertDef) {
- this.alertDefinition = alertDef;
+ alertDefinition = alertDef;
+
+ buildForm();
if (alertDef == null) {
clearFormValues();
@@ -90,10 +93,16 @@ public class NotificationsAlertDefinitionForm extends DynamicForm implements Edi
@Override
public void clearFormValues() {
// TODO component.clearValue();
+
+ markForRedraw();
}
private void buildForm() {
- // TODO build components
- // TODO setFields(components);
+ if (!formBuilt) {
+ // TODO build components
+ // TODO setFields(components);
+
+ formBuilt = true;
+ }
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/RecoveryAlertDefinitionForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/RecoveryAlertDefinitionForm.java
index e95c771..cff9ad7 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/RecoveryAlertDefinitionForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/RecoveryAlertDefinitionForm.java
@@ -62,12 +62,12 @@ public class RecoveryAlertDefinitionForm extends DynamicForm implements EditAler
@Override
public AlertDefinition getAlertDefinition() {
- return this.alertDefinition;
+ return alertDefinition;
}
@Override
public void setAlertDefinition(AlertDefinition alertDef) {
- this.alertDefinition = alertDef;
+ alertDefinition = alertDef;
buildForm();
@@ -99,6 +99,8 @@ public class RecoveryAlertDefinitionForm extends DynamicForm implements EditAler
public void clearFormValues() {
recoverAlertSelection.clearValue();
disableWhenFiredSelection.clearValue();
+
+ markForRedraw();
}
private void buildForm() {
@@ -113,6 +115,7 @@ public class RecoveryAlertDefinitionForm extends DynamicForm implements EditAler
disableWhenFiredSelection.setDefaultValue("Yes");
setFields(recoverAlertSelection, disableWhenFiredSelection);
+
formBuilt = true;
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsView.java
index 36c146c..6d01e26 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsView.java
@@ -27,6 +27,8 @@ import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.grid.ListGridRecord;
+import org.rhq.core.domain.alert.AlertDefinition;
+import org.rhq.core.domain.alert.AlertPriority;
import org.rhq.core.domain.resource.Resource;
/**
@@ -68,12 +70,17 @@ public class ResourceAlertDefinitionsView extends AbstractAlertDefinitionsView {
@Override
protected void newButtonPressed(ListGridRecord[] selection) {
- // TODO Auto-generated method stub
- String str = "this is not implemented yet but you selected";
- for (ListGridRecord record : selection) {
- str += ": " + record.getAttribute("name");
- }
- SC.say(str);
+ // create an empty one with all defaults
+ AlertDefinition newAlertDef = new AlertDefinition();
+ newAlertDef.setDeleted(false);
+ newAlertDef.setEnabled(true);
+ newAlertDef.setNotifyFiltered(false);
+ newAlertDef.setParentId(Integer.valueOf(0));
+ newAlertDef.setPriority(AlertPriority.MEDIUM);
+ newAlertDef.setWillRecover(false);
+
+ showSingleAlertDefinitionView(newAlertDef);
+ getSingleAlertDefinitionView().makeEditable();
}
@Override
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/SingleAlertDefinitionView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/SingleAlertDefinitionView.java
index eff934f..810d31e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/SingleAlertDefinitionView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/SingleAlertDefinitionView.java
@@ -107,6 +107,7 @@ public class SingleAlertDefinitionView extends VLayout {
@Override
public void onClick(ClickEvent event) {
saveAlertDefinition();
+ setAlertDefinition(getAlertDefinition()); // loads data into static fields
makeViewOnly();
// TODO getAlertDefinition() should now have the new user data - commit it to DB
13 years, 10 months
[rhq] modules/core
by Joseph Marques
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementScheduleCriteria.java | 6 ++++++
1 file changed, 6 insertions(+)
New commits:
commit 761b250755f3b21feeace531c324afeb13b36d54
Author: Joseph Marques <joseph(a)redhat.com>
Date: Fri Aug 13 10:12:00 2010 -0400
add the missing pieces to finish up filtering MeasurementSchedules by resourceTypeId
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementScheduleCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementScheduleCriteria.java
index c82c98e..a4c8a09 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementScheduleCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementScheduleCriteria.java
@@ -53,6 +53,7 @@ public class MeasurementScheduleCriteria extends Criteria {
// filter fields
public static final String FILTER_FIELD_RESOURCE_ID = "resourceId";
public static final String FILTER_FIELD_RESOURCE_GROUP_ID = "resourceGroupId";
+ public static final String FILTER_FIELD_RESOURCE_TYPE_ID = "resourceTypeId";
private Integer filterId;
private Boolean filterEnabled;
@@ -89,6 +90,7 @@ public class MeasurementScheduleCriteria extends Criteria {
+ " FROM Resource res " //
+ " JOIN res.parentResource parent " //
+ " WHERE parent.id = ? )");
+ filterOverrides.put(FILTER_FIELD_RESOURCE_TYPE_ID, "resource.type.id = ?");
sortOverrides.put(SORT_FIELD_DEFINITION_ID, "definition.id");
sortOverrides.put(SORT_FIELD_NAME, "definition.name");
@@ -130,6 +132,10 @@ public class MeasurementScheduleCriteria extends Criteria {
this.filterAutoGroupParentResourceId = filterAutoGroupParentResourceId;
}
+ public void addFilterResourceTypeId(Integer filterResourceTypeId) {
+ this.filterResourceTypeId = filterResourceTypeId;
+ }
+
public void fetchBaseline(boolean fetchBaseline) {
this.fetchBaseline = fetchBaseline;
}
13 years, 10 months
[rhq] 2 commits - modules/core modules/enterprise
by mazz
modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertDefinition.java | 8
modules/core/domain/src/main/java/org/rhq/core/domain/alert/BooleanExpression.java | 46 +-
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AlertDefinitionCriteria.java | 11
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsDataSource.java | 133 ++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java | 149 ++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AlertDefinitionsDataSource.java | 194 --------
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AlertDefinitionsView.java | 69 ---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ConditionsAlertDefinitionForm.java | 106 ++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/DampeningAlertDefinitionForm.java | 99 ++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/EditAlertDefinitionForm.java | 21
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GeneralPropertiesAlertDefinitionForm.java | 221 ++++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GroupAlertDefinitionsDataSource.java | 57 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GroupAlertDefinitionsView.java | 108 ++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/NotificationsAlertDefinitionForm.java | 99 ++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/RecoveryAlertDefinitionForm.java | 119 +++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsDataSource.java | 132 +++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsView.java | 108 ++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/SingleAlertDefinitionView.java | 175 +++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/TemplateAlertDefinitionsDataSource.java | 57 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/TemplateAlertDefinitionsView.java | 108 ++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java | 55 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java | 9
22 files changed, 1758 insertions(+), 326 deletions(-)
New commits:
commit 5e99a1a17683741a4fc7f92376e6269a7a73ddf3
Merge: 602b409... 9964a96...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Aug 13 03:04:34 2010 -0400
Merge branch 'master' into alert-def-gwt
commit 602b40901e514a475854f00219e790cb5d6d0f47
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Aug 13 03:02:06 2010 -0400
the start of the GWT resource alert definition tab
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertDefinition.java b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertDefinition.java
index 23ecc44..807d3d3 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertDefinition.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertDefinition.java
@@ -475,6 +475,10 @@ public class AlertDefinition implements Serializable {
return this.ctime;
}
+ public void setCtime(long ctime) {
+ this.ctime = ctime;
+ }
+
@PrePersist
void onPersist() {
this.mtime = this.ctime = System.currentTimeMillis();
@@ -484,6 +488,10 @@ public class AlertDefinition implements Serializable {
return this.mtime;
}
+ public void setMtime(long mtime) {
+ this.mtime = mtime;
+ }
+
@PreUpdate
void onUpdate() {
this.mtime = System.currentTimeMillis();
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/BooleanExpression.java b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/BooleanExpression.java
index 62c9a92..87ebf60 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/BooleanExpression.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/BooleanExpression.java
@@ -1,25 +1,25 @@
- /*
- * 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.
- */
+/*
+ * 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.alert;
public enum BooleanExpression {
@@ -38,4 +38,4 @@ public enum BooleanExpression {
* processing
*/
COMPLEX; // <-- not currently supported
-}
\ No newline at end of file
+}; // gwt compiler wants semicolon
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AlertDefinitionCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AlertDefinitionCriteria.java
index 9ddf148..298a6e5 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AlertDefinitionCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AlertDefinitionCriteria.java
@@ -52,10 +52,10 @@ public class AlertDefinitionCriteria extends Criteria {
private List<Integer> filterResourceIds; // requires overrides
private List<Integer> filterResourceGroupIds; // requires overrides
private Boolean filterEnabled;
- private String filterOperationName; // requires overrides
private Boolean filterDeleted = false; // find enabled definitions by default
private boolean fetchAlerts;
+ private boolean fetchGroupAlertDefinition;
private boolean fetchConditions;
private boolean fetchAlertNotifications;
@@ -68,7 +68,6 @@ public class AlertDefinitionCriteria extends Criteria {
filterOverrides.put("alertTemplateResourceTypeName", "resourceType.name like ?");
filterOverrides.put("resourceIds", "resource.id IN ( ? )");
filterOverrides.put("resourceGroupIds", "resourceGroup.id IN ( ? )");
- filterOverrides.put("operationName", "operationDefinition.name like ?");
}
@Override
@@ -116,10 +115,6 @@ public class AlertDefinitionCriteria extends Criteria {
this.filterEnabled = filterEnabled;
}
- public void addFilterOperationName(String filterOperationName) {
- this.filterOperationName = filterOperationName;
- }
-
public void addFilterDeleted(Boolean filterDeleted) {
this.filterDeleted = filterDeleted;
}
@@ -128,6 +123,10 @@ public class AlertDefinitionCriteria extends Criteria {
this.fetchAlerts = fetchAlerts;
}
+ public void fetchGroupAlertDefinition(boolean fetchGroupAlertDefinition) {
+ this.fetchGroupAlertDefinition = fetchGroupAlertDefinition;
+ }
+
public void fetchConditions(boolean fetchConditions) {
this.fetchConditions = fetchConditions;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsDataSource.java
new file mode 100644
index 0000000..c3c6660
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsDataSource.java
@@ -0,0 +1,133 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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 as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * 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 for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.alert.definitions;
+
+import java.util.Date;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.data.fields.DataSourceTextField;
+import com.smartgwt.client.types.FieldType;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+import org.rhq.core.domain.alert.AlertDefinition;
+import org.rhq.core.domain.alert.AlertPriority;
+import org.rhq.core.domain.criteria.AlertDefinitionCriteria;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+
+/**
+ * @author Greg Hinkle
+ * @author John Mazzitelli
+ */
+public abstract class AbstractAlertDefinitionsDataSource extends RPCDataSource<AlertDefinition> {
+
+ protected static final String FIELD_ID = "id";
+ protected static final String FIELD_NAME = "name";
+ protected static final String FIELD_DESCRIPTION = "description";
+ protected static final String FIELD_CTIME = "ctime";
+ protected static final String FIELD_MTIME = "mtime";
+ protected static final String FIELD_ENABLED = "enabled";
+ protected static final String FIELD_DELETED = "deleted";
+ protected static final String FIELD_PRIORITY = "priority"; // not the actual object; a string for the UI
+ protected static final String FIELD_PRIORITY_ENUM = "priority_enum"; // the actual enum name
+
+ public AbstractAlertDefinitionsDataSource() {
+ setupFields();
+ }
+
+ @Override
+ public AlertDefinition copyValues(ListGridRecord from) {
+ AlertDefinition alertDef = new AlertDefinition();
+ alertDef.setId(from.getAttributeAsInt(FIELD_ID));
+ alertDef.setName(from.getAttributeAsString(FIELD_NAME));
+ alertDef.setDescription(from.getAttributeAsString(FIELD_DESCRIPTION));
+ alertDef.setCtime(from.getAttributeAsDate(FIELD_CTIME).getTime());
+ alertDef.setMtime(from.getAttributeAsDate(FIELD_MTIME).getTime());
+ alertDef.setEnabled(from.getAttributeAsBoolean(FIELD_ENABLED));
+ alertDef.setPriority(AlertPriority.valueOf(from.getAttributeAsString(FIELD_PRIORITY_ENUM)));
+ return alertDef;
+ }
+
+ @Override
+ public ListGridRecord copyValues(AlertDefinition from) {
+ ListGridRecord record = new ListGridRecord();
+ record.setAttribute(FIELD_ID, from.getId());
+ record.setAttribute(FIELD_NAME, from.getName());
+ record.setAttribute(FIELD_DESCRIPTION, from.getDescription());
+ record.setAttribute(FIELD_CTIME, new Date(from.getCtime()));
+ record.setAttribute(FIELD_MTIME, new Date(from.getMtime()));
+ record.setAttribute(FIELD_ENABLED, from.getEnabled());
+ record.setAttribute(FIELD_DELETED, from.getDeleted());
+ record.setAttribute(FIELD_PRIORITY, from.getPriority().getDisplayName());
+ record.setAttribute(FIELD_PRIORITY_ENUM, from.getPriority().name());
+ return record;
+ }
+
+ /**
+ * Sets up some basic alert definition fields for this data source. Subclasses are
+ * free to call this method and then add more, or add their own custom set and not
+ * call this method at all (if they don't want some of these basic fields or want to reorder them).
+ */
+ protected void setupFields() {
+ DataSourceTextField nameField = new DataSourceTextField(FIELD_NAME, "Name");
+ addField(nameField);
+
+ DataSourceTextField descriptionField = new DataSourceTextField(FIELD_DESCRIPTION, "Description");
+ addField(descriptionField);
+
+ DataSourceTextField ctimeField = new DataSourceTextField(FIELD_CTIME, "Created Time");
+ ctimeField.setType(FieldType.DATETIME);
+ addField(ctimeField);
+
+ DataSourceTextField mtimeField = new DataSourceTextField(FIELD_MTIME, "Modified Time");
+ mtimeField.setType(FieldType.DATETIME);
+ addField(mtimeField);
+
+ DataSourceTextField enabledField = new DataSourceTextField(FIELD_ENABLED, "Enabled");
+ enabledField.setType(FieldType.BOOLEAN);
+ addField(enabledField);
+
+ DataSourceTextField priorityField = new DataSourceTextField(FIELD_PRIORITY, "Priority");
+ addField(priorityField);
+ }
+
+ @Override
+ protected void executeFetch(final DSRequest request, final DSResponse response) {
+ AlertDefinitionCriteria criteria = getCriteria(request);
+ GWTServiceLookup.getAlertService().findAlertDefinitionsByCriteria(criteria,
+ new AsyncCallback<PageList<AlertDefinition>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load alert definition data", caught);
+ response.setStatus(DSResponse.STATUS_FAILURE);
+ processResponse(request.getRequestId(), response);
+ }
+
+ public void onSuccess(PageList<AlertDefinition> result) {
+ response.setData(buildRecords(result));
+ processResponse(request.getRequestId(), response);
+ }
+ });
+ }
+
+ protected abstract AlertDefinitionCriteria getCriteria(DSRequest request);
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java
new file mode 100644
index 0000000..6c6aa9f
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java
@@ -0,0 +1,149 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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 as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * 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 for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.alert.definitions;
+
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
+import com.smartgwt.client.widgets.grid.events.SelectionEvent;
+import com.smartgwt.client.widgets.layout.VLayout;
+
+import org.rhq.core.domain.alert.AlertDefinition;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
+import org.rhq.enterprise.gui.coregui.client.components.table.Table.SelectionEnablement;
+
+/**
+ * Superclass to the different alert definition views. This should be subclassed
+ * to obtain resource, group, and template alert definition views.
+ *
+ * @author John Mazzitelli
+ */
+public abstract class AbstractAlertDefinitionsView extends VLayout {
+
+ private SingleAlertDefinitionView singleAlertDefinitionView;
+
+ public AbstractAlertDefinitionsView() {
+ setWidth100();
+ setHeight100();
+ setMembersMargin(10);
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+ Criteria criteria = getCriteria();
+ final Table table = new Table(getTableTitle(), criteria);
+ table.setDataSource(getAlertDefinitionDataSource());
+ table.getListGrid().setUseAllDataSourceFields(true);
+
+ table.getListGrid().addSelectionChangedHandler(new SelectionChangedHandler() {
+ public void onSelectionChanged(SelectionEvent selectionEvent) {
+ AlertDefinition alertDef = null;
+ ListGridRecord selectedRecord = null;
+ ListGridRecord[] allSelections = selectionEvent.getSelection();
+ if (allSelections != null && allSelections.length == 1) {
+ selectedRecord = allSelections[0];
+ }
+ if (selectedRecord != null) {
+ alertDef = ((AbstractAlertDefinitionsDataSource) table.getDataSource()).copyValues(selectedRecord);
+ table.setHeight("33%");
+ table.setShowResizeBar(true);
+ singleAlertDefinitionView.setHeight("67%");
+ singleAlertDefinitionView.show();
+ singleAlertDefinitionView.setAlertDefinition(alertDef);
+ } else {
+ table.setHeight100();
+ table.setShowResizeBar(false);
+ singleAlertDefinitionView.hide();
+ }
+ markForRedraw();
+ }
+ });
+
+ boolean permitted = isAllowedToModifyAlerts();
+
+ table.addTableAction("New", (permitted) ? SelectionEnablement.ALWAYS : SelectionEnablement.NEVER, null,
+ new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ newButtonPressed(selection);
+ CoreGUI.refresh();
+ }
+ });
+
+ table.addTableAction("Enable", (permitted) ? SelectionEnablement.ANY : SelectionEnablement.NEVER,
+ "Are You Sure?", new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ enableButtonPressed(selection);
+ CoreGUI.refresh();
+ }
+ });
+
+ table.addTableAction("Disable", (permitted) ? SelectionEnablement.ANY : SelectionEnablement.NEVER,
+ "Are You Sure?", new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ disableButtonPressed(selection);
+ }
+ });
+
+ table.addTableAction("Delete", (permitted) ? SelectionEnablement.ANY : SelectionEnablement.NEVER,
+ "Are You Sure?", new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ deleteButtonPressed(selection);
+ CoreGUI.refresh();
+ }
+ });
+
+ addMember(table);
+
+ this.singleAlertDefinitionView = buildSingleAlertDefinitionView();
+ this.singleAlertDefinitionView.hide();
+ this.singleAlertDefinitionView.setWidth100();
+ this.singleAlertDefinitionView.setHeight100();
+ this.singleAlertDefinitionView.setMargin(10);
+ addMember(this.singleAlertDefinitionView);
+ }
+
+ protected SingleAlertDefinitionView getSingleAlertDefinitionView() {
+ return this.singleAlertDefinitionView;
+ }
+
+ protected SingleAlertDefinitionView buildSingleAlertDefinitionView() {
+ SingleAlertDefinitionView singleAlertDefinitionView = new SingleAlertDefinitionView();
+ return singleAlertDefinitionView;
+ }
+
+ protected abstract String getTableTitle();
+
+ protected abstract Criteria getCriteria();
+
+ protected abstract AbstractAlertDefinitionsDataSource getAlertDefinitionDataSource();
+
+ protected abstract boolean isAllowedToModifyAlerts();
+
+ protected abstract void newButtonPressed(ListGridRecord[] selection);
+
+ protected abstract void deleteButtonPressed(ListGridRecord[] selection);
+
+ protected abstract void enableButtonPressed(ListGridRecord[] selection);
+
+ protected abstract void disableButtonPressed(ListGridRecord[] selection);
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AlertDefinitionsDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AlertDefinitionsDataSource.java
deleted file mode 100644
index e8ec455..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AlertDefinitionsDataSource.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 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 as published by
- * the Free Software Foundation version 2 of the License.
- *
- * 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 for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.alert.definitions;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Embedded;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.FetchType;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.OneToMany;
-import javax.persistence.OrderBy;
-import javax.xml.bind.annotation.XmlTransient;
-
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.data.Criteria;
-import com.smartgwt.client.data.DSRequest;
-import com.smartgwt.client.data.DSResponse;
-import com.smartgwt.client.data.fields.DataSourceIntegerField;
-import com.smartgwt.client.data.fields.DataSourceTextField;
-import com.smartgwt.client.types.FieldType;
-import com.smartgwt.client.widgets.grid.ListGridRecord;
-
-import org.rhq.core.domain.alert.Alert;
-import org.rhq.core.domain.alert.AlertCondition;
-import org.rhq.core.domain.alert.AlertDampening;
-import org.rhq.core.domain.alert.AlertDampeningEvent;
-import org.rhq.core.domain.alert.AlertDefinition;
-import org.rhq.core.domain.alert.AlertDefinitionContext;
-import org.rhq.core.domain.alert.AlertPriority;
-import org.rhq.core.domain.alert.BooleanExpression;
-import org.rhq.core.domain.alert.notification.AlertNotification;
-import org.rhq.core.domain.criteria.AlertCriteria;
-import org.rhq.core.domain.criteria.AlertDefinitionCriteria;
-import org.rhq.core.domain.operation.OperationDefinition;
-import org.rhq.core.domain.resource.Resource;
-import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.domain.resource.group.ResourceGroup;
-import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
-
-/**
- * @author Greg Hinkle
- */
-public class AlertDefinitionsDataSource extends RPCDataSource<AlertDefinition> {
-
-
- public AlertDefinitionsDataSource() {
-
- DataSourceIntegerField idField = new DataSourceIntegerField("id","ID");
- idField.setPrimaryKey(true);
- addField(idField);
-
- DataSourceTextField nameField = new DataSourceTextField("name","Name");
- addField(nameField);
-
- DataSourceTextField ctimeField = new DataSourceTextField("ctime","Created Time");
- ctimeField.setType(FieldType.DATETIME);
- addField(ctimeField);
-
- DataSourceTextField mtimeField = new DataSourceTextField("mtime", "Modified Time");
- mtimeField.setType(FieldType.DATETIME);
- addField(mtimeField);
-
- DataSourceTextField descriptionField = new DataSourceTextField("description","Description");
- addField(descriptionField);
-
- DataSourceTextField priorityField = new DataSourceTextField("priority","Priority");
- addField(priorityField);
-
- DataSourceTextField enabledField = new DataSourceTextField("enabled","Enabled");
- enabledField.setType(FieldType.BOOLEAN);
- addField(enabledField);
-
- }
-
- @Override
- protected void executeFetch(final DSRequest request, final DSResponse response) {
-
- AlertDefinitionCriteria criteria = getCriteria(request);
-
- GWTServiceLookup.getAlertService().findAlertDefinitionsByCriteria(
- criteria,
- new AsyncCallback<PageList<AlertDefinition>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load alert definition data", caught);
- response.setStatus(DSResponse.STATUS_FAILURE);
- processResponse(request.getRequestId(), response);
- }
-
- public void onSuccess(PageList<AlertDefinition> result) {
- response.setData(buildRecords(result));
- processResponse(request.getRequestId(), response);
- }
- }
- );
- }
-
-
- protected AlertDefinitionCriteria getCriteria(DSRequest request) {
- AlertDefinitionCriteria criteria = new AlertDefinitionCriteria();
- criteria.fetchConditions(true);
-
- Criteria requestCriteria = request.getCriteria();
- if (requestCriteria != null) {
- Map values = requestCriteria.getValues();
- for (Object key : values.keySet()) {
- String fieldName = (String) key;
- if (fieldName.equals("resourceId")) {
- Integer resourceId = (Integer) values.get(fieldName);
- criteria.addFilterResourceIds(resourceId);
- }
- // TODO: Add support for other fields we need to filter by (e.g. resourceGroupId).
- }
- }
-
- criteria.setPageControl(getPageControl(request));
- return criteria;
- }
-
-
- @Override
- public AlertDefinition copyValues(ListGridRecord from) {
- return null; // TODO: Implement this method.
- }
-
- @Override
- public ListGridRecord copyValues(AlertDefinition from) {
- ListGridRecord record = new ListGridRecord();
-
- record.setAttribute("id", from.getId());
- record.setAttribute("name", from.getName());
- record.setAttribute("ctime", new Date(from.getCtime()));
- record.setAttribute("mtime", new Date(from.getMtime()));
- record.setAttribute("parentId", from.getParentId());
- record.setAttribute("description", from.getDescription());
- record.setAttribute("priority", from.getPriority().getDisplayName());
- record.setAttribute("enabled", from.getEnabled());
-
- record.setAttribute("recoveryId", from.getRecoveryId());
- record.setAttribute("willRecover", from.getWillRecover());
- record.setAttribute("notifyFiltered", from.getNotifyFiltered());
- record.setAttribute("controlFiltered", from.getControlFiltered());
- record.setAttribute("deleted", from.getDeleted());
- record.setAttribute("readOnly", from.isReadOnly());
- record.setAttribute("conditionExpression", from.getConditionExpression());
-
-
- return record;
- }
-
-
-/*
-The following is not yet translated into the record
- private AlertDefinition groupAlertDefinition;
- private Set<AlertDefinition> groupAlertDefinitionChildren = new LinkedHashSet<AlertDefinition>();
- private AlertDampening alertDampening;
- private BooleanExpression conditionExpression;
- private Set<AlertCondition> conditions = new LinkedHashSet<AlertCondition>(1); // Most alerts will only have one condition.
- private List<AlertNotification> alertNotifications = new ArrayList<AlertNotification>();
- private OperationDefinition operationDefinition;
- private Set<AlertDampeningEvent> alertDampeningEvents = new HashSet<AlertDampeningEvent>();
- private Set<Alert> alerts = new LinkedHashSet<Alert>();
-*/
-
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AlertDefinitionsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AlertDefinitionsView.java
deleted file mode 100644
index 0e35a55..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AlertDefinitionsView.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 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 as published by
- * the Free Software Foundation version 2 of the License.
- *
- * 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 for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.alert.definitions;
-
-import com.smartgwt.client.data.Criteria;
-import com.smartgwt.client.widgets.grid.ListGridRecord;
-import com.smartgwt.client.widgets.layout.VLayout;
-
-import org.rhq.core.domain.resource.Resource;
-import org.rhq.enterprise.gui.coregui.client.components.table.Table;
-import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.alert.AlertEditView;
-
-/**
- * @author Greg Hinkle
- */
-public class AlertDefinitionsView extends VLayout {
-
- private Resource resource;
-
- public AlertDefinitionsView(Resource resource) {
- setWidth100();
- this.resource = resource;
- }
-
- @Override
- protected void onDraw() {
- super.onDraw();
-
- Criteria criteria = new Criteria();
- criteria.addCriteria("resourceId",resource.getId());
-
- Table table = new Table("Alert Definitions", criteria);
- table.setDataSource(new AlertDefinitionsDataSource());
- table.getListGrid().setUseAllDataSourceFields(true);
-
-
- table.addTableAction("New", new TableAction() {
- public void executeAction(ListGridRecord[] selection) {
- new AlertEditView(resource).displayAsDialog();
- }
- });
-
- addMember(table);
- }
-
-
- public static AlertDefinitionsView getResourceView(Resource resource) {
- return new AlertDefinitionsView(resource);
- }
-
-
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ConditionsAlertDefinitionForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ConditionsAlertDefinitionForm.java
new file mode 100644
index 0000000..3f91844
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ConditionsAlertDefinitionForm.java
@@ -0,0 +1,106 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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.enterprise.gui.coregui.client.alert.definitions;
+
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.SelectItem;
+
+import org.rhq.core.domain.alert.AlertDefinition;
+import org.rhq.core.domain.alert.BooleanExpression;
+
+/**
+ * @author John Mazzitelli
+ */
+public class ConditionsAlertDefinitionForm extends DynamicForm implements EditAlertDefinitionForm {
+
+ private AlertDefinition alertDefinition;
+
+ private SelectItem conditionExpression;
+
+ public ConditionsAlertDefinitionForm() {
+ this(null);
+ }
+
+ public ConditionsAlertDefinitionForm(AlertDefinition alertDefinition) {
+ this.alertDefinition = alertDefinition;
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+ if (conditionExpression == null) {
+ buildForm();
+ setAlertDefinition(alertDefinition);
+ makeViewOnly();
+ }
+ }
+
+ @Override
+ public AlertDefinition getAlertDefinition() {
+ return this.alertDefinition;
+ }
+
+ @Override
+ public void setAlertDefinition(AlertDefinition alertDef) {
+ this.alertDefinition = alertDef;
+
+ if (alertDef == null) {
+ clearFormValues();
+ } else {
+ // TODO: why is cond expression always null????
+ //conditionExpression.setValue(alertDef.getConditionExpression().toString());
+ }
+
+ markForRedraw();
+ }
+
+ @Override
+ public void makeEditable() {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public void makeViewOnly() {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public void saveAlertDefinition() {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public void clearFormValues() {
+ conditionExpression.clearValue();
+ }
+
+ private void buildForm() {
+ conditionExpression = new SelectItem("conditionExpression", "Fire alert when");
+ conditionExpression.setValueMap(BooleanExpression.ALL.toString(), BooleanExpression.ANY.toString());
+ conditionExpression.setDefaultValue(BooleanExpression.ALL.toString());
+
+ setFields(conditionExpression);
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/DampeningAlertDefinitionForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/DampeningAlertDefinitionForm.java
new file mode 100644
index 0000000..adf2173
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/DampeningAlertDefinitionForm.java
@@ -0,0 +1,99 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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.enterprise.gui.coregui.client.alert.definitions;
+
+import com.smartgwt.client.widgets.form.DynamicForm;
+
+import org.rhq.core.domain.alert.AlertDefinition;
+
+/**
+ * @author John Mazzitelli
+ */
+public class DampeningAlertDefinitionForm extends DynamicForm implements EditAlertDefinitionForm {
+
+ private AlertDefinition alertDefinition;
+
+ public DampeningAlertDefinitionForm() {
+ this(null);
+ }
+
+ public DampeningAlertDefinitionForm(AlertDefinition alertDefinition) {
+ this.alertDefinition = alertDefinition;
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+ // TODO only build form if we didn't do it yet
+ if (true) {
+ buildForm();
+ setAlertDefinition(alertDefinition);
+ makeViewOnly();
+ }
+ }
+
+ @Override
+ public AlertDefinition getAlertDefinition() {
+ return this.alertDefinition;
+ }
+
+ @Override
+ public void setAlertDefinition(AlertDefinition alertDef) {
+ this.alertDefinition = alertDef;
+
+ if (alertDef == null) {
+ clearFormValues();
+ } else {
+ // TODO set values of the components
+ }
+
+ markForRedraw();
+ }
+
+ @Override
+ public void makeEditable() {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public void makeViewOnly() {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public void saveAlertDefinition() {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public void clearFormValues() {
+ // TODO component.clearValue();
+ }
+
+ private void buildForm() {
+ // TODO build components
+ // TODO setFields(components);
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/EditAlertDefinitionForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/EditAlertDefinitionForm.java
new file mode 100644
index 0000000..439ed3e
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/EditAlertDefinitionForm.java
@@ -0,0 +1,21 @@
+package org.rhq.enterprise.gui.coregui.client.alert.definitions;
+
+import org.rhq.core.domain.alert.AlertDefinition;
+
+/**
+ * @author John Mazzitelli
+ */
+public interface EditAlertDefinitionForm {
+
+ AlertDefinition getAlertDefinition();
+
+ void setAlertDefinition(AlertDefinition alertDef);
+
+ void makeEditable();
+
+ void makeViewOnly();
+
+ void saveAlertDefinition();
+
+ void clearFormValues();
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GeneralPropertiesAlertDefinitionForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GeneralPropertiesAlertDefinitionForm.java
new file mode 100644
index 0000000..712013c
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GeneralPropertiesAlertDefinitionForm.java
@@ -0,0 +1,221 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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.enterprise.gui.coregui.client.alert.definitions;
+
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.RadioGroupItem;
+import com.smartgwt.client.widgets.form.fields.SelectItem;
+import com.smartgwt.client.widgets.form.fields.StaticTextItem;
+import com.smartgwt.client.widgets.form.fields.TextAreaItem;
+import com.smartgwt.client.widgets.form.fields.TextItem;
+
+import org.rhq.core.domain.alert.AlertDefinition;
+import org.rhq.core.domain.alert.AlertPriority;
+
+/**
+ * @author John Mazzitelli
+ */
+public class GeneralPropertiesAlertDefinitionForm extends DynamicForm implements EditAlertDefinitionForm {
+
+ private AlertDefinition alertDefinition;
+
+ private TextItem nameTextField;
+ private TextAreaItem descriptionTextField;
+ private SelectItem prioritySelection;
+ private RadioGroupItem enabledSelection;
+ private RadioGroupItem readOnlySelection;
+
+ private StaticTextItem nameStatic;
+ private StaticTextItem descriptionStatic;
+ private StaticTextItem priorityStatic;
+ private StaticTextItem enabledStatic;
+ private StaticTextItem readOnlyStatic;
+
+ private boolean formBuilt = false;
+
+ public GeneralPropertiesAlertDefinitionForm() {
+ this(null);
+ }
+
+ public GeneralPropertiesAlertDefinitionForm(AlertDefinition alertDefinition) {
+ this.alertDefinition = alertDefinition;
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+ if (!formBuilt) {
+ buildForm();
+ setAlertDefinition(alertDefinition);
+ makeViewOnly();
+ }
+ }
+
+ @Override
+ public AlertDefinition getAlertDefinition() {
+ return this.alertDefinition;
+ }
+
+ @Override
+ public void setAlertDefinition(AlertDefinition alertDef) {
+ this.alertDefinition = alertDef;
+
+ buildForm();
+
+ if (alertDef == null) {
+ clearFormValues();
+ } else {
+ nameTextField.setValue(alertDef.getName());
+ nameStatic.setValue(alertDef.getName());
+
+ descriptionTextField.setValue(alertDef.getDescription());
+ descriptionStatic.setValue(alertDef.getDescription());
+
+ prioritySelection.setValue(alertDef.getPriority().getDisplayName());
+ priorityStatic.setValue(alertDef.getPriority().getDisplayName());
+
+ enabledSelection.setValue(alertDef.getEnabled() ? "Yes" : "No");
+ enabledStatic.setValue(alertDef.getEnabled() ? "Yes" : "No");
+
+ readOnlySelection.setValue(alertDef.isReadOnly() ? "Yes" : "No");
+ readOnlyStatic.setValue(alertDef.isReadOnly() ? "Yes" : "No");
+ }
+
+ markForRedraw();
+ }
+
+ @Override
+ public void makeEditable() {
+ nameTextField.show();
+ nameStatic.hide();
+
+ descriptionTextField.show();
+ descriptionStatic.hide();
+
+ prioritySelection.show();
+ priorityStatic.hide();
+
+ enabledSelection.show();
+ enabledStatic.hide();
+
+ readOnlySelection.show();
+ readOnlyStatic.hide();
+
+ Integer parentId = this.alertDefinition.getParentId();
+ if ((parentId == null || parentId.intValue() == 0) && (this.alertDefinition.getGroupAlertDefinition() == null)) {
+ readOnlySelection.hide();
+ } else {
+ readOnlySelection.show();
+ }
+ readOnlyStatic.hide();
+
+ markForRedraw();
+ }
+
+ @Override
+ public void makeViewOnly() {
+ nameTextField.hide();
+ nameStatic.show();
+
+ descriptionTextField.hide();
+ descriptionStatic.show();
+
+ prioritySelection.hide();
+ priorityStatic.show();
+
+ enabledSelection.hide();
+ enabledStatic.show();
+
+ readOnlySelection.hide();
+ readOnlyStatic.show();
+
+ Integer parentId = this.alertDefinition.getParentId();
+ if ((parentId == null || parentId.intValue() == 0) && (this.alertDefinition.getGroupAlertDefinition() == null)) {
+ readOnlyStatic.hide();
+ } else {
+ readOnlyStatic.show();
+ }
+ readOnlySelection.hide();
+
+ markForRedraw();
+ }
+
+ @Override
+ public void saveAlertDefinition() {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public void clearFormValues() {
+ nameTextField.clearValue();
+ descriptionTextField.clearValue();
+ prioritySelection.clearValue();
+ enabledSelection.clearValue();
+ readOnlySelection.clearValue();
+
+ nameStatic.clearValue();
+ descriptionStatic.clearValue();
+ priorityStatic.clearValue();
+ enabledStatic.clearValue();
+ readOnlyStatic.clearValue();
+
+ markForRedraw();
+ }
+
+ private void buildForm() {
+ if (!formBuilt) {
+ nameTextField = new TextItem("name", "Name");
+ nameTextField.setWidth(300);
+ nameStatic = new StaticTextItem("nameStatic", "Name");
+
+ descriptionTextField = new TextAreaItem("description", "Description");
+ descriptionTextField.setWidth(300);
+ descriptionStatic = new StaticTextItem("descriptionStatic", "Description");
+
+ prioritySelection = new SelectItem("priority", "Priority");
+ prioritySelection.setValueMap(AlertPriority.HIGH.getDisplayName(), AlertPriority.MEDIUM.getDisplayName(),
+ AlertPriority.LOW.getDisplayName());
+ prioritySelection.setDefaultValue(AlertPriority.MEDIUM.getDisplayName());
+ priorityStatic = new StaticTextItem("priorityStatic", "Priority");
+
+ enabledSelection = new RadioGroupItem("enabled", "Enabled");
+ enabledSelection.setValueMap("Yes", "No");
+ enabledSelection.setDefaultValue("Yes");
+ enabledStatic = new StaticTextItem("enabledStatic", "Enabled");
+
+ readOnlySelection = new RadioGroupItem("readOnly", "Read Only");
+ readOnlySelection.setValueMap("Yes", "No");
+ readOnlySelection.setDefaultValue("Yes");
+ readOnlySelection.setPrompt("If true, the parent definition will not override this alert definition");
+ readOnlyStatic = new StaticTextItem("readOnlyStatic", "Read Only");
+
+ setFields(nameTextField, nameStatic, descriptionTextField, descriptionStatic, prioritySelection,
+ priorityStatic, enabledSelection, enabledStatic, readOnlySelection, readOnlyStatic);
+
+ formBuilt = true;
+ }
+
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GroupAlertDefinitionsDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GroupAlertDefinitionsDataSource.java
new file mode 100644
index 0000000..90f9490
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GroupAlertDefinitionsDataSource.java
@@ -0,0 +1,57 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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.enterprise.gui.coregui.client.alert.definitions;
+
+import java.util.Map;
+
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.data.DSRequest;
+
+import org.rhq.core.domain.criteria.AlertDefinitionCriteria;
+
+/**
+ * @author John Mazzitelli
+ */
+public class GroupAlertDefinitionsDataSource extends AbstractAlertDefinitionsDataSource {
+
+ @Override
+ protected AlertDefinitionCriteria getCriteria(DSRequest request) {
+ AlertDefinitionCriteria criteria = new AlertDefinitionCriteria();
+
+ Criteria requestCriteria = request.getCriteria();
+ if (requestCriteria != null) {
+ Map values = requestCriteria.getValues();
+ for (Object key : values.keySet()) {
+ String fieldName = (String) key;
+ if (fieldName.equals(GroupAlertDefinitionsView.CRITERIA_GROUP_ID)) {
+ Integer resourceId = (Integer) values.get(fieldName);
+ criteria.addFilterResourceGroupIds(resourceId);
+ }
+ }
+ }
+
+ criteria.setPageControl(getPageControl(request));
+ return criteria;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GroupAlertDefinitionsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GroupAlertDefinitionsView.java
new file mode 100644
index 0000000..7283f8f
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GroupAlertDefinitionsView.java
@@ -0,0 +1,108 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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.enterprise.gui.coregui.client.alert.definitions;
+
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.util.SC;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+import org.rhq.core.domain.resource.group.ResourceGroup;
+
+/**
+ * @author John Mazzitelli
+ */
+public class GroupAlertDefinitionsView extends AbstractAlertDefinitionsView {
+
+ public static final String CRITERIA_GROUP_ID = "groupId";
+
+ private ResourceGroup group;
+
+ public GroupAlertDefinitionsView(ResourceGroup group) {
+ super();
+ this.group = group;
+ }
+
+ @Override
+ protected Criteria getCriteria() {
+ Criteria criteria = new Criteria();
+ criteria.addCriteria(CRITERIA_GROUP_ID, group.getId());
+ return criteria;
+ }
+
+ @Override
+ protected AbstractAlertDefinitionsDataSource getAlertDefinitionDataSource() {
+ return new GroupAlertDefinitionsDataSource();
+ }
+
+ @Override
+ protected String getTableTitle() {
+ return "Group Alert Definitions";
+ }
+
+ @Override
+ protected boolean isAllowedToModifyAlerts() {
+ // TODO: see if user can modify group alerts on this group
+ return true;
+ }
+
+ @Override
+ protected void newButtonPressed(ListGridRecord[] selection) {
+ // TODO Auto-generated method stub
+ String str = "this is not implemented yet but you selected";
+ for (ListGridRecord record : selection) {
+ str += ": " + record.getAttribute("name");
+ }
+ SC.say(str);
+ }
+
+ @Override
+ protected void enableButtonPressed(ListGridRecord[] selection) {
+ // TODO Auto-generated method stub
+ String str = "this is not implemented yet but you selected";
+ for (ListGridRecord record : selection) {
+ str += ": " + record.getAttribute("name");
+ }
+ SC.say(str);
+ }
+
+ @Override
+ protected void disableButtonPressed(ListGridRecord[] selection) {
+ // TODO Auto-generated method stub
+ String str = "this is not implemented yet but you selected";
+ for (ListGridRecord record : selection) {
+ str += ": " + record.getAttribute("name");
+ }
+ SC.say(str);
+ }
+
+ @Override
+ protected void deleteButtonPressed(ListGridRecord[] selection) {
+ // TODO Auto-generated method stub
+ String str = "this is not implemented yet but you selected";
+ for (ListGridRecord record : selection) {
+ str += ": " + record.getAttribute("name");
+ }
+ SC.say(str);
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/NotificationsAlertDefinitionForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/NotificationsAlertDefinitionForm.java
new file mode 100644
index 0000000..948656a
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/NotificationsAlertDefinitionForm.java
@@ -0,0 +1,99 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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.enterprise.gui.coregui.client.alert.definitions;
+
+import com.smartgwt.client.widgets.form.DynamicForm;
+
+import org.rhq.core.domain.alert.AlertDefinition;
+
+/**
+ * @author John Mazzitelli
+ */
+public class NotificationsAlertDefinitionForm extends DynamicForm implements EditAlertDefinitionForm {
+
+ private AlertDefinition alertDefinition;
+
+ public NotificationsAlertDefinitionForm() {
+ this(null);
+ }
+
+ public NotificationsAlertDefinitionForm(AlertDefinition alertDefinition) {
+ this.alertDefinition = alertDefinition;
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+ // TODO only build form if we didn't do it yet
+ if (true) {
+ buildForm();
+ setAlertDefinition(alertDefinition);
+ makeViewOnly();
+ }
+ }
+
+ @Override
+ public AlertDefinition getAlertDefinition() {
+ return this.alertDefinition;
+ }
+
+ @Override
+ public void setAlertDefinition(AlertDefinition alertDef) {
+ this.alertDefinition = alertDef;
+
+ if (alertDef == null) {
+ clearFormValues();
+ } else {
+ // TODO set values of the components
+ }
+
+ markForRedraw();
+ }
+
+ @Override
+ public void makeEditable() {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public void makeViewOnly() {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public void saveAlertDefinition() {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public void clearFormValues() {
+ // TODO component.clearValue();
+ }
+
+ private void buildForm() {
+ // TODO build components
+ // TODO setFields(components);
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/RecoveryAlertDefinitionForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/RecoveryAlertDefinitionForm.java
new file mode 100644
index 0000000..e95c771
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/RecoveryAlertDefinitionForm.java
@@ -0,0 +1,119 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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.enterprise.gui.coregui.client.alert.definitions;
+
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.RadioGroupItem;
+import com.smartgwt.client.widgets.form.fields.SelectItem;
+
+import org.rhq.core.domain.alert.AlertDefinition;
+
+/**
+ * @author John Mazzitelli
+ */
+public class RecoveryAlertDefinitionForm extends DynamicForm implements EditAlertDefinitionForm {
+
+ private AlertDefinition alertDefinition;
+
+ private SelectItem recoverAlertSelection;
+ private RadioGroupItem disableWhenFiredSelection;
+
+ private boolean formBuilt = false;
+
+ public RecoveryAlertDefinitionForm() {
+ this(null);
+ }
+
+ public RecoveryAlertDefinitionForm(AlertDefinition alertDefinition) {
+ this.alertDefinition = alertDefinition;
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+ if (!formBuilt) {
+ buildForm();
+ setAlertDefinition(alertDefinition);
+ makeViewOnly();
+ }
+ }
+
+ @Override
+ public AlertDefinition getAlertDefinition() {
+ return this.alertDefinition;
+ }
+
+ @Override
+ public void setAlertDefinition(AlertDefinition alertDef) {
+ this.alertDefinition = alertDef;
+
+ buildForm();
+
+ if (alertDef == null) {
+ clearFormValues();
+ } else {
+ disableWhenFiredSelection.setValue(alertDef.getWillRecover() ? "Yes" : "No");
+ }
+
+ markForRedraw();
+ }
+
+ @Override
+ public void makeEditable() {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public void makeViewOnly() {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public void saveAlertDefinition() {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public void clearFormValues() {
+ recoverAlertSelection.clearValue();
+ disableWhenFiredSelection.clearValue();
+ }
+
+ private void buildForm() {
+ if (!formBuilt) {
+ recoverAlertSelection = new SelectItem("recoveryAlert", "Recover Alert");
+ recoverAlertSelection.setValueMap("Select...");
+ recoverAlertSelection.setDefaultValue("Select...");
+ // TODO: call into server and get the menu list of all alerts that we can recover
+
+ disableWhenFiredSelection = new RadioGroupItem("disableWhenFired", "Disable When Fired");
+ disableWhenFiredSelection.setValueMap("Yes", "No");
+ disableWhenFiredSelection.setDefaultValue("Yes");
+
+ setFields(recoverAlertSelection, disableWhenFiredSelection);
+ formBuilt = true;
+ }
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsDataSource.java
new file mode 100644
index 0000000..ed19a24
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsDataSource.java
@@ -0,0 +1,132 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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.enterprise.gui.coregui.client.alert.definitions;
+
+import java.util.Map;
+
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.fields.DataSourceLinkField;
+import com.smartgwt.client.data.fields.DataSourceTextField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+import org.rhq.core.domain.alert.AlertDefinition;
+import org.rhq.core.domain.criteria.AlertDefinitionCriteria;
+import org.rhq.core.domain.resource.Resource;
+
+/**
+ * @author John Mazzitelli
+ */
+public class ResourceAlertDefinitionsDataSource extends AbstractAlertDefinitionsDataSource {
+
+ protected static final String FIELD_PARENT = "parent"; // the column field - may be template or group alert def parent
+ protected static final String FIELD_PARENT_TEMPLATEID = "parent_tid"; // the actual integer (may be 0) of template ID
+ protected static final String FIELD_PARENT_GROUPALERTDEF = "parentId_gad"; // the actual group alert def parent (may be null)
+ protected static final String FIELD_READONLY = "readOnly"; // not necessarily the actual boolean; sometimes we display "N/A"
+ protected static final String FIELD_READONLY_BOOLEAN = "readOnly_boolean"; // the actual boolean value
+
+ private Resource resource;
+
+ public ResourceAlertDefinitionsDataSource(Resource resource) {
+ super();
+ this.resource = resource;
+ }
+
+ @Override
+ public AlertDefinition copyValues(ListGridRecord from) {
+ AlertDefinition alertDef = super.copyValues(from);
+ alertDef.setParentId(from.getAttributeAsInt(FIELD_PARENT_TEMPLATEID));
+ alertDef.setGroupAlertDefinition((AlertDefinition) from.getAttributeAsObject(FIELD_PARENT_GROUPALERTDEF));
+ alertDef.setReadOnly(from.getAttributeAsBoolean(FIELD_READONLY_BOOLEAN));
+ return alertDef;
+ }
+
+ @Override
+ public ListGridRecord copyValues(AlertDefinition from) {
+ ListGridRecord record = super.copyValues(from);
+
+ Integer parentId = from.getParentId(); // a valid non-zero number means the alert def came from a template
+ AlertDefinition groupAlertDefinition = from.getGroupAlertDefinition();
+ boolean readOnly = from.isReadOnly();
+
+ record.setAttribute(FIELD_PARENT_TEMPLATEID, parentId);
+ record.setAttribute(FIELD_PARENT_GROUPALERTDEF, groupAlertDefinition);
+ record.setAttribute(FIELD_READONLY_BOOLEAN, readOnly);
+
+ if ((parentId == null || parentId.intValue() == 0) && (groupAlertDefinition == null)) {
+ record.setAttribute(FIELD_PARENT, "");
+ record.setLinkText("");
+ record.setAttribute(FIELD_READONLY, "N/A");
+ } else {
+ // TODO: fix the URLs so they point to the new GWT pages when they are implemented
+ if (parentId != null && parentId.intValue() != 0) {
+ record.setAttribute(FIELD_PARENT, "/alerts/Config.do?mode=viewRoles&type="
+ + this.resource.getResourceType().getId() + "&from=" + from.getId() + "&ad=" + parentId);
+ record.setLinkText("View Template");
+ } else {
+ record.setAttribute(FIELD_PARENT, "/alerts/Config.do?mode=viewRoles&groupId="
+ + groupAlertDefinition.getResourceGroup().getId() + "&from=" + from.getId() + "&ad="
+ + groupAlertDefinition.getId());
+ record.setLinkText("View Group Definition");
+ }
+ record.setAttribute(FIELD_READONLY, readOnly);
+ }
+
+ return record;
+ }
+
+ @Override
+ protected void setupFields() {
+ super.setupFields();
+
+ // add two more columns
+ DataSourceLinkField parentIdField = new DataSourceLinkField(FIELD_PARENT, "Parent");
+ addField(parentIdField);
+
+ DataSourceTextField readOnlyField = new DataSourceTextField(FIELD_READONLY, "Read Only");
+ addField(readOnlyField);
+ }
+
+ @Override
+ protected AlertDefinitionCriteria getCriteria(DSRequest request) {
+ AlertDefinitionCriteria criteria = new AlertDefinitionCriteria();
+
+ criteria.fetchGroupAlertDefinition(true);
+
+ Criteria requestCriteria = request.getCriteria();
+ if (requestCriteria != null) {
+ Map values = requestCriteria.getValues();
+ for (Object key : values.keySet()) {
+ String fieldName = (String) key;
+ if (fieldName.equals(ResourceAlertDefinitionsView.CRITERIA_RESOURCE_ID)) {
+ Integer resourceId = (Integer) values.get(fieldName);
+ criteria.addFilterResourceIds(resourceId);
+ }
+ }
+ }
+
+ criteria.setPageControl(getPageControl(request));
+ return criteria;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsView.java
new file mode 100644
index 0000000..36c146c
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsView.java
@@ -0,0 +1,108 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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.enterprise.gui.coregui.client.alert.definitions;
+
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.util.SC;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+import org.rhq.core.domain.resource.Resource;
+
+/**
+ * @author John Mazzitelli
+ */
+public class ResourceAlertDefinitionsView extends AbstractAlertDefinitionsView {
+
+ public static final String CRITERIA_RESOURCE_ID = "resourceId";
+
+ private Resource resource;
+
+ public ResourceAlertDefinitionsView(Resource resource) {
+ super();
+ this.resource = resource;
+ }
+
+ @Override
+ protected Criteria getCriteria() {
+ Criteria criteria = new Criteria();
+ criteria.addCriteria(CRITERIA_RESOURCE_ID, resource.getId());
+ return criteria;
+ }
+
+ @Override
+ protected AbstractAlertDefinitionsDataSource getAlertDefinitionDataSource() {
+ return new ResourceAlertDefinitionsDataSource(this.resource);
+ }
+
+ @Override
+ protected String getTableTitle() {
+ return "Alert Definitions";
+ }
+
+ @Override
+ protected boolean isAllowedToModifyAlerts() {
+ // TODO: see if user can modify alerts on this resource
+ return true;
+ }
+
+ @Override
+ protected void newButtonPressed(ListGridRecord[] selection) {
+ // TODO Auto-generated method stub
+ String str = "this is not implemented yet but you selected";
+ for (ListGridRecord record : selection) {
+ str += ": " + record.getAttribute("name");
+ }
+ SC.say(str);
+ }
+
+ @Override
+ protected void enableButtonPressed(ListGridRecord[] selection) {
+ // TODO Auto-generated method stub
+ String str = "this is not implemented yet but you selected";
+ for (ListGridRecord record : selection) {
+ str += ": " + record.getAttribute("name");
+ }
+ SC.say(str);
+ }
+
+ @Override
+ protected void disableButtonPressed(ListGridRecord[] selection) {
+ // TODO Auto-generated method stub
+ String str = "this is not implemented yet but you selected";
+ for (ListGridRecord record : selection) {
+ str += ": " + record.getAttribute("name");
+ }
+ SC.say(str);
+ }
+
+ @Override
+ protected void deleteButtonPressed(ListGridRecord[] selection) {
+ // TODO Auto-generated method stub
+ String str = "this is not implemented yet but you selected";
+ for (ListGridRecord record : selection) {
+ str += ": " + record.getAttribute("name");
+ }
+ SC.say(str);
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/SingleAlertDefinitionView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/SingleAlertDefinitionView.java
new file mode 100644
index 0000000..eff934f
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/SingleAlertDefinitionView.java
@@ -0,0 +1,175 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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.enterprise.gui.coregui.client.alert.definitions;
+
+import com.smartgwt.client.widgets.Button;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.layout.HLayout;
+import com.smartgwt.client.widgets.layout.VLayout;
+import com.smartgwt.client.widgets.tab.Tab;
+import com.smartgwt.client.widgets.tab.TabSet;
+
+import org.rhq.core.domain.alert.AlertDefinition;
+
+/**
+ * @author John Mazzitelli
+ */
+public class SingleAlertDefinitionView extends VLayout {
+
+ private AlertDefinition alertDefinition;
+ private GeneralPropertiesAlertDefinitionForm generalProperties;
+ private ConditionsAlertDefinitionForm conditions;
+ private NotificationsAlertDefinitionForm notifications;
+ private RecoveryAlertDefinitionForm recovery;
+ private DampeningAlertDefinitionForm dampening;
+
+ private Button editButton;
+ private Button saveButton;
+ private Button cancelButton;
+
+ public SingleAlertDefinitionView() {
+ this(null);
+ }
+
+ public SingleAlertDefinitionView(AlertDefinition alertDefinition) {
+ this.alertDefinition = alertDefinition;
+
+ TabSet tabSet = new TabSet();
+ tabSet.setHeight100();
+
+ Tab generalPropertiesTab = new Tab("General Properties");
+ generalProperties = new GeneralPropertiesAlertDefinitionForm(alertDefinition);
+ generalPropertiesTab.setPane(generalProperties);
+
+ Tab conditionsTab = new Tab("Conditions");
+ conditions = new ConditionsAlertDefinitionForm(alertDefinition);
+ conditionsTab.setPane(conditions);
+
+ Tab notificationsTab = new Tab("Notifications");
+ notifications = new NotificationsAlertDefinitionForm(alertDefinition);
+ notificationsTab.setPane(notifications);
+
+ Tab recoveryTab = new Tab("Recovery");
+ recovery = new RecoveryAlertDefinitionForm(alertDefinition);
+ recoveryTab.setPane(recovery);
+
+ Tab dampeningTab = new Tab("Dampening");
+ dampening = new DampeningAlertDefinitionForm(alertDefinition);
+ dampeningTab.setPane(dampening);
+
+ tabSet.setTabs(generalPropertiesTab, conditionsTab, notificationsTab, recoveryTab, dampeningTab);
+
+ final HLayout buttons = new HLayout();
+ buttons.setMembersMargin(20);
+
+ editButton = new Button("Edit");
+ saveButton = new Button("Save");
+ cancelButton = new Button("Cancel");
+
+ editButton.show();
+ saveButton.hide();
+ cancelButton.hide();
+
+ buttons.addMember(editButton);
+ buttons.addMember(saveButton);
+ buttons.addMember(cancelButton);
+
+ editButton.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ makeEditable();
+ }
+ });
+
+ saveButton.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ saveAlertDefinition();
+ makeViewOnly();
+
+ // TODO getAlertDefinition() should now have the new user data - commit it to DB
+ }
+ });
+
+ cancelButton.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ makeViewOnly();
+ }
+ });
+
+ setMembersMargin(10);
+ addMember(tabSet);
+ addMember(buttons);
+ }
+
+ public AlertDefinition getAlertDefinition() {
+ return alertDefinition;
+ }
+
+ public void setAlertDefinition(AlertDefinition alertDef) {
+ alertDefinition = alertDef;
+
+ generalProperties.setAlertDefinition(alertDef);
+ conditions.setAlertDefinition(alertDef);
+ notifications.setAlertDefinition(alertDef);
+ recovery.setAlertDefinition(alertDef);
+ dampening.setAlertDefinition(alertDef);
+
+ makeViewOnly();
+ }
+
+ public void makeEditable() {
+ saveButton.show();
+ cancelButton.show();
+ editButton.hide();
+
+ generalProperties.makeEditable();
+ conditions.makeEditable();
+ notifications.makeEditable();
+ recovery.makeEditable();
+ dampening.makeEditable();
+ }
+
+ public void makeViewOnly() {
+ saveButton.hide();
+ cancelButton.hide();
+ editButton.show();
+
+ generalProperties.makeViewOnly();
+ conditions.makeViewOnly();
+ notifications.makeViewOnly();
+ recovery.makeViewOnly();
+ dampening.makeViewOnly();
+ }
+
+ public void saveAlertDefinition() {
+ generalProperties.saveAlertDefinition();
+ conditions.saveAlertDefinition();
+ notifications.saveAlertDefinition();
+ recovery.saveAlertDefinition();
+ dampening.saveAlertDefinition();
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/TemplateAlertDefinitionsDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/TemplateAlertDefinitionsDataSource.java
new file mode 100644
index 0000000..9a96db8
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/TemplateAlertDefinitionsDataSource.java
@@ -0,0 +1,57 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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.enterprise.gui.coregui.client.alert.definitions;
+
+import java.util.Map;
+
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.data.DSRequest;
+
+import org.rhq.core.domain.criteria.AlertDefinitionCriteria;
+
+/**
+ * @author John Mazzitelli
+ */
+public class TemplateAlertDefinitionsDataSource extends AbstractAlertDefinitionsDataSource {
+
+ @Override
+ protected AlertDefinitionCriteria getCriteria(DSRequest request) {
+ AlertDefinitionCriteria criteria = new AlertDefinitionCriteria();
+
+ Criteria requestCriteria = request.getCriteria();
+ if (requestCriteria != null) {
+ Map values = requestCriteria.getValues();
+ for (Object key : values.keySet()) {
+ String fieldName = (String) key;
+ if (fieldName.equals(TemplateAlertDefinitionsView.CRITERIA_RESOURCE_TYPE_ID)) {
+ Integer resourceId = (Integer) values.get(fieldName);
+ criteria.addFilterAlertTemplateResourceTypeId(resourceId);
+ }
+ }
+ }
+
+ criteria.setPageControl(getPageControl(request));
+ return criteria;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/TemplateAlertDefinitionsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/TemplateAlertDefinitionsView.java
new file mode 100644
index 0000000..e9674ad
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/TemplateAlertDefinitionsView.java
@@ -0,0 +1,108 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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.enterprise.gui.coregui.client.alert.definitions;
+
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.util.SC;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+import org.rhq.core.domain.resource.ResourceType;
+
+/**
+ * @author John Mazzitelli
+ */
+public class TemplateAlertDefinitionsView extends AbstractAlertDefinitionsView {
+
+ public static final String CRITERIA_RESOURCE_TYPE_ID = "resourceTypeId";
+
+ private ResourceType resourceType;
+
+ public TemplateAlertDefinitionsView(ResourceType resourceType) {
+ super();
+ this.resourceType = resourceType;
+ }
+
+ @Override
+ protected Criteria getCriteria() {
+ Criteria criteria = new Criteria();
+ criteria.addCriteria(CRITERIA_RESOURCE_TYPE_ID, resourceType.getId());
+ return criteria;
+ }
+
+ @Override
+ protected AbstractAlertDefinitionsDataSource getAlertDefinitionDataSource() {
+ return new TemplateAlertDefinitionsDataSource();
+ }
+
+ @Override
+ protected String getTableTitle() {
+ return "Alert Templates";
+ }
+
+ @Override
+ protected boolean isAllowedToModifyAlerts() {
+ // TODO: see if user can modify template alerts
+ return true;
+ }
+
+ @Override
+ protected void newButtonPressed(ListGridRecord[] selection) {
+ // TODO Auto-generated method stub
+ String str = "this is not implemented yet but you selected";
+ for (ListGridRecord record : selection) {
+ str += ": " + record.getAttribute("name");
+ }
+ SC.say(str);
+ }
+
+ @Override
+ protected void enableButtonPressed(ListGridRecord[] selection) {
+ // TODO Auto-generated method stub
+ String str = "this is not implemented yet but you selected";
+ for (ListGridRecord record : selection) {
+ str += ": " + record.getAttribute("name");
+ }
+ SC.say(str);
+ }
+
+ @Override
+ protected void disableButtonPressed(ListGridRecord[] selection) {
+ // TODO Auto-generated method stub
+ String str = "this is not implemented yet but you selected";
+ for (ListGridRecord record : selection) {
+ str += ": " + record.getAttribute("name");
+ }
+ SC.say(str);
+ }
+
+ @Override
+ protected void deleteButtonPressed(ListGridRecord[] selection) {
+ // TODO Auto-generated method stub
+ String str = "this is not implemented yet but you selected";
+ for (ListGridRecord record : selection) {
+ str += ": " + record.getAttribute("name");
+ }
+ SC.say(str);
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
index 2418783..ee29754 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
@@ -34,11 +34,8 @@ import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.grid.ListGrid;
-import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.events.DataArrivedEvent;
import com.smartgwt.client.widgets.grid.events.DataArrivedHandler;
-import com.smartgwt.client.widgets.grid.events.FieldStateChangedEvent;
-import com.smartgwt.client.widgets.grid.events.FieldStateChangedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionEvent;
import com.smartgwt.client.widgets.layout.HLayout;
@@ -68,7 +65,6 @@ public class Table extends VLayout {
private String headerIcon;
-
private boolean showHeader = true;
private boolean showFooter = true;
@@ -91,7 +87,11 @@ public class Table extends VLayout {
/**
* Two or more rows are selected.
*/
- MULTIPLE
+ MULTIPLE,
+ /**
+ * Never enabled - usually due to the user having a lack of permissions
+ */
+ NEVER
}
;
@@ -124,7 +124,7 @@ public class Table extends VLayout {
}
public Table(String tableTitle, Criteria criteria, SortSpecifier[] sortSpecifiers, String[] excludedFieldNames,
- boolean autoFetchData) {
+ boolean autoFetchData) {
super();
setWidth100();
@@ -164,7 +164,6 @@ public class Table extends VLayout {
protected void onInit() {
super.onInit();
-
// NOTE: It is essential that we wait to hide any excluded fields until after super.onDraw() is called, since
// super.onDraw() is what actually adds the fields to the ListGrid (based on what fields are defined in
// the underlying datasource).
@@ -174,13 +173,10 @@ public class Table extends VLayout {
}
}
-
tableInfo.setWrap(false);
-
}
-
@Override
protected void onDraw() {
super.onDraw();
@@ -222,7 +218,7 @@ public class Table extends VLayout {
if (tableAction.confirmMessage != null) {
String message = tableAction.confirmMessage.replaceAll("\\#", String.valueOf(listGrid
- .getSelection().length));
+ .getSelection().length));
SC.ask(message, new BooleanCallback() {
public void execute(Boolean confirmed) {
@@ -244,7 +240,6 @@ public class Table extends VLayout {
footer.addMember(extraWidgetCanvas);
}
-
footer.addMember(new LayoutSpacer());
IButton refreshButton = new IButton("Refresh");
@@ -268,11 +263,9 @@ public class Table extends VLayout {
public void onDataArrived(DataArrivedEvent dataArrivedEvent) {
refreshTableInfo();
fieldSizes.clear();
- totalWidth = 0;
}
});
-
addMember(footer);
}
}
@@ -297,9 +290,7 @@ public class Table extends VLayout {
this.showFooter = showFooter;
}
- private int totalWidth;
private ArrayList<Integer> fieldSizes = new ArrayList<Integer>();
- private boolean autoSizing = false;
public void refresh(Criteria criteria) {
this.listGrid.invalidateCache();
@@ -311,7 +302,6 @@ public class Table extends VLayout {
this.listGrid.invalidateCache();
this.listGrid.markForRedraw();
}
-
public void setTableTitle(String titleString) {
if (titleString == null) {
@@ -346,7 +336,6 @@ public class Table extends VLayout {
return listGrid;
}
-
public void setTitleComponent(Canvas canvas) {
this.titleComponent = canvas;
}
@@ -356,7 +345,7 @@ public class Table extends VLayout {
}
public void addTableAction(String title, SelectionEnablement enablement, String confirmation,
- TableAction tableAction) {
+ TableAction tableAction) {
if (enablement == null) {
enablement = DEFAULT_SELECTION_ENABLEMENT;
}
@@ -383,20 +372,23 @@ public class Table extends VLayout {
for (TableActionInfo tableAction : tableActions) {
boolean enabled;
switch (tableAction.enablement) {
- case ALWAYS:
- enabled = true;
- break;
- case ANY:
- enabled = (count >= 1);
- break;
- case SINGLE:
- enabled = (count == 1);
- break;
- case MULTIPLE:
- enabled = (count > 1);
- break;
- default:
- throw new IllegalStateException("Unhandled SelectionEnablement: " + tableAction.enablement.name());
+ case ALWAYS:
+ enabled = true;
+ break;
+ case NEVER:
+ enabled = false;
+ break;
+ case ANY:
+ enabled = (count >= 1);
+ break;
+ case SINGLE:
+ enabled = (count == 1);
+ break;
+ case MULTIPLE:
+ enabled = (count > 1);
+ break;
+ default:
+ throw new IllegalStateException("Unhandled SelectionEnablement: " + tableAction.enablement.name());
}
tableAction.actionButton.setDisabled(!enabled);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index ea7b88e..5da123b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -33,6 +33,7 @@ import org.rhq.core.domain.resource.composite.ResourcePermission;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
+import org.rhq.enterprise.gui.coregui.client.alert.definitions.ResourceAlertDefinitionsView;
import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTab;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSelectedEvent;
@@ -108,7 +109,7 @@ public class ResourceDetailView extends VLayout implements BookmarkableView, Res
operationsTab.registerSubTabs("History", "Scheduled");
alertsTab = new TwoLevelTab("Alerts", "/images/icons/Alert_grey_16.png");
- alertsTab.registerSubTabs("History", "Definitions");
+ alertsTab.registerSubTabs("History", "Definitions", "DELETEME");
configurationTab = new TwoLevelTab("Configuration", "/images/icons/Configure_grey_16.png");
configurationTab.registerSubTabs("Current", "History");
@@ -178,11 +179,11 @@ public class ResourceDetailView extends VLayout implements BookmarkableView, Res
// 3) user can enable/disable/delete alert definitions if they possess the appropriate permissions
// 4) user can search alert history by: date alert was fired, alert priority, or alert definition
//alertsTab.updateSubTab("History", new ResourceAlertHistoryView(resource.getId()));
- //alertsTab.updateSubTab("Definitions", AlertDefinitionsView.getResourceView(resource));
alertsTab.updateSubTab("History", new FullHTMLPane("/rhq/resource/alert/listAlertHistory-plain.xhtml?id="
+ resource.getId()));
- alertsTab.updateSubTab("Definitions", new FullHTMLPane(
- "/rhq/resource/alert/listAlertDefinitions-plain.xhtml?id=" + resource.getId()));
+ alertsTab.updateSubTab("Definitions", new ResourceAlertDefinitionsView(resource));
+ alertsTab.updateSubTab("DELETEME", new FullHTMLPane("/rhq/resource/alert/listAlertDefinitions-plain.xhtml?id="
+ + resource.getId()));
// comment out GWT-based view until...
// 1) user can search event history by: metric display range, event source, event details, event severity
13 years, 10 months
[rhq] modules/core modules/enterprise
by ips
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementScheduleCriteria.java | 28 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java | 9
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/MeasurementDataGWTService.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementScheduleDataSource.java | 204 ++++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementScheduleListView.java | 81 +++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java | 7
8 files changed, 318 insertions(+), 22 deletions(-)
New commits:
commit 9964a96c296a2ecde766d5e899b5c30bc74a6d2a
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Thu Aug 12 17:28:02 2010 -0400
first rev of the base classes needed for the metric schedule list pages for resources, groups, and templates
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementScheduleCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementScheduleCriteria.java
index cae02bf..c82c98e 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementScheduleCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementScheduleCriteria.java
@@ -39,6 +39,21 @@ import org.rhq.core.domain.util.PageOrdering;
public class MeasurementScheduleCriteria extends Criteria {
private static final long serialVersionUID = 1L;
+ // sort fields from the MeasurementSchedule itself
+ public static final String SORT_FIELD_ENABLED = "enabled";
+ public static final String SORT_FIELD_INTERVAL = "interval";
+
+ // sort fields from the MeasurementSchedule's MeasurementDefinition
+ public static final String SORT_FIELD_DEFINITION_ID = "definitionId";
+ public static final String SORT_FIELD_NAME = "name";
+ public static final String SORT_FIELD_DISPLAY_NAME = "displayName";
+ public static final String SORT_FIELD_DESCRIPTION = "description";
+ public static final String SORT_FIELD_DATA_TYPE = "dataType";
+
+ // filter fields
+ public static final String FILTER_FIELD_RESOURCE_ID = "resourceId";
+ public static final String FILTER_FIELD_RESOURCE_GROUP_ID = "resourceGroupId";
+
private Integer filterId;
private Boolean filterEnabled;
private List<Integer> filterDefinitionIds; // requires overrides
@@ -46,6 +61,7 @@ public class MeasurementScheduleCriteria extends Criteria {
private Integer filterResourceGroupId; // requires overrides
private Integer filterAutoGroupResourceTypeId; // requires overrides
private Integer filterAutoGroupParentResourceId; // requires overrides
+ private Integer filterResourceTypeId; // requires overrides
private boolean fetchBaseline;
private boolean fetchDefinition;
@@ -57,8 +73,8 @@ public class MeasurementScheduleCriteria extends Criteria {
public MeasurementScheduleCriteria() {
filterOverrides.put("definitionIds", "definition.id IN ( ? )");
- filterOverrides.put("resourceId", "resource.id IN ( ? )");
- filterOverrides.put("resourceGroupId", "resource.id IN " //
+ filterOverrides.put(FILTER_FIELD_RESOURCE_ID, "resource.id IN ( ? )");
+ filterOverrides.put(FILTER_FIELD_RESOURCE_GROUP_ID, "resource.id IN " //
+ "( SELECT res.id " //
+ " FROM Resource res " //
+ " JOIN res.implicitGroups ig " //
@@ -74,9 +90,11 @@ public class MeasurementScheduleCriteria extends Criteria {
+ " JOIN res.parentResource parent " //
+ " WHERE parent.id = ? )");
- sortOverrides.put("name", "definition.name");
- sortOverrides.put("displayName", "definition.displayName");
- sortOverrides.put("dataType", "definition.dataType");
+ sortOverrides.put(SORT_FIELD_DEFINITION_ID, "definition.id");
+ sortOverrides.put(SORT_FIELD_NAME, "definition.name");
+ sortOverrides.put(SORT_FIELD_DISPLAY_NAME, "definition.displayName");
+ sortOverrides.put(SORT_FIELD_DESCRIPTION, "definition.description");
+ sortOverrides.put(SORT_FIELD_DATA_TYPE, "definition.dataType");
}
@Override
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
index 6e5430f..3369352 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
@@ -70,9 +70,7 @@ public class AlertDataSource extends RPCDataSource<Alert> {
setCanMultiSort(true);
List<DataSourceField> fields = createFields();
- for (DataSourceField field : fields) {
- addField(field);
- }
+ addFields(fields);
}
protected List<DataSourceField> createFields() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
index 9240e83..c4cf1b4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
@@ -279,18 +279,9 @@ public class AlertsView extends Table {
}
- protected Criteria getCriteria() {
- return null;
- }
-
public void refresh() {
this.getListGrid().invalidateCache();
//this.table.getListGrid().markForRedraw();
}
- public void refresh(Criteria criteria) {
- this.refresh(criteria);
- //this.table.getListGrid().markForRedraw();
- }
-
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
index 2418783..8d71fe2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
@@ -34,11 +34,8 @@ import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.grid.ListGrid;
-import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.events.DataArrivedEvent;
import com.smartgwt.client.widgets.grid.events.DataArrivedHandler;
-import com.smartgwt.client.widgets.grid.events.FieldStateChangedEvent;
-import com.smartgwt.client.widgets.grid.events.FieldStateChangedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionEvent;
import com.smartgwt.client.widgets.layout.HLayout;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/MeasurementDataGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/MeasurementDataGWTService.java
index cd99ad7..c3c67e2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/MeasurementDataGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/MeasurementDataGWTService.java
@@ -53,9 +53,9 @@ public interface MeasurementDataGWTService extends RemoteService {
PageList<CallTimeDataComposite> findCallTimeDataForResource(int scheduleId, long start, long end,
PageControl pageControl);
- public PageList<MeasurementDefinition> findMeasurementDefinitionsByCriteria(MeasurementDefinitionCriteria criteria);
+ PageList<MeasurementDefinition> findMeasurementDefinitionsByCriteria(MeasurementDefinitionCriteria criteria);
- public PageList<MeasurementSchedule> findMeasurementSchedulesByCriteria(MeasurementScheduleCriteria criteria);
+ PageList<MeasurementSchedule> findMeasurementSchedulesByCriteria(MeasurementScheduleCriteria criteria);
PageList<MeasurementOOBComposite> getSchedulesWithOOBs(String metricNameFilter,
String resourceNameFilter, String parentNameFilter, PageControl pc);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementScheduleDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementScheduleDataSource.java
new file mode 100644
index 0000000..9137081
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementScheduleDataSource.java
@@ -0,0 +1,204 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2010 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 as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * 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 for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.common;
+
+import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.data.DataSourceField;
+import com.smartgwt.client.data.fields.DataSourceBooleanField;
+import com.smartgwt.client.data.fields.DataSourceIntegerField;
+import com.smartgwt.client.data.fields.DataSourceTextField;
+import com.smartgwt.client.rpc.RPCResponse;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import org.rhq.core.domain.criteria.MeasurementScheduleCriteria;
+import org.rhq.core.domain.measurement.MeasurementSchedule;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.gwt.MeasurementDataGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * A server-side SmartGWT DataSource for reading and updating {@link MeasurementSchedule}s.
+ *
+ * @author Ian Springer
+ */
+public abstract class AbstractMeasurementScheduleDataSource extends RPCDataSource<MeasurementSchedule> {
+ private MeasurementDataGWTServiceAsync measurementService = GWTServiceLookup.getMeasurementDataService();
+
+ protected AbstractMeasurementScheduleDataSource() {
+ super();
+
+ setCanMultiSort(true);
+
+ List<DataSourceField> fields = createFields();
+ addFields(fields);
+ }
+
+ protected List<DataSourceField> createFields() {
+ List<DataSourceField> fields = new ArrayList<DataSourceField>();
+
+ DataSourceField idField = new DataSourceIntegerField(MeasurementScheduleCriteria.SORT_FIELD_DEFINITION_ID,
+ "Id");
+ idField.setPrimaryKey(true);
+ idField.setHidden(true);
+ fields.add(idField);
+
+ DataSourceTextField nameField = new DataSourceTextField(MeasurementScheduleCriteria.SORT_FIELD_DISPLAY_NAME,
+ "Metric");
+ fields.add(nameField);
+
+ DataSourceTextField descriptionField = new DataSourceTextField(MeasurementScheduleCriteria.SORT_FIELD_DESCRIPTION,
+ "Description");
+ fields.add(descriptionField);
+
+ DataSourceTextField typeField = new DataSourceTextField(MeasurementScheduleCriteria.SORT_FIELD_DATA_TYPE,
+ "Type");
+ fields.add(typeField);
+
+ DataSourceBooleanField enabledField = new DataSourceBooleanField(MeasurementScheduleCriteria.SORT_FIELD_ENABLED,
+ "Enabled?");
+ fields.add(enabledField);
+
+ DataSourceTextField intervalField = new DataSourceTextField(MeasurementScheduleCriteria.SORT_FIELD_INTERVAL,
+ "Collection Interval");
+ fields.add(intervalField);
+
+ return fields;
+ }
+
+ protected void executeFetch(final DSRequest request, final DSResponse response) {
+ final long startTime = System.currentTimeMillis();
+
+ final MeasurementScheduleCriteria criteria = getCriteria(request);
+
+ this.measurementService.findMeasurementSchedulesByCriteria(criteria, new AsyncCallback<PageList<MeasurementSchedule>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to fetch measurement schedules for criteria " + criteria,
+ caught);
+ response.setStatus(RPCResponse.STATUS_FAILURE);
+ processResponse(request.getRequestId(), response);
+ }
+
+ public void onSuccess(PageList<MeasurementSchedule> result) {
+ long fetchDuration = System.currentTimeMillis() - startTime;
+ System.out.println(result.size() + " measurement schedules fetched in: " + fetchDuration + "ms");
+
+ response.setData(buildRecords(result));
+ // For paging to work, we have to specify size of full result set.
+ response.setTotalRows(result.getTotalSize());
+ processResponse(request.getRequestId(), response);
+ }
+ });
+ }
+
+ protected MeasurementScheduleCriteria getCriteria(DSRequest request) {
+ MeasurementScheduleCriteria criteria = new MeasurementScheduleCriteria();
+ criteria.fetchDefinition(true);
+
+ Criteria requestCriteria = request.getCriteria();
+ if (requestCriteria != null) {
+ Map values = requestCriteria.getValues();
+ for (Object key : values.keySet()) {
+ String fieldName = (String) key;
+ if (fieldName.equals(MeasurementScheduleCriteria.FILTER_FIELD_RESOURCE_ID)) {
+ Integer resourceId = (Integer) values.get(fieldName);
+ criteria.addFilterResourceId(resourceId);
+ } else if (fieldName.equals(MeasurementScheduleCriteria.FILTER_FIELD_RESOURCE_GROUP_ID)) {
+ Integer resourceGroupId = (Integer) values.get(fieldName);
+ criteria.addFilterResourceGroupId(resourceGroupId);
+ }
+ // TODO: Add support for other fields we need to filter by (e.g. resourceTypeId for metric templates).
+ }
+ }
+
+ criteria.setPageControl(getPageControl(request));
+ return criteria;
+ }
+
+ @Override
+ public MeasurementSchedule copyValues(ListGridRecord from) {
+ return null; // TODO: Implement?
+ }
+
+ @Override
+ public ListGridRecord copyValues(MeasurementSchedule from) {
+ ListGridRecord record = new ListGridRecord();
+ record.setAttribute("id", from.getId());
+ record.setAttribute(MeasurementScheduleCriteria.SORT_FIELD_DISPLAY_NAME, from.getDefinition().getDisplayName());
+ record.setAttribute(MeasurementScheduleCriteria.SORT_FIELD_DESCRIPTION, from.getDefinition().getDescription());
+ record.setAttribute(MeasurementScheduleCriteria.SORT_FIELD_DATA_TYPE, from.getDefinition().getDataType().name());
+ record.setAttribute(MeasurementScheduleCriteria.SORT_FIELD_ENABLED, from.isEnabled());
+ record.setAttribute(MeasurementScheduleCriteria.SORT_FIELD_INTERVAL, from.getInterval());
+ // TODO: resourceId and resourceGroupId (can probably be handled by subclasses)
+ return record;
+ }
+
+ protected void executeRemove(final DSRequest request, final DSResponse response) {
+ JavaScriptObject data = request.getData();
+ ListGridRecord record = new ListGridRecord(data);
+ Window.alert(String.valueOf(record.getAttributeAsInt("id")));
+ }
+
+ public void enableSchedules(AbstractMeasurementScheduleListView measurementScheduleListView) {
+ Integer[] measurementDefinitionIds = getMeasurementDefinitionIds(measurementScheduleListView);
+ enableSchedules(measurementScheduleListView, measurementDefinitionIds);
+ }
+
+ protected abstract void enableSchedules(AbstractMeasurementScheduleListView measurementScheduleListView,
+ Integer[] measurementDefinitionIds);
+
+ public void disableSchedules(AbstractMeasurementScheduleListView measurementScheduleListView) {
+ Integer[] measurementDefinitionIds = getMeasurementDefinitionIds(measurementScheduleListView);
+ disableSchedules(measurementScheduleListView, measurementDefinitionIds);
+ }
+
+ protected abstract void disableSchedules(AbstractMeasurementScheduleListView measurementScheduleListView,
+ Integer[] measurementDefinitionIds);
+
+ public void updateSchedules(AbstractMeasurementScheduleListView measurementScheduleListView, long interval) {
+ Integer[] measurementDefinitionIds = getMeasurementDefinitionIds(measurementScheduleListView);
+ updateSchedules(measurementScheduleListView, measurementDefinitionIds, interval);
+ }
+
+ private Integer[] getMeasurementDefinitionIds(AbstractMeasurementScheduleListView measurementScheduleListView) {
+ ListGrid listGrid = measurementScheduleListView.getListGrid();
+ ListGridRecord[] records = listGrid.getSelection();
+
+ Integer[] measurementDefinitionIds = new Integer[records.length];
+ for (int i = 0, selectionLength = records.length; i < selectionLength; i++) {
+ ListGridRecord record = records[i];
+ Integer measurementDefinitionId = record.getAttributeAsInt(MeasurementScheduleCriteria.SORT_FIELD_DEFINITION_ID);
+ measurementDefinitionIds[i] = measurementDefinitionId;
+ }
+ return measurementDefinitionIds;
+ }
+
+ protected abstract void updateSchedules(final AbstractMeasurementScheduleListView measurementScheduleListView,
+ final Integer[] measurementDefinitionIds, final long interval);
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementScheduleListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementScheduleListView.java
new file mode 100644
index 0000000..8d76d32
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementScheduleListView.java
@@ -0,0 +1,81 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2010 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 as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * 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 for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.common;
+
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.data.SortSpecifier;
+import com.smartgwt.client.types.SortDirection;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import org.rhq.core.domain.criteria.MeasurementScheduleCriteria;
+import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
+
+/**
+ * A view that displays a non-paginated table of {@link org.rhq.core.domain.measurement.MeasurementSchedule measurement
+ * schedule}s, along with the ability to sort, enable, disable, or update the collection interval on those schedules.
+ *
+ * @author Ian Springer
+ */
+// TODO: Actually, this class probably does not need to be abstract...
+public abstract class AbstractMeasurementScheduleListView extends Table {
+ private static final String TITLE = "Metric Collection Schedules";
+
+ private static final SortSpecifier[] SORT_SPECIFIERS = new SortSpecifier[]{
+ new SortSpecifier(MeasurementScheduleCriteria.SORT_FIELD_DISPLAY_NAME, SortDirection.ASCENDING)
+ };
+
+ public AbstractMeasurementScheduleListView(AbstractMeasurementScheduleDataSource dataSource) {
+ this(dataSource, null, null);
+ }
+
+ public AbstractMeasurementScheduleListView(AbstractMeasurementScheduleDataSource dataSource, Criteria criteria, String[] excludedFieldNames) {
+ super(TITLE, criteria, SORT_SPECIFIERS, excludedFieldNames);
+ setDataSource(dataSource);
+ }
+
+ @Override
+ public AbstractMeasurementScheduleDataSource getDataSource() {
+ return (AbstractMeasurementScheduleDataSource) super.getDataSource();
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+
+ ListGrid listGrid = getListGrid();
+ listGrid.getField(MeasurementScheduleCriteria.SORT_FIELD_DISPLAY_NAME).setWidth("20%");
+ listGrid.getField(MeasurementScheduleCriteria.SORT_FIELD_DESCRIPTION).setWidth("30%");
+ listGrid.getField(MeasurementScheduleCriteria.SORT_FIELD_DATA_TYPE).setWidth("20%");
+ listGrid.getField(MeasurementScheduleCriteria.SORT_FIELD_ENABLED).setWidth("10%");
+ listGrid.getField(MeasurementScheduleCriteria.SORT_FIELD_INTERVAL).setWidth("20%");
+
+ addTableAction("Enable", Table.SelectionEnablement.ANY, null, new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ getDataSource().enableSchedules(AbstractMeasurementScheduleListView.this);
+ }
+ });
+ addTableAction("Disable", Table.SelectionEnablement.ANY, null, new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ getDataSource().disableSchedules(AbstractMeasurementScheduleListView.this);
+ }
+ });
+ // TODO: Add controls to set collection interval - base class is going to need massaging...
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
index 95436d4..1b6f6cd 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
@@ -23,6 +23,7 @@ import java.util.Collection;
import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.data.DataSource;
+import com.smartgwt.client.data.DataSourceField;
import com.smartgwt.client.types.DSDataFormat;
import com.smartgwt.client.types.DSProtocol;
import com.smartgwt.client.widgets.grid.ListGridRecord;
@@ -169,4 +170,10 @@ public abstract class RPCDataSource<T> extends DataSource {
response.setStatus(0);
return response;
}
+
+ public void addFields(Collection<DataSourceField> fields) {
+ for (DataSourceField field : fields) {
+ addField(field);
+ }
+ }
}
13 years, 10 months
[rhq] modules/core
by Joseph Marques
modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/RuntimeDiscoveryExecutor.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 1043bd79d2744f13a4b8db9b54fc7df9811fa619
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Aug 12 16:24:14 2010 -0400
BZ-536368 - fix for ConcurrentModificationException during resource discovery
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/RuntimeDiscoveryExecutor.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/RuntimeDiscoveryExecutor.java
index c16ba56..1d803b4 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/RuntimeDiscoveryExecutor.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/RuntimeDiscoveryExecutor.java
@@ -136,7 +136,7 @@ public class RuntimeDiscoveryExecutor implements Runnable, Callable<InventoryRep
discoverForResource(platform, report, false);
// Next discover all other services and non-top-level servers
- Set<Resource> servers = platform.getChildResources();
+ Set<Resource> servers = new HashSet<Resource>(platform.getChildResources()); // prevent concurrent mod
for (Resource server : servers) {
discoverForResource(server, report, false);
}
13 years, 10 months
[rhq] modules/enterprise
by Joseph Marques
modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/struts-config.xml | 20 +++++++
modules/enterprise/gui/portal-war/src/main/webapp/admin/config/ChangeResourceTemplate.jsp | 26 +++++++---
modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/config/ConfigMetrics.jsp | 15 +++++
modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/config/EditConfigMetricsVisibility.jsp | 3 +
modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/config/ShowOneResourceType.jsp | 13 +++--
5 files changed, 67 insertions(+), 10 deletions(-)
New commits:
commit 733cabfa08d3ca73b943665a65771ee7fef41256
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Aug 12 14:54:11 2010 -0400
mplement "plain" / "nomenu" scheme using iframed-struts for unimplemented metric templates section
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/struts-config.xml b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/struts-config.xml
index 6c08474..61a14fe 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/struts-config.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/struts-config.xml
@@ -1264,6 +1264,16 @@
<forward name="success" path="/resource/platform/monitor/Config.do?mode=configure"/>
</action>
+ <action path="/resource/platform/monitor/config/ConfigMetricsNoMenu"
+ name="MonitoringConfigForm"
+ scope="request"
+ input="/resource/platform/monitor/Config.do?mode=configure&nomenu=true"
+ type="org.rhq.enterprise.gui.legacy.action.resource.common.monitor.config.ConfigMetricsAction">
+ <forward name="remove" path="/resource/platform/monitor/Config.do?mode=configure&nomenu=true"/>
+ <forward name="failure" path="/resource/platform/monitor/Config.do?mode=configure&nomenu=true"/>
+ <forward name="success" path="/resource/platform/monitor/Config.do?mode=configure&nomenu=true"/>
+ </action>
+
<!-- / -->
<!-- server monitoring actions -->
@@ -3135,6 +3145,16 @@
<forward name="failure" path="/admin/platform/monitor/Config.do?mode=configure"/>
<forward name="success" path="/admin/platform/monitor/Config.do?mode=configure"/>
</action>
+
+ <action path="/resource/common/monitor/config/ConfigMetricsNoMenu"
+ name="MonitoringConfigForm"
+ scope="request"
+ input="/admin/platform/monitor/Config.do?mode=configure&nomenu=true"
+ type="org.rhq.enterprise.gui.legacy.action.resource.common.monitor.config.ConfigMetricsAction">
+ <forward name="remove" path="/admin/platform/monitor/Config.do?mode=configure&nomenu=true"/>
+ <forward name="failure" path="/admin/platform/monitor/Config.do?mode=configure&nomenu=true"/>
+ <forward name="success" path="/admin/platform/monitor/Config.do?mode=configure&nomenu=true"/>
+ </action>
<!-- === Resource Monitor>Events Tab === -->
<action path="/resource/common/Events"
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/admin/config/ChangeResourceTemplate.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/admin/config/ChangeResourceTemplate.jsp
index 988672f..0ec1a85 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/admin/config/ChangeResourceTemplate.jsp
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/admin/config/ChangeResourceTemplate.jsp
@@ -32,9 +32,16 @@
<td class="ListCellPrimary"><c:out value="${entry.type.name}"/> <c:out value="${entry.pluginInfo}"/></td>
<td class="ListCell" align="left" nowrap="nowrap">
<c:if test="${monitorEnabled}">
- <html:link page="/admin/platform/monitor/Config.do?mode=configure&id=${entry.type.id}&type=${entry.type.id}" styleClass="buttonsmall">
- Edit Metric Template
- </html:link>
+ <c:if test="${not empty param.nomenu}">
+ <html:link page="/admin/platform/monitor/Config.do?nomenu=true&mode=configure&id=${entry.type.id}&type=${entry.type.id}" styleClass="buttonsmall">
+ Edit Metric Template
+ </html:link>
+ </c:if>
+ <c:if test="${empty param.nomenu}">
+ <html:link page="/admin/platform/monitor/Config.do?mode=configure&id=${entry.type.id}&type=${entry.type.id}" styleClass="buttonsmall">
+ Edit Metric Template
+ </html:link>
+ </c:if>
<c:if test="${(entry.enabledMetricCount + entry.disabledMetricCount) > 0}">
<span title="(enabled | disabled)">
(<c:out value="${entry.enabledMetricCount}" /> | <c:out value="${entry.disabledMetricCount}" />)
@@ -99,9 +106,16 @@
<td class="ListCellPrimary"><c:out value="${entry.type.name}"/> <c:out value="${entry.pluginInfo}"/></td>
<td class="ListCell" align="left">
<c:if test="${monitorEnabled}">
- <html:link page="/admin/platform/monitor/Config.do?mode=configure&type=${entry.type.id}" styleClass="buttonsmall">
- Edit Metric Template
- </html:link>
+ <c:if test="${not empty param.nomenu}">
+ <html:link page="/admin/platform/monitor/Config.do?nomenu=true&mode=configure&type=${entry.type.id}" styleClass="buttonsmall">
+ Edit Metric Template
+ </html:link>
+ </c:if>
+ <c:if test="${empty param.nomenu}">
+ <html:link page="/admin/platform/monitor/Config.do?mode=configure&type=${entry.type.id}" styleClass="buttonsmall">
+ Edit Metric Template
+ </html:link>
+ </c:if>
<c:if test="${(entry.enabledMetricCount + entry.disabledMetricCount) > 0}">
<span title="(enabled | disabled)">
(<c:out value="${entry.enabledMetricCount}" /> | <c:out value="${entry.disabledMetricCount}" />)
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/config/ConfigMetrics.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/config/ConfigMetrics.jsp
index 8ce14ae..26b0682 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/config/ConfigMetrics.jsp
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/config/ConfigMetrics.jsp
@@ -22,17 +22,30 @@
<c:param name="mode" value="configure"/>
<c:param name="groupId" value="${groupId}"/>
<c:param name="category" value="COMPATIBLE"/>
+ <c:if test="${not empty param.nomenu}">
+ <c:param name="nomenu" value="${param.nomenu}" />
+ </c:if>
</c:url>
</c:when>
<c:otherwise>
<c:url var="selfAction" value="/resource/common/monitor/Config.do">
<c:param name="mode" value="configure"/>
<c:param name="id" value="${Resource.id}"/>
+ <c:if test="${not empty param.nomenu}">
+ <c:param name="nomenu" value="${param.nomenu}" />
+ </c:if>
</c:url>
</c:otherwise>
</c:choose>
-<html:form action="/resource/${section}/monitor/config/ConfigMetrics">
+<c:if test="${not empty param.nomenu}">
+ <c:set var="actionSuffix" value="NoMenu" />
+</c:if>
+<c:if test="${empty param.nomenu}">
+ <c:set var="actionSuffix" value="" />
+</c:if>
+
+<html:form action="/resource/${section}/monitor/config/ConfigMetrics${actionSuffix}">
<c:choose>
<c:when test="${not empty ResourceType && empty param.parent}">
<!-- resource type wasn't empty so it is a default-->
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/config/EditConfigMetricsVisibility.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/config/EditConfigMetricsVisibility.jsp
index c89b9e7..6780c28 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/config/EditConfigMetricsVisibility.jsp
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/config/EditConfigMetricsVisibility.jsp
@@ -40,6 +40,9 @@
<c:if test="${not empty param.ps}">
<c:param name="ps" value="${param.ps}"/>
</c:if>
+ <c:if test="${not empty param.nomenu}">
+ <c:param name="nomenu" value="${param.nomenu}"/>
+ </c:if>
</c:url>
<c:if test="${ResourceType != null && param.parent > 0}">
<c:set var="isAutoGroup" value="true"/>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/config/ShowOneResourceType.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/config/ShowOneResourceType.jsp
index 4ce0cf2..9165090 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/config/ShowOneResourceType.jsp
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/config/ShowOneResourceType.jsp
@@ -50,9 +50,16 @@
</td>
<td class="ListCell" align="left" nowrap="nowrap">
<c:if test="${monitorEnabled}">
- <html:link page="/admin/platform/monitor/Config.do?mode=configure&id=${serviceType.type.id}&type=${serviceType.type.id}" styleClass="buttonsmall">
- Edit Metric Template
- </html:link>
+ <c:if test="${not empty param.nomenu}">
+ <html:link page="/admin/platform/monitor/Config.do?nomenu=true&mode=configure&id=${serviceType.type.id}&type=${serviceType.type.id}" styleClass="buttonsmall">
+ Edit Metric Template
+ </html:link>
+ </c:if>
+ <c:if test="${empty param.nomenu}">
+ <html:link page="/admin/platform/monitor/Config.do?mode=configure&id=${serviceType.type.id}&type=${serviceType.type.id}" styleClass="buttonsmall">
+ Edit Metric Template
+ </html:link>
+ </c:if>
<c:if test="${(serviceType.enabledMetricCount + serviceType.disabledMetricCount) > 0}">
<span title="(enabled | disabled)">
(<c:out value="${serviceType.enabledMetricCount}" /> | <c:out value="${serviceType.disabledMetricCount}" />)
13 years, 10 months
[rhq] 3 commits - modules/enterprise
by Joseph Marques
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java | 2
modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/admin-navigation-plain.xml | 106 +++
modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/struts-config.xml | 13
modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/web.xml | 1
modules/enterprise/gui/portal-war/src/main/webapp/admin/config/EditServerConfig.jsp | 3
modules/enterprise/gui/portal-war/src/main/webapp/admin/license/License.jsp | 2
modules/enterprise/gui/portal-war/src/main/webapp/admin/license/LicenseEdit.jsp | 28 -
modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-config-plain.xhtml | 108 ++++
modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-details-plain.xhtml | 155 +++++
modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-edit-add-map-plain.xhtml | 28 +
modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-edit-map-plain.xhtml | 21
modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-edit-plain.xhtml | 41 +
modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-edit-update-map-plain.xhtml | 29 +
modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-edit-view-map-plain.xhtml | 22
modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-list-plain.xhtml | 268 ++++++++++
15 files changed, 823 insertions(+), 4 deletions(-)
New commits:
commit d8fca9dc8305e86a642cd4be9633b93476670c98
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Aug 12 13:57:54 2010 -0400
implement "plain" scheme using iframed-facelets for unimplemented admin > config > plugins section
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
index dc1bb5c..5779155 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
@@ -241,7 +241,7 @@ public class AdministrationView extends HLayout implements BookmarkableView {
} else if ("License".equals(page)) {
url = "/admin/license/LicenseAdmin.do?mode=view";
} else if ("Plugins".equals(page)) {
- url = "/rhq/admin/plugin/plugin-list.xhtml";
+ url = "/rhq/admin/plugin/plugin-list-plain.xhtml";
}
url = addQueryStringParam(url, "nomenu=true");
content = new FullHTMLPane(url);
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/admin-navigation-plain.xml b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/admin-navigation-plain.xml
new file mode 100644
index 0000000..e2c4d98
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/admin-navigation-plain.xml
@@ -0,0 +1,106 @@
+<?xml version="1.0"?>
+
+<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+
+ <navigation-rule>
+ <from-view-id>/rhq/admin/largeenv-plain.xhtml</from-view-id>
+
+ <navigation-case>
+ <!-- catch all navigation-case: if any actions return 'success', go here -->
+ <from-outcome>success</from-outcome>
+ <to-view-id>/rhq/admin/largeenv-plain.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ </navigation-rule>
+
+ <navigation-rule>
+ <from-view-id>/rhq/admin/plugin/plugin-list-plain.xhtml</from-view-id>
+
+ <navigation-case>
+ <!-- catch all navigation-case: if any actions return 'success', go here -->
+ <from-action>#{InstalledPluginsUIBean.uploadPlugin}</from-action>
+ <from-outcome>success</from-outcome>
+ <to-view-id>/rhq/admin/plugin/plugin-list-plain.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ </navigation-rule>
+
+ <navigation-rule>
+ <from-view-id>/rhq/admin/plugin/plugin-config-plain.xhtml</from-view-id>
+
+ <navigation-case>
+ <from-action>#{ConfigHelperUIBean.accessMap}</from-action>
+ <to-view-id>/rhq/admin/plugin/plugin-edit-view-map-plain.xhtml?plugin=#{pluginConfigUIBean.plugin.name}&deployment=#{pluginConfigUIBean.plugin.deployment}&pluginType=#{pluginConfigUIBean.plugin.type}&listName=#{param.listName}&listIndex=#{param.listIndex}</to-view-id>
+
+ <redirect />
+ </navigation-case>
+ </navigation-rule>
+
+ <navigation-rule>
+ <from-view-id>/rhq/admin/plugin/plugin-edit-plain.xhtml</from-view-id>
+
+ <navigation-case>
+ <from-action>#{ConfigHelperUIBean.addNewMap}</from-action>
+ <to-view-id>/rhq/admin/plugin/plugin-edit-add-map-plain.xhtml</to-view-id>
+ </navigation-case>
+
+ <navigation-case>
+ <from-action>#{ConfigHelperUIBean.accessMap}</from-action>
+ <to-view-id>/rhq/admin/plugin/plugin-edit-update-map-plain.xhtml</to-view-id>
+ </navigation-case>
+
+ <navigation-case>
+ <from-action>#{editPluginConfigurationUIBean.updatePlugin}</from-action>
+ <from-outcome>success</from-outcome>
+ <to-view-id>/rhq/admin/plugin/plugin-config-plain.xhtml?pluginName=#{editPluginConfigurationUIBean.plugin.name}</to-view-id>
+
+ <redirect />
+ </navigation-case>
+ </navigation-rule>
+
+ <navigation-rule>
+ <from-view-id>/rhq/admin/plugin/plugin-edit-add-map-plain.xhtml</from-view-id>
+
+ <navigation-case>
+ <from-outcome>success</from-outcome>
+ <to-view-id>/rhq/admin/plugin/plugin-edit-plain.xhtml?plugin=#{pluginConfigUIBean.plugin.name}&deployment=#{pluginConfigUIBean.plugin.deployment}&pluginType=#{pluginConfigUIBean.plugin.type}</to-view-id>
+
+ <redirect/>
+ </navigation-case>
+
+ </navigation-rule>
+
+ <navigation-rule>
+ <from-view-id>/rhq/admin/plugin/plugin-edit-update-map-plain.xhtml</from-view-id>
+
+ <navigation-case>
+ <from-outcome>success</from-outcome>
+ <to-view-id>/rhq/admin/plugin/plugin-edit-plain.xhtml?plugin=#{pluginConfigUIBean.plugin.name}&deployment=#{pluginConfigUIBean.plugin.deployment}&pluginType=#{pluginConfigUIBean.plugin.type}</to-view-id>
+
+ <redirect/>
+ </navigation-case>
+
+ </navigation-rule>
+
+ <navigation-rule>
+ <from-view-id>/rhq/admin/plugin/plugin-details-plain.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>success</from-outcome>
+ <to-view-id>/rhq/admin/plugin/plugin-details-plain.xhtml?plugin=#{plugin.name}&deployment=#{plugin.deployment}&pluginType=#{serverPlugin.type}&control=#{param.control}</to-view-id>
+ <redirect/>
+ </navigation-case>
+ </navigation-rule>
+
+ <navigation-rule>
+ <navigation-case>
+ <from-outcome>sessionExpired</from-outcome>
+ <to-view-id>/Login.do</to-view-id>
+ <redirect/>
+ </navigation-case>
+ </navigation-rule>
+
+</faces-config>
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/web.xml b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/web.xml
index 87580b6..ed22bc6 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/web.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/web.xml
@@ -162,6 +162,7 @@
/WEB-INF/jsf-navigation/summary-navigation.xml,
/WEB-INF/jsf-navigation/test-navigation.xml,
+ /WEB-INF/jsf-navigation/admin-plain-navigation.xml,
/WEB-INF/jsf-navigation/alert-plain-navigation.xml,
/WEB-INF/jsf-navigation/cluster-plain-navigation.xml,
/WEB-INF/jsf-navigation/content-plain-navigation.xml,
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-config-plain.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-config-plain.xhtml
new file mode 100644
index 0000000..56c872d
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-config-plain.xhtml
@@ -0,0 +1,108 @@
+<ui:composition template="/rhq/entity/layout/main-plain.xhtml"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:onc="http://jboss.org/on/component"
+ xmlns:onf="http://jboss.org/on/function"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+
+ <ui:define name="content">
+
+ <h:form id="pluginsConfigForm">
+ <h:panelGrid columns="2" width="100%" columnClasses="col1,col2">
+ <rich:panel>
+ <f:facet name="header">
+ <h:outputText value="Available Plugins" />
+ </f:facet>
+
+ <rich:tree nodeSelectListener="#{pluginConfigUIBean.processSelection}"
+ adviseNodeSelected="#{pluginConfigUIBean.adviseSelected}"
+ adviseNodeOpened="#{pluginConfigUIBean.adviseOpened}"
+ reRender="pluginConfig"
+ value="#{pluginConfigUIBean.root}"
+ ajaxSubmitSelection="true"
+ switchType="client"
+ var="item"
+ toggleOnClick="false"
+ nodeFace="#{item.class.simpleName}"
+ >
+
+ <rich:treeNode type="String">
+ <h:outputText value="#{item}s" />
+ </rich:treeNode>
+ <rich:treeNode type="ServerPlugin">
+ <h:outputText value="#{item.displayName}" />
+ </rich:treeNode>
+ </rich:tree>
+ </rich:panel>
+
+ <h:panelGroup id="pluginConfig">
+ <rich:panel id="detailsLink"
+ style="background: #EEEEEE;"
+ rendered="#{pluginConfigUIBean.plugin != null}" >
+ <h:outputText value="See the " />
+ <h:outputLink value="/rhq/admin/plugin/plugin-details-plain.xhtml">
+ <f:param name="plugin" value="#{pluginConfigUIBean.plugin.name}"/>
+ <f:param name="deployment" value="#{pluginConfigUIBean.plugin.deployment}"/>
+ <f:param name="pluginType" value="#{pluginConfigUIBean.plugin.type}"/>
+ <h:outputText value="'#{pluginConfigUIBean.plugin.displayName}' details page"/>
+ </h:outputLink>
+ <h:outputText value=" for more plugin information." />
+ </rich:panel>
+
+ <rich:panel id="noConfigMessage"
+ style="background: #EEEEEE;"
+ rendered="#{not pluginConfigUIBean.editable and pluginConfigUIBean.plugin != null}" >
+ <h:outputText escape="true" value="Plugin '#{pluginConfigUIBean.plugin.displayName}' has no configuration." />
+ </rich:panel>
+
+ <rich:panel id="pluginButtonsTopPanel" rendered="#{pluginConfigUIBean.editable}">
+ <h:panelGroup id="pluginButtonsTop">
+ <h:outputLink value="/rhq/admin/plugin/plugin-edit-plain.xhtml" styleClass="buttonmed">
+ <f:param name="plugin" value="#{pluginConfigUIBean.plugin.name}"/>
+ <f:param name="deployment" value="#{pluginConfigUIBean.plugin.deployment}"/>
+ <f:param name="pluginType" value="#{pluginConfigUIBean.plugin.type}"/>
+ <h:outputText value="EDIT"/>
+ </h:outputLink>
+ </h:panelGroup>
+ </rich:panel>
+
+ <rich:panel rendered="#{pluginConfigUIBean.plugin.pluginConfiguration != null}">
+ <f:facet name="header">
+ <h:outputText value="Plugin Configuration"/>
+ </f:facet>
+ <onc:config configurationDefinition="#{pluginConfigUIBean.pluginConfigurationDefinition}"
+ configuration="#{pluginConfigUIBean.plugin.pluginConfiguration}"
+ readOnly="true" />
+ </rich:panel>
+
+ <rich:panel rendered="#{pluginConfigUIBean.plugin.scheduledJobsConfiguration != null}">
+ <f:facet name="header">
+ <h:outputText value="Scheduled Jobs"/>
+ </f:facet>
+ <onc:config configurationDefinition="#{pluginConfigUIBean.scheduledJobsDefinition}"
+ configuration="#{pluginConfigUIBean.plugin.scheduledJobsConfiguration}"
+ readOnly="true" />
+ </rich:panel>
+
+ <rich:panel id="pluginButtonsBottomPanel" rendered="#{pluginConfigUIBean.editable}">
+ <h:panelGroup id="pluginButtonsBottom">
+ <h:outputLink value="/rhq/admin/plugin/plugin-edit-plain.xhtml" styleClass="buttonmed">
+ <f:param name="plugin" value="#{pluginConfigUIBean.plugin.name}"/>
+ <f:param name="deployment" value="#{pluginConfigUIBean.plugin.deployment}"/>
+ <f:param name="pluginType" value="#{pluginConfigUIBean.plugin.type}"/>
+ <h:outputText value="EDIT"/>
+ </h:outputLink>
+ </h:panelGroup>
+ </rich:panel>
+
+ </h:panelGroup>
+ </h:panelGrid>
+ </h:form>
+ </ui:define>
+
+</ui:composition>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-details-plain.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-details-plain.xhtml
new file mode 100644
index 0000000..fc22797
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-details-plain.xhtml
@@ -0,0 +1,155 @@
+<ui:composition template="/rhq/entity/layout/main-plain.xhtml"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:onc="http://jboss.org/on/component"
+ xmlns:onf="http://jboss.org/on/function"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+
+ <ui:define name="content">
+
+ <h:form id="pluginsForm">
+
+ <rich:panel>
+ <f:facet name="header">
+ <h:outputText value="Plugin: #{plugin.displayName} (#{plugin.name})"/>
+ </f:facet>
+
+ <h:panelGrid styleClass="BlockContent" columns="4" width="100%">
+
+ <h:outputLabel styleClass="BlockLabel" value="Version:"/>
+ <h:outputText styleClass="BlockContent" value="#{plugin.version}"/>
+
+ <h:outputLabel styleClass="BlockLabel" value="AMPS Version:"/>
+ <h:outputText styleClass="BlockContent" value="#{plugin.ampsVersion}"/>
+
+ <h:outputLabel styleClass="BlockLabel" value="Enabled:"/>
+ <h:outputText styleClass="BlockContent" value="#{plugin.enabled}"/>
+
+ <h:outputLabel styleClass="BlockLabel" value="Type:"/>
+ <h:outputText styleClass="BlockContent" value="#{plugin.deployment}"/>
+
+ <h:outputLabel styleClass="BlockLabel" value="MD5:"/>
+ <h:outputText styleClass="BlockContent" value="#{plugin.md5}"/>
+
+ <h:outputLabel styleClass="BlockLabel" value="Description:"/>
+ <h:outputText styleClass="BlockContent" value="#{plugin.description}"/>
+
+ <h:outputLabel styleClass="BlockLabel" value="Path:"/>
+ <h:outputText styleClass="BlockContent" value="#{plugin.path}"/>
+ </h:panelGrid>
+
+ <br />
+ <h:outputLink value="/rhq/admin/plugin/plugin-config-plain.xhtml" rendered="#{plugin.deployment eq 'SERVER'}">
+ <f:param name="pluginName" value="#{plugin.name}"/>
+ <h:outputText value="Configure '#{plugin.displayName}'"/>
+ </h:outputLink>
+ <br />
+ <br />
+
+ <rich:panel>
+ <f:facet name="header">
+ <h:outputText value="Plugin Help"/>
+ </f:facet>
+
+ <h:outputText escape="false" value="<pre> #{plugin.help} </pre>"/>
+ </rich:panel>
+
+ <rich:panel rendered="#{plugin.deployment == 'SERVER' and ServerPluginControlUIBean.controls.size > 0 and ServerPluginControlUIBean.permission }">
+ <f:facet name="header">
+ <h:outputText value="Plugin Controls"/>
+ </f:facet>
+
+ <rich:dataTable id="serverPluginsDataTable"
+ value="#{ServerPluginControlUIBean.controls}"
+ var="control"
+ width="100%"
+ columnsWidth="25% 75%"
+ headerClass="tableRowHeader"
+ footerClass="on-pager-footer"
+ onRowMouseOver="this.style.backgroundColor='#E7E7E7'"
+ onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
+
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Name"/>
+ </f:facet>
+
+ <h:outputLink value="/rhq/admin/plugin/plugin-details-plain.xhtml">
+ <f:param name="plugin" value="#{plugin.name}"/>
+ <f:param name="deployment" value="#{plugin.deployment}"/>
+ <f:param name="pluginType" value="#{plugin.type}"/>
+ <f:param name="control" value="#{control[0]}"/>
+ <h:outputText value="#{control[1]} *" rendered="#{param.control eq control[0]}"/>
+ <h:outputText value="#{control[1]}" rendered="#{param.control ne control[0]}"/>
+ </h:outputLink>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Description"/>
+ </f:facet>
+
+ <h:outputText value="#{control[2]}"/>
+ </rich:column>
+ </rich:dataTable>
+
+ <br/>
+ <onc:config id="paramConfig"
+ rendered="#{param.control ne null}"
+ readOnly="#{ServerPluginControlUIBean.resultsAvailable}"
+ configurationDefinition="#{ServerPluginControlUIBean.paramsDefinition}"
+ configuration="#{ServerPluginControlUIBean.paramsConfiguration}"
+ nullConfigurationDefinitionMessage="This control does not accept parameters"
+ nullConfigurationMessage="This control does not accept parameters!"
+ nullConfigurationStyle="InfoBlock"/>
+ <br />
+ <input type="hidden" name="plugin" value="#{plugin.name}" />
+ <input type="hidden" name="deployment" value="#{plugin.deployment}" />
+ <input type="hidden" name="pluginType" value="#{serverPlugin.type}" />
+ <c:if test="${not empty param.control}">
+ <input type="hidden" name="control" value="#{param.control}" />
+ </c:if>
+ <h:commandButton action="#{ServerPluginControlUIBean.invokeControl}"
+ rendered="#{param.control ne null and !ServerPluginControlUIBean.resultsAvailable }"
+ value="EXECUTE"
+ styleClass="buttonmed"
+ onclick="return preventDoubleClick();"/>
+ <br/>
+ <h:panelGrid rendered="#{ServerPluginControlUIBean.resultsAvailable}">
+ <rich:panel>
+ <h:outputText rendered="#{ServerPluginControlUIBean.resultsError ne null}" value="Results: #{ServerPluginControlUIBean.resultsError}" styleClass="ErrorBlock" />
+ <h:outputText rendered="#{ServerPluginControlUIBean.resultsError eq null}" value="Results: Success!" styleClass="InfoBlock" />
+ </rich:panel>
+ <rich:panel rendered="#{ServerPluginControlUIBean.resultsDefinition ne null}">
+ <onc:config id="resultsConfig"
+ readOnly="true"
+ configurationDefinition="#{ServerPluginControlUIBean.resultsDefinition}"
+ configuration="#{ServerPluginControlUIBean.resultsConfiguration}"
+ nullConfigurationDefinitionMessage="No result properties were returned"
+ nullConfigurationMessage="No result properties were returned!"
+ nullConfigurationStyle="#{ServerPluginControlUIBean.resultsError eq null ? 'InfoBlock' : 'WarnBlock'}"/>
+ </rich:panel>
+ </h:panelGrid>
+
+
+ </rich:panel>
+
+ </rich:panel>
+ </h:form>
+
+ <script type="text/javascript">
+ var submitted = false;
+ function preventDoubleClick() {
+ if (submitted) { return false; }
+ else { submitted = true; return true; }
+ }
+ </script>
+
+ </ui:define>
+
+ </ui:composition>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-edit-add-map-plain.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-edit-add-map-plain.xhtml
new file mode 100644
index 0000000..73d77e6
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-edit-add-map-plain.xhtml
@@ -0,0 +1,28 @@
+<ui:composition template="/rhq/admin/plugin/plugin-edit-map-plain.xhtml"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:onc="http://jboss.org/on/component"
+ xmlns:onf="http://jboss.org/on/function"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+
+ <ui:param name="actionVerb" value="Add to" />
+ <ui:param name="editBreadCrumb" value="true" />
+
+ <ui:define name="mapConfig">
+ <onc:config configurationDefinition="#{editPluginConfigurationUIBean.currentConfigurationDefinition}"
+ configuration="#{editPluginConfigurationUIBean.currentConfiguration}"
+ listName="#{param.listName}" />
+
+ <h:panelGrid columns="2" styleClass="buttons-table" columnClasses="button-cell">
+ <h:commandButton value="OK" type="submit" action="#{editPluginConfigurationUIBean.finishMap}"
+ alt="Click to Add Map" styleClass="buttonmed"/>
+ <h:commandButton value="RESET" type="reset" immediate="true"
+ alt="Click to Reset Fields" styleClass="buttonmed"/>
+ </h:panelGrid>
+ </ui:define>
+</ui:composition>
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-edit-map-plain.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-edit-map-plain.xhtml
new file mode 100644
index 0000000..8e0f8b9
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-edit-map-plain.xhtml
@@ -0,0 +1,21 @@
+<ui:composition template="/rhq/entity/layout/main-plain.xhtml"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:onc="http://jboss.org/on/component"
+ xmlns:onf="http://jboss.org/on/function"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+
+ <ui:define name="content">
+
+ <h:form id="editPluginConfigurationForm" onsubmit="prepareInputsForSubmission(this)">
+ <ui:insert name="mapConfig" />
+ </h:form>
+
+ </ui:define>
+
+</ui:composition>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-edit-plain.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-edit-plain.xhtml
new file mode 100644
index 0000000..ffa8733
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-edit-plain.xhtml
@@ -0,0 +1,41 @@
+<ui:composition template="/rhq/entity/layout/main-plain.xhtml"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:onc="http://jboss.org/on/component"
+ xmlns:onf="http://jboss.org/on/function"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+
+ <ui:define name="content">
+
+ <h:form id="pluginConfigForm">
+ <rich:panel rendered="#{editPluginConfigurationUIBean.plugin.pluginConfiguration != null}">
+ <f:facet name="header">
+ <h:outputText value="Plugin Configuration"/>
+ </f:facet>
+ <onc:config configurationDefinition="#{editPluginConfigurationUIBean.pluginConfigurationDefinition}"
+ configuration="#{editPluginConfigurationUIBean.plugin.pluginConfiguration}" />
+ </rich:panel>
+
+ <rich:panel rendered="#{editPluginConfigurationUIBean.plugin.scheduledJobsConfiguration != null}">
+ <f:facet name="header">
+ <h:outputText value="Scheduled Jobs"/>
+ </f:facet>
+ <onc:config configurationDefinition="#{editPluginConfigurationUIBean.scheduledJobsDefinition}"
+ configuration="#{editPluginConfigurationUIBean.plugin.scheduledJobsConfiguration}" />
+ </rich:panel>
+
+ <h:panelGroup id="pluginButtons">
+ <h:commandButton value="SAVE" type="submit" action="#{editPluginConfigurationUIBean.updatePlugin}"
+ alt="Click to Save Changes" styleClass="buttonmed" />
+ <h:commandButton value="RESET" type="reset" immediate="true"
+ title="Click to Reset Fields" styleClass="buttonmed"/>
+ </h:panelGroup>
+ </h:form>
+ </ui:define>
+
+</ui:composition>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-edit-update-map-plain.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-edit-update-map-plain.xhtml
new file mode 100644
index 0000000..8d847b7
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-edit-update-map-plain.xhtml
@@ -0,0 +1,29 @@
+<ui:composition template="/rhq/admin/plugin/plugin-edit-map-plain.xhtml"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:onc="http://jboss.org/on/component"
+ xmlns:onf="http://jboss.org/on/function"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+
+ <ui:param name="actionVerb" value="Update" />
+ <ui:param name="editBreadCrumb" value="true" />
+
+ <ui:define name="mapConfig">
+ <onc:config configurationDefinition="#{editPluginConfigurationUIBean.currentConfigurationDefinition}"
+ configuration="#{editPluginConfigurationUIBean.currentConfiguration}"
+ listName="#{param.listName}"
+ listIndex="#{param.listIndex}" />
+
+ <h:panelGrid columns="2" styleClass="buttons-table" columnClasses="button-cell">
+ <h:commandButton value="OK" type="submit" action="#{editPluginConfigurationUIBean.finishMap}"
+ alt="Click to Update Map" styleClass="buttonmed"/>
+ <h:commandButton value="RESET" type="reset" immediate="true"
+ alt="Click to Reset Fields" styleClass="buttonmed"/>
+ </h:panelGrid>
+ </ui:define>
+</ui:composition>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-edit-view-map-plain.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-edit-view-map-plain.xhtml
new file mode 100644
index 0000000..02b18c4
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-edit-view-map-plain.xhtml
@@ -0,0 +1,22 @@
+<ui:composition template="/rhq/admin/plugin/plugin-edit-map-plain.xhtml"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:onc="http://jboss.org/on/component"
+ xmlns:onf="http://jboss.org/on/function"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+
+ <ui:param name="actionVerb" value="View" />
+
+ <ui:define name="mapConfig">
+ <onc:config configurationDefinition="#{editPluginConfigurationUIBean.scheduledJobsDefinition}"
+ configuration="#{editPluginConfigurationUIBean.plugin.scheduledJobsConfiguration}"
+ listName="#{param.listName}"
+ listIndex="#{param.listIndex}"
+ readOnly="true" />
+ </ui:define>
+</ui:composition>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-list-plain.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-list-plain.xhtml
new file mode 100644
index 0000000..c85a6c1
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-list-plain.xhtml
@@ -0,0 +1,268 @@
+<ui:composition template="/rhq/entity/layout/main-plain.xhtml"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:onc="http://jboss.org/on/component"
+ xmlns:onf="http://jboss.org/on/function"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+
+ <ui:define name="content">
+
+<h:form id="pluginsForm">
+
+ <rich:panel>
+ <f:facet name="header">
+ <h:outputText value="Installed Plugins"/>
+ </f:facet>
+
+ <h:panelGrid columns="1" width="100%">
+ <rich:tabPanel switchType="ajax" selectedTab="#{InstalledPluginsSessionUIBean.selectedTab}">
+
+ <!-- ========== AGENT PLUGINS TAB ========== -->
+
+ <rich:tab name="AGENT" label="Agent Plugins">
+
+ <rich:dataTable id="agentPluginsDataTable"
+ value="#{InstalledPluginsUIBean.installedAgentPlugins}"
+ var="agentPlugin"
+ width="100%"
+ columnsWidth="3%, 20%, 52%, 15%, 10%"
+ styleClass="resources-table"
+ footerClass="on-pager-footer"
+ onRowMouseOver="this.style.backgroundColor='#E7E7E7'"
+ onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
+
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:allSelect target="selectedPlugin"/>
+ </f:facet>
+
+ <onc:select name="selectedPlugin" value="#{agentPlugin.id}"/>
+ </rich:column>
+
+ <rich:column rendered="#{param.debug}">
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="ID"/>
+ </f:facet>
+
+ <h:outputText value="#{agentPlugin.id}"/>
+ </rich:column>
+
+ <rich:column sortBy="#{agentPlugin.displayName}">
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Name"/>
+ </f:facet>
+
+ <h:outputLink value="/rhq/admin/plugin/plugin-details-plain.xhtml">
+ <f:param name="plugin" value="#{agentPlugin.name}"/>
+ <f:param name="deployment" value="AGENT"/>
+ <h:outputText value="#{agentPlugin.displayName}"/>
+ </h:outputLink>
+
+ </rich:column>
+
+ <rich:column sortBy="#{agentPlugin.description}">
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Description"/>
+ </f:facet>
+
+ <h:outputText value="#{agentPlugin.description}"/>
+ </rich:column>
+
+ <rich:column sortBy="#{agentPlugin.mtime}">
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Last Update"/>
+ </f:facet>
+
+ <h:outputText value="#{agentPlugin.mtime}">
+ <f:converter converterId="UserDateTimeConverter" />
+ </h:outputText>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Enabled"/>
+ </f:facet>
+
+ <h:graphicImage value="/images/icons/availability_green_16.png" rendered="#{agentPlugin.enabled}"/>
+ <h:graphicImage value="/images/icons/availability_red_16.png" rendered="#{!agentPlugin.enabled}"/>
+ </rich:column>
+
+ <f:facet name="footer">
+ <rich:columnGroup>
+ <rich:column colspan="5" width="100%">
+ <onc:selectCommandButton action="#{InstalledPluginsUIBean.enableAgentPlugins}"
+ value="ENABLE" target="selectedPlugin" styleClass="on-pager-button buttonsmall">
+ </onc:selectCommandButton>
+ <onc:selectCommandButton action="#{InstalledPluginsUIBean.disableAgentPlugins}"
+ value="DISABLE" target="selectedPlugin" styleClass="on-pager-button buttonsmall">
+ </onc:selectCommandButton>
+ </rich:column>
+ <rich:column colspan="5" width="100%" breakBefore="true">
+ <h:commandButton action="#{InstalledPluginsUIBean.scan}"
+ value="SCAN FOR UPDATES" styleClass="on-pager-button buttonsmall">
+ </h:commandButton>
+ </rich:column>
+ </rich:columnGroup>
+ </f:facet>
+
+ </rich:dataTable>
+
+ </rich:tab>
+
+ <!-- ========== SERVER PLUGINS TAB ========== -->
+
+ <rich:tab name="SERVER" label="Server Plugins">
+
+ <rich:dataTable id="serverPluginsDataTable"
+ value="#{InstalledPluginsUIBean.installedServerPlugins}"
+ var="serverPlugin"
+ width="100%"
+ columnsWidth="#{InstalledPluginsSessionUIBean.showAllServerPlugins ? '3%, 20%, 52%, 15%, 5%, 5%' : '3%, 20%, 52%, 15%, 10%'}"
+ styleClass="resources-table"
+ footerClass="on-pager-footer"
+ onRowMouseOver="this.style.backgroundColor='#E7E7E7'"
+ onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
+
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:allSelect target="selectedPlugin"/>
+ </f:facet>
+
+ <onc:select name="selectedPlugin" value="#{serverPlugin.id}"/>
+ </rich:column>
+
+ <rich:column rendered="#{param.debug}">
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="ID"/>
+ </f:facet>
+
+ <h:outputText value="#{serverPlugin.id}"/>
+ </rich:column>
+
+ <rich:column sortBy="#{serverPlugin.displayName}">
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Name"/>
+ </f:facet>
+
+ <h:outputLink value="/rhq/admin/plugin/plugin-details-plain.xhtml" rendered="#{serverPlugin.status eq 'INSTALLED'}">
+ <f:param name="plugin" value="#{serverPlugin.name}"/>
+ <f:param name="deployment" value="SERVER"/>
+ <f:param name="pluginType" value="#{serverPlugin.type}"/>
+ <h:outputText value="#{serverPlugin.displayName}"/>
+ </h:outputLink>
+ <h:outputText value="#{serverPlugin.displayName}" rendered="#{serverPlugin.status ne 'INSTALLED'}"/>
+
+ </rich:column>
+
+ <rich:column sortBy="#{serverPlugin.description}">
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Description"/>
+ </f:facet>
+
+ <h:outputText value="#{serverPlugin.description}"/>
+ </rich:column>
+
+ <rich:column sortBy="#{serverPlugin.mtime}">
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Last Update"/>
+ </f:facet>
+
+ <h:outputText value="#{serverPlugin.mtime}">
+ <f:converter converterId="UserDateTimeConverter" />
+ </h:outputText>
+ </rich:column>
+
+
+ <rich:column sortBy="#{serverPlugin.enabled}">
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Enabled"/>
+ </f:facet>
+
+ <h:graphicImage value="/images/icons/availability_green_16.png" rendered="#{serverPlugin.enabled}"/>
+ <h:graphicImage value="/images/icons/availability_red_16.png" rendered="#{!serverPlugin.enabled}"/>
+ </rich:column>
+
+ <rich:column sortBy="#{serverPlugin.status}" rendered="#{InstalledPluginsSessionUIBean.showAllServerPlugins}">
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Deployed"/>
+ </f:facet>
+
+ <h:graphicImage value="/images/icons/availability_green_16.png" rendered="#{serverPlugin.status eq 'INSTALLED' }"/>
+ <h:graphicImage value="/images/icons/availability_red_16.png" rendered="#{serverPlugin.status ne 'INSTALLED' }"/>
+ </rich:column>
+
+ <f:facet name="footer">
+ <rich:columnGroup>
+ <rich:column colspan="#{InstalledPluginsSessionUIBean.showAllServerPlugins ? 6 : 5}" width="100%">
+ <onc:selectCommandButton action="#{InstalledPluginsUIBean.enableServerPlugins}"
+ value="ENABLE" target="selectedPlugin" styleClass="on-pager-button buttonsmall">
+ </onc:selectCommandButton>
+ <onc:selectCommandButton action="#{InstalledPluginsUIBean.disableServerPlugins}"
+ value="DISABLE" target="selectedPlugin" styleClass="on-pager-button buttonsmall">
+ </onc:selectCommandButton>
+ <onc:selectCommandButton action="#{InstalledPluginsUIBean.undeployServerPlugins}"
+ value="UNDEPLOY" target="selectedPlugin" styleClass="on-pager-button buttonsmall">
+ </onc:selectCommandButton>
+ <onc:selectCommandButton action="#{InstalledPluginsUIBean.purgeServerPlugins}"
+ rendered="#{InstalledPluginsSessionUIBean.showAllServerPlugins}"
+ value="PURGE" target="selectedPlugin" styleClass="on-pager-button buttonsmall">
+ </onc:selectCommandButton>
+ </rich:column>
+ <rich:column breakBefore="true" colspan="#{InstalledPluginsSessionUIBean.showAllServerPlugins ? 6 : 5}" width="100%">
+ <h:commandButton action="#{InstalledPluginsUIBean.scan}"
+ value="SCAN FOR UPDATES" styleClass="on-pager-button buttonsmall">
+ </h:commandButton>
+ <h:commandButton action="#{InstalledPluginsUIBean.restartMasterPluginContainer}"
+ value="RESTART MASTER PLUGIN CONTAINER" styleClass="on-pager-button buttonsmall">
+ </h:commandButton>
+ <h:commandButton action="#{InstalledPluginsSessionUIBean.showUndeployedServerPlugins}"
+ rendered="#{!InstalledPluginsSessionUIBean.showAllServerPlugins}"
+ value="SHOW UNDEPLOYED" styleClass="on-pager-button buttonsmall">
+ </h:commandButton>
+ <h:commandButton action="#{InstalledPluginsSessionUIBean.hideUndeployedServerPlugins}"
+ rendered="#{InstalledPluginsSessionUIBean.showAllServerPlugins}"
+ value="HIDE UNDEPLOYED" styleClass="on-pager-button buttonsmall">
+ </h:commandButton>
+ </rich:column>
+ </rich:columnGroup>
+ </f:facet>
+
+ </rich:dataTable>
+
+ </rich:tab>
+ </rich:tabPanel>
+ </h:panelGrid>
+
+ </rich:panel>
+
+<rich:panel>
+ <f:facet name="header">
+ <h:outputText value="Upload Plugin"/>
+ </f:facet>
+
+ <h:panelGrid columns="1" width="100%">
+ <rich:fileUpload
+ id="upload"
+ fileUploadListener="#{InstalledPluginsUIBean.fileUploadListener}"
+ maxFilesQuantity="10"
+ acceptedTypes="jar"
+ noDuplicate="true"
+ immediateUpload="false"
+ autoclear="false"
+ allowFlash="false">
+ <a4j:support event="onuploadcomplete" reRender="pluginsmessages" />
+ </rich:fileUpload>
+ </h:panelGrid>
+
+</rich:panel>
+</h:form>
+</ui:define>
+
+</ui:composition>
commit dc2c58ac2e463d43f331d393955a605576e0476f
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Aug 12 13:57:21 2010 -0400
implement "plain" scheme using iframed-facelets for unimplemented admin > config > settings section
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/admin/config/EditServerConfig.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/admin/config/EditServerConfig.jsp
index 4ad7b5f..dc5dcfb 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/admin/config/EditServerConfig.jsp
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/admin/config/EditServerConfig.jsp
@@ -33,6 +33,9 @@
<c:if test="${not empty param.debug}">
<input type="hidden" name="debug" value="${param.debug}" />
</c:if>
+<c:if test="${not empty param.nomenu}">
+ <input type="hidden" name="nomenu" value="${param.nomenu}" />
+</c:if>
<tiles:insert page="/admin/config/SystemInfoForm.jsp"/>
<br>
commit 36bde6fd9ce6e52d996ae59be1a131abf2905630
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Aug 12 13:56:50 2010 -0400
implement "plain" / "nomenu" scheme using iframed-facelets for unimplemented admin > config > license section
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/struts-config.xml b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/struts-config.xml
index a4a323e..6c08474 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/struts-config.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/struts-config.xml
@@ -1898,6 +1898,19 @@
<forward name="failure" path="/admin/license/LicenseAdmin.do?mode=edit&error=true" redirect="true"/>
<forward name="success" path="/admin/license/LicenseAdmin.do?mode=view&update=true" redirect="true"/>
</action>
+
+ <action path="/admin/license/UpdateLicenseNoMenu"
+ name="LicenseAdminForm"
+ scope="request"
+ parameter="mode"
+ type="org.rhq.enterprise.gui.action.license.LicenseUpdateAction"
+ input="/admin/license/LicenseAdmin.do?mode=edit&nomenu=true">
+ <set-property property="title" value="License"/>
+ <forward name="cancel" path="/admin/license/LicenseAdmin.do?mode=view&nomenu=true" redirect="true"/>
+ <forward name="reset" path="/admin/license/LicenseAdmin.do?mode=edit&nomenu=true" redirect="true"/>
+ <forward name="failure" path="/admin/license/LicenseAdmin.do?mode=edit&error=true&nomenu=true" redirect="true"/>
+ <forward name="success" path="/admin/license/LicenseAdmin.do?mode=view&update=true&nomenu=true" redirect="true"/>
+ </action>
<action path="/dashboard/Admin"
forward=".dashboard.admin.layout">
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/admin/license/License.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/admin/license/License.jsp
index 6f30264..4c7d47a 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/admin/license/License.jsp
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/admin/license/License.jsp
@@ -84,7 +84,7 @@
<hq:authorization permission="MANAGE_SETTINGS">
<tr>
- <td class="BlockContent" colspan="4" align="center"><html:link action="/admin/license/LicenseAdmin.do?mode=edit">Update License</html:link>
+ <td class="BlockContent" colspan="4" align="center"><html:link action="/admin/license/LicenseAdmin.do?mode=edit&nomenu=true">Update License</html:link>
</td>
</tr>
</hq:authorization>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/admin/license/LicenseEdit.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/admin/license/LicenseEdit.jsp
index 5019eb0..f49a8bf 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/admin/license/LicenseEdit.jsp
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/admin/license/LicenseEdit.jsp
@@ -10,7 +10,8 @@
<table width="100%" cellpadding="0" cellspacing="0" border="0">
- <html:form action="/admin/license/UpdateLicense" enctype="multipart/form-data" method="POST">
+ <c:if test="${not empty param.nomenu}">
+ <html:form action="/admin/license/UpdateLicenseNoMenu" enctype="multipart/form-data" method="POST">
<tr>
<td colspan="4" class="BlockHeader">
<tiles:insert definition=".header.tab">
@@ -30,7 +31,30 @@
</tr>
<tiles:insert definition=".form.buttons"/>
-
</html:form>
+ </c:if>
+ <c:if test="${empty param.nomenu}">
+ <html:form action="/admin/license/UpdateLicense" enctype="multipart/form-data" method="POST">
+ <tr>
+ <td colspan="4" class="BlockHeader">
+ <tiles:insert definition=".header.tab">
+ <tiles:put name="tabKey" value="admin.license.UpdateLicenseTab"/>
+ </tiles:insert>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="4">An up to date license file can be downloaded from the
+ <a href="https://network.jboss.com/jbossnetwork/restricted/listSoftware.html">
+ JBoss Network Customer Service Portal</a>.</td>
+ </tr>
+ <tr>
+ <td class="BlockLabel"><fmt:message key="admin.license.LicenseFile"/></td>
+ <td class="BlockContent"><html:file property="licenseFile"/></td>
+ <td colspan="2" class="BlockContent"> </td>
+ </tr>
+
+ <tiles:insert definition=".form.buttons"/>
+ </html:form>
+ </c:if>
</table>
\ No newline at end of file
13 years, 10 months