[rhq] modules/enterprise
by Joseph Marques
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java | 1 +
1 file changed, 1 insertion(+)
New commits:
commit 56cdad77b1f9e576bdeb7f27eec7d6f4ea929351
Author: Joseph Marques <joseph(a)redhat.com>
Date: Wed Aug 11 01:01:03 2010 -0400
Don't allow "Step X of Y" for wizard-based flows to wrap to next line
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
index a8ff10b..3d88005 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
@@ -206,6 +206,7 @@ public class WizardView extends VLayout {
currentStep = stepIndex;
stepLabel.setContents("Step " + (stepIndex + 1) + " of " + wizardSteps.size());
+ stepLabel.setWrap(false);
WizardStep step = wizardSteps.get(currentStep);
13 years, 10 months
[rhq] modules/enterprise
by Joseph Marques
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/perspective/activator/context/GroupActivationContext.java | 2 +-
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/perspective/activator/context/ResourceActivationContext.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
New commits:
commit 4bed8786b2d15c9ace92b938e1b9e160dde5d65e
Author: Joseph Marques <joseph(a)redhat.com>
Date: Wed Aug 11 00:30:37 2010 -0400
fix 2 compilation errors where Set could not be assigned to EnumSet
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/perspective/activator/context/GroupActivationContext.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/perspective/activator/context/GroupActivationContext.java
index 9e853f0..2c572fb 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/perspective/activator/context/GroupActivationContext.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/perspective/activator/context/GroupActivationContext.java
@@ -60,7 +60,7 @@ public class GroupActivationContext extends AbstractResourceOrGroupActivationCon
// lazy load
if (this.facets == null) {
ResourceFacets resourceFacets = this.resourceTypeManager.getResourceFacets(getResourceType().getId());
- this.facets = resourceFacets.getFacets();
+ this.facets = EnumSet.copyOf(resourceFacets.getFacets());
}
return this.facets;
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/perspective/activator/context/ResourceActivationContext.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/perspective/activator/context/ResourceActivationContext.java
index 510f584..de91285 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/perspective/activator/context/ResourceActivationContext.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/perspective/activator/context/ResourceActivationContext.java
@@ -62,7 +62,7 @@ public class ResourceActivationContext extends AbstractResourceOrGroupActivation
if (this.facets == null) {
ResourceFacets resourceFacets = this.resourceTypeManager.getResourceFacets(resource.getResourceType()
.getId());
- this.facets = resourceFacets.getFacets();
+ this.facets = EnumSet.copyOf(resourceFacets.getFacets());
}
return this.facets;
}
13 years, 10 months
[rhq] modules/enterprise
by ips
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java | 67 ++++------
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java | 13 -
4 files changed, 39 insertions(+), 47 deletions(-)
New commits:
commit 6e66afbb63d19bad003c6c26b08b31c8c7135171
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Tue Aug 10 18:23:34 2010 -0400
fix bookmarking/history for Resource 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 1204539..144442b 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
@@ -92,7 +92,7 @@ public class ResourceGroupDetailView extends VLayout implements BookmarkableView
monitoringTab = new TwoLevelTab("Monitoring", "/images/icons/Monitor_grey_16.png");
monitoringTab.registerSubTabs("Graphs", "Tables", "Traits", "Availability", "Schedules", "Call Time");
- inventoryTab = new TwoLevelTab(DEFAULT_TAB_NAME, "/images/icons/Inventory_grey_16.png");
+ inventoryTab = new TwoLevelTab("Inventory", "/images/icons/Inventory_grey_16.png");
inventoryTab.registerSubTabs("Overview", "Members", "Connection Settings");
operationsTab = new TwoLevelTab("Operations", "/images/icons/Operation_grey_16.png");
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java
index d16d403..c75f6e8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java
@@ -116,14 +116,14 @@ public class ResourceGroupTopView extends HLayout implements BookmarkableView {
public void renderView(ViewPath viewPath) {
if (viewPath.isEnd()) {
// default detail view
- viewPath.getViewPath().add(new ViewId("Summary"));
+ viewPath.getViewPath().add(new ViewId("Inventory"));
viewPath.getViewPath().add(new ViewId("Overview"));
}
Integer groupId = Integer.parseInt(viewPath.getCurrent().getPath());
if (currentGroup == null || currentGroup.getResourceGroup().getId() != groupId) {
- // The previous bookmark did not already point to this group.
+ // The previous history item did not already point to this group.
setSelectedGroup(groupId, viewPath);
}
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 a40f10a..7415ba7 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
@@ -25,7 +25,6 @@ import com.google.gwt.user.client.History;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.Side;
import com.smartgwt.client.widgets.layout.VLayout;
-import com.smartgwt.client.widgets.tab.Tab;
import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.resource.Resource;
@@ -62,6 +61,8 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTyp
*/
public class ResourceDetailView extends VLayout implements BookmarkableView, ResourceSelectListener, TwoLevelTabSelectedHandler {
+ private static final String DEFAULT_TAB_NAME = "Summary";
+
private Resource resource;
private ResourcePermission permissions;
private ResourceType type;
@@ -79,9 +80,6 @@ public class ResourceDetailView extends VLayout implements BookmarkableView, Res
private ResourceTitleBar titleBar;
- private ViewId tabView;
- private ViewId subtabView;
-
public void setResource(Resource resource) {
this.resource = resource;
@@ -146,10 +144,7 @@ public class ResourceDetailView extends VLayout implements BookmarkableView, Res
this.resource = resource;
titleBar.setResource(resource);
-
- int selectedTab = topTabSet.getSelectedTabNumber();
-
-
+
FullHTMLPane timelinePane = new FullHTMLPane("/rhq/resource/summary/timeline-plain.xhtml?id=" + resource.getId());
summaryTab.updateSubTab("Overview", new ResourceOverviewView(resource));
summaryTab.updateSubTab("Timeline", timelinePane);
@@ -269,43 +264,43 @@ public class ResourceDetailView extends VLayout implements BookmarkableView, Res
public void onTabSelected(TwoLevelTabSelectedEvent tabSelectedEvent) {
+ // Switch tabs directly, rather than letting the history framework do it, to avoid redrawing the outer views.
+ selectTab(tabSelectedEvent.getId(), tabSelectedEvent.getSubTabId());
String tabPath = "/" + tabSelectedEvent.getId() + "/" + tabSelectedEvent.getSubTabId();
-// System.out.println("TAB: " + currentView.getPath() + tabPath);
+ String path = "Resource/" + this.resource.getId() + tabPath;
- if (resource != null) {
- String path = "Resource/" + resource.getId() + tabPath;
- History.newItem(path, false);
- }
+ // But still add an item to the history, specifying false to tell it not to fire an event.
+ History.newItem(path, false);
}
public void renderView(ViewPath viewPath) {
- // TODO: Implement this method.
-
- if (viewPath.isEnd()) {
- // default
-
- } else {
-
- tabView = viewPath.getCurrent();
- subtabView = viewPath.getNext();
-
- for (Tab t : topTabSet.getTabs()) {
- TwoLevelTab tab = (TwoLevelTab) t;
-
- if (tab.getTitle().equals(tabView.getPath())) {
- topTabSet.selectTab(tab); //tabView.getPath());
-
- tab.getLayout().selectTab(subtabView.getPath());
-
+ // e.g. #Resource/10010/Inventory/Overview
+ String tabName = (!viewPath.isEnd()) ? viewPath.getCurrent().getPath() : null; // e.g. "Inventory"
+ String subTabName = (viewPath.viewsLeft() >= 1) ? viewPath.getNext().getPath() : null; // e.g. "Overview"
+ selectTab(tabName, subTabName);
+ }
- }
+ public void selectTab(String tabName, String subtabName) {
+ if (tabName == null) {
+ tabName = DEFAULT_TAB_NAME;
+ }
+ TwoLevelTab tab = (TwoLevelTab)this.topTabSet.getTabByTitle(tabName);
+ if (tab == null) {
+ CoreGUI.getErrorHandler().handleError("Invalid tab name: " + tabName);
+ // TODO: Should we fire a history event here to redirect to a valid bookmark?
+ tab = (TwoLevelTab)this.topTabSet.getTabByTitle(DEFAULT_TAB_NAME);
+ }
+ this.topTabSet.selectTab(tab);
+ if (subtabName != null) {
+ if (!tab.getLayout().selectTab(subtabName)) {
+ CoreGUI.getErrorHandler().handleError("Invalid subtab name: " + subtabName);
+ // TODO: Should we fire a history event here to redirect to a valid bookmark?
+ return;
}
-
-
+ tab.getLayout().selectTab(subtabName);
}
-
-
}
+
}
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
index e342628..f7b5c6e 100644
--- 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
@@ -133,16 +133,13 @@ public class ResourceView extends HLayout implements BookmarkableView {
Integer resourceId = Integer.parseInt(viewPath.getCurrent().getPath());
if (currentResource == null || currentResource.getId() != resourceId) {
-
+ // The previous history item did not already point to this Resource.
setSelectedResource(resourceId, viewPath);
-
- this.treeView.renderView(viewPath);
-
- viewPath.next();
-
- this.detailView.renderView(viewPath);
-
}
+
+ viewPath.next();
+ this.treeView.renderView(viewPath);
+ this.detailView.renderView(viewPath);
}
}
13 years, 10 months
[rhq] modules/enterprise
by ips
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java | 8 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java | 17 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java | 61 +++++-----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java | 11 -
4 files changed, 53 insertions(+), 44 deletions(-)
New commits:
commit 92f76547ae768f78379d0abbd9fde4b3d0e375e8
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Tue Aug 10 17:33:32 2010 -0400
fix bookmarks/history for group tabs
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 9b07011..bc79260 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
@@ -151,12 +151,14 @@ public class SubTabLayout extends VLayout {
- public void selectTab(String title) {
+ public boolean selectTab(String title) {
+ boolean foundTab = false;
currentlySelected = title;
int i = 0;
for (String sub : subtabs.keySet()) {
if (sub.equals(title)) {
currentIndex = i;
+ foundTab = true;
break;
}
i++;
@@ -167,11 +169,11 @@ public class SubTabLayout extends VLayout {
((Button)buttonBar.getMember(currentIndex)).select();
draw(subtabs.get(title));
}
+
+ return foundTab;
}
-
-
// ------- Event support -------
// Done with a separate handler manager from parent class on purpose (compatibility issue)
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 a8bc6cd..b12304c 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
@@ -18,7 +18,6 @@
*/
package org.rhq.enterprise.gui.coregui.client.components.tab;
-import com.google.gwt.event.shared.DefaultHandlerRegistration;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.event.shared.HandlerRegistration;
import com.smartgwt.client.widgets.tab.Tab;
@@ -26,15 +25,12 @@ import com.smartgwt.client.widgets.tab.TabSet;
import com.smartgwt.client.widgets.tab.events.TabSelectedEvent;
import com.smartgwt.client.widgets.tab.events.TabSelectedHandler;
-import java.util.ArrayList;
-
/**
* @author Greg Hinkle
*/
public class TwoLevelTabSet extends TabSet implements TabSelectedHandler, TwoLevelTabSelectedHandler {
-
public void setTabs(TwoLevelTab... tabs) {
super.setTabs(tabs);
for (TwoLevelTab tab : tabs) {
@@ -48,9 +44,6 @@ public class TwoLevelTabSet extends TabSet implements TabSelectedHandler, TwoLev
}
-
-
-
// ------- Event support -------
// Done with a separate handler manager from parent class on purpose (compatibility issue)
@@ -80,5 +73,15 @@ public class TwoLevelTabSet extends TabSet implements TabSelectedHandler, TwoLev
m.fireEvent(tabSelectedEvent);
}
+
+ public Tab getTabByTitle(String title) {
+ Tab[] tabs = getTabs();
+ for (Tab tab : tabs) {
+ if (tab.getTitle().equals(title)) {
+ return tab;
+ }
+ }
+ return null;
+ }
}
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 7ce23a7..1204539 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
@@ -25,7 +25,6 @@ import com.google.gwt.user.client.History;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.Side;
import com.smartgwt.client.widgets.layout.VLayout;
-import com.smartgwt.client.widgets.tab.Tab;
import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.resource.ResourceType;
@@ -36,7 +35,6 @@ import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
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.components.tab.TwoLevelTab;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSelectedEvent;
@@ -51,11 +49,12 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTyp
* Right panel of the group view.
*
* @author Greg Hinkle
+ * @author Ian Springer
*/
public class ResourceGroupDetailView extends VLayout implements BookmarkableView, TwoLevelTabSelectedHandler {
+ private static final String DEFAULT_TAB_NAME = "Inventory";
private ResourceGroupComposite groupComposite;
- private ResourceType groupType;
private ResourcePermission permissions;
private TwoLevelTab summaryTab;
@@ -70,8 +69,6 @@ public class ResourceGroupDetailView extends VLayout implements BookmarkableView
private ResourceGroupTitleBar titleBar;
- private ViewId tabView;
- private ViewId subtabView;
@Override
protected void onDraw() {
@@ -95,7 +92,7 @@ public class ResourceGroupDetailView extends VLayout implements BookmarkableView
monitoringTab = new TwoLevelTab("Monitoring", "/images/icons/Monitor_grey_16.png");
monitoringTab.registerSubTabs("Graphs", "Tables", "Traits", "Availability", "Schedules", "Call Time");
- inventoryTab = new TwoLevelTab("Inventory", "/images/icons/Inventory_grey_16.png");
+ inventoryTab = new TwoLevelTab(DEFAULT_TAB_NAME, "/images/icons/Inventory_grey_16.png");
inventoryTab.registerSubTabs("Overview", "Members", "Connection Settings");
operationsTab = new TwoLevelTab("Operations", "/images/icons/Operation_grey_16.png");
@@ -123,6 +120,7 @@ public class ResourceGroupDetailView extends VLayout implements BookmarkableView
// CoreGUI.addBreadCrumb(getPlace());
}
+
public void onGroupSelected(ResourceGroupComposite groupComposite) {
this.groupComposite = groupComposite;
@@ -183,7 +181,6 @@ public class ResourceGroupDetailView extends VLayout implements BookmarkableView
new ResourceTypeRepository.TypeLoadedCallback() {
public void onTypesLoaded(ResourceType type) {
group.setResourceType(type);
- ResourceGroupDetailView.this.groupType = type;
GWTServiceLookup.getAuthorizationService().getImplicitGroupPermissions(
group.getId(), new AsyncCallback<Set<Permission>>() {
public void onFailure(Throwable caught) {
@@ -242,34 +239,44 @@ public class ResourceGroupDetailView extends VLayout implements BookmarkableView
}
+
public void onTabSelected(TwoLevelTabSelectedEvent tabSelectedEvent) {
+ // Switch tabs directly, rather than letting the history framework do it, to avoid redrawing the outer views.
+ selectTab(tabSelectedEvent.getId(), tabSelectedEvent.getSubTabId());
String tabPath = "/" + tabSelectedEvent.getId() + "/" + tabSelectedEvent.getSubTabId();
- // System.out.println("TAB: " + currentView.getPath() + tabPath);
-
- if (groupComposite != null) {
- String path = "ResourceGroup/" + groupComposite.getResourceGroup().getId() + tabPath;
- History.newItem(path, false);
- }
+ String path = "ResourceGroup/" + this.groupComposite.getResourceGroup().getId() + tabPath;
+
+ // But still add an item to the history, specifying false to tell it not to fire an event.
+ History.newItem(path, false);
}
- public void renderView(ViewPath viewPath) {
- if (viewPath.isEnd()) {
- // default
- } else {
- tabView = viewPath.getCurrent();
- subtabView = viewPath.getNext();
-
- for (Tab t : topTabSet.getTabs()) {
- TwoLevelTab tab = (TwoLevelTab) t;
- if (tab.getTitle().equals(tabView.getPath())) {
- topTabSet.selectTab(tabView.getPath());
+ public void renderView(ViewPath viewPath) {
+ // e.g. #ResourceGroup/10010/Inventory/Overview
+ String tabName = (!viewPath.isEnd()) ? viewPath.getCurrent().getPath() : null; // e.g. "Inventory"
+ String subTabName = (viewPath.viewsLeft() >= 1) ? viewPath.getNext().getPath() : null; // e.g. "Overview"
+ selectTab(tabName, subTabName);
+ }
- tab.getLayout().selectTab(subtabView.getPath());
- }
+ public void selectTab(String tabName, String subtabName) {
+ if (tabName == null) {
+ tabName = DEFAULT_TAB_NAME;
+ }
+ TwoLevelTab tab = (TwoLevelTab)this.topTabSet.getTabByTitle(tabName);
+ if (tab == null) {
+ CoreGUI.getErrorHandler().handleError("Invalid tab name: " + tabName);
+ // TODO: Should we fire a history event here to redirect to a valid bookmark?
+ tab = (TwoLevelTab)this.topTabSet.getTabByTitle(DEFAULT_TAB_NAME);
+ }
+ this.topTabSet.selectTab(tab);
+ if (subtabName != null) {
+ if (!tab.getLayout().selectTab(subtabName)) {
+ CoreGUI.getErrorHandler().handleError("Invalid subtab name: " + subtabName);
+ // TODO: Should we fire a history event here to redirect to a valid bookmark?
+ return;
}
+ tab.getLayout().selectTab(subtabName);
}
-
}
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java
index f45b169..d16d403 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java
@@ -123,15 +123,12 @@ public class ResourceGroupTopView extends HLayout implements BookmarkableView {
Integer groupId = Integer.parseInt(viewPath.getCurrent().getPath());
if (currentGroup == null || currentGroup.getResourceGroup().getId() != groupId) {
-
+ // The previous bookmark did not already point to this group.
setSelectedGroup(groupId, viewPath);
-
- this.treeView.setSelectedGroup(groupId);
-
- viewPath.next();
-
- this.detailView.renderView(viewPath);
}
+
+ viewPath.next();
+ this.detailView.renderView(viewPath);
}
}
13 years, 10 months
[rhq] modules/core modules/enterprise
by ips
modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourceFacets.java | 38 +-
modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ResourceGroupComposite.java | 8
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 | 87 +++---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java | 68 +---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java | 38 --
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/OverviewView.java | 139 +++++++++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/overview/ResourceSummaryView.java | 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGroupGWTServiceImpl.java | 7
9 files changed, 241 insertions(+), 151 deletions(-)
New commits:
commit c9c6d348a082f89c8f4a18edc2afb3d5e7498cc4
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Tue Aug 10 12:56:19 2010 -0400
implement group Inventory>Overview subtab, with the exception of the ability to edit the group's name and description
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourceFacets.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourceFacets.java
index cc3cb50..c05d5ef 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourceFacets.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourceFacets.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
@@ -23,12 +23,14 @@
package org.rhq.core.domain.resource.composite;
import java.io.Serializable;
-import java.util.EnumSet;
+import java.util.HashSet;
+import java.util.Set;
import org.rhq.core.domain.resource.ResourceTypeFacet;
/**
- * The set of facets a Resource supports - used to determine which quicknav icons and tabs to display in the UI.
+ * The set of facets a Resource or compatible Resource group supports - used to determine which quick-nav icons and tabs
+ * to display in the GUI.
*
* @author Ian Springer
*/
@@ -39,18 +41,22 @@ public class ResourceFacets implements Serializable {
public static ResourceFacets ALL = new ResourceFacets(-1, true, true, true, true, true, true, true, true);
/*
* immutable private member data makes this object safe to use in a concurrent environment, such as a
- * concurrent-access cache of ResourceFacets objects
+ * concurrent-access cache of ResourceFacets objects (TODO (ips): make these final again?)
*/
- private final int resourceTypeId;
- private final boolean measurement;
- private final boolean event;
- private final boolean pluginConfiguration;
- private final boolean configuration;
- private final boolean operation;
- private final boolean content;
- private final boolean callTime;
- private final boolean support;
- private EnumSet<ResourceTypeFacet> facets;
+ private int resourceTypeId;
+ private boolean measurement;
+ private boolean event;
+ private boolean pluginConfiguration;
+ private boolean configuration;
+ private boolean operation;
+ private boolean content;
+ private boolean callTime;
+ private boolean support;
+ private Set<ResourceTypeFacet> facets;
+
+ // no-arg constructor required by GWT compiler
+ public ResourceFacets() {
+ }
public ResourceFacets(int resourceTypeId, boolean measurement, boolean event, boolean pluginConfiguration,
boolean configuration, boolean operation, boolean content, boolean callTime, boolean support) {
@@ -163,12 +169,12 @@ public class ResourceFacets implements Serializable {
*
* @return an enum representation of the facets
*/
- public EnumSet<ResourceTypeFacet> getFacets() {
+ public Set<ResourceTypeFacet> getFacets() {
return facets;
}
private void initEnum() {
- this.facets = EnumSet.noneOf(ResourceTypeFacet.class);
+ this.facets = new HashSet<ResourceTypeFacet>();
if (measurement)
this.facets.add(ResourceTypeFacet.MEASUREMENT);
if (event)
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ResourceGroupComposite.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ResourceGroupComposite.java
index 6a837c9..5199ba2 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ResourceGroupComposite.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ResourceGroupComposite.java
@@ -53,6 +53,8 @@ public class ResourceGroupComposite implements Serializable {
private ResourceFacets resourceFacets;
+ // TODO: Expose authz permissions current user has for the group.
+
private class GroupDefinitionMember extends ResourceGroup {
public void setGroupCategory(GroupCategory category) {
super.setGroupCategory(category);
@@ -101,8 +103,8 @@ public class ResourceGroupComposite implements Serializable {
} else if (this.resourceGroup.getGroupCategory() == GroupCategory.MIXED) {
this.category = GroupCategory.MIXED;
} else {
- throw new IllegalArgumentException("Unknown category " + this.resourceGroup.getGroupCategory()
- + " for ResourceGroup " + this.resourceGroup.getName());
+ throw new IllegalArgumentException("Unknown category [" + this.resourceGroup.getGroupCategory()
+ + "] for ResourceGroup [" + this.resourceGroup.getName() + "]");
}
this.resourceFacets = facets;
@@ -218,6 +220,6 @@ public class ResourceGroupComposite implements Serializable {
+ this.resourceGroup.getName() //
+ ", implicit[up/down/avail=," + this.implicitUp + "/" + this.implicitDown + "/" + this.implicitAvail + "]"
+ ", explicit[up/down/avail=," + this.explicitUp + "/" + this.explicitDown + "/" + this.explicitAvail + "]"
- + ", permission=" + "]";
+ + ", facets=" + this.resourceFacets + "]";
}
}
\ 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 c6f5800..5644554 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
@@ -18,18 +18,16 @@
*/
package org.rhq.enterprise.gui.coregui.client.gwt;
-
import org.rhq.core.domain.criteria.ResourceGroupCriteria;
import org.rhq.core.domain.criteria.ResourceGroupDefinitionCriteria;
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.core.domain.util.PageList;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
-
-
/**
* @author Greg Hinkle
*/
@@ -38,6 +36,8 @@ public interface ResourceGroupGWTService extends RemoteService {
PageList<ResourceGroup> findResourceGroupsByCriteria(ResourceGroupCriteria criteria);
+ PageList<ResourceGroupComposite> findResourceGroupCompositesByCriteria(ResourceGroupCriteria criteria);
+
PageList<GroupDefinition> findGroupDefinitionsByCriteria(ResourceGroupDefinitionCriteria criteria);
void ensureMembershipMatches(int groupId, int[] resourceIds);
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 c3d6a43..7ce23a7 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
@@ -29,9 +29,11 @@ import com.smartgwt.client.widgets.tab.Tab;
import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.ResourceTypeFacet;
import org.rhq.core.domain.resource.composite.ResourcePermission;
import org.rhq.core.domain.resource.group.GroupCategory;
import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ViewId;
@@ -52,10 +54,9 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTyp
*/
public class ResourceGroupDetailView extends VLayout implements BookmarkableView, TwoLevelTabSelectedHandler {
- private ResourceGroup group;
- private ResourcePermission permissions;
-
+ private ResourceGroupComposite groupComposite;
private ResourceType groupType;
+ private ResourcePermission permissions;
private TwoLevelTab summaryTab;
private TwoLevelTab monitoringTab;
@@ -122,15 +123,13 @@ public class ResourceGroupDetailView extends VLayout implements BookmarkableView
// CoreGUI.addBreadCrumb(getPlace());
}
- public void onGroupSelected(ResourceGroup group) {
+ public void onGroupSelected(ResourceGroupComposite groupComposite) {
- this.group = group;
+ this.groupComposite = groupComposite;
- titleBar.setGroup(group);
+ this.titleBar.setGroup(groupComposite.getResourceGroup());
- int selectedTab = topTabSet.getSelectedTabNumber();
-
- // TODO all of the tabs
+ // 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));
@@ -143,8 +142,8 @@ public class ResourceGroupDetailView extends VLayout implements BookmarkableView
// monitoringTab.updateSubTab("Schedules", new FullHTMLPane("/rhq/resource/monitor/schedules-plain.xhtml?id=" + resource.getId()));
// monitoringTab.updateSubTab("Call Time", new CallTimeView(resource));
//
- inventoryTab.updateSubTab("Overview", new OverviewView());
- inventoryTab.updateSubTab("Members", ResourceSearchView.getMembersOf(this.group.getId()));
+ inventoryTab.updateSubTab("Overview", new OverviewView(this.groupComposite));
+ inventoryTab.updateSubTab("Members", ResourceSearchView.getMembersOf(this.groupComposite.getResourceGroup().getId()));
// inventoryTab.updateSubTab("Connection Settings", new GroupPluginConfigurationEditView(this.group.getId(), this.group.getResourceType().getId(), ConfigurationEditor.ConfigType.plugin));
//
// operationsTab.updateSubTab("History", OperationHistoryView.getResourceHistoryView(resource));
@@ -170,10 +169,11 @@ public class ResourceGroupDetailView extends VLayout implements BookmarkableView
}
private void updateTabStatus() {
- // Go and get the type with all needed metadata
- // and then get the permissions for this resource
+ final ResourceGroup group = this.groupComposite.getResourceGroup();
if (group.getGroupCategory() == GroupCategory.COMPATIBLE) {
+
+ // Load the fully fetched ResourceType.
ResourceType groupType = group.getResourceType();
ResourceTypeRepository.Cache.getInstance().getResourceTypes(
groupType.getId(),
@@ -182,13 +182,12 @@ public class ResourceGroupDetailView extends VLayout implements BookmarkableView
ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
new ResourceTypeRepository.TypeLoadedCallback() {
public void onTypesLoaded(ResourceType type) {
-
+ group.setResourceType(type);
ResourceGroupDetailView.this.groupType = type;
-
GWTServiceLookup.getAuthorizationService().getImplicitGroupPermissions(
- ResourceGroupDetailView.this.group.getId(), new AsyncCallback<Set<Permission>>() {
+ group.getId(), new AsyncCallback<Set<Permission>>() {
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load group permissions", caught);
+ CoreGUI.getErrorHandler().handleError("Failed to load group permissions.", caught);
}
public void onSuccess(Set<Permission> result) {
@@ -203,36 +202,42 @@ public class ResourceGroupDetailView extends VLayout implements BookmarkableView
private void completeTabUpdate() {
- if (!permissions.isMeasure()) {
- topTabSet.disableTab(monitoringTab);
- } else {
- topTabSet.enableTab(monitoringTab);
- }
+ // Summary and Inventory tabs are always enabled.
+ topTabSet.enableTab(summaryTab);
+ topTabSet.enableTab(inventoryTab);
- if (groupType.getOperationDefinitions() == null || groupType.getOperationDefinitions().isEmpty()
- || !permissions.isControl()) {
- topTabSet.disableTab(operationsTab);
+ GroupCategory groupCategory = groupComposite.getResourceGroup().getGroupCategory();
+
+ // Monitoring and Alerts tabs are always enabled for compatible groups and always disabled for mixed groups.
+ if (groupCategory == GroupCategory.COMPATIBLE) {
+ topTabSet.enableTab(monitoringTab);
+ topTabSet.enableTab(alertsTab);
} else {
- topTabSet.enableTab(operationsTab);
+ topTabSet.disableTab(monitoringTab);
+ topTabSet.disableTab(alertsTab);
}
- if (!permissions.isAlert()) {
- topTabSet.disableTab(alertsTab);
+ // 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)) {
+ topTabSet.enableTab(operationsTab);
} else {
- topTabSet.enableTab(alertsTab);
+ topTabSet.disableTab(operationsTab);
}
- if (groupType.getResourceConfigurationDefinition() == null || !permissions.isConfigureRead()) {
- topTabSet.disableTab(configurationTab);
- } else {
+ // 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()) {
topTabSet.enableTab(configurationTab);
+ } else {
+ topTabSet.disableTab(configurationTab);
}
- if (groupType.getEventDefinitions() == null || groupType.getEventDefinitions().isEmpty()
- || !permissions.isMeasure()) {
+ // Events tab is only enabled for compatible groups of a type that supports the Events facet.
+ if (typeFacets.contains(ResourceTypeFacet.EVENT)) {
topTabSet.enableTab(eventsTab);
} else {
- topTabSet.enableTab(eventsTab);
+ topTabSet.disableTab(eventsTab);
}
}
@@ -241,22 +246,16 @@ public class ResourceGroupDetailView extends VLayout implements BookmarkableView
String tabPath = "/" + tabSelectedEvent.getId() + "/" + tabSelectedEvent.getSubTabId();
// System.out.println("TAB: " + currentView.getPath() + tabPath);
- if (group != null) {
- String path = "ResourceGroup/" + group.getId() + tabPath;
+ if (groupComposite != null) {
+ String path = "ResourceGroup/" + groupComposite.getResourceGroup().getId() + tabPath;
History.newItem(path, false);
}
}
public void renderView(ViewPath viewPath) {
-
- Integer groupId = Integer.parseInt(viewPath.getCurrent().getPath());
-
-
if (viewPath.isEnd()) {
// default
-
} else {
-
tabView = viewPath.getCurrent();
subtabView = viewPath.getNext();
@@ -269,9 +268,7 @@ public class ResourceGroupDetailView extends VLayout implements BookmarkableView
tab.getLayout().selectTab(subtabView.getPath());
}
-
}
-
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java
index 8faaae8..f45b169 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java
@@ -27,7 +27,7 @@ import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.layout.HLayout;
import org.rhq.core.domain.criteria.ResourceGroupCriteria;
-import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
@@ -45,11 +45,10 @@ public class ResourceGroupTopView extends HLayout implements BookmarkableView {
private Canvas contentCanvas;
- private ResourceGroup currentGroup;
- //private Resource resourcePlatform;
+ private ResourceGroupComposite currentGroup;
private ResourceGroupTreeView treeView;
- private ResourceGroupDetailView detailView = new ResourceGroupDetailView();
+ private ResourceGroupDetailView detailView;
private ResourceGroupGWTServiceAsync groupService = GWTServiceLookup.getResourceGroupService();
@@ -58,6 +57,7 @@ public class ResourceGroupTopView extends HLayout implements BookmarkableView {
}
+
@Override
protected void onInit() {
super.onInit();
@@ -65,58 +65,45 @@ public class ResourceGroupTopView extends HLayout implements BookmarkableView {
setWidth100();
setHeight100();
-
treeView = new ResourceGroupTreeView();
addMember(treeView);
contentCanvas = new Canvas();
addMember(contentCanvas);
-
- // created above
detailView = new ResourceGroupDetailView();
// treeView.addResourceSelectListener(detailView);
-
setContent(detailView);
-
}
- public void setSelectedGroup(final int groupId, final ViewPath view) {
- ResourceGroup group = this.treeView.getGroup(groupId);
- if (group != null) {
- setSelectedGroup(group, view);
- } else {
- ResourceGroupCriteria criteria = new ResourceGroupCriteria();
- criteria.addFilterId(groupId);
- criteria.fetchTags(true);
- groupService.findResourceGroupsByCriteria(criteria, new AsyncCallback<PageList<ResourceGroup>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getMessageCenter().notify(new Message("Group with id [" + groupId +
- "] does not exist or is not accessible.", Message.Severity.Warning));
-
- CoreGUI.goTo(InventoryView.VIEW_PATH);
- }
- public void onSuccess(PageList<ResourceGroup> result) {
- if (result.isEmpty()) {
- //noinspection ThrowableInstanceNeverThrown
- onFailure(new Exception("Group with id [" + groupId + "] does not exist."));
- } else {
- ResourceGroup group = result.get(0);
- setSelectedGroup(group, view);
- }
+ public void setSelectedGroup(final int groupId, final ViewPath view) {
+ ResourceGroupCriteria criteria = new ResourceGroupCriteria();
+ criteria.addFilterId(groupId);
+ //criteria.fetchTags(true);
+ groupService.findResourceGroupCompositesByCriteria(criteria, new AsyncCallback<PageList<ResourceGroupComposite>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getMessageCenter().notify(new Message("Group with id [" + groupId +
+ "] does not exist or is not accessible.", Message.Severity.Warning));
+ caught.printStackTrace();
+ CoreGUI.goTo(InventoryView.VIEW_PATH);
+ }
+
+ public void onSuccess(PageList<ResourceGroupComposite> result) {
+ if (result.isEmpty()) {
+ //noinspection ThrowableInstanceNeverThrown
+ onFailure(new Exception("Group with id [" + groupId + "] does not exist."));
+ } else {
+ currentGroup = result.get(0);
+ treeView.setSelectedGroup(currentGroup.getResourceGroup().getId());
+ detailView.onGroupSelected(currentGroup);
}
- });
- }
+ }
+ });
}
- private void setSelectedGroup(ResourceGroup group, ViewPath viewPath) {
- this.currentGroup = group;
- this.treeView.setSelectedGroup(group.getId());
- this.detailView.onGroupSelected(group);
- }
public void setContent(Canvas newContent) {
if (contentCanvas.getChildren().length > 0)
@@ -135,7 +122,7 @@ public class ResourceGroupTopView extends HLayout implements BookmarkableView {
Integer groupId = Integer.parseInt(viewPath.getCurrent().getPath());
- if (currentGroup == null || currentGroup.getId() != groupId) {
+ if (currentGroup == null || currentGroup.getResourceGroup().getId() != groupId) {
setSelectedGroup(groupId, viewPath);
@@ -144,7 +131,6 @@ public class ResourceGroupTopView extends HLayout implements BookmarkableView {
viewPath.next();
this.detailView.renderView(viewPath);
-
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java
index bd79780..1730ac3 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java
@@ -43,8 +43,6 @@ import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
*/
public class ResourceGroupTreeView extends VLayout {
- private int groupId;
- private ResourceGroup group;
private TreeGrid treeGrid;
public ResourceGroupTreeView() {
@@ -52,24 +50,19 @@ public class ResourceGroupTreeView extends VLayout {
setHeight100();
}
-
@Override
protected void onInit() {
super.onInit();
-
this.treeGrid = new TreeGrid();
this.treeGrid.setWidth100();
this.treeGrid.setHeight100();
treeGrid.setShowRoot(true);
addMember(this.treeGrid);
-
-
}
public void setSelectedGroup(int groupId) {
- this.groupId = groupId;
GWTServiceLookup.getClusterService().getClusterTree(groupId,
new AsyncCallback<ClusterFlyweight>() {
public void onFailure(Throwable caught) {
@@ -80,33 +73,9 @@ public class ResourceGroupTreeView extends VLayout {
loadTree(result);
}
});
-
- // TODO: Get the group from the ResourceGroupTreeView in case it was already loaded.
- ResourceGroupCriteria criteria = new ResourceGroupCriteria();
- criteria.addFilterId(groupId);
- criteria.fetchTags(true);
- GWTServiceLookup.getResourceGroupService().findResourceGroupsByCriteria(criteria,
- new AsyncCallback<PageList<ResourceGroup>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load group", caught);
- }
-
- public void onSuccess(PageList<ResourceGroup> result) {
- group = result.get(0);
- }
- });
-
}
- ResourceGroup getGroup(int groupId) {
- // TODO: Get the group from the ResourceGroupTreeView in case it was already loaded.
- return this.group;
- }
-
-
private void loadTree(ClusterFlyweight root) {
-
-
TreeNode rootNode = new TreeNode(root.getName());
loadTree(rootNode, root);
@@ -116,7 +85,6 @@ public class ResourceGroupTreeView extends VLayout {
treeGrid.setData(tree);
markForRedraw();
-
}
public void loadTree(TreeNode parent, ClusterFlyweight parentNode) {
@@ -125,14 +93,8 @@ public class ResourceGroupTreeView extends VLayout {
ArrayList<TreeNode> childNodes = new ArrayList<TreeNode>();
HashMap<Integer,TreeNode> typeNodes = new HashMap<Integer, TreeNode>();
-
for (ClusterFlyweight child : parentNode.getChildren()) {
-
-
-
-
-
TreeNode node = new TreeNode(child.getName());
childNodes.add(node);
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 c5aeb38..57ecbcd 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
@@ -1,12 +1,147 @@
+/*
+ * 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.smartgwt.client.types.Alignment;
+import com.smartgwt.client.widgets.HTMLFlow;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.FormItem;
+import com.smartgwt.client.widgets.form.fields.SpacerItem;
+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 java.util.ArrayList;
+import java.util.Date;
/**
+ * The group Inventory>Overview tab.
+ *
* @author Ian Springer
*/
public class OverviewView extends VLayout {
+ private ResourceGroupComposite groupComposite;
+
+ public OverviewView(ResourceGroupComposite groupComposite) {
+ super();
+ this.groupComposite = groupComposite;
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+
+ ResourceGroup group = this.groupComposite.getResourceGroup();
+
+ HLayout spacer = new HLayout();
+ spacer.setHeight(15);
+ addMember(spacer);
+
+ DynamicForm generalPropsForm = new DynamicForm();
+ generalPropsForm.setNumCols(4);
+ generalPropsForm.setColWidths("25%", "25%", "25%", "25%");
+ generalPropsForm.setWrapItemTitles(false);
+ setWidth("90%");
+
+ ArrayList<FormItem> formItems = new ArrayList<FormItem>();
+ ArrayList<String> itemIds = new ArrayList<String>();
+
+ //HeaderItem headerItem = new HeaderItem("header", "General Properties");
+ //headerItem.setValue("General Properties");
+ //formItems.add(headerItem);
+
+ StaticTextItem nameItem = new StaticTextItem("nameItem", "Name");
+ nameItem.setValue(group.getName());
+ formItems.add(nameItem);
+ itemIds.add(nameItem.getName());
+
+ StaticTextItem typeItem = new StaticTextItem("typeItem", "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);
+ itemIds.add(typeItem.getName());
+
+ StaticTextItem countItem = new StaticTextItem("countItem", "Member Count");
+ long memberCount = this.groupComposite.getImplicitUp() + this.groupComposite.getImplicitDown();
+ countItem.setValue(memberCount);
+ formItems.add(countItem);
+ itemIds.add(countItem.getName());
+
+ StaticTextItem descriptionItem = new StaticTextItem("descriptionItem", "Description");
+ String description = group.getDescription();
+ descriptionItem.setValue((description != null) ? description : "<i>none</i>");
+ formItems.add(descriptionItem);
+ itemIds.add(descriptionItem.getName());
+
+ StaticTextItem dynamicItem = new StaticTextItem("dynamicItem", "Dynamic?");
+ dynamicItem.setValue((group.getGroupDefinition() != null) ? "yes" : "no");
+ formItems.add(dynamicItem);
+ itemIds.add(dynamicItem.getName());
+
+ StaticTextItem recursiveItem = new StaticTextItem("recursiveItem", "Recursive?");
+ recursiveItem.setValue((group.isRecursive()) ? "yes" : "no");
+ formItems.add(recursiveItem);
+ itemIds.add(recursiveItem.getName());
+
+ StaticTextItem createdItem = new StaticTextItem("createdItem", "Created");
+ createdItem.setValue(new Date(group.getCtime()));
+ formItems.add(createdItem);
+ itemIds.add(createdItem.getName());
+
+ StaticTextItem lastModifiedItem = new StaticTextItem("lastModifiedItem", "Last Modified");
+ lastModifiedItem.setValue(new Date(group.getMtime()));
+ formItems.add(lastModifiedItem);
+ itemIds.add(lastModifiedItem.getName());
+
+ StaticTextItem lastModifiedByItem = new StaticTextItem("lastModifiedByItem", "Last Modified By");
+ lastModifiedByItem.setValue(group.getModifiedBy());
+ formItems.add(lastModifiedByItem);
+ itemIds.add(lastModifiedByItem.getName());
+
+ StaticTextItem groupDefinitionItem = new StaticTextItem("groupDefinitionItem", "Group Definition");
+ GroupDefinition groupDefinition = group.getGroupDefinition();
+ // TODO (ips): Make this a link to the group def.
+ groupDefinitionItem.setValue((groupDefinition != null) ? groupDefinition.getName() : "<i>none</i>");
+ formItems.add(groupDefinitionItem);
+ itemIds.add(groupDefinitionItem.getName());
+
+ generalPropsForm.setItems(formItems.toArray(new FormItem[formItems.size()]));
+ addMember(generalPropsForm);
- // TODO: Group general properties go here.
-
+ if (groupDefinition != null) {
+ 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/overview/ResourceSummaryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/overview/ResourceSummaryView.java
index 981fb60..6f1228c 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
@@ -144,7 +144,6 @@ public class ResourceSummaryView extends DynamicForm implements ResourceSelectLi
formItems.add(descriptionItem);
itemIds.add(descriptionItem.getName());
-
StaticTextItem versionItem = new StaticTextItem("versionItem", "Version");
formItems.add(versionItem);
itemIds.add(versionItem.getName());
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 48e9961..67326c1 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
@@ -22,6 +22,7 @@ import org.rhq.core.domain.criteria.ResourceGroupCriteria;
import org.rhq.core.domain.criteria.ResourceGroupDefinitionCriteria;
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.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGroupGWTService;
import org.rhq.enterprise.gui.coregui.server.util.SerialUtility;
@@ -39,13 +40,15 @@ public class ResourceGroupGWTServiceImpl extends AbstractGWTServiceImpl implemen
private ResourceGroupManagerLocal groupManager = LookupUtil.getResourceGroupManager();
private GroupDefinitionManagerLocal definitionManager = LookupUtil.getGroupDefinitionManager();
-
public PageList<ResourceGroup> findResourceGroupsByCriteria(ResourceGroupCriteria criteria) {
return SerialUtility.prepare(groupManager.findResourceGroupsByCriteria(getSessionSubject(), criteria),
"ResourceGroupService.findResourceGroupsByCriteria");
}
- // TODO GH: build and expose findResourceGroupCompositesByCriteria
+ public PageList<ResourceGroupComposite> findResourceGroupCompositesByCriteria(ResourceGroupCriteria criteria) {
+ return SerialUtility.prepare(groupManager.findResourceGroupCompositesByCriteria(getSessionSubject(), criteria),
+ "ResourceGroupService.findResourceGroupCompositesByCriteria");
+ }
public PageList<GroupDefinition> findGroupDefinitionsByCriteria(ResourceGroupDefinitionCriteria criteria) {
return SerialUtility.prepare(definitionManager.findGroupDefinitionsByCriteria(getSessionSubject(), criteria),
13 years, 10 months
[rhq] 3 commits - modules/enterprise
by Jay Shaughnessy
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java | 21 --
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java | 83 +++++-----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java | 20 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateStep.java | 39 +++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateWizard.java | 13 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupMembersStep.java | 11 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java | 33 ++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java | 57 +++++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypePluginTreeDataSource.java | 79 ++++-----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java | 44 +----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java | 46 ++---
modules/enterprise/gui/portal-war/src/main/webapp/index.html | 18 +-
12 files changed, 264 insertions(+), 200 deletions(-)
New commits:
commit 14cb5621315e2cfecdad8bb54c8d995b95340820
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Aug 10 12:26:56 2010 -0400
Group List View and Create Wizard Work
- converted group list view to extend Table instead of VLayout with single table
- added group delete to list view
- changed button and confirm text for consistency (now like bundle buttons)
- removed checkboxes from list view
- added some core gui refresh to list view
- simplified wizard invoke style
- left justify create step and increase text box sizes
- improve Next/Previous handling
- respect selected compatible type on member selection page
- fetch only the required resources for compatible group member select
- fix issues with member filtering
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
index f29a064..8171d96 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
@@ -18,51 +18,52 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.groups;
+import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.ListGridFieldType;
-import com.smartgwt.client.types.SelectionAppearance;
import com.smartgwt.client.types.SelectionStyle;
import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
-import com.smartgwt.client.widgets.layout.VLayout;
+import org.rhq.core.domain.resource.group.ResourceGroup;
+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.wizard.WizardView;
+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.inventory.groups.wizard.GroupCreateWizard;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSearchView;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
/**
* @author Greg Hinkle
*/
-public class ResourceGroupListView extends VLayout {
-
- private Table table;
+public class ResourceGroupListView extends Table {
public ResourceGroupListView() {
- this(null);
-
+ super("Resource Groups");
+ setWidth100();
+ setHeight100();
}
- /**
- * Resource Group list filtered by a given criteria
- * @param criteria
- */
public ResourceGroupListView(Criteria criteria) {
+ super("Resource Groups", criteria);
+ }
- setWidth100();
- setHeight100();
+ @Override
+ protected void onInit() {
+ super.onInit();
- final ResourceGroupsDataSource datasource = ResourceGroupsDataSource.getInstance();
+ // setHeaderIcon("?_24.png");
- table = new Table("Resource Groups", criteria);
- table.setDataSource(datasource);
+ final ResourceGroupsDataSource datasource = ResourceGroupsDataSource.getInstance();
+ setDataSource(datasource);
- table.getListGrid().setSelectionType(SelectionStyle.SIMPLE);
- table.getListGrid().setSelectionAppearance(SelectionAppearance.CHECKBOX);
- table.getListGrid().setResizeFieldsInRealTime(true);
+ getListGrid().setSelectionType(SelectionStyle.SIMPLE);
+ //table.getListGrid().setSelectionAppearance(SelectionAppearance.CHECKBOX);
+ getListGrid().setResizeFieldsInRealTime(true);
ListGridField idField = new ListGridField("id", "Id", 55);
idField.setType(ListGridFieldType.INTEGER);
@@ -81,26 +82,38 @@ public class ResourceGroupListView extends VLayout {
ListGridField availabilityField = new ListGridField("currentAvailability", "Availability", 55);
availabilityField.setAlign(Alignment.CENTER);
- table.getListGrid().setFields(idField, nameField, descriptionField, typeNameField, pluginNameField,
- categoryField, availabilityField);
-
- table.addTableAction("Delete Groups", Table.SelectionEnablement.ANY,
- "Are you sure you want to delete # groups?", new TableAction() {
- public void executeAction(ListGridRecord[] selection) {
- // TODO: Implement this method.
+ getListGrid().setFields(idField, nameField, descriptionField, typeNameField, pluginNameField, categoryField,
+ availabilityField);
+
+ addTableAction("Delete", Table.SelectionEnablement.ANY, "Delete the selected resource groups?",
+ new TableAction() {
+ public void executeAction(ListGridRecord[] selections) {
+ ResourceGroupsDataSource ds = (ResourceGroupsDataSource) getDataSource();
+ for (ListGridRecord selection : selections) {
+ ResourceGroupGWTServiceAsync resourceGroupManager = GWTServiceLookup.getResourceGroupService();
+ final ResourceGroup object = ds.copyValues(selection);
+ resourceGroupManager.deleteResourceGroup(object.getId(), new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+ "Failed to delete resource group [" + object.getName() + "]", caught);
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("Deleted resource group [" + object.getName() + "]", Severity.Info));
+
+ CoreGUI.refresh();
+ }
+ });
+ }
}
});
- table.addTableAction("New Group", new TableAction() {
+ addTableAction("New", new TableAction() {
public void executeAction(ListGridRecord[] selection) {
- WizardView view = new WizardView(new GroupCreateWizard());
- view.displayDialog();
+ new GroupCreateWizard().startBundleWizard();
}
});
-
-
- addMember(table);
-
}
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java
index debe24d..aaaaeaa 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java
@@ -28,6 +28,7 @@ import com.smartgwt.client.rpc.RPCResponse;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.core.domain.criteria.ResourceGroupCriteria;
+import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.group.GroupCategory;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.util.PageList;
@@ -115,7 +116,24 @@ public class ResourceGroupsDataSource extends RPCDataSource<ResourceGroup> {
@Override
public ResourceGroup copyValues(ListGridRecord from) {
- return null; // TODO: Implement this method.
+ Integer idAttrib = from.getAttributeAsInt("id");
+ String nameAttrib = from.getAttribute("name");
+ String descriptionAttrib = from.getAttribute("description");
+ String typeNameAttrib = from.getAttribute("typeName");
+ String pluginNameAttrib = from.getAttribute("pluginName");
+ ResourceType rt = null;
+
+ ResourceGroup rg = new ResourceGroup(nameAttrib);
+ rg.setId(idAttrib);
+ rg.setDescription(descriptionAttrib);
+ if (null != typeNameAttrib) {
+ rt = new ResourceType();
+ rt.setName(typeNameAttrib);
+ rt.setPlugin(pluginNameAttrib);
+ rg.setResourceType(rt);
+ }
+
+ return rg;
}
@Override
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateStep.java
index 96b6017..032cc75 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateStep.java
@@ -52,19 +52,22 @@ public class GroupCreateStep extends AbstractWizardStep {
form = new DynamicForm();
form.setValuesManager(new ValuesManager());
- form.setNumCols(4);
+ form.setWidth100();
+ form.setNumCols(2);
TextItem name = new TextItem("name", "Name");
name.setRequired(true);
-
- TextItem location = new TextItem("location", "Location");
+ name.setWidth(300);
TextAreaItem description = new AutoFitTextAreaItem("description", "Description");
+ description.setWidth(300);
+
+ TextItem location = new TextItem("location", "Location");
+ location.setWidth(300);
CheckboxItem recursive = new CheckboxItem("recursive", "Recursive");
LinkedHashMap<String, Canvas> options = new LinkedHashMap<String, Canvas>();
-
options.put("Mixed", null);
IPickTreeItem typeSelectItem = new IPickTreeItem("type", "Type");
@@ -81,16 +84,25 @@ public class GroupCreateStep extends AbstractWizardStep {
options.put("Compatible", form2);
RadioGroupWithComponentsItem kind = new RadioGroupWithComponentsItem("kind", "Group Type", options, form);
- kind.setValue("Mixed Resources");
+ kind.setValue("Mixed");
- form.setFields(name, location, description, recursive, kind);
+ form.setFields(name, description, location, recursive, kind);
}
return form;
}
public boolean nextPage() {
- return form.validate();
+ boolean valid = form.validate();
+ if (valid) {
+ RadioGroupWithComponentsItem kind = (RadioGroupWithComponentsItem) form.getField("kind");
+ if ("Compatible".equals(kind.getSelected())) {
+ DynamicForm form2 = (DynamicForm) kind.getSelectedComponent();
+ valid = (null != form2.getValue("type"));
+ }
+ }
+
+ return valid;
}
public String getName() {
@@ -103,11 +115,16 @@ public class GroupCreateStep extends AbstractWizardStep {
group.setLocation(form.getValueAsString("location"));
group.setRecursive(form.getValue("recursive") != null ? true : false);
- if (form.getValue("type") != null) {
- ResourceType type = new ResourceType();
- type.setId(Integer.parseInt(form.getValueAsString("type")));
- group.setResourceType(type);
+ RadioGroupWithComponentsItem kind = (RadioGroupWithComponentsItem) form.getField("kind");
+ if ("Compatible".equals(kind.getSelected())) {
+ DynamicForm form2 = (DynamicForm) kind.getSelectedComponent();
+ if (null != form2.getValue("type")) {
+ ResourceType rt = new ResourceType();
+ rt.setId(Integer.parseInt(form2.getValueAsString("type")));
+ group.setResourceType(rt);
+ }
}
+
return group;
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateWizard.java
index 4c8b074..55d1588 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateWizard.java
@@ -28,6 +28,7 @@ import java.util.List;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.IButton;
+import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.wizard.AbstractWizard;
@@ -68,6 +69,18 @@ public class GroupCreateWizard extends AbstractWizard {
return null; // TODO: Implement this method.
}
+ /**
+ * @return only the rt id is set
+ */
+ public ResourceType getCompatibleGroupResourceType() {
+ ResourceGroup rg = createStep.getGroup();
+ ResourceType rt = null;
+ if (null != rg) {
+ rt = rg.getResourceType();
+ }
+ return rt;
+ }
+
public void cancel() {
// TODO: Implement this method.
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupMembersStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupMembersStep.java
index 5f13657..cc79abc 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupMembersStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupMembersStep.java
@@ -26,6 +26,7 @@ import java.util.HashSet;
import com.smartgwt.client.widgets.Canvas;
+import org.rhq.core.domain.resource.ResourceType;
import org.rhq.enterprise.gui.coregui.client.components.wizard.AbstractWizardStep;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.selection.ResourceSelector;
@@ -34,16 +35,20 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.selection.Resour
*/
public class GroupMembersStep extends AbstractWizardStep {
- private GroupCreateWizard wizard;
- private ResourceSelector selector;
+ private GroupCreateWizard wizard = null;
+ private ResourceSelector selector = null;
+ private ResourceType requireType = null;
public GroupMembersStep(GroupCreateWizard wizard) {
this.wizard = wizard;
}
public Canvas getCanvas() {
- if (selector == null) {
+ ResourceType rt = wizard.getCompatibleGroupResourceType();
+ if ((selector == null) || (rt != requireType)) {
selector = new ResourceSelector();
+ requireType = rt;
+ selector.setRequireType(rt);
}
return selector;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
index af8931b..c0731b8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
@@ -98,6 +98,24 @@ public class ResourceDatasource extends RPCDataSource<Resource> {
public void executeFetch(final DSRequest request, final DSResponse response) {
+ ResourceCriteria criteria = getFetchCriteria(request);
+
+ resourceService.findResourcesByCriteria(criteria, new AsyncCallback<PageList<Resource>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to fetch resource data", caught);
+ response.setStatus(RPCResponse.STATUS_FAILURE);
+ processResponse(request.getRequestId(), response);
+ }
+
+ public void onSuccess(PageList<Resource> result) {
+
+ dataRetrieved(result, response, request);
+ }
+ });
+ }
+
+ protected ResourceCriteria getFetchCriteria(final DSRequest request) {
+
ResourceCriteria criteria = new ResourceCriteria();
criteria.setPageControl(getPageControl(request));
@@ -164,18 +182,7 @@ public class ResourceDatasource extends RPCDataSource<Resource> {
criteria.addFilterTagName((String) request.getCriteria().getValues().get("tagName"));
}
- resourceService.findResourcesByCriteria(criteria, new AsyncCallback<PageList<Resource>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to fetch resource data", caught);
- response.setStatus(RPCResponse.STATUS_FAILURE);
- processResponse(request.getRequestId(), response);
- }
-
- public void onSuccess(PageList<Resource> result) {
-
- dataRetrieved(result, response, request);
- }
- });
+ return criteria;
}
@Override
@@ -221,7 +228,7 @@ public class ResourceDatasource extends RPCDataSource<Resource> {
record.setAttribute("id", from.getId());
record.setAttribute(NAME.propertyName(), from.getName());
record.setAttribute(DESCRIPTION.propertyName(), from.getDescription());
- record.setAttribute(TYPE.propertyName(), from.getResourceType().getName());
+ record.setAttribute(TYPE.propertyName(), from.getResourceType().getId());
record.setAttribute(PLUGIN.propertyName(), from.getResourceType().getPlugin());
record.setAttribute(CATEGORY.propertyName(), from.getResourceType().getCategory().getDisplayName());
record.setAttribute("icon", from.getResourceType().getCategory().getDisplayName() + "_"
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java
index 1274e14..0d25f38 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java
@@ -18,12 +18,18 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.selection;
+import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.CATEGORY;
+import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.NAME;
+import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.PLUGIN;
+import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.TYPE;
+
import java.util.ArrayList;
import java.util.Collection;
import com.smartgwt.client.data.AdvancedCriteria;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.data.Criterion;
+import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.types.OperatorId;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.IPickTreeItem;
@@ -31,7 +37,9 @@ import com.smartgwt.client.widgets.form.fields.SelectItem;
import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.grid.ListGridRecord;
+import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceType;
import org.rhq.enterprise.gui.coregui.client.components.selector.AbstractSelector;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDatasource;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypePluginTreeDataSource;
@@ -42,18 +50,18 @@ import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
*/
public class ResourceSelector extends AbstractSelector<Resource> {
- private Integer requireTypeId;
+ private ResourceType requireType;
public ResourceSelector() {
super();
}
- public Integer getRequireTypeId() {
- return requireTypeId;
+ public ResourceType getRequireType() {
+ return requireType;
}
- public void setRequireTypeId(Integer requireTypeId) {
- this.requireTypeId = requireTypeId;
+ public void setRequireType(ResourceType requireType) {
+ this.requireType = requireType;
markForRedraw();
}
@@ -70,10 +78,15 @@ public class ResourceSelector extends AbstractSelector<Resource> {
typeSelectItem.setEmptyMenuMessage("Loading...");
typeSelectItem.setShowIcons(true);
- if (requireTypeId != null) {
- typeSelectItem.setValue(requireTypeId);
- typeSelectItem.setDisabled(true);
- availableFilterForm.setItems(search, typeSelectItem);
+ if (requireType != null) {
+ // TODO: Currently ignore the typeSelectItem widget because we already know the type.
+ // Alternatively, we could display it disabled but we'd want the type name to be displayed as the
+ // value. To get this to display the type name I think we need to pre-fetch the type tree here. We could
+ // potentially optimize typeSelectItem.setValue(requireType.getId()) to build a tree that includes only
+ // this single type.
+ //typeSelectItem.setValue(requireType.getId());
+ //typeSelectItem.setDisabled(true);
+ availableFilterForm.setItems(search);
} else {
SelectItem categorySelect = new SelectItem("category", "Category");
categorySelect.setValueMap("Platform", "Server", "Service");
@@ -91,23 +104,23 @@ public class ResourceSelector extends AbstractSelector<Resource> {
protected Criteria getLatestCriteria(DynamicForm availableFilterForm) {
String search = (String) availableFilterForm.getValue("search");
- String type = (String) availableFilterForm.getValue("type");
+ String type = availableFilterForm.getValueAsString("type");
String category = (String) availableFilterForm.getValue("category");
ArrayList<Criterion> criteria = new ArrayList<Criterion>(3);
if (null != search) {
- criteria.add(new Criterion("name", OperatorId.CONTAINS, search));
+ criteria.add(new Criterion(NAME.propertyName(), OperatorId.CONTAINS, search));
}
if (null != type) {
// If type is a number its a typeId, otherwise a plugin name
try {
Integer.parseInt(type);
- criteria.add(new Criterion("type", OperatorId.EQUALS, type));
+ criteria.add(new Criterion(TYPE.propertyName(), OperatorId.EQUALS, type));
} catch (NumberFormatException nfe) {
- criteria.add(new Criterion("plugin", OperatorId.EQUALS, type));
+ criteria.add(new Criterion(PLUGIN.propertyName(), OperatorId.EQUALS, type));
}
}
if (null != category) {
- criteria.add(new Criterion("category", OperatorId.EQUALS, category));
+ criteria.add(new Criterion(CATEGORY.propertyName(), OperatorId.EQUALS, category));
}
AdvancedCriteria latestCriteria = new AdvancedCriteria(OperatorId.AND, criteria.toArray(new Criterion[criteria
.size()]));
@@ -127,5 +140,21 @@ public class ResourceSelector extends AbstractSelector<Resource> {
}
return records;
}
+
+ @Override
+ protected ResourceCriteria getFetchCriteria(final DSRequest request) {
+ ResourceCriteria result = super.getFetchCriteria(request);
+
+ // additional filters
+ if (null != requireType) {
+ result.addFilterResourceTypeId(requireType.getId());
+ }
+
+ // additional return data
+ result.fetchResourceType(true);
+
+ return result;
+ }
+
}
}
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/index.html b/modules/enterprise/gui/portal-war/src/main/webapp/index.html
index c6499a3..156119e 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/index.html
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/index.html
@@ -1,9 +1,9 @@
-<html>
- <head>
- <meta http-equiv="Refresh" content="0; URL=/coregui/CoreGUI.html#Dashboard"/>
- </head>
- <body>
- <p>Redirecting to <a href="/coregui/CoreGUI.html#Dashboard">coregui.war</a>...</p>
- </body>
-</html>
-
+<html>
+ <head>
+ <meta http-equiv="Refresh" content="0; URL=/coregui/CoreGUI.html#Dashboard"/>
+ </head>
+ <body>
+ <p>Redirecting to <a href="/coregui/CoreGUI.html#Dashboard">coregui.war</a>...</p>
+ </body>
+</html>
+
commit ab5237ba41268de18da049c127ad1d83a380378b
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Aug 10 12:18:03 2010 -0400
cosmetic changes only
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypePluginTreeDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypePluginTreeDataSource.java
index 227e783..03a2198 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypePluginTreeDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypePluginTreeDataSource.java
@@ -22,8 +22,6 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
-import java.util.HashSet;
-import java.util.ListIterator;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.DSRequest;
@@ -48,7 +46,6 @@ import org.rhq.enterprise.gui.coregui.client.gwt.ResourceTypeGWTServiceAsync;
*/
public class ResourceTypePluginTreeDataSource extends DataSource {
-
private ResourceTypeGWTServiceAsync resourceTypeService = GWTServiceLookup.getResourceTypeGWTService();
public ResourceTypePluginTreeDataSource() {
@@ -57,7 +54,6 @@ public class ResourceTypePluginTreeDataSource extends DataSource {
setDataProtocol(DSProtocol.CLIENTCUSTOM);
setDataFormat(DSDataFormat.CUSTOM);
-
DataSourceTextField idField = new DataSourceTextField("id", "ID");
idField.setPrimaryKey(true);
@@ -70,7 +66,6 @@ public class ResourceTypePluginTreeDataSource extends DataSource {
DataSourceTextField resourceTypeField = new DataSourceTextField("category", "Category");
-
setFields(idField, parentIdField, resourceNameField, resourceKeyField, resourceTypeField);
}
@@ -80,17 +75,16 @@ public class ResourceTypePluginTreeDataSource extends DataSource {
// Asume success
response.setStatus(0);
switch (request.getOperationType()) {
- case FETCH:
- executeFetch(request, response);
- break;
- default:
- break;
+ case FETCH:
+ executeFetch(request, response);
+ break;
+ default:
+ break;
}
return request.getData();
}
-
protected void executeFetch(final DSRequest request, final DSResponse response) {
String parentIdString = request.getCriteria().getAttributeAsString("parentId");
@@ -98,26 +92,23 @@ public class ResourceTypePluginTreeDataSource extends DataSource {
processResponse(request.getRequestId(), response);
} else {
-
ResourceTypeCriteria criteria = new ResourceTypeCriteria();
criteria.fetchParentResourceTypes(true);
criteria.setPageControl(PageControl.getUnlimitedInstance());
- resourceTypeService.findResourceTypesByCriteria(criteria,
- new AsyncCallback<PageList<ResourceType>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load resource type tree data", caught);
- }
-
- public void onSuccess(PageList<ResourceType> result) {
- response.setData(buildNodes(result));
- processResponse(request.getRequestId(), response);
- }
- });
+ resourceTypeService.findResourceTypesByCriteria(criteria, new AsyncCallback<PageList<ResourceType>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load resource type tree data", caught);
+ }
+
+ public void onSuccess(PageList<ResourceType> result) {
+ response.setData(buildNodes(result));
+ processResponse(request.getRequestId(), response);
+ }
+ });
}
}
-
public static TreeNode[] buildNodes(PageList<ResourceType> result) {
HashMap<String, PluginTreeNode> pluginNodes = new HashMap<String, PluginTreeNode>();
@@ -127,12 +118,11 @@ public class ResourceTypePluginTreeDataSource extends DataSource {
if (type.getParentResourceTypes() == null || type.getParentResourceTypes().isEmpty()) {
PluginTreeNode pluginNode = pluginNodes.get(type.getPlugin());
- if (pluginNode == null) {
- pluginNode = new PluginTreeNode(type.getPlugin());
- pluginNodes.put(type.getPlugin(), pluginNode);
- nodes.add(pluginNode);
- }
-
+ if (pluginNode == null) {
+ pluginNode = new PluginTreeNode(type.getPlugin());
+ pluginNodes.put(type.getPlugin(), pluginNode);
+ nodes.add(pluginNode);
+ }
nodes.add(new ResourceTypeTreeNode(type, type.getPlugin()));
} else {
@@ -152,7 +142,6 @@ public class ResourceTypePluginTreeDataSource extends DataSource {
return treeNodes;
}
-
/**
* Returns a prepopulated PageControl based on the provided DSRequest. This will set sort fields,
* pagination, but *not* filter fields.
@@ -166,7 +155,8 @@ public class ResourceTypePluginTreeDataSource extends DataSource {
if (request.getStartRow() == null || request.getEndRow() == null) {
pageControl = new PageControl();
} else {
- pageControl = PageControl.getExplicitPageControl(request.getStartRow(), request.getEndRow() - request.getStartRow());
+ pageControl = PageControl.getExplicitPageControl(request.getStartRow(), request.getEndRow()
+ - request.getStartRow());
}
// Initialize sorting.
@@ -183,7 +173,6 @@ public class ResourceTypePluginTreeDataSource extends DataSource {
return pageControl;
}
-
public static class PluginTreeNode extends TreeNode {
String id;
@@ -195,19 +184,22 @@ public class ResourceTypePluginTreeDataSource extends DataSource {
setParentID(null);
setAttribute("name", pluginName + " Plugin");
-// setAttribute("plugin",pluginName);
+ // setAttribute("plugin",pluginName);
setIcon("types/plugin_16.png"); // todo doesn't work
setEnabled(true);
}
@Override
public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
PluginTreeNode that = (PluginTreeNode) o;
- if (!id.equals(that.id)) return false;
+ if (!id.equals(that.id))
+ return false;
return true;
}
@@ -245,20 +237,23 @@ public class ResourceTypePluginTreeDataSource extends DataSource {
setIsFolder(true);
}
-
public ResourceType getResourceType() {
return resourceType;
}
@Override
public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
ResourceTypeTreeNode that = (ResourceTypeTreeNode) o;
- if (!id.equals(that.id)) return false;
- if (parentId != null ? !parentId.equals(that.parentId) : that.parentId != null) return false;
+ if (!id.equals(that.id))
+ return false;
+ if (parentId != null ? !parentId.equals(that.parentId) : that.parentId != null)
+ return false;
return true;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
index 9d354f4..d761dbd 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
@@ -18,36 +18,16 @@
*/
package org.rhq.enterprise.gui.coregui.client.menu;
-import com.google.gwt.dom.client.Document;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.user.client.History;
-import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Hyperlink;
-import com.smartgwt.client.types.ContentsType;
-import com.smartgwt.client.types.VerticalAlignment;
-import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.Img;
-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.events.DrawEvent;
-import com.smartgwt.client.widgets.events.DrawHandler;
-import com.smartgwt.client.widgets.events.ShowContextMenuEvent;
-import com.smartgwt.client.widgets.events.ShowContextMenuHandler;
-import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.LayoutSpacer;
import com.smartgwt.client.widgets.layout.VLayout;
-import com.smartgwt.client.widgets.menu.Menu;
-import com.smartgwt.client.widgets.menu.MenuBar;
-import com.smartgwt.client.widgets.menu.MenuItem;
-import com.smartgwt.client.widgets.menu.MenuItemSeparator;
-import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent;
import com.smartgwt.client.widgets.toolbar.ToolStrip;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.components.AboutModalWindow;
/**
@@ -57,13 +37,12 @@ public class MenuBarView extends VLayout {
private AboutModalWindow aboutModalWindow;
- public static final String[] SECTIONS = {"Dashboard", "Inventory", "Reports", "Bundles", "Administration"};
+ public static final String[] SECTIONS = { "Dashboard", "Inventory", "Reports", "Bundles", "Administration" };
private String selected = "Dashboard";
private HTMLFlow linksPane;
-
protected void onDraw() {
super.onDraw();
@@ -81,7 +60,6 @@ public class MenuBarView extends VLayout {
}
});
-
ToolStrip topStrip = new ToolStrip();
topStrip.setHeight(34);
topStrip.setWidth100();
@@ -104,16 +82,16 @@ public class MenuBarView extends VLayout {
topStrip.addMember(new LayoutSpacer());
- HLayout helpLayout = new HLayout();
-// Label loggedInAs = new Label("Logged in as " + CoreGUI.getSessionSubject().getName());
-// loggedInAs.setWrap(false);
-// loggedInAs.setValign(VerticalAlignment.CENTER);
-// helpLayout.addMember(loggedInAs);
+ //HLayout helpLayout = new HLayout();
+ // Label loggedInAs = new Label("Logged in as " + CoreGUI.getSessionSubject().getName());
+ // loggedInAs.setWrap(false);
+ // loggedInAs.setValign(VerticalAlignment.CENTER);
+ // helpLayout.addMember(loggedInAs);
topStrip.addMember(new Hyperlink("Help", "Help"));
topStrip.addMember(new Hyperlink("Preferences", "Preferences"));
topStrip.addMember(new Hyperlink("Log Out", "LogOut"));
-// helpLayout.setLayoutAlign(VerticalAlignment.CENTER);
-// topStrip.addMember(helpLayout);
+ // helpLayout.setLayoutAlign(VerticalAlignment.CENTER);
+ // topStrip.addMember(helpLayout);
/* DynamicForm links = new DynamicForm();
links.setNumCols(SECTIONS.length * 2);
@@ -148,7 +126,7 @@ public class MenuBarView extends VLayout {
private String setupLinks() {
StringBuilder headerString = new StringBuilder(
- "<table style=\"height: 34px;\" cellpadding=\"0\" cellspacing=\"0\"><tr>");
+ "<table style=\"height: 34px;\" cellpadding=\"0\" cellspacing=\"0\"><tr>");
boolean first = true;
for (String section : SECTIONS) {
@@ -162,7 +140,8 @@ public class MenuBarView extends VLayout {
styleClass += "Selected";
}
- headerString.append("<td class=\"" + styleClass + "\" onclick=\"document.location='#" + section + "'\" >");
+ headerString.append("<td id=\"" + section + "\" class=\"" + styleClass
+ + "\" onclick=\"document.location='#" + section + "'\" >");
headerString.append(section);
headerString.append("</td>\n");
@@ -174,5 +153,4 @@ public class MenuBarView extends VLayout {
return headerString.toString();
}
-
}
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 a288517..95436d4 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
@@ -20,11 +20,6 @@ package org.rhq.enterprise.gui.coregui.client.util;
import java.util.Collection;
-import org.rhq.core.domain.util.PageControl;
-import org.rhq.core.domain.util.PageList;
-import org.rhq.core.domain.util.PageOrdering;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-
import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.data.DataSource;
@@ -32,6 +27,10 @@ import com.smartgwt.client.types.DSDataFormat;
import com.smartgwt.client.types.DSProtocol;
import com.smartgwt.client.widgets.grid.ListGridRecord;
+import org.rhq.core.domain.util.PageControl;
+import org.rhq.core.domain.util.PageOrdering;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+
/**
* Base GWT-RPC oriented DataSource class.
*
@@ -59,21 +58,21 @@ public abstract class RPCDataSource<T> extends DataSource {
DSResponse response = createResponse(request);
switch (request.getOperationType()) {
- case FETCH:
- executeFetch(request, response);
- break;
- case ADD:
- executeAdd(request, response);
- break;
- case UPDATE:
- executeUpdate(request, response);
- break;
- case REMOVE:
- executeRemove(request, response);
- break;
- default:
- super.transformRequest(request);
- break;
+ case FETCH:
+ executeFetch(request, response);
+ break;
+ case ADD:
+ executeAdd(request, response);
+ break;
+ case UPDATE:
+ executeUpdate(request, response);
+ break;
+ case REMOVE:
+ executeRemove(request, response);
+ break;
+ default:
+ super.transformRequest(request);
+ break;
}
} catch (Throwable t) {
CoreGUI.getErrorHandler().handleError("Failure in datasource [" + request.getOperationType() + "]", t);
@@ -95,7 +94,8 @@ public abstract class RPCDataSource<T> extends DataSource {
if (request.getStartRow() == null || request.getEndRow() == null) {
pageControl = new PageControl();
} else {
- pageControl = PageControl.getExplicitPageControl(request.getStartRow(), request.getEndRow() - request.getStartRow());
+ pageControl = PageControl.getExplicitPageControl(request.getStartRow(), request.getEndRow()
+ - request.getStartRow());
}
// Initialize sorting.
@@ -112,7 +112,6 @@ public abstract class RPCDataSource<T> extends DataSource {
return pageControl;
}
-
public ListGridRecord[] buildRecords(Collection<T> list) {
if (list == null) {
return null;
@@ -126,7 +125,6 @@ public abstract class RPCDataSource<T> extends DataSource {
return records;
}
-
/**
* Extensions should implement this method to retrieve data. Paging solutions should use
* {@link #getPageControl(com.smartgwt.client.data.DSRequest)}. All implementations should call processResponse()
@@ -138,12 +136,10 @@ public abstract class RPCDataSource<T> extends DataSource {
*/
protected abstract void executeFetch(final DSRequest request, final DSResponse response);
-
public abstract T copyValues(ListGridRecord from);
public abstract ListGridRecord copyValues(T from);
-
/**
* Executed on <code>REMOVE</code> operation. <code>processResponse (requestId, response)</code>
* should be called when operation completes (either successful or failure).
commit 622cb7544ac6e28d4557a68e9f57420387d9c5de
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Aug 10 12:14:32 2010 -0400
cosmetic changes only
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
index 3dc9f4c..8b2726c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
@@ -18,15 +18,11 @@
*/
package org.rhq.enterprise.gui.coregui.client.bundle.list;
-import com.google.gwt.user.client.History;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.types.ListGridFieldType;
-import com.smartgwt.client.types.SelectionAppearance;
import com.smartgwt.client.types.SelectionStyle;
-import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGridRecord;
-import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.bundle.Bundle;
import org.rhq.core.domain.bundle.composite.BundleWithLatestVersionComposite;
@@ -63,7 +59,6 @@ public class BundlesListView extends Table {
setHeaderIcon("subsystems/bundle/Bundle_24.png");
-
setDataSource(new BundlesWithLatestVersionDataSource());
getListGrid().getField("id").setWidth("60");
@@ -71,27 +66,26 @@ public class BundlesListView extends Table {
getListGrid().getField("link").setType(ListGridFieldType.LINK);
getListGrid().getField("link").setTarget("_self");
-// getListGrid().getField("name").setCellFormatter(new CellFormatter() {
-// public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
-// return "";//<a href=\"#Bundles/Bundle/" + listGridRecord.getAttribute("id") + "\">" + o + "</a>";
-// }
-// });
+ // getListGrid().getField("name").setCellFormatter(new CellFormatter() {
+ // public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
+ // return "";//<a href=\"#Bundles/Bundle/" + listGridRecord.getAttribute("id") + "\">" + o + "</a>";
+ // }
+ // });
getListGrid().getField("description").setWidth("25%");
getListGrid().getField("latestVersion").setWidth("25%");
getListGrid().getField("versionsCount").setWidth("*");
getListGrid().setSelectionType(SelectionStyle.SIMPLE);
-// getListGrid().setSelectionAppearance(SelectionAppearance.CHECKBOX);
+ // getListGrid().setSelectionAppearance(SelectionAppearance.CHECKBOX);
addTableAction("New", Table.SelectionEnablement.ALWAYS, null, new TableAction() {
public void executeAction(ListGridRecord[] selection) {
new BundleCreateWizard().startBundleWizard();
-
}
});
- addTableAction("Delete", Table.SelectionEnablement.ANY, "Delete the selected bundle?", new TableAction() {
+ addTableAction("Delete", Table.SelectionEnablement.ANY, "Delete the selected bundles?", new TableAction() {
public void executeAction(ListGridRecord[] selections) {
BundlesWithLatestVersionDataSource ds = (BundlesWithLatestVersionDataSource) getDataSource();
for (ListGridRecord selection : selections) {
@@ -148,7 +142,6 @@ public class BundlesListView extends Table {
});
}
-
public int getMatches() {
return this.getListGrid().getTotalRows();
}
13 years, 10 months
[rhq] Branch 'code-smell' - 3 commits - modules/core
by lkrejci
modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml | 78 ++++------
1 file changed, 36 insertions(+), 42 deletions(-)
New commits:
commit aef5cf286fc08b16273a54022ecb0f48f19d9b44
Merge: ac90dbd... a5187a8...
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Tue Aug 10 18:11:10 2010 +0200
Merge branch 'master' into code-smell
commit a5187a89792700e0852b59a679444a5b352bbd11
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Aug 10 10:21:15 2010 -0400
trivial - remove end-of-line spaces
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index 5d47fc1..f36ad4a 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -1539,7 +1539,7 @@
<statement targetDBVendor="postgresql">
ALTER TABLE RHQ_REPO
ADD CONSTRAINT RHQ_REPO_PKEY PRIMARY KEY ( ID )
- </statement>
+ </statement>
<statement>
ALTER TABLE RHQ_CHANNEL_CONTENT_SRC_MAP
RENAME TO RHQ_REPO_CONTENT_SRC_MAP
@@ -3065,20 +3065,20 @@
FOREIGN KEY ( DASHBOARD_ID )
REFERENCES RHQ_DASHBOARD ( ID )
</statement>
- </schema-directSQL>
+ </schema-directSQL>
</schemaSpec>
-
+
<!-- rhq 3.0.0.final release at this point. -->
-
+
<!-- 2.89 corrects problems in 3.0.0.final *new* installs. The problems it
fixes are not present in an upgraded db. As such, ignore any errors.
- -->
+ -->
<schemaSpec version="2.89">
<schema-deleteColumn ignoreError="true" table="RHQ_ALERT" column="TRIGGERED_OPERATION" />
<schema-deleteColumn ignoreError="true" table="RHQ_ALERT_DEFINITION" column="operation_def_id" />
-
+
<schema-alterColumn ignoreError="true" table="RHQ_ADVISORY_CVE" column="LAST_MODIFIED" nullable="false" />
-
+
<schema-alterColumn ignoreError="true" table="RHQ_TAGGING_BUNDLE_MAP" column="BUNDLE_ID" nullable="false" />
<schema-alterColumn ignoreError="true" table="RHQ_TAGGING_BUNDLE_MAP" column="TAG_ID" nullable="false" />
<schema-alterColumn ignoreError="true" table="RHQ_TAGGING_BUNDLE_VERSION_MAP" column="BUNDLE_VERSION_ID" nullable="false" />
@@ -3090,27 +3090,27 @@
<schema-alterColumn ignoreError="true" table="RHQ_TAGGING_RESOURCE_MAP" column="RESOURCE_ID" nullable="false" />
<schema-alterColumn ignoreError="true" table="RHQ_TAGGING_RESOURCE_MAP" column="TAG_ID" nullable="false" />
<schema-alterColumn ignoreError="true" table="RHQ_TAGGING_RES_GROUP_MAP" column="RESOURCE_GROUP_ID" nullable="false" />
- <schema-alterColumn ignoreError="true" table="RHQ_TAGGING_RES_GROUP_MAP" column="TAG_ID" nullable="false" />
+ <schema-alterColumn ignoreError="true" table="RHQ_TAGGING_RES_GROUP_MAP" column="TAG_ID" nullable="false" />
</schemaSpec>
<!-- 2.90 corrects problems in 3.0.0.final upgrade installs. The problems it
fixes are not present in a new db. As such, ignore any errors.
- -->
- <schemaSpec version="2.90">
- <schema-dropSequence ignoreError="true" name="rhq_tag_id_seq" />
+ -->
+ <schemaSpec version="2.90">
+ <schema-dropSequence ignoreError="true" name="rhq_tag_id_seq" />
<schema-dropSequence ignoreError="true" name="rhq_advisory_buglist_seq" />
-
+
<schema-createSequence ignoreError="true" name="RHQ_ADVISORY_BUGLIST_ID_SEQ" initial="10001" />
-
+
<schema-alterColumn ignoreError="true" table="RHQ_ALERT_NOTIF_LOG" column="SENDER" nullable="TRUE" />
-
+
<schema-alterColumn ignoreError="true" table="RHQ_BUNDLE_TYPE" column="RESOURCE_TYPE_ID" nullable="FALSE" />
-
+
<schema-alterColumn ignoreError="true" table="RHQ_ROLE_LDAP_GROUP" column="LDAP_GROUP_NAME" nullable="FALSE" />
<schema-deleteColumn ignoreError="true" table="RHQ_SAVED_SEARCH" column="JPQL_TRANSLATION" />
<schema-alterColumn ignoreError="true" table="RHQ_SAVED_SEARCH" column="NAME" nullable="FALSE" />
-
+
<schema-directSQL ignoreError="true">
<statement desc="Creating RHQ_SAVED_SEARCH foreign key relation to RHQ_SUBJECT">
ALTER TABLE RHQ_SAVED_SEARCH
@@ -3119,7 +3119,7 @@
REFERENCES RHQ_SUBJECT (ID)
</statement>
</schema-directSQL>
-
+
</schemaSpec>
<schemaSpec version="2.91">
@@ -3132,7 +3132,7 @@
</statement>
</schema-directSQL>
</schemaSpec>
-
+
<schemaSpec version="2.92">
<!-- if some role previously had CONFIGURE perm (now called CONFIGURE_WRITE), give it the implied perm
CONFIGURE_READ so users don't experience an unexpected permission restriction after upgrade -->
@@ -3157,14 +3157,14 @@
<statement desc="RESOURCE_GROUP: Make unknown usernames as rhqadmin in tmp modifiedBy column">
UPDATE RHQ_RESOURCE_GROUP SET MODIFIED_BY_VARCHAR = 'rhqadmin' WHERE MODIFIED_BY_VARCHAR IS NULL
</statement>
- </schema-directSQL>
+ </schema-directSQL>
<schema-deleteColumn table="RHQ_RESOURCE_GROUP" column="MODIFIED_BY" />
<schema-directSQL>
<statement desc="RESOURCE_GROUP: Renaming new varchar MODIFIED_BY column">
ALTER TABLE RHQ_RESOURCE_GROUP
RENAME COLUMN MODIFIED_BY_VARCHAR TO MODIFIED_BY
</statement>
- </schema-directSQL>
+ </schema-directSQL>
</schemaSpec>
<schemaSpec version="2.93.2">
@@ -3177,14 +3177,14 @@
<statement desc="RESOURCE: Make unknown usernames as rhqadmin in tmp modifiedBy column">
UPDATE RHQ_RESOURCE SET MODIFIED_BY_VARCHAR = 'rhqadmin' WHERE MODIFIED_BY_VARCHAR IS NULL
</statement>
- </schema-directSQL>
+ </schema-directSQL>
<schema-deleteColumn table="RHQ_RESOURCE" column="MODIFIED_BY" />
<schema-directSQL>
<statement desc="RESOURCE: Renaming new varchar MODIFIED_BY column">
ALTER TABLE RHQ_RESOURCE
RENAME COLUMN MODIFIED_BY_VARCHAR TO MODIFIED_BY
</statement>
- </schema-directSQL>
+ </schema-directSQL>
</schemaSpec>
<schemaSpec version="2.93.3">
commit 7a1accc180497bc215e3e416a0f19c74f6dc1647
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Aug 10 10:18:39 2010 -0400
bz 622491 - make the db upgrade re-typing of the MODIFIED_BY column more efficient
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index 8c404b7..5d47fc1 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -3149,48 +3149,42 @@
<!-- BZ 622491 - 2.93.x - modifiedBy should only be username, not a subject ID and should be size 100 -->
<schemaSpec version="2.93.1">
<!-- first do the RHQ_RESOURCE_GROUP table -->
- <schema-addColumn table="RHQ_RESOURCE_GROUP" column="TMP_MODIFIED_BY" columnType="VARCHAR2" precision="100"/>
+ <schema-addColumn table="RHQ_RESOURCE_GROUP" column="MODIFIED_BY_VARCHAR" columnType="VARCHAR2" precision="100"/>
<schema-directSQL>
<statement desc="RESOURCE_GROUP: Populate the tmp modifiedBy column with existing user names or null if user does not exist">
- UPDATE RHQ_RESOURCE_GROUP AS g SET TMP_MODIFIED_BY = (SELECT NAME FROM RHQ_SUBJECT WHERE ID = g.MODIFIED_BY)
+ UPDATE RHQ_RESOURCE_GROUP AS g SET MODIFIED_BY_VARCHAR = (SELECT NAME FROM RHQ_SUBJECT WHERE ID = g.MODIFIED_BY)
</statement>
<statement desc="RESOURCE_GROUP: Make unknown usernames as rhqadmin in tmp modifiedBy column">
- UPDATE RHQ_RESOURCE_GROUP SET TMP_MODIFIED_BY = 'rhqadmin' WHERE TMP_MODIFIED_BY IS NULL
- </statement>
- <statement desc="RESOURCE_GROUP: Null out IDs from existing modifiedBy column to prepare for conversion to varchar column">
- UPDATE RHQ_RESOURCE_GROUP SET MODIFIED_BY = NULL
+ UPDATE RHQ_RESOURCE_GROUP SET MODIFIED_BY_VARCHAR = 'rhqadmin' WHERE MODIFIED_BY_VARCHAR IS NULL
</statement>
</schema-directSQL>
- <schema-alterColumn table="RHQ_RESOURCE_GROUP" column="MODIFIED_BY" columnType="VARCHAR2" precision="100" />
+ <schema-deleteColumn table="RHQ_RESOURCE_GROUP" column="MODIFIED_BY" />
<schema-directSQL>
- <statement desc="RESOURCE_GROUP: Populate the new-typed modifiedBy column with user names from tmp column">
- UPDATE RHQ_RESOURCE_GROUP SET MODIFIED_BY = TMP_MODIFIED_BY
+ <statement desc="RESOURCE_GROUP: Renaming new varchar MODIFIED_BY column">
+ ALTER TABLE RHQ_RESOURCE_GROUP
+ RENAME COLUMN MODIFIED_BY_VARCHAR TO MODIFIED_BY
</statement>
</schema-directSQL>
- <schema-deleteColumn table="RHQ_RESOURCE_GROUP" column="TMP_MODIFIED_BY" />
</schemaSpec>
<schemaSpec version="2.93.2">
<!-- second do the RHQ_RESOURCE table -->
- <schema-addColumn table="RHQ_RESOURCE" column="TMP_MODIFIED_BY" columnType="VARCHAR2" precision="100"/>
+ <schema-addColumn table="RHQ_RESOURCE" column="MODIFIED_BY_VARCHAR" columnType="VARCHAR2" precision="100"/>
<schema-directSQL>
<statement desc="RESOURCE: Populate the tmp modifiedBy column with existing user names or null if user does not exist">
- UPDATE RHQ_RESOURCE AS r SET TMP_MODIFIED_BY = (SELECT NAME FROM RHQ_SUBJECT WHERE ID = r.MODIFIED_BY)
+ UPDATE RHQ_RESOURCE AS r SET MODIFIED_BY_VARCHAR = (SELECT NAME FROM RHQ_SUBJECT WHERE ID = r.MODIFIED_BY)
</statement>
<statement desc="RESOURCE: Make unknown usernames as rhqadmin in tmp modifiedBy column">
- UPDATE RHQ_RESOURCE SET TMP_MODIFIED_BY = 'rhqadmin' WHERE TMP_MODIFIED_BY IS NULL
- </statement>
- <statement desc="RESOURCE: Null out IDs from existing modifiedBy column to prepare for conversion to varchar column">
- UPDATE RHQ_RESOURCE SET MODIFIED_BY = NULL
+ UPDATE RHQ_RESOURCE SET MODIFIED_BY_VARCHAR = 'rhqadmin' WHERE MODIFIED_BY_VARCHAR IS NULL
</statement>
</schema-directSQL>
- <schema-alterColumn table="RHQ_RESOURCE" column="MODIFIED_BY" columnType="VARCHAR2" precision="100" />
+ <schema-deleteColumn table="RHQ_RESOURCE" column="MODIFIED_BY" />
<schema-directSQL>
- <statement desc="RESOURCE: Populate the new-typed modifiedBy column with user names from tmp column">
- UPDATE RHQ_RESOURCE SET MODIFIED_BY = TMP_MODIFIED_BY
+ <statement desc="RESOURCE: Renaming new varchar MODIFIED_BY column">
+ ALTER TABLE RHQ_RESOURCE
+ RENAME COLUMN MODIFIED_BY_VARCHAR TO MODIFIED_BY
</statement>
</schema-directSQL>
- <schema-deleteColumn table="RHQ_RESOURCE" column="TMP_MODIFIED_BY" />
</schemaSpec>
<schemaSpec version="2.93.3">
13 years, 10 months
[rhq] Branch 'code-smell' - 2 commits - modules/plugins
by lkrejci
modules/plugins/samba/src/main/java/org/rhq/plugins/samba/SambaServerDiscoveryComponent.java | 49 +++++-----
1 file changed, 27 insertions(+), 22 deletions(-)
New commits:
commit ac90dbd66d849db6dc7d4d82e595cf44cf58b5c0
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Tue Aug 10 18:02:45 2010 +0200
Trivial - code formatting.
diff --git a/modules/plugins/samba/src/main/java/org/rhq/plugins/samba/SambaServerDiscoveryComponent.java b/modules/plugins/samba/src/main/java/org/rhq/plugins/samba/SambaServerDiscoveryComponent.java
index 1821eed..b805ea9 100644
--- a/modules/plugins/samba/src/main/java/org/rhq/plugins/samba/SambaServerDiscoveryComponent.java
+++ b/modules/plugins/samba/src/main/java/org/rhq/plugins/samba/SambaServerDiscoveryComponent.java
@@ -37,27 +37,29 @@ import org.rhq.plugins.augeas.AugeasConfigurationDiscoveryComponent;
public class SambaServerDiscoveryComponent extends AugeasConfigurationDiscoveryComponent {
- private static final Pattern netBiosNamePattern = Pattern.compile("[\\s]*netbios[\\s]*name[\\s]*=[\\s]*(.*)[\\s]*");
-
- public Set discoverResources(ResourceDiscoveryContext resourceDiscoveryContext) throws InvalidPluginConfigurationException, Exception {
+ private static final Pattern NET_BIOS_NAME_PATTERN = Pattern
+ .compile("[\\s]*netbios[\\s]*name[\\s]*=[\\s]*(.*)[\\s]*");
+
+ public Set discoverResources(ResourceDiscoveryContext resourceDiscoveryContext)
+ throws InvalidPluginConfigurationException, Exception {
Set<DiscoveredResourceDetails> resources = super.discoverResources(resourceDiscoveryContext);
- for (DiscoveredResourceDetails detail : resources){
+ for (DiscoveredResourceDetails detail : resources) {
Configuration config = detail.getPluginConfiguration();
PropertySimple property = (PropertySimple) config.get(AugeasConfigurationComponent.INCLUDE_GLOBS_PROP);
String configFilePath = property.getStringValue();
String resourceName;
-
+
try {
- resourceName = findNetBiosName(configFilePath);
- }catch(Exception e){
- resourceName = resourceDiscoveryContext.getSystemInformation().getHostname();
+ resourceName = findNetBiosName(configFilePath);
+ } catch (Exception e) {
+ resourceName = resourceDiscoveryContext.getSystemInformation().getHostname();
}
detail.setResourceName(resourceName);
}
return resources;
}
-
- private String findNetBiosName(String includeFile) throws Exception{
+
+ private String findNetBiosName(String includeFile) throws Exception {
try {
File file = new File(includeFile);
if (file.exists()) {
@@ -66,21 +68,20 @@ public class SambaServerDiscoveryComponent extends AugeasConfigurationDiscoveryC
try {
String strLine;
while ((strLine = br.readLine()) != null) {
- Matcher m = netBiosNamePattern.matcher(strLine);
+ Matcher m = NET_BIOS_NAME_PATTERN.matcher(strLine);
if (m.matches()) {
String glob = m.group(1);
-
- return glob;
- }
+
+ return glob;
+ }
}
} finally {
StreamUtil.safeClose(br);
}
}
- }
- catch (Exception e) {
- throw new Exception("NetBios name was not found in configuration file "+ includeFile + " cause:",e);
+ } catch (Exception e) {
+ throw new Exception("NetBios name was not found in configuration file " + includeFile + " cause:", e);
}
- throw new Exception("NetBios name was not found in configuration file "+ includeFile);
+ throw new Exception("NetBios name was not found in configuration file " + includeFile);
}
}
commit 892927807a251621668c91bbf18e07e05c8037bd
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Tue Aug 10 18:00:39 2010 +0200
Close the stream.
diff --git a/modules/plugins/samba/src/main/java/org/rhq/plugins/samba/SambaServerDiscoveryComponent.java b/modules/plugins/samba/src/main/java/org/rhq/plugins/samba/SambaServerDiscoveryComponent.java
index b53c006..1821eed 100644
--- a/modules/plugins/samba/src/main/java/org/rhq/plugins/samba/SambaServerDiscoveryComponent.java
+++ b/modules/plugins/samba/src/main/java/org/rhq/plugins/samba/SambaServerDiscoveryComponent.java
@@ -31,6 +31,7 @@ import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
+import org.rhq.core.util.stream.StreamUtil;
import org.rhq.plugins.augeas.AugeasConfigurationComponent;
import org.rhq.plugins.augeas.AugeasConfigurationDiscoveryComponent;
@@ -62,16 +63,19 @@ public class SambaServerDiscoveryComponent extends AugeasConfigurationDiscoveryC
if (file.exists()) {
FileInputStream fstream = new FileInputStream(file);
BufferedReader br = new BufferedReader(new InputStreamReader(fstream));
- String strLine;
- while ((strLine = br.readLine()) != null) {
- Matcher m = netBiosNamePattern.matcher(strLine);
- if (m.matches()) {
- String glob = m.group(1);
-
- return glob;
- }
+ try {
+ String strLine;
+ while ((strLine = br.readLine()) != null) {
+ Matcher m = netBiosNamePattern.matcher(strLine);
+ if (m.matches()) {
+ String glob = m.group(1);
+
+ return glob;
+ }
+ }
+ } finally {
+ StreamUtil.safeClose(br);
}
- br.close();
}
}
catch (Exception e) {
13 years, 10 months
[rhq] Branch 'code-smell' - 2 commits - modules/plugins
by lkrejci
modules/plugins/postgres/src/main/java/org/rhq/plugins/postgres/PostgresDiscoveryComponent.java | 7 ++++++-
modules/plugins/postgres/src/main/java/org/rhq/plugins/postgres/PostgresUserComponent.java | 3 ++-
2 files changed, 8 insertions(+), 2 deletions(-)
New commits:
commit e6e41cf77ad3cd48cb50abb74b56952c289fa49c
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Tue Aug 10 17:57:09 2010 +0200
Unnecessarily getting a value twice.
diff --git a/modules/plugins/postgres/src/main/java/org/rhq/plugins/postgres/PostgresUserComponent.java b/modules/plugins/postgres/src/main/java/org/rhq/plugins/postgres/PostgresUserComponent.java
index af3280a..6312c4d 100644
--- a/modules/plugins/postgres/src/main/java/org/rhq/plugins/postgres/PostgresUserComponent.java
+++ b/modules/plugins/postgres/src/main/java/org/rhq/plugins/postgres/PostgresUserComponent.java
@@ -151,7 +151,8 @@ public class PostgresUserComponent implements DatabaseComponent<PostgresServerCo
+ " ";
if (type != UpdateType.DROP) {
- if (config.getSimpleValue("password",null) != null && config.getSimpleValue("password",null).length() != 0) {
+ String password = config.getSimpleValue("password",null);
+ if (password != null && password.length() != 0) {
sql += " WITH PASSWORD '" + config.getSimpleValue("password",null) + "' ";
}
commit 75e16e1459f6e2d7f1725189be63f2439a91ec3a
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Tue Aug 10 17:56:14 2010 +0200
Make sure to close the JDBC connection.
diff --git a/modules/plugins/postgres/src/main/java/org/rhq/plugins/postgres/PostgresDiscoveryComponent.java b/modules/plugins/postgres/src/main/java/org/rhq/plugins/postgres/PostgresDiscoveryComponent.java
index b02d764..b03327d 100644
--- a/modules/plugins/postgres/src/main/java/org/rhq/plugins/postgres/PostgresDiscoveryComponent.java
+++ b/modules/plugins/postgres/src/main/java/org/rhq/plugins/postgres/PostgresDiscoveryComponent.java
@@ -298,7 +298,12 @@ public class PostgresDiscoveryComponent implements ResourceDiscoveryComponent, M
}
public static List<String> getDatabases(Configuration pluginConfiguration) {
- return getDatabaseNames(pluginConfiguration, getConnection(pluginConfiguration));
+ Connection conn = getConnection(pluginConfiguration);
+ try {
+ return getDatabaseNames(pluginConfiguration, conn);
+ } finally {
+ JDBCUtil.safeClose(conn);
+ }
}
private static List<String> getDatabaseNames(Configuration config, Connection conn) {
13 years, 10 months
[rhq] Branch 'code-smell' - 2 commits - modules/plugins
by lkrejci
modules/plugins/postfix/src/main/java/org/rhq/plugins/postfix/PostfixServerDiscoveryComponent.java | 48 +++++-----
1 file changed, 26 insertions(+), 22 deletions(-)
New commits:
commit dfa063dcb426f7ba05cfd3923c603b9d33e4dbf4
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Tue Aug 10 17:46:45 2010 +0200
Trivial - code formatting.
diff --git a/modules/plugins/postfix/src/main/java/org/rhq/plugins/postfix/PostfixServerDiscoveryComponent.java b/modules/plugins/postfix/src/main/java/org/rhq/plugins/postfix/PostfixServerDiscoveryComponent.java
index 49172bd..91490c0 100644
--- a/modules/plugins/postfix/src/main/java/org/rhq/plugins/postfix/PostfixServerDiscoveryComponent.java
+++ b/modules/plugins/postfix/src/main/java/org/rhq/plugins/postfix/PostfixServerDiscoveryComponent.java
@@ -37,27 +37,28 @@ import java.util.regex.Pattern;
public class PostfixServerDiscoveryComponent extends AugeasConfigurationDiscoveryComponent {
- private static final Pattern hostNamePattern = Pattern.compile("[\\s]*myhostname[\\s]*=[\\s]*([^$].*)[\\s]*");
-
- public Set discoverResources(ResourceDiscoveryContext resourceDiscoveryContext) throws InvalidPluginConfigurationException, Exception {
+ private static final Pattern HOSTNAME_PATTERN = Pattern.compile("[\\s]*myhostname[\\s]*=[\\s]*([^$].*)[\\s]*");
+
+ public Set discoverResources(ResourceDiscoveryContext resourceDiscoveryContext)
+ throws InvalidPluginConfigurationException, Exception {
Set<DiscoveredResourceDetails> resources = super.discoverResources(resourceDiscoveryContext);
- for (DiscoveredResourceDetails detail : resources){
+ for (DiscoveredResourceDetails detail : resources) {
Configuration config = detail.getPluginConfiguration();
PropertySimple property = (PropertySimple) config.get(AugeasConfigurationComponent.INCLUDE_GLOBS_PROP);
String configFilePath = property.getStringValue();
String resourceName;
-
+
try {
- resourceName = findHostName(configFilePath);
- }catch(Exception e){
- resourceName = resourceDiscoveryContext.getSystemInformation().getHostname();
+ resourceName = findHostName(configFilePath);
+ } catch (Exception e) {
+ resourceName = resourceDiscoveryContext.getSystemInformation().getHostname();
}
detail.setResourceName(resourceName);
}
return resources;
}
-
- private String findHostName(String includeFile) throws Exception{
+
+ private String findHostName(String includeFile) throws Exception {
try {
File file = new File(includeFile);
if (file.exists()) {
@@ -66,21 +67,20 @@ public class PostfixServerDiscoveryComponent extends AugeasConfigurationDiscover
try {
String strLine;
while ((strLine = br.readLine()) != null) {
- Matcher m = hostNamePattern.matcher(strLine);
+ Matcher m = HOSTNAME_PATTERN.matcher(strLine);
if (m.matches()) {
String glob = m.group(1);
-
- return glob;
- }
+
+ return glob;
+ }
}
} finally {
StreamUtil.safeClose(br);
}
}
- }
- catch (Exception e) {
- throw new Exception("NetBios name was not found in configuration file "+ includeFile + " cause:",e);
+ } catch (Exception e) {
+ throw new Exception("NetBios name was not found in configuration file " + includeFile + " cause:", e);
}
- throw new Exception("NetBios name was not found in configuration file "+ includeFile);
+ throw new Exception("NetBios name was not found in configuration file " + includeFile);
}
}
commit e13bce0c0d7a0d84a6afbfc5c7c04586f306329a
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Tue Aug 10 17:37:40 2010 +0200
Close the stream.
diff --git a/modules/plugins/postfix/src/main/java/org/rhq/plugins/postfix/PostfixServerDiscoveryComponent.java b/modules/plugins/postfix/src/main/java/org/rhq/plugins/postfix/PostfixServerDiscoveryComponent.java
index 8f26ee0..49172bd 100644
--- a/modules/plugins/postfix/src/main/java/org/rhq/plugins/postfix/PostfixServerDiscoveryComponent.java
+++ b/modules/plugins/postfix/src/main/java/org/rhq/plugins/postfix/PostfixServerDiscoveryComponent.java
@@ -23,6 +23,7 @@ import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
+import org.rhq.core.util.stream.StreamUtil;
import org.rhq.plugins.augeas.AugeasConfigurationComponent;
import org.rhq.plugins.augeas.AugeasConfigurationDiscoveryComponent;
@@ -62,16 +63,19 @@ public class PostfixServerDiscoveryComponent extends AugeasConfigurationDiscover
if (file.exists()) {
FileInputStream fstream = new FileInputStream(file);
BufferedReader br = new BufferedReader(new InputStreamReader(fstream));
- String strLine;
- while ((strLine = br.readLine()) != null) {
- Matcher m = hostNamePattern.matcher(strLine);
- if (m.matches()) {
- String glob = m.group(1);
-
- return glob;
- }
+ try {
+ String strLine;
+ while ((strLine = br.readLine()) != null) {
+ Matcher m = hostNamePattern.matcher(strLine);
+ if (m.matches()) {
+ String glob = m.group(1);
+
+ return glob;
+ }
+ }
+ } finally {
+ StreamUtil.safeClose(br);
}
- br.close();
}
}
catch (Exception e) {
13 years, 10 months