[rhq] 2 commits - modules/enterprise
by ips
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java | 22 ++++++--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java | 5 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/TitleBar.java | 8 +--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/InventoryView.java | 20 ++++++--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java | 24 +++++++--
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 2
modules/enterprise/server/ear/pom.xml | 25 ++--------
7 files changed, 65 insertions(+), 41 deletions(-)
New commits:
commit 8a2e19e9442d84ae9b9fd8d316401c3dfe57971a
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Wed Nov 24 13:03:24 2010 -0500
remove webdav war from ear (https://bugzilla.redhat.com/show_bug.cgi?id=535493)
diff --git a/modules/enterprise/server/ear/pom.xml b/modules/enterprise/server/ear/pom.xml
index 0917089..7c919a0 100644
--- a/modules/enterprise/server/ear/pom.xml
+++ b/modules/enterprise/server/ear/pom.xml
@@ -160,28 +160,17 @@
<!-- ** WARs -->
<webModule>
- <groupId>${project.groupId}</groupId>
- <artifactId>rhq-portal</artifactId>
- <bundleFileName>rhq-portal.war</bundleFileName>
- <contextRoot>/</contextRoot>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-coregui</artifactId>
+ <bundleFileName>coregui.war</bundleFileName>
+ <contextRoot>/coregui</contextRoot>
</webModule>
-
- <webModule>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-coregui</artifactId>
- <bundleFileName>coregui.war</bundleFileName>
- <contextRoot>/coregui</contextRoot>
- </webModule>
-
-
- <!-- included unless exclude.webdav property is set to true. -->
<webModule>
<groupId>${project.groupId}</groupId>
- <artifactId>rhq-webdav</artifactId>
- <excluded>${exclude-webdav}</excluded>
- <bundleFileName>rhq-webdav.war</bundleFileName>
- <contextRoot>/webdav</contextRoot>
+ <artifactId>rhq-portal</artifactId>
+ <bundleFileName>rhq-portal.war</bundleFileName>
+ <contextRoot>/</contextRoot>
</webModule>
<!-- used to expose content through http -->
commit f8b9c615da5bff9b1397da83b2db05c7d5011b45
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Wed Nov 24 13:03:18 2010 -0500
make descriptions on default views for top views span the full width of the content pane
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
index 1b28a58..082d77f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
@@ -22,13 +22,15 @@ import java.util.ArrayList;
import java.util.List;
import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.HTMLFlow;
+import com.smartgwt.client.widgets.Label;
+import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.enterprise.gui.coregui.client.admin.agent.install.RemoteAgentInstallView;
import org.rhq.enterprise.gui.coregui.client.admin.roles.RolesView;
import org.rhq.enterprise.gui.coregui.client.admin.templates.ResourceTypeTreeView;
import org.rhq.enterprise.gui.coregui.client.admin.users.UsersView;
import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
+import org.rhq.enterprise.gui.coregui.client.components.TitleBar;
import org.rhq.enterprise.gui.coregui.client.components.view.AbstractSectionedLeftNavigationView;
import org.rhq.enterprise.gui.coregui.client.components.view.NavigationItem;
import org.rhq.enterprise.gui.coregui.client.components.view.NavigationSection;
@@ -86,11 +88,19 @@ public class AdministrationView extends AbstractSectionedLeftNavigationView {
return sections;
}
- protected HTMLFlow defaultView() {
- String contents = "<h1>" + MSG.view_admin_administration() + "</h1>\n" + MSG.view_admin_landing();
- HTMLFlow flow = new HTMLFlow(contents);
- flow.setPadding(20);
- return flow;
+ protected VLayout defaultView() {
+ VLayout vLayout = new VLayout();
+ vLayout.setWidth100();
+
+ // TODO: Admin icon.
+ TitleBar titleBar = new TitleBar(this, MSG.view_admin_administration());
+ vLayout.addMember(titleBar);
+
+ Label label = new Label(MSG.view_admin_landing());
+ label.setPadding(10);
+ vLayout.addMember(label);
+
+ return vLayout;
}
private NavigationSection buildSecuritySection() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
index 8b5cd62..0dc46b5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
@@ -18,6 +18,7 @@
*/
package org.rhq.enterprise.gui.coregui.client.bundle;
+import com.allen_sauer.gwt.log.client.Log;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.types.VisibilityMode;
import com.smartgwt.client.widgets.Canvas;
@@ -40,6 +41,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableSectionStack
* @author Greg Hinkle
*/
public class BundleTopView extends LocatableHLayout implements BookmarkableView {
+
public static final ViewName VIEW_ID = new ViewName("Bundles", MSG.view_bundle_bundles());
private BundleTreeView bundleTreeView;
@@ -107,7 +109,7 @@ public class BundleTopView extends LocatableHLayout implements BookmarkableView
if (viewPath.isEnd()) {
if (currentNextPath == null && bundlesListView != null) {
// refresh
- com.allen_sauer.gwt.log.client.Log.info("Refreshing BundleTopView");
+ Log.info("Refreshing BundleTopView");
bundlesListView.refresh();
} else {
@@ -127,4 +129,5 @@ public class BundleTopView extends LocatableHLayout implements BookmarkableView
}
}
}
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/TitleBar.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/TitleBar.java
index 36cc9ee..fe6c3b6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/TitleBar.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/TitleBar.java
@@ -48,11 +48,11 @@ public class TitleBar extends LocatableToolStrip {
super(parent.extendLocatorId("TitleBar"));
setWidth100();
- setHeight(35);
+ setHeight(37);
LocatableVLayout vLayout = new LocatableVLayout(extendLocatorId("VLayout"));
vLayout.setAlign(VerticalAlignment.CENTER);
- vLayout.setLayoutMargin(5);
+ vLayout.setLayoutMargin(6);
LocatableHLayout hLayout = new LocatableHLayout(vLayout.extendLocatorId("HLayout"));
vLayout.addMember(hLayout);
@@ -62,7 +62,7 @@ public class TitleBar extends LocatableToolStrip {
this.label.setIcon(icon);
this.label.setIconWidth(24);
this.label.setIconHeight(24);
- this.label.setAutoHeight();
+ this.label.setAutoHeight();
hLayout.addMember(this.label);
setVisible(false);
@@ -98,7 +98,7 @@ public class TitleBar extends LocatableToolStrip {
contents = "<span class='HeaderLabel'>" + title + "</span>";
windowTitle = "RHQ: " + title;
}
- this.label.setContents(contents);
+ this.label.setContents(contents);
Window.setTitle(windowTitle);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/InventoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/InventoryView.java
index fb4b084..a77c032 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/InventoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/InventoryView.java
@@ -26,13 +26,15 @@ import java.util.Set;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.HTMLFlow;
+import com.smartgwt.client.widgets.Label;
+import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.group.GroupCategory;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.components.TitleBar;
import org.rhq.enterprise.gui.coregui.client.components.view.AbstractSectionedLeftNavigationView;
import org.rhq.enterprise.gui.coregui.client.components.view.NavigationItem;
import org.rhq.enterprise.gui.coregui.client.components.view.NavigationSection;
@@ -106,10 +108,18 @@ public class InventoryView extends AbstractSectionedLeftNavigationView {
}
protected Canvas defaultView() {
- String contents = "<h1>" + MSG.common_title_inventory() + "</h1>\n" + MSG.view_inventory_sectionHelp();
- HTMLFlow flow = new HTMLFlow(contents);
- flow.setPadding(20);
- return flow;
+ VLayout vLayout = new VLayout();
+ vLayout.setWidth100();
+
+ // TODO: Admin icon.
+ TitleBar titleBar = new TitleBar(this, MSG.common_title_inventory());
+ vLayout.addMember(titleBar);
+
+ Label label = new Label(MSG.view_inventory_sectionHelp());
+ label.setPadding(10);
+ vLayout.addMember(label);
+
+ return vLayout;
}
@Override
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java
index 275e251..1783a71 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java
@@ -26,12 +26,14 @@ import java.util.ArrayList;
import java.util.List;
import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.HTMLFlow;
+import com.smartgwt.client.widgets.Label;
+import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.enterprise.gui.coregui.client.admin.AdministrationView;
import org.rhq.enterprise.gui.coregui.client.admin.templates.ResourceTypeTreeView;
import org.rhq.enterprise.gui.coregui.client.alert.AlertHistoryView;
import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
+import org.rhq.enterprise.gui.coregui.client.components.TitleBar;
import org.rhq.enterprise.gui.coregui.client.components.view.AbstractSectionedLeftNavigationView;
import org.rhq.enterprise.gui.coregui.client.components.view.NavigationItem;
import org.rhq.enterprise.gui.coregui.client.components.view.NavigationSection;
@@ -50,6 +52,7 @@ import org.rhq.enterprise.gui.coregui.client.report.tag.TaggedView;
* @author Ian Springer
*/
public class ReportTopView extends AbstractSectionedLeftNavigationView {
+
public static final ViewName VIEW_ID = new ViewName("Reports", MSG.view_reportsTop_title());
public static final ViewName SECTION_SUBSYSTEMS_VIEW_ID = new ViewName("Subsystems", MSG.view_reports_subsystems());
@@ -74,11 +77,19 @@ public class ReportTopView extends AbstractSectionedLeftNavigationView {
}
@Override
- protected HTMLFlow defaultView() {
- String contents = "<h1>" + MSG.view_reportsTop_title() + "</h1>\n" + MSG.view_reportsTop_description();
- HTMLFlow flow = new HTMLFlow(contents);
- flow.setPadding(20);
- return flow;
+ protected VLayout defaultView() {
+ VLayout vLayout = new VLayout();
+ vLayout.setWidth100();
+
+ // TODO: Admin icon.
+ TitleBar titleBar = new TitleBar(this, MSG.view_reportsTop_title());
+ vLayout.addMember(titleBar);
+
+ Label label = new Label(MSG.view_reportsTop_description());
+ label.setPadding(10);
+ vLayout.addMember(label);
+
+ return vLayout;
}
private NavigationSection buildSubsystemsSection() {
@@ -145,4 +156,5 @@ public class ReportTopView extends AbstractSectionedLeftNavigationView {
return new NavigationSection(SECTION_INVENTORY_VIEW_ID, inventorySummaryItem, platformSystemInfoItem);
}
+
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index a99b4ed..913ea3b 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -419,7 +419,7 @@ dataSource_resourceErrors_error_fetchFailure = Failed to find Resource errors fo
#================= Administration ==================
view_admin_administration = Administration~
-view_admin_landing = From this section, the RHQ global settings can be administered. This includes configuring Security, setting up Plugins, and managing RHQ servers and agents.~
+view_admin_landing = From this section, the RHQ global settings can be administered. This includes configuring security, setting up plugins, and managing RHQ Servers and Agents.~
view_admin_configuration = Configuration~
view_admin_security = Security~
view_admin_topology = Topology~
13 years, 5 months
[rhq] 2 commits - modules/enterprise
by Jay Shaughnessy
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java | 22 +++++-----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java | 13 +++--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java | 8 +--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java | 2
4 files changed, 26 insertions(+), 19 deletions(-)
New commits:
commit f791f5fcdf7dfe02d7c127124345023c26cd7cb4
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Nov 24 12:58:35 2010 -0500
Changes to Footer
- Hopefully improve layout by moving Message Center to the right. The bottom
right is more traditionally a location for message handling. Note that the
Message Center is not just a button but actually a layout that uses the
entire footer left of the button as well. That is the dynamic notification
area. This makes it pretty difficult to locate other footer items to the
left of the message center, therefore other items are placed to the right.
- Fixed nav issue when clicking on the Alert Count.
- Changed margins to allow for some space between the rightmost button and
the edge of the footer.
- Left somee commented code re: handling of the logged in user until issues
with username liveness (now in the topmenubar) is resolved.
group change layout to hopefully allow easier move Message Center
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java
index b40d3f7..96b2e17 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java
@@ -30,8 +30,10 @@ import com.smartgwt.client.widgets.toolbar.ToolStripSeparator;
import org.rhq.core.domain.alert.Alert;
import org.rhq.core.domain.criteria.AlertCriteria;
import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.alert.AlertHistoryView;
import org.rhq.enterprise.gui.coregui.client.footer.FavoritesButton;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.report.ReportTopView;
import org.rhq.enterprise.gui.coregui.client.util.message.MessageCenterView;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableLabel;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableToolStrip;
@@ -47,9 +49,9 @@ public class Footer extends LocatableToolStrip {
super(LOCATOR_ID);
setHeight(30);
setAlign(VerticalAlignment.CENTER);
- // setPadding(5);
setWidth100();
- setMembersMargin(15);
+ setMembersMargin(10);
+ setLayoutRightMargin(5);
}
@Override
@@ -57,19 +59,20 @@ public class Footer extends LocatableToolStrip {
super.onDraw();
//final UserSessionState userSessionState = new UserSessionState("UserSessionState");
- final MessageCenterView recentMessage = new MessageCenterView(extendLocatorId(MessageCenterView.LOCATOR_ID));
- recentMessage.setWidth("*");
+ final MessageCenterView messageCenter = new MessageCenterView(extendLocatorId(MessageCenterView.LOCATOR_ID));
final FavoritesButton favoritesButton = new FavoritesButton(extendLocatorId("Favorites"));
final AlertsMessage alertsMessage = new AlertsMessage(extendLocatorId("Alerts"));
- //addMember(userSessionState);
- //addMember(new ToolStripSeparator());
- addMember(favoritesButton);
+ addMember(messageCenter);
+
addMember(new ToolStripSeparator());
- addMember(recentMessage);
addMember(alertsMessage);
+ addMember(new ToolStripSeparator());
+
+ addMember(favoritesButton);
+
//userSessionState.schedule(15000);
alertsMessage.schedule(60000);
}
@@ -140,7 +143,8 @@ public class Footer extends LocatableToolStrip {
addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
- History.newItem("Reports/Inventory/Recent Alerts");
+ History.newItem(ReportTopView.VIEW_ID.getName() + "/" + ReportTopView.SECTION_SUBSYSTEMS_VIEW_ID
+ + "/" + AlertHistoryView.SUBSYSTEM_VIEW_ID);
}
});
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java
index fa63445..275e251 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java
@@ -52,8 +52,8 @@ import org.rhq.enterprise.gui.coregui.client.report.tag.TaggedView;
public class ReportTopView extends AbstractSectionedLeftNavigationView {
public static final ViewName VIEW_ID = new ViewName("Reports", MSG.view_reportsTop_title());
- private static final ViewName SUBSYSTEMS_SECTION_VIEW_ID = new ViewName("Subsystems", MSG.view_reports_subsystems());
- private static final ViewName INVENTORY_SECTION_VIEW_ID = new ViewName("Inventory", MSG.common_title_inventory());
+ public static final ViewName SECTION_SUBSYSTEMS_VIEW_ID = new ViewName("Subsystems", MSG.view_reports_subsystems());
+ public static final ViewName SECTION_INVENTORY_VIEW_ID = new ViewName("Inventory", MSG.common_title_inventory());
public ReportTopView() {
// This is a top level view, so our locator id can simply be our view id.
@@ -123,7 +123,7 @@ public class ReportTopView extends AbstractSectionedLeftNavigationView {
}
});
- return new NavigationSection(SUBSYSTEMS_SECTION_VIEW_ID, tagItem, suspectMetricsItem,
+ return new NavigationSection(SECTION_SUBSYSTEMS_VIEW_ID, tagItem, suspectMetricsItem,
recentConfigurationChangesItem, recentOperationsItem, recentAlertsItem, alertDefinitionsItem);
}
@@ -143,6 +143,6 @@ public class ReportTopView extends AbstractSectionedLeftNavigationView {
}
});
- return new NavigationSection(INVENTORY_SECTION_VIEW_ID, inventorySummaryItem, platformSystemInfoItem);
+ return new NavigationSection(SECTION_INVENTORY_VIEW_ID, inventorySummaryItem, platformSystemInfoItem);
}
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java
index 0b9cf7d..f9e7ec4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java
@@ -109,8 +109,8 @@ public class MessageCenterView extends LocatableHLayout implements MessageCenter
vl.setAlign(VerticalAlignment.CENTER);
vl.addMember(recentEventsButton);
- addMember(vl);
addMember(new LayoutSpacer());
+ addMember(vl);
}
private void showDetails(Message message) {
commit bb5532f9480c9ddc47f5e5443441e7d148707b11
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Nov 24 12:51:20 2010 -0500
Fix problem with Dashboard name editing where every character change forced
a save opertation. Use onBlurHandler as opposed to ChangeHandler.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
index 3d10400..1023efb 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
@@ -31,6 +31,8 @@ import com.smartgwt.client.widgets.form.fields.CanvasItem;
import com.smartgwt.client.widgets.form.fields.ColorPickerItem;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.form.fields.TextItem;
+import com.smartgwt.client.widgets.form.fields.events.BlurEvent;
+import com.smartgwt.client.widgets.form.fields.events.BlurHandler;
import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
import com.smartgwt.client.widgets.layout.LayoutSpacer;
@@ -119,11 +121,12 @@ public class DashboardView extends LocatableVLayout {
TextItem nameItem = new TextItem("name", MSG.common_title_dashboard_name());
nameItem.setValue(storedDashboard.getName());
- nameItem.addChangedHandler(new ChangedHandler() {
- public void onChanged(ChangedEvent changedEvent) {
- String val = (String) changedEvent.getValue();
- if (!(null == val || "".equals(val.trim()))) {
- storedDashboard.setName(val.trim());
+ nameItem.addBlurHandler(new BlurHandler() {
+ public void onBlur(BlurEvent blurEvent) {
+ String val = (String) blurEvent.getItem().getValue();
+ val = (null == val) ? "" : val.trim();
+ if (!("".equals(val) || val.equals(storedDashboard.getName()))) {
+ storedDashboard.setName(val);
save();
dashboardsView.updateNames();
}
13 years, 5 months
[rhq] modules/enterprise
by Joseph Marques
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java | 1 +
1 file changed, 1 insertion(+)
New commits:
commit c013a8f4fc20e50f0613c42599137e34cbb49bb1
Author: Joseph Marques <joseph(a)redhat.com>
Date: Wed Nov 24 12:58:17 2010 -0500
add missing import statement
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 4f6257e..b41be2b 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
@@ -38,6 +38,7 @@ 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.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.UserPermissionsManager;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.alert.GroupAlertHistoryView;
import org.rhq.enterprise.gui.coregui.client.alert.definitions.GroupAlertDefinitionsView;
13 years, 5 months
[rhq] modules/enterprise
by Joseph Marques
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java | 1 +
1 file changed, 1 insertion(+)
New commits:
commit d2d558f6198fbf16627eb60cca093834774d96ce
Author: Joseph Marques <joseph(a)redhat.com>
Date: Wed Nov 24 12:53:47 2010 -0500
add missing import statement
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 03420f2..514aaf7 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
@@ -38,6 +38,7 @@ import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.resource.composite.ResourcePermission;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.UserPermissionsManager;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.alert.ResourceAlertHistoryView;
import org.rhq.enterprise.gui.coregui.client.alert.definitions.ResourceAlertDefinitionsView;
13 years, 5 months
[rhq] 3 commits - modules/core modules/enterprise
by Joseph Marques
modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourcePermission.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/core/domain/measurement/MeasurementConverterClient.java | 360 ---------
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserPermissionsManager.java | 132 ---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/agent/install/RemoteAgentInstallView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertFormatUtility.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/file/FileListView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformPortletView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java | 11
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java | 11
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/AvailabilityBarView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/LiveGraphView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/measurement/MeasurementOOBDataSource.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/MeasurementConverterClient.java | 363 ++++++++++
15 files changed, 376 insertions(+), 523 deletions(-)
New commits:
commit 64aa25bcc4cb12dfe7011882365a8f0672b328d4
Author: Joseph Marques <joseph(a)redhat.com>
Date: Wed Nov 24 12:31:49 2010 -0500
fix bug introduced during ResourcePermission refactoring
* isInventory() was incorrectly checking for MANAGE_INVENTORY, which is a
global permission. however, this object only represents the collection of
resource-level permission, thus this was always returning false. the
authorization to change connection properties needs to be guarded by
MODIFY_RESOURCE
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourcePermission.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourcePermission.java
index e8ea649..4141593 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourcePermission.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourcePermission.java
@@ -67,7 +67,7 @@ public class ResourcePermission implements Serializable {
this.permissions.add(Permission.MANAGE_MEASUREMENTS);
}
if (inventory) {
- this.permissions.add(Permission.MANAGE_INVENTORY);
+ this.permissions.add(Permission.MODIFY_RESOURCE);
}
if (control) {
this.permissions.add(Permission.CONTROL);
@@ -108,7 +108,7 @@ public class ResourcePermission implements Serializable {
}
public boolean isInventory() {
- return this.permissions.contains(Permission.MANAGE_INVENTORY);
+ return this.permissions.contains(Permission.MODIFY_RESOURCE);
}
public boolean isControl() {
commit 44de15aed85d8215111c2bf1d26584dbbe212776
Author: Joseph Marques <joseph(a)redhat.com>
Date: Wed Nov 24 12:29:31 2010 -0500
don't cache resource/group permissions (they're already in the composite)
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserPermissionsManager.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserPermissionsManager.java
index c26a2f4..9554c5f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserPermissionsManager.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserPermissionsManager.java
@@ -28,9 +28,6 @@ import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.rpc.AsyncCallback;
import org.rhq.core.domain.authz.Permission;
-import org.rhq.core.domain.resource.composite.ResourceComposite;
-import org.rhq.core.domain.resource.composite.ResourcePermission;
-import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
import org.rhq.enterprise.gui.coregui.client.gwt.AuthorizationGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
@@ -52,23 +49,11 @@ public class UserPermissionsManager {
private static final MessageCenter MESSAGE_CENTER = CoreGUI.getMessageCenter();
private static final int REFRESH_INTERVAL = 60 * 1000; // 1 minute
- private Context currentContext;
- private int currentId;
-
/** This is a reference to the last set of global perms returned to a caller. */
private Set<Permission> globalPermissions = new HashSet<Permission>(Permission.GLOBAL_ALL.size());
private boolean globalCacheDirty = true;
private PermissionsLoadedListener globalPermissionsLoadedListener;
- /** This is a reference to the last set of Resource perms returned to a caller. */
- private Set<Permission> resourcePermissions;
- private boolean resourceCacheDirty = true;
- private PermissionsLoadedListener resourcePermissionsLoadedListener;
-
- private enum Context {
- RESOURCE, GROUP;
- };
-
public static UserPermissionsManager getInstance() {
return INSTANCE;
}
@@ -88,63 +73,6 @@ public class UserPermissionsManager {
return this.globalPermissions;
}
- public void loadResourcePermissions(ResourceComposite currentResource,
- PermissionsLoadedListener permissionsLoadedListener) {
- if ((this.currentContext != Context.RESOURCE) || (this.currentId != currentResource.getResource().getId())) {
- this.resourceCacheDirty = true;
- }
- this.currentContext = Context.RESOURCE;
- this.currentId = currentResource.getResource().getId();
- if (currentResource.getResourcePermission() == null) {
- ResourcePermission resourcePermission = new ResourcePermission(new HashSet<Permission>(
- Permission.RESOURCE_ALL.size()));
- currentResource.setResourcePermission(resourcePermission);
- }
- this.resourcePermissions = currentResource.getResourcePermission().getPermissions();
-
- // TODO: This code is not working correctly, it's returning no perms. Also, why are we going to the
- // server when we basically just fetched a resource composite. Its perms should be valid.
- // Anyway, for now, bypass this...
- //if (this.resourceCacheDirty) {
- // Permissions are not cached. Kick off an async load and let it notify the caller when the load completes.
- // this.resourcePermissionsLoadedListener = permissionsLoadedListener;
- // loadCurrentResourcePermissions();
- //} else {
- // Permissions are cached - shoot em back to the caller.
- permissionsLoadedListener.onPermissionsLoaded(this.resourcePermissions);
- // }
- }
-
- /**
- * TODO
- *
- * @param currentGroup
- * @param permissionsLoadedListener
- */
- public void loadGroupPermissions(ResourceGroupComposite currentGroup,
- PermissionsLoadedListener permissionsLoadedListener) {
- if ((this.currentContext != Context.GROUP) || (this.currentId != currentGroup.getResourceGroup().getId())) {
- this.resourceCacheDirty = true;
- }
- this.currentContext = Context.GROUP;
- this.currentId = currentGroup.getResourceGroup().getId();
- if (currentGroup.getResourcePermission() == null) {
- ResourcePermission resourcePermission = new ResourcePermission(new HashSet<Permission>(
- Permission.RESOURCE_ALL.size()));
- currentGroup.setResourcePermission(resourcePermission);
- }
- this.resourcePermissions = currentGroup.getResourcePermission().getPermissions();
-
- if (this.resourceCacheDirty) {
- // Permissions are not cached. Kick off an async load and let it notify the caller when the load completes.
- this.resourcePermissionsLoadedListener = permissionsLoadedListener;
- loadCurrentGroupPermissions();
- } else {
- // Permissions are cached - shoot em back to the caller.
- permissionsLoadedListener.onPermissionsLoaded(this.resourcePermissions);
- }
- }
-
/**
* Clear all cached permissions.
*/
@@ -152,11 +80,6 @@ public class UserPermissionsManager {
// Clear global cache.
this.globalCacheDirty = true;
this.globalPermissions.clear();
-
- // Clear Resource/group cache.
- this.resourceCacheDirty = true;
- this.currentContext = null;
- this.currentId = 0;
}
private UserPermissionsManager() {
@@ -164,16 +87,6 @@ public class UserPermissionsManager {
public void run() {
Log.debug("Refreshing cached user permissions...");
loadGlobalPermissions();
- if (UserPermissionsManager.this.currentContext != null) {
- switch (UserPermissionsManager.this.currentContext) {
- case RESOURCE:
- loadCurrentResourcePermissions();
- break;
- case GROUP:
- loadCurrentGroupPermissions();
- break;
- }
- }
}
};
@@ -207,51 +120,6 @@ public class UserPermissionsManager {
}
}
- private void loadCurrentResourcePermissions() {
- AUTHORIZATION_SERVICE.getExplicitResourcePermissions(this.currentId, new AsyncCallback<Set<Permission>>() {
- public void onFailure(Throwable throwable) {
- MESSAGE_CENTER.notify(new Message(MSG.util_userPerm_loadFailResource(Integer
- .toString(UserPermissionsManager.this.currentId)), throwable, Message.Severity.Error, EnumSet
- .of(Message.Option.BackgroundJobResult)));
- UserPermissionsManager.this.resourcePermissions.clear();
- UserPermissionsManager.this.resourceCacheDirty = true;
- notifyResourcePermissionsLoadedListener();
- }
-
- public void onSuccess(Set<Permission> permissions) {
- setTo(UserPermissionsManager.this.resourcePermissions, permissions);
- UserPermissionsManager.this.resourceCacheDirty = false;
- notifyResourcePermissionsLoadedListener();
- }
- });
- }
-
- private void loadCurrentGroupPermissions() {
- AUTHORIZATION_SERVICE.getExplicitGroupPermissions(this.currentId, new AsyncCallback<Set<Permission>>() {
- public void onFailure(Throwable throwable) {
- MESSAGE_CENTER.notify(new Message(MSG.util_userPerm_loadFailGroup(Integer
- .toString(UserPermissionsManager.this.currentId)), throwable, Message.Severity.Error, EnumSet
- .of(Message.Option.BackgroundJobResult)));
- UserPermissionsManager.this.resourcePermissions.clear();
- UserPermissionsManager.this.resourceCacheDirty = true;
- notifyResourcePermissionsLoadedListener();
- }
-
- public void onSuccess(Set<Permission> permissions) {
- setTo(UserPermissionsManager.this.resourcePermissions, permissions);
- UserPermissionsManager.this.resourceCacheDirty = false;
- notifyResourcePermissionsLoadedListener();
- }
- });
- }
-
- private void notifyResourcePermissionsLoadedListener() {
- if (this.resourcePermissionsLoadedListener != null) {
- this.resourcePermissionsLoadedListener.onPermissionsLoaded(this.resourcePermissions);
- this.resourcePermissionsLoadedListener = null;
- }
- }
-
private static void setTo(Set<Permission> permissions1, Set<Permission> permissions2) {
permissions1.clear();
permissions1.addAll(permissions2);
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 3226afe..4f6257e 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
@@ -38,8 +38,6 @@ 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.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.PermissionsLoadedListener;
-import org.rhq.enterprise.gui.coregui.client.UserPermissionsManager;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.alert.GroupAlertHistoryView;
import org.rhq.enterprise.gui.coregui.client.alert.definitions.GroupAlertDefinitionsView;
@@ -358,14 +356,7 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
"Failed to load group composite for group with id " + groupId);
} else {
groupComposite = result.get(0);
- // First load the user's permissions for the group.
- UserPermissionsManager.getInstance().loadGroupPermissions(groupComposite,
- new PermissionsLoadedListener() {
- public void onPermissionsLoaded(Set<Permission> permissions) {
- // Next load the group's ResourceType.
- loadResourceType(groupComposite, viewPath);
- }
- });
+ loadResourceType(groupComposite, 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 35a929b..03420f2 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
@@ -38,8 +38,6 @@ import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.resource.composite.ResourcePermission;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.PermissionsLoadedListener;
-import org.rhq.enterprise.gui.coregui.client.UserPermissionsManager;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.alert.ResourceAlertHistoryView;
import org.rhq.enterprise.gui.coregui.client.alert.definitions.ResourceAlertDefinitionsView;
@@ -397,14 +395,7 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
onFailure(new Exception(MSG.view_inventory_resource_loadFailed(String.valueOf(resourceId))));
} else {
final ResourceComposite resourceComposite = result.get(0);
- // First load the user's permissions for the Resource.
- UserPermissionsManager.getInstance().loadResourcePermissions(resourceComposite,
- new PermissionsLoadedListener() {
- public void onPermissionsLoaded(Set<Permission> permissions) {
- // Next load the Resource's type.
- loadResourceType(resourceComposite, viewPath);
- }
- });
+ loadResourceType(resourceComposite, viewPath);
}
}
});
commit 362a0a6eab0dd07084a6575e19a037ac4d19ff19
Author: Joseph Marques <joseph(a)redhat.com>
Date: Mon Nov 22 17:59:26 2010 -0500
fix GWT compiler error
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/core/domain/measurement/MeasurementConverterClient.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/core/domain/measurement/MeasurementConverterClient.java
deleted file mode 100644
index 64eea4a..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/core/domain/measurement/MeasurementConverterClient.java
+++ /dev/null
@@ -1,360 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.rhq.core.domain.measurement;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import com.google.gwt.i18n.client.NumberFormat;
-
-import org.rhq.core.domain.measurement.composite.MeasurementNumericValueAndUnits;
-import org.rhq.core.domain.measurement.util.MeasurementConversionException;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.Messages;
-
-public class MeasurementConverterClient {
- private static final Messages MSG = CoreGUI.getMessages();
-
- private static final int MAX_PRECISION_DIGITS = 4;
- private static final String NULL_OR_NAN_FORMATTED_VALUE = MSG.view_measure_nan();
-
- private static NumberFormat getDefaultNumberFormat() {
- NumberFormat nf = NumberFormat.getFormat("0.0");
-
- return nf;
- }
-
- public static Double scale(MeasurementNumericValueAndUnits origin, MeasurementUnits targetUnits)
- throws MeasurementConversionException {
- MeasurementUnits originUnits = origin.getUnits();
- Double originValue = origin.getValue();
-
- return originValue * MeasurementUnits.calculateOffset(originUnits, targetUnits);
- }
-
- public static Double scale(Double origin, MeasurementUnits targetUnits) throws MeasurementConversionException {
- boolean wasNegative = false;
- if (origin < 0) {
- wasNegative = true;
- origin = -origin;
- }
-
- MeasurementUnits baseUnit = targetUnits.getBaseUnits();
- MeasurementNumericValueAndUnits valueAndUnits = new MeasurementNumericValueAndUnits(origin, baseUnit);
-
- Double results = scale(valueAndUnits, targetUnits);
- if (wasNegative) {
- results = -results;
- }
-
- return results;
- }
-
- public static String format(String value, MeasurementUnits targetUnits) {
- if (targetUnits == null) {
- return value;
- } else {
- return value + targetUnits;
- }
- }
-
- /**
- * Formats the given array of double values: determines the necessary precision such that when formatted, they are
- * distinct and reasonable to look at. For example, for values { 1.45 1.46 1.47 1.48 1.49 } the desired precision is
- * 2 - less precision loses significant digits, and more precision provides no added benefit. Max precision is
- * bounded for presentation considerations.
- *
- * @param values the values to be formatted
- * @param targetUnits the target units for the values
- * @param bestFit whether or not to use a normalized scale for the family of units
- *
- * @return the formatted values
- */
- public static String[] formatToSignificantPrecision(double[] values, MeasurementUnits targetUnits, boolean bestFit) {
- if ((null == values) || (values.length == 0)) {
- return null;
- }
-
- MeasurementUnits originalUnits = targetUnits;
-
- /*
- * in the overwhelming majority of cases, you're going to want to apply a bestFit
- * to the passed data, but it's not required; it's perfectly possible to allow a
- * list of doubles to be formatted without being fit, in which case the targetUnits
- * will be part of the formatted display for each result element
- */
- if (bestFit) {
- // find bestFit units by taking the average
- Double average = 0.0;
-
- for (int i = 0, sz = values.length; i < sz; i++) {
- /*
- * adding fractional amount iterative leads to greater
- * error, but prevents overflow on large data sets
- */
- average += (values[i] / sz);
- }
-
- MeasurementNumericValueAndUnits fittedAverage = fit(average, targetUnits);
- //noinspection UnnecessaryLocalVariable
- MeasurementUnits fittedUnits = fittedAverage.getUnits();
-
- /*
- * and change the local reference to targetUnits, so that the same logic
- * can be used both for the bestFit and non-bestFit computations
- */
- targetUnits = fittedUnits;
- }
-
- Set<String> existingStrings; // technically this *is* unused because
- int precisionDigits = 0;
- boolean scaleWithMorePrecision = true;
- String[] results = new String[values.length];
- NumberFormat nf = getDefaultNumberFormat();
-
- /*
- * we scale at most to MAX_PRECISION_DIGITS to allow for presentation limits
- *
- * increase the maxPrecisionDigits in the while condition
- * itself to ensure it gets done for every loop
- */
- while (scaleWithMorePrecision && (++precisionDigits <= MAX_PRECISION_DIGITS)) {
- /*
- * make the assumption that we no longer need to scale beyond this iteration
- */
- scaleWithMorePrecision = false;
-
- /*
- * we need to record the uniquely formatted values so we can determine
- */
- existingStrings = new HashSet<String>();
- nf = NumberFormat.getFormat(getFormat(0, precisionDigits));
-
- Double[] scaledValues = new Double[values.length];
-
- for (int i = 0; i < scaledValues.length; i++) {
- /*
- * For relative units apply the scale now, prior to the nf.format(), since we are not using format( Double...).
- * Otherwise, apply standard multi-unit scaling.
- */
- if (MeasurementUnits.Family.RELATIVE == originalUnits.getFamily()) {
- scaledValues[i] = MeasurementUnits.scaleUp(values[i], originalUnits);
- } else {
- scaledValues[i] = scale(new MeasurementNumericValueAndUnits(values[i], originalUnits), targetUnits);
- }
- }
-
- for (int i = 0; i < results.length; i++) {
- /*
- * JUST get the formatted value, specifically DON'T tack on the formatted units yet;
- * we do this to see how many units we'll have to scale to afterwards (outside this
- * while loop) to make the array of values passed to us unique
- */
- String formatted = nf.format(scaledValues[i]);
-
- /*
- * check whether formatted value was in the set or not; if it was, we have to
- * loop, but only if we're not not already at our maximum precision
- */
- boolean wasNewElement = existingStrings.add(formatted);
-
- if ((!wasNewElement) && (precisionDigits < MAX_PRECISION_DIGITS)) {
- scaleWithMorePrecision = true;
- break;
- }
-
- results[i] = formatted;
- }
- }
-
- /*
- * we did the best we could in terms of trying to find a precision that adds the most
- * uniqueness to the given set of values, NOW tack on the formatted value for the units
- */
- for (int i = 0; i < results.length; i++) {
- results[i] = format(results[i], targetUnits);
- }
-
- return results;
- }
-
- public static String format(Double value, MeasurementUnits targetUnits, boolean bestFit) {
- return format(value, targetUnits, bestFit, null, null);
- }
-
- public static String format(Double value, MeasurementUnits targetUnits, boolean bestFit,
- Integer minimumFractionDigits, Integer maximumFractionDigits) {
- if (value == null || Double.isNaN(value)) {
- return NULL_OR_NAN_FORMATTED_VALUE;
- }
- if (bestFit) {
- MeasurementNumericValueAndUnits valueAndUnits = fit(value, targetUnits);
-
- value = valueAndUnits.getValue();
- targetUnits = valueAndUnits.getUnits();
- }
-
- // apply relative scale at presentation time
- if (targetUnits != null && MeasurementUnits.Family.RELATIVE == targetUnits.getFamily()) {
- value = MeasurementUnits.scaleUp(value, targetUnits);
- }
-
- NumberFormat numberFormat = NumberFormat.getFormat(getFormat(
- minimumFractionDigits != null ? minimumFractionDigits : 1,
- maximumFractionDigits != null ? maximumFractionDigits : 1));
-
- String formatted = numberFormat.format(value);
-
- return format(formatted, targetUnits);
- }
-
- public static String scaleAndFormat(Double origin, MeasurementSchedule targetSchedule, boolean bestFit)
- throws MeasurementConversionException {
- MeasurementUnits targetUnits = targetSchedule.getDefinition().getUnits();
-
- return scaleAndFormat(origin, targetUnits, bestFit, null, null);
- }
-
- public static String scaleAndFormat(Double origin, MeasurementUnits targetUnits, boolean bestFit)
- throws MeasurementConversionException {
-
- return scaleAndFormat(origin, targetUnits, bestFit, null, null);
- }
-
- public static String scaleAndFormat(Double origin, MeasurementUnits targetUnits, boolean bestFit,
- Integer minimumFractionDigits, Integer maximumFractionDigits) throws MeasurementConversionException {
-
- MeasurementUnits baseUnits = targetUnits.getBaseUnits();
- MeasurementNumericValueAndUnits valueAndUnits = new MeasurementNumericValueAndUnits(origin, baseUnits);
- Double scaledMagnitude = scale(valueAndUnits, targetUnits);
-
- return format(scaledMagnitude, targetUnits, bestFit);
- }
-
- public static MeasurementNumericValueAndUnits fit(Double origin, MeasurementUnits units) {
- return fit(origin, units, null, null);
- }
-
- public static MeasurementNumericValueAndUnits fit(Double origin, MeasurementUnits units, MeasurementUnits lowUnits,
- MeasurementUnits highUnits) {
-
- // work-around for the various Chart descendants not properly setting their units field;
- if (null == units) {
- return new MeasurementNumericValueAndUnits(origin, units);
- }
-
- // by definition, absolutely specified units don't scale to anything
- if ((MeasurementUnits.Family.ABSOLUTE == units.getFamily())
- || (MeasurementUnits.Family.DURATION == units.getFamily())) {
- return new MeasurementNumericValueAndUnits(origin, units);
- }
-
- // by definition relative-valued units are self-scaled (converted at formatting)
- if (MeasurementUnits.Family.RELATIVE == units.getFamily()) {
- return new MeasurementNumericValueAndUnits(origin, units);
- }
-
- if (MeasurementUnits.Family.TEMPERATURE == units.getFamily()) {
- return new MeasurementNumericValueAndUnits(origin, units);
- }
-
- // if the magnitude is zero, the best-fit also will spin around forever since it won't change
- if (Math.abs(origin) < 1e-9) {
- return new MeasurementNumericValueAndUnits(origin, units);
- }
-
- boolean wasNegative = false;
-
- if (origin < 0) {
- wasNegative = true;
- origin = -origin;
- }
-
- MeasurementNumericValueAndUnits currentValueAndUnits;
- MeasurementNumericValueAndUnits nextValueAndUnits = new MeasurementNumericValueAndUnits(origin, units);
-
- // first, make the value smaller if it's too big
- int maxOrdinal = (highUnits != null) ? (highUnits.ordinal() + 1) : MeasurementUnits.values().length;
-
- do {
- currentValueAndUnits = nextValueAndUnits;
-
- int nextOrdinal = currentValueAndUnits.getUnits().ordinal() + 1;
- if (nextOrdinal == maxOrdinal) {
- // we could theoretically get bigger, but we don't have any units to represent that
- break;
- }
-
- MeasurementUnits biggerUnits = MeasurementUnits.values()[nextOrdinal];
- if (biggerUnits.getFamily() != currentValueAndUnits.getUnits().getFamily()) {
- // we're as big as we can get, break out of the loop so we can return
- break;
- }
-
- Double smallerValue = scale(currentValueAndUnits, biggerUnits);
-
- nextValueAndUnits = new MeasurementNumericValueAndUnits(smallerValue, biggerUnits);
- } while (nextValueAndUnits.getValue() > 1.0);
-
- // next, make the value bigger if it's too small
- int minOrdinal = (lowUnits != null) ? (lowUnits.ordinal() - 1) : -1;
-
- while (currentValueAndUnits.getValue() < 1.0) {
- int nextOrdinal = currentValueAndUnits.getUnits().ordinal() - 1;
- if (nextOrdinal == minOrdinal) {
- // we could theoretically get smaller, but we don't have any units to represent that
- break;
- }
-
- MeasurementUnits smallerUnits = MeasurementUnits.values()[nextOrdinal];
- if (smallerUnits.getFamily() != currentValueAndUnits.getUnits().getFamily()) {
- // we're as small as we can get, break out of the loop so we can return
- break;
- }
-
- Double biggerValue = scale(currentValueAndUnits, smallerUnits);
-
- nextValueAndUnits = new MeasurementNumericValueAndUnits(biggerValue, smallerUnits);
-
- currentValueAndUnits = nextValueAndUnits;
- }
-
- if (wasNegative) {
- return new MeasurementNumericValueAndUnits(-currentValueAndUnits.getValue(), currentValueAndUnits
- .getUnits());
- }
-
- return currentValueAndUnits;
- }
-
- public static String getFormat(int minDigits, int maxDigits) {
- StringBuilder buf = new StringBuilder("0.");
- for (int i = 0; i < minDigits; i++) {
- buf.append("0");
- }
- for (int i = 0; i < (maxDigits - minDigits); i++) {
- buf.append("#");
- }
- return buf.toString();
- }
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/agent/install/RemoteAgentInstallView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/agent/install/RemoteAgentInstallView.java
index 3adcf47..656f171 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/agent/install/RemoteAgentInstallView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/agent/install/RemoteAgentInstallView.java
@@ -45,12 +45,12 @@ import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.install.remote.AgentInstallInfo;
import org.rhq.core.domain.install.remote.AgentInstallStep;
import org.rhq.core.domain.install.remote.RemoteAccessInfo;
-import org.rhq.core.domain.measurement.MeasurementConverterClient;
import org.rhq.core.domain.measurement.MeasurementUnits;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.RemoteInstallGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.util.MeasurementConverterClient;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
index 5b58ab2..801c06f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
@@ -42,11 +42,11 @@ import org.rhq.core.domain.alert.AlertPriority;
import org.rhq.core.domain.alert.notification.AlertNotificationLog;
import org.rhq.core.domain.common.EntityContext;
import org.rhq.core.domain.criteria.AlertCriteria;
-import org.rhq.core.domain.measurement.MeasurementConverterClient;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.gwt.AlertGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.MeasurementConverterClient;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
/**
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertFormatUtility.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertFormatUtility.java
index 133683f..26a2477 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertFormatUtility.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertFormatUtility.java
@@ -26,10 +26,10 @@ import org.rhq.core.domain.alert.Alert;
import org.rhq.core.domain.alert.AlertCondition;
import org.rhq.core.domain.alert.AlertConditionCategory;
import org.rhq.core.domain.alert.AlertDefinition;
-import org.rhq.core.domain.measurement.MeasurementConverterClient;
import org.rhq.core.domain.measurement.MeasurementUnits;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.Messages;
+import org.rhq.enterprise.gui.coregui.client.util.MeasurementConverterClient;
/**
* The methods in this class are ported from AlertDefUtil from portal-war and MeasurementFormatter from
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/file/FileListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/file/FileListView.java
index 305871a..31fce59 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/file/FileListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/file/FileListView.java
@@ -30,12 +30,12 @@ import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.core.domain.bundle.BundleFile;
import org.rhq.core.domain.criteria.BundleFileCriteria;
-import org.rhq.core.domain.measurement.MeasurementConverterClient;
import org.rhq.core.domain.measurement.MeasurementUnits;
import org.rhq.core.domain.util.PageList;
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.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.MeasurementConverterClient;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformPortletView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformPortletView.java
index 4a563c7..e04f6f6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformPortletView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformPortletView.java
@@ -36,7 +36,6 @@ import com.smartgwt.client.widgets.layout.HLayout;
import org.rhq.core.domain.criteria.ResourceTypeCriteria;
import org.rhq.core.domain.dashboard.DashboardPortlet;
-import org.rhq.core.domain.measurement.MeasurementConverterClient;
import org.rhq.core.domain.measurement.MeasurementData;
import org.rhq.core.domain.measurement.MeasurementDataNumeric;
import org.rhq.core.domain.measurement.MeasurementDefinition;
@@ -54,6 +53,7 @@ import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.MeasurementDataGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceTypeGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField;
+import org.rhq.enterprise.gui.coregui.client.util.MeasurementConverterClient;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableListGrid;
/**
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/AvailabilityBarView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/AvailabilityBarView.java
index 835f8e5..4abfb0e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/AvailabilityBarView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/AvailabilityBarView.java
@@ -28,7 +28,6 @@ import com.smartgwt.client.widgets.layout.HLayout;
import org.rhq.core.domain.measurement.Availability;
import org.rhq.core.domain.measurement.AvailabilityType;
-import org.rhq.core.domain.measurement.MeasurementConverterClient;
import org.rhq.core.domain.measurement.MeasurementUnits;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.util.PageControl;
@@ -37,6 +36,7 @@ import org.rhq.core.domain.util.PageOrdering;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.Messages;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.MeasurementConverterClient;
/**
* @author Greg Hinkle
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/LiveGraphView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/LiveGraphView.java
index 6d6f5bc..ca6c27d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/LiveGraphView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/LiveGraphView.java
@@ -53,13 +53,13 @@ import com.smartgwt.client.widgets.events.CloseClientEvent;
import com.smartgwt.client.widgets.events.MouseOutEvent;
import com.smartgwt.client.widgets.events.MouseOutHandler;
-import org.rhq.core.domain.measurement.MeasurementConverterClient;
import org.rhq.core.domain.measurement.MeasurementData;
import org.rhq.core.domain.measurement.MeasurementDataNumeric;
import org.rhq.core.domain.measurement.MeasurementDefinition;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.MeasurementDataGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.util.MeasurementConverterClient;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWidgetCanvas;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWindow;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java
index da91f8c..3c751b1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java
@@ -52,7 +52,6 @@ import com.smartgwt.client.widgets.events.MouseOutHandler;
import com.smartgwt.client.widgets.layout.HLayout;
import org.rhq.core.domain.criteria.ResourceCriteria;
-import org.rhq.core.domain.measurement.MeasurementConverterClient;
import org.rhq.core.domain.measurement.MeasurementDefinition;
import org.rhq.core.domain.measurement.composite.MeasurementDataNumericHighLowComposite;
import org.rhq.core.domain.resource.Resource;
@@ -62,6 +61,7 @@ import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+import org.rhq.enterprise.gui.coregui.client.util.MeasurementConverterClient;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableImg;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/measurement/MeasurementOOBDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/measurement/MeasurementOOBDataSource.java
index f9657b4..e90e605 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/measurement/MeasurementOOBDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/measurement/MeasurementOOBDataSource.java
@@ -34,12 +34,12 @@ import com.smartgwt.client.data.fields.DataSourceTextField;
import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.grid.ListGridRecord;
-import org.rhq.core.domain.measurement.MeasurementConverterClient;
import org.rhq.core.domain.measurement.composite.MeasurementOOBComposite;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.MeasurementConverterClient;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
/**
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/MeasurementConverterClient.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/MeasurementConverterClient.java
new file mode 100644
index 0000000..c538e2b
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/MeasurementConverterClient.java
@@ -0,0 +1,363 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.util;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import com.google.gwt.i18n.client.NumberFormat;
+
+import org.rhq.core.domain.measurement.MeasurementSchedule;
+import org.rhq.core.domain.measurement.MeasurementUnits;
+import org.rhq.core.domain.measurement.MeasurementUnits.Family;
+import org.rhq.core.domain.measurement.composite.MeasurementNumericValueAndUnits;
+import org.rhq.core.domain.measurement.util.MeasurementConversionException;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.Messages;
+
+public class MeasurementConverterClient {
+ private static final Messages MSG = CoreGUI.getMessages();
+
+ private static final int MAX_PRECISION_DIGITS = 4;
+ private static final String NULL_OR_NAN_FORMATTED_VALUE = MSG.view_measure_nan();
+
+ private static NumberFormat getDefaultNumberFormat() {
+ NumberFormat nf = NumberFormat.getFormat("0.0");
+
+ return nf;
+ }
+
+ public static Double scale(MeasurementNumericValueAndUnits origin, MeasurementUnits targetUnits)
+ throws MeasurementConversionException {
+ MeasurementUnits originUnits = origin.getUnits();
+ Double originValue = origin.getValue();
+
+ return originValue * MeasurementUnits.calculateOffset(originUnits, targetUnits);
+ }
+
+ public static Double scale(Double origin, MeasurementUnits targetUnits) throws MeasurementConversionException {
+ boolean wasNegative = false;
+ if (origin < 0) {
+ wasNegative = true;
+ origin = -origin;
+ }
+
+ MeasurementUnits baseUnit = targetUnits.getBaseUnits();
+ MeasurementNumericValueAndUnits valueAndUnits = new MeasurementNumericValueAndUnits(origin, baseUnit);
+
+ Double results = scale(valueAndUnits, targetUnits);
+ if (wasNegative) {
+ results = -results;
+ }
+
+ return results;
+ }
+
+ public static String format(String value, MeasurementUnits targetUnits) {
+ if (targetUnits == null) {
+ return value;
+ } else {
+ return value + targetUnits;
+ }
+ }
+
+ /**
+ * Formats the given array of double values: determines the necessary precision such that when formatted, they are
+ * distinct and reasonable to look at. For example, for values { 1.45 1.46 1.47 1.48 1.49 } the desired precision is
+ * 2 - less precision loses significant digits, and more precision provides no added benefit. Max precision is
+ * bounded for presentation considerations.
+ *
+ * @param values the values to be formatted
+ * @param targetUnits the target units for the values
+ * @param bestFit whether or not to use a normalized scale for the family of units
+ *
+ * @return the formatted values
+ */
+ public static String[] formatToSignificantPrecision(double[] values, MeasurementUnits targetUnits, boolean bestFit) {
+ if ((null == values) || (values.length == 0)) {
+ return null;
+ }
+
+ MeasurementUnits originalUnits = targetUnits;
+
+ /*
+ * in the overwhelming majority of cases, you're going to want to apply a bestFit
+ * to the passed data, but it's not required; it's perfectly possible to allow a
+ * list of doubles to be formatted without being fit, in which case the targetUnits
+ * will be part of the formatted display for each result element
+ */
+ if (bestFit) {
+ // find bestFit units by taking the average
+ Double average = 0.0;
+
+ for (int i = 0, sz = values.length; i < sz; i++) {
+ /*
+ * adding fractional amount iterative leads to greater
+ * error, but prevents overflow on large data sets
+ */
+ average += (values[i] / sz);
+ }
+
+ MeasurementNumericValueAndUnits fittedAverage = fit(average, targetUnits);
+ //noinspection UnnecessaryLocalVariable
+ MeasurementUnits fittedUnits = fittedAverage.getUnits();
+
+ /*
+ * and change the local reference to targetUnits, so that the same logic
+ * can be used both for the bestFit and non-bestFit computations
+ */
+ targetUnits = fittedUnits;
+ }
+
+ Set<String> existingStrings; // technically this *is* unused because
+ int precisionDigits = 0;
+ boolean scaleWithMorePrecision = true;
+ String[] results = new String[values.length];
+ NumberFormat nf = getDefaultNumberFormat();
+
+ /*
+ * we scale at most to MAX_PRECISION_DIGITS to allow for presentation limits
+ *
+ * increase the maxPrecisionDigits in the while condition
+ * itself to ensure it gets done for every loop
+ */
+ while (scaleWithMorePrecision && (++precisionDigits <= MAX_PRECISION_DIGITS)) {
+ /*
+ * make the assumption that we no longer need to scale beyond this iteration
+ */
+ scaleWithMorePrecision = false;
+
+ /*
+ * we need to record the uniquely formatted values so we can determine
+ */
+ existingStrings = new HashSet<String>();
+ nf = NumberFormat.getFormat(getFormat(0, precisionDigits));
+
+ Double[] scaledValues = new Double[values.length];
+
+ for (int i = 0; i < scaledValues.length; i++) {
+ /*
+ * For relative units apply the scale now, prior to the nf.format(), since we are not using format( Double...).
+ * Otherwise, apply standard multi-unit scaling.
+ */
+ if (MeasurementUnits.Family.RELATIVE == originalUnits.getFamily()) {
+ scaledValues[i] = MeasurementUnits.scaleUp(values[i], originalUnits);
+ } else {
+ scaledValues[i] = scale(new MeasurementNumericValueAndUnits(values[i], originalUnits), targetUnits);
+ }
+ }
+
+ for (int i = 0; i < results.length; i++) {
+ /*
+ * JUST get the formatted value, specifically DON'T tack on the formatted units yet;
+ * we do this to see how many units we'll have to scale to afterwards (outside this
+ * while loop) to make the array of values passed to us unique
+ */
+ String formatted = nf.format(scaledValues[i]);
+
+ /*
+ * check whether formatted value was in the set or not; if it was, we have to
+ * loop, but only if we're not not already at our maximum precision
+ */
+ boolean wasNewElement = existingStrings.add(formatted);
+
+ if ((!wasNewElement) && (precisionDigits < MAX_PRECISION_DIGITS)) {
+ scaleWithMorePrecision = true;
+ break;
+ }
+
+ results[i] = formatted;
+ }
+ }
+
+ /*
+ * we did the best we could in terms of trying to find a precision that adds the most
+ * uniqueness to the given set of values, NOW tack on the formatted value for the units
+ */
+ for (int i = 0; i < results.length; i++) {
+ results[i] = format(results[i], targetUnits);
+ }
+
+ return results;
+ }
+
+ public static String format(Double value, MeasurementUnits targetUnits, boolean bestFit) {
+ return format(value, targetUnits, bestFit, null, null);
+ }
+
+ public static String format(Double value, MeasurementUnits targetUnits, boolean bestFit,
+ Integer minimumFractionDigits, Integer maximumFractionDigits) {
+ if (value == null || Double.isNaN(value)) {
+ return NULL_OR_NAN_FORMATTED_VALUE;
+ }
+ if (bestFit) {
+ MeasurementNumericValueAndUnits valueAndUnits = fit(value, targetUnits);
+
+ value = valueAndUnits.getValue();
+ targetUnits = valueAndUnits.getUnits();
+ }
+
+ // apply relative scale at presentation time
+ if (targetUnits != null && MeasurementUnits.Family.RELATIVE == targetUnits.getFamily()) {
+ value = MeasurementUnits.scaleUp(value, targetUnits);
+ }
+
+ NumberFormat numberFormat = NumberFormat.getFormat(getFormat(
+ minimumFractionDigits != null ? minimumFractionDigits : 1,
+ maximumFractionDigits != null ? maximumFractionDigits : 1));
+
+ String formatted = numberFormat.format(value);
+
+ return format(formatted, targetUnits);
+ }
+
+ public static String scaleAndFormat(Double origin, MeasurementSchedule targetSchedule, boolean bestFit)
+ throws MeasurementConversionException {
+ MeasurementUnits targetUnits = targetSchedule.getDefinition().getUnits();
+
+ return scaleAndFormat(origin, targetUnits, bestFit, null, null);
+ }
+
+ public static String scaleAndFormat(Double origin, MeasurementUnits targetUnits, boolean bestFit)
+ throws MeasurementConversionException {
+
+ return scaleAndFormat(origin, targetUnits, bestFit, null, null);
+ }
+
+ public static String scaleAndFormat(Double origin, MeasurementUnits targetUnits, boolean bestFit,
+ Integer minimumFractionDigits, Integer maximumFractionDigits) throws MeasurementConversionException {
+
+ MeasurementUnits baseUnits = targetUnits.getBaseUnits();
+ MeasurementNumericValueAndUnits valueAndUnits = new MeasurementNumericValueAndUnits(origin, baseUnits);
+ Double scaledMagnitude = scale(valueAndUnits, targetUnits);
+
+ return format(scaledMagnitude, targetUnits, bestFit);
+ }
+
+ public static MeasurementNumericValueAndUnits fit(Double origin, MeasurementUnits units) {
+ return fit(origin, units, null, null);
+ }
+
+ public static MeasurementNumericValueAndUnits fit(Double origin, MeasurementUnits units, MeasurementUnits lowUnits,
+ MeasurementUnits highUnits) {
+
+ // work-around for the various Chart descendants not properly setting their units field;
+ if (null == units) {
+ return new MeasurementNumericValueAndUnits(origin, units);
+ }
+
+ // by definition, absolutely specified units don't scale to anything
+ if ((MeasurementUnits.Family.ABSOLUTE == units.getFamily())
+ || (MeasurementUnits.Family.DURATION == units.getFamily())) {
+ return new MeasurementNumericValueAndUnits(origin, units);
+ }
+
+ // by definition relative-valued units are self-scaled (converted at formatting)
+ if (MeasurementUnits.Family.RELATIVE == units.getFamily()) {
+ return new MeasurementNumericValueAndUnits(origin, units);
+ }
+
+ if (MeasurementUnits.Family.TEMPERATURE == units.getFamily()) {
+ return new MeasurementNumericValueAndUnits(origin, units);
+ }
+
+ // if the magnitude is zero, the best-fit also will spin around forever since it won't change
+ if (Math.abs(origin) < 1e-9) {
+ return new MeasurementNumericValueAndUnits(origin, units);
+ }
+
+ boolean wasNegative = false;
+
+ if (origin < 0) {
+ wasNegative = true;
+ origin = -origin;
+ }
+
+ MeasurementNumericValueAndUnits currentValueAndUnits;
+ MeasurementNumericValueAndUnits nextValueAndUnits = new MeasurementNumericValueAndUnits(origin, units);
+
+ // first, make the value smaller if it's too big
+ int maxOrdinal = (highUnits != null) ? (highUnits.ordinal() + 1) : MeasurementUnits.values().length;
+
+ do {
+ currentValueAndUnits = nextValueAndUnits;
+
+ int nextOrdinal = currentValueAndUnits.getUnits().ordinal() + 1;
+ if (nextOrdinal == maxOrdinal) {
+ // we could theoretically get bigger, but we don't have any units to represent that
+ break;
+ }
+
+ MeasurementUnits biggerUnits = MeasurementUnits.values()[nextOrdinal];
+ if (biggerUnits.getFamily() != currentValueAndUnits.getUnits().getFamily()) {
+ // we're as big as we can get, break out of the loop so we can return
+ break;
+ }
+
+ Double smallerValue = scale(currentValueAndUnits, biggerUnits);
+
+ nextValueAndUnits = new MeasurementNumericValueAndUnits(smallerValue, biggerUnits);
+ } while (nextValueAndUnits.getValue() > 1.0);
+
+ // next, make the value bigger if it's too small
+ int minOrdinal = (lowUnits != null) ? (lowUnits.ordinal() - 1) : -1;
+
+ while (currentValueAndUnits.getValue() < 1.0) {
+ int nextOrdinal = currentValueAndUnits.getUnits().ordinal() - 1;
+ if (nextOrdinal == minOrdinal) {
+ // we could theoretically get smaller, but we don't have any units to represent that
+ break;
+ }
+
+ MeasurementUnits smallerUnits = MeasurementUnits.values()[nextOrdinal];
+ if (smallerUnits.getFamily() != currentValueAndUnits.getUnits().getFamily()) {
+ // we're as small as we can get, break out of the loop so we can return
+ break;
+ }
+
+ Double biggerValue = scale(currentValueAndUnits, smallerUnits);
+
+ nextValueAndUnits = new MeasurementNumericValueAndUnits(biggerValue, smallerUnits);
+
+ currentValueAndUnits = nextValueAndUnits;
+ }
+
+ if (wasNegative) {
+ return new MeasurementNumericValueAndUnits(-currentValueAndUnits.getValue(), currentValueAndUnits
+ .getUnits());
+ }
+
+ return currentValueAndUnits;
+ }
+
+ public static String getFormat(int minDigits, int maxDigits) {
+ StringBuilder buf = new StringBuilder("0.");
+ for (int i = 0; i < minDigits; i++) {
+ buf.append("0");
+ }
+ for (int i = 0; i < (maxDigits - minDigits); i++) {
+ buf.append("#");
+ }
+ return buf.toString();
+ }
+}
13 years, 5 months
[rhq] modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertHistoryView.java | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
New commits:
commit a4a64ce17b94a73ad5e26e190c1bd1f749015511
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Nov 24 11:41:37 2010 -0500
need to provide a i18n title for status column
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertHistoryView.java
index 9fd74a1..bd103a9 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertHistoryView.java
@@ -95,7 +95,7 @@ public class AlertHistoryView extends TableSection {
ListGridField conditionTextField = new ListGridField("conditionText", MSG.view_alerts_field_condition_text());
ListGridField priorityField = new ListGridField("priority", MSG.view_alerts_field_priority(), 50);
- ListGridField statusField = new ListGridField("status", 175);
+ ListGridField statusField = new ListGridField("status", MSG.common_title_status(), 175);
statusField.setCellFormatter(new CellFormatter() {
public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
String ackTime = listGridRecord.getAttribute("acknowledgeTime");
@@ -127,7 +127,6 @@ public class AlertHistoryView extends TableSection {
setupTableInteractions();
-
}
private void setupTableInteractions() {
13 years, 5 months
[rhq] Branch 'release-3.0.0' - 2 commits - modules/plugins
by lkrejci
modules/plugins/apache/pom.xml | 21 +
modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheVirtualHostServiceComponent.java | 46 +---
modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheVirtualHostServiceDiscoveryComponent.java | 20 -
modules/plugins/apache/src/main/java/org/rhq/plugins/apache/augeas/AugeasConfigurationApache.java | 61 ++---
modules/plugins/apache/src/main/java/org/rhq/plugins/apache/augeas/AugeasTreeBuilderApache.java | 10
modules/plugins/apache/src/main/java/org/rhq/plugins/apache/parser/ApacheParserImpl.java | 4
modules/plugins/apache/src/main/java/org/rhq/plugins/apache/util/HttpdAddressUtility.java | 114 ++++++++--
modules/plugins/apache/src/test/java/org/rhq/plugins/apache/ApacheAugeasTest.java | 11
modules/plugins/apache/src/test/java/org/rhq/plugins/apache/ApachePluginTest.java | 13 -
modules/plugins/augeas/src/main/java/org/rhq/augeas/util/Glob.java | 4
10 files changed, 193 insertions(+), 111 deletions(-)
New commits:
commit ae99b5bc0bf42909308a9d1efc09cee77d06ffc1
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Tue Nov 23 22:09:27 2010 +0100
a couple of robustness enhancements to the apache plugin:
BZ 656449 - use the matching algorithm between SNMP values and augeas nodes also
when matching the vhost node by resource key, because resource key
in RHQ 3 is based on the SNMP value.
BZ 652247 - Log the SNMP errors only on DEBUG level during discovery because SNMP isn't
required for it to work.
BZ 656476 - Do not fail the discovery if a non-existent directory is used in an Include directive
BZ 652247, BZ 656491 - Do not choke on invalid/unresolvable hostnames in VirtualHost or ServerName directives
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheVirtualHostServiceComponent.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheVirtualHostServiceComponent.java
index a0f2120..c894fa9 100644
--- a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheVirtualHostServiceComponent.java
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheVirtualHostServiceComponent.java
@@ -26,6 +26,7 @@ import java.net.URISyntaxException;
import java.net.URL;
import java.net.UnknownHostException;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -384,25 +385,26 @@ public class ApacheVirtualHostServiceComponent implements ResourceComponent<Apac
//BZ 612189 - remove this once resource upgrade is in place
HttpdAddressUtility.Address resourceKeyAddress = HttpdAddressUtility.Address.parse(resourceKey);
+
+ AugeasNode bestNode = null;
+ int bestMatch = 0;
for(AugeasNode node : nodes) {
- List<AugeasNode> serverNameNodes = tree.matchRelative(node, "ServerName/param");
List<AugeasNode> vhostAddressNodes = node.getChildByLabel("param");
- String vhostServerName = serverNameNodes.isEmpty() ? null : serverNameNodes.get(0).getValue();
- String vhostAddressDef = vhostAddressNodes.isEmpty() ? null : vhostAddressNodes.get(0).getValue();
+ List<HttpdAddressUtility.Address> vhostAddresses = new ArrayList<HttpdAddressUtility.Address>();
+ for (AugeasNode vhostAddressNode : vhostAddressNodes) {
+ vhostAddresses.add(HttpdAddressUtility.Address.parse(vhostAddressNode.getValue()));
+ }
- if (vhostAddressDef != null) {
- HttpdAddressUtility.Address vhostAddress = HttpdAddressUtility.Address.parse(vhostAddressDef);
- if (vhostServerName != null) {
- HttpdAddressUtility.Address vhostServerAddress = HttpdAddressUtility.Address.parse(vhostServerName);
- vhostAddress.host = vhostServerAddress.host;
- }
-
- if (resourceKeyAddress.equals(vhostAddress)) {
- virtualHosts.add(node);
- }
+ int matchRate = matchRate(vhostAddresses, resourceKeyAddress);
+ if (bestMatch < matchRate) {
+ bestNode = node;
}
}
+
+ if (bestNode != null) {
+ return bestNode;
+ }
//BZ 612189 - remove this once we have resource upgrade
//ok, one final attempt... the legacy resource key format for the MainServer is just a host:port as with the rest of the vhosts, let's try that
@@ -411,24 +413,18 @@ public class ApacheVirtualHostServiceComponent implements ResourceComponent<Apac
URI serverUri = new URI(serverUrl);
String expectedResourceKey = serverUri.getHost() + ":" + serverUri.getPort();
- if (expectedResourceKey.equals(resourceKey)) {
+ HttpdAddressUtility.Address expectedAddress = HttpdAddressUtility.Address.parse(expectedResourceKey);
+ HttpdAddressUtility.Address actualAddress = HttpdAddressUtility.Address.parse(resourceKey);
+
+ if (matchRate(Collections.singletonList(expectedAddress), actualAddress) > 0) {
return tree.getRootNode();
}
} catch (URISyntaxException e) {
log.warn("Failed to parse the server URL when trying to match the vhost with the main server.", e);
}
- if (virtualHosts.size() == 0) {
- throw new IllegalStateException("Could not find virtual host configuration in augeas for virtual host: "
- + resourceKey);
- }
-
- if (virtualHosts.size() > 1) {
- throw new IllegalStateException("Found more than 1 virtual host configuration in augeas for virtual host: "
- + resourceKey);
- }
-
- return virtualHosts.get(0);
+ throw new IllegalStateException("Could not find virtual host configuration in augeas for virtual host: "
+ + resourceKey);
}
/**
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheVirtualHostServiceDiscoveryComponent.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheVirtualHostServiceDiscoveryComponent.java
index 8251658..95edbcf 100644
--- a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheVirtualHostServiceDiscoveryComponent.java
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheVirtualHostServiceDiscoveryComponent.java
@@ -96,6 +96,7 @@ public class ApacheVirtualHostServiceDiscoveryComponent implements ResourceDisco
}
String resourceKey = createResourceKey(serverName, hosts);
+ String resourceName = resourceKey; //this'll get overridden below if we find a better value using the address variable
Configuration pluginConfiguration = context.getDefaultPluginConfiguration();
@@ -104,7 +105,7 @@ public class ApacheVirtualHostServiceDiscoveryComponent implements ResourceDisco
String scheme = address.scheme;
String hostToPing = address.host;
int portToPing = address.port;
- if (address.isPortWildcard()) {
+ if (address.isPortWildcard() || !address.isPortDefined()) {
Address serverAddress = serverComponent.getAddressUtility().getMainServerSampleAddress(tree, hostToPing, 0);
if (serverAddress != null) {
portToPing = serverAddress.port;
@@ -132,21 +133,14 @@ public class ApacheVirtualHostServiceDiscoveryComponent implements ResourceDisco
PropertySimple urlProp = new PropertySimple(ApacheVirtualHostServiceComponent.URL_CONFIG_PROP, url);
pluginConfiguration.put(urlProp);
- }
-
- if (address != null) {
File rtLogFile = new File(logsDir, address.host + address.port + RT_LOG_FILE_NAME_SUFFIX);
-
+
PropertySimple rtLogProp = new PropertySimple(
ApacheVirtualHostServiceComponent.RESPONSE_TIME_LOG_FILE_CONFIG_PROP, rtLogFile.toString());
pluginConfiguration.put(rtLogProp);
- }
-
- String resourceName;
- if (serverName != null) {
- resourceName = address.host + ":" + address.port;
- } else {
- resourceName = resourceKey;
+
+ //redefine the resourcename using the virtual host sample address
+ resourceName = address.toString(false);
}
//BZ 612189 - remove this once we have resource upgrade
@@ -320,7 +314,7 @@ public class ApacheVirtualHostServiceDiscoveryComponent implements ResourceDisco
return ret;
} catch (Exception e) {
- log.warn("Error while trying to contact SNMP of the apache server " + discoveryContext.getParentResourceContext().getResourceKey(), e);
+ log.debug("Error while trying to contact SNMP of the apache server " + discoveryContext.getParentResourceContext().getResourceKey(), e);
return null;
}
}
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/augeas/AugeasConfigurationApache.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/augeas/AugeasConfigurationApache.java
index 3e51757..d4f7dd2 100644
--- a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/augeas/AugeasConfigurationApache.java
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/augeas/AugeasConfigurationApache.java
@@ -31,10 +31,11 @@ import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.rhq.augeas.config.AugeasModuleConfig;
import org.rhq.augeas.util.Glob;
import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.plugins.apache.ApachePluginLifecycleListener;
import org.rhq.plugins.apache.ApacheServerComponent;
import org.rhq.rhqtransform.AugeasRhqException;
import org.rhq.rhqtransform.impl.PluginDescriptorBasedAugeasConfiguration;
@@ -59,6 +60,8 @@ public class AugeasConfigurationApache extends PluginDescriptorBasedAugeasConfig
private final Pattern includePattern = Pattern.compile(INCLUDE_FILES_PATTERN);
private final Pattern serverRootPattern = Pattern.compile(SERVER_ROOT_PATTERN);
+ private static final Log LOG = LogFactory.getLog(AugeasConfigurationApache.class);
+
private String serverRootPath;
private AugeasModuleConfig module;
private List<File> allConfigFiles;
@@ -109,7 +112,7 @@ public class AugeasConfigurationApache extends PluginDescriptorBasedAugeasConfig
files.addAll(Glob.match(root, expression));
for (File fl : files){
- if (fl.exists()) {
+ if (fl.exists() && fl.isFile()) {
foundIncludes.add(fl.getAbsolutePath());
FileInputStream fstream = new FileInputStream(fl);
@@ -162,18 +165,23 @@ public class AugeasConfigurationApache extends PluginDescriptorBasedAugeasConfig
for (File configFile : files) {
if (!configFile.isAbsolute()) {
- throw new IllegalStateException(
- "Configuration files inclusion patterns contain a non-absolute file.");
+ LOG.warn("Configuration files inclusion patterns contain a non-absolute file: " + configFile);
+ continue;
}
+
if (!configFile.exists()) {
- throw new IllegalStateException(
- "Configuration files inclusion patterns refer to a non-existent file.");
+ LOG.warn("Configuration files inclusion patterns refer to a non-existent file: " + configFile);
+ continue;
}
+
if (configFile.isDirectory()) {
- throw new IllegalStateException("Configuration files inclusion patterns refer to a directory.");
+ LOG.warn("Configuration files inclusion patterns refer to a directory: " + configFile);
+ continue;
}
- if (!module.getConfigFiles().contains(configFile.getAbsolutePath()))
+
+ if (!module.getConfigFiles().contains(configFile.getAbsolutePath())) {
module.addConfigFile(configFile.getAbsolutePath());
+ }
}
}
}
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/parser/ApacheParserImpl.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/parser/ApacheParserImpl.java
index f33f8fd..686625e 100644
--- a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/parser/ApacheParserImpl.java
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/parser/ApacheParserImpl.java
@@ -24,7 +24,9 @@ public class ApacheParserImpl implements ApacheParser{
if (directive.getName().equals(INCLUDE_DIRECTIVE)){
List<File> files = getIncludeFiles(directive.getValuesAsString());
for (File fl : files){
- ApacheConfigReader.searchFile(fl.getAbsolutePath(), this);
+ if (fl.exists() && fl.isFile()) {
+ ApacheConfigReader.searchFile(fl.getAbsolutePath(), this);
+ }
}
}
directive.setParentNode(stack.getLastDirective());
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/util/HttpdAddressUtility.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/util/HttpdAddressUtility.java
index b5cdedf..0710178 100644
--- a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/util/HttpdAddressUtility.java
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/util/HttpdAddressUtility.java
@@ -82,7 +82,7 @@ public enum HttpdAddressUtility {
address = getLocalhost(address.port);
}
- updateWithServerName(address, ag, false);
+ updateWithServerName(address, ag);
return address;
}
@@ -106,7 +106,7 @@ public enum HttpdAddressUtility {
addr = getLocalhost(addr.port);
}
- updateWithServerName(addr, ag, false);
+ updateWithServerName(addr, ag);
return addr;
}
@@ -217,21 +217,68 @@ public enum HttpdAddressUtility {
Address o = (Address) other;
- if (this.host == null) {
- return o.host == null && this.port == o.port;
- } else {
- return this.host.equals(o.host) && this.port == o.port;
+ return safeEquals(host, o.host) && this.port == o.port;
+ }
+
+ /**
+ * This differs from equals in the way that it considers wildcard values:
+ * <ul>
+ * <li>wildcard host matches any host
+ * <li>default host matches default host
+ * <li>wildcard port matches any port
+ * <li>undefined port matches undefined port
+ * </ul>
+ * The addresses match if both address and port match.
+ *
+ * @param other the address to match
+ * @param whether to match the scheme as well
+ * @return true if the addresses match according to the rules described above, false otherwise
+ */
+ public boolean matches(Address other, boolean matchSchemes) {
+ if (matchSchemes && !safeEquals(scheme, other.scheme)) {
+ return false;
+ }
+
+ if (!WILDCARD.equals(host) && !WILDCARD.equals(other.host) && !safeEquals(host, other.host)) {
+ return false;
}
+
+ if (PORT_WILDCARD_VALUE != port && PORT_WILDCARD_VALUE != other.port && port != other.port) {
+ return false;
+ }
+
+ return true;
}
@Override
public String toString() {
- if (port == NO_PORT_SPECIFIED_VALUE) return scheme + "://" + host;
- else {
- String portSpec = port == PORT_WILDCARD_VALUE ? WILDCARD : String.valueOf(port);
+ return toString(true);
+ }
+
+ public String toString(boolean includeScheme) {
+ StringBuilder bld = new StringBuilder();
+
+ if (includeScheme) {
+ bld.append(scheme).append("://");
+ }
+
+ bld.append(host);
+
+ if (port != NO_PORT_SPECIFIED_VALUE) {
+ bld.append(":");
- return scheme + "://" + host + ":" + portSpec;
+ if (port == PORT_WILDCARD_VALUE) {
+ bld.append(WILDCARD);
+ } else {
+ bld.append(port);
+ }
}
+
+ return bld.toString();
+ }
+
+ private static boolean safeEquals(Object a, Object b) {
+ return a == null ? b == null : a.equals(b);
}
}
@@ -270,9 +317,9 @@ public enum HttpdAddressUtility {
return null;
addr.host = serverAddr.host;
}
-
+
if (serverName != null) {
- updateWithServerName(addr, serverName, true);
+ updateWithServerName(addr, serverName);
}
return addr;
@@ -351,7 +398,7 @@ public enum HttpdAddressUtility {
}
}
- private static void updateWithServerName(Address address, ApacheDirectiveTree config, boolean updatePort) throws UnknownHostException {
+ private static void updateWithServerName(Address address, ApacheDirectiveTree config) throws UnknownHostException {
//check if there is a ServerName directive
List<ApacheDirective> serverNameNodes = config.search("/ServerName");
@@ -360,21 +407,46 @@ public enum HttpdAddressUtility {
//be the case if the server listens on more than one interfaces.
if (serverNameNodes.size() > 0) {
String serverName = serverNameNodes.get(0).getValuesAsString();
- updateWithServerName(address, serverName, updatePort);
+ updateWithServerName(address, serverName);
}
}
- private static void updateWithServerName(Address address, String serverName, boolean updatePort) throws UnknownHostException {
+ private static void updateWithServerName(Address address, String serverName) throws UnknownHostException {
+ //the configuration may be invalid and/or the hostname can be unresolvable.
+ //we try to match the address with the servername first by IP address
+ //but if that fails (i.e. the hostname couldn't be resolved to an IP)
+ //we try to simply match the hostnames themselves.
+
Address serverAddr = Address.parse(serverName);
- InetAddress addrFromServerName = InetAddress.getByName(serverAddr.host);
- InetAddress addrFromAddress = InetAddress.getByName(address.host);
+ String ipFromServerName = null;
+ String ipFromAddress = null;
+ String hostFromServerName = null;
+ String hostFromAddress = null;
+ boolean lookupFailed = false;
+
+ try {
+ InetAddress addrFromServerName = InetAddress.getByName(serverAddr.host);
+ ipFromServerName = addrFromServerName.getHostAddress();
+ hostFromServerName = addrFromServerName.getHostName();
+ } catch (UnknownHostException e) {
+ ipFromServerName = serverAddr.host;
+ hostFromServerName = serverAddr.host;
+ lookupFailed = true;
+ }
- if (addrFromAddress.equals(addrFromServerName)) {
+ try {
+ InetAddress addrFromAddress = InetAddress.getByName(address.host);
+ ipFromAddress = addrFromAddress.getHostAddress();
+ hostFromAddress = addrFromAddress.getHostName();
+ } catch (UnknownHostException e) {
+ ipFromAddress = address.host;
+ hostFromAddress = address.host;
+ lookupFailed = true;
+ }
+
+ if (ipFromAddress.equals(ipFromServerName) || (lookupFailed && (hostFromAddress.equals(hostFromServerName)))) {
address.scheme = serverAddr.scheme;
address.host = serverAddr.host;
- if (updatePort) {
- address.port = serverAddr.port;
- }
}
}
}
diff --git a/modules/plugins/augeas/src/main/java/org/rhq/augeas/util/Glob.java b/modules/plugins/augeas/src/main/java/org/rhq/augeas/util/Glob.java
index fddf06e..d41d2a2 100644
--- a/modules/plugins/augeas/src/main/java/org/rhq/augeas/util/Glob.java
+++ b/modules/plugins/augeas/src/main/java/org/rhq/augeas/util/Glob.java
@@ -26,6 +26,7 @@ package org.rhq.augeas.util;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.apache.commons.logging.Log;
@@ -129,7 +130,8 @@ public class Glob {
globPattern = new File(globPattern).getAbsolutePath();
File[] files = parentPath.listFiles(new GlobFilter(globPattern));
if (files == null) {
- throw new IllegalStateException("Could not list files in " + parentPath);
+ log.debug("Could list files in " + parentPath);
+ return Collections.emptyList();
}
return Arrays.asList(files);
}
commit 1e6b979b70b403f1ac537e1fd274bf01b2c0c515
Author: Filip Drabek <fdrabek(a)dhcp-lab-136.englab.brq.redhat.com>
Date: Thu Aug 5 13:54:15 2010 +0200
BZ-618314 - fix of apache tests
BZ-618877 - Includes can use absolute path now.
diff --git a/modules/plugins/apache/pom.xml b/modules/plugins/apache/pom.xml
index f8868f6..5781ac5 100644
--- a/modules/plugins/apache/pom.xml
+++ b/modules/plugins/apache/pom.xml
@@ -95,18 +95,27 @@
</execution>
</executions>
</plugin>
+
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
</plugins>
</build>
<profiles>
<profile>
<id>integration-tests</id>
- <activation>
- <property>
- <name>maven.test.skip</name>
- <value>!true</value>
- </property>
- </activation>
+ <!--
+ <activation>
+ <property>
+ <name>maven.test.skip</name>
+ <value>!true</value>
+ </property>
+ </activation>
+ -->
<build>
<plugins>
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/augeas/AugeasConfigurationApache.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/augeas/AugeasConfigurationApache.java
index cb61c0a..3e51757 100644
--- a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/augeas/AugeasConfigurationApache.java
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/augeas/AugeasConfigurationApache.java
@@ -101,17 +101,13 @@ public class AugeasConfigurationApache extends PluginDescriptorBasedAugeasConfig
}
private void loadIncludes(String expression, List<String> foundIncludes) {
- try {
- File file = new File(expression);
-
+ try {
List<File> files = new ArrayList<File>();
- if (!file.isAbsolute()) {
- File serverRootFile = new File(serverRootPath);
- files = Glob.match(serverRootFile, expression);
- }else
- files.add(file);
-
+ File check = new File(expression);
+ File root = new File(check.isAbsolute() ? Glob.rootPortion(expression) : serverRootPath);
+ files.addAll(Glob.match(root, expression));
+
for (File fl : files){
if (fl.exists()) {
foundIncludes.add(fl.getAbsolutePath());
@@ -142,8 +138,7 @@ public class AugeasConfigurationApache extends PluginDescriptorBasedAugeasConfig
}
public void loadFiles() {
- File root = new File(serverRootPath);
-
+
for (AugeasModuleConfig module : modules) {
List<String> includeGlobs = module.getIncludedGlobs();
@@ -154,10 +149,10 @@ public class AugeasConfigurationApache extends PluginDescriptorBasedAugeasConfig
ArrayList<File> files = new ArrayList<File>();
for (String incl : includeGlobs) {
- if (incl.indexOf(File.separatorChar) == 0) {
- files.add(new File(incl));
- } else
- files.addAll(Glob.match(root, incl));
+ File check = new File(incl);
+ File root = new File(check.isAbsolute() ? Glob.rootPortion(incl) : serverRootPath);
+
+ files.addAll(Glob.match(root, incl));
}
if (module.getExcludedGlobs() != null) {
@@ -185,15 +180,11 @@ public class AugeasConfigurationApache extends PluginDescriptorBasedAugeasConfig
private static List<File> getIncludeFiles(String serverRoot, List<String> foundIncludes) {
List<File> ret = new ArrayList<File>();
- File serverRootFile = new File(serverRoot);
for (String path : foundIncludes) {
- File check = new File(path);
- if (check.isAbsolute()) {
- ret.add(check);
- } else {
- for (File f : Glob.match(serverRootFile, path)) {
- ret.add(f);
- }
+ File check = new File(path);
+ File root = new File(check.isAbsolute() ? Glob.rootPortion(path) : serverRoot);
+ for (File f :Glob.match(root, path)){
+ ret.add(f);
}
}
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/augeas/AugeasTreeBuilderApache.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/augeas/AugeasTreeBuilderApache.java
index 24c2e95..e6454b7 100644
--- a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/augeas/AugeasTreeBuilderApache.java
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/augeas/AugeasTreeBuilderApache.java
@@ -70,18 +70,16 @@ public class AugeasTreeBuilderApache implements AugeasTreeBuilder {
AugeasNode rootNode = new ApacheAugeasNode(ApacheAugeasTree.AUGEAS_DATA_PATH + rootPath, tree);
tree.setRootNode(rootNode);
- File rootFile = new File(apacheConfig.getServerRootPath());
// we need to know which files are related to each glob
for (String inclName : module.getIncludedGlobs()) {
List<File> files = new ArrayList<File>();
- if (inclName.indexOf(File.separatorChar) == 0) {
- files.add(new File(inclName));
- } else
- files.addAll(Glob.match(rootFile, inclName));
-
+ File check = new File(inclName);
+ File root = new File(check.isAbsolute() ? Glob.rootPortion(inclName) : apacheConfig.getServerRootPath());
+ files.addAll(Glob.match(root, inclName));
+
if (module.getExcludedGlobs() != null)
Glob.excludeAll(files, module.getExcludedGlobs());
diff --git a/modules/plugins/apache/src/test/java/org/rhq/plugins/apache/ApacheAugeasTest.java b/modules/plugins/apache/src/test/java/org/rhq/plugins/apache/ApacheAugeasTest.java
index 344ab1f..88a050b 100644
--- a/modules/plugins/apache/src/test/java/org/rhq/plugins/apache/ApacheAugeasTest.java
+++ b/modules/plugins/apache/src/test/java/org/rhq/plugins/apache/ApacheAugeasTest.java
@@ -3,6 +3,8 @@ package org.rhq.plugins.apache;
import java.io.File;
import java.util.List;
+import net.augeas.Augeas;
+
import org.rhq.augeas.AugeasProxy;
import org.rhq.augeas.node.AugeasNode;
import org.rhq.augeas.tree.AugeasTree;
@@ -120,4 +122,13 @@ public class ApacheAugeasTest {
//test if the updated augeas tree can be mapped to configuration stored at files in "loadconfig" temporary directory
testLoadConfig(treeUpdate, container);
}
+
+ public boolean isAugeasInstalled(){
+ try {
+ Augeas ag = new Augeas();
+ }catch(Throwable e){
+ return false;
+ }
+ return true;
+ }
}
diff --git a/modules/plugins/apache/src/test/java/org/rhq/plugins/apache/ApachePluginTest.java b/modules/plugins/apache/src/test/java/org/rhq/plugins/apache/ApachePluginTest.java
index 890aa10..5a6cc7e 100644
--- a/modules/plugins/apache/src/test/java/org/rhq/plugins/apache/ApachePluginTest.java
+++ b/modules/plugins/apache/src/test/java/org/rhq/plugins/apache/ApachePluginTest.java
@@ -18,18 +18,16 @@
*/
package org.rhq.plugins.apache;
-/*
+
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
-
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.Test;
-
import org.rhq.core.clientapi.server.discovery.InventoryReport;
import org.rhq.core.domain.measurement.DataType;
import org.rhq.core.domain.measurement.MeasurementData;
@@ -43,7 +41,6 @@ import org.rhq.core.pc.plugin.PluginEnvironment;
import org.rhq.core.pc.plugin.PluginManager;
import org.rhq.core.pluginapi.inventory.ResourceComponent;
import org.rhq.core.pluginapi.measurement.MeasurementFacet;
-*/
/**
* The unit tests for the JON Apache plugin.
@@ -53,7 +50,6 @@ import org.rhq.core.pluginapi.measurement.MeasurementFacet;
public class ApachePluginTest {
private static final String PLUGIN_NAME = "Apache";
- /*
@BeforeSuite
public void start() {
//System.out.println("java.class.path=" + System.getProperty("java.class.path"));
@@ -71,6 +67,10 @@ public class ApachePluginTest {
container.getInventoryManager().executeServerScanImmediately();
container.getInventoryManager().executeServiceScanImmediately();
ApacheAugeasTest test = new ApacheAugeasTest();
+ if (!test.isAugeasInstalled()){
+ System.out.println("Augeas is not installed.");
+ return;
+ }
test.testMapping(container);
} catch (Exception e) {
e.printStackTrace();
@@ -153,5 +153,4 @@ public class ApachePluginTest {
ApachePluginTest pluginTest = new ApachePluginTest();
pluginTest.start();
}
- */
-}
\ No newline at end of file
+}
13 years, 6 months
[rhq] modules/enterprise
by Jay Shaughnessy
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java | 15 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java | 43 +--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletHelpWindow.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/help/HelpView.java | 142 ++++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java | 22 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java | 41 +-
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 22 +
7 files changed, 228 insertions(+), 59 deletions(-)
New commits:
commit c2ef722267a5e33172f5c070d5b3d9f263d8727b
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Nov 23 16:01:31 2010 -0500
Changs to global layout
- Add Help as new View
- Move logged in username to top right
- work on footer (in progress)
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
index 229fedc..1fb3d29 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
@@ -41,6 +41,7 @@ import org.rhq.enterprise.gui.coregui.client.admin.AdministrationView;
import org.rhq.enterprise.gui.coregui.client.alert.AlertHistoryView;
import org.rhq.enterprise.gui.coregui.client.bundle.BundleTopView;
import org.rhq.enterprise.gui.coregui.client.dashboard.DashboardsView;
+import org.rhq.enterprise.gui.coregui.client.help.HelpView;
import org.rhq.enterprise.gui.coregui.client.inventory.InventoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.ResourceGroupDetailView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.ResourceGroupTopView;
@@ -192,18 +193,22 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
public Canvas createContent(String breadcrumbName) {
Canvas canvas;
- if (breadcrumbName.equals(AdministrationView.VIEW_ID.getName())) {
- canvas = new AdministrationView();
+ if (breadcrumbName.equals(DashboardsView.VIEW_ID.getName())) {
+ canvas = new DashboardsView(breadcrumbName);
} else if (breadcrumbName.equals(InventoryView.VIEW_ID.getName())) {
canvas = new InventoryView();
} else if (breadcrumbName.equals(ResourceTopView.VIEW_ID.getName())) {
canvas = new ResourceTopView(breadcrumbName);
} else if (breadcrumbName.equals(ResourceGroupTopView.VIEW_ID.getName())) {
canvas = new ResourceGroupTopView(breadcrumbName);
- } else if (breadcrumbName.equals(DashboardsView.VIEW_ID.getName())) {
- canvas = new DashboardsView(breadcrumbName);
+ } else if (breadcrumbName.equals(ReportTopView.VIEW_ID.getName())) {
+ canvas = new ReportTopView();
} else if (breadcrumbName.equals(BundleTopView.VIEW_ID.getName())) {
canvas = new BundleTopView(breadcrumbName);
+ } else if (breadcrumbName.equals(AdministrationView.VIEW_ID.getName())) {
+ canvas = new AdministrationView();
+ } else if (breadcrumbName.equals(HelpView.VIEW_ID.getName())) {
+ canvas = new HelpView();
} else if (breadcrumbName.equals("LogOut")) {
// TODO: don't make LogOut a history event, just perform the logout action by responding to click event
LoginView logoutView = new LoginView("Login");
@@ -214,8 +219,6 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
canvas = new TaggedView(breadcrumbName);
} else if (breadcrumbName.equals("Subsystems")) {
canvas = new AlertHistoryView("Alert");
- } else if (breadcrumbName.equals(ReportTopView.VIEW_ID.getName())) {
- canvas = new ReportTopView();
} else if (breadcrumbName.equals(TestTopView.VIEW_ID.getName())) {
canvas = new TestTopView();
} else {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java
index 1c9e15b..b40d3f7 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java
@@ -56,20 +56,21 @@ public class Footer extends LocatableToolStrip {
protected void onDraw() {
super.onDraw();
- final UserSessionState userSessionState = new UserSessionState("UserSessionState");
+ //final UserSessionState userSessionState = new UserSessionState("UserSessionState");
final MessageCenterView recentMessage = new MessageCenterView(extendLocatorId(MessageCenterView.LOCATOR_ID));
recentMessage.setWidth("*");
final FavoritesButton favoritesButton = new FavoritesButton(extendLocatorId("Favorites"));
final AlertsMessage alertsMessage = new AlertsMessage(extendLocatorId("Alerts"));
- addMember(userSessionState);
+ //addMember(userSessionState);
+ //addMember(new ToolStripSeparator());
+ addMember(favoritesButton);
addMember(new ToolStripSeparator());
addMember(recentMessage);
- addMember(new ToolStripSeparator());
- addMember(favoritesButton);
+
addMember(alertsMessage);
- userSessionState.schedule(15000);
+ //userSessionState.schedule(15000);
alertsMessage.schedule(60000);
}
@@ -110,22 +111,22 @@ public class Footer extends LocatableToolStrip {
}
}
- public static class UserSessionState extends RefreshableLabel {
- public UserSessionState(String locatorId) {
- super(locatorId);
- setWrap(false);
- setMargin(5);
- setValign(VerticalAlignment.CENTER);
- }
-
- public void refreshLoggedIn() {
- setContents(MSG.view_core_loggedInAs(UserSessionManager.getSessionSubject().getName()));
- }
-
- public void refreshLoggedOut() {
- setContents(MSG.view_core_loggedOut());
- }
- }
+ // public static class UserSessionState extends RefreshableLabel {
+ // public UserSessionState(String locatorId) {
+ // super(locatorId);
+ // setWrap(false);
+ // setMargin(5);
+ // setValign(VerticalAlignment.CENTER);
+ // }
+ //
+ // public void refreshLoggedIn() {
+ // setContents(MSG.view_core_loggedInAs(UserSessionManager.getSessionSubject().getName()));
+ // }
+ //
+ // public void refreshLoggedOut() {
+ // setContents(MSG.view_core_loggedOut());
+ // }
+ // }
public static class AlertsMessage extends RefreshableLabel {
public AlertsMessage(String locatorId) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletHelpWindow.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletHelpWindow.java
index 80fe610..3dbd66a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletHelpWindow.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletHelpWindow.java
@@ -53,7 +53,7 @@ public class PortletHelpWindow extends Window {
this.storedPortlet = storedPortlet;
this.view = view;
- setTitle(storedPortlet.getName() + " " + MSG.view_menuBar_help());
+ setTitle(storedPortlet.getName() + " " + MSG.common_title_help());
setOverflow(Overflow.VISIBLE);
// setAutoSize(true);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/help/HelpView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/help/HelpView.java
new file mode 100644
index 0000000..9b306e2
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/help/HelpView.java
@@ -0,0 +1,142 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.help;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.HTMLFlow;
+
+import org.rhq.enterprise.gui.coregui.client.components.AboutModalWindow;
+import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
+import org.rhq.enterprise.gui.coregui.client.components.view.AbstractSectionedLeftNavigationView;
+import org.rhq.enterprise.gui.coregui.client.components.view.NavigationItem;
+import org.rhq.enterprise.gui.coregui.client.components.view.NavigationSection;
+import org.rhq.enterprise.gui.coregui.client.components.view.ViewFactory;
+import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
+
+/**
+ * The Help top-level view.
+ *
+ * @author Jay Shaughnessy
+ */
+public class HelpView extends AbstractSectionedLeftNavigationView {
+ public static final ViewName VIEW_ID = new ViewName("Help", MSG.common_title_help());
+
+ private static final ViewName SECTION_DOC_VIEW_ID = new ViewName("Documentation", MSG
+ .view_helpSection_documentation());
+ private static final ViewName SECTION_TUTORIAL_VIEW_ID = new ViewName("Tutorial", MSG.view_helpSection_tutorial());
+
+ public HelpView() {
+ // This is a top level view, so our locator id can simply be our view id.
+ super(VIEW_ID.getName());
+ }
+
+ @Override
+ protected List<NavigationSection> getNavigationSections() {
+ List<NavigationSection> sections = new ArrayList<NavigationSection>();
+
+ NavigationSection docSection = buildDocSection();
+ sections.add(docSection);
+
+ NavigationSection tutorialSection = buildTutorialSection();
+ sections.add(tutorialSection);
+
+ return sections;
+ }
+
+ @Override
+ protected HTMLFlow defaultView() {
+ String contents = "<h1>" + MSG.common_title_help() + "</h1>\n" + MSG.view_helpTop_description();
+ HTMLFlow flow = new HTMLFlow(contents);
+ flow.setPadding(20);
+ return flow;
+ }
+
+ private NavigationSection buildDocSection() {
+
+ NavigationItem aboutItem = new NavigationItem(new ViewName("AboutBox", MSG.view_help_docAbout()),
+ "[SKIN]/actions/help.png", new ViewFactory() {
+ public Canvas createView() {
+ AboutModalWindow aboutModalWindow = new AboutModalWindow();
+ aboutModalWindow.show();
+ return aboutModalWindow;
+ }
+ });
+
+ NavigationItem docItem = new NavigationItem(new ViewName("TOC", MSG.view_help_docToc()),
+ "[SKIN]/headerIcons/document.png", new ViewFactory() {
+ public Canvas createView() {
+ return new FullHTMLPane(extendLocatorId("TOC"), "http://www.rhq-project.org/display/JOPR2/Home");
+ }
+ });
+
+ NavigationItem faqItem = new NavigationItem(new ViewName("FAQ", MSG.view_help_docFaq()),
+ "[SKIN]/headerIcons/document.png", new ViewFactory() {
+ public Canvas createView() {
+ return new FullHTMLPane(extendLocatorId("FAQ"), "http://www.rhq-project.org/display/JOPR2/FAQ");
+ }
+ });
+
+ return new NavigationSection(SECTION_DOC_VIEW_ID, aboutItem, docItem, faqItem);
+ }
+
+ private NavigationSection buildTutorialSection() {
+
+ NavigationItem searchItem = new NavigationItem(new ViewName("TutorialSearch", MSG.view_help_tutorialSearch()),
+ "[SKIN]/actions/help.png", new ViewFactory() {
+ public Canvas createView() {
+ return new FullHTMLPane(extendLocatorId("TutorialSearch"),
+ "http://www.rhq-project.org/display/JOPR2/Search");
+ }
+ });
+
+ NavigationItem dynaGroupItem = new NavigationItem(new ViewName("TutorialDynaGroup", MSG
+ .view_help_tutorialDynaGroup()), "[SKIN]/actions/help.png", new ViewFactory() {
+ public Canvas createView() {
+ return new FullHTMLPane(
+ extendLocatorId("TutorialDynaGroup"),
+ "http://docs.redhat.com/docs/en-US/JBoss_Operations_Network/2.4/html/Basic...");
+ }
+ });
+
+ NavigationItem demoAllItem = new NavigationItem(new ViewName("DemoAll", MSG.view_help_tutorialDemoAll()),
+ "[SKIN]/actions/help.png", new ViewFactory() {
+ public Canvas createView() {
+ return new FullHTMLPane(extendLocatorId("DemoAll"),
+ "http://www.rhq-project.org/display/JOPR2/Demos");
+ }
+ });
+
+ NavigationItem demoBundleItem = new NavigationItem(new ViewName("DemoBundle", MSG
+ .view_help_tutorialDemoBundle()), "[SKIN]/actions/help.png", new ViewFactory() {
+ public Canvas createView() {
+ return new FullHTMLPane(extendLocatorId("DemoBundle"),
+ "http://mazz.fedorapeople.org/demos/provisioning_beta/prov-beta.htm");
+ }
+ });
+
+ return new NavigationSection(SECTION_TUTORIAL_VIEW_ID, searchItem, dynaGroupItem, demoAllItem, demoBundleItem);
+ }
+}
\ No newline at end of file
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 38bfba0..a87fcc4 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
@@ -31,14 +31,16 @@ import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.toolbar.ToolStrip;
+import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
import org.rhq.enterprise.gui.coregui.client.admin.AdministrationView;
import org.rhq.enterprise.gui.coregui.client.bundle.BundleTopView;
import org.rhq.enterprise.gui.coregui.client.components.AboutModalWindow;
import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
import org.rhq.enterprise.gui.coregui.client.dashboard.DashboardsView;
+import org.rhq.enterprise.gui.coregui.client.help.HelpView;
import org.rhq.enterprise.gui.coregui.client.inventory.InventoryView;
import org.rhq.enterprise.gui.coregui.client.report.ReportTopView;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableImg;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableLabel;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
@@ -49,7 +51,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
public class MenuBarView extends LocatableVLayout {
public static final ViewName[] SECTIONS = { DashboardsView.VIEW_ID, InventoryView.VIEW_ID, ReportTopView.VIEW_ID,
- BundleTopView.VIEW_ID, AdministrationView.VIEW_ID };
+ BundleTopView.VIEW_ID, AdministrationView.VIEW_ID, HelpView.VIEW_ID };
private String currentlySelectedSection = DashboardsView.VIEW_ID.getName();
@@ -138,15 +140,21 @@ public class MenuBarView extends LocatableVLayout {
layout.setMargin(10);
layout.setAlign(Alignment.RIGHT);
- LocatableImg helpImage = new LocatableImg("HelpImage", "[SKIN]/actions/help.png", 16, 16);
- Hyperlink helpLink = SeleniumUtility.setHtmlId(new Hyperlink(MSG.view_menuBar_help(), "Help"));
+ LocatableLabel userLabel = new LocatableLabel(this.extendLocatorId("User"), UserSessionManager
+ .getSessionSubject().getName());
+ userLabel.setAutoWidth();
+
+ LocatableLabel lineLabel = new LocatableLabel(this.extendLocatorId("Line"), " | ");
+ lineLabel.setWidth("10px");
+ lineLabel.setAlign(Alignment.CENTER);
+
Hyperlink logoutLink = SeleniumUtility.setHtmlId(new Hyperlink(MSG.view_menuBar_logout(), "LogOut"));
+ logoutLink.setWidth("1px");
- layout.addMember(helpImage);
- layout.addMember(helpLink);
+ layout.addMember(userLabel);
+ layout.addMember(lineLabel);
layout.addMember(logoutLink);
return layout;
}
-
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java
index 0a3f94c..0b9cf7d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java
@@ -60,7 +60,7 @@ public class MessageCenterView extends LocatableHLayout implements MessageCenter
public MessageCenterView(String locatorId) {
super(locatorId, 5);
setHeight100();
- setAlign(Alignment.LEFT);
+ //setAlign(Alignment.RIGHT);
setAlign(VerticalAlignment.CENTER);
setOverflow(Overflow.HIDDEN);
}
@@ -72,9 +72,8 @@ public class MessageCenterView extends LocatableHLayout implements MessageCenter
final Menu recentEventsMenu = new LocatableMenu(this.extendLocatorId("Messages"));
- IMenuButton recentEventsButton = new LocatableIMenuButton(extendLocatorId("RecentEvents"),
- MSG.view_messageCenter_messageTitle(),
- recentEventsMenu);
+ IMenuButton recentEventsButton = new LocatableIMenuButton(extendLocatorId("RecentEvents"), MSG
+ .view_messageCenter_messageTitle(), recentEventsMenu);
recentEventsButton.setTop(5);
recentEventsButton.setShowMenuBelow(false);
recentEventsButton.setAutoFit(true);
@@ -202,36 +201,36 @@ public class MessageCenterView extends LocatableHLayout implements MessageCenter
// TODO: Format the message better.
String logMessage = message.toString();
switch (message.getSeverity()) {
- case Info:
- Log.info(logMessage);
- break;
- case Warning:
- Log.warn(logMessage);
- break;
- case Error:
- Log.error(logMessage);
- break;
- case Fatal:
- Log.fatal(logMessage);
- break;
+ case Info:
+ Log.info(logMessage);
+ break;
+ case Warning:
+ Log.warn(logMessage);
+ break;
+ case Error:
+ Log.error(logMessage);
+ break;
+ case Fatal:
+ Log.fatal(logMessage);
+ break;
}
}
private String getSeverityIcon(Message.Severity severity) {
String iconSrc = null;
switch (severity) {
- case Info:
+ case Info:
iconSrc = "info/icn_info_blue.png";
break;
- case Warning:
+ case Warning:
iconSrc = "info/icn_info_orange.png";
break;
- case Error:
- case Fatal:
+ case Error:
+ case Fatal:
iconSrc = "info/icn_info_red.png";
break;
}
return iconSrc;
}
-
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index 9cf47f1..a99b4ed 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -101,6 +101,7 @@ common_title_icon = ~
common_title_id = ID~
common_title_id_parent = Parent ID~
common_title_info = Info~
+common_title_help = Help~
common_title_host = Host~
common_title_inventory = Inventory~
common_title_inventorySummary = Inventory Summary~
@@ -1422,6 +1423,22 @@ view_tagCloud_error_tagUsedCount = Tag used {0} times.~
view_taggedResources_title = Tagged Resources~
+#==================== Help ======================
+
+view_help_docAbout = About~
+view_help_docFaq = Frequently Asked Questions (FAQ)~
+view_help_docToc = Documentation~
+view_help_tutorialDemoAll = Demo: All
+view_help_tutorialDemoBundle = Demo: Bundle Provisioning
+view_help_tutorialDynaGroup = How to build Group Definitions
+view_help_tutorialSearch = How to use the Search Bar
+view_helpSection_documentation = Documentation~
+view_helpSection_tutorial = Tutorial~
+view_helpTop_description = This section provides access to documentation, tutorials, version, and other helpful information.~
+
+
+
+
#===================== Test =======================
view_testTop_title = Test~
view_testTop_description = This section contains pages for testing various GUI components.~
@@ -1441,7 +1458,7 @@ view_aboutBox_version = Version:~
# CoreGUI
#--------------
view_core_error_1 = New Alerts lookup failed~
-view_core_loggedInAs = Logged in as {0}~
+#view_core_loggedInAs = Logged in as {0}~
view_core_loggedOut = Logged out~
view_core_recentAlerts = [{0}] recent alerts~
view_core_uncaught = Globally uncaught exception~
@@ -1463,8 +1480,7 @@ view_login_welcomeMsg = Welcome to JBoss ON! <br/><br/> Enter/update the followi
# Menu Bar
#--------------
-view_menuBar_help = Help~
-view_menuBar_logout = Logout~
+view_menuBar_logout = logout~
# Search Bar, GUI
#-----------------
13 years, 6 months
[rhq] 2 commits - modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java | 2 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsDataSource.java | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
New commits:
commit 84305ec29a6ff9adff96ce2b64b2cb7a6cb06d75
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Nov 23 15:45:08 2010 -0500
point to the new gwt template page
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsDataSource.java
index 97acbd2..14f587d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsDataSource.java
@@ -37,6 +37,7 @@ import org.rhq.core.domain.alert.AlertDefinition;
import org.rhq.core.domain.criteria.AlertDefinitionCriteria;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.util.PageControl;
+import org.rhq.enterprise.gui.coregui.client.LinkManager;
/**
* @author John Mazzitelli
@@ -66,10 +67,9 @@ public class ResourceAlertDefinitionsDataSource extends AbstractAlertDefinitions
record.setLinkText("");
record.setAttribute(FIELD_READONLY, MSG.common_val_na());
} else {
- // TODO: fix the URLs so they point to the new GWT pages when they are implemented
if (parentId != null && parentId.intValue() != 0) {
- record.setAttribute(FIELD_PARENT, "/alerts/Config.do?mode=viewRoles&type="
- + this.resource.getResourceType().getId() + "&from=" + from.getId() + "&ad=" + parentId);
+ record.setAttribute(FIELD_PARENT, LinkManager.getAdminTemplatesLink() + "/Alert/"
+ + this.resource.getResourceType().getId());
record.setLinkText(MSG.view_alert_definition_for_type());
} else {
record.setAttribute(FIELD_PARENT, "#ResourceGroup/" + groupAlertDefinition.getResourceGroup().getId()
commit d75f0d38ceee855705f07aec99da1cc7c3ff2243
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Nov 23 15:41:34 2010 -0500
fix the link - it no longer has spaces in it
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java
index 8ab7e32..f425e77 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java
@@ -46,7 +46,7 @@ public class LinkManager {
}
public static String getGroupPluginConfigurationUpdateHistoryLink(int groupId) {
- return getResourceGroupLink(groupId) + "/Inventory/Connection Settings History";
+ return getResourceGroupLink(groupId) + "/Inventory/ConnectionSettingsHistory";
}
public static String getGroupDefinitionLink(int groupDefinitionId) {
13 years, 6 months
[rhq] modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/GeneralProperties.java | 211 ++++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java | 62 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/OverviewView.java | 157 -------
3 files changed, 270 insertions(+), 160 deletions(-)
New commits:
commit 3fa45416a30b70b27ce8662285b05ab776459175
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Nov 23 14:58:46 2010 -0500
move the general properties (aka summary>overview) up to the collapsible area. the summary>overview will become Activity in the future.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/GeneralProperties.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/GeneralProperties.java
new file mode 100644
index 0000000..a945d0d
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/GeneralProperties.java
@@ -0,0 +1,211 @@
+/*
+ * 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;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.widgets.HTMLFlow;
+import com.smartgwt.client.widgets.form.fields.FormItem;
+import com.smartgwt.client.widgets.form.fields.StaticTextItem;
+import com.smartgwt.client.widgets.layout.HLayout;
+
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.group.GroupDefinition;
+import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.LinkManager;
+import org.rhq.enterprise.gui.coregui.client.components.form.EnhancedDynamicForm;
+import org.rhq.enterprise.gui.coregui.client.components.form.TogglableTextItem;
+import org.rhq.enterprise.gui.coregui.client.components.form.ValueUpdatedHandler;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGroupGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+
+/**
+ * A canvas that shows basic information/properties on a specific group.
+ *
+ * @author Ian Springer
+ * @author John Mazzitelli
+ */
+public class GeneralProperties extends LocatableVLayout {
+ private ResourceGroupGWTServiceAsync resourceGroupService = GWTServiceLookup.getResourceGroupService();
+ private ResourceGroupComposite groupComposite;
+
+ public GeneralProperties(String locatorId, ResourceGroupComposite groupComposite) {
+ super(locatorId);
+ this.groupComposite = groupComposite;
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+
+ final ResourceGroup group = this.groupComposite.getResourceGroup();
+
+ HLayout spacer = new HLayout();
+ spacer.setHeight(10);
+ addMember(spacer);
+
+ final EnhancedDynamicForm generalPropsForm = new EnhancedDynamicForm(this.extendLocatorId("General"));
+
+ List<FormItem> formItems = new ArrayList<FormItem>();
+
+ boolean dynamic = (group.getGroupDefinition() != null);
+
+ final FormItem nameItem = (dynamic) ? new StaticTextItem() : new TogglableTextItem();
+ nameItem.setName("name");
+ nameItem.setTitle(MSG.common_title_name());
+ nameItem.setValue(group.getName());
+ if (nameItem instanceof TogglableTextItem) {
+ final TogglableTextItem togglableNameItem = (TogglableTextItem) nameItem;
+ togglableNameItem.addValueUpdatedHandler(new ValueUpdatedHandler() {
+ public void onValueUpdated(final String newName) {
+ final String oldName = group.getName();
+ if (newName.equals(oldName)) {
+ return;
+ }
+ group.setName(newName);
+ GeneralProperties.this.resourceGroupService.updateResourceGroup(group, false,
+ new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+ MSG.view_group_summary_nameUpdateFailure(String.valueOf(group.getId()), oldName,
+ newName), caught);
+ // We failed to update it on the Server, so change back the ResourceGroup and the form item
+ // to the original value.
+ group.setName(oldName);
+ nameItem.setValue(oldName);
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message(MSG.view_group_summary_nameUpdateSuccessful(String.valueOf(group
+ .getId()), oldName, newName), Message.Severity.Info));
+ }
+ });
+ }
+ });
+ }
+ formItems.add(nameItem);
+
+ StaticTextItem typeItem = new StaticTextItem("memberType", MSG.view_group_summary_memberType());
+ ResourceType type = group.getResourceType();
+ if (type != null) {
+ typeItem.setTooltip(MSG.common_title_plugin() + ": " + type.getPlugin() + "\n<br>"
+ + MSG.common_title_type() + ": " + type.getName());
+ typeItem.setValue(type.getName() + " (" + type.getPlugin() + ")");
+ } else {
+ typeItem.setValue("<i>" + MSG.view_group_summary_mixed() + "</i>");
+ }
+ formItems.add(typeItem);
+
+ StaticTextItem countItem = new StaticTextItem("memberCount", MSG.view_group_summary_memberCount());
+ long memberCount = this.groupComposite.getImplicitUp() + this.groupComposite.getImplicitDown();
+ countItem.setValue(memberCount);
+ formItems.add(countItem);
+
+ final FormItem descriptionItem = (dynamic) ? new StaticTextItem() : new TogglableTextItem();
+ descriptionItem.setName("description");
+ descriptionItem.setTitle(MSG.common_title_description());
+ descriptionItem.setValue(group.getDescription());
+ if (descriptionItem instanceof TogglableTextItem) {
+ final TogglableTextItem togglableDescriptionItem = (TogglableTextItem) descriptionItem;
+ togglableDescriptionItem.addValueUpdatedHandler(new ValueUpdatedHandler() {
+ public void onValueUpdated(final String newDescription) {
+ final String oldDescription = group.getDescription();
+ if (newDescription.equals(oldDescription)) {
+ return;
+ }
+ group.setDescription(newDescription);
+ GeneralProperties.this.resourceGroupService.updateResourceGroup(group, false,
+ new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+ MSG.view_group_summary_descUpdateFailure(String.valueOf(group.getId())), caught);
+ // We failed to update it on the Server, so change back the ResourceGroup and the form item
+ // to the original value.
+ group.setDescription(oldDescription);
+ descriptionItem.setValue(oldDescription);
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message(MSG.view_group_summary_descUpdateSuccessful(), Message.Severity.Info));
+ }
+ });
+ }
+ });
+ }
+ formItems.add(descriptionItem);
+
+ StaticTextItem dynamicItem = new StaticTextItem("dynamic", MSG.view_group_summary_dynamic());
+ dynamicItem.setValue(dynamic ? MSG.common_val_yes_lower() : MSG.common_val_no_lower());
+ formItems.add(dynamicItem);
+
+ StaticTextItem recursiveItem = new StaticTextItem("recursive", MSG.view_group_summary_recursive());
+ recursiveItem.setValue((group.isRecursive()) ? MSG.common_val_yes_lower() : MSG.common_val_no_lower());
+ formItems.add(recursiveItem);
+
+ StaticTextItem createdItem = new StaticTextItem("created", MSG.common_title_dateCreated());
+ createdItem.setValue(new Date(group.getCtime()));
+ formItems.add(createdItem);
+
+ StaticTextItem lastModifiedItem = new StaticTextItem("lastModified", MSG.common_title_lastUpdated());
+ lastModifiedItem.setValue(new Date(group.getMtime()));
+ formItems.add(lastModifiedItem);
+
+ StaticTextItem lastModifiedByItem = new StaticTextItem("lastModifiedBy", MSG.common_title_lastUpdatedBy());
+ lastModifiedByItem.setValue(group.getModifiedBy());
+ formItems.add(lastModifiedByItem);
+
+ if (dynamic) {
+ StaticTextItem groupDefinitionItem = new StaticTextItem("groupDefinition", MSG
+ .view_group_summary_groupDefinition());
+ GroupDefinition groupDefinition = group.getGroupDefinition();
+ String groupDefinitionUrl = LinkManager.getGroupDefinitionLink(groupDefinition.getId());
+ groupDefinitionItem
+ .setValue("<a href=\"" + groupDefinitionUrl + "\">" + groupDefinition.getName() + "</a>");
+ formItems.add(groupDefinitionItem);
+ }
+
+ generalPropsForm.setItems(formItems.toArray(new FormItem[formItems.size()]));
+ addMember(generalPropsForm);
+
+ if (dynamic) {
+ spacer = new HLayout();
+ spacer.setHeight(10);
+ addMember(spacer);
+
+ HTMLFlow note = new HTMLFlow();
+ note.setContents("<b>*</b> " + MSG.view_group_summary_dynamicNote());
+ note.setAlign(Alignment.CENTER);
+ addMember(note);
+ }
+
+ HLayout spacer2 = new HLayout();
+ spacer2.setHeight(10);
+ addMember(spacer2);
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java
index c99e1ca..bdf3fda 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java
@@ -23,6 +23,7 @@ import java.util.LinkedHashSet;
import java.util.Set;
import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.types.VerticalAlignment;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.Img;
@@ -33,6 +34,7 @@ import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.criteria.ResourceGroupCriteria;
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.core.domain.tagging.Tag;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
@@ -43,22 +45,26 @@ import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableImg;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
* @author Greg Hinkle
* @author Ian Springer
*/
-public class ResourceGroupTitleBar extends LocatableHLayout {
+public class ResourceGroupTitleBar extends LocatableVLayout {
private static final String FAV_ICON = "Favorite_24_Selected.png";
private static final String NOT_FAV_ICON = "Favorite_24.png";
private ResourceGroup group;
+ private ResourceGroupComposite groupComposite;
+ private Img expandCollapseArrow;
private Img badge;
private Img favoriteButton;
private HTMLFlow title;
private Img availabilityImage;
private boolean favorite;
+ private GeneralProperties generalProperties;
public ResourceGroupTitleBar(String locatorId) {
super(locatorId);
@@ -73,6 +79,9 @@ public class ResourceGroupTitleBar extends LocatableHLayout {
child.destroy();
}
+ final LocatableHLayout hlayout = new LocatableHLayout(extendLocatorId("hlayout"));
+ addMember(hlayout);
+
this.title = new HTMLFlow();
this.title.setWidth("*");
@@ -87,6 +96,46 @@ public class ResourceGroupTitleBar extends LocatableHLayout {
}
});
+ expandCollapseArrow = new Img("[SKIN]/ListGrid/row_collapsed.png", 16, 16);
+ expandCollapseArrow.setLayoutAlign(VerticalAlignment.BOTTOM);
+ ResourceGroupCriteria criteria = new ResourceGroupCriteria();
+ criteria.addFilterId(this.group.getId());
+ GWTServiceLookup.getResourceGroupService().findResourceGroupCompositesByCriteria(criteria,
+ new AsyncCallback<PageList<ResourceGroupComposite>>() {
+ @Override
+ public void onSuccess(PageList<ResourceGroupComposite> result) {
+ if (result == null || result.size() != 1) {
+ CoreGUI.getErrorHandler().handleError(
+ "Failed to get general info on group [" + group.getName() + "]");
+ return;
+ }
+ generalProperties = new GeneralProperties(extendLocatorId("genProps"), result.get(0));
+ generalProperties.setVisible(false);
+ ResourceGroupTitleBar.this.addMember(generalProperties);
+ expandCollapseArrow.addClickHandler(new ClickHandler() {
+ private boolean collapsed = true;
+
+ @Override
+ public void onClick(ClickEvent event) {
+ collapsed = !collapsed;
+ if (collapsed) {
+ expandCollapseArrow.setSrc("[SKIN]/ListGrid/row_collapsed.png");
+ generalProperties.hide();
+ } else {
+ expandCollapseArrow.setSrc("[SKIN]/ListGrid/row_expanded.png");
+ generalProperties.show();
+ }
+ ResourceGroupTitleBar.this.markForRedraw();
+ }
+ });
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Cannot load group properties info", caught);
+ }
+ });
+
badge = new Img("types/Service_up_24.png", 24, 24);
TagEditorView tagEditorView = new TagEditorView(extendLocatorId("Editor"), group.getTags(), false,
@@ -112,11 +161,12 @@ public class ResourceGroupTitleBar extends LocatableHLayout {
loadTags(tagEditorView);
- addMember(badge);
- addMember(title);
- addMember(tagEditorView);
- addMember(availabilityImage);
- addMember(favoriteButton);
+ hlayout.addMember(expandCollapseArrow);
+ hlayout.addMember(badge);
+ hlayout.addMember(title);
+ hlayout.addMember(tagEditorView);
+ hlayout.addMember(availabilityImage);
+ hlayout.addMember(favoriteButton);
}
private void loadTags(final TagEditorView tagEditorView) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/OverviewView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/OverviewView.java
index 53809d5..f848f36 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/OverviewView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/OverviewView.java
@@ -18,29 +18,13 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.summary;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.widgets.HTMLFlow;
-import com.smartgwt.client.widgets.form.fields.FormItem;
-import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.layout.HLayout;
-import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.domain.resource.group.GroupDefinition;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.LinkManager;
-import org.rhq.enterprise.gui.coregui.client.components.form.EnhancedDynamicForm;
-import org.rhq.enterprise.gui.coregui.client.components.form.TogglableTextItem;
-import org.rhq.enterprise.gui.coregui.client.components.form.ValueUpdatedHandler;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGroupGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
@@ -67,143 +51,8 @@ public class OverviewView extends LocatableVLayout {
spacer.setHeight(15);
addMember(spacer);
- final EnhancedDynamicForm generalPropsForm = new EnhancedDynamicForm(this.extendLocatorId("General"));
-
- List<FormItem> formItems = new ArrayList<FormItem>();
-
- // TODO: Uncomment the below header if we decide to add other stuff to this page besides the general props.
- //HeaderItem headerItem = new HeaderItem("header", "General Properties");
- //headerItem.setValue("General Properties");
- //formItems.add(headerItem);
-
- boolean dynamic = (group.getGroupDefinition() != null);
-
- final FormItem nameItem = (dynamic) ? new StaticTextItem() : new TogglableTextItem();
- nameItem.setName("name");
- nameItem.setTitle(MSG.common_title_name());
- nameItem.setValue(group.getName());
- if (nameItem instanceof TogglableTextItem) {
- final TogglableTextItem togglableNameItem = (TogglableTextItem) nameItem;
- togglableNameItem.addValueUpdatedHandler(new ValueUpdatedHandler() {
- public void onValueUpdated(final String newName) {
- final String oldName = group.getName();
- if (newName.equals(oldName)) {
- return;
- }
- group.setName(newName);
- OverviewView.this.resourceGroupService.updateResourceGroup(group, false, new AsyncCallback<Void>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(
- MSG.view_group_summary_nameUpdateFailure(String.valueOf(group.getId()), oldName,
- newName), caught);
- // We failed to update it on the Server, so change back the ResourceGroup and the form item
- // to the original value.
- group.setName(oldName);
- nameItem.setValue(oldName);
- }
-
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(
- new Message(MSG.view_group_summary_nameUpdateSuccessful(String.valueOf(group.getId()),
- oldName, newName), Message.Severity.Info));
- }
- });
- }
- });
- }
- formItems.add(nameItem);
-
- StaticTextItem typeItem = new StaticTextItem("memberType", MSG.view_group_summary_memberType());
- ResourceType type = group.getResourceType();
- if (type != null) {
- typeItem.setTooltip(MSG.common_title_plugin() + ": " + type.getPlugin() + "\n<br>"
- + MSG.common_title_type() + ": " + type.getName());
- typeItem.setValue(type.getName() + " (" + type.getPlugin() + ")");
- } else {
- typeItem.setValue("<i>" + MSG.view_group_summary_mixed() + "</i>");
- }
- formItems.add(typeItem);
-
- StaticTextItem countItem = new StaticTextItem("memberCount", MSG.view_group_summary_memberCount());
- long memberCount = this.groupComposite.getImplicitUp() + this.groupComposite.getImplicitDown();
- countItem.setValue(memberCount);
- formItems.add(countItem);
-
- final FormItem descriptionItem = (dynamic) ? new StaticTextItem() : new TogglableTextItem();
- descriptionItem.setName("description");
- descriptionItem.setTitle(MSG.common_title_description());
- descriptionItem.setValue(group.getDescription());
- if (descriptionItem instanceof TogglableTextItem) {
- final TogglableTextItem togglableDescriptionItem = (TogglableTextItem) descriptionItem;
- togglableDescriptionItem.addValueUpdatedHandler(new ValueUpdatedHandler() {
- public void onValueUpdated(final String newDescription) {
- final String oldDescription = group.getDescription();
- if (newDescription.equals(oldDescription)) {
- return;
- }
- group.setDescription(newDescription);
- OverviewView.this.resourceGroupService.updateResourceGroup(group, false, new AsyncCallback<Void>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(
- MSG.view_group_summary_descUpdateFailure(String.valueOf(group.getId())), caught);
- // We failed to update it on the Server, so change back the ResourceGroup and the form item
- // to the original value.
- group.setDescription(oldDescription);
- descriptionItem.setValue(oldDescription);
- }
-
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(
- new Message(MSG.view_group_summary_descUpdateSuccessful(), Message.Severity.Info));
- }
- });
- }
- });
- }
- formItems.add(descriptionItem);
-
- StaticTextItem dynamicItem = new StaticTextItem("dynamic", MSG.view_group_summary_dynamic());
- dynamicItem.setValue(dynamic ? MSG.common_val_yes_lower() : MSG.common_val_no_lower());
- formItems.add(dynamicItem);
-
- StaticTextItem recursiveItem = new StaticTextItem("recursive", MSG.view_group_summary_recursive());
- recursiveItem.setValue((group.isRecursive()) ? MSG.common_val_yes_lower() : MSG.common_val_no_lower());
- formItems.add(recursiveItem);
-
- StaticTextItem createdItem = new StaticTextItem("created", MSG.common_title_dateCreated());
- createdItem.setValue(new Date(group.getCtime()));
- formItems.add(createdItem);
-
- StaticTextItem lastModifiedItem = new StaticTextItem("lastModified", MSG.common_title_lastUpdated());
- lastModifiedItem.setValue(new Date(group.getMtime()));
- formItems.add(lastModifiedItem);
-
- StaticTextItem lastModifiedByItem = new StaticTextItem("lastModifiedBy", MSG.common_title_lastUpdatedBy());
- lastModifiedByItem.setValue(group.getModifiedBy());
- formItems.add(lastModifiedByItem);
-
- if (dynamic) {
- StaticTextItem groupDefinitionItem = new StaticTextItem("groupDefinition", MSG
- .view_group_summary_groupDefinition());
- GroupDefinition groupDefinition = group.getGroupDefinition();
- String groupDefinitionUrl = LinkManager.getGroupDefinitionLink(groupDefinition.getId());
- groupDefinitionItem
- .setValue("<a href=\"" + groupDefinitionUrl + "\">" + groupDefinition.getName() + "</a>");
- formItems.add(groupDefinitionItem);
- }
-
- generalPropsForm.setItems(formItems.toArray(new FormItem[formItems.size()]));
- addMember(generalPropsForm);
-
- if (dynamic) {
- spacer = new HLayout();
- spacer.setHeight(10);
- addMember(spacer);
-
- HTMLFlow note = new HTMLFlow();
- note.setContents("<b>*</b> " + MSG.view_group_summary_dynamicNote());
- note.setAlign(Alignment.CENTER);
- addMember(note);
- }
+ // TODO
+ HTMLFlow html = new HTMLFlow("Activity information will go here");
+ addMember(html);
}
}
13 years, 6 months