[rhq] Branch 'delete-agent-plugin' - modules/enterprise
by John Sanda
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementViewManagerTest.java | 1 +
1 file changed, 1 insertion(+)
New commits:
commit decd2b92d5a0e74e56dbc7bab450dd5501a961b0
Author: John Sanda <jsanda(a)redhat.com>
Date: Thu Dec 16 22:49:16 2010 -0500
Fixing compiler error that happened from last merge
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementViewManagerTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementViewManagerTest.java
index b4eeecf..d1a2ba1 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementViewManagerTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementViewManagerTest.java
@@ -6,6 +6,7 @@ import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.Query;
+import org.testng.annotations.AfterMethod;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
13 years, 6 months
[rhq] 2 commits - modules/enterprise
by mazz
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerBean.java | 16 ++--------
1 file changed, 4 insertions(+), 12 deletions(-)
New commits:
commit e7fb3d8b0e17089282e53c6a9e6d6690bb3286fd
Merge: 0496649... c761fd5...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Dec 16 21:56:07 2010 -0500
Merge branch 'master' of ssh://git.fedorahosted.org/git/rhq/rhq.git
commit 049664958db392c360a6b9969241d9dad6dbd032
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Dec 16 21:55:48 2010 -0500
modifying bundle tags requires MANAGE_BUNDLE perm
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerBean.java
index a66166f..a7e05a2 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerBean.java
@@ -69,12 +69,8 @@ public class TagManagerBean implements TagManagerLocal, TagManagerRemote {
private AuthorizationManagerLocal authorizationManager;
public PageList<Tag> findTagsByCriteria(Subject subject, TagCriteria criteria) {
-
CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject, criteria);
- ;
-
CriteriaQueryRunner<Tag> queryRunner = new CriteriaQueryRunner<Tag>(criteria, generator, entityManager);
-
return queryRunner.execute();
}
@@ -145,8 +141,7 @@ public class TagManagerBean implements TagManagerLocal, TagManagerRemote {
}
}
- @RequiredPermission(Permission.MANAGE_INVENTORY)
- // todo verify
+ @RequiredPermission(Permission.MANAGE_BUNDLE)
public void updateBundleTags(Subject subject, int bundleId, Set<Tag> tags) {
Set<Tag> definedTags = addTags(subject, tags);
@@ -163,8 +158,7 @@ public class TagManagerBean implements TagManagerLocal, TagManagerRemote {
}
}
- @RequiredPermission(Permission.MANAGE_INVENTORY)
- // todo verify
+ @RequiredPermission(Permission.MANAGE_BUNDLE)
public void updateBundleVersionTags(Subject subject, int bundleVersionId, Set<Tag> tags) {
Set<Tag> definedTags = addTags(subject, tags);
@@ -181,8 +175,7 @@ public class TagManagerBean implements TagManagerLocal, TagManagerRemote {
}
}
- @RequiredPermission(Permission.MANAGE_INVENTORY)
- // todo verify
+ @RequiredPermission(Permission.MANAGE_BUNDLE)
public void updateBundleDeploymentTags(Subject subject, int bundleDeploymentId, Set<Tag> tags) {
Set<Tag> definedTags = addTags(subject, tags);
@@ -199,8 +192,7 @@ public class TagManagerBean implements TagManagerLocal, TagManagerRemote {
}
}
- @RequiredPermission(Permission.MANAGE_INVENTORY)
- // todo verify
+ @RequiredPermission(Permission.MANAGE_BUNDLE)
public void updateBundleDestinationTags(Subject subject, int bundleDestinationId, Set<Tag> tags) {
Set<Tag> definedTags = addTags(subject, tags);
13 years, 6 months
[rhq] modules/core modules/enterprise
by ips
modules/core/domain/src/main/java/org/rhq/core/domain/common/JobTrigger.java | 298 ++++++++++
modules/core/domain/src/main/java/org/rhq/core/domain/common/Trigger.java | 298 ----------
modules/core/domain/src/main/java/org/rhq/core/domain/operation/bean/OperationSchedule.java | 10
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/OperationGWTService.java | 11
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationScheduleCompositeDataSource.java | 74 --
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationScheduleDataSource.java | 115 +++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationScheduleListView.java | 17
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java | 10
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/schedule/ResourceOperationScheduleDataSource.java | 68 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/schedule/ResourceOperationScheduleListView.java | 52 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/OperationGWTServiceImpl.java | 27
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerBean.java | 90 ++-
13 files changed, 680 insertions(+), 392 deletions(-)
New commits:
commit c761fd50323d94e0a4d717ef885464c86959dfc8
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Thu Dec 16 19:55:54 2010 -0500
first rough cut of GWT-based resource Operations>Schedule subtab
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/common/JobTrigger.java b/modules/core/domain/src/main/java/org/rhq/core/domain/common/JobTrigger.java
new file mode 100644
index 0000000..b3a8b48
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/common/JobTrigger.java
@@ -0,0 +1,298 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * 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.core.domain.common;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * Indicates when a particular job (e.g. invocation of an RHQ Agent plugin operation) should execute.
+ * Note, all constructors of this class are private - the create*Trigger() static factory methods
+ * must be used to create instances.
+ *
+ * @author Ian Springer
+ */
+public class JobTrigger implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ // Together, the startType, recurrenceType, and endType define what type of trigger this is.
+ // For the remaining fields in this class, only those that apply to the trigger's type will have non-null values.
+ private StartType startType;
+ private RecurrenceType recurrenceType;
+ // Note, this field will be null when recurrenceType=NONE, since it's not applicable in that case.
+ private EndType endType;
+
+ // Fields used by startType=DATETIME triggers
+ private Date startDate;
+
+ // Fields used by recurrenceType=REPEAT_INTERVAL triggers
+ private Long repeatInterval;
+ // endDate and repeatCount are mutually exclusive - only one can have a non-null value;
+ // if both are null, the repetition is indefinite.
+ private Date endDate;
+ private Integer repeatCount;
+
+ // Fields used by recurrenceType=CRON_EXPRESSION triggers
+ private String cronExpression;
+
+ public enum StartType {
+ /**
+ * Start the initial run now.
+ */
+ NOW,
+ /**
+ * Start the initial run at a specified date-time in the future.
+ */
+ DATETIME;
+ }
+
+ public enum RecurrenceType {
+ /**
+ * No recurrence - just run once.
+ */
+ NONE,
+ /**
+ * Run every n seconds, starting at the start time of the initial run.
+ */
+ REPEAT_INTERVAL,
+ /**
+ * Run on a schedule based on the specified cron expression. The expression must follow
+ * <a href="http://www.quartz-scheduler.org/docs/tutorials/crontrigger.html">Quartz
+ * cron expression syntax</a>, which is a bit different than Unix cron expression syntax.
+ */
+ CRON_EXPRESSION;
+ }
+
+ public enum EndType {
+ /**
+ * No end - recurrence is indefinite.
+ */
+ NEVER,
+ /**
+ * End recurrence at a specified date/time in the future.
+ */
+ DATETIME,
+ /**
+ * End recurrence after n repetitions.
+ */
+ REPEAT_COUNT;
+ }
+
+ public StartType getStartType() {
+ return startType;
+ }
+
+ public EndType getEndType() {
+ return endType;
+ }
+
+ public RecurrenceType getRecurrenceType() {
+ return recurrenceType;
+ }
+
+ public Date getStartDate() {
+ return startDate;
+ }
+
+ public Long getRepeatInterval() {
+ return repeatInterval;
+ }
+
+ public String getCronExpression() {
+ return cronExpression;
+ }
+
+ public Date getEndDate() {
+ return endDate;
+ }
+
+ public Integer getRepeatCount() {
+ return repeatCount;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("Trigger");
+ sb.append("[cronExpression='").append(cronExpression).append('\'');
+ sb.append(", startType=").append(startType);
+ sb.append(", recurrenceType=").append(recurrenceType);
+ sb.append(", endType=").append(endType);
+ sb.append(", startDate=").append(startDate);
+ sb.append(", repeatInterval=").append(repeatInterval);
+ sb.append(", endDate=").append(endDate);
+ sb.append(", repeatCount=").append(repeatCount);
+ sb.append(']');
+ return sb.toString();
+ }
+
+ /**
+ * Create a trigger that will run now, once.
+ *
+ * @return a trigger that will run now, once
+ */
+ public static JobTrigger createNowTrigger() {
+ return new JobTrigger();
+ }
+
+ /**
+ * Create a trigger that will run now and repeat on interval indefinitely.
+ *
+ * @return a trigger that will run now and repeat on interval indefinitely
+ */
+ public static JobTrigger createNowAndRepeatTrigger(long repeatInterval) {
+ return new JobTrigger(repeatInterval);
+ }
+
+ /**
+ * Create a trigger that will run now and repeat on interval until end date/time.
+ *
+ * @return a trigger that will run now and repeat on interval until end date/time
+ */
+ public static JobTrigger createNowAndRepeatTrigger(long repeatInterval, Date endDate) {
+ return new JobTrigger(repeatInterval, endDate);
+ }
+
+ /**
+ * Create a trigger that will run now and repeat on interval n times.
+ *
+ * @return a trigger that will run now and repeat on interval n times
+ */
+ public static JobTrigger createNowAndRepeatTrigger(long repeatInterval, int repeatCount) {
+ return new JobTrigger(repeatInterval, repeatCount);
+ }
+
+ /**
+ * Create a trigger that will run at specified date/time, once.
+ *
+ * @return a trigger that will run at specified date/time, once
+ */
+ public static JobTrigger createLaterTrigger(Date startDate) {
+ return new JobTrigger(startDate);
+ }
+
+ /**
+ * Create a trigger that will run at specified date/time and then repeat on interval indefinitely.
+ *
+ * @return a trigger that will run at specified date/time and then repeat on interval indefinitely
+ */
+ public static JobTrigger createLaterAndRepeatTrigger(Date startDate, long repeatInterval) {
+ return new JobTrigger(startDate, repeatInterval);
+ }
+
+ /**
+ * Create a trigger that will run at specified date/time and then repeat on interval until end date/time.
+ *
+ * @return a trigger that will run at specified date/time and then repeat on interval until end date/time
+ */
+ public static JobTrigger createLaterAndRepeatTrigger(Date startDate, long repeatInterval, Date endDate) {
+ return new JobTrigger(startDate, repeatInterval, endDate);
+ }
+
+ /**
+ * Create a trigger that will run at specified date/time and then repeat on interval n times.
+ *
+ * @return a trigger that will run at specified date/time and then repeat on interval n times
+ */
+ public static JobTrigger createLaterAndRepeatTrigger(Date startDate, long repeatInterval, int repeatCount) {
+ return new JobTrigger(startDate, repeatInterval, repeatCount);
+ }
+
+ /**
+ * Create a trigger that will run on the schedule specified by a cron expression. The expression must follow
+ * <a href="http://www.quartz-scheduler.org/docs/tutorials/crontrigger.html">Quartz
+ * cron expression syntax</a>, which is a bit different than Unix cron expression syntax.
+ *
+ * @return a trigger that will run on the schedule specified by a cron expression
+ */
+ public static JobTrigger createCronTrigger(String cronExpression) {
+ return new JobTrigger(cronExpression);
+ }
+
+
+ private JobTrigger(StartType startType, RecurrenceType recurrenceType, EndType endType) {
+ this.startType = startType;
+ this.recurrenceType = recurrenceType;
+ this.endType = endType;
+ }
+
+ // run now, once
+ private JobTrigger() {
+ this(StartType.NOW, RecurrenceType.NONE, null);
+ }
+
+ // run now and repeat on interval indefinitely
+ private JobTrigger(long repeatInterval) {
+ this(StartType.NOW, RecurrenceType.REPEAT_INTERVAL, EndType.REPEAT_COUNT);
+ this.repeatInterval = repeatInterval;
+ }
+
+ // run now and repeat on interval until end date/time
+ private JobTrigger(long repeatInterval, Date endDate) {
+ this(StartType.NOW, RecurrenceType.REPEAT_INTERVAL, EndType.DATETIME);
+ this.repeatInterval = repeatInterval;
+ this.endDate = endDate;
+ }
+
+ // run now and repeat on interval n times
+ private JobTrigger(long repeatInterval, int repeatCount) {
+ this(StartType.NOW, RecurrenceType.REPEAT_INTERVAL, EndType.REPEAT_COUNT);
+ this.repeatInterval = repeatInterval;
+ this.repeatCount = repeatCount;
+ }
+
+ // run at specified date/time, once
+ private JobTrigger(Date startDate) {
+ this(StartType.DATETIME, RecurrenceType.NONE, EndType.REPEAT_COUNT);
+ this.startDate = startDate;
+ this.repeatCount = 1;
+ }
+
+ // run at specified date/time and then repeat on interval indefinitely
+ private JobTrigger(Date startDate, long repeatInterval) {
+ this(StartType.DATETIME, RecurrenceType.REPEAT_INTERVAL, EndType.NEVER);
+ this.startDate = startDate;
+ this.repeatInterval = repeatInterval;
+ }
+
+ // run at specified date/time and then repeat on interval until end date/time
+ private JobTrigger(Date startDate, long repeatInterval, Date endDate) {
+ this(StartType.DATETIME, RecurrenceType.REPEAT_INTERVAL, EndType.DATETIME);
+ this.startDate = startDate;
+ this.repeatInterval = repeatInterval;
+ this.endDate = endDate;
+ }
+
+ // run at specified date/time and then repeat on interval n times
+ private JobTrigger(Date startDate, long repeatInterval, int repeatCount) {
+ this(StartType.DATETIME, RecurrenceType.REPEAT_INTERVAL, EndType.REPEAT_COUNT);
+ this.startDate = startDate;
+ this.repeatInterval = repeatInterval;
+ this.repeatCount = repeatCount;
+ }
+
+ // run on the schedule specified by cron expression
+ private JobTrigger(String cronExpression) {
+ this(StartType.NOW, RecurrenceType.CRON_EXPRESSION, EndType.NEVER);
+ this.cronExpression = cronExpression;
+ }
+
+}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/common/Trigger.java b/modules/core/domain/src/main/java/org/rhq/core/domain/common/Trigger.java
deleted file mode 100644
index da58047..0000000
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/common/Trigger.java
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * 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.core.domain.common;
-
-import java.io.Serializable;
-import java.util.Date;
-
-/**
- * Indicates when a particular job (e.g. invocation of an RHQ Agent plugin operation) should execute.
- * Note, all constructors of this class are private - the create*Trigger() static factory methods
- * must be used to create instances.
- *
- * @author Ian Springer
- */
-public class Trigger implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- // Together, the startType, recurrenceType, and endType define what type of trigger this is.
- // For the remaining fields in this class, only those that apply to the trigger's type will have non-null values.
- private StartType startType;
- private RecurrenceType recurrenceType;
- // Note, this field will be null when recurrenceType=NONE, since it's not applicable in that case.
- private EndType endType;
-
- // Fields used by startType=DATETIME triggers
- private Date startDate;
-
- // Fields used by recurrenceType=REPEAT_INTERVAL triggers
- private Long repeatInterval;
- // endDate and repeatCount are mutually exclusive - only one can have a non-null value;
- // if both are null, the repetition is indefinite.
- private Date endDate;
- private Integer repeatCount;
-
- // Fields used by recurrenceType=CRON_EXPRESSION triggers
- private String cronExpression;
-
- public enum StartType {
- /**
- * Start the initial run now.
- */
- NOW,
- /**
- * Start the initial run at a specified date-time in the future.
- */
- DATETIME;
- }
-
- public enum RecurrenceType {
- /**
- * No recurrence - just run once.
- */
- NONE,
- /**
- * Run every n seconds, starting at the start time of the initial run.
- */
- REPEAT_INTERVAL,
- /**
- * Run on a schedule based on the specified cron expression. The expression must follow
- * <a href="http://www.quartz-scheduler.org/docs/tutorials/crontrigger.html">Quartz
- * cron expression syntax</a>, which is a bit different than Unix cron expression syntax.
- */
- CRON_EXPRESSION;
- }
-
- public enum EndType {
- /**
- * No end - recurrence is indefinite.
- */
- NEVER,
- /**
- * End recurrence at a specified date/time in the future.
- */
- DATETIME,
- /**
- * End recurrence after n repetitions.
- */
- REPEAT_COUNT;
- }
-
- public StartType getStartType() {
- return startType;
- }
-
- public EndType getEndType() {
- return endType;
- }
-
- public RecurrenceType getRecurrenceType() {
- return recurrenceType;
- }
-
- public Date getStartDate() {
- return startDate;
- }
-
- public Long getRepeatInterval() {
- return repeatInterval;
- }
-
- public String getCronExpression() {
- return cronExpression;
- }
-
- public Date getEndDate() {
- return endDate;
- }
-
- public Integer getRepeatCount() {
- return repeatCount;
- }
-
- @Override
- public String toString() {
- final StringBuilder sb = new StringBuilder();
- sb.append("Trigger");
- sb.append("[cronExpression='").append(cronExpression).append('\'');
- sb.append(", startType=").append(startType);
- sb.append(", recurrenceType=").append(recurrenceType);
- sb.append(", endType=").append(endType);
- sb.append(", startDate=").append(startDate);
- sb.append(", repeatInterval=").append(repeatInterval);
- sb.append(", endDate=").append(endDate);
- sb.append(", repeatCount=").append(repeatCount);
- sb.append(']');
- return sb.toString();
- }
-
- /**
- * Create a trigger that will run now, once.
- *
- * @return a trigger that will run now, once
- */
- public static Trigger createNowTrigger() {
- return new Trigger();
- }
-
- /**
- * Create a trigger that will run now and repeat on interval indefinitely.
- *
- * @return a trigger that will run now and repeat on interval indefinitely
- */
- public static Trigger createNowAndRepeatTrigger(long repeatInterval) {
- return new Trigger(repeatInterval);
- }
-
- /**
- * Create a trigger that will run now and repeat on interval until end date/time.
- *
- * @return a trigger that will run now and repeat on interval until end date/time
- */
- public static Trigger createNowAndRepeatTrigger(long repeatInterval, Date endDate) {
- return new Trigger(repeatInterval, endDate);
- }
-
- /**
- * Create a trigger that will run now and repeat on interval n times.
- *
- * @return a trigger that will run now and repeat on interval n times
- */
- public static Trigger createNowAndRepeatTrigger(long repeatInterval, int repeatCount) {
- return new Trigger(repeatInterval, repeatCount);
- }
-
- /**
- * Create a trigger that will run at specified date/time, once.
- *
- * @return a trigger that will run at specified date/time, once
- */
- public static Trigger createLaterTrigger(Date startDate) {
- return new Trigger(startDate);
- }
-
- /**
- * Create a trigger that will run at specified date/time and then repeat on interval indefinitely.
- *
- * @return a trigger that will run at specified date/time and then repeat on interval indefinitely
- */
- public static Trigger createLaterAndRepeatTrigger(Date startDate, long repeatInterval) {
- return new Trigger(startDate, repeatInterval);
- }
-
- /**
- * Create a trigger that will run at specified date/time and then repeat on interval until end date/time.
- *
- * @return a trigger that will run at specified date/time and then repeat on interval until end date/time
- */
- public static Trigger createLaterAndRepeatTrigger(Date startDate, long repeatInterval, Date endDate) {
- return new Trigger(startDate, repeatInterval, endDate);
- }
-
- /**
- * Create a trigger that will run at specified date/time and then repeat on interval n times.
- *
- * @return a trigger that will run at specified date/time and then repeat on interval n times
- */
- public static Trigger createLaterAndRepeatTrigger(Date startDate, long repeatInterval, int repeatCount) {
- return new Trigger(startDate, repeatInterval, repeatCount);
- }
-
- /**
- * Create a trigger that will run on the schedule specified by a cron expression. The expression must follow
- * <a href="http://www.quartz-scheduler.org/docs/tutorials/crontrigger.html">Quartz
- * cron expression syntax</a>, which is a bit different than Unix cron expression syntax.
- *
- * @return a trigger that will run on the schedule specified by a cron expression
- */
- public static Trigger createCronTrigger(String cronExpression) {
- return new Trigger(cronExpression);
- }
-
-
- private Trigger(StartType startType, RecurrenceType recurrenceType, EndType endType) {
- this.startType = startType;
- this.recurrenceType = recurrenceType;
- this.endType = endType;
- }
-
- // run now, once
- private Trigger() {
- this(StartType.NOW, RecurrenceType.NONE, null);
- }
-
- // run now and repeat on interval indefinitely
- private Trigger(long repeatInterval) {
- this(StartType.NOW, RecurrenceType.REPEAT_INTERVAL, EndType.REPEAT_COUNT);
- this.repeatInterval = repeatInterval;
- }
-
- // run now and repeat on interval until end date/time
- private Trigger(long repeatInterval, Date endDate) {
- this(StartType.NOW, RecurrenceType.REPEAT_INTERVAL, EndType.DATETIME);
- this.repeatInterval = repeatInterval;
- this.endDate = endDate;
- }
-
- // run now and repeat on interval n times
- private Trigger(long repeatInterval, int repeatCount) {
- this(StartType.NOW, RecurrenceType.REPEAT_INTERVAL, EndType.REPEAT_COUNT);
- this.repeatInterval = repeatInterval;
- this.repeatCount = repeatCount;
- }
-
- // run at specified date/time, once
- private Trigger(Date startDate) {
- this(StartType.DATETIME, RecurrenceType.NONE, EndType.REPEAT_COUNT);
- this.startDate = startDate;
- this.repeatCount = 1;
- }
-
- // run at specified date/time and then repeat on interval indefinitely
- private Trigger(Date startDate, long repeatInterval) {
- this(StartType.DATETIME, RecurrenceType.REPEAT_INTERVAL, EndType.NEVER);
- this.startDate = startDate;
- this.repeatInterval = repeatInterval;
- }
-
- // run at specified date/time and then repeat on interval until end date/time
- private Trigger(Date startDate, long repeatInterval, Date endDate) {
- this(StartType.DATETIME, RecurrenceType.REPEAT_INTERVAL, EndType.DATETIME);
- this.startDate = startDate;
- this.repeatInterval = repeatInterval;
- this.endDate = endDate;
- }
-
- // run at specified date/time and then repeat on interval n times
- private Trigger(Date startDate, long repeatInterval, int repeatCount) {
- this(StartType.DATETIME, RecurrenceType.REPEAT_INTERVAL, EndType.REPEAT_COUNT);
- this.startDate = startDate;
- this.repeatInterval = repeatInterval;
- this.repeatCount = repeatCount;
- }
-
- // run on the schedule specified by cron expression
- private Trigger(String cronExpression) {
- this(StartType.NOW, RecurrenceType.CRON_EXPRESSION, EndType.NEVER);
- this.cronExpression = cronExpression;
- }
-
-}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/operation/bean/OperationSchedule.java b/modules/core/domain/src/main/java/org/rhq/core/domain/operation/bean/OperationSchedule.java
index f92f3d0..c638b31 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/operation/bean/OperationSchedule.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/operation/bean/OperationSchedule.java
@@ -26,6 +26,7 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.common.JobTrigger;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.operation.HistoryJobId;
import org.rhq.core.domain.operation.JobId;
@@ -47,6 +48,7 @@ public abstract class OperationSchedule implements Serializable {
private Configuration parameters;
private Subject subject;
private String description;
+ private JobTrigger jobTrigger;
public OperationSchedule() {
}
@@ -124,6 +126,14 @@ public abstract class OperationSchedule implements Serializable {
this.description = description;
}
+ public JobTrigger getJobTrigger() {
+ return jobTrigger;
+ }
+
+ public void setJobTrigger(JobTrigger jobTrigger) {
+ this.jobTrigger = jobTrigger;
+ }
+
/**
* The single job ID which identifies the operation. It can later be parsed via {@link JobId#JobId(String)}. Note
* that this job ID only identifies the scheduled operation; it does not identify any specific invocation of that
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/OperationGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/OperationGWTService.java
index 58d02ee..badd227 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/OperationGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/OperationGWTService.java
@@ -27,10 +27,13 @@ import org.rhq.core.domain.criteria.GroupOperationHistoryCriteria;
import org.rhq.core.domain.criteria.ResourceOperationHistoryCriteria;
import org.rhq.core.domain.operation.GroupOperationHistory;
import org.rhq.core.domain.operation.ResourceOperationHistory;
+import org.rhq.core.domain.operation.bean.GroupOperationSchedule;
+import org.rhq.core.domain.operation.bean.ResourceOperationSchedule;
import org.rhq.core.domain.operation.composite.ResourceOperationLastCompletedComposite;
import org.rhq.core.domain.operation.composite.ResourceOperationScheduleComposite;
import org.rhq.core.domain.resource.composite.DisambiguationReport;
import org.rhq.core.domain.util.PageList;
+import org.rhq.core.util.exception.ThrowableUtil;
/**
* @author Greg Hinkle
@@ -46,10 +49,14 @@ public interface OperationGWTService extends RemoteService {
List<DisambiguationReport<ResourceOperationScheduleComposite>> findScheduledOperations(int pageSize);
- public void invokeResourceOperation(int resourceId, String operationName, Configuration parameters,
+ void invokeResourceOperation(int resourceId, String operationName, Configuration parameters,
String description, int timeout) throws RuntimeException;
- public void scheduleResourceOperation(int resourceId, String operationName, Configuration parameters,
+ void scheduleResourceOperation(int resourceId, String operationName, Configuration parameters,
String description, int timeout, String cronString) throws RuntimeException;
+ List<ResourceOperationSchedule> findScheduledResourceOperations(int resourceId) throws RuntimeException;
+
+ List<GroupOperationSchedule> findScheduledGroupOperations(int groupId) throws RuntimeException;
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationScheduleCompositeDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationScheduleCompositeDataSource.java
deleted file mode 100644
index 88df113..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationScheduleCompositeDataSource.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.schedule;
-
-import java.util.List;
-
-import com.smartgwt.client.data.DataSourceField;
-import com.smartgwt.client.data.fields.DataSourceIntegerField;
-import com.smartgwt.client.data.fields.DataSourceTextField;
-
-import org.rhq.core.domain.operation.composite.OperationScheduleComposite;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.gwt.OperationGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
-
-/**
- * @author Ian Springer
- */
-public abstract class OperationScheduleCompositeDataSource extends RPCDataSource<OperationScheduleComposite> {
-
- public static abstract class Field {
-
- public static final String OPERATION_JOB_ID = "operationJobId";
- public static final String OPERATION_NAME = "operationName";
- public static final String OPERATION_NEXT_FIRE_TIME = "operationNextFireTime";
- }
-
- protected OperationGWTServiceAsync operationService = GWTServiceLookup.getOperationService();
-
- public OperationScheduleCompositeDataSource() {
- super();
- List<DataSourceField> fields = addDataSourceFields();
- addFields(fields);
- }
-
- @Override
- protected List<DataSourceField> addDataSourceFields() {
- List<DataSourceField> fields = super.addDataSourceFields();
-
- // TODO: i18n
- DataSourceIntegerField idField = new DataSourceIntegerField(Field.OPERATION_JOB_ID, "ID");
- idField.setPrimaryKey(true);
- idField.setCanEdit(false);
- fields.add(idField);
-
- DataSourceTextField nameField = createTextField(Field.OPERATION_NAME, MSG.common_title_name(), 3, 100, true);
- fields.add(nameField);
-
- // TODO: i18n
- DataSourceTextField nextFireTimeField = createTextField(Field.OPERATION_NEXT_FIRE_TIME, "Next Fire Time", null,
- 100, false);
- fields.add(nextFireTimeField);
-
- return fields;
- }
-
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationScheduleDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationScheduleDataSource.java
new file mode 100644
index 0000000..65fe51f
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationScheduleDataSource.java
@@ -0,0 +1,115 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.schedule;
+
+import java.util.List;
+
+import com.smartgwt.client.data.DataSourceField;
+import com.smartgwt.client.data.Record;
+import com.smartgwt.client.data.fields.DataSourceTextField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.common.JobTrigger;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.operation.bean.OperationSchedule;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.gwt.OperationGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+
+/**
+ * @author Ian Springer
+ */
+public abstract class OperationScheduleDataSource<T extends OperationSchedule> extends RPCDataSource<T> {
+
+ public static abstract class Field {
+ public static final String JOB_NAME = "jobName";
+ public static final String JOB_GROUP = "jobGroup";
+ public static final String OPERATION_NAME = "operationName";
+ public static final String OPERATION_DISPLAY_NAME = "operationDisplayName";
+ public static final String PARAMETERS = "parameters";
+ public static final String SUBJECT = "subject";
+ public static final String DESCRIPTION = "description";
+ public static final String JOB_TRIGGER = "jobTrigger";
+ }
+
+ protected OperationGWTServiceAsync operationService = GWTServiceLookup.getOperationService();
+
+ public OperationScheduleDataSource() {
+ super();
+ List<DataSourceField> fields = addDataSourceFields();
+ addFields(fields);
+ }
+
+ // TODO: i18n
+ @Override
+ protected List<DataSourceField> addDataSourceFields() {
+ List<DataSourceField> fields = super.addDataSourceFields();
+
+ DataSourceTextField operationDisplayNameField = createTextField(Field.OPERATION_DISPLAY_NAME, "Operation", null, 100, true);
+ fields.add(operationDisplayNameField);
+
+ DataSourceTextField subjectField = createTextField(Field.SUBJECT, "Owner", null, 100, true);
+ fields.add(subjectField);
+
+ DataSourceTextField descriptionField = createTextField(Field.DESCRIPTION, "Description", null, 100, true);
+ fields.add(descriptionField);
+
+ DataSourceTextField jobTriggerField = createTextField(Field.JOB_TRIGGER, "Schedule", null, 100, true);
+ fields.add(jobTriggerField);
+
+ return fields;
+ }
+
+ protected abstract T createOperationSchedule();
+
+ @Override
+ public T copyValues(Record from) {
+ T to = createOperationSchedule();
+
+ to.setJobName(from.getAttribute(Field.JOB_NAME));
+ to.setJobGroup(from.getAttribute(Field.JOB_GROUP));
+ to.setJobTrigger((JobTrigger)from.getAttributeAsObject(Field.JOB_TRIGGER));
+ to.setDescription(from.getAttribute(Field.DESCRIPTION));
+ to.setOperationDisplayName(from.getAttribute(Field.OPERATION_DISPLAY_NAME));
+ to.setOperationName(from.getAttribute(Field.OPERATION_NAME));
+ to.setParameters((Configuration)from.getAttributeAsObject(Field.PARAMETERS));
+ to.setSubject((Subject)from.getAttributeAsObject(Field.SUBJECT));
+
+ return to;
+ }
+
+ @Override
+ public ListGridRecord copyValues(T from) {
+ ListGridRecord to = new ListGridRecord();
+
+ to.setAttribute(Field.JOB_NAME, from.getJobName());
+ to.setAttribute(Field.JOB_GROUP, from.getJobGroup());
+ to.setAttribute(Field.JOB_TRIGGER, from.getJobTrigger());
+ to.setAttribute(Field.OPERATION_DISPLAY_NAME, from.getOperationDisplayName());
+ to.setAttribute(Field.OPERATION_NAME, from.getOperationName());
+ to.setAttribute(Field.SUBJECT, from.getSubject());
+ to.setAttribute(Field.DESCRIPTION, from.getDescription());
+ to.setAttribute(Field.PARAMETERS, from.getParameters());
+
+ return to;
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationScheduleListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationScheduleListView.java
index 29d0136..d658acc 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationScheduleListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationScheduleListView.java
@@ -28,15 +28,12 @@ import org.rhq.enterprise.gui.coregui.client.components.table.TableSection;
/**
* @author Ian Springer
*/
-public abstract class OperationScheduleListView extends TableSection<OperationScheduleCompositeDataSource> {
+public abstract class OperationScheduleListView extends TableSection<OperationScheduleDataSource> {
- private static final String HEADER_ICON = "subsystems/control/Operation_24.png";
-
- public OperationScheduleListView(String locatorId, OperationScheduleCompositeDataSource dataSource, String title) {
+ public OperationScheduleListView(String locatorId, OperationScheduleDataSource dataSource, String title) {
super(locatorId, title);
setDataSource(dataSource);
- setHeaderIcon(HEADER_ICON);
}
protected abstract boolean hasControlPermission();
@@ -45,11 +42,15 @@ public abstract class OperationScheduleListView extends TableSection<OperationSc
protected void configureTable() {
super.configureTable();
- ListGridField nameField = new ListGridField(OperationScheduleCompositeDataSource.Field.OPERATION_NAME, 150);
+ ListGridField operationField = new ListGridField(OperationScheduleDataSource.Field.OPERATION_DISPLAY_NAME, 150);
+
+ //ListGridField subjectField = new ListGridField(OperationScheduleDataSource.Field.SUBJECT, 150);
+
+ //ListGridField jobTriggerField = new ListGridField(OperationScheduleDataSource.Field.JOB_TRIGGER, 300);
- ListGridField nextFireTimeField = new ListGridField(OperationScheduleCompositeDataSource.Field.OPERATION_NEXT_FIRE_TIME);
+ ListGridField descriptionField = new ListGridField(OperationScheduleDataSource.Field.DESCRIPTION);
- setListGridFields(nameField, nextFireTimeField);
+ setListGridFields(operationField, descriptionField);
addTableAction(extendLocatorId("New"), MSG.common_button_new(), new TableAction() {
public boolean isEnabled(ListGridRecord[] selection) {
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 de120f5..9cbf3e2 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
@@ -61,6 +61,7 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.schedules.SchedulesView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.traits.TraitsView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.history.ResourceOperationHistoryListView;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.schedule.ResourceOperationScheduleListView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary.ActivityView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
@@ -243,7 +244,7 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
updateAlertsTabContent(resourceComposite);
updateMonitoringTabContent(resource, facets);
updateEventsTabContent(resourceComposite, facets);
- updateOperationsTabContent(resource, facets);
+ updateOperationsTabContent(facets);
updateConfigurationTabContent(resourceComposite, resource, resourcePermissions, facets);
updateContentTabContent(resource, facets);
@@ -334,7 +335,7 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
}
}
- private void updateOperationsTabContent(Resource resource, Set<ResourceTypeFacet> facets) {
+ private void updateOperationsTabContent(Set<ResourceTypeFacet> facets) {
if (updateTab(this.operationsTab, facets.contains(ResourceTypeFacet.OPERATION), true)) {
// comment out GWT-based operation history until...
// 1) user can delete history if they possess the appropriate permissions
@@ -342,11 +343,12 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
// 3) operation arguments/results become read-only configuration data in the history details pop-up
// 4) user can navigate to the group operation that spawned this resource operation history, if appropriate
// note: enabled operation execution/schedules from left-nav, if it doesn't already exist
+
updateSubTab(this.operationsTab, this.operationsHistory, new ResourceOperationHistoryListView(operationsTab
.extendLocatorId("HistoryView"), this.resourceComposite), true, true);
- updateSubTab(this.operationsTab, this.operationsSchedule, new FullHTMLPane(this.operationsSchedule.extendLocatorId("View"),
- "/rhq/resource/operation/resourceOperationSchedules-plain.xhtml?id=" + resource.getId()), true, true);
+ updateSubTab(this.operationsTab, this.operationsSchedule,new ResourceOperationScheduleListView(operationsTab.extendLocatorId("SchedulesView"), this.resourceComposite),
+ true, true);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/schedule/ResourceOperationScheduleDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/schedule/ResourceOperationScheduleDataSource.java
new file mode 100644
index 0000000..e044f51
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/schedule/ResourceOperationScheduleDataSource.java
@@ -0,0 +1,68 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.schedule;
+
+import java.util.List;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.data.Record;
+
+import org.rhq.core.domain.operation.bean.ResourceOperationSchedule;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.schedule.OperationScheduleDataSource;
+
+/**
+ * A DataSource for {@link ResourceOperationSchedule}s for a given {@link Resource}.
+ *
+ * @author Ian Springer
+ */
+public class ResourceOperationScheduleDataSource extends OperationScheduleDataSource<ResourceOperationSchedule> {
+
+ private int resourceId;
+
+ public ResourceOperationScheduleDataSource(int resourceId) {
+ this.resourceId = resourceId;
+ }
+
+ @Override
+ protected ResourceOperationSchedule createOperationSchedule() {
+ return new ResourceOperationSchedule();
+ }
+
+ @Override
+ protected void executeFetch(final DSRequest request, final DSResponse response) {
+ operationService.findScheduledResourceOperations(this.resourceId,
+ new AsyncCallback<List<ResourceOperationSchedule>>() {
+ public void onSuccess(List<ResourceOperationSchedule> result) {
+ Record[] records = buildRecords(result);
+ response.setData(records);
+ processResponse(request.getRequestId(), response);
+ }
+
+ public void onFailure(Throwable caught) {
+ throw new RuntimeException("Failed to find scheduled operations for Resource with id ["
+ + resourceId + "].", caught);
+ }
+ });
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/schedule/ResourceOperationScheduleListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/schedule/ResourceOperationScheduleListView.java
new file mode 100644
index 0000000..03de2a6
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/schedule/ResourceOperationScheduleListView.java
@@ -0,0 +1,52 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.schedule;
+
+import com.smartgwt.client.widgets.Canvas;
+
+import org.rhq.core.domain.resource.composite.ResourceComposite;
+import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.schedule.OperationScheduleDataSource;
+import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.schedule.OperationScheduleListView;
+
+/**
+ * @author Ian Springer
+ */
+public class ResourceOperationScheduleListView extends OperationScheduleListView {
+
+ private static final String TITLE = null;
+
+ private ResourceComposite resourceComposite;
+
+ public ResourceOperationScheduleListView(String locatorId, ResourceComposite resourceComposite) {
+ super(locatorId, new ResourceOperationScheduleDataSource(resourceComposite.getResource().getId()), TITLE);
+ this.resourceComposite = resourceComposite;
+ }
+
+ @Override
+ protected boolean hasControlPermission() {
+ return this.resourceComposite.getResourcePermission().isControl();
+ }
+
+ @Override
+ public Canvas getDetailsView(int id) {
+ return new Canvas(); // TODO
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
index de8e667..a7bd459 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
@@ -85,7 +85,7 @@ public abstract class RPCDataSource<T> extends DataSource {
}
/**
- * A pattern that can be used for Datasource subclassing. Each subclass can add it's own fields prior to
+ * A pattern that can be used for Datasource subclassing. Each subclass can add its own fields prior to
* all of the fields being added to the datasource.
*/
protected List<DataSourceField> addDataSourceFields() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/OperationGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/OperationGWTServiceImpl.java
index 7cef256..a51ed3f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/OperationGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/OperationGWTServiceImpl.java
@@ -27,6 +27,7 @@ import org.rhq.core.domain.criteria.GroupOperationHistoryCriteria;
import org.rhq.core.domain.criteria.ResourceOperationHistoryCriteria;
import org.rhq.core.domain.operation.GroupOperationHistory;
import org.rhq.core.domain.operation.ResourceOperationHistory;
+import org.rhq.core.domain.operation.bean.GroupOperationSchedule;
import org.rhq.core.domain.operation.bean.ResourceOperationSchedule;
import org.rhq.core.domain.operation.composite.ResourceOperationLastCompletedComposite;
import org.rhq.core.domain.operation.composite.ResourceOperationScheduleComposite;
@@ -75,7 +76,7 @@ public class OperationGWTServiceImpl extends AbstractGWTServiceImpl implements O
ResourceOperationSchedule opSchedule = operationManager.scheduleResourceOperation(getSessionSubject(),
resourceId, operationName, 0, 0, 0, 0, parameters, description);
} catch (Exception e) {
- throw new RuntimeException("Unabled to invoke operation: " + e.getMessage());
+ throw new RuntimeException("Unable to invoke operation: " + e.getMessage());
}
}
@@ -87,7 +88,7 @@ public class OperationGWTServiceImpl extends AbstractGWTServiceImpl implements O
resourceId, operationName, parameters, ct, description);
} catch (Exception e) {
- throw new RuntimeException("Unabled to schedule operation execution: " + e.getMessage());
+ throw new RuntimeException("Unable to schedule operation execution: " + e.getMessage());
}
}
@@ -132,6 +133,28 @@ public class OperationGWTServiceImpl extends AbstractGWTServiceImpl implements O
}
}
+ public List<ResourceOperationSchedule> findScheduledResourceOperations(int resourceId) throws RuntimeException {
+ try {
+ List<ResourceOperationSchedule> resourceOperationSchedules =
+ operationManager.findScheduledResourceOperations(getSessionSubject(), resourceId);
+ return SerialUtility.prepare(resourceOperationSchedules, "findScheduledResourceOperations");
+ }
+ catch (Exception e) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ }
+ }
+
+ public List<GroupOperationSchedule> findScheduledGroupOperations(int groupId) throws RuntimeException {
+ try {
+ List<GroupOperationSchedule> groupOperationSchedules =
+ operationManager.findScheduledGroupOperations(getSessionSubject(), groupId);
+ return SerialUtility.prepare(groupOperationSchedules, "findScheduledGroupOperations");
+ }
+ catch (Exception e) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ }
+ }
+
private static final IntExtractor<ResourceOperationLastCompletedComposite> RESOURCE_OPERATION_RESOURCE_ID_EXTRACTOR = new IntExtractor<ResourceOperationLastCompletedComposite>() {
public int extract(ResourceOperationLastCompletedComposite object) {
return object.getResourceId();
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerBean.java
index cdda16d..a1fc704 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerBean.java
@@ -19,6 +19,7 @@
package org.rhq.enterprise.server.operation;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Set;
@@ -34,6 +35,7 @@ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jetbrains.annotations.Nullable;
+import org.quartz.CronTrigger;
import org.quartz.JobDataMap;
import org.quartz.JobDetail;
import org.quartz.SchedulerException;
@@ -44,6 +46,7 @@ import org.rhq.core.clientapi.agent.operation.CancelResults;
import org.rhq.core.clientapi.agent.operation.CancelResults.InterruptedState;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Permission;
+import org.rhq.core.domain.common.JobTrigger;
import org.rhq.core.domain.common.composite.IntegerOptionItem;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
@@ -418,7 +421,7 @@ public class OperationManagerBean implements OperationManagerLocal, OperationMan
return operationSchedules;
}
- public ResourceOperationSchedule getResourceOperationSchedule(Subject subject, JobDetail jobDetail) {
+ public ResourceOperationSchedule getResourceOperationSchedule(Subject whoami, JobDetail jobDetail) {
JobDataMap jobDataMap = jobDetail.getJobDataMap();
String description = jobDetail.getDescription();
@@ -433,7 +436,7 @@ public class OperationManagerBean implements OperationManagerLocal, OperationMan
}
int resourceId = jobDataMap.getIntFromString(ResourceOperationJob.DATAMAP_INT_RESOURCE_ID);
- Resource resource = getResourceIfAuthorized(subject, resourceId);
+ Resource resource = getResourceIfAuthorized(whoami, resourceId);
// note that we throw an exception if the subject does not exist!
// this is by design to avoid a malicious user creating a dummy subject in the database,
@@ -447,9 +450,13 @@ public class OperationManagerBean implements OperationManagerLocal, OperationMan
sched.setResource(resource);
sched.setOperationName(operationName);
sched.setOperationDisplayName(displayName);
- sched.setSubject(subjectManager.getSubjectById(subjectId));
+ Subject subject = subjectManager.getSubjectById(subjectId);
+ sched.setSubject(subject);
sched.setParameters(parameters);
sched.setDescription(description);
+ Trigger trigger = getTriggerOfJob(jobDetail);
+ JobTrigger jobTrigger = convertToJobTrigger(trigger);
+ sched.setJobTrigger(jobTrigger);
return sched;
}
@@ -515,6 +522,9 @@ public class OperationManagerBean implements OperationManagerLocal, OperationMan
sched.setExecutionOrder(executionOrder);
sched.setDescription(description);
sched.setHaltOnFailure(jobDataMap.getBooleanValueFromString(GroupOperationJob.DATAMAP_BOOL_HALT_ON_FAILURE));
+ Trigger trigger = getTriggerOfJob(jobDetail);
+ JobTrigger jobTrigger = convertToJobTrigger(trigger);
+ sched.setJobTrigger(jobTrigger);
return sched;
}
@@ -1828,4 +1838,78 @@ public class OperationManagerBean implements OperationManagerLocal, OperationMan
entityManager);
return queryRunner.execute();
}
+
+ private Trigger getTriggerOfJob(JobDetail jobDetail) {
+ Trigger[] triggers;
+ try {
+ triggers = scheduler.getTriggersOfJob(jobDetail.getName(), jobDetail.getGroup());
+ }
+ catch (SchedulerException e) {
+ throw new RuntimeException("Failed to lookup trigger for job [" + jobDetail.getFullName() + "].", e);
+ }
+ if (triggers.length == 0) {
+ throw new IllegalStateException("Job [" + jobDetail.getFullName() + "] has no triggers.");
+ }
+ if (triggers.length > 1) {
+ throw new IllegalStateException("Job [" + jobDetail.getFullName() + "] has more than one trigger: "
+ + Arrays.asList(triggers));
+ }
+ return triggers[0];
+ }
+
+ private static JobTrigger convertToJobTrigger(Trigger trigger) {
+ JobTrigger schedule;
+ if (trigger instanceof SimpleTrigger) {
+ SimpleTrigger simpleTrigger = (SimpleTrigger)trigger;
+ Date startTime = simpleTrigger.getStartTime();
+ if (startTime != null) {
+ // later
+ int repeatCount = simpleTrigger.getRepeatCount();
+ if (repeatCount == 0) {
+ // non-recurring
+ schedule = JobTrigger.createLaterTrigger(startTime);
+ } else {
+ // recurring
+ long repeatInterval = simpleTrigger.getRepeatInterval();
+ if (repeatCount == SimpleTrigger.REPEAT_INDEFINITELY) {
+ Date endTime = simpleTrigger.getEndTime();
+ if (endTime != null) {
+ schedule = JobTrigger.createLaterAndRepeatTrigger(startTime, repeatInterval, endTime);
+ } else {
+ schedule = JobTrigger.createLaterAndRepeatTrigger(startTime, repeatInterval);
+ }
+ } else {
+ schedule = JobTrigger.createLaterAndRepeatTrigger(startTime, repeatInterval, repeatCount);
+ }
+ }
+ } else {
+ // now
+ int repeatCount = simpleTrigger.getRepeatCount();
+ if (repeatCount == 0) {
+ // non-recurring
+ schedule = JobTrigger.createNowTrigger();
+ } else {
+ // recurring
+ long repeatInterval = simpleTrigger.getRepeatInterval();
+ if (repeatCount == SimpleTrigger.REPEAT_INDEFINITELY) {
+ Date endTime = simpleTrigger.getEndTime();
+ if (endTime != null) {
+ schedule = JobTrigger.createNowAndRepeatTrigger(repeatInterval, endTime);
+ } else {
+ schedule = JobTrigger.createNowAndRepeatTrigger(repeatInterval);
+ }
+ } else {
+ schedule = JobTrigger.createNowAndRepeatTrigger(repeatInterval, repeatCount);
+ }
+ }
+ }
+ } else if (trigger instanceof CronTrigger) {
+ CronTrigger cronTrigger = (CronTrigger)trigger;
+ schedule = JobTrigger.createCronTrigger(cronTrigger.getCronExpression());
+ } else {
+ throw new IllegalStateException("Unsupported Quartz trigger type: " + trigger.getClass().getName());
+ }
+ return schedule;
+ }
+
}
\ No newline at end of file
13 years, 6 months
[rhq] modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleSelector.java | 25 +++-------
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesDataSource.java | 12 ++++
2 files changed, 20 insertions(+), 17 deletions(-)
New commits:
commit f68131f17112cc6bbe4b619812e0b578bd2f3ede
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Dec 16 21:03:07 2010 -0500
filter on bundle type now works in deploy wizard
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleSelector.java
index 4a3e457..5b0c30c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleSelector.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleSelector.java
@@ -19,12 +19,10 @@
package org.rhq.enterprise.gui.coregui.client.bundle;
import java.util.ArrayList;
+import java.util.LinkedHashMap;
import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.data.AdvancedCriteria;
import com.smartgwt.client.data.Criteria;
-import com.smartgwt.client.data.Criterion;
-import com.smartgwt.client.types.OperatorId;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.SelectItem;
import com.smartgwt.client.widgets.form.fields.TextItem;
@@ -61,9 +59,9 @@ public class BundleSelector extends AbstractSelector<Bundle> {
}
public void onSuccess(ArrayList<BundleType> result) {
- String[] values = new String[result.size()];
- for (int i = 0, size = result.size(); (i < size); ++i) {
- values[i] = result.get(i).getName();
+ LinkedHashMap<String, String> values = new LinkedHashMap<String, String>(result.size());
+ for (BundleType type : result) {
+ values.put(String.valueOf(type.getId()), type.getName());
}
bundleTypeSelect.setValueMap(values);
}
@@ -80,16 +78,11 @@ public class BundleSelector extends AbstractSelector<Bundle> {
protected Criteria getLatestCriteria(DynamicForm availableFilterForm) {
String search = (String) availableFilterForm.getValue("search");
- String bundleType = (String) availableFilterForm.getValue("bundleType");
- ArrayList<Criterion> criteria = new ArrayList<Criterion>(2);
- if (null != search) {
- criteria.add(new Criterion("name", OperatorId.CONTAINS, search));
- }
- if (null != bundleType) {
- criteria.add(new Criterion("bundleType", OperatorId.EQUALS, bundleType));
- }
- AdvancedCriteria latestCriteria = new AdvancedCriteria(OperatorId.AND, criteria.toArray(new Criterion[criteria
- .size()]));
+ String bundleType = (String) availableFilterForm.getValueAsString("bundleType");
+
+ Criteria latestCriteria = new Criteria();
+ latestCriteria.addCriteria("search", search);
+ latestCriteria.addCriteria("bundleType", bundleType);
return latestCriteria;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesDataSource.java
index dfb6ae1..4fe31e0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesDataSource.java
@@ -88,6 +88,16 @@ public class BundlesDataSource extends RPCDataSource<Bundle> {
criteria.addFilterTagName((String) request.getCriteria().getValues().get("tagName"));
}
+ if (request.getCriteria().getValues().get("bundleType") != null) {
+ criteria.addFilterBundleTypeId(Integer.valueOf(request.getCriteria().getValues().get("bundleType")
+ .toString()));
+ }
+
+ // TODO: this doesn't work like I think it should, figure out how to search on the name column
+ // if (request.getCriteria().getValues().get("search") != null) {
+ // criteria.setSearchExpression(request.getCriteria().getValues().get("search").toString());
+ // }
+
bundleService.findBundlesByCriteria(criteria, new AsyncCallback<PageList<Bundle>>() {
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError(MSG.dataSource_bundle_loadFailed(), caught);
@@ -106,7 +116,7 @@ public class BundlesDataSource extends RPCDataSource<Bundle> {
@Override
public Bundle copyValues(Record from) {
- return null; // TODO: Implement this method.
+ return (Bundle) from.getAttributeAsObject("object");
}
@Override
13 years, 6 months
[rhq] modules/enterprise
by mazz
dev/null |binary
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Breadcrumb.java | 138 --
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadcrumbTrailPane.java | 128 --
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java | 35
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/View.java | 38
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewId.java | 34
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDetailsView.java | 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java | 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java | 10
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java | 9
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java | 7
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java | 6
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeDetailsView.java | 9
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java | 11
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/NewResourceTreeDataSource.java | 360 -------
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/NewResourceTreeView.java | 508 ----------
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java | 36
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 1
18 files changed, 32 insertions(+), 1307 deletions(-)
New commits:
commit d84d301e273daba6b31c5e4a7baa8e5f8f24530a
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Dec 16 20:14:54 2010 -0500
Removes all remnants of the now-obsolete breadcrumbs.
The default browser window title is also now more descriptive, based
on the URL. if a particular page wants a different title than the default,
they can just call Window.setTitle() in, say, the onDraw or renderView method
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Breadcrumb.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Breadcrumb.java
deleted file mode 100644
index 2bddbf2..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Breadcrumb.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client;
-
-import com.smartgwt.client.widgets.Canvas;
-
-/**
- * Information about a breadcrumb (i.e. history token component) that is used to render that breadcrumb in the
- * breadcrumb trail at the top of the page.
- *
- * @author Ian Springer
- */
-public class Breadcrumb {
- private String name;
- private String displayName;
- private String icon;
- private boolean hyperlink;
-
- public Breadcrumb(String name) {
- this(name, null);
- }
-
- public Breadcrumb(String name, String displayName) {
- this(name, displayName, null, true);
- }
-
- public Breadcrumb(String name, boolean hyperlink) {
- this(name, name, null, hyperlink);
- }
-
- public Breadcrumb(String name, String displayName, String icon, boolean hyperlink) {
- if (name == null) {
- throw new IllegalArgumentException("Name is null.");
- }
- this.name = name;
- this.icon = icon;
- setDisplayName(displayName);
- this.hyperlink = hyperlink;
- }
-
- /**
- * Returns this breadcrumb's name (e.g. "10001").
- *
- * @return this breadcrumb's name (e.g. "10001")
- */
- public String getName() {
- return this.name;
- }
-
- /**
- * Returns the display name to use for this breadcrumb in the breadcrumb trail, or null if the display name should
- * be derived from the name.
- *
- * @return the display name to use for this breadcrumb in the breadcrumb trail, or null if the display name should
- * be derived from the name
- */
- public String getDisplayName() {
- return this.displayName;
- }
-
- /**
- * Sets the display name to use for this breadcrumb in the breadcrumb trail, or null if the display name should
- * be derived from the name.
- */
- public void setDisplayName(String displayName) {
- this.displayName = (displayName != null) ? displayName : getDefaultDisplayName();
- }
-
- /**
- * Return true if this breadcrumb should be a hyperlink in the breadcrumb trail, or false otherwise. NOTE:
- * Regardless of what this method returns, if this breadcrumb is the last item in the breadcrumb trail, it
- * will not be made a hyperlink, since it already corresponds to the current view.
- *
- * @return true if this breadcrumb should be a hyperlink in the breadcrumb trail, or false otherwise
- */
- public boolean isHyperlink() {
- return this.hyperlink;
- }
-
- public String getIcon() {
- return icon;
- }
-
- public void setIcon(String icon) {
- this.icon = icon;
- }
-
- public String getDisplayHTML() {
- String display = "";
- if (icon != null) {
- display += Canvas.imgHTML(icon, 16, 16);
- }
- display += this.displayName;
-
- return display;
- }
-
-
- @Override
- public String toString() {
- return this.name;
- }
-
- private String getDefaultDisplayName() {
- StringBuilder displayName = new StringBuilder();
- boolean first = true;
- for (int i = 0; i < this.name.length(); i++) {
- char currentChar = this.name.charAt(i);
- if (!first) {
- if (Character.isUpperCase(currentChar)) {
- if ((i + 1) == this.name.length() || Character.isLowerCase(this.name.charAt(i + 1))) {
- displayName.append(" ");
- }
- }
- } else {
- first = false;
- }
- displayName.append(currentChar);
- }
- return displayName.toString();
- }
-}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadcrumbTrailPane.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadcrumbTrailPane.java
deleted file mode 100644
index a153ee0..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadcrumbTrailPane.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client;
-
-import com.google.gwt.user.client.Window;
-import com.smartgwt.client.types.Overflow;
-import com.smartgwt.client.types.VerticalAlignment;
-import com.smartgwt.client.widgets.Img;
-import com.smartgwt.client.widgets.Label;
-import com.smartgwt.client.widgets.layout.LayoutSpacer;
-import com.smartgwt.client.widgets.toolbar.ToolStrip;
-
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableLabel;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
-
-/**
- * GWT widget for the breadcrumb trail, which is displayed at the top of each page.
- *
- * @author Greg Hinkle
- * @author Ian Springer
- */
-public class BreadcrumbTrailPane extends ToolStrip {
-
- public BreadcrumbTrailPane() {
- super();
- setHeight(28);
- setAlign(VerticalAlignment.CENTER);
- setWidth100();
- setMembersMargin(15);
-
- setOverflow(Overflow.HIDDEN);
-
- }
-
- public void refresh(ViewPath viewPath) {
- try {
- // before rebuilding the trail, remove the current members, and destroy them to avoid ID conflicts
- SeleniumUtility.destroyMembers(this);
-
- LayoutSpacer ls = new LayoutSpacer();
- ls.setWidth(5);
- addMember(ls);
-
- boolean first = true;
- StringBuilder path = new StringBuilder();
-
- for (ViewId viewId : viewPath.getViewPath()) {
-
- if (!first && !viewId.getBreadcrumbs().isEmpty()) {
- addMember(getSpacer());
- }
-
- if (!first) {
- path.append("/");
- } else {
- first = false;
- }
-
- boolean firstBC = true;
- for (Breadcrumb breadcrumb : viewId.getBreadcrumbs()) {
-
- if (!firstBC) {
- addMember(getSpacer());
- } else {
- firstBC = false;
- }
-
- addMember(getCrumb(breadcrumb, path.toString()));
- }
- path.append(viewId.getPath());
- }
-
- addMember(new LayoutSpacer());
-
- } catch (Throwable t) {
- System.err.println("Failed to refresh bread crumb HTML - cause: " + t);
- }
-
- String title = "RHQ";
- if (!viewPath.getViewPath().isEmpty()) {
- title += ": "
- + viewPath.getViewPath().get(viewPath.getViewPath().size() - 1).getBreadcrumbs().get(0)
- .getDisplayName();
-
- }
- Window.setTitle(title);
-
- redraw();
- }
-
- private Label getCrumb(Breadcrumb crumb, String path) {
- Label l = null;
- String fullPath = path.toString() + crumb.getName();
- //if (crumb.isHyperlink()) {
- //l = new LocatableLabel(fullPath, "<a href=\"#" + fullPath + "\">" + crumb.getDisplayName() + "</a>");
- //} else {
- l = new LocatableLabel(fullPath, "<b>" + crumb.getDisplayName() + "</b>");
- //}
- if (crumb.getIcon() != null) {
- l.setIcon(crumb.getIcon());
- l.setIconSize(16);
- }
- l.setValign(VerticalAlignment.CENTER);
- l.setWrap(false);
- l.setAutoWidth();
- return l;
- }
-
- private Img getSpacer() {
- return new Img("header/breadcrumb_space.png", 28, 28);
- }
-}
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 2b1597f..dca51dc 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
@@ -28,6 +28,7 @@ import com.google.gwt.http.client.URL;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.Timer;
+import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.Window.Location;
import com.smartgwt.client.core.KeyIdentifier;
import com.smartgwt.client.types.Overflow;
@@ -84,8 +85,6 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
private static MessageBar messageBar;
- private static BreadcrumbTrailPane breadCrumbTrailPane;
-
private static MessageCenter messageCenter;
private static String currentPath;
@@ -153,8 +152,6 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
messageBar = new MessageBar();
- breadCrumbTrailPane = new BreadcrumbTrailPane();
-
Canvas canvas = new Canvas(CONTENT_CANVAS_ID);
canvas.setWidth100();
canvas.setHeight100();
@@ -303,14 +300,6 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
}
}
- /**
- * @deprecated
- */
- @Deprecated
- public static void refreshBreadCrumbTrail() {
- //breadCrumbTrailPane.refresh(currentViewPath);
- }
-
public static Messages getMessages() {
return MSG;
}
@@ -324,7 +313,27 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
setHeight100();
}
+ private String getViewPathTitle(ViewPath viewPath) {
+ // default title is the path minus any IDs we find. That should give a least some nice default title.
+ StringBuilder path = new StringBuilder();
+ for (ViewId view : viewPath.getViewPath()) {
+ // none of our path elements start with a digit that is NOT an ID; if we see an ID, skip it
+ if (!Character.isDigit(view.getPath().charAt(0))) {
+ if (path.length() > 0) {
+ path.append(" | ");
+ }
+ path.append(view.getPath());
+ }
+ }
+ if (path.length() == 0) {
+ path.append("Core Application");
+ }
+ return "RHQ: " + path.toString();
+ }
+
public void renderView(final ViewPath viewPath) {
+ Window.setTitle(getViewPathTitle(viewPath));
+
if (viewPath.isEnd()) {
// default view
History.newItem(DEFAULT_VIEW_PATH);
@@ -363,8 +372,6 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
((BookmarkableView) currentCanvas).renderView(viewPath.next());
}
}
-
- refreshBreadCrumbTrail();
}
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/View.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/View.java
index 18a0fd9..2321d65 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/View.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/View.java
@@ -30,34 +30,17 @@ package org.rhq.enterprise.gui.coregui.client;
public class View {
private ViewId id;
private BookmarkableView descendantViewRenderer;
- private Breadcrumb breadcrumb;
private View parent;
public View(ViewId id) {
- this(id, null, null);
+ this(id, null);
}
public View(ViewId id, BookmarkableView descendantViewRenderer) {
- this(id, descendantViewRenderer, null);
- }
-
- public View(ViewId id, Breadcrumb breadcrumb) {
- this(id, null, breadcrumb);
- }
-
- public View(ViewId id, BookmarkableView descendantViewRenderer, Breadcrumb breadcrumb) {
if (id == null) {
throw new IllegalArgumentException("Id is null.");
}
this.id = id;
- if (breadcrumb != null) {
- if (!breadcrumb.getName().equals(id.getPath())) {
- throw new IllegalArgumentException("Breadcrumb name is not equal to id name.");
- }
- this.breadcrumb = breadcrumb;
- } else {
- this.breadcrumb = new Breadcrumb(id.getPath());
- }
this.descendantViewRenderer = descendantViewRenderer;
}
@@ -89,17 +72,6 @@ public class View {
}
}
- /**
- * Returns info that should be used when rendering a breadcrumb for this view in the
- * breadcrumb trail, or null if a default breadcrumb should be used.
- *
- * @return info that should be used when rendering a breadcrumb for this view in the
- * breadcrumb trail, or null if a default breadcrumb should be used
- */
- public Breadcrumb getBreadcrumb() {
- return this.breadcrumb;
- }
-
public View getParent() {
return this.parent;
}
@@ -110,11 +82,7 @@ public class View {
@Override
public String toString() {
- return "View[" +
- "id=" + id +
- ", descendantViewRenderer=" +
- ((this.descendantViewRenderer != null) ? this.descendantViewRenderer.getClass().getName() : null) +
- ", breadcrumb=" + this.breadcrumb +
- ']';
+ return "View[" + "id=" + id + ", descendantViewRenderer="
+ + ((this.descendantViewRenderer != null) ? this.descendantViewRenderer.getClass().getName() : null) + ']';
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewId.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewId.java
index cba747e..1f0743e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewId.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewId.java
@@ -18,38 +18,13 @@
*/
package org.rhq.enterprise.gui.coregui.client;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-/**
- *
- * @author Greg Hinkle
- */
public class ViewId {
private String path;
- private List<Breadcrumb> breadcrumbs;
-
- public ViewId(String path, Breadcrumb... breadcrumbs) {
- this.path = path;
- if ( breadcrumbs != null) {
- this.breadcrumbs = Arrays.asList(breadcrumbs);
- } else {
- this.breadcrumbs = new ArrayList<Breadcrumb>();
- }
- }
-
public ViewId(String path) {
this.path = path;
- breadcrumbs = new ArrayList<Breadcrumb>();
-
- breadcrumbs.add(new Breadcrumb(path));
- }
-
- public List<Breadcrumb> getBreadcrumbs() {
- return breadcrumbs;
}
public String getPath() {
@@ -63,12 +38,15 @@ public class ViewId {
@Override
public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
ViewId viewId = (ViewId) o;
- if (!path.equals(viewId.path)) return false;
+ if (!path.equals(viewId.path))
+ return false;
return true;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDetailsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDetailsView.java
index abb0657..594cbb4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDetailsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDetailsView.java
@@ -44,7 +44,6 @@ import org.rhq.core.domain.criteria.AlertCriteria;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.ViewId;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
@@ -58,7 +57,6 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
public class AlertDetailsView extends LocatableVLayout implements BookmarkableView {
private int alertId;
- private ViewId viewId;
private static AlertDetailsView INSTANCE = new AlertDetailsView("alertDetailsView");
@@ -93,11 +91,6 @@ public class AlertDetailsView extends LocatableVLayout implements BookmarkableVi
removeChild(child);
}
- if (this.viewId != null) {
- viewId.getBreadcrumbs().get(0).setDisplayName(MSG.view_alert_details_breadcrumb());
- CoreGUI.refreshBreadCrumbTrail();
- }
-
Log.info("AlertDetailsView-Alert: " + alert);
ListGridRecord record = AlertDataSource.convert(alert);
Log.info("AlertDetailsView-ListGridRecord: " + record);
@@ -251,7 +244,6 @@ public class AlertDetailsView extends LocatableVLayout implements BookmarkableVi
@Override
public void renderView(ViewPath viewPath) {
alertId = viewPath.getCurrentAsInt();
- viewId = viewPath.getCurrent();
show(alertId);
}
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 e41d351..c8f9261 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
@@ -118,7 +118,6 @@ public class BundleTopView extends LocatableHLayout implements BookmarkableView
setContent(bundlesListView);
}
} else {
- viewPath.getCurrent().getBreadcrumbs().clear();
if (!viewPath.getNext().equals(currentNextPath)) {
currentNextPath = viewPath.getNext();
bundleView = new BundleView(extendLocatorId("Bundle"));
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
index 9b91e25..0bb149c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
@@ -53,7 +53,6 @@ import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.tagging.Tag;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
-import org.rhq.enterprise.gui.coregui.client.Breadcrumb;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
@@ -311,17 +310,8 @@ public class BundleDeploymentView extends LocatableVLayout implements Bookmarkab
}
public void onSuccess(PageList<BundleResourceDeployment> result) {
-
deployment.setResourceDeployments(result);
-
- viewPath.getViewForIndex(2).getBreadcrumbs().set(0,
- new Breadcrumb(String.valueOf(bundle.getId()), bundle.getName()));
- viewId.getBreadcrumbs().set(0,
- new Breadcrumb(String.valueOf(deployment.getId()), deployment.getName()));
- CoreGUI.refreshBreadCrumbTrail();
-
viewBundleDeployment(deployment, viewPath.getCurrent());
-
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
index 1c91fee..dd65070 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
@@ -41,7 +41,6 @@ import org.rhq.core.domain.criteria.BundleDestinationCriteria;
import org.rhq.core.domain.tagging.Tag;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
-import org.rhq.enterprise.gui.coregui.client.Breadcrumb;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ViewId;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
@@ -250,15 +249,7 @@ public class BundleDestinationView extends LocatableVLayout implements Bookmarka
}
public void onSuccess(PageList<BundleDestination> result) {
-
final BundleDestination destination = result.get(0);
-
- viewPath.getViewForIndex(2).getBreadcrumbs().set(0,
- new Breadcrumb(String.valueOf(destination.getBundle().getId()), destination.getBundle().getName()));
- viewId.getBreadcrumbs().set(0,
- new Breadcrumb(String.valueOf(destination.getId()), destination.getName()));
- CoreGUI.refreshBreadCrumbTrail();
-
viewBundleDestination(destination, viewPath.getCurrent());
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
index fc3ce87..1d64b7a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
@@ -41,7 +41,6 @@ import org.rhq.core.domain.criteria.BundleCriteria;
import org.rhq.core.domain.tagging.Tag;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
-import org.rhq.enterprise.gui.coregui.client.Breadcrumb;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ViewId;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
@@ -294,10 +293,7 @@ public class BundleView extends LocatableVLayout implements BookmarkableView {
public void onSuccess(PageList<Bundle> result) {
Bundle bundle = result.get(0);
- viewId.getBreadcrumbs().set(0,
- new Breadcrumb(String.valueOf(bundle.getId()), bundle.getName()));
viewBundle(bundle, viewPath.getCurrent());
- CoreGUI.refreshBreadCrumbTrail();
}
});
} else if (!viewPath.isEnd()) {
@@ -307,10 +303,7 @@ public class BundleView extends LocatableVLayout implements BookmarkableView {
} else if ("destinations".equals(current)) {
tabs.selectTab(destinationsTab);
}
- // The tab change forces an update so fix up the breadcrumb to use displayName and not just the path
- viewId.getBreadcrumbs().set(0, new Breadcrumb(String.valueOf(bundle.getId()), bundle.getName()));
viewBundle(bundle, viewPath.getCurrent());
- CoreGUI.refreshBreadCrumbTrail();
}
} else {
// Although still relevant the bundle is no longer being viewed. Set to 0 for re-fetch if needed
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java
index 807ec93..e3e8567 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java
@@ -39,7 +39,6 @@ import org.rhq.core.domain.criteria.BundleVersionCriteria;
import org.rhq.core.domain.tagging.Tag;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
-import org.rhq.enterprise.gui.coregui.client.Breadcrumb;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ViewId;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
@@ -207,11 +206,6 @@ public class BundleVersionView extends LocatableVLayout implements BookmarkableV
public void onSuccess(PageList<BundleVersion> result) {
BundleVersion version = result.get(0);
viewBundleVersion(version, viewPath.getCurrent());
- viewPath.getViewForIndex(2).getBreadcrumbs().set(0,
- new Breadcrumb(String.valueOf(version.getBundle().getId()), version.getBundle().getName()));
- viewId.getBreadcrumbs().set(0,
- new Breadcrumb(String.valueOf(version.getId()), version.getVersion()));
- CoreGUI.refreshBreadCrumbTrail();
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeDetailsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeDetailsView.java
index ddcaf9b..f90af80 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeDetailsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeDetailsView.java
@@ -34,7 +34,6 @@ import org.rhq.core.domain.event.composite.EventComposite;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.ViewId;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
@@ -45,7 +44,6 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
public class EventCompositeDetailsView extends LocatableVLayout implements BookmarkableView {
private int eventId;
- private ViewId viewId;
private static EventCompositeDetailsView INSTANCE = new EventCompositeDetailsView("eventCompositeDetailsView");
@@ -81,11 +79,6 @@ public class EventCompositeDetailsView extends LocatableVLayout implements Bookm
removeChild(child);
}
- if (this.viewId != null) {
- viewId.getBreadcrumbs().get(0).setDisplayName(MSG.view_inventory_eventHistory_details());
- CoreGUI.refreshBreadCrumbTrail();
- }
-
DynamicForm form = new DynamicForm();
form.setWidth100();
form.setHeight100();
@@ -117,8 +110,6 @@ public class EventCompositeDetailsView extends LocatableVLayout implements Bookm
@Override
public void renderView(ViewPath viewPath) {
eventId = viewPath.getCurrentAsInt();
- viewId = viewPath.getCurrent();
-
show(eventId);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java
index e6bc5b9..9ab4029 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java
@@ -49,7 +49,6 @@ import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.PermissionsLoadedListener;
import org.rhq.enterprise.gui.coregui.client.PermissionsLoader;
-import org.rhq.enterprise.gui.coregui.client.ViewId;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
@@ -68,7 +67,6 @@ public class SingleGroupDefinitionView extends LocatableVLayout implements Bookm
private int groupDefinitionId;
private GroupDefinition groupDefinition;
private String basePath;
- private ViewId viewId;
// editable form
private TextItem id;
@@ -209,14 +207,6 @@ public class SingleGroupDefinitionView extends LocatableVLayout implements Bookm
recursive.show();
expression.show();
recalculationInterval.show();
-
- if (groupDefinitionId == 0) {
- viewId.getBreadcrumbs().get(0).setDisplayName(MSG.view_dynagroup_newGroupDefinition());
- } else {
- viewId.getBreadcrumbs().get(0).setDisplayName(MSG.view_dynagroup_editing(name.getValue().toString()));
- }
- CoreGUI.refreshBreadCrumbTrail();
-
markForRedraw();
}
@@ -341,7 +331,6 @@ public class SingleGroupDefinitionView extends LocatableVLayout implements Bookm
public void onPermissionsLoaded(Set<Permission> permissions) {
if (permissions != null && permissions.contains(Permission.MANAGE_INVENTORY)) {
groupDefinitionId = viewPath.getCurrentAsInt();
- viewId = viewPath.getCurrent();
basePath = viewPath.getPathToCurrent();
lookupDetails(groupDefinitionId);
} else {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/NewResourceTreeDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/NewResourceTreeDataSource.java
deleted file mode 100644
index c54c0ff..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/NewResourceTreeDataSource.java
+++ /dev/null
@@ -1,360 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, 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.inventory.resource.detail;
-
-import java.util.ArrayList;
-import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.allen_sauer.gwt.log.client.Log;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.data.DSRequest;
-import com.smartgwt.client.data.DSResponse;
-import com.smartgwt.client.data.DataSource;
-import com.smartgwt.client.data.DataSourceField;
-import com.smartgwt.client.data.fields.DataSourceImageField;
-import com.smartgwt.client.data.fields.DataSourceTextField;
-import com.smartgwt.client.rpc.RPCResponse;
-import com.smartgwt.client.types.DSDataFormat;
-import com.smartgwt.client.types.DSProtocol;
-import com.smartgwt.client.widgets.tree.TreeNode;
-
-import org.rhq.core.domain.criteria.ResourceCriteria;
-import org.rhq.core.domain.resource.Resource;
-import org.rhq.core.domain.resource.ResourceCategory;
-import org.rhq.core.domain.resource.ResourceSubCategory;
-import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.ImageManager;
-import org.rhq.enterprise.gui.coregui.client.Messages;
-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;
-
-/**
- * @author Greg Hinkle
- *
- * @deprecated {@link ResourceTreeDatasource} is used instead
- */
-@Deprecated
-public class NewResourceTreeDataSource extends DataSource {
-
- Messages MSG = CoreGUI.getMessages();
-
- int rootId;
-
- private ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();
-
- public NewResourceTreeDataSource() {
- setClientOnly(false);
- setDataProtocol(DSProtocol.CLIENTCUSTOM);
- setDataFormat(DSDataFormat.CUSTOM);
-
- this.rootId = rootId;
-
- DataSourceField idDataField = new DataSourceTextField("id", MSG.common_title_id());
- idDataField.setPrimaryKey(true);
-
- DataSourceTextField nameDataField = new DataSourceTextField("name", MSG.common_title_name());
- nameDataField.setCanEdit(false);
-
- DataSourceTextField descriptionDataField = new DataSourceTextField("description", MSG
- .common_title_description());
- descriptionDataField.setCanEdit(false);
-
- DataSourceImageField availabilityDataField = new DataSourceImageField("currentAvailability", MSG
- .common_title_availability());
- descriptionDataField.setCanEdit(false);
-
- DataSourceTextField parentIdField = new DataSourceTextField("parentId", MSG.common_title_id_parent());
- parentIdField.setForeignKey("id");
- // parentIdField.setRootValue(rootId);
-
- // DataSourceTextField parentKeyField = new DataSourceTextField("parentKey", "Parent KEY");
- // parentKeyField.setForeignKey("id");
- // parentKeyField.setRootValue(rootId);
-
- // nameDataField.setType(FieldType.);
-
- setDropExtraFields(false);
-
- setFields(idDataField, nameDataField, descriptionDataField, availabilityDataField);
- }
-
- @Override
- protected Object transformRequest(DSRequest request) {
- String requestId = request.getRequestId();
- DSResponse response = new DSResponse();
- response.setAttribute("clientContext", request.getAttributeAsObject("clientContext"));
- // Asume success
- response.setStatus(0);
- switch (request.getOperationType()) {
- case ADD:
- //executeAdd(request, response);
- break;
- case FETCH:
- executeFetch(requestId, request, response);
- break;
- case REMOVE:
- //executeRemove(lstRec);
- break;
- case UPDATE:
- //executeAdd(lstRec, false);
- break;
-
- default:
- break;
- }
-
- return request.getData();
- }
-
- public void executeFetch(final String requestId, final DSRequest request, final DSResponse response) {
- final long start = System.currentTimeMillis();
-
- String p = request.getCriteria().getAttribute("parentId");
-
- ResourceCriteria criteria = new ResourceCriteria();
-
- if (p == null) {
- Log.info("DataSourceTree: Loading initial data");
-
- criteria.addFilterId(rootId);
-
- } else {
- Log.info("DataSourceTree: Loading " + p);
-
- criteria.addFilterParentResourceId(Integer.parseInt(p));
- }
-
- // The server is already eager fetch resource type
- // * criteria.fetchResourceType(true);
-
- resourceService.findResourcesByCriteria(criteria, new AsyncCallback<PageList<Resource>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.view_tree_common_loadFailed_generic(), caught);
- response.setStatus(RPCResponse.STATUS_FAILURE);
- processResponse(requestId, response);
- }
-
- public void onSuccess(PageList<Resource> result) {
- processIncomingData(result, response, requestId);
- }
- });
- }
-
- private void processIncomingData(List<Resource> result, final DSResponse response, final String requestId) {
-
- ResourceTypeRepository.Cache.getInstance().loadResourceTypes(
- result,
- EnumSet.of(ResourceTypeRepository.MetadataType.operations, ResourceTypeRepository.MetadataType.children,
- ResourceTypeRepository.MetadataType.subCategory),
- new ResourceTypeRepository.ResourceTypeLoadedCallback() {
- public void onResourceTypeLoaded(List<Resource> result) {
- // response.setData(buildNodes(result));
- processResponse(requestId, response);
-
- }
- });
- }
-
- /**
- * Construct a set of TreeNodes from a list of resources
- *
- * @param resources
- * @return
- */
- public static TreeNode build(int rootId, Map<Integer, Resource> resources) {
- Resource root = resources.get(rootId);
-
- TreeNode rootNode = new ResourceTreeNode(root);
-
- buildTree(rootNode, root, resources);
-
- ResourceTreeNode[] records = new ResourceTreeNode[resources.size()];
- for (int x = 0; x < resources.size(); x++) {
- Resource res = resources.get(x);
- ResourceTreeNode record = new ResourceTreeNode(res);
- records[x] = record;
- }
-
- return rootNode;
- // return introduceTypeFolders(records);
- }
-
- private static void buildTree(TreeNode parent, Resource parentResource, Map<Integer, Resource> resources) {
-
- HashMap<ResourceType, TypeTreeNode> types = new HashMap<ResourceType, TypeTreeNode>();
-
- ArrayList<ResourceTreeNode> childNodes = new ArrayList<ResourceTreeNode>();
-
- for (Resource res : resources.values()) {
- if (res.getParentResource() != null && res.getParentResource().getId() == parentResource.getId()) {
-
- // parent.setChildren();
-
- ResourceTreeNode child = new ResourceTreeNode(res);
-
- childNodes.add(child);
-
- buildTree(child, res, resources);
-
- }
- }
-
- parent.setChildren(childNodes.toArray(new TreeNode[childNodes.size()]));
-
- }
-
- private static TreeNode[] introduceTypeFolders(ResourceTreeNode[] nodes) {
- ArrayList<TreeNode> built = new ArrayList<TreeNode>();
- HashMap<ResourceSubCategory, CategoryTreeNode> categories = new HashMap<ResourceSubCategory, CategoryTreeNode>();
- HashMap<ResourceType, TypeTreeNode> types = new HashMap<ResourceType, TypeTreeNode>();
-
- for (ResourceTreeNode node : nodes) {
- built.add(node);
-
- if (!types.containsKey(node.getResourceType())
- && node.getResourceType().getCategory() != ResourceCategory.PLATFORM) {
-
- String parentResourceId = String.valueOf(node.getResource().getParentResource().getId());
-
- CategoryTreeNode categoryNode = null;
-
- if (node.getResourceType().getSubCategory() != null) {
- ResourceSubCategory category = node.getResourceType().getSubCategory();
- if (category.getName() != null) {
- categoryNode = categories.get(category);
-
- if (categoryNode == null) {
- categoryNode = new CategoryTreeNode(parentResourceId, category);
-
- categories.put(category, categoryNode);
- built.add(categoryNode);
- }
- }
- }
-
- String parentId = null;
- if (categoryNode != null) {
- parentId = categoryNode.getAttribute("id");
- } else {
- parentId = parentResourceId;
- }
-
- TypeTreeNode typeNode = new TypeTreeNode(parentId, parentResourceId, node.getResourceType().getName());
- built.add(typeNode);
- types.put(node.getResourceType(), typeNode);
- }
- }
-
- return built.toArray(new TreeNode[built.size()]);
-
- }
-
- private static boolean sameTypes(ResourceTreeNode[] nodes) {
- ResourceType first = nodes[0].getResourceType();
- for (ResourceTreeNode node : nodes) {
- if (!first.equals(node)) {
- return false;
- }
- }
- return true;
- }
-
- public static class CategoryTreeNode extends TreeNode {
- public CategoryTreeNode(String parentId, ResourceSubCategory category) {
- setID(parentId + "__" + category.getName());
- setParentID(parentId);
- setName(category.getDisplayName());
-
- setAttribute("id", parentId + "__" + category.getName());
- setAttribute("parentId", parentId);
- setAttribute("name", category.getDisplayName());
- }
- }
-
- public static class TypeTreeNode extends TreeNode {
-
- private TypeTreeNode(String parentId, String parentResourceId, String type) {
- setID(parentId + "_" + type);
- setParentID(parentId);
-
- setAttribute("id", parentResourceId + "_" + type);
- setAttribute("parentId", parentId);
- // setAttribute("parentKey", parentId);
- setAttribute("name", type);
- }
-
- }
-
- public static class ResourceTreeNode extends TreeNode {
-
- private Resource resource;
-
- private ResourceTreeNode(Resource resource) {
- this.resource = resource;
-
- String id = String.valueOf(resource.getId());
- String parentId = resource.getParentResource() == null ? null
- : (resource.getParentResource().getId() + "_" + resource.getResourceType().getName());
-
- // com.allen_sauer.gwt.log.client.Log.info(id + " / " + parentId);
-
- setID(id);
- setParentID(parentId);
-
- setAttribute("id", id);
- setAttribute("parentId", parentId);
-
- // setAttribute("parentKey", resource.getParentResource() == null ? 0 : (resource.getParentResource().getId() + resource.getResourceType().getName()));
-
- setAttribute("name", resource.getName());
- // setAttribute("description", resource.getDescription());
- setAttribute("currentAvailability", ImageManager.getAvailabilityIconFromAvailType(resource
- .getCurrentAvailability().getAvailabilityType()));
-
- setIsFolder((resource.getResourceType().getChildResourceTypes() != null && !resource.getResourceType()
- .getChildResourceTypes().isEmpty()));
- }
-
- public Resource getResource() {
- return resource;
- }
-
- public void setResource(Resource resource) {
- this.resource = resource;
- }
-
- public ResourceType getResourceType() {
- return resource.getResourceType();
- }
-
- public String getParentId() {
- return getAttribute("parentId");
- }
- }
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/NewResourceTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/NewResourceTreeView.java
deleted file mode 100644
index e957d7d..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/NewResourceTreeView.java
+++ /dev/null
@@ -1,508 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail;
-
-import java.util.ArrayList;
-import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.List;
-
-import com.allen_sauer.gwt.log.client.Log;
-import com.google.gwt.user.client.History;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.types.SelectionStyle;
-import com.smartgwt.client.widgets.Window;
-import com.smartgwt.client.widgets.events.CloseClickHandler;
-import com.smartgwt.client.widgets.events.CloseClientEvent;
-import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
-import com.smartgwt.client.widgets.grid.events.SelectionEvent;
-import com.smartgwt.client.widgets.menu.Menu;
-import com.smartgwt.client.widgets.menu.MenuItem;
-import com.smartgwt.client.widgets.menu.MenuItemSeparator;
-import com.smartgwt.client.widgets.menu.events.ClickHandler;
-import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent;
-import com.smartgwt.client.widgets.tree.Tree;
-import com.smartgwt.client.widgets.tree.TreeGrid;
-import com.smartgwt.client.widgets.tree.TreeNode;
-import com.smartgwt.client.widgets.tree.events.NodeContextClickEvent;
-import com.smartgwt.client.widgets.tree.events.NodeContextClickHandler;
-
-import org.rhq.core.domain.configuration.PropertySimple;
-import org.rhq.core.domain.criteria.ResourceCriteria;
-import org.rhq.core.domain.criteria.ResourceTypeCriteria;
-import org.rhq.core.domain.dashboard.Dashboard;
-import org.rhq.core.domain.dashboard.DashboardPortlet;
-import org.rhq.core.domain.measurement.MeasurementDefinition;
-import org.rhq.core.domain.operation.OperationDefinition;
-import org.rhq.core.domain.resource.Resource;
-import org.rhq.core.domain.resource.ResourceCategory;
-import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.domain.util.PageControl;
-import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.gui.coregui.client.Breadcrumb;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.ImageManager;
-import org.rhq.enterprise.gui.coregui.client.ViewId;
-import org.rhq.enterprise.gui.coregui.client.ViewPath;
-import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
-import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.inventory.resource.graph.GraphPortlet;
-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.gwt.ResourceTypeGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
-import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.schedule.OperationCreateWizard;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.factory.ResourceFactoryCreateWizard;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
-
-/**
- * @author Greg Hinkle
- *
- * @deprecated {@link ResourceTreeView} is used instead
- */
-@Deprecated
-public class NewResourceTreeView extends LocatableVLayout {
- private Resource selectedResource;
- private Resource rootResource;
-
- private TreeGrid treeGrid;
- private Menu contextMenu;
-
- private ViewId currentViewId;
-
- private ArrayList<ResourceSelectListener> selectListeners = new ArrayList<ResourceSelectListener>();
-
- private boolean initialSelect = false;
-
- public NewResourceTreeView(String locatorId) {
- super(locatorId);
-
- setWidth("250");
- setHeight100();
-
- setShowResizeBar(true);
- }
-
- public void onInit() {
-
- }
-
- private void buildTree() {
-
- treeGrid = new CustomResourceTreeGrid(getLocatorId());
-
- treeGrid.setOpenerImage("resources/dir.png");
- treeGrid.setOpenerIconSize(16);
-
- // treeGrid.setAutoFetchData(true);
- treeGrid.setAnimateFolders(false);
- treeGrid.setSelectionType(SelectionStyle.SINGLE);
- treeGrid.setShowRollOver(false);
- treeGrid.setSortField("name");
- treeGrid.setShowHeader(false);
-
- treeGrid.setLeaveScrollbarGap(false);
-
- contextMenu = new Menu();
- MenuItem item = new MenuItem("Expand node");
-
- treeGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
- public void onSelectionChanged(SelectionEvent selectionEvent) {
- if (!selectionEvent.isRightButtonDown() && selectionEvent.getState()) {
- if (treeGrid.getSelectedRecord() instanceof ResourceTreeDatasource.ResourceTreeNode) {
- ResourceTreeDatasource.ResourceTreeNode node = (ResourceTreeDatasource.ResourceTreeNode) treeGrid
- .getSelectedRecord();
- Log.info("Resource selected in tree: " + node.getResource());
-
- String newToken = "Resource/" + node.getResource().getId();
- String currentToken = History.getToken();
- if (!currentToken.startsWith(newToken)) {
-
- String ending = currentToken.replaceFirst("^[^\\/]*\\/[^\\/]*", "");
-
- History.newItem("Resource/" + node.getResource().getId() + ending);
-
- }
- }
-
- }
- }
- });
-
- // This constructs the context menu for the resource at the time of the click.
- setContextMenu(contextMenu);
-
- treeGrid.addNodeContextClickHandler(new NodeContextClickHandler() {
- public void onNodeContextClick(final NodeContextClickEvent event) {
- event.getNode();
- event.cancel();
-
- if (event.getNode() instanceof ResourceTreeDatasource.AutoGroupTreeNode) {
- showContextMenu((ResourceTreeDatasource.AutoGroupTreeNode) event.getNode());
- } else if (event.getNode() instanceof ResourceTreeDatasource.ResourceTreeNode) {
- showContextMenu((ResourceTreeDatasource.ResourceTreeNode) event.getNode());
- }
- }
- });
- }
-
- private void showContextMenu(ResourceTreeDatasource.AutoGroupTreeNode node) {
-
- contextMenu.setItems(new MenuItem(node.getName()));
- contextMenu.showContextMenu();
-
- }
-
- private void showContextMenu(final ResourceTreeDatasource.ResourceTreeNode node) {
- ResourceType type = node.getResource().getResourceType();
- ResourceTypeRepository.Cache.getInstance().getResourceTypes(
- type.getId(),
- EnumSet.of(ResourceTypeRepository.MetadataType.operations, ResourceTypeRepository.MetadataType.children,
- ResourceTypeRepository.MetadataType.subCategory,
- ResourceTypeRepository.MetadataType.pluginConfigurationDefinition,
- ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
- new ResourceTypeRepository.TypeLoadedCallback() {
- public void onTypesLoaded(ResourceType type) {
- buildResourceContextMenu(node.getResource(), type);
- contextMenu.showContextMenu();
- }
- });
- }
-
- private void buildResourceContextMenu(final Resource resource, final ResourceType resourceType) {
- contextMenu.setItems(new MenuItem(resource.getName()));
-
- contextMenu.addItem(new MenuItem(MSG.view_tree_common_contextMenu_type_name_label(resourceType.getName())));
-
- MenuItem editPluginConfiguration = new MenuItem(MSG.view_tabs_common_connectionSettings());
- editPluginConfiguration.addClickHandler(new ClickHandler() {
- public void onClick(MenuItemClickEvent event) {
- int resourceId = resource.getId();
- int resourceTypeId = resourceType.getId();
-
- Window configEditor = new Window();
- configEditor.setTitle(MSG.view_tree_common_contextMenu_editPluginConfiguration(resource.getName()));
- configEditor.setWidth(800);
- configEditor.setHeight(800);
- configEditor.setIsModal(true);
- configEditor.setShowModalMask(true);
- configEditor.setCanDragResize(true);
- configEditor.centerInPage();
- configEditor.addItem(new ConfigurationEditor("PluginConfig-" + resource.getName(), resourceId,
- resourceTypeId, ConfigurationEditor.ConfigType.plugin));
- configEditor.show();
-
- }
- });
- editPluginConfiguration.setEnabled(resourceType.getPluginConfigurationDefinition() != null);
- contextMenu.addItem(editPluginConfiguration);
-
- MenuItem editResourceConfiguration = new MenuItem(MSG.view_tree_common_contextMenu_resourceConfiguration());
- editResourceConfiguration.addClickHandler(new ClickHandler() {
- public void onClick(MenuItemClickEvent event) {
- int resourceId = resource.getId();
- int resourceTypeId = resourceType.getId();
-
- final Window configEditor = new Window();
- configEditor.setTitle(MSG.view_tree_common_contextMenu_editResourceConfiguration(resource.getName()));
- configEditor.setWidth(800);
- configEditor.setHeight(800);
- configEditor.setIsModal(true);
- configEditor.setShowModalMask(true);
- configEditor.setCanDragResize(true);
- configEditor.setShowResizer(true);
- configEditor.centerInPage();
- configEditor.addCloseClickHandler(new CloseClickHandler() {
- public void onCloseClick(CloseClientEvent closeClientEvent) {
- configEditor.destroy();
- }
- });
- configEditor.addItem(new ConfigurationEditor("ResourceConfig-" + resource.getName(), resourceId,
- resourceTypeId, ConfigurationEditor.ConfigType.resource));
- configEditor.show();
-
- }
- });
- editResourceConfiguration.setEnabled(resourceType.getResourceConfigurationDefinition() != null);
- contextMenu.addItem(editResourceConfiguration);
-
- contextMenu.addItem(new MenuItemSeparator());
-
- // Operations Menu
- MenuItem operations = new MenuItem(MSG.view_tree_common_contextMenu_operations());
- Menu opSubMenu = new Menu();
- for (final OperationDefinition operationDefinition : resourceType.getOperationDefinitions()) {
- MenuItem operationItem = new MenuItem(operationDefinition.getDisplayName());
- operationItem.addClickHandler(new ClickHandler() {
- public void onClick(MenuItemClickEvent event) {
- new OperationCreateWizard(selectedResource, operationDefinition).startOperationWizard();
- }
- });
- opSubMenu.addItem(operationItem);
- // todo action
- }
- operations.setEnabled(!resourceType.getOperationDefinitions().isEmpty());
- operations.setSubmenu(opSubMenu);
- contextMenu.addItem(operations);
-
- contextMenu.addItem(buildMetricsMenu(resourceType));
-
- // Create Menu
- MenuItem createChildMenu = new MenuItem(MSG.common_button_create_child());
- Menu createChildSubMenu = new Menu();
- for (final ResourceType childType : resourceType.getChildResourceTypes()) {
- if (childType.isCreatable()) {
- MenuItem createItem = new MenuItem(childType.getName());
- createChildSubMenu.addItem(createItem);
- createItem.addClickHandler(new ClickHandler() {
- public void onClick(MenuItemClickEvent event) {
- ResourceFactoryCreateWizard.showCreateWizard(resource, childType);
- }
- });
-
- }
- }
- createChildMenu.setSubmenu(createChildSubMenu);
- createChildMenu.setEnabled(createChildSubMenu.getItems().length > 0);
- contextMenu.addItem(createChildMenu);
-
- // Manually Add Menu
- MenuItem importChildMenu = new MenuItem(MSG.common_button_import());
- Menu importChildSubMenu = new Menu();
- for (ResourceType childType : resourceType.getChildResourceTypes()) {
- if (childType.isSupportsManualAdd()) {
- importChildSubMenu.addItem(new MenuItem(childType.getName()));
- //todo action
- }
- }
- if (resourceType.getCategory() == ResourceCategory.PLATFORM) {
- loadManuallyAddServersToPlatforms(importChildSubMenu);
- }
- importChildMenu.setSubmenu(importChildSubMenu);
- importChildMenu.setEnabled(importChildSubMenu.getItems().length > 0);
- contextMenu.addItem(importChildMenu);
- }
-
- private void loadManuallyAddServersToPlatforms(final Menu manuallyAddMenu) {
- ResourceTypeGWTServiceAsync rts = GWTServiceLookup.getResourceTypeGWTService();
-
- ResourceTypeCriteria criteria = new ResourceTypeCriteria();
- criteria.addFilterSupportsManualAdd(true);
- criteria.fetchParentResourceTypes(true);
- rts.findResourceTypesByCriteria(criteria, new AsyncCallback<PageList<ResourceType>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.view_tree_common_contextMenu_loadFailed_manualAddChildren(),
- caught);
- }
-
- public void onSuccess(PageList<ResourceType> result) {
- for (ResourceType type : result) {
- if (type.getParentResourceTypes() == null || type.getParentResourceTypes().isEmpty()) {
- MenuItem item = new MenuItem(type.getName());
- manuallyAddMenu.addItem(item);
- }
- }
- }
- });
- }
-
- private MenuItem buildMetricsMenu(final ResourceType type) {
- MenuItem measurements = new MenuItem("Measurements");
- final Menu measurementsSubMenu = new Menu();
-
- GWTServiceLookup.getDashboardService().findDashboardsForSubject(new AsyncCallback<List<Dashboard>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.view_tree_common_contextMenu_loadFailed_dashboard(), caught);
- }
-
- public void onSuccess(List<Dashboard> result) {
-
- for (final MeasurementDefinition def : type.getMetricDefinitions()) {
-
- MenuItem defItem = new MenuItem(def.getDisplayName());
- measurementsSubMenu.addItem(defItem);
- Menu defSubItem = new Menu();
- defItem.setSubmenu(defSubItem);
-
- for (final Dashboard d : result) {
- MenuItem addToDBItem = new MenuItem(MSG.view_tree_common_contextMenu_addChartToDashboard(d
- .getName()));
- defSubItem.addItem(addToDBItem);
-
- addToDBItem.addClickHandler(new ClickHandler() {
- public void onClick(MenuItemClickEvent menuItemClickEvent) {
-
- DashboardPortlet p = new DashboardPortlet(def.getDisplayName() + " Chart",
- GraphPortlet.KEY, 250);
- p.getConfiguration().put(
- new PropertySimple(GraphPortlet.CFG_RESOURCE_ID, selectedResource.getId()));
- p.getConfiguration().put(
- new PropertySimple(GraphPortlet.CFG_DEFINITION_ID, def.getId()));
-
- d.addPortlet(p, 0, 0);
-
- GWTServiceLookup.getDashboardService().storeDashboard(d,
- new AsyncCallback<Dashboard>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(
- MSG.view_tree_common_contextMenu_saveChartToDashboardFailure(), caught);
- }
-
- public void onSuccess(Dashboard result) {
- CoreGUI.getMessageCenter().notify(
- new Message(MSG
- .view_tree_common_contextMenu_saveChartToDashboardSuccessful(result
- .getName()), Message.Severity.Info));
- }
- });
-
- }
- });
-
- }
-
- }
-
- }
- });
- measurements.setSubmenu(measurementsSubMenu);
- return measurements;
- }
-
- Resource getResource(int resourceId) {
- if (this.treeGrid != null && this.treeGrid.getTree() != null) {
- ResourceTreeDatasource.ResourceTreeNode treeNode = (ResourceTreeDatasource.ResourceTreeNode) this.treeGrid
- .getTree().findById(String.valueOf(resourceId));
- if (treeNode != null) {
- return treeNode.getResource();
- }
- }
- return null;
- }
-
- private void setRootResource(Resource rootResource) {
- this.rootResource = rootResource;
- }
-
- public void setSelectedResource(final Resource selectedResource, final ViewId viewId) {
- this.selectedResource = selectedResource;
-
- TreeNode node = null;
- if (treeGrid != null && treeGrid.getTree() != null
- && (node = treeGrid.getTree().findById(String.valueOf(selectedResource.getId()))) != null) {
-
- // This is the case where the tree was previously loaded and we get fired to look at a different
- // node in the same tree and just have to switch the selection
-
- TreeNode[] parents = treeGrid.getTree().getParents(node);
- treeGrid.getTree().openFolders(parents);
- treeGrid.getTree().openFolder(node);
-
- treeGrid.deselectAllRecords();
- treeGrid.selectRecord(node);
-
- // Update breadcrumbs
- viewId.getBreadcrumbs().clear();
- for (int i = parents.length - 1; i >= 0; i--) {
- TreeNode n = parents[i];
- adjustBreadcrumb(n, viewId);
- }
- adjustBreadcrumb(node, viewId);
-
- CoreGUI.refreshBreadCrumbTrail();
-
- } else {
-
- // Data not yet loaded or a node in a different tree
-
- final ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();
-
- resourceService.getPlatformForResource(selectedResource.getId(), new AsyncCallback<Resource>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.view_tree_common_loadFailed_root(), caught);
- }
-
- public void onSuccess(Resource result) {
- rootResource = result;
-
- ResourceCriteria criteria = new ResourceCriteria();
- criteria.addFilterRootResourceId(rootResource.getId());
- criteria.setPageControl(PageControl.getUnlimitedInstance());
-
- resourceService.findResourcesByCriteria(criteria, new AsyncCallback<PageList<Resource>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler()
- .handleError(MSG.view_tree_common_loadFailed_descendants(), caught);
- }
-
- public void onSuccess(PageList<Resource> result) {
-
- loadTree(rootResource.getId(), result);
- }
- });
- }
- });
-
- }
- }
-
- private void loadTree(int rootId, PageList<Resource> result) {
- if (this.treeGrid != null) {
- this.treeGrid.destroy();
- }
- this.buildTree();
-
- HashMap<Integer, Resource> data = new HashMap<Integer, Resource>();
- for (Resource res : result) {
- data.put(res.getId(), res);
- }
-
- Tree tree = new Tree();
-
- tree.setRoot(NewResourceTreeDataSource.build(rootId, data));
- treeGrid.setData(tree);
- addMember(this.treeGrid);
- }
-
- private void adjustBreadcrumb(TreeNode node, ViewId viewId) {
- if (node instanceof ResourceTreeDatasource.ResourceTreeNode) {
-
- Resource nr = ((ResourceTreeDatasource.ResourceTreeNode) node).getResource();
- String display = node.getName() + " <span class=\"subtitle\">" + nr.getResourceType().getName() + "</span>";
- String icon = ImageManager.getResourceIcon(nr.getResourceType().getCategory());
-
- viewId.getBreadcrumbs().add(new Breadcrumb(node.getAttribute("id"), display, icon, true));
-
- } else {
-
- // if (node.getName() != null) {
- // viewId.getBreadcrumbs().add(new Breadcrumb(node.getAttribute("id"), node.getName(), null, true));
- // }
- }
- }
-
- public void addResourceSelectListener(ResourceSelectListener listener) {
- this.selectListeners.add(listener);
- }
-
- public void renderView(ViewPath viewPath) {
- currentViewId = viewPath.getCurrent();
- }
-}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
index dcbfaea..a0d233d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
@@ -66,9 +66,7 @@ import org.rhq.core.domain.resource.composite.ResourceLineageComposite;
import org.rhq.core.domain.resource.composite.ResourcePermission;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.gui.coregui.client.Breadcrumb;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.ImageManager;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.ViewId;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
@@ -78,11 +76,11 @@ import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGroupGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceTypeGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.inventory.InventoryView;
+import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.schedule.OperationCreateWizard;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.ResourceGroupContextMenu;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.ResourceGroupDetailView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceTreeDatasource.AutoGroupTreeNode;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceTreeDatasource.ResourceTreeNode;
-import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.schedule.OperationCreateWizard;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.factory.ResourceFactoryCreateWizard;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.factory.ResourceFactoryImportWizard;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
@@ -311,36 +309,6 @@ public class ResourceTreeView extends LocatableVLayout {
}
treeGrid.markForRedraw();
-
- // Update breadcrumbs
- if (currentViewId != null) {
- currentViewId.getBreadcrumbs().clear();
- if (null != parents) {
- for (int i = parents.length - 1; i >= 0; i--) {
- TreeNode n = parents[i];
- adjustBreadcrumb(n, currentViewId);
- }
- }
- adjustBreadcrumb(selectedNode, currentViewId);
- CoreGUI.refreshBreadCrumbTrail();
- }
- }
- }
-
- private void adjustBreadcrumb(TreeNode node, ViewId viewId) {
- if (node instanceof ResourceTreeNode) {
- Resource nr = ((ResourceTreeNode) node).getResource();
- String display = node.getName() + " <span class=\"subtitle\">" + nr.getResourceType().getName() + "</span>";
- String icon = ImageManager.getResourceIcon(nr.getResourceType().getCategory());
-
- viewId.getBreadcrumbs().add(new Breadcrumb(node.getAttribute("id"), display, icon, true));
-
- } else if (node instanceof AutoGroupTreeNode) {
- String name = ((AutoGroupTreeNode) node).getBackingGroupName();
- String display = node.getName() + " <span class=\"subtitle\">" + name + "</span>";
- String icon = ImageManager.getResourceIcon(((AutoGroupTreeNode) node).getResourceType().getCategory());
-
- viewId.getBreadcrumbs().add(new Breadcrumb(node.getAttribute("id"), display, icon, true));
}
}
@@ -832,5 +800,5 @@ public class ResourceTreeView extends LocatableVLayout {
setSelectedResource(resourceId);
}
}
-
+
}
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 d7c9176..69803a3 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
@@ -658,7 +658,6 @@ view_alerts_ack_success = Successfully acknowledged {0} alerts
view_alerts_ack_failure = Failed to acknowledge alerts with id''s: {0}
view_alerts_ack_failure_all = Failed to acknowledge all alerts from this source
view_alert_details_loadFailed = Failed to fetch alert details
-view_alert_details_breadcrumb = Details
view_alert_details_field_ack_by = Acknowledged by
view_alert_details_field_ack_at = Acknowledged at
view_alert_details_field_recovery_info = Recovery Info
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/header/breadcrumb_space.png b/modules/enterprise/gui/coregui/src/main/webapp/images/header/breadcrumb_space.png
deleted file mode 100644
index e6fdc85..0000000
Binary files a/modules/enterprise/gui/coregui/src/main/webapp/images/header/breadcrumb_space.png and /dev/null differ
13 years, 6 months
[rhq] modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java | 148 +++----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java | 200 ++++++----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesWithLatestVersionDataSource.java | 57 --
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeView.java | 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TaggedView.java | 2
6 files changed, 225 insertions(+), 187 deletions(-)
New commits:
commit 8c80f13e1b4b15826e260ebe74d5f3820e6dfea9
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Dec 16 19:04:23 2010 -0500
partial BZ 663727 - bundle main view no longer shows repositories unless user has manage_inventory perm
also adds double click to the bundle list so it drills down just as if you clicked the link
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 6528e76..49395c0 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
@@ -319,4 +319,8 @@ public class LinkManager {
public static String getTagLink(String tag) {
return "#Reports/Subsystems/Tags/" + tag;
}
+
+ public static String getBundleLink(int bundleId) {
+ return "#Bundles/Bundle/" + bundleId;
+ }
}
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 0dc46b5..e41d351 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,7 +18,8 @@
*/
package org.rhq.enterprise.gui.coregui.client.bundle;
-import com.allen_sauer.gwt.log.client.Log;
+import java.util.Set;
+
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.types.VisibilityMode;
import com.smartgwt.client.widgets.Canvas;
@@ -26,7 +27,10 @@ import com.smartgwt.client.widgets.layout.SectionStack;
import com.smartgwt.client.widgets.layout.SectionStackSection;
import com.smartgwt.client.widgets.layout.VLayout;
+import org.rhq.core.domain.authz.Permission;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoadedListener;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoader;
import org.rhq.enterprise.gui.coregui.client.ViewId;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.bundle.list.BundleView;
@@ -38,19 +42,21 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableSectionStack;
/**
+ * This is the main bundle view with left hand side trees and right hand side list/details view.
+ *
* @author Greg Hinkle
+ * @author John Mazzitelli
*/
public class BundleTopView extends LocatableHLayout implements BookmarkableView {
public static final ViewName VIEW_ID = new ViewName("Bundles", MSG.view_bundle_bundles());
- private BundleTreeView bundleTreeView;
-
- private VLayout contentCanvas;
-
private ViewId currentNextPath;
- private BundleView bundleView;
- private BundlesListView bundlesListView;
+
+ private BundleTreeView bundleTreeView; // the tree of bundle destinations and versions
+ private VLayout contentCanvas; // the right-side canvas container
+ private BundleView bundleView; // if the user is viewing an individual bundle, this is that right-side view
+ private BundlesListView bundlesListView; // if the user is not viewing an indiv. bundle, this is the right-side list
public BundleTopView(String locatorId) {
super(locatorId);
@@ -59,38 +65,74 @@ public class BundleTopView extends LocatableHLayout implements BookmarkableView
setHeight100();
}
- @Override
- protected void onDraw() {
- super.onDraw();
-
- SectionStack sectionStack = new LocatableSectionStack(getLocatorId());
- sectionStack.setShowResizeBar(true);
- sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE);
- sectionStack.setWidth(250);
- sectionStack.setHeight100();
-
- SectionStackSection bundlesSection = new SectionStackSection(MSG.view_bundle_bundles());
- bundleTreeView = new BundleTreeView(extendLocatorId("BundleTree"));
- bundlesSection.addItem(bundleTreeView);
- sectionStack.addSection(bundlesSection);
-
- SectionStackSection repositoriesSection = new SectionStackSection(MSG.common_title_repositories());
- ContentRepositoryTreeView repoTree = new ContentRepositoryTreeView(extendLocatorId("RepoTree"));
- repositoriesSection.addItem(repoTree);
- sectionStack.addSection(repositoriesSection);
-
- SectionStackSection providersSection = new SectionStackSection(MSG.common_title_providers());
- sectionStack.addSection(providersSection);
-
- addMember(sectionStack);
-
- contentCanvas = new VLayout();
- contentCanvas.setWidth100();
- contentCanvas.setHeight100();
- addMember(contentCanvas);
+ public void renderView(final ViewPath viewPath) {
+ new PermissionsLoader().loadExplicitGlobalPermissions(new PermissionsLoadedListener() {
+ @Override
+ public void onPermissionsLoaded(Set<Permission> permissions) {
+ // if we haven't done it yet, build the view components
+ if (bundleTreeView == null) {
+ SectionStack sectionStack = new LocatableSectionStack(getLocatorId());
+ sectionStack.setShowResizeBar(true);
+ sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE);
+ sectionStack.setWidth(250);
+ sectionStack.setHeight100();
+
+ SectionStackSection bundlesSection = new SectionStackSection(MSG.view_bundle_bundles());
+ bundleTreeView = new BundleTreeView(extendLocatorId("BundleTree"));
+ bundlesSection.addItem(bundleTreeView);
+ sectionStack.addSection(bundlesSection);
+
+ // we only show repositories if the user has the global manage_inventory perms since that is required
+ if (permissions != null && permissions.contains(Permission.MANAGE_INVENTORY)) {
+ SectionStackSection repositoriesSection = new SectionStackSection(MSG
+ .common_title_repositories());
+ ContentRepositoryTreeView repoTree = new ContentRepositoryTreeView(extendLocatorId("RepoTree"));
+ repositoriesSection.addItem(repoTree);
+ sectionStack.addSection(repositoriesSection);
+ }
+
+ // TODO: we aren't doing anything with providers yet
+ // SectionStackSection providersSection = new SectionStackSection(MSG.common_title_providers());
+ // sectionStack.addSection(providersSection);
+
+ addMember(sectionStack);
+
+ contentCanvas = new VLayout();
+ contentCanvas.setWidth100();
+ contentCanvas.setHeight100();
+ addMember(contentCanvas);
+ }
+
+ if (viewPath.isRefresh()) {
+ bundleTreeView.refresh();
+ }
+
+ bundleTreeView.selectPath(viewPath);
+
+ if (viewPath.isEnd()) {
+ if (currentNextPath == null && bundlesListView != null) {
+ bundlesListView.refresh();
+ } else {
+ currentNextPath = null;
+ bundlesListView = new BundlesListView(extendLocatorId("BundleList"), permissions);
+ setContent(bundlesListView);
+ }
+ } else {
+ viewPath.getCurrent().getBreadcrumbs().clear();
+ if (!viewPath.getNext().equals(currentNextPath)) {
+ currentNextPath = viewPath.getNext();
+ bundleView = new BundleView(extendLocatorId("Bundle"));
+ setContent(bundleView);
+ bundleView.renderView(viewPath.next());
+ } else {
+ bundleView.renderView(viewPath.next());
+ }
+ }
+ }
+ });
}
- public void setContent(Canvas newContent) {
+ private void setContent(Canvas newContent) {
for (Canvas c : contentCanvas.getMembers()) {
c.destroy();
}
@@ -98,36 +140,4 @@ public class BundleTopView extends LocatableHLayout implements BookmarkableView
contentCanvas.markForRedraw();
}
- public void renderView(ViewPath viewPath) {
-
- if (viewPath.isRefresh()) {
- bundleTreeView.refresh();
- }
-
- bundleTreeView.selectPath(viewPath);
-
- if (viewPath.isEnd()) {
- if (currentNextPath == null && bundlesListView != null) {
- // refresh
- Log.info("Refreshing BundleTopView");
-
- bundlesListView.refresh();
- } else {
- currentNextPath = null;
- this.bundlesListView = new BundlesListView(extendLocatorId("BundleList"));
- setContent(this.bundlesListView);
- }
- } else {
- viewPath.getCurrent().getBreadcrumbs().clear();
- if (!viewPath.getNext().equals(currentNextPath)) {
- currentNextPath = viewPath.getNext();
- bundleView = new BundleView(extendLocatorId("Bundle"));
- setContent(bundleView);
- bundleView.renderView(viewPath.next());
- } else {
- bundleView.renderView(viewPath.next());
- }
- }
- }
-
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
index bbe68f2..e06b795 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
@@ -18,16 +18,25 @@
*/
package org.rhq.enterprise.gui.coregui.client.bundle.list;
+import java.util.Set;
+
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.ListGridFieldType;
+import com.smartgwt.client.widgets.events.DoubleClickEvent;
+import com.smartgwt.client.widgets.events.DoubleClickHandler;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
+import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.bundle.Bundle;
import org.rhq.core.domain.bundle.composite.BundleWithLatestVersionComposite;
import org.rhq.core.domain.criteria.BundleCriteria;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.bundle.create.BundleCreateWizard;
import org.rhq.enterprise.gui.coregui.client.bundle.deploy.BundleDeployWizard;
import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableAction;
@@ -35,109 +44,152 @@ import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
/**
+ * Shows a list of bundles in the system. The list gives you some actions like new, delete and deploy but
+ * only if you provide the proper permissions. If you give null permissions, no action buttons are shown.
+ *
* @author Greg Hinkle
+ * @author John Mazzitelli
*/
-public class BundlesListView extends Table {
-
- public BundlesListView(String locatorId) {
- this(locatorId, null);
+public class BundlesListView extends Table<RPCDataSource<BundleWithLatestVersionComposite>> {
+
+ private final Set<Permission> permissions;
+
+ /**
+ * Creates a new list view.
+ *
+ * @param locatorId
+ * @param perms if perms is null, no button actions will be shown in the table
+ */
+ public BundlesListView(String locatorId, Set<Permission> perms) {
+ this(locatorId, null, perms);
}
- public BundlesListView(String locatorId, Criteria criteria) {
+ public BundlesListView(String locatorId, Criteria criteria, Set<Permission> perms) {
super(locatorId, MSG.view_bundle_bundles(), criteria);
+ this.permissions = perms;
setHeaderIcon("subsystems/bundle/Bundle_24.png");
setDataSource(new BundlesWithLatestVersionDataSource());
}
@Override
protected void configureTable() {
- getListGrid().getField("id").setWidth("60");
- getListGrid().getField("link").setWidth("25%");
- getListGrid().getField("link").setType(ListGridFieldType.LINK);
- getListGrid().getField("link").setTarget("_self");
-
- // getListGrid().getField("name").setCellFormatter(new CellFormatter() {
- // public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
- // return "";//<a href=\"#Bundles/Bundle/" + listGridRecord.getAttribute("id") + "\">" + o + "</a>";
- // }
- // });
-
- getListGrid().getField("description").setWidth("25%");
- getListGrid().getField("latestVersion").setWidth("25%");
- getListGrid().getField("versionsCount").setWidth("*");
-
- addTableAction(extendLocatorId("New"), MSG.common_button_new(), null, new AbstractTableAction() {
- public void executeAction(ListGridRecord[] selection, Object actionValue) {
- new BundleCreateWizard().startWizard();
+
+ ListGridField idField = new ListGridField(BundlesWithLatestVersionDataSource.FIELD_ID, MSG.common_title_id());
+ idField.setType(ListGridFieldType.INTEGER);
+ idField.setWidth("50");
+
+ ListGridField nameField = new ListGridField(BundlesWithLatestVersionDataSource.FIELD_NAMELINK, MSG
+ .common_title_name());
+ nameField.setType(ListGridFieldType.LINK);
+ nameField.setTarget("_self");
+ nameField.setWidth("33%");
+
+ ListGridField descField = new ListGridField(BundlesWithLatestVersionDataSource.FIELD_DESCRIPTION, MSG
+ .common_title_description());
+ descField.setWidth("33%");
+
+ ListGridField latestVersionField = new ListGridField(BundlesWithLatestVersionDataSource.FIELD_LATEST_VERSION,
+ MSG.view_bundle_latestVersion());
+ latestVersionField.setWidth("20%");
+ latestVersionField.setAlign(Alignment.CENTER);
+
+ ListGridField versionsCountField = new ListGridField(BundlesWithLatestVersionDataSource.FIELD_VERSIONS_COUNT,
+ MSG.view_bundle_list_versionsCount());
+ versionsCountField.setType(ListGridFieldType.INTEGER);
+ versionsCountField.setWidth("*");
+ versionsCountField.setAlign(Alignment.CENTER);
+
+ setListGridFields(idField, nameField, descField, latestVersionField, versionsCountField);
+
+ setListGridDoubleClickHandler(new DoubleClickHandler() {
+ @Override
+ public void onDoubleClick(DoubleClickEvent event) {
+ ListGrid listGrid = (ListGrid) event.getSource();
+ ListGridRecord[] selectedRows = listGrid.getSelection();
+ if (selectedRows != null && selectedRows.length == 1) {
+ String selectedId = selectedRows[0].getAttribute(BundlesWithLatestVersionDataSource.FIELD_ID);
+ CoreGUI.goToView(LinkManager.getBundleLink(Integer.valueOf(selectedId)));
+ }
}
});
- addTableAction(extendLocatorId("Delete"), MSG.common_button_delete(), MSG.common_msg_areYouSure(),
- new AbstractTableAction(TableActionEnablement.ANY) {
- public void executeAction(ListGridRecord[] selections, Object actionValue) {
- BundlesWithLatestVersionDataSource ds = (BundlesWithLatestVersionDataSource) getDataSource();
- for (ListGridRecord selection : selections) {
- BundleGWTServiceAsync bundleManager = GWTServiceLookup.getBundleService();
- final BundleWithLatestVersionComposite object = ds.copyValues(selection);
- bundleManager.deleteBundle(object.getBundleId(), new AsyncCallback<Void>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(
- MSG.view_bundle_list_deleteFailure(object.getBundleName()), caught);
- }
+ // only show the buttons if we were given a set of permissions - passing in null is a way to say you only want the list, no actions
+ if (this.permissions != null) {
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(
- new Message(MSG.view_bundle_list_deleteSuccessful(object.getBundleName()),
- Severity.Info));
+ boolean hasAuth = permissions.contains(Permission.MANAGE_BUNDLE);
- CoreGUI.refresh();
- }
- });
- }
+ addTableAction(extendLocatorId("New"), MSG.common_button_new(), null, new AbstractTableAction(
+ (hasAuth) ? TableActionEnablement.ALWAYS : TableActionEnablement.NEVER) {
+ public void executeAction(ListGridRecord[] selection, Object actionValue) {
+ new BundleCreateWizard().startWizard();
}
});
- // can change this back to SINGLE selection when we feel like it. currently allowing the wizard to
- // select the bundle.
- addTableAction(extendLocatorId("Deploy"), MSG.view_bundle_deploy(), null, new AbstractTableAction() {
- public void executeAction(ListGridRecord[] selection, Object actionValue) {
- if (selection.length == 0) {
- new BundleDeployWizard().startWizard();
- return;
- }
+ addTableAction(extendLocatorId("Delete"), MSG.common_button_delete(), MSG.common_msg_areYouSure(),
+ new AbstractTableAction((hasAuth) ? TableActionEnablement.ANY : TableActionEnablement.NEVER) {
+ public void executeAction(ListGridRecord[] selections, Object actionValue) {
+ BundlesWithLatestVersionDataSource ds = (BundlesWithLatestVersionDataSource) getDataSource();
+ for (ListGridRecord selection : selections) {
+ BundleGWTServiceAsync bundleManager = GWTServiceLookup.getBundleService();
+ final BundleWithLatestVersionComposite object = ds.copyValues(selection);
+ bundleManager.deleteBundle(object.getBundleId(), new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+ MSG.view_bundle_list_deleteFailure(object.getBundleName()), caught);
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message(MSG.view_bundle_list_deleteSuccessful(object.getBundleName()),
+ Severity.Info));
+
+ CoreGUI.refresh();
+ }
+ });
+ }
+ }
+ });
- BundlesWithLatestVersionDataSource ds = (BundlesWithLatestVersionDataSource) getDataSource();
- final BundleWithLatestVersionComposite object = ds.copyValues(selection[0]);
- BundleCriteria bc = new BundleCriteria();
- bc.addFilterId(object.getBundleId());
- BundleGWTServiceAsync bundleManager = GWTServiceLookup.getBundleService();
- bundleManager.findBundlesByCriteria(bc, new AsyncCallback<PageList<Bundle>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.view_bundle_list_loadFailure(object.getBundleName()),
- caught);
+ // can change this back to SINGLE selection when we feel like it. currently allowing the wizard to
+ // select the bundle.
+ addTableAction(extendLocatorId("Deploy"), MSG.view_bundle_deploy(), null, new AbstractTableAction(
+ (hasAuth) ? TableActionEnablement.ALWAYS : TableActionEnablement.NEVER) {
+ public void executeAction(ListGridRecord[] selection, Object actionValue) {
+ if (selection.length == 0) {
+ new BundleDeployWizard().startWizard();
+ return;
}
- public void onSuccess(PageList<Bundle> result) {
- if (result == null || result.size() != 1) {
- CoreGUI.getMessageCenter().notify(
- new Message(MSG.view_bundle_list_singleLoadFailure(object.getBundleName()),
- Severity.Error));
- return;
+ BundlesWithLatestVersionDataSource ds = (BundlesWithLatestVersionDataSource) getDataSource();
+ final BundleWithLatestVersionComposite object = ds.copyValues(selection[0]);
+ BundleCriteria bc = new BundleCriteria();
+ bc.addFilterId(object.getBundleId());
+ BundleGWTServiceAsync bundleManager = GWTServiceLookup.getBundleService();
+ bundleManager.findBundlesByCriteria(bc, new AsyncCallback<PageList<Bundle>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+ MSG.view_bundle_list_loadFailure(object.getBundleName()), caught);
}
- new BundleDeployWizard(result.get(0).getId()).startWizard();
- }
- });
- }
- });
+ public void onSuccess(PageList<Bundle> result) {
+ if (result == null || result.size() != 1) {
+ CoreGUI.getMessageCenter().notify(
+ new Message(MSG.view_bundle_list_singleLoadFailure(object.getBundleName()),
+ Severity.Error));
+ return;
+ }
+ new BundleDeployWizard(result.get(0).getId()).startWizard();
+ }
+ });
+ }
+ });
+ }
}
- public int getMatches() {
- return this.getListGrid().getTotalRows();
- }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesWithLatestVersionDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesWithLatestVersionDataSource.java
index c513513..0932620 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesWithLatestVersionDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesWithLatestVersionDataSource.java
@@ -25,15 +25,13 @@ import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.data.DataSourceField;
import com.smartgwt.client.data.Record;
-import com.smartgwt.client.data.fields.DataSourceIntegerField;
-import com.smartgwt.client.data.fields.DataSourceLinkField;
-import com.smartgwt.client.data.fields.DataSourceTextField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.core.domain.bundle.composite.BundleWithLatestVersionComposite;
import org.rhq.core.domain.criteria.BundleCriteria;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
@@ -43,6 +41,13 @@ import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
*/
public class BundlesWithLatestVersionDataSource extends RPCDataSource<BundleWithLatestVersionComposite> {
+ public static final String FIELD_ID = "id";
+ public static final String FIELD_NAME = "name";
+ public static final String FIELD_NAMELINK = "namelink";
+ public static final String FIELD_DESCRIPTION = "description";
+ public static final String FIELD_LATEST_VERSION = "latestVersion";
+ public static final String FIELD_VERSIONS_COUNT = "versionsCount";
+
private BundleGWTServiceAsync bundleService = GWTServiceLookup.getBundleService();
public BundlesWithLatestVersionDataSource() {
@@ -52,31 +57,6 @@ public class BundlesWithLatestVersionDataSource extends RPCDataSource<BundleWith
}
@Override
- protected List<DataSourceField> addDataSourceFields() {
- List<DataSourceField> fields = super.addDataSourceFields();
-
- DataSourceIntegerField idField = new DataSourceIntegerField("id", MSG.common_title_id());
- idField.setPrimaryKey(true);
- fields.add(idField);
-
- DataSourceLinkField linkField = new DataSourceLinkField("link", MSG.common_title_name());
- fields.add(linkField);
-
- DataSourceTextField descriptionField = new DataSourceTextField("description", MSG.common_title_description());
- fields.add(descriptionField);
-
- DataSourceTextField latestVersionField = new DataSourceTextField("latestVersion", MSG
- .view_bundle_latestVersion());
- fields.add(latestVersionField);
-
- DataSourceIntegerField deploymentCountField = new DataSourceIntegerField("versionsCount", MSG
- .view_bundle_list_versionsCount());
- fields.add(deploymentCountField);
-
- return fields;
- }
-
- @Override
protected void executeFetch(final DSRequest request, final DSResponse response) {
BundleCriteria criteria = new BundleCriteria();
@@ -112,29 +92,22 @@ public class BundlesWithLatestVersionDataSource extends RPCDataSource<BundleWith
@Override
public BundleWithLatestVersionComposite copyValues(Record from) {
- Integer idAttrib = from.getAttributeAsInt("id");
- String nameAttrib = from.getAttribute("name");
- String descriptionAttrib = from.getAttribute("description");
- String latestVersionAttrib = from.getAttribute("latestVersion");
- Integer versionsCountAttrib = from.getAttributeAsInt("versionsCount");
-
- return new BundleWithLatestVersionComposite(idAttrib, nameAttrib, descriptionAttrib, latestVersionAttrib,
- versionsCountAttrib.longValue());
+ return (BundleWithLatestVersionComposite) from.getAttributeAsObject("object");
}
@Override
public ListGridRecord copyValues(BundleWithLatestVersionComposite from) {
ListGridRecord record = new ListGridRecord();
- record.setAttribute("id", from.getBundleId());
- record.setAttribute("name", from.getBundleName());
+ record.setAttribute(FIELD_ID, from.getBundleId());
+ record.setAttribute(FIELD_NAME, from.getBundleName());
- record.setAttribute("link", "#Bundles/Bundle/" + from.getBundleId());
+ record.setAttribute(FIELD_NAMELINK, LinkManager.getBundleLink(from.getBundleId()));
record.setLinkText(from.getBundleName());
- record.setAttribute("description", from.getBundleDescription());
- record.setAttribute("latestVersion", from.getLatestVersion());
- record.setAttribute("versionsCount", Integer.valueOf(from.getVersionsCount().intValue())); // want int, not long
+ record.setAttribute(FIELD_DESCRIPTION, from.getBundleDescription());
+ record.setAttribute(FIELD_LATEST_VERSION, from.getLatestVersion());
+ record.setAttribute(FIELD_VERSIONS_COUNT, Integer.valueOf(from.getVersionsCount().intValue())); // want int, not long
record.setAttribute("object", from);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeView.java
index 236f728..12b8e23 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeView.java
@@ -44,7 +44,6 @@ public class BundleTreeView extends LocatableTreeGrid {
setWidth100();
setHeight100();
setLeaveScrollbarGap(false);
- // setShowRoot(true);
setAutoFetchData(true);
setAnimateFolders(false);
setSelectionType(SelectionStyle.SINGLE);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TaggedView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TaggedView.java
index feb325e..7192f94 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TaggedView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TaggedView.java
@@ -98,7 +98,7 @@ public class TaggedView extends LocatableVLayout implements BookmarkableView {
Tab tab;
- BundlesListView bundlesView = new BundlesListView(getLocatorId(), criteria);
+ BundlesListView bundlesView = new BundlesListView(getLocatorId(), criteria, null);
viewsWithTags.add(bundlesView);
tab = new LocatableTab(extendLocatorId("bundleList"), MSG.view_bundle_bundles());
tab.setPane(bundlesView);
13 years, 6 months
[rhq] 3 commits - modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/PermissionsLoadedListener.java | 16 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/PermissionsLoader.java | 117 ++++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java | 21 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java | 33 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java | 30 --
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java | 26 --
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java | 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/RepoGWTService.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/InventoryView.java | 18 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java | 21 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java | 23 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java | 29 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/AutodiscoveryQueueDataSource.java | 65 ++---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/RepoGWTServiceImpl.java | 4
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 4
15 files changed, 246 insertions(+), 169 deletions(-)
New commits:
commit 647d8e92fe2cf690c42ce6b36889ec8c59109eb1
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Dec 16 15:47:43 2010 -0500
introduce a new PermissionsLoader. this does NOT cache - but it makes
getting permissions a bit easier and less boiler plate code is needed.
I've noticed all the uses of AuthorizationService all had the same
basic onFailure implementation - this helps eliminate the need for
that duplicate code and also makes the error message common across
(which is what it should have been but some places duplicated messages
in Message.properties - those dups have been removed).
this now provides a single place where perms can be obtained and, in the
future, if we do want to do some type of caching or at least limit the
loading of the same perms repeatedly in the same request,
this one place is all that is needed to change.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/PermissionsLoadedListener.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/PermissionsLoadedListener.java
index 0c20eca..2ae6faa 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/PermissionsLoadedListener.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/PermissionsLoadedListener.java
@@ -24,10 +24,22 @@ import java.util.Set;
import org.rhq.core.domain.authz.Permission;
/**
+ * This is called by the {@link PermissionsLoader} when a set of permissions have been loaded
+ * or a failure occurred and the permissions failed to load.
+ *
* @author Ian Springer
+ * @author John Mazzitelli
*/
public interface PermissionsLoadedListener {
- void onPermissionsLoaded(Set<Permission> permissions);
-
+ /**
+ * The callback method that is called when the {@link PermissionsLoader} finished
+ * its remote call. If the call was successful, the given permissions argument will
+ * be non-null (but may be empty). If an error occurred that failed to load the permissions,
+ * <code>null</code> will be passed in as the value.
+ *
+ * @param permissions the permissions if successfully loaded; <code>null</code> if an error
+ * occurred and the permissions are unknown
+ */
+ void onPermissionsLoaded(Set<Permission> permissions);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/PermissionsLoader.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/PermissionsLoader.java
new file mode 100644
index 0000000..42cb182
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/PermissionsLoader.java
@@ -0,0 +1,117 @@
+/*
+ * 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;
+
+import java.util.EnumSet;
+import java.util.Set;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+
+import org.rhq.core.domain.authz.Permission;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message.Option;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
+
+/**
+ * Provides convienence methods that loads permissions and notifies you via a callback when done.
+ * If an error occurs, the error will be logged in the message center.
+ * This stores the last error received, in case a caller wants more information on failures.
+ *
+ * Usage of this ensures consistency of error messages that occur when permission loading fails and
+ * allows callers to implement a smaller callback object ({@link PermissionsLoadedListener}).
+ *
+ * @author John Mazzitelli
+ */
+public class PermissionsLoader {
+
+ private static Messages MSG = CoreGUI.getMessages();
+ private Throwable lastError;
+
+ /**
+ * Returns the last error that occurred while trying to load permissions.
+ *
+ * @return last error that occurred during permissions loading
+ */
+ public Throwable getLastError() {
+ return lastError;
+ }
+
+ public void loadExplicitGlobalPermissions(final PermissionsLoadedListener callback) {
+ GWTServiceLookup.getAuthorizationService().getExplicitGlobalPermissions(new AsyncCallback<Set<Permission>>() {
+
+ @Override
+ public void onSuccess(Set<Permission> result) {
+ callback.onPermissionsLoaded(result);
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ processFailure(MSG.util_userPerm_loadFailGlobal(), caught);
+ callback.onPermissionsLoaded(null); // indicate an error by passing in null
+ }
+ });
+ }
+
+ public void loadExplicitGroupPermissions(final int groupId, final PermissionsLoadedListener callback) {
+ GWTServiceLookup.getAuthorizationService().getExplicitGroupPermissions(groupId,
+ new AsyncCallback<Set<Permission>>() {
+
+ @Override
+ public void onSuccess(Set<Permission> result) {
+ callback.onPermissionsLoaded(result);
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ processFailure(MSG.util_userPerm_loadFailGroup(String.valueOf(groupId)), caught);
+ callback.onPermissionsLoaded(null); // indicate an error by passing in null
+ }
+ });
+ }
+
+ public void loadExplicitResourcePermissions(final int resourceId, final PermissionsLoadedListener callback) {
+ GWTServiceLookup.getAuthorizationService().getExplicitResourcePermissions(resourceId,
+ new AsyncCallback<Set<Permission>>() {
+
+ @Override
+ public void onSuccess(Set<Permission> result) {
+ callback.onPermissionsLoaded(result);
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ processFailure(MSG.util_userPerm_loadFailResource(String.valueOf(resourceId)), caught);
+ callback.onPermissionsLoaded(null); // indicate an error by passing in null
+ }
+ });
+ }
+
+ protected void processFailure(String msg, Throwable caught) {
+ this.lastError = caught;
+ EnumSet<Option> options = EnumSet.of(Message.Option.BackgroundJobResult);
+ Severity severity = Message.Severity.Error;
+ CoreGUI.getMessageCenter().notify(new Message(msg, caught, severity, options));
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java
index 0757313..3d63160 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java
@@ -19,7 +19,6 @@
package org.rhq.enterprise.gui.coregui.client.admin.roles;
import java.util.ArrayList;
-import java.util.EnumSet;
import java.util.List;
import java.util.Set;
@@ -40,6 +39,8 @@ import org.rhq.core.domain.resource.group.GroupCategory;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoadedListener;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoader;
import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.admin.users.UsersDataSource;
@@ -49,7 +50,6 @@ import org.rhq.enterprise.gui.coregui.client.components.selector.AssignedItemsCh
import org.rhq.enterprise.gui.coregui.client.components.selector.AssignedItemsChangedHandler;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.selection.ResourceGroupSelector;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableTab;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableTabSet;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
@@ -89,18 +89,13 @@ public class RoleEditView extends AbstractRecordEditor<RolesDataSource> implemen
this.isSystemRole = RolesDataSource.isSystemRoleId(getRecordId());
- GWTServiceLookup.getAuthorizationService().getExplicitGlobalPermissions(new AsyncCallback<Set<Permission>>() {
+ new PermissionsLoader().loadExplicitGlobalPermissions(new PermissionsLoadedListener() {
@Override
- public void onSuccess(Set<Permission> result) {
- RoleEditView.this.hasManageSecurityPermission = result.contains(Permission.MANAGE_SECURITY);
- checkIfLdapConfigured();
- }
-
- @Override
- public void onFailure(Throwable caught) {
- CoreGUI.getMessageCenter().notify(
- new Message(MSG.util_userPerm_loadFailGlobal(), caught, Message.Severity.Error, EnumSet
- .of(Message.Option.BackgroundJobResult)));
+ public void onPermissionsLoaded(Set<Permission> perms) {
+ if (perms != null) {
+ RoleEditView.this.hasManageSecurityPermission = perms.contains(Permission.MANAGE_SECURITY);
+ checkIfLdapConfigured();
+ }
}
});
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
index 3c1c5f1..190045a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
@@ -18,23 +18,20 @@
*/
package org.rhq.enterprise.gui.coregui.client.admin.roles;
-import java.util.EnumSet;
import java.util.Set;
-import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.core.domain.authz.Permission;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoadedListener;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoader;
import org.rhq.enterprise.gui.coregui.client.admin.AdministrationView;
import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
import org.rhq.enterprise.gui.coregui.client.components.table.TableSection;
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.util.message.Message;
/**
* A table that lists all roles and provides the ability to view details of or delete those roles and to create new
@@ -48,7 +45,7 @@ public class RolesView extends TableSection<RolesDataSource> implements Bookmark
public static final ViewName VIEW_ID = new ViewName("Roles", MSG.view_adminSecurity_roles());
public static final String VIEW_PATH = AdministrationView.VIEW_ID + "/"
+ AdministrationView.SECTION_SECURITY_VIEW_ID + "/" + VIEW_ID;
-
+
private static final String HEADER_ICON = "global/Role_24.png";
private boolean hasManageSecurity;
@@ -60,7 +57,7 @@ public class RolesView extends TableSection<RolesDataSource> implements Bookmark
setDataSource(datasource);
setHeaderIcon(HEADER_ICON);
}
-
+
@Override
protected void configureTable() {
super.configureTable();
@@ -108,23 +105,17 @@ public class RolesView extends TableSection<RolesDataSource> implements Bookmark
}
private void fetchManageSecurityPermissionAsync() {
- GWTServiceLookup.getAuthorizationService().getExplicitGlobalPermissions(
- new AsyncCallback<Set<Permission>>() {
-
- @Override
- public void onSuccess(Set<Permission> result) {
- hasManageSecurity = result.contains(Permission.MANAGE_SECURITY);
+ new PermissionsLoader().loadExplicitGlobalPermissions(new PermissionsLoadedListener() {
+ @Override
+ public void onPermissionsLoaded(Set<Permission> permissions) {
+ if (permissions != null) {
+ hasManageSecurity = permissions.contains(Permission.MANAGE_SECURITY);
refresh();
- }
-
- @Override
- public void onFailure(Throwable caught) {
+ } else {
hasManageSecurity = false;
- CoreGUI.getMessageCenter().notify(
- new Message(MSG.util_userPerm_loadFailGlobal(), caught, Message.Severity.Error, EnumSet
- .of(Message.Option.BackgroundJobResult)));
}
- });
+ }
+ });
}
@Override
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
index d7a7481..04bc1b3 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
@@ -19,11 +19,9 @@
package org.rhq.enterprise.gui.coregui.client.admin.users;
import java.util.ArrayList;
-import java.util.EnumSet;
import java.util.List;
import java.util.Set;
-import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Record;
import com.smartgwt.client.widgets.form.fields.FormItem;
import com.smartgwt.client.widgets.form.fields.PasswordItem;
@@ -37,15 +35,14 @@ import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.core.domain.auth.Principal;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Permission;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoadedListener;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoader;
import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.components.form.AbstractRecordEditor;
import org.rhq.enterprise.gui.coregui.client.components.form.EnhancedDynamicForm;
import org.rhq.enterprise.gui.coregui.client.components.selector.AssignedItemsChangedEvent;
import org.rhq.enterprise.gui.coregui.client.components.selector.AssignedItemsChangedHandler;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message;
/**
* A form for viewing and/or editing an RHQ user (i.e. a {@link Subject}, and optionally an associated
@@ -70,21 +67,16 @@ public class UserEditView extends AbstractRecordEditor<UsersDataSource> {
public void renderView(ViewPath viewPath) {
super.renderView(viewPath);
- GWTServiceLookup.getAuthorizationService().getExplicitGlobalPermissions(new AsyncCallback<Set<Permission>>() {
+ new PermissionsLoader().loadExplicitGlobalPermissions(new PermissionsLoadedListener() {
@Override
- public void onSuccess(Set<Permission> result) {
- UserEditView.this.hasManageSecurityPermission = result.contains(Permission.MANAGE_SECURITY);
- Subject sessionSubject = UserSessionManager.getSessionSubject();
- boolean isEditingSelf = (sessionSubject.getId() == getRecordId());
- boolean isReadOnly = (!UserEditView.this.hasManageSecurityPermission && !isEditingSelf);
- init(isReadOnly);
- }
-
- @Override
- public void onFailure(Throwable caught) {
- CoreGUI.getMessageCenter().notify(
- new Message(MSG.util_userPerm_loadFailGlobal(), caught, Message.Severity.Error, EnumSet
- .of(Message.Option.BackgroundJobResult)));
+ public void onPermissionsLoaded(Set<Permission> permissions) {
+ if (permissions != null) {
+ UserEditView.this.hasManageSecurityPermission = permissions.contains(Permission.MANAGE_SECURITY);
+ Subject sessionSubject = UserSessionManager.getSessionSubject();
+ boolean isEditingSelf = (sessionSubject.getId() == getRecordId());
+ boolean isReadOnly = (!UserEditView.this.hasManageSecurityPermission && !isEditingSelf);
+ init(isReadOnly);
+ }
}
});
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
index 26ef84d..4249101 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
@@ -19,23 +19,20 @@
package org.rhq.enterprise.gui.coregui.client.admin.users;
import java.util.ArrayList;
-import java.util.EnumSet;
import java.util.List;
import java.util.Set;
-import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.core.domain.authz.Permission;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoadedListener;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoader;
import org.rhq.enterprise.gui.coregui.client.admin.AdministrationView;
import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
import org.rhq.enterprise.gui.coregui.client.components.table.TableSection;
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.util.message.Message;
/**
* A table that lists all users and provides the ability to view or edit details of users, delete users, or create new
@@ -78,20 +75,17 @@ public class UsersView extends TableSection<UsersDataSource> {
}
private void fetchManageSecurityPermissionAsync() {
- GWTServiceLookup.getAuthorizationService().getExplicitGlobalPermissions(
- new AsyncCallback<Set<Permission>>() {
- public void onSuccess(Set<Permission> result) {
- hasManageSecurity = result.contains(Permission.MANAGE_SECURITY);
+ new PermissionsLoader().loadExplicitGlobalPermissions(new PermissionsLoadedListener() {
+ @Override
+ public void onPermissionsLoaded(Set<Permission> permissions) {
+ if (permissions != null) {
+ hasManageSecurity = permissions.contains(Permission.MANAGE_SECURITY);
refresh();
- }
-
- public void onFailure(Throwable caught) {
+ } else {
hasManageSecurity = false;
- CoreGUI.getMessageCenter().notify(
- new Message(MSG.util_userPerm_loadFailGlobal(), caught, Message.Severity.Error, EnumSet
- .of(Message.Option.BackgroundJobResult)));
}
- });
+ }
+ });
}
private List<ListGridField> createFields() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
index 5ec9af2..981fadc 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
@@ -24,6 +24,7 @@ import com.google.gwt.user.client.rpc.RpcRequestBuilder;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoader;
import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
/**
@@ -101,6 +102,10 @@ public class GWTServiceLookup {
return secure(ResourceBossGWTServiceAsync.Util.getInstance());
}
+ /**
+ * Consider using {@link PermissionsLoader} instead of using
+ * this authorization service directly.
+ */
public static AuthorizationGWTServiceAsync getAuthorizationService() {
return secure(AuthorizationGWTServiceAsync.Util.getInstance());
}
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 c7172a9..2e3d919 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
@@ -23,7 +23,6 @@ import java.util.EnumSet;
import java.util.List;
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.Label;
@@ -33,15 +32,15 @@ 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.ImageManager;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoadedListener;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoader;
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;
import org.rhq.enterprise.gui.coregui.client.components.view.ViewFactory;
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.inventory.groups.ResourceGroupDataSourceField;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupListView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.definitions.GroupDefinitionListView;
@@ -92,17 +91,10 @@ public class InventoryView extends AbstractSectionedLeftNavigationView {
@Override
protected void onInit() {
- GWTServiceLookup.getAuthorizationService().getExplicitGlobalPermissions(new AsyncCallback<Set<Permission>>() {
+ new PermissionsLoader().loadExplicitGlobalPermissions(new PermissionsLoadedListener() {
@Override
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.view_inventory_cannotGetGlobalPerms(), caught);
- globalPermissions = EnumSet.noneOf(Permission.class);
- InventoryView.super.onInit();
- }
-
- @Override
- public void onSuccess(Set<Permission> result) {
- globalPermissions = result;
+ public void onPermissionsLoaded(Set<Permission> permissions) {
+ globalPermissions = (permissions != null) ? permissions : EnumSet.noneOf(Permission.class);
InventoryView.super.onInit();
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
index d36e17c..0ad75df 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
@@ -18,14 +18,12 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.common.detail;
-import java.util.EnumSet;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.History;
-import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.Side;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.layout.Layout;
@@ -33,6 +31,8 @@ import com.smartgwt.client.widgets.layout.Layout;
import org.rhq.core.domain.authz.Permission;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoadedListener;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoader;
import org.rhq.enterprise.gui.coregui.client.RefreshableView;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.components.tab.SubTab;
@@ -40,8 +40,6 @@ import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTab;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSelectedEvent;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSelectedHandler;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSet;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
@@ -160,19 +158,10 @@ public abstract class AbstractTwoLevelTabSetView<T, U extends Layout> extends Lo
}
public void renderView(final ViewPath viewPath) {
- GWTServiceLookup.getAuthorizationService().getExplicitGlobalPermissions(new AsyncCallback<Set<Permission>>() {
+ new PermissionsLoader().loadExplicitGlobalPermissions(new PermissionsLoadedListener() {
@Override
- public void onSuccess(Set<Permission> result) {
- globalPermissions = result;
- renderTabs(viewPath);
- }
-
- @Override
- public void onFailure(Throwable caught) {
- CoreGUI.getMessageCenter().notify(
- new Message(MSG.util_userPerm_loadFailGlobal(), caught, Message.Severity.Error, EnumSet
- .of(Message.Option.BackgroundJobResult)));
- globalPermissions = new HashSet<Permission>();
+ public void onPermissionsLoaded(Set<Permission> permissions) {
+ globalPermissions = (permissions != null) ? permissions : new HashSet<Permission>();
renderTabs(viewPath);
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java
index 0fb0e77..0f5fe93 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java
@@ -29,6 +29,8 @@ import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.core.domain.authz.Permission;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoadedListener;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoader;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableAction;
import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
@@ -153,26 +155,21 @@ public class GroupDefinitionListView extends TableSection {
@Override
public void renderView(final ViewPath viewPath) {
- GWTServiceLookup.getAuthorizationService().getExplicitGlobalPermissions(new AsyncCallback<Set<Permission>>() {
+
+ new PermissionsLoader().loadExplicitGlobalPermissions(new PermissionsLoadedListener() {
@Override
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.view_dynagroup_permUnknown(), caught);
- handleAuthorizationFailure();
+ public void onPermissionsLoaded(Set<Permission> permissions) {
+ if (permissions != null && permissions.contains(Permission.MANAGE_INVENTORY)) {
+ GroupDefinitionListView.super.renderView(viewPath);
+ } else {
+ handleAuthorizationFailure();
+ }
}
private void handleAuthorizationFailure() {
CoreGUI.getErrorHandler().handleError(MSG.view_dynagroup_permDenied());
History.back();
}
-
- @Override
- public void onSuccess(Set<Permission> result) {
- if (result.contains(Permission.MANAGE_INVENTORY) == false) {
- handleAuthorizationFailure();
- } else {
- GroupDefinitionListView.super.renderView(viewPath);
- }
- }
});
}
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java
index 3a9fdcf..e6bc5b9 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java
@@ -47,6 +47,8 @@ import org.rhq.core.domain.resource.group.GroupDefinition;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoadedListener;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoader;
import org.rhq.enterprise.gui.coregui.client.ViewId;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
@@ -334,31 +336,24 @@ public class SingleGroupDefinitionView extends LocatableVLayout implements Bookm
@Override
public void renderView(final ViewPath viewPath) {
- GWTServiceLookup.getAuthorizationService().getExplicitGlobalPermissions(new AsyncCallback<Set<Permission>>() {
+ new PermissionsLoader().loadExplicitGlobalPermissions(new PermissionsLoadedListener() {
@Override
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.view_dynagroup_permUnknown(), caught);
- handleAuthorizationFailure();
- }
-
- private void handleAuthorizationFailure() {
- CoreGUI.getErrorHandler().handleError(MSG.view_dynagroup_permDenied());
- History.back();
- }
-
- @Override
- public void onSuccess(Set<Permission> result) {
- if (result.contains(Permission.MANAGE_INVENTORY) == false) {
- handleAuthorizationFailure();
- } else {
+ public void onPermissionsLoaded(Set<Permission> permissions) {
+ if (permissions != null && permissions.contains(Permission.MANAGE_INVENTORY)) {
groupDefinitionId = viewPath.getCurrentAsInt();
viewId = viewPath.getCurrent();
basePath = viewPath.getPathToCurrent();
lookupDetails(groupDefinitionId);
+ } else {
+ handleAuthorizationFailure();
}
}
- });
+ private void handleAuthorizationFailure() {
+ CoreGUI.getErrorHandler().handleError(MSG.view_dynagroup_permDenied());
+ History.back();
+ }
+ });
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/AutodiscoveryQueueDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/AutodiscoveryQueueDataSource.java
index 7629074..fa7a0f8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/AutodiscoveryQueueDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/AutodiscoveryQueueDataSource.java
@@ -44,7 +44,8 @@ import org.rhq.core.domain.util.PageControl;
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.AuthorizationGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoadedListener;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoader;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
@@ -65,7 +66,7 @@ public class AutodiscoveryQueueDataSource extends DataSource {
private int unlimited = -1;
private int maximumPlatformsToDisplay = -1;
private ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();
- private AuthorizationGWTServiceAsync authorizationService = GWTServiceLookup.getAuthorizationService();
+ private PermissionsLoader permissionsLoader = new PermissionsLoader();
private TreeGrid dataContainerReference = null;
private static final Permission MANAGE_INVENTORY = Permission.MANAGE_INVENTORY;
@@ -141,40 +142,40 @@ public class AutodiscoveryQueueDataSource extends DataSource {
}
//determine if has manage inventory perms, if so then chain and proceed with getting discovered resources
- authorizationService.getExplicitGlobalPermissions(new AsyncCallback<Set<Permission>>() {
- public void onSuccess(Set<Permission> globalPermissions) {
- Boolean accessGranted = globalPermissions.contains(MANAGE_INVENTORY);
- if (accessGranted) {
- if (dataContainerReference != null) {
- dataContainerReference.setEmptyMessage(EMPTY_MESSAGE);
+ permissionsLoader.loadExplicitGlobalPermissions(new PermissionsLoadedListener() {
+ @Override
+ public void onPermissionsLoaded(Set<Permission> permissions) {
+ if (permissions != null) {
+ Boolean accessGranted = permissions.contains(MANAGE_INVENTORY);
+ if (accessGranted) {
+ if (dataContainerReference != null) {
+ dataContainerReference.setEmptyMessage(EMPTY_MESSAGE);
+ }
+ resourceService.getQueuedPlatformsAndServers(statuses, pc,
+ new AsyncCallback<Map<Resource, List<Resource>>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler()
+ .handleError(MSG.view_autoDiscoveryQ_loadFailure(), caught);
+ }
+
+ public void onSuccess(Map<Resource, List<Resource>> result) {
+ response.setData(buildNodes(result));
+ processResponse(request.getRequestId(), response);
+ }
+ });
+ } else {
+ Log.debug("(User does not have required managed inventory permissions. " + EMPTY_MESSAGE);
+ response.setTotalRows(0);
+ if (dataContainerReference != null) {
+ Log.trace("Setting better empty container message."
+ + NO_MANAGE_INVENTORY_PERMS_EMPTY_MESSAGE);
+ dataContainerReference.setEmptyMessage(NO_MANAGE_INVENTORY_PERMS_EMPTY_MESSAGE);
+ }
+ processResponse(request.getRequestId(), response);
}
- resourceService.getQueuedPlatformsAndServers(statuses, pc,
- new AsyncCallback<Map<Resource, List<Resource>>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.view_autoDiscoveryQ_loadFailure(), caught);
- }
-
- public void onSuccess(Map<Resource, List<Resource>> result) {
- response.setData(buildNodes(result));
- processResponse(request.getRequestId(), response);
- }
- });
- } else {
- Log.debug("(User does not have required managed inventory permissions. " + EMPTY_MESSAGE);
- response.setTotalRows(0);
- if (dataContainerReference != null) {
- Log.trace("Setting better empty container message." + NO_MANAGE_INVENTORY_PERMS_EMPTY_MESSAGE);
- dataContainerReference.setEmptyMessage(NO_MANAGE_INVENTORY_PERMS_EMPTY_MESSAGE);
- }
- processResponse(request.getRequestId(), response);
}
}
-
- public void onFailure(Throwable caught) {
- Log.error("Unable to determine whether if user has manage inventory permissions - check server logs.");
- }
});
-
}
private TreeNode[] buildNodes(Map<Resource, List<Resource>> result) {
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 2b65a7f..d7c9176 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
@@ -869,7 +869,7 @@ view_autoDiscoveryQ_ignoreFailure = Failed to ignore resources
view_autoDiscoveryQ_ignoreSuccessful = You have successfully ignored the selected resources.
view_autoDiscoveryQ_unignoreFailure = Failed to unignore resources
view_autoDiscoveryQ_unignoreSuccessful = You have successfully unignored the selected resources.
-view_autoDiscoveryQ_noperm = (Required manage inventory permissions missing. See Administrator to change)
+view_autoDiscoveryQ_noperm = (You are not authorized to view the auto-discovery queue)
view_autoDiscoveryQ_noItems = No items to show
view_autoDiscoveryQ_field_parentId = Parent ID
view_autoDiscoveryQ_field_name = Resource Name
@@ -1219,7 +1219,6 @@ view_portlet_tagCloud_title = TagCloud
# =================== Inventory =====================
view_inventory_adq = Discovery Queue
view_inventory_sectionHelp = From this section, newly discovered Resources, inventoried Resources, and Groups can be viewed and managed.
-view_inventory_cannotGetGlobalPerms = Could not determine global permissions - assuming none.
view_inventory_problemGroups = Problem Groups
view_inventory_collectionInterval = Collection Interval
view_inventory_mixed = mixed
@@ -1387,7 +1386,6 @@ view_dynagroup_expression = Expression
view_dynagroup_recursive = Recursive
view_dynagroup_loadDefinitionFailure = Failed to load group definition [{0}]
view_dynagroup_loadDefinitionMissing = There is no group definition with the ID of [{0}]
-view_dynagroup_permUnknown = Could not determine if you have the proper permissions - access is denied
view_dynagroup_permDenied = You do not have permission to view group definitions
view_dynagroup_definitions = DynaGroup Definitions
view_group_detail_failLoad = Failed to load group for group with ID [{0}]
commit 2a36e647404caa3c850b564512a892da74e1b309
Merge: 58f7d81... bfa4afd...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Dec 16 14:03:13 2010 -0500
Merge commit 'origin/master'
commit 58f7d81f12eb70697b8beb5cf96507b07cbda16c
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Dec 16 13:29:35 2010 -0500
propogate exceptions to gwt client
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/RepoGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/RepoGWTService.java
index 50253c9..b8a0a6e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/RepoGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/RepoGWTService.java
@@ -33,7 +33,6 @@ import org.rhq.core.domain.util.PageList;
*/
public interface RepoGWTService extends RemoteService {
-
- PageList<Repo> findReposByCriteria(RepoCriteria criteria);
+ PageList<Repo> findReposByCriteria(RepoCriteria criteria) throws Exception;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/RepoGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/RepoGWTServiceImpl.java
index 073a6f7..98c26cc 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/RepoGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/RepoGWTServiceImpl.java
@@ -40,10 +40,10 @@ public class RepoGWTServiceImpl extends AbstractGWTServiceImpl implements RepoGW
private RepoManagerLocal repoManager = LookupUtil.getRepoManagerLocal();
- public PageList<Repo> findReposByCriteria(RepoCriteria criteria) {
+ public PageList<Repo> findReposByCriteria(RepoCriteria criteria) throws Exception {
try {
return SerialUtility.prepare(repoManager.findReposByCriteria(getSessionSubject(), criteria),
- "ContentService.findReposByCriteria");
+ "RepoService.findReposByCriteria");
} catch (Exception e) {
throw new RuntimeException(ThrowableUtil.getAllMessages(e));
}
13 years, 6 months
[rhq] Branch 'release-3.0.0' - modules/plugins
by lkrejci
modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerDiscoveryComponent.java | 195 +++++-----
1 file changed, 113 insertions(+), 82 deletions(-)
New commits:
commit 510edfa8fac2234ef186b837e8119f7708aa6d18
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Thu Dec 16 19:45:36 2010 +0100
BZ 663745 - refactor the apache discovery to continue processing the rest of process scan results after an error during processing one of them.
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerDiscoveryComponent.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerDiscoveryComponent.java
index 9356ac9..6ea64f4 100644
--- a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerDiscoveryComponent.java
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerDiscoveryComponent.java
@@ -21,6 +21,8 @@ package org.rhq.plugins.apache;
import java.io.File;
import java.io.IOException;
import java.net.URI;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -68,101 +70,130 @@ public class ApacheServerDiscoveryComponent implements ResourceDiscoveryComponen
private static final Log log = LogFactory.getLog(ApacheServerDiscoveryComponent.class);
- public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<PlatformComponent> discoveryContext) throws Exception {
+ private static class DiscoveryFailureException extends Exception {
+ private static final long serialVersionUID = 1L;
+
+ public DiscoveryFailureException(String message) {
+ super(message);
+ }
+ }
+
+ public Set<DiscoveredResourceDetails>
+ discoverResources(ResourceDiscoveryContext<PlatformComponent> discoveryContext) throws Exception {
Set<DiscoveredResourceDetails> discoveredResources = new HashSet<DiscoveredResourceDetails>();
// Process any PC-discovered OS processes...
List<ProcessScanResult> processes = discoveryContext.getAutoDiscoveredProcesses();
for (ProcessScanResult process : processes) {
- //String executablePath = process.getProcessInfo().getName();
- String executableName = getExecutableName(process);
- File executablePath = OsProcessUtility.getProcExe(process.getProcessInfo().getPid(), executableName);
- if (executablePath == null) {
- log.error("Executable path could not be determined for Apache [" + process.getProcessInfo() + "].");
- continue;
- }
- if (!executablePath.isAbsolute()) {
- log.error("Executable path (" + executablePath + ") is not absolute for Apache [" +
- process.getProcessInfo() + "]." +
- "Please restart Apache specifying an absolute path for the executable.");
- continue;
- }
- log.debug("Apache executable path: " + executablePath);
- ApacheBinaryInfo binaryInfo;
try {
- binaryInfo = ApacheBinaryInfo.getInfo(executablePath.getPath(),
- discoveryContext.getSystemInformation());
+ DiscoveredResourceDetails apache = discoverSingleProcess(discoveryContext, process);
+ discoveredResources.add(apache);
+ } catch (DiscoveryFailureException e) {
+ log.warn("Discovery of Apache process [" + process.getProcessInfo() + "] failed: " + e.getMessage());
} catch (Exception e) {
- log.error("'" + executablePath + "' is not a valid Apache executable (" + e + ").");
- continue;
+ log.error("Discovery of Apache process [" + process.getProcessInfo() + "] failed with an exception.", e);
}
+ }
- if (isSupportedVersion(binaryInfo.getVersion())) {
- String serverRoot = getServerRoot(binaryInfo, process.getProcessInfo());
- if (serverRoot == null) {
- log.error("Unable to determine server root for Apache process: " + process.getProcessInfo());
- continue;
- }
+ return discoveredResources;
+ }
- File serverConfigFile = getServerConfigFile(binaryInfo, process.getProcessInfo(), serverRoot);
- if (serverConfigFile == null) {
- log.error("Unable to determine server config file for Apache process: " + process.getProcessInfo());
- continue;
- }
+ /**
+ * Performs discovery on the single process scan result.
+ *
+ * @param discoveryContext the discovery context
+ * @param process the process discovered by the scan
+ * @return resource details
+ * @throws DiscoveryFailureException if the discovery failed due to inability to detect necessary data from
+ * the process info.
+ * @throws Exception other unhandled exception
+ */
+ private DiscoveredResourceDetails discoverSingleProcess(ResourceDiscoveryContext<PlatformComponent> discoveryContext,
+ ProcessScanResult process) throws DiscoveryFailureException, Exception {
+ //String executablePath = process.getProcessInfo().getName();
+ String executableName = getExecutableName(process);
+ File executablePath = OsProcessUtility.getProcExe(process.getProcessInfo().getPid(), executableName);
+ if (executablePath == null) {
+ throw new DiscoveryFailureException("Executable path could not be determined.");
+ }
+ if (!executablePath.isAbsolute()) {
+ throw new DiscoveryFailureException("Executable path (" + executablePath + ") is not absolute."
+ + "Please restart Apache specifying an absolute path for the executable.");
+ }
+ log.debug("Apache executable path: " + executablePath);
+ ApacheBinaryInfo binaryInfo;
+ try {
+ binaryInfo = ApacheBinaryInfo
+ .getInfo(executablePath.getPath(), discoveryContext.getSystemInformation());
+ } catch (Exception e) {
+ throw new DiscoveryFailureException("'" + executablePath + "' is not a valid Apache executable (" + e + ").");
+ }
- Configuration pluginConfig = discoveryContext.getDefaultPluginConfiguration();
-
- PropertySimple executablePathProp = new PropertySimple(
- ApacheServerComponent.PLUGIN_CONFIG_PROP_EXECUTABLE_PATH, executablePath);
- pluginConfig.put(executablePathProp);
-
- PropertySimple serverRootProp = new PropertySimple(
- ApacheServerComponent.PLUGIN_CONFIG_PROP_SERVER_ROOT, serverRoot);
- pluginConfig.put(serverRootProp);
-
- PropertySimple configFile = new PropertySimple(ApacheServerComponent.PLUGIN_CONFIG_PROP_HTTPD_CONF,
- serverConfigFile);
- pluginConfig.put(configFile);
-
- PropertySimple inclusionGlobs = new PropertySimple(PluginDescriptorBasedAugeasConfiguration.INCLUDE_GLOBS_PROP, serverConfigFile);
- pluginConfig.put(inclusionGlobs);
-
- ApacheDirectiveTree serverConfig = loadParser(serverConfigFile.getAbsolutePath(),serverRoot);
-
- String serverUrl = null;
- String vhostsGlobInclude = null;
-
- //now check if the httpd.conf doesn't redefine the ServerRoot
- List<ApacheDirective> serverRoots = serverConfig.search("/ServerRoot");
- if (!serverRoots.isEmpty()) {
- serverRoot = AugeasNodeValueUtil.unescape(serverRoots.get(0).getValuesAsString());
- serverRootProp.setValue(serverRoot);
- //reparse the configuration with the new ServerRoot
- serverConfig = loadParser(serverConfigFile.getAbsolutePath(), serverRoot);
- }
-
- serverUrl = getUrl(serverConfig, binaryInfo.getVersion());
- vhostsGlobInclude = scanForGlobInclude(serverConfig);
-
- if (serverUrl != null) {
- Property urlProp = new PropertySimple(ApacheServerComponent.PLUGIN_CONFIG_PROP_URL, serverUrl);
- pluginConfig.put(urlProp);
- }
-
- if (vhostsGlobInclude != null) {
- pluginConfig.put(new PropertySimple(ApacheServerComponent.PLUGIN_CONFIG_PROP_VHOST_FILES_MASK, vhostsGlobInclude));
- }else
- {
- if (serverConfigFile.exists())
- pluginConfig.put(new PropertySimple(ApacheServerComponent.PLUGIN_CONFIG_PROP_VHOST_FILES_MASK, serverConfigFile.getParent()+File.separator+"*"));
- }
-
- discoveredResources.add(createResourceDetails(discoveryContext, pluginConfig, process.getProcessInfo(),
- binaryInfo));
- }
+ if (!isSupportedVersion(binaryInfo.getVersion())) {
+ throw new DiscoveryFailureException("Apache " + binaryInfo.getVersion() + " is not suppported.");
+ }
+
+ String serverRoot = getServerRoot(binaryInfo, process.getProcessInfo());
+ if (serverRoot == null) {
+ throw new DiscoveryFailureException("Unable to determine server root.");
}
- return discoveredResources;
+ File serverConfigFile = getServerConfigFile(binaryInfo, process.getProcessInfo(), serverRoot);
+ if (serverConfigFile == null) {
+ throw new DiscoveryFailureException("Unable to determine server config file.");
+ }
+
+ Configuration pluginConfig = discoveryContext.getDefaultPluginConfiguration();
+
+ PropertySimple executablePathProp = new PropertySimple(
+ ApacheServerComponent.PLUGIN_CONFIG_PROP_EXECUTABLE_PATH, executablePath);
+ pluginConfig.put(executablePathProp);
+
+ PropertySimple serverRootProp = new PropertySimple(
+ ApacheServerComponent.PLUGIN_CONFIG_PROP_SERVER_ROOT, serverRoot);
+ pluginConfig.put(serverRootProp);
+
+ PropertySimple configFile = new PropertySimple(ApacheServerComponent.PLUGIN_CONFIG_PROP_HTTPD_CONF,
+ serverConfigFile);
+ pluginConfig.put(configFile);
+
+ PropertySimple inclusionGlobs = new PropertySimple(
+ PluginDescriptorBasedAugeasConfiguration.INCLUDE_GLOBS_PROP, serverConfigFile);
+ pluginConfig.put(inclusionGlobs);
+
+ ApacheDirectiveTree serverConfig = loadParser(serverConfigFile.getAbsolutePath(), serverRoot);
+
+ String serverUrl = null;
+ String vhostsGlobInclude = null;
+
+ //now check if the httpd.conf doesn't redefine the ServerRoot
+ List<ApacheDirective> serverRoots = serverConfig.search("/ServerRoot");
+ if (!serverRoots.isEmpty()) {
+ serverRoot = AugeasNodeValueUtil.unescape(serverRoots.get(0).getValuesAsString());
+ serverRootProp.setValue(serverRoot);
+ //reparse the configuration with the new ServerRoot
+ serverConfig = loadParser(serverConfigFile.getAbsolutePath(), serverRoot);
+ }
+
+ serverUrl = getUrl(serverConfig, binaryInfo.getVersion());
+ vhostsGlobInclude = scanForGlobInclude(serverConfig);
+
+ if (serverUrl != null) {
+ Property urlProp = new PropertySimple(ApacheServerComponent.PLUGIN_CONFIG_PROP_URL, serverUrl);
+ pluginConfig.put(urlProp);
+ }
+
+ if (vhostsGlobInclude != null) {
+ pluginConfig.put(new PropertySimple(ApacheServerComponent.PLUGIN_CONFIG_PROP_VHOST_FILES_MASK,
+ vhostsGlobInclude));
+ } else {
+ if (serverConfigFile.exists())
+ pluginConfig.put(new PropertySimple(ApacheServerComponent.PLUGIN_CONFIG_PROP_VHOST_FILES_MASK,
+ serverConfigFile.getParent() + File.separator + "*"));
+ }
+
+ return createResourceDetails(discoveryContext, pluginConfig, process.getProcessInfo(),
+ binaryInfo);
}
13 years, 6 months
[rhq] modules/plugins
by lkrejci
modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerDiscoveryComponent.java | 191 +++++-----
1 file changed, 109 insertions(+), 82 deletions(-)
New commits:
commit bfa4afdfdf10b80f08113fcb31b301d5e2e958e1
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Thu Dec 16 19:25:54 2010 +0100
BZ 653695 - refactor the apache discovery to continue processing the rest of process scan results after an error during processing one of them.
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerDiscoveryComponent.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerDiscoveryComponent.java
index a5e19e5..c82d3ae 100644
--- a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerDiscoveryComponent.java
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerDiscoveryComponent.java
@@ -26,6 +26,7 @@ import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.URI;
+import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
@@ -77,6 +78,14 @@ public class ApacheServerDiscoveryComponent implements ResourceDiscoveryComponen
private static final Log log = LogFactory.getLog(ApacheServerDiscoveryComponent.class);
+ private static class DiscoveryFailureException extends Exception {
+ private static final long serialVersionUID = 1L;
+
+ public DiscoveryFailureException(String message) {
+ super(message);
+ }
+ }
+
public Set<DiscoveredResourceDetails>
discoverResources(ResourceDiscoveryContext<PlatformComponent> discoveryContext) throws Exception {
Set<DiscoveredResourceDetails> discoveredResources = new HashSet<DiscoveredResourceDetails>();
@@ -84,107 +93,125 @@ public class ApacheServerDiscoveryComponent implements ResourceDiscoveryComponen
// Process any PC-discovered OS processes...
List<ProcessScanResult> processes = discoveryContext.getAutoDiscoveredProcesses();
for (ProcessScanResult process : processes) {
- //String executablePath = process.getProcessInfo().getName();
- String executableName = getExecutableName(process);
- File executablePath = OsProcessUtility.getProcExe(process.getProcessInfo().getPid(), executableName);
- if (executablePath == null) {
- log.error("Executable path could not be determined for Apache [" + process.getProcessInfo() + "].");
- continue;
- }
- if (!executablePath.isAbsolute()) {
- log.error("Executable path (" + executablePath + ") is not absolute for Apache ["
- + process.getProcessInfo() + "]."
- + "Please restart Apache specifying an absolute path for the executable.");
- continue;
- }
- log.debug("Apache executable path: " + executablePath);
- ApacheBinaryInfo binaryInfo;
try {
- binaryInfo = ApacheBinaryInfo
- .getInfo(executablePath.getPath(), discoveryContext.getSystemInformation());
+ DiscoveredResourceDetails apache = discoverSingleProcess(discoveryContext, process);
+ discoveredResources.add(apache);
+ } catch (DiscoveryFailureException e) {
+ log.warn("Discovery of Apache process [" + process.getProcessInfo() + "] failed: " + e.getMessage());
} catch (Exception e) {
- log.error("'" + executablePath + "' is not a valid Apache executable (" + e + ").");
- continue;
+ log.error("Discovery of Apache process [" + process.getProcessInfo() + "] failed with an exception.", e);
}
+ }
- if (isSupportedVersion(binaryInfo.getVersion())) {
- String serverRoot = getServerRoot(binaryInfo, process.getProcessInfo());
- if (serverRoot == null) {
- log.error("Unable to determine server root for Apache process: " + process.getProcessInfo());
- continue;
- }
+ return discoveredResources;
+ }
- File serverConfigFile = getServerConfigFile(binaryInfo, process.getProcessInfo(), serverRoot);
- if (serverConfigFile == null) {
- log.error("Unable to determine server config file for Apache process: " + process.getProcessInfo());
- continue;
- }
+ /**
+ * Performs discovery on the single process scan result.
+ *
+ * @param discoveryContext the discovery context
+ * @param process the process discovered by the scan
+ * @return resource details
+ * @throws DiscoveryFailureException if the discovery failed due to inability to detect necessary data from
+ * the process info.
+ * @throws Exception other unhandled exception
+ */
+ private DiscoveredResourceDetails discoverSingleProcess(ResourceDiscoveryContext<PlatformComponent> discoveryContext,
+ ProcessScanResult process) throws DiscoveryFailureException, Exception {
+ //String executablePath = process.getProcessInfo().getName();
+ String executableName = getExecutableName(process);
+ File executablePath = OsProcessUtility.getProcExe(process.getProcessInfo().getPid(), executableName);
+ if (executablePath == null) {
+ throw new DiscoveryFailureException("Executable path could not be determined.");
+ }
+ if (!executablePath.isAbsolute()) {
+ throw new DiscoveryFailureException("Executable path (" + executablePath + ") is not absolute."
+ + "Please restart Apache specifying an absolute path for the executable.");
+ }
+ log.debug("Apache executable path: " + executablePath);
+ ApacheBinaryInfo binaryInfo;
+ try {
+ binaryInfo = ApacheBinaryInfo
+ .getInfo(executablePath.getPath(), discoveryContext.getSystemInformation());
+ } catch (Exception e) {
+ throw new DiscoveryFailureException("'" + executablePath + "' is not a valid Apache executable (" + e + ").");
+ }
- Configuration pluginConfig = discoveryContext.getDefaultPluginConfiguration();
+ if (!isSupportedVersion(binaryInfo.getVersion())) {
+ throw new DiscoveryFailureException("Apache " + binaryInfo.getVersion() + " is not suppported.");
+ }
+
+ String serverRoot = getServerRoot(binaryInfo, process.getProcessInfo());
+ if (serverRoot == null) {
+ throw new DiscoveryFailureException("Unable to determine server root.");
+ }
- PropertySimple executablePathProp = new PropertySimple(
- ApacheServerComponent.PLUGIN_CONFIG_PROP_EXECUTABLE_PATH, executablePath);
- pluginConfig.put(executablePathProp);
+ File serverConfigFile = getServerConfigFile(binaryInfo, process.getProcessInfo(), serverRoot);
+ if (serverConfigFile == null) {
+ throw new DiscoveryFailureException("Unable to determine server config file.");
+ }
- PropertySimple serverRootProp = new PropertySimple(
- ApacheServerComponent.PLUGIN_CONFIG_PROP_SERVER_ROOT, serverRoot);
- pluginConfig.put(serverRootProp);
+ Configuration pluginConfig = discoveryContext.getDefaultPluginConfiguration();
- PropertySimple configFile = new PropertySimple(ApacheServerComponent.PLUGIN_CONFIG_PROP_HTTPD_CONF,
- serverConfigFile);
- pluginConfig.put(configFile);
+ PropertySimple executablePathProp = new PropertySimple(
+ ApacheServerComponent.PLUGIN_CONFIG_PROP_EXECUTABLE_PATH, executablePath);
+ pluginConfig.put(executablePathProp);
- PropertySimple inclusionGlobs = new PropertySimple(
- PluginDescriptorBasedAugeasConfiguration.INCLUDE_GLOBS_PROP, serverConfigFile);
- pluginConfig.put(inclusionGlobs);
+ PropertySimple serverRootProp = new PropertySimple(
+ ApacheServerComponent.PLUGIN_CONFIG_PROP_SERVER_ROOT, serverRoot);
+ pluginConfig.put(serverRootProp);
- ApacheDirectiveTree serverConfig = loadParser(serverConfigFile.getAbsolutePath(), serverRoot);
+ PropertySimple configFile = new PropertySimple(ApacheServerComponent.PLUGIN_CONFIG_PROP_HTTPD_CONF,
+ serverConfigFile);
+ pluginConfig.put(configFile);
- String serverUrl = null;
- String vhostsGlobInclude = null;
+ PropertySimple inclusionGlobs = new PropertySimple(
+ PluginDescriptorBasedAugeasConfiguration.INCLUDE_GLOBS_PROP, serverConfigFile);
+ pluginConfig.put(inclusionGlobs);
- //now check if the httpd.conf doesn't redefine the ServerRoot
- List<ApacheDirective> serverRoots = serverConfig.search("/ServerRoot");
- if (!serverRoots.isEmpty()) {
- serverRoot = AugeasNodeValueUtil.unescape(serverRoots.get(0).getValuesAsString());
- serverRootProp.setValue(serverRoot);
- //reparse the configuration with the new ServerRoot
- serverConfig = loadParser(serverConfigFile.getAbsolutePath(), serverRoot);
- }
+ ApacheDirectiveTree serverConfig = loadParser(serverConfigFile.getAbsolutePath(), serverRoot);
- serverUrl = getUrl(serverConfig, binaryInfo.getVersion());
- vhostsGlobInclude = scanForGlobInclude(serverConfig);
+ String serverUrl = null;
+ String vhostsGlobInclude = null;
- if (serverUrl != null) {
- Property urlProp = new PropertySimple(ApacheServerComponent.PLUGIN_CONFIG_PROP_URL, serverUrl);
- pluginConfig.put(urlProp);
- }
+ //now check if the httpd.conf doesn't redefine the ServerRoot
+ List<ApacheDirective> serverRoots = serverConfig.search("/ServerRoot");
+ if (!serverRoots.isEmpty()) {
+ serverRoot = AugeasNodeValueUtil.unescape(serverRoots.get(0).getValuesAsString());
+ serverRootProp.setValue(serverRoot);
+ //reparse the configuration with the new ServerRoot
+ serverConfig = loadParser(serverConfigFile.getAbsolutePath(), serverRoot);
+ }
- if (vhostsGlobInclude != null) {
- pluginConfig.put(new PropertySimple(ApacheServerComponent.PLUGIN_CONFIG_PROP_VHOST_FILES_MASK,
- vhostsGlobInclude));
- } else {
- if (serverConfigFile.exists())
- pluginConfig.put(new PropertySimple(ApacheServerComponent.PLUGIN_CONFIG_PROP_VHOST_FILES_MASK,
- serverConfigFile.getParent() + File.separator + "*"));
- }
+ serverUrl = getUrl(serverConfig, binaryInfo.getVersion());
+ vhostsGlobInclude = scanForGlobInclude(serverConfig);
- List<InetSocketAddress> snmpAddresses = findSNMPAddresses(serverConfig, new File(serverRoot));
- if (snmpAddresses != null && snmpAddresses.size() > 0) {
- InetSocketAddress addr = snmpAddresses.get(0);
- int port = addr.getPort();
- InetAddress host = addr.getAddress() == null ? InetAddress.getLocalHost() : addr.getAddress();
-
- pluginConfig.put(new PropertySimple(ApacheServerComponent.PLUGIN_CONFIG_PROP_SNMP_AGENT_HOST, host.getHostAddress()));
- pluginConfig.put(new PropertySimple(ApacheServerComponent.PLUGIN_CONFIG_PROP_SNMP_AGENT_PORT, port));
- }
-
- discoveredResources.add(createResourceDetails(discoveryContext, pluginConfig, process.getProcessInfo(),
- binaryInfo));
- }
+ if (serverUrl != null) {
+ Property urlProp = new PropertySimple(ApacheServerComponent.PLUGIN_CONFIG_PROP_URL, serverUrl);
+ pluginConfig.put(urlProp);
}
- return discoveredResources;
+ if (vhostsGlobInclude != null) {
+ pluginConfig.put(new PropertySimple(ApacheServerComponent.PLUGIN_CONFIG_PROP_VHOST_FILES_MASK,
+ vhostsGlobInclude));
+ } else {
+ if (serverConfigFile.exists())
+ pluginConfig.put(new PropertySimple(ApacheServerComponent.PLUGIN_CONFIG_PROP_VHOST_FILES_MASK,
+ serverConfigFile.getParent() + File.separator + "*"));
+ }
+
+ List<InetSocketAddress> snmpAddresses = findSNMPAddresses(serverConfig, new File(serverRoot));
+ if (snmpAddresses != null && snmpAddresses.size() > 0) {
+ InetSocketAddress addr = snmpAddresses.get(0);
+ int port = addr.getPort();
+ InetAddress host = addr.getAddress() == null ? InetAddress.getLocalHost() : addr.getAddress();
+
+ pluginConfig.put(new PropertySimple(ApacheServerComponent.PLUGIN_CONFIG_PROP_SNMP_AGENT_HOST, host.getHostAddress()));
+ pluginConfig.put(new PropertySimple(ApacheServerComponent.PLUGIN_CONFIG_PROP_SNMP_AGENT_PORT, port));
+ }
+
+ return createResourceDetails(discoveryContext, pluginConfig, process.getProcessInfo(),
+ binaryInfo);
}
public ResourceUpgradeReport upgrade(ResourceUpgradeContext<PlatformComponent> context) {
13 years, 6 months
[rhq] Branch 'delete-agent-plugin' - 89 commits - .classpath etc/m2 modules/core modules/enterprise modules/pom.xml pom.xml
by John Sanda
.classpath | 2
etc/m2/settings.xml | 61 +
modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml | 8
modules/core/domain/src/main/java/org/rhq/core/domain/common/Trigger.java | 279 ++++
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java | 8
modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/ResourceUpgradeTestBase.java | 23
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BookmarkableView.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java | 28
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java | 10
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/RefreshableView.java | 1
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/admin/roles/RolesView.java | 10
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java | 10
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertHistoryView.java | 22
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java | 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GroupAlertDefinitionsView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/SingleAlertDefinitionView.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/TemplateAlertDefinitionsView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDistroFileStep.java | 40
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java | 9
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/CheckboxEditableFormItem.java | 111 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EditableFormItem.java | 437 +++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EnhancedDynamicForm.java | 118 --
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/RadioGroupWithComponentsItem.java | 31
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/SearchBarItem.java | 53
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/StringLengthValidator.java | 71 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/TogglableTextItem.java | 62 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/ValueUpdatedHandler.java | 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/AbstractSelector.java | 37
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java | 11
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java | 28
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/FileUploadForm.java | 104 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/TextFileRetrieverForm.java | 53
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/AbstractSectionedLeftNavigationView.java | 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/queue/AutodiscoveryPortlet.java | 46
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/PortletAlertSelector.java | 97 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java | 120 --
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGroupGWTService.java | 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/help/HelpView.java | 21
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/InventoryView.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java | 9
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/history/AbstractOperationHistoryListView.java | 188 +++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/history/OperationHistoryDataSource.java | 117 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/history/ResourceOperationHistoryDetailsView.java | 259 ++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/ExecutionSchedule.java | 311 +++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationCreateWizard.java | 157 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationParametersStep.java | 72 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationScheduleCompositeDataSource.java | 74 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationScheduleListView.java | 77 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationSchedulingStep.java | 418 +++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java | 63 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java | 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/GeneralProperties.java | 60 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupContextMenu.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java | 91 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/MembersView.java | 99 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java | 55
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/OverviewView.java | 58 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceCompositeDataSource.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceCompositeSearchView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java | 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java | 72 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/NewResourceTreeView.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java | 184 +--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java | 270 ++--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java | 9
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/ResourceResourceAgentView.java | 188 +--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/ResourceResourceGroupsView.java | 33
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryDataSource.java | 145 --
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java | 249 ----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationWizard.java | 61 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/ExecutionSchedule.java | 311 -----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationCreateWizard.java | 157 --
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationParametersStep.java | 72 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java | 418 -------
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/detail/OperationDetailsView.java | 259 ----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/history/ResourceOperationHistoryDataSource.java | 67 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/history/ResourceOperationHistoryListView.java | 93 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java | 59 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/DashboardView.java | 54
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewForm.java | 100 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewView.java | 49
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ResourceErrorsView.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java | 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java | 7
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/operation/SubsystemOperationHistoryListView.java | 84 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/search/AbstractSearchBar.java | 44
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/search/FlexSearchBar.java | 568 ++++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/search/SearchBar.java | 9
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/search/favorites/SavedSearchGrid.java | 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/search/favorites/SavedSearchManager.java | 6
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/search/suggest/SuggestTextBox_v3.java | 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestTopView.java | 12
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/inventory/TestSearchBarView.java | 28
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java | 24
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGroupGWTServiceImpl.java | 11
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 25
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties | 71 -
modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.html | 1
modules/enterprise/gui/coregui/src/main/webapp/css/search.css | 10
modules/enterprise/gui/coregui/src/main/webapp/images/blank.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/global/AutoDiscovery_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/global/AutoDiscovery_24.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/global/upload.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/global/upload_Disabled.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/availability/availability_green_16_Disabled.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/availability/availability_grey_16_Disabled.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/availability/availability_red_16_Disabled.png |binary
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/browse/BrowseResourcesUIBean.java | 2
modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/searchInterface.xhtml | 18
modules/enterprise/remoting/webservices/src/test/java/org/rhq/enterprise/server/ws/WsResourceManagerTest.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/AuthorizationManagerBean.java | 34
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerBean.java | 4
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java | 42
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/LookupUtil.java | 6
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/authz/test/AuthorizationManagerBeanTest.java | 4
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/event/test/EventManagerTest.java | 11
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementDataManagerTest.java | 189 +++
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementViewManagerTest.java | 11
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/pc/generic/GenericServerPluginTest.java | 13
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/cluster/ClusterManagerBeanTest.java | 7
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/group/test/RecursiveResourceGroupTest.java | 5
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/test/PluginDescriptorValidationTest.java | 9
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdateSubsytemTestBase.java | 62 -
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/test/ResourceGroupManagerBeanTest.java | 5
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java | 7
modules/enterprise/server/jar/src/test/resources/test/metadata/measurement/measurementDeletion-v1_0.xml | 3
modules/enterprise/server/jar/src/test/resources/test/metadata/measurement/update-v1_0.xml | 5
modules/enterprise/server/jar/src/test/resources/test/metadata/measurement/update-v2_0.xml | 11
modules/enterprise/server/jar/src/test/resources/test/metadata/resource-type/update4-v1_0.xml | 3
modules/pom.xml | 12
pom.xml | 1
138 files changed, 5372 insertions(+), 2952 deletions(-)
New commits:
commit 41ce47cfe0837f18b1af0f9d2bd7447cede41dac
Merge: c18b08c... f82412f...
Author: John Sanda <jsanda(a)redhat.com>
Date: Thu Dec 16 13:03:38 2010 -0500
Merge branch 'master' into delete-agent-plugin
Conflicts:
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/authz/test/AuthorizationManagerBeanTest.java
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/event/test/EventManagerTest.java
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementViewManagerTest.java
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/cluster/ClusterManagerBeanTest.java
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/group/test/RecursiveResourceGroupTest.java
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/test/PluginDescriptorValidationTest.java
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdateSubsytemTestBase.java
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/test/ResourceGroupManagerBeanTest.java
modules/enterprise/server/jar/src/test/resources/test/metadata/measurement/update-v1_0.xml
modules/enterprise/server/jar/src/test/resources/test/metadata/measurement/update-v2_0.xml
diff --cc modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdateSubsytemTestBase.java
index e1a7f3e,19b2e8e..77d48be
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdateSubsytemTestBase.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdateSubsytemTestBase.java
@@@ -37,7 -61,7 +61,8 @@@ import org.rhq.core.util.MessageDigestG
import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.resource.ResourceManagerLocal;
import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal;
+ import org.rhq.enterprise.server.resource.metadata.ResourceMetadataManagerLocal;
+import org.rhq.enterprise.server.resource.metadata.PluginManagerLocal;
import org.rhq.enterprise.server.test.AbstractEJB3Test;
import org.rhq.enterprise.server.test.TestServerCommunicationsService;
import org.rhq.enterprise.server.util.LookupUtil;
@@@ -84,10 -86,10 +87,10 @@@ public class UpdateSubsytemTestBase ext
protected static ResourceTypeManagerLocal resourceTypeManager;
protected static ResourceManagerLocal resourceManager;
- @BeforeSuite
+ @BeforeMethod
protected void init() {
try {
- metadataManager = LookupUtil.getResourceMetadataManager();
+ pluginMgr = LookupUtil.getPluginManager();
resourceTypeManager = LookupUtil.getResourceTypeManager();
resourceManager = LookupUtil.getResourceManager();
} catch (Throwable t) {
commit f82412f3737b6547ebf6c2e6fce50c197bbd76d1
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Dec 16 11:21:23 2010 -0500
i like these auto-disc icons better
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/global/AutoDiscovery_16.png b/modules/enterprise/gui/coregui/src/main/webapp/images/global/AutoDiscovery_16.png
index e849115..099ef87 100644
Binary files a/modules/enterprise/gui/coregui/src/main/webapp/images/global/AutoDiscovery_16.png and b/modules/enterprise/gui/coregui/src/main/webapp/images/global/AutoDiscovery_16.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/global/AutoDiscovery_24.png b/modules/enterprise/gui/coregui/src/main/webapp/images/global/AutoDiscovery_24.png
index f4eae94..2afd2c4 100644
Binary files a/modules/enterprise/gui/coregui/src/main/webapp/images/global/AutoDiscovery_24.png and b/modules/enterprise/gui/coregui/src/main/webapp/images/global/AutoDiscovery_24.png differ
commit 31de48811bdeed00bef7a49e9d5ecd655a912eb1
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Dec 16 10:52:07 2010 -0500
new auto-discovery icons since the clock face didn't make sense.
these new ones can, at least plausibly, be said to better represent auto-discovery and importation of resources
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 9221091..c7172a9 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
@@ -137,8 +137,8 @@ public class InventoryView extends AbstractSectionedLeftNavigationView {
}
private NavigationSection buildResourcesSection() {
- NavigationItem autodiscoveryQueueItem = new NavigationItem(PAGE_AUTODISCOVERY_QUEUE, "global/Recent_16.png",
- new ViewFactory() {
+ NavigationItem autodiscoveryQueueItem = new NavigationItem(PAGE_AUTODISCOVERY_QUEUE,
+ "global/AutoDiscovery_16.png", new ViewFactory() {
public Canvas createView() {
return new ResourceAutodiscoveryView(extendLocatorId(PAGE_AUTODISCOVERY_QUEUE.getName()));
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
index 6f9ecbf..6b99ed2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
@@ -61,7 +61,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
*/
public class ResourceAutodiscoveryView extends LocatableVLayout {
private static final String TITLE = MSG.view_autoDiscoveryQ_title();
- private static final String HEADER_ICON = "global/Recent_24.png";
+ private static final String HEADER_ICON = "global/AutoDiscovery_24.png";
private boolean simple;
private TreeGrid treeGrid;
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/global/AutoDiscovery_16.png b/modules/enterprise/gui/coregui/src/main/webapp/images/global/AutoDiscovery_16.png
new file mode 100644
index 0000000..e849115
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/global/AutoDiscovery_16.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/global/AutoDiscovery_24.png b/modules/enterprise/gui/coregui/src/main/webapp/images/global/AutoDiscovery_24.png
new file mode 100644
index 0000000..f4eae94
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/global/AutoDiscovery_24.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/global/upload.png b/modules/enterprise/gui/coregui/src/main/webapp/images/global/upload.png
index 335a235..b25dfbc 100644
Binary files a/modules/enterprise/gui/coregui/src/main/webapp/images/global/upload.png and b/modules/enterprise/gui/coregui/src/main/webapp/images/global/upload.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/global/upload_Disabled.png b/modules/enterprise/gui/coregui/src/main/webapp/images/global/upload_Disabled.png
index dec31e9..3b87d0c 100644
Binary files a/modules/enterprise/gui/coregui/src/main/webapp/images/global/upload_Disabled.png and b/modules/enterprise/gui/coregui/src/main/webapp/images/global/upload_Disabled.png differ
commit 2ba9e1c4cfcb7046bfce34996d4955b0091c08a6
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Thu Dec 16 12:23:48 2010 +0100
BZ 656469 - adding a temporary performance measure on the RHQ_MEASUREMENT_DATA_NUM_1D. Having an index on TIME_STAMP column helps the performance of the hourly jobs but a more involved solution is needed to fix this bottleneck.
This fix is part of RHQ 3.0.1 as well and therefore was added as schema spec 2.92.4 even though master is currently on schema spec 2.101.
This is to support seamless upgrade of the releases, but of course intermittently this is schema spec is not going to get applied until a full dbsetup is executed.
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index 1483436..d9f63c0 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -3130,6 +3130,14 @@
<schema-alterColumn table="RHQ_PARTITION_EVENT" column="SUBJECT_NAME" columnType="VARCHAR2" precision="100" />
</schemaSpec>
+ <schemaSpec version="2.92.4">
+ <schema-directSQL>
+ <statement desc="Add index on measurement data 1d table timestamp">
+ CREATE INDEX RHQ_MEAS_DATA_1D_TIME_IDX ON RHQ_MEASUREMENT_DATA_NUM_1D (time_stamp)
+ </statement>
+ </schema-directSQL>
+ </schemaSpec>
+
<schemaSpec version="2.93">
<!-- the customizable dashboard storage system -->
commit 3c1e2de750953df239f104d08a3f469e08ea0429
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Dec 16 02:12:23 2010 -0500
first stab at integrating new FlexSearchBar into TestSearchBarView
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/SearchBarItem.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/SearchBarItem.java
new file mode 100644
index 0000000..abc0958
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/SearchBarItem.java
@@ -0,0 +1,53 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.components.form;
+
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.form.fields.CanvasItem;
+
+import org.rhq.core.domain.search.SearchSubsystem;
+import org.rhq.enterprise.gui.coregui.client.search.FlexSearchBar;
+
+/**
+ * @author Joseph Marques
+ */
+public class SearchBarItem extends CanvasItem {
+
+ private Canvas canvas = new Canvas();
+ private FlexSearchBar searchBar;
+
+ public SearchBarItem(SearchSubsystem subsystem) {
+ super("Search");
+
+ searchBar = new FlexSearchBar();
+ searchBar.setSearchSubsystem(subsystem);
+
+ searchBar.setHeight("30px");
+ canvas.addChild(searchBar);
+
+ setCanvas(canvas);
+ setHeight(30);
+ }
+
+ @Override
+ public Canvas getCanvas() {
+ return canvas;
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
index 92548b5..a99ff5a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
@@ -73,6 +73,7 @@ import com.smartgwt.client.widgets.toolbar.ToolStrip;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.RefreshableView;
+import org.rhq.enterprise.gui.coregui.client.components.form.SearchBarItem;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
@@ -476,7 +477,7 @@ public class Table<DS extends RPCDataSource> extends LocatableHLayout implements
}
public void refresh() {
- if (null != this.listGrid) {
+ if (null != this.listGrid) {
this.listGrid.invalidateCache();
this.listGrid.markForRedraw();
}
@@ -681,9 +682,8 @@ public class Table<DS extends RPCDataSource> extends LocatableHLayout implements
recordNames.add(name);
}
- Message message = new Message(MSG
- .widget_recordEditor_info_recordsDeletedConcise(String.valueOf(deletedRecords.length),
- getDataTypeNamePlural()), MSG
+ Message message = new Message(MSG.widget_recordEditor_info_recordsDeletedConcise(String
+ .valueOf(deletedRecords.length), getDataTypeNamePlural()), MSG
.widget_recordEditor_info_recordsDeletedDetailed(String.valueOf(deletedRecords.length),
getDataTypeNamePlural(), recordNames.toString()));
CoreGUI.getMessageCenter().notify(message);
@@ -740,6 +740,8 @@ public class Table<DS extends RPCDataSource> extends LocatableHLayout implements
nextFormItem.addKeyPressHandler(this);
} else if (nextFormItem instanceof SelectItem) {
nextFormItem.addChangedHandler(this);
+ } else if (nextFormItem instanceof SearchBarItem) {
+ nextFormItem.addKeyPressHandler(this);
}
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/inventory/TestSearchBarView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/inventory/TestSearchBarView.java
index b372b93..d58197d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/inventory/TestSearchBarView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/inventory/TestSearchBarView.java
@@ -6,7 +6,9 @@ import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceD
import com.smartgwt.client.widgets.form.fields.TextItem;
import org.rhq.core.domain.resource.ResourceCategory;
+import org.rhq.core.domain.search.SearchSubsystem;
import org.rhq.enterprise.gui.coregui.client.components.form.EnumSelectItem;
+import org.rhq.enterprise.gui.coregui.client.components.form.SearchBarItem;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSearchView;
public class TestSearchBarView extends ResourceSearchView {
@@ -19,7 +21,8 @@ public class TestSearchBarView extends ResourceSearchView {
final TextItem nameFilter = new TextItem(NAME.propertyName(), NAME.title());
final EnumSelectItem categoryFilter = new EnumSelectItem(CATEGORY.propertyName(), CATEGORY.title(),
ResourceCategory.class);
+ final SearchBarItem searchFilter = new SearchBarItem(SearchSubsystem.RESOURCE);
- setFilterFormItems(nameFilter, categoryFilter);
+ setFilterFormItems(nameFilter, categoryFilter, searchFilter);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.html b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.html
index de84de2..ad2c937 100644
--- a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.html
+++ b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.html
@@ -12,6 +12,7 @@
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<link rel="stylesheet" href="CoreGUI.css">
+ <link rel="stylesheet" href="css/search.css">
<style type="text/css">
.menuButton, .menuButtonOver, .menuButtonDown, .menuButtonDisabled, .menuButtonSelected, .menuButtonSelectedDown, .menuButtonSelectedOver, .menuButtonSelectedDisabled {
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/css/search.css b/modules/enterprise/gui/coregui/src/main/webapp/css/search.css
index 994d28a..cd75fbc 100644
--- a/modules/enterprise/gui/coregui/src/main/webapp/css/search.css
+++ b/modules/enterprise/gui/coregui/src/main/webapp/css/search.css
@@ -30,6 +30,7 @@ div {
border-color: white;
border-style: none;
outline: none;
+ z-index: 999999;
}
.patternNameLabel {
@@ -41,6 +42,7 @@ div {
border-style: none;
font-size: 11px;
width: 125px;
+ z-index: 999999;
}
.patternNameField {
@@ -52,6 +54,7 @@ div {
border-style: dotted;
border-width: thin;
outline: none;
+ z-index: 999999;
}
@@ -67,6 +70,7 @@ div {
background-color: rgb(233, 230, 225);
height: 34px;
vertical-align: bottom;
+ z-index: 999999;
}
.searchBarBackgroundContainer {
@@ -83,12 +87,14 @@ div {
padding: 0;
width: 785px;
height: 20px;
+ z-index: 999999;
}
.searchBarComponentsContainer {
width: 100%;
margin: 0;
padding: 0;
+ z-index: 999999;
}
.searchBarComponentLHS {
@@ -122,6 +128,7 @@ div {
padding: 0;
margin: 0;
width: 785px;
+ z-index: 999999;
}
.savedSearchesPanel-row {
@@ -184,6 +191,8 @@ div {
border-bottom-color: gray;
border-right-color: gray;
border-width: 1px 1px 1px 1px;
+
+ z-index: 999999;
}
.suggestData {
@@ -221,6 +230,7 @@ div.rounded {
}
div.rounded2 {
width: 125px;
+ z-index: 999999;
background: rgb(192, 236, 207) url(/coregui/images/search/corner-upper-right-8.png) no-repeat top right;
}
div.rounded2 div {
commit 193d79cc72bd6ff3f63f9ef2aea818d31bef0cfb
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Dec 16 01:45:07 2010 -0500
update SearchBar-related classes to use new AbstractSearchBar super
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/search/favorites/SavedSearchGrid.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/search/favorites/SavedSearchGrid.java
index fd5c55f..188cd89 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/search/favorites/SavedSearchGrid.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/search/favorites/SavedSearchGrid.java
@@ -27,6 +27,7 @@ import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.Grid;
import org.rhq.core.domain.search.SavedSearch;
+import org.rhq.enterprise.gui.coregui.client.search.AbstractSearchBar;
import org.rhq.enterprise.gui.coregui.client.search.SearchBar;
/**
@@ -35,7 +36,7 @@ import org.rhq.enterprise.gui.coregui.client.search.SearchBar;
public class SavedSearchGrid extends Grid {
private PatternSelectionHandler patternSelectionHandler;
- private SearchBar searchBar;
+ private AbstractSearchBar searchBar;
public interface PatternSelectionHandler {
public void handleSelection(int rowIndex, int columnIndex, String patternName);
@@ -60,7 +61,7 @@ public class SavedSearchGrid extends Grid {
}
}
- public SavedSearchGrid(SearchBar searchBar) {
+ public SavedSearchGrid(AbstractSearchBar searchBar) {
super(0, 2); // assume no rows to start, but we'll always have 2 columns
setRowFormatter(new SavedSearchRowFormatter());
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/search/favorites/SavedSearchManager.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/search/favorites/SavedSearchManager.java
index 21a4f5f..b6ec717 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/search/favorites/SavedSearchManager.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/search/favorites/SavedSearchManager.java
@@ -33,7 +33,7 @@ import org.rhq.core.domain.search.SavedSearch;
import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.SearchGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.search.SearchBar;
+import org.rhq.enterprise.gui.coregui.client.search.AbstractSearchBar;
/**
* @author Joseph Marques
@@ -43,9 +43,9 @@ public class SavedSearchManager {
private final SearchGWTServiceAsync searchService = GWTServiceLookup.getSearchService();
private LinkedHashMap<String, SavedSearch> savedSearches = new LinkedHashMap<String, SavedSearch>();
- private SearchBar searchBar;
+ private AbstractSearchBar searchBar;
- public SavedSearchManager(SearchBar searchBar) {
+ public SavedSearchManager(AbstractSearchBar searchBar) {
this.searchBar = searchBar;
load();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/search/suggest/SuggestTextBox_v3.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/search/suggest/SuggestTextBox_v3.java
index fd3ecc8..f2dab2f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/search/suggest/SuggestTextBox_v3.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/search/suggest/SuggestTextBox_v3.java
@@ -64,12 +64,12 @@ import org.rhq.core.domain.search.SearchSuggestion;
import org.rhq.core.domain.search.SearchSuggestion.Kind;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.SearchGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.search.SearchBar;
+import org.rhq.enterprise.gui.coregui.client.search.AbstractSearchBar;
public class SuggestTextBox_v3 extends Composite implements HasText, HasAllFocusHandlers, HasValue<String>,
HasSelectionHandlers<Suggestion> {
- private final SearchBar searchBar;
+ private final AbstractSearchBar searchBar;
private final SearchSuggestOracle oracle;
private int limit = 20;
@@ -86,7 +86,7 @@ public class SuggestTextBox_v3 extends Composite implements HasText, HasAllFocus
private final String STYLE_NAME_TEXT_BOX = "patternField";
private final String STYLE_NAME_POPUP_PANEL = "suggestPanel";
- public SuggestTextBox_v3(SearchBar searchBar, TextBoxBase box) {
+ public SuggestTextBox_v3(AbstractSearchBar searchBar, TextBoxBase box) {
super();
this.searchBar = searchBar;
@@ -700,7 +700,7 @@ public class SuggestTextBox_v3 extends Composite implements HasText, HasAllFocus
SearchSuggestion searchSuggestion = extraSearchSuggestion(suggestion);
String currentText = getText().toLowerCase();
- if (searchBar.welcomeMessage.equals(currentText)) {
+ if (searchBar.getWelcomeMessage().equals(currentText)) {
setValue("", true);
return;
}
commit 1b8b6ec5876fcc1d1b86b2ea29918c9777e60eb8
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Dec 16 01:43:31 2010 -0500
abstract class for SearchBar, so two impls can be supported in parallel
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/search/AbstractSearchBar.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/search/AbstractSearchBar.java
new file mode 100644
index 0000000..ac4a874
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/search/AbstractSearchBar.java
@@ -0,0 +1,44 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.search;
+
+import com.google.gwt.user.client.ui.Composite;
+
+import org.rhq.core.domain.search.SearchSubsystem;
+import org.rhq.enterprise.gui.coregui.client.search.favorites.SavedSearchManager;
+
+/**
+ * Abstract class for SearchBar, so that a separate implementation can be written alongside the original.
+ *
+ * @author Joseph Marques
+ */
+public abstract class AbstractSearchBar extends Composite {
+
+ public abstract SearchSubsystem getSearchSubsystem();
+
+ public abstract String getWelcomeMessage();
+
+ public abstract String getSelectedTab();
+
+ public abstract void activateSavedSearch(String savedSearchName);
+
+ public abstract void onSavedSearchManagerLoaded();
+
+ public abstract SavedSearchManager getSavedSearchManager();
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/search/FlexSearchBar.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/search/FlexSearchBar.java
new file mode 100644
index 0000000..172bd13
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/search/FlexSearchBar.java
@@ -0,0 +1,568 @@
+/*
+ * 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.search;
+
+import com.allen_sauer.gwt.log.client.Log;
+import com.google.gwt.event.dom.client.BlurEvent;
+import com.google.gwt.event.dom.client.BlurHandler;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.dom.client.FocusEvent;
+import com.google.gwt.event.dom.client.FocusHandler;
+import com.google.gwt.event.dom.client.KeyCodes;
+import com.google.gwt.event.dom.client.KeyPressEvent;
+import com.google.gwt.event.dom.client.KeyPressHandler;
+import com.google.gwt.event.dom.client.MouseOutEvent;
+import com.google.gwt.event.dom.client.MouseOutHandler;
+import com.google.gwt.event.dom.client.MouseOverEvent;
+import com.google.gwt.event.dom.client.MouseOverHandler;
+import com.google.gwt.event.logical.shared.CloseEvent;
+import com.google.gwt.event.logical.shared.CloseHandler;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Element;
+import com.google.gwt.user.client.Event;
+import com.google.gwt.user.client.Event.NativePreviewEvent;
+import com.google.gwt.user.client.Event.NativePreviewHandler;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Image;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.Panel;
+import com.google.gwt.user.client.ui.PopupPanel;
+import com.google.gwt.user.client.ui.TextBox;
+
+import org.rhq.core.domain.search.SavedSearch;
+import org.rhq.core.domain.search.SearchSubsystem;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.Messages;
+import org.rhq.enterprise.gui.coregui.client.search.favorites.SavedSearchGrid;
+import org.rhq.enterprise.gui.coregui.client.search.favorites.SavedSearchManager;
+import org.rhq.enterprise.gui.coregui.client.search.favorites.SavedSearchGrid.PatternSelectionHandler;
+import org.rhq.enterprise.gui.coregui.client.search.suggest.SuggestTextBox_v3;
+
+/**
+ * @author Joseph Marques
+ */
+public class FlexSearchBar extends AbstractSearchBar {
+
+ private static final Messages MSG = CoreGUI.getMessages();
+
+ public String welcomeMessage;
+
+ public static final String DEFAULT_PATTERN_NAME = MSG.view_searchBar_defaultPattern();
+
+ private static final String IMAGE_DIR = "/coregui/images/search/";
+
+ private static final String STAR_OFF_URL = IMAGE_DIR + "star1.png";
+ private static final String STAR_ACTIVE_URL = IMAGE_DIR + "star2.png";
+ private static final String STAR_ON_URL = IMAGE_DIR + "star3.png";
+
+ private static final String ARROW_WHITE_URL = IMAGE_DIR + "menu_arrow.png";
+ private static final String ARROW_GRAY_URL = IMAGE_DIR + "menu_arrow_down.png";
+
+ public static final String TRASH = IMAGE_DIR + "trash.png";
+
+ private final TextBox patternField = new TextBox();
+ private final SuggestTextBox_v3 autoCompletePatternField = new SuggestTextBox_v3(this, patternField);
+ private final TextBox patternNameField = new TextBox();
+ private final Label patternNameLabel = new Label();
+
+ private final Image starImage = new Image(STAR_OFF_URL);
+ private final Image arrowImage = new Image(ARROW_WHITE_URL);
+
+ private final PopupPanel savedSearchesPanel = new PopupPanel(true);
+ private final SavedSearchGrid savedSearchesGrid = new SavedSearchGrid(this);
+
+ private String currentSearch = "";
+ private long lastNameFieldBlurTime = 0;
+
+ private final SavedSearchManager savedSearchManager;
+ private SearchSubsystem searchSubsystem;
+ private String defaultSearchText;
+ private String defaultSavedSearchPatternId;
+
+ private Element searchButton;
+
+ public void setupButton() {
+ searchButton = DOM.createButton();
+ Event.addNativePreviewHandler(new NativePreviewHandler() {
+ public void onPreviewNativeEvent(NativePreviewEvent event) {
+ if (event.getNativeEvent() != null && event.getNativeEvent().getEventTarget() != null) {
+
+ if (event.getNativeEvent().getEventTarget().equals(searchButton)
+ && event.getTypeInt() == Event.ONMOUSEDOWN) {
+ prepareSearchExecution();
+ }
+ }
+ }
+ });
+ }
+
+ HorizontalPanel sbc;
+ HorizontalPanel sbc_sbbgc;
+ HorizontalPanel sbc_sbbgc_sbcc;
+ HorizontalPanel sbc_sbbgc_sbcc_sbclhs_pfc;
+ HorizontalPanel sbc_sbbgc_sbcc_sbcrhs_aic;
+ HorizontalPanel sbc_sbbgc_sbcc_sbcrhs_sic;
+ HorizontalPanel sbc_sbbgc_sbcc_sbcrhs_pnfc;
+ HorizontalPanel sbc_sbbgc_sbcc_sbcrhs;
+ HorizontalPanel sbc_sbbgc_sbcc_sbcrhs_pnlc;
+ HorizontalPanel sbc_sbbc;
+ HorizontalPanel sbc_pfsc;
+ HorizontalPanel sbc_ssc;
+
+ public FlexSearchBar() {
+ Log.info("Loading SearchBar...");
+
+ // TODO: load default saved search pattern, if used has selected one
+ // populate default search text
+ // ensure that search subsystem is selected, probably want to force it to be a ctor argument
+
+ sbc = createHPanel(null, "searchBarContainer", null);
+ sbc_sbbgc = createHPanel(sbc, "searchBarBackgroundContainer", null);
+ sbc_sbbgc_sbcc = createHPanel(sbc_sbbgc, "searchBarComponentsContainer", null);
+ sbc_sbbgc_sbcc_sbclhs_pfc = createHPanel(sbc_sbbgc_sbcc, "searchBarComponentLHS", "patternFieldContainer");
+ sbc_sbbgc_sbcc_sbcrhs_aic = createHPanel(sbc_sbbgc_sbcc, "searchBarComponentRHS", "arrowImageContainer");
+ sbc_sbbgc_sbcc_sbcrhs_sic = createHPanel(sbc_sbbgc_sbcc, "searchBarComponentRHS", "starImageContainer");
+ sbc_sbbgc_sbcc_sbcrhs_pnfc = createHPanel(sbc_sbbgc_sbcc, "searchBarComponentRHS", "starImageContainer");
+ sbc_sbbgc_sbcc_sbcrhs = createHPanel(sbc_sbbgc_sbcc, "searchBarComponentRHS", null);
+ sbc_sbbgc_sbcc_sbcrhs_pnlc = createHPanel(sbc_sbbgc_sbcc_sbcrhs, "rounded", "patternNameLabelContainer");
+ sbc_sbbc = createHPanel(sbc, "searchBarButtonContainer", "searchButtonContainer");
+ sbc_pfsc = createHPanel(sbc, null, "patternFieldSuggestionsContainer");
+ sbc_ssc = createHPanel(sbc, null, "savedSearchesContainer");
+ initWidget(sbc);
+
+ savedSearchManager = new SavedSearchManager(this);
+ }
+
+ private Element createDiv(Element parentDiv, String className, String id) {
+ Element div = DOM.createDiv();
+ if (parentDiv != null) {
+ parentDiv.appendChild(div);
+ }
+ if (className != null) {
+ div.addClassName(className);
+ }
+ if (id != null) {
+ div.setId(id);
+ }
+ return div;
+ }
+
+ private HorizontalPanel createHPanel(Panel parent, String className, String id) {
+ HorizontalPanel panel = new HorizontalPanel();
+ if (parent != null) {
+ parent.add(panel);
+ }
+ if (className != null) {
+ panel.setStyleName(className);
+ }
+ if (id != null) {
+ panel.getElement().setId(id);
+ }
+ return panel;
+ }
+
+ public void onSavedSearchManagerLoaded() {
+ /*
+ RootPanel.get("patternFieldContainer").add(autoCompletePatternField);
+ RootPanel.get("patternNameFieldContainer").add(patternNameField);
+ RootPanel.get("patternNameLabelContainer").add(patternNameLabel);
+ RootPanel.get("starImageContainer").add(starImage);
+ RootPanel.get("arrowImageContainer").add(arrowImage);
+ RootPanel.get("savedSearchesContainer").add(savedSearchesPanel);
+ */
+
+ sbc_sbbgc_sbcc_sbclhs_pfc.add(autoCompletePatternField);
+ sbc_sbbgc_sbcc_sbcrhs_pnfc.add(patternNameField);
+ sbc_sbbgc_sbcc_sbcrhs_pnlc.add(patternNameLabel);
+ sbc_sbbgc_sbcc_sbcrhs_sic.add(starImage);
+ sbc_sbbgc_sbcc_sbcrhs_aic.add(arrowImage);
+ sbc_ssc.add(savedSearchesPanel);
+
+ setupAutoCompletingPatternField();
+ setupPatternNameField();
+ setupPatternNameLabel();
+ setupStarImage();
+ setupArrowImage();
+ setupSavedSearches();
+
+ //
+ if (defaultSearchText != null) {
+ this.autoCompletePatternField.setText(defaultSearchText);
+ click(searchButton); // execute the search with this default search expression
+ } else if (defaultSavedSearchPatternId != null) {
+ try {
+ Integer savedSearchId = Integer.valueOf(defaultSavedSearchPatternId);
+ activateSavedSearch(savedSearchId);
+ } catch (Exception e) {
+ this.autoCompletePatternField.setText(MSG.view_searchBar_error_selectSavedSearch());
+ click(searchButton); // execute the search, which will help to further highlight the error
+ }
+ }
+
+ // presume the enclosing page logic loads results without a button click
+ }
+
+ public static native String getUserAgent()
+ /*-{
+ return navigator.userAgent.toLowerCase();
+ }-*/;
+
+ public SavedSearchManager getSavedSearchManager() {
+ return savedSearchManager;
+ }
+
+ public void setSearchSubsystem(SearchSubsystem searchSubsystem) {
+ this.searchSubsystem = searchSubsystem;
+
+ this.welcomeMessage = MSG.view_searchBar_welcomeMessage(this.searchSubsystem.getName());
+
+ this.autoCompletePatternField.setText(welcomeMessage);
+ }
+
+ public SearchSubsystem getSearchSubsystem() {
+ return searchSubsystem;
+ }
+
+ public void setDefaultSearchText(String defaultSearchText) {
+ if (defaultSearchText == null || defaultSearchText.trim().equals("")) {
+ return; // do nothing
+ }
+
+ this.defaultSearchText = defaultSearchText;
+ }
+
+ public String getDefaultSearchText() {
+ return defaultSearchText;
+ }
+
+ public void setDefaultSavedSearchPatternId(String defaultSavedSearchPatternId) {
+ if (defaultSavedSearchPatternId == null || defaultSavedSearchPatternId.trim().equals("")) {
+ return; // do nothing
+ }
+
+ this.defaultSavedSearchPatternId = defaultSavedSearchPatternId;
+ }
+
+ public String getDefaultSavedSearchPatternId() {
+ return defaultSavedSearchPatternId;
+ }
+
+ public String getWelcomeMessage() {
+ return welcomeMessage;
+ }
+
+ public void prepareSearchExecution() {
+ String searchTerms = autoCompletePatternField.getText().toLowerCase().trim();
+ if (searchTerms.equals(welcomeMessage)) {
+ autoCompletePatternField.setText("");
+ }
+ }
+
+ private void setupAutoCompletingPatternField() {
+ autoCompletePatternField.getElement().setId("patternField");
+ autoCompletePatternField.setStyleName("patternField");
+
+ AutoCompletePatternFieldEventHandler handler = new AutoCompletePatternFieldEventHandler();
+ autoCompletePatternField.getTextBox().addFocusHandler(handler);
+ autoCompletePatternField.getTextBox().addBlurHandler(handler);
+ autoCompletePatternField.addKeyPressHandler(handler);
+ }
+
+ private void setupPatternNameField() {
+ patternNameField.setStyleName("patternNameField");
+ patternNameField.setVisible(false);
+
+ PatternNameFieldEventHandler handler = new PatternNameFieldEventHandler();
+ patternNameField.addKeyPressHandler(handler);
+ patternNameField.addClickHandler(handler);
+ patternNameField.addBlurHandler(handler);
+ }
+
+ private void setupPatternNameLabel() {
+ patternNameLabel.setStyleName("patternNameLabel");
+ patternNameLabel.setVisible(false);
+
+ PatternNameLabelEventHandler handler = new PatternNameLabelEventHandler();
+ patternNameLabel.addClickHandler(handler);
+ }
+
+ private void setupStarImage() {
+ StarImageEventHandler handler = new StarImageEventHandler();
+ starImage.addClickHandler(handler);
+ starImage.addMouseOverHandler(handler);
+ starImage.addMouseOutHandler(handler);
+ }
+
+ private void setupArrowImage() {
+ ArrowImageEventHandler handler = new ArrowImageEventHandler();
+ arrowImage.addClickHandler(handler);
+ }
+
+ private void setupSavedSearches() {
+ savedSearchesPanel.add(savedSearchesGrid);
+ savedSearchesPanel.setStyleName("savedSearchesPanel");
+ savedSearchesGrid.addStyleName("savedSearchesPanel");
+
+ // panel position will be re-calculated on down-arrow click
+ savedSearchesPanel.show();
+ savedSearchesPanel.hide();
+
+ SavedSearchesEventHandler handler = new SavedSearchesEventHandler();
+ savedSearchesPanel.addCloseHandler(handler);
+ savedSearchesGrid.setPatternSelectionHandler(handler);
+ }
+
+ private void turnNameFieldIntoLabel() {
+ String name = patternNameField.getText();
+
+ if (name.equalsIgnoreCase(DEFAULT_PATTERN_NAME)) {
+ name = "";
+ }
+
+ arrowImage.setVisible(true);
+ patternNameField.setVisible(false);
+
+ if (name.equals("")) {
+ savedSearchManager.removePatternByName(currentSearch);
+ starImage.setUrl(STAR_OFF_URL);
+ } else {
+ if (currentSearch.equals("")) {
+ String pattern = autoCompletePatternField.getText();
+ savedSearchManager.updatePatternByName(name, pattern); // create case
+ } else {
+ savedSearchManager.renamePattern(currentSearch, name);
+ }
+ //savedSearchManager.updatePatternByName(name, pattern);
+ patternNameLabel.setText(elipse(name));
+ patternNameLabel.setVisible(true);
+ starImage.setUrl(STAR_ON_URL);
+ }
+ currentSearch = name;
+ }
+
+ private void turnNameLabelIntoField() {
+ String name = currentSearch;
+ patternNameField.setText(name);
+ patternNameField.setVisible(true);
+ patternNameLabel.setVisible(false);
+ patternNameField.setFocus(true);
+ }
+
+ private String elipse(String data) {
+ if (data.length() > 14) {
+ return data.substring(0, 14) + "...";
+ }
+ return data;
+ }
+
+ /*
+ * Event Handlers
+ */
+ class AutoCompletePatternFieldEventHandler implements KeyPressHandler, FocusHandler, BlurHandler {
+ public void onKeyPress(KeyPressEvent event) {
+ // hide pattern field/label, turn off star
+ if (event.getCharCode() == KeyCodes.KEY_ENTER) {
+ return;
+ }
+
+ patternNameLabel.setText("");
+ patternNameLabel.setVisible(false);
+ patternNameField.setValue("", true);
+ patternNameField.setVisible(false);
+ currentSearch = "";
+ starImage.setUrl(STAR_OFF_URL);
+
+ if (event.getCharCode() == KeyCodes.KEY_ESCAPE) {
+ autoCompletePatternField.hideSuggestionList();
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ }
+
+ public void onFocus(FocusEvent event) {
+ // clear default search text if necessary
+ if (autoCompletePatternField.getText().equals(welcomeMessage)) {
+ autoCompletePatternField.setValue("", true);
+ }
+ autoCompletePatternField.showSuggestionList();
+ savedSearchesPanel.hide();
+ }
+
+ public void onBlur(BlurEvent event) {
+ if (autoCompletePatternField.getText().equals("")) {
+ autoCompletePatternField.setValue(welcomeMessage, true);
+ }
+ savedSearchesPanel.hide();
+ }
+ }
+
+ class PatternNameFieldEventHandler implements KeyPressHandler, ClickHandler, BlurHandler {
+ public void onKeyPress(KeyPressEvent event) {
+ if (event.getCharCode() == KeyCodes.KEY_ENTER) {
+ Log.debug("key press pattern name field");
+ turnNameFieldIntoLabel();
+ }
+ }
+
+ public void onClick(ClickEvent event) {
+ if (patternNameField.getText().equals(DEFAULT_PATTERN_NAME)) {
+ patternNameField.setValue("", false);
+ }
+ }
+
+ public void onBlur(BlurEvent event) {
+ lastNameFieldBlurTime = System.currentTimeMillis();
+ turnNameFieldIntoLabel();
+ }
+ }
+
+ class PatternNameLabelEventHandler implements ClickHandler {
+ public void onClick(ClickEvent event) {
+ turnNameLabelIntoField();
+ }
+ }
+
+ class StarImageEventHandler implements ClickHandler, MouseOverHandler, MouseOutHandler {
+ public void onClick(ClickEvent event) {
+ long diff = System.currentTimeMillis() - lastNameFieldBlurTime;
+ if (Math.abs(diff) < 750) {
+ /*
+ * This event propagation is annoying. If the threshold is set too low, then both
+ * the name field blur event and this star image click event fire...but the blur
+ * event fires first, which turns the star white. Then a click on a white star
+ * triggers edit mode, re-enabling the name field. However, setting the threshold
+ * too high will prevent the click event from being handled when the user naturally
+ * wants to click on the star in rapid succession within the threshold time frame.
+ * It is hoped that 750ms will strike a nice balance, and that most users will never
+ * experienced any oddities from this trade-off.
+ */
+ return;
+ }
+
+ if (starImage.getUrl().endsWith(STAR_ACTIVE_URL)) {
+ patternNameField.setText(DEFAULT_PATTERN_NAME);
+ patternNameField.setVisible(true);
+ patternNameField.selectAll();
+ patternNameField.setFocus(true);
+ patternNameLabel.setVisible(false);
+ } else if (starImage.getUrl().endsWith(STAR_ON_URL)) {
+ starImage.setUrl(STAR_ACTIVE_URL);
+ patternNameField.setVisible(false);
+ patternNameLabel.setVisible(false);
+ savedSearchManager.removePatternByName(currentSearch);
+ }
+ }
+
+ public void onMouseOver(MouseOverEvent event) {
+ if (starImage.getUrl().endsWith(STAR_OFF_URL)) {
+ starImage.setUrl(STAR_ACTIVE_URL);
+
+ }
+ }
+
+ public void onMouseOut(MouseOutEvent event) {
+ if (starImage.getUrl().endsWith(STAR_ACTIVE_URL) && !patternNameField.isVisible()) {
+ starImage.setUrl(STAR_OFF_URL);
+ }
+ }
+ }
+
+ class ArrowImageEventHandler implements ClickHandler {
+ public void onClick(ClickEvent event) {
+ savedSearchesGrid.updateModel();
+ int left = autoCompletePatternField.getAbsoluteLeft();
+ int top = autoCompletePatternField.getAbsoluteTop() + autoCompletePatternField.getOffsetHeight();
+ savedSearchesPanel.setPopupPosition(left, top + 5);
+ savedSearchesPanel.show();
+ arrowImage.setUrl(ARROW_GRAY_URL);
+ }
+ }
+
+ class SavedSearchesEventHandler implements CloseHandler<PopupPanel>, PatternSelectionHandler {
+ public void onClose(CloseEvent<PopupPanel> event) {
+ arrowImage.setUrl(ARROW_WHITE_URL);
+ }
+
+ public void handleSelection(int rowIndex, int columnIndex, String patternName) {
+ Log.debug("SavedSearchesEventHandler.handleSelection(" + rowIndex + "," + columnIndex + "," + patternName
+ + ")");
+ if (columnIndex == 1) {
+ savedSearchManager.removePatternByName(patternName);
+
+ if (currentSearch.equals(patternName)) {
+ currentSearch = "";
+ patternNameField.setValue("", true);
+ patternNameField.setVisible(false);
+ patternNameLabel.setText("");
+ patternNameLabel.setVisible(false);
+ autoCompletePatternField.setFocus(true);
+ starImage.setUrl(STAR_OFF_URL);
+ savedSearchesPanel.hide();
+ }
+
+ if (savedSearchManager.getSavedSearchCount() == 0) {
+ savedSearchesPanel.hide();
+ }
+
+ savedSearchesGrid.removeRow(rowIndex);
+ } else {
+ activateSavedSearch(patternName); // activating the saved search also clicks the button
+ }
+ }
+ }
+
+ private static native void click(Element button)
+ /*-{
+ button.click();
+ }-*/;
+
+ public void activateSavedSearch(Integer savedSearchId) {
+ SavedSearch savedSearch = savedSearchManager.getSavedSearchById(savedSearchId);
+ if (savedSearch == null) {
+ Log.debug("activateSavedSearch: no known saved search with id '" + savedSearchId + "'");
+ return; // no saved search existing with the specified id
+ }
+ activateSavedSearch(savedSearch);
+ }
+
+ public void activateSavedSearch(String savedSearchName) {
+ SavedSearch savedSearch = savedSearchManager.getSavedSearchByName(savedSearchName);
+ if (savedSearch == null) {
+ Log.debug("activateSavedSearch: no known saved search with name '" + savedSearchName + "'");
+ return; // no saved search existing with the specified name
+ }
+ activateSavedSearch(savedSearch);
+ }
+
+ public void activateSavedSearch(SavedSearch savedSearch) {
+ currentSearch = "";
+ autoCompletePatternField.setValue(savedSearch.getPattern(), true);
+ patternNameField.setValue(savedSearch.getName(), true);
+ Log.debug("search results change: [" + savedSearch.getName() + "," + savedSearch.getPattern() + "]");
+ turnNameFieldIntoLabel();
+ savedSearchesPanel.hide();
+ click(searchButton);
+ }
+
+ public String getSelectedTab() {
+ return null;
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/search/SearchBar.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/search/SearchBar.java
index 7d330d1..8be4f47 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/search/SearchBar.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/search/SearchBar.java
@@ -43,7 +43,6 @@ import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.RootPanel;
-import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.TextBox;
import org.rhq.core.domain.search.SavedSearch;
@@ -58,7 +57,7 @@ import org.rhq.enterprise.gui.coregui.client.search.suggest.SuggestTextBox_v3;
/**
* @author Joseph Marques
*/
-public class SearchBar extends SimplePanel {
+public class SearchBar extends AbstractSearchBar {
private static final Messages MSG = CoreGUI.getMessages();
@@ -118,7 +117,7 @@ public class SearchBar extends SimplePanel {
if (event.getNativeEvent() != null && event.getNativeEvent().getEventTarget() != null) {
if (event.getNativeEvent().getEventTarget().equals(searchButton)
- && event.getTypeInt() == Event.ONMOUSEDOWN) {
+ && event.getTypeInt() == Event.ONMOUSEDOWN) {
prepareSearchExecution();
}
}
@@ -473,8 +472,8 @@ public class SearchBar extends SimplePanel {
}
public void handleSelection(int rowIndex, int columnIndex, String patternName) {
- Log.debug("SavedSearchesEventHandler.handleSelection(" + rowIndex + "," + columnIndex + ","
- + patternName + ")");
+ Log.debug("SavedSearchesEventHandler.handleSelection(" + rowIndex + "," + columnIndex + "," + patternName
+ + ")");
if (columnIndex == 1) {
savedSearchManager.removePatternByName(patternName);
commit 7a4c71230136a3dc9bba3d367f0079f5f34228c8
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Dec 16 01:33:31 2010 -0500
fix indentation
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/searchInterface.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/searchInterface.xhtml
index 99bf2d1..6046ee3 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/searchInterface.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/searchInterface.xhtml
@@ -18,15 +18,15 @@
subtab="#{subtab}"
id="searchBar">
<div class="searchBarBackgroundContainer">
- <div class="searchBarComponentsContainer">
- <div class="searchBarComponentLHS" id="patternFieldContainer"></div>
-
- <div class="searchBarComponentRHS" id="arrowImageContainer"></div>
- <div class="searchBarComponentRHS" id="starImageContainer"></div>
- <div class="searchBarComponentRHS" id="patternNameFieldContainer"></div>
- <div class="searchBarComponentRHS">
- <div id="patternNameLabelContainer" class="rounded"></div>
- </div>
+ <div class="searchBarComponentsContainer">
+ <div class="searchBarComponentLHS" id="patternFieldContainer"></div>
+
+ <div class="searchBarComponentRHS" id="arrowImageContainer"></div>
+ <div class="searchBarComponentRHS" id="starImageContainer"></div>
+ <div class="searchBarComponentRHS" id="patternNameFieldContainer"></div>
+ <div class="searchBarComponentRHS">
+ <div id="patternNameLabelContainer" class="rounded"></div>
+ </div>
</div>
</div>
<div class="searchBarButtonContainer" id="searchButtonContainer"></div>
commit f0205b9c24997f76d06497b176db1c9fd09cb903
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Dec 16 01:17:18 2010 -0500
2nd attempt at fixing compile error in ws test
diff --git a/modules/enterprise/remoting/webservices/src/test/java/org/rhq/enterprise/server/ws/WsResourceManagerTest.java b/modules/enterprise/remoting/webservices/src/test/java/org/rhq/enterprise/server/ws/WsResourceManagerTest.java
index 8d00622..0049cf3 100644
--- a/modules/enterprise/remoting/webservices/src/test/java/org/rhq/enterprise/server/ws/WsResourceManagerTest.java
+++ b/modules/enterprise/remoting/webservices/src/test/java/org/rhq/enterprise/server/ws/WsResourceManagerTest.java
@@ -260,7 +260,7 @@ public class WsResourceManagerTest extends AssertJUnit implements TestProperties
// lookup the first platform resource and use that name. More stable
// than hard coding. Almost always one.
ResourceCriteria platCriteria = new ResourceCriteria();
- platCriteria.setFilterResourceCategories(ResourceCategory.PLATFORM);
+ platCriteria.getFilterResourceCategories().add(ResourceCategory.PLATFORM);
List<Resource> platformList = WEBSERVICE_REMOTE.findResourcesByCriteria(subject, platCriteria);
assertNotNull("Platform list should not be null.", platformList);
assertEquals("Should be only one in list for testing.", 1, platformList.size());
commit 591dc2e2556a716692594c4945810f4ddb174998
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Dec 16 00:52:20 2010 -0500
fix compile error in ws test
diff --git a/modules/enterprise/remoting/webservices/src/test/java/org/rhq/enterprise/server/ws/WsResourceManagerTest.java b/modules/enterprise/remoting/webservices/src/test/java/org/rhq/enterprise/server/ws/WsResourceManagerTest.java
index 42cbb21..8d00622 100644
--- a/modules/enterprise/remoting/webservices/src/test/java/org/rhq/enterprise/server/ws/WsResourceManagerTest.java
+++ b/modules/enterprise/remoting/webservices/src/test/java/org/rhq/enterprise/server/ws/WsResourceManagerTest.java
@@ -260,7 +260,7 @@ public class WsResourceManagerTest extends AssertJUnit implements TestProperties
// lookup the first platform resource and use that name. More stable
// than hard coding. Almost always one.
ResourceCriteria platCriteria = new ResourceCriteria();
- platCriteria.setFilterResourceCategory(ResourceCategory.PLATFORM);
+ platCriteria.setFilterResourceCategories(ResourceCategory.PLATFORM);
List<Resource> platformList = WEBSERVICE_REMOTE.findResourcesByCriteria(subject, platCriteria);
assertNotNull("Platform list should not be null.", platformList);
assertEquals("Should be only one in list for testing.", 1, platformList.size());
commit a512a512e3277135e1e789a6ffbdbf61fb964b25
Author: Joseph Marques <joseph(a)redhat.com>
Date: Wed Dec 15 23:03:41 2010 -0500
more forgiving parsing of criteria objects from the request
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
index 629a4df..de8e667 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
@@ -424,21 +424,36 @@ public abstract class RPCDataSource<T> extends DataSource {
if (value == null) {
// nothing to do, result is already null
} else if (type == Integer.class) {
- int[] intermediates = criteria.getAttributeAsIntArray(paramName);
+ int[] intermediates;
+ if (type.getClass().isArray()) {
+ intermediates = criteria.getAttributeAsIntArray(paramName);
+ } else { // want array return, but only single instance of the type in the request
+ intermediates = new int[] { criteria.getAttributeAsInt(paramName) };
+ }
resultArray = (S[]) new Integer[intermediates.length];
int index = 0;
for (int next : intermediates) {
resultArray[index++] = (S) Integer.valueOf(next);
}
} else if (type == String.class) {
- String[] intermediates = criteria.getAttributeAsStringArray(paramName);
+ String[] intermediates;
+ if (type.getClass().isArray()) {
+ intermediates = criteria.getAttributeAsStringArray(paramName);
+ } else { // want array return, but only single instance of the type in the request
+ intermediates = new String[] { criteria.getAttributeAsString(paramName) };
+ }
resultArray = (S[]) new String[intermediates.length];
int index = 0;
for (String next : intermediates) {
resultArray[index++] = (S) next;
}
} else if (type.isEnum()) {
- String[] intermediates = criteria.getAttributeAsStringArray(paramName);
+ String[] intermediates;
+ if (type.getClass().isArray()) {
+ intermediates = criteria.getAttributeAsStringArray(paramName);
+ } else { // want array return, but only single instance of the type in the request
+ intermediates = new String[] { criteria.getAttributeAsString(paramName) };
+ }
List<S> buffer = new ArrayList<S>();
for (String next : intermediates) {
buffer.add((S) Enum.valueOf((Class<? extends Enum>) type, next));
commit b37f3e2278ca08f5eddb43e275e300642fa9d850
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Dec 15 22:22:46 2010 -0500
BZ 663517 which fixes BZ 663236 also. cobertura should be at test scope so it and its ant dep don't go in the server
diff --git a/pom.xml b/pom.xml
index bf46232..9d8537b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -455,6 +455,7 @@
<groupId>net.sourceforge.cobertura</groupId>
<artifactId>cobertura</artifactId>
<version>1.9.4.1</version>
+ <scope>test</scope>
</dependency>
</dependencies>
commit b6394f410395f0dc6b2afda52ba7cab9644e1f09
Author: Joseph Marques <joseph(a)redhat.com>
Date: Wed Dec 15 18:33:21 2010 -0500
eliminate EnumSet usage, which bombs during serialization for GWT
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/AuthorizationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/AuthorizationManagerBean.java
index 25e34b7..1da673c 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/AuthorizationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/AuthorizationManagerBean.java
@@ -20,7 +20,7 @@ package org.rhq.enterprise.server.authz;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.EnumSet;
+import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -56,15 +56,15 @@ public class AuthorizationManagerBean implements AuthorizationManagerLocal {
public Set<Permission> getExplicitGlobalPermissions(Subject subject) {
Query query = entityManager.createNamedQuery(Subject.QUERY_GET_GLOBAL_PERMISSIONS);
query.setParameter("subject", subject);
- List<Permission> results = query.getResultList();
- EnumSet permissions = EnumSet.noneOf(Permission.class);
- for (Permission permission : results) {
+ List<Permission> intermediate = query.getResultList();
+ Set<Permission> results = new HashSet<Permission>();
+ for (Permission permission : intermediate) {
if (permission.getTarget() == Target.GLOBAL) {
- permissions.add(permission);
+ results.add(permission);
}
}
- return permissions;
+ return results;
}
@SuppressWarnings("unchecked")
@@ -72,13 +72,13 @@ public class AuthorizationManagerBean implements AuthorizationManagerLocal {
Query query = entityManager.createNamedQuery(Subject.QUERY_GET_PERMISSIONS_BY_GROUP_ID);
query.setParameter("subject", subject);
query.setParameter("groupId", groupId);
- List<Permission> results = query.getResultList();
- EnumSet permissions = EnumSet.noneOf(Permission.class);
- for (Permission permission : results) {
- permissions.add(permission);
+ List<Permission> intermediate = query.getResultList();
+ Set<Permission> results = new HashSet<Permission>();
+ for (Permission permission : intermediate) {
+ results.add(permission);
}
- return permissions;
+ return results;
}
public Set<Permission> getImplicitGroupPermissions(Subject subject, int groupId) {
@@ -92,13 +92,13 @@ public class AuthorizationManagerBean implements AuthorizationManagerLocal {
Query query = entityManager.createNamedQuery(Subject.QUERY_GET_PERMISSIONS_BY_RESOURCE_ID);
query.setParameter("subject", subject);
query.setParameter("resourceId", resourceId);
- List<Permission> results = query.getResultList();
- EnumSet permissions = EnumSet.noneOf(Permission.class);
- for (Permission permission : results) {
- permissions.add(permission);
+ List<Permission> intermediate = query.getResultList();
+ Set<Permission> results = new HashSet<Permission>();
+ for (Permission permission : intermediate) {
+ results.add(permission);
}
- return permissions;
+ return results;
}
public Set<Permission> getImplicitResourcePermissions(Subject subject, int resourceId) {
@@ -285,5 +285,5 @@ public class AuthorizationManagerBean implements AuthorizationManagerLocal {
return (subject.getId() == SUBJECT_ID_OVERLORD);
}
-
+
}
\ No newline at end of file
commit 30ccb523e40086b01d852d6af79fa08d2dcbf720
Author: Joseph Marques <joseph(a)redhat.com>
Date: Mon Dec 13 18:41:02 2010 -0500
add new test page to showcase filtering resources
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestTopView.java
index 92823f9..95bfaa5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestTopView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestTopView.java
@@ -35,6 +35,7 @@ import org.rhq.enterprise.gui.coregui.client.test.configuration.TestConfiguratio
import org.rhq.enterprise.gui.coregui.client.test.configuration.TestGroupConfigurationView;
import org.rhq.enterprise.gui.coregui.client.test.i18n.TestPluralizationView;
import org.rhq.enterprise.gui.coregui.client.test.i18n.TestRemoteServiceStatisticsView;
+import org.rhq.enterprise.gui.coregui.client.test.inventory.TestSearchBarView;
/**
* The Test top-level view. This view is "hidden", i.e. there are no links to it, so the user must go to the URL
@@ -47,13 +48,12 @@ public class TestTopView extends AbstractSectionedLeftNavigationView {
// view IDs for Inventory section
private static final ViewName INVENTORY_SECTION_VIEW_ID = new ViewName("Inventory");
-
private static final ViewName PAGE_RESOURCE_SELECTOR = new ViewName("ResourceSelector");
private static final ViewName PAGE_TYPE_TREE = new ViewName("TypeTree");
+ private static final ViewName PAGE_SEARCH_BAR = new ViewName("SearchBar");
// view IDs for Configuration section
private static final ViewName CONFIGURATION_SECTION_VIEW_ID = new ViewName("Configuration");
-
private static final ViewName PAGE_CONFIG_EDITOR = new ViewName("ConfigEditor");
private static final ViewName PAGE_GROUP_CONFIG_EDITOR = new ViewName("GroupConfigEditor");
@@ -103,7 +103,13 @@ public class TestTopView extends AbstractSectionedLeftNavigationView {
}
});
- return new NavigationSection(INVENTORY_SECTION_VIEW_ID, resourceSelectorItem, typeTreeItem);
+ NavigationItem searchBarItem = new NavigationItem(PAGE_SEARCH_BAR, null, new ViewFactory() {
+ public Canvas createView() {
+ return new TestSearchBarView(extendLocatorId(PAGE_SEARCH_BAR.getName()));
+ }
+ });
+
+ return new NavigationSection(INVENTORY_SECTION_VIEW_ID, resourceSelectorItem, typeTreeItem, searchBarItem);
}
private NavigationSection buildConfigurationSection() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/inventory/TestSearchBarView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/inventory/TestSearchBarView.java
new file mode 100644
index 0000000..b372b93
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/inventory/TestSearchBarView.java
@@ -0,0 +1,25 @@
+package org.rhq.enterprise.gui.coregui.client.test.inventory;
+
+import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.CATEGORY;
+import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.NAME;
+
+import com.smartgwt.client.widgets.form.fields.TextItem;
+
+import org.rhq.core.domain.resource.ResourceCategory;
+import org.rhq.enterprise.gui.coregui.client.components.form.EnumSelectItem;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSearchView;
+
+public class TestSearchBarView extends ResourceSearchView {
+ public TestSearchBarView(String locatorId) {
+ super(locatorId);
+ }
+
+ @Override
+ protected void configureTableFilters() {
+ final TextItem nameFilter = new TextItem(NAME.propertyName(), NAME.title());
+ final EnumSelectItem categoryFilter = new EnumSelectItem(CATEGORY.propertyName(), CATEGORY.title(),
+ ResourceCategory.class);
+
+ setFilterFormItems(nameFilter, categoryFilter);
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
index c0e8695..629a4df 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
@@ -45,6 +45,7 @@ import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.core.domain.alert.AlertPriority;
import org.rhq.core.domain.event.EventSeverity;
+import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
@@ -460,6 +461,8 @@ public abstract class RPCDataSource<T> extends DataSource {
return (S[]) new AlertPriority[size];
} else if (genericEnumType == EventSeverity.class) {
return (S[]) new EventSeverity[size];
+ } else if (genericEnumType == ResourceCategory.class) {
+ return (S[]) new ResourceCategory[size];
} else {
throw new IllegalArgumentException(MSG.dataSource_rpc_error_unsupportedEnumType(genericEnumType.getName()));
}
commit 708cbe1099f406d92304832a9451b84120902b46
Author: Joseph Marques <joseph(a)redhat.com>
Date: Mon Dec 13 18:37:03 2010 -0500
improve ResourceCriteria to be able to filter on multiple ResourceCategory enums
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
index 0fd3a0a..5ecec8c 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
@@ -52,7 +52,7 @@ public class ResourceCriteria extends TaggedCriteria {
private String filterDescription;
private Integer filterResourceTypeId; // needs overrides
private String filterResourceTypeName; // needs overrides
- private ResourceCategory filterResourceCategory; // needs overrides
+ private List<ResourceCategory> filterResourceCategories; // needs overrides
private String filterPluginName; // needs overrides
private Integer filterParentResourceId; // needs overrides
private String filterParentResourceName; // needs overrides
@@ -104,7 +104,7 @@ public class ResourceCriteria extends TaggedCriteria {
public ResourceCriteria() {
filterOverrides.put("resourceTypeId", "resourceType.id = ?");
filterOverrides.put("resourceTypeName", "resourceType.name like ?");
- filterOverrides.put("resourceCategory", "resourceType.category = ?");
+ filterOverrides.put("resourceCategories", "resourceType.category IN ( ? )");
filterOverrides.put("pluginName", "resourceType.plugin like ?");
filterOverrides.put("parentResourceId", "parentResource.id = ?");
filterOverrides.put("parentResourceName", "parentResource.name like ?");
@@ -172,8 +172,8 @@ public class ResourceCriteria extends TaggedCriteria {
this.filterResourceTypeName = filterResourceTypeName;
}
- public void addFilterResourceCategory(ResourceCategory filterResourceCategory) {
- this.filterResourceCategory = filterResourceCategory;
+ public void addFilterResourceCategories(ResourceCategory... filterResourceCategories) {
+ this.filterResourceCategories = CriteriaUtils.getListIgnoringNulls(filterResourceCategories);
}
public void addFilterPluginName(String filterPluginName) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceCompositeDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceCompositeDataSource.java
index bf6d251..1b44b53 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceCompositeDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceCompositeDataSource.java
@@ -128,7 +128,7 @@ public class ResourceCompositeDataSource extends RPCDataSource<ResourceComposite
criteria.addFilterId(getFilter(request, "id", Integer.class));
criteria.addFilterParentResourceId(getFilter(request, "parentId", Integer.class));
criteria.addFilterCurrentAvailability(getFilter(request, AVAILABILITY.propertyName(), AvailabilityType.class));
- criteria.addFilterResourceCategory(getFilter(request, CATEGORY.propertyName(), ResourceCategory.class));
+ criteria.addFilterResourceCategories(getArrayFilter(request, CATEGORY.propertyName(), ResourceCategory.class));
criteria.addFilterIds(getArrayFilter(request, "resourceIds", Integer.class));
criteria.addFilterImplicitGroupIds(getFilter(request, "groupId", Integer.class));
criteria.addFilterName(getFilter(request, NAME.propertyName(), String.class));
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
index 0b3ef89..8d0ac24 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
@@ -168,7 +168,7 @@ public class ResourceDatasource extends RPCDataSource<Resource> {
criteria.addFilterId(getFilter(request, "id", Integer.class));
criteria.addFilterParentResourceId(getFilter(request, "parentId", Integer.class));
criteria.addFilterCurrentAvailability(getFilter(request, AVAILABILITY.propertyName(), AvailabilityType.class));
- criteria.addFilterResourceCategory(getFilter(request, CATEGORY.propertyName(), ResourceCategory.class));
+ criteria.addFilterResourceCategories(getArrayFilter(request, CATEGORY.propertyName(), ResourceCategory.class));
criteria.addFilterIds(getArrayFilter(request, "resourceIds", Integer.class));
criteria.addFilterImplicitGroupIds(getFilter(request, "groupId", Integer.class));
criteria.addFilterName(getFilter(request, NAME.propertyName(), String.class));
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/browse/BrowseResourcesUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/browse/BrowseResourcesUIBean.java
index f927357..0d473a6 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/browse/BrowseResourcesUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/browse/BrowseResourcesUIBean.java
@@ -83,7 +83,7 @@ public class BrowseResourcesUIBean extends PagedDataTableUIBean {
ResourceCriteria criteria = new ResourceCriteria();
criteria.setPageControl(pc);
- criteria.addFilterResourceCategory(category);
+ criteria.addFilterResourceCategories(category);
if (search != null && !search.trim().equals("")) {
criteria.setSearchExpression(search);
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java
index 06fdfb0..32c6950 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java
@@ -846,7 +846,7 @@ public final class CriteriaQueryGenerator {
public static void testResourceCriteria() {
ResourceCriteria resourceCriteria = new ResourceCriteria();
- resourceCriteria.addFilterResourceCategory(ResourceCategory.SERVER);
+ resourceCriteria.addFilterResourceCategories(ResourceCategory.SERVER);
resourceCriteria.addFilterName("marques");
resourceCriteria.fetchAgent(true);
resourceCriteria.addSortResourceTypeName(PageOrdering.ASC);
commit 32e6e65b458760a74ae2a99be476a817ac6eee1f
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Wed Dec 15 14:15:54 2010 -0500
add more Javadoc to Trigger class
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/common/Trigger.java b/modules/core/domain/src/main/java/org/rhq/core/domain/common/Trigger.java
index 116ec06..6f6756c 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/common/Trigger.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/common/Trigger.java
@@ -34,7 +34,7 @@ public class Trigger {
// For the remaining fields in this class, only those that apply to the trigger's type will have non-null values.
private StartType startType;
private RecurrenceType recurrenceType;
- // Note, this field will be null when recurrenceType=NONE, since is not applicable in that case.
+ // Note, this field will be null when recurrenceType=NONE, since it's not applicable in that case.
private EndType endType;
// Fields used by startType=DATETIME triggers
@@ -51,19 +51,45 @@ public class Trigger {
private String cronExpression;
public enum StartType {
+ /**
+ * Start the initial run now.
+ */
NOW,
+ /**
+ * Start the initial run at a specified date-time in the future.
+ */
DATETIME;
}
public enum RecurrenceType {
+ /**
+ * No recurrence - just run once.
+ */
NONE,
+ /**
+ * Run every n seconds, starting at the start time of the initial run.
+ */
REPEAT_INTERVAL,
+ /**
+ * Run on a schedule based on the specified cron expression. The expression must follow
+ * <a href="http://www.quartz-scheduler.org/docs/tutorials/crontrigger.html">Quartz
+ * cron expression syntax</a>, which is a bit different than Unix cron expression syntax.
+ */
CRON_EXPRESSION;
}
public enum EndType {
+ /**
+ * No end - recurrence is indefinite.
+ */
NEVER,
+ /**
+ * End recurrence at a specified date/time in the future.
+ */
DATETIME,
+ /**
+ * End recurrence after n repetitions.
+ */
REPEAT_COUNT;
}
@@ -172,9 +198,11 @@ public class Trigger {
}
/**
- * Create a trigger that will run on the schedule specified by cron expression
+ * Create a trigger that will run on the schedule specified by a cron expression. The expression must follow
+ * <a href="http://www.quartz-scheduler.org/docs/tutorials/crontrigger.html">Quartz
+ * cron expression syntax</a>, which is a bit different than Unix cron expression syntax.
*
- * @return a trigger that will run on the schedule specified by cron expression
+ * @return a trigger that will run on the schedule specified by a cron expression
*/
public static Trigger createCronTrigger(String cronExpression) {
return new Trigger(cronExpression);
commit a871ff65733324da91e392b702e80ae9957614f2
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Wed Dec 15 13:57:28 2010 -0500
add new Trigger POJO to core-domain; extract base classes to be used by Resource and group Operations subtabs, as well as Recent Operations subsystem view; start on GWT-based Resource Operations>Schedule subtab
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/common/Trigger.java b/modules/core/domain/src/main/java/org/rhq/core/domain/common/Trigger.java
new file mode 100644
index 0000000..116ec06
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/common/Trigger.java
@@ -0,0 +1,251 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * 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.core.domain.common;
+
+import java.util.Date;
+
+/**
+ * Indicates when a particular job (e.g. invocation of an RHQ Agent plugin operation) should execute.
+ * Note, all constructors of this class are private - the create*Trigger() static factory methods
+ * must be used to create instances.
+ *
+ * @author Ian Springer
+ */
+public class Trigger {
+
+ // Together, the startType, recurrenceType, and endType define what type of trigger this is.
+ // For the remaining fields in this class, only those that apply to the trigger's type will have non-null values.
+ private StartType startType;
+ private RecurrenceType recurrenceType;
+ // Note, this field will be null when recurrenceType=NONE, since is not applicable in that case.
+ private EndType endType;
+
+ // Fields used by startType=DATETIME triggers
+ private Date startDate;
+
+ // Fields used by recurrenceType=REPEAT_INTERVAL triggers
+ private Long repeatInterval;
+ // endDate and repeatCount are mutually exclusive - only one can have a non-null value;
+ // if both are null, the repetition is indefinite.
+ private Date endDate;
+ private Integer repeatCount;
+
+ // Fields used by recurrenceType=CRON_EXPRESSION triggers
+ private String cronExpression;
+
+ public enum StartType {
+ NOW,
+ DATETIME;
+ }
+
+ public enum RecurrenceType {
+ NONE,
+ REPEAT_INTERVAL,
+ CRON_EXPRESSION;
+ }
+
+ public enum EndType {
+ NEVER,
+ DATETIME,
+ REPEAT_COUNT;
+ }
+
+ public StartType getStartType() {
+ return startType;
+ }
+
+ public EndType getEndType() {
+ return endType;
+ }
+
+ public RecurrenceType getRecurrenceType() {
+ return recurrenceType;
+ }
+
+ public Date getStartDate() {
+ return startDate;
+ }
+
+ public Long getRepeatInterval() {
+ return repeatInterval;
+ }
+
+ public String getCronExpression() {
+ return cronExpression;
+ }
+
+ public Date getEndDate() {
+ return endDate;
+ }
+
+ public Integer getRepeatCount() {
+ return repeatCount;
+ }
+
+ /**
+ * Create a trigger that will run now, once.
+ *
+ * @return a trigger that will run now, once
+ */
+ public static Trigger createNowTrigger() {
+ return new Trigger();
+ }
+
+ /**
+ * Create a trigger that will run now and repeat on interval indefinitely.
+ *
+ * @return a trigger that will run now and repeat on interval indefinitely
+ */
+ public static Trigger createNowAndRepeatTrigger(long repeatInterval) {
+ return new Trigger(repeatInterval);
+ }
+
+ /**
+ * Create a trigger that will run now and repeat on interval until end date/time.
+ *
+ * @return a trigger that will run now and repeat on interval until end date/time
+ */
+ public static Trigger createNowAndRepeatTrigger(long repeatInterval, Date endDate) {
+ return new Trigger(repeatInterval, endDate);
+ }
+
+ /**
+ * Create a trigger that will run now and repeat on interval n times.
+ *
+ * @return a trigger that will run now and repeat on interval n times
+ */
+ public static Trigger createNowAndRepeatTrigger(long repeatInterval, int repeatCount) {
+ return new Trigger(repeatInterval, repeatCount);
+ }
+
+ /**
+ * Create a trigger that will run at specified date/time, once.
+ *
+ * @return a trigger that will run at specified date/time, once
+ */
+ public static Trigger createLaterTrigger(Date startDate) {
+ return new Trigger(startDate);
+ }
+
+ /**
+ * Create a trigger that will run at specified date/time and then repeat on interval indefinitely.
+ *
+ * @return a trigger that will run at specified date/time and then repeat on interval indefinitely
+ */
+ public static Trigger createLaterAndRepeatTrigger(Date startDate, long repeatInterval) {
+ return new Trigger(startDate, repeatInterval);
+ }
+
+ /**
+ * Create a trigger that will run at specified date/time and then repeat on interval until end date/time.
+ *
+ * @return a trigger that will run at specified date/time and then repeat on interval until end date/time
+ */
+ public static Trigger createLaterAndRepeatTrigger(Date startDate, long repeatInterval, Date endDate) {
+ return new Trigger(startDate, repeatInterval, endDate);
+ }
+
+ /**
+ * Create a trigger that will run at specified date/time and then repeat on interval n times.
+ *
+ * @return a trigger that will run at specified date/time and then repeat on interval n times
+ */
+ public static Trigger createLaterAndRepeatTrigger(Date startDate, long repeatInterval, int repeatCount) {
+ return new Trigger(startDate, repeatInterval, repeatCount);
+ }
+
+ /**
+ * Create a trigger that will run on the schedule specified by cron expression
+ *
+ * @return a trigger that will run on the schedule specified by cron expression
+ */
+ public static Trigger createCronTrigger(String cronExpression) {
+ return new Trigger(cronExpression);
+ }
+
+
+ private Trigger(StartType startType, RecurrenceType recurrenceType, EndType endType) {
+ this.startType = startType;
+ this.recurrenceType = recurrenceType;
+ this.endType = endType;
+ }
+
+ // run now, once
+ private Trigger() {
+ this(StartType.NOW, RecurrenceType.NONE, null);
+ }
+
+ // run now and repeat on interval indefinitely
+ private Trigger(long repeatInterval) {
+ this(StartType.NOW, RecurrenceType.REPEAT_INTERVAL, EndType.REPEAT_COUNT);
+ this.repeatInterval = repeatInterval;
+ }
+
+ // run now and repeat on interval until end date/time
+ private Trigger(long repeatInterval, Date endDate) {
+ this(StartType.NOW, RecurrenceType.REPEAT_INTERVAL, EndType.DATETIME);
+ this.repeatInterval = repeatInterval;
+ this.endDate = endDate;
+ }
+
+ // run now and repeat on interval n times
+ private Trigger(long repeatInterval, int repeatCount) {
+ this(StartType.NOW, RecurrenceType.REPEAT_INTERVAL, EndType.REPEAT_COUNT);
+ this.repeatInterval = repeatInterval;
+ this.repeatCount = repeatCount;
+ }
+
+ // run at specified date/time, once
+ private Trigger(Date startDate) {
+ this(StartType.DATETIME, RecurrenceType.NONE, EndType.REPEAT_COUNT);
+ this.startDate = startDate;
+ this.repeatCount = 1;
+ }
+
+ // run at specified date/time and then repeat on interval indefinitely
+ private Trigger(Date startDate, long repeatInterval) {
+ this(StartType.DATETIME, RecurrenceType.REPEAT_INTERVAL, EndType.NEVER);
+ this.startDate = startDate;
+ this.repeatInterval = repeatInterval;
+ }
+
+ // run at specified date/time and then repeat on interval until end date/time
+ private Trigger(Date startDate, long repeatInterval, Date endDate) {
+ this(StartType.DATETIME, RecurrenceType.REPEAT_INTERVAL, EndType.DATETIME);
+ this.startDate = startDate;
+ this.repeatInterval = repeatInterval;
+ this.endDate = endDate;
+ }
+
+ // run at specified date/time and then repeat on interval n times
+ private Trigger(Date startDate, long repeatInterval, int repeatCount) {
+ this(StartType.DATETIME, RecurrenceType.REPEAT_INTERVAL, EndType.REPEAT_COUNT);
+ this.startDate = startDate;
+ this.repeatInterval = repeatInterval;
+ this.repeatCount = repeatCount;
+ }
+
+ // run on the schedule specified by cron expression
+ private Trigger(String cronExpression) {
+ this(StartType.NOW, RecurrenceType.CRON_EXPRESSION, EndType.NEVER);
+ this.cronExpression = cronExpression;
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
index eeb428b..92548b5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
@@ -26,7 +26,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import com.allen_sauer.gwt.log.client.Log;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.data.DSCallback;
import com.smartgwt.client.data.DSRequest;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/history/AbstractOperationHistoryListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/history/AbstractOperationHistoryListView.java
new file mode 100644
index 0000000..bc22921
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/history/AbstractOperationHistoryListView.java
@@ -0,0 +1,188 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.history;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.data.Record;
+import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.types.DateDisplayFormat;
+import com.smartgwt.client.types.ListGridFieldType;
+import com.smartgwt.client.types.Overflow;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.Window;
+import com.smartgwt.client.widgets.events.CloseClickHandler;
+import com.smartgwt.client.widgets.events.CloseClientEvent;
+import com.smartgwt.client.widgets.grid.CellFormatter;
+import com.smartgwt.client.widgets.grid.HoverCustomizer;
+import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
+import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
+
+import org.rhq.core.domain.operation.OperationRequestStatus;
+import org.rhq.enterprise.gui.coregui.client.ImageManager;
+import org.rhq.enterprise.gui.coregui.client.components.table.TableSection;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHTMLPane;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWindow;
+
+/**
+ * @author Greg Hinkle
+ * @author John Mazzitelli
+ */
+public abstract class AbstractOperationHistoryListView extends TableSection<OperationHistoryDataSource> {
+
+ private static final String HEADER_ICON = "subsystems/control/Operation_24.png";
+
+ public AbstractOperationHistoryListView(String locatorId, OperationHistoryDataSource dataSource, String title) {
+ super(locatorId, title);
+ setDataSource(dataSource);
+ setHeaderIcon(HEADER_ICON);
+ }
+
+ public AbstractOperationHistoryListView(String locatorId, OperationHistoryDataSource dataSource, String title,
+ Criteria criteria) {
+ super(locatorId, title, criteria);
+ setDataSource(dataSource);
+ }
+
+ @Override
+ protected void configureTable() {
+ super.configureTable();
+
+ List<ListGridField> fields = createFields();
+ setListGridFields(fields.toArray(new ListGridField[fields.size()]));
+ }
+
+ protected List<ListGridField> createFields() {
+ List<ListGridField> fields = new ArrayList<ListGridField>();
+
+ ListGridField idField = new ListGridField(OperationHistoryDataSource.Field.ID, MSG.common_title_id());
+ idField.setWidth(38);
+ fields.add(idField);
+
+ ListGridField opNameField = new ListGridField(OperationHistoryDataSource.Field.OPERATION_NAME,
+ MSG.dataSource_operationHistory_operationName());
+ opNameField.setWidth("34%");
+ fields.add(opNameField);
+
+ ListGridField subjectField = new ListGridField(OperationHistoryDataSource.Field.SUBJECT,
+ MSG.common_title_user());
+ subjectField.setWidth("33%");
+ fields.add(subjectField);
+
+ ListGridField statusField = new ListGridField(OperationHistoryDataSource.Field.STATUS,
+ MSG.common_title_status());
+ statusField.setAlign(Alignment.CENTER);
+ statusField.setCellAlign(Alignment.CENTER);
+ statusField.setShowHover(true);
+ statusField.setHoverCustomizer(new HoverCustomizer() {
+ @Override
+ public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
+ String statusStr = record.getAttribute(OperationHistoryDataSource.Field.STATUS);
+ OperationRequestStatus status = OperationRequestStatus.valueOf(statusStr);
+ switch (status) {
+ case SUCCESS: {
+ return MSG.common_status_success();
+ }
+ case FAILURE: {
+ return MSG.common_status_failed();
+ }
+ case INPROGRESS: {
+ return MSG.common_status_inprogress();
+ }
+ case CANCELED: {
+ return MSG.common_status_canceled();
+ }
+ }
+ return "unknown"; // should never get here
+ }
+ });
+ statusField.setCellFormatter(new CellFormatter() {
+ public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
+ OperationRequestStatus status = OperationRequestStatus.valueOf((String) o);
+ String icon = ImageManager.getOperationResultsIcon(status);
+ return Canvas.imgHTML(icon, 16, 16);
+ }
+ });
+ statusField.addRecordClickHandler(new RecordClickHandler() {
+ @Override
+ public void onRecordClick(RecordClickEvent event) {
+ Record record = event.getRecord();
+ String statusStr = record.getAttribute(OperationHistoryDataSource.Field.STATUS);
+ OperationRequestStatus status = OperationRequestStatus.valueOf(statusStr);
+ if (status == OperationRequestStatus.FAILURE) {
+ final Window winModal = new LocatableWindow(AbstractOperationHistoryListView.this
+ .extendLocatorId("statusDetailsWin"));
+ winModal.setTitle(MSG.common_title_details());
+ winModal.setOverflow(Overflow.VISIBLE);
+ winModal.setShowMinimizeButton(false);
+ winModal.setShowMaximizeButton(true);
+ winModal.setIsModal(true);
+ winModal.setShowModalMask(true);
+ winModal.setAutoSize(true);
+ winModal.setAutoCenter(true);
+ winModal.setShowResizer(true);
+ winModal.setCanDragResize(true);
+ winModal.centerInPage();
+ winModal.addCloseClickHandler(new CloseClickHandler() {
+ @Override
+ public void onCloseClick(CloseClientEvent event) {
+ winModal.markForDestroy();
+ }
+ });
+
+ LocatableHTMLPane htmlPane = new LocatableHTMLPane(AbstractOperationHistoryListView.this
+ .extendLocatorId("statusDetailsPane"));
+ htmlPane.setMargin(10);
+ htmlPane.setDefaultWidth(500);
+ htmlPane.setDefaultHeight(400);
+ String errorMsg = record.getAttribute(OperationHistoryDataSource.Field.ERROR_MESSAGE);
+ if (errorMsg == null) {
+ errorMsg = MSG.common_status_failed();
+ }
+ htmlPane.setContents("<pre>" + errorMsg + "</pre>");
+ winModal.addItem(htmlPane);
+ winModal.show();
+ }
+ }
+ });
+ statusField.setWidth(44);
+ fields.add(statusField);
+
+ ListGridField startedTimeField = new ListGridField(OperationHistoryDataSource.Field.STARTED_TIME,
+ MSG.dataSource_operationHistory_startedTime());
+ startedTimeField.setType(ListGridFieldType.DATE);
+ startedTimeField.setDateFormatter(DateDisplayFormat.TOLOCALESTRING);
+ startedTimeField.setAlign(Alignment.LEFT);
+ startedTimeField.setCellAlign(Alignment.LEFT);
+ startedTimeField.setWidth("33%");
+ fields.add(startedTimeField);
+
+ return fields;
+ }
+
+ @Override
+ protected String getDetailsLinkColumnName() {
+ return OperationHistoryDataSource.Field.OPERATION_NAME;
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/history/OperationHistoryDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/history/OperationHistoryDataSource.java
new file mode 100644
index 0000000..1152459
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/history/OperationHistoryDataSource.java
@@ -0,0 +1,117 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.history;
+
+import java.util.Date;
+import java.util.List;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.data.DataSourceField;
+import com.smartgwt.client.data.Record;
+import com.smartgwt.client.data.fields.DataSourceTextField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+import org.rhq.core.domain.criteria.ResourceOperationHistoryCriteria;
+import org.rhq.core.domain.operation.ResourceOperationHistory;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.gwt.OperationGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+
+/**
+ * @author Greg Hinkle
+ */
+public abstract class OperationHistoryDataSource extends RPCDataSource<ResourceOperationHistory> {
+
+ public static abstract class Field {
+ public static final String ID = "id";
+ public static final String OPERATION_NAME = "operationName";
+ public static final String RESOURCE = "resource";
+ public static final String STATUS = "status";
+ public static final String STARTED_TIME = "startedTime";
+ public static final String CREATED_TIME = "createdTime";
+ public static final String DURATION = "duration";
+ public static final String SUBJECT = "subject";
+ public static final String OPERATION_DEFINITION = "operationDefinition";
+ public static final String ERROR_MESSAGE = "errorMessage";
+ public static final String PARAMETERS = "parameters";
+ }
+
+ protected OperationGWTServiceAsync operationService = GWTServiceLookup.getOperationService();
+
+ public OperationHistoryDataSource() {
+ List<DataSourceField> fields = addDataSourceFields();
+ addFields(fields);
+ }
+
+ @Override
+ protected List<DataSourceField> addDataSourceFields() {
+ List<DataSourceField> fields = super.addDataSourceFields();
+
+ /*
+ DataSourceIntegerField idField = new DataSourceIntegerField(Field.ID);
+ idField.setPrimaryKey(true);
+ fields.add(idField);
+ */
+
+ DataSourceTextField nameField = new DataSourceTextField(Field.OPERATION_NAME);
+ fields.add(nameField);
+
+ /*
+ DataSourceTextField resourceField = new DataSourceTextField(Field.RESOURCE);
+ fields.add(resourceField);
+
+ DataSourceTextField statusField = new DataSourceTextField(Field.STATUS);
+ fields.add(statusField);
+
+ DataSourceTextField startedField = new DataSourceTextField(Field.STARTED_TIME);
+ startedField.setType(FieldType.DATETIME);
+ fields.add(startedField);
+ */
+
+ return fields;
+ }
+
+ @Override
+ public ResourceOperationHistory copyValues(Record from) {
+ throw new UnsupportedOperationException("ResourceOperationHistory is read only.");
+ }
+
+ @Override
+ public ListGridRecord copyValues(ResourceOperationHistory from) {
+ ListGridRecord record = new ListGridRecord();
+ record.setAttribute(Field.ID, from.getId());
+ record.setAttribute(Field.CREATED_TIME, from.getCreatedTime());
+ record.setAttribute(Field.STARTED_TIME, new Date(from.getStartedTime()));
+ record.setAttribute(Field.DURATION, from.getDuration());
+ record.setAttribute(Field.RESOURCE, from.getResource());
+ record.setAttribute(Field.SUBJECT, from.getSubjectName());
+ record.setAttribute(Field.OPERATION_DEFINITION, from.getOperationDefinition());
+ record.setAttribute(Field.OPERATION_NAME, from.getOperationDefinition().getDisplayName());
+ record.setAttribute(Field.ERROR_MESSAGE, from.getErrorMessage());
+ record.setAttribute(Field.STATUS, from.getStatus().name());
+ record.setAttribute(Field.PARAMETERS, from.getParameters());
+
+ return record;
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/history/ResourceOperationHistoryDetailsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/history/ResourceOperationHistoryDetailsView.java
new file mode 100644
index 0000000..208404f
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/history/ResourceOperationHistoryDetailsView.java
@@ -0,0 +1,259 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.history;
+
+import java.util.Date;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.types.Overflow;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.Window;
+import com.smartgwt.client.widgets.events.CloseClickHandler;
+import com.smartgwt.client.widgets.events.CloseClientEvent;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.LinkItem;
+import com.smartgwt.client.widgets.form.fields.StaticTextItem;
+import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
+import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
+
+import org.rhq.core.domain.criteria.ResourceOperationHistoryCriteria;
+import org.rhq.core.domain.operation.OperationDefinition;
+import org.rhq.core.domain.operation.OperationRequestStatus;
+import org.rhq.core.domain.operation.ResourceOperationHistory;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.ImageManager;
+import org.rhq.enterprise.gui.coregui.client.ViewPath;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHTMLPane;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWindow;
+
+/**
+ * @author Greg Hinkle
+ */
+public class ResourceOperationHistoryDetailsView extends LocatableVLayout implements BookmarkableView {
+
+ private OperationDefinition definition;
+ private ResourceOperationHistory operationHistory;
+
+ private DynamicForm form;
+
+ public ResourceOperationHistoryDetailsView(String locatorId) {
+ super(locatorId);
+ }
+
+ public ResourceOperationHistoryDetailsView(String locatorId, OperationDefinition definition,
+ ResourceOperationHistory operationHistory) {
+ super(locatorId);
+
+ this.definition = definition;
+ this.operationHistory = operationHistory;
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+ for (Canvas child : getMembers()) {
+ child.destroy();
+ }
+
+ if (this.operationHistory != null) {
+ displayDetails(operationHistory);
+ }
+ }
+
+ private void displayDetails(final ResourceOperationHistory operationHistory) {
+
+ for (Canvas child : getMembers()) {
+ removeChild(child);
+ }
+
+ this.definition = operationHistory.getOperationDefinition();
+ this.operationHistory = operationHistory;
+
+ // Information Form
+
+ form = new DynamicForm();
+ form.setWidth100();
+ form.setWrapItemTitles(false);
+
+ OperationRequestStatus status = operationHistory.getStatus();
+
+ StaticTextItem operationItem = new StaticTextItem(OperationHistoryDataSource.Field.OPERATION_NAME, MSG
+ .view_operationHistoryDetails_operation());
+ operationItem.setValue(definition.getDisplayName());
+
+ StaticTextItem submittedItem = new StaticTextItem(OperationHistoryDataSource.Field.STARTED_TIME, MSG
+ .view_operationHistoryDetails_dateSubmitted());
+ submittedItem.setValue(new Date(operationHistory.getStartedTime()));
+
+ StaticTextItem completedItem = new StaticTextItem("completed", MSG.view_operationHistoryDetails_dateCompleted());
+ if (status == OperationRequestStatus.INPROGRESS) {
+ completedItem.setValue(MSG.common_val_na());
+ } else if (status == OperationRequestStatus.CANCELED) {
+ completedItem.setValue(MSG.common_val_never());
+ } else {
+ completedItem.setValue(new Date(operationHistory.getStartedTime() + operationHistory.getDuration()));
+ }
+
+ StaticTextItem requesterItem = new StaticTextItem(OperationHistoryDataSource.Field.SUBJECT, MSG
+ .view_operationHistoryDetails_requestor());
+ requesterItem.setValue(operationHistory.getSubjectName());
+
+ LinkItem errorLinkItem = null;
+
+ StaticTextItem statusItem = new StaticTextItem(OperationHistoryDataSource.Field.STATUS, MSG
+ .view_operationHistoryDetails_status());
+ String icon = ImageManager.getFullImagePath(ImageManager.getOperationResultsIcon(status));
+ statusItem.setValue("<img src='" + icon + "'/>");
+ switch (status) {
+ case SUCCESS:
+ statusItem.setTooltip(MSG.common_status_success());
+ break;
+ case FAILURE:
+ statusItem.setTooltip(MSG.common_status_failed());
+ errorLinkItem = new LinkItem("errorLink");
+ errorLinkItem.setTitle(MSG.common_title_error());
+ errorLinkItem.setLinkTitle(getShortErrorMessage(operationHistory));
+ errorLinkItem.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ final Window winModal = new LocatableWindow(ResourceOperationHistoryDetailsView.this.extendLocatorId("errorWin"));
+ winModal.setTitle(MSG.common_title_details());
+ winModal.setOverflow(Overflow.VISIBLE);
+ winModal.setShowMinimizeButton(false);
+ winModal.setShowMaximizeButton(true);
+ winModal.setIsModal(true);
+ winModal.setShowModalMask(true);
+ winModal.setAutoSize(true);
+ winModal.setAutoCenter(true);
+ winModal.setShowResizer(true);
+ winModal.setCanDragResize(true);
+ winModal.centerInPage();
+ winModal.addCloseClickHandler(new CloseClickHandler() {
+ @Override
+ public void onCloseClick(CloseClientEvent event) {
+ winModal.markForDestroy();
+ }
+ });
+
+ LocatableHTMLPane htmlPane = new LocatableHTMLPane(ResourceOperationHistoryDetailsView.this
+ .extendLocatorId("statusDetailsPane"));
+ htmlPane.setMargin(10);
+ htmlPane.setDefaultWidth(500);
+ htmlPane.setDefaultHeight(400);
+ String errorMsg = operationHistory.getErrorMessage();
+ if (errorMsg == null) {
+ errorMsg = MSG.common_status_failed();
+ }
+ htmlPane.setContents("<pre>" + errorMsg + "</pre>");
+ winModal.addItem(htmlPane);
+ winModal.show();
+ }
+ });
+
+ break;
+ case INPROGRESS:
+ statusItem.setTooltip(MSG.common_status_inprogress());
+ break;
+ case CANCELED:
+ statusItem.setTooltip(MSG.common_status_canceled());
+ break;
+ }
+
+ /*
+ Operation: View Process List
+ Date Submitted: 3/11/10, 12:24:02 PM, EST
+ Date Completed: 3/11/10, 12:24:03 PM, EST
+ Requester: rhqadmin
+ Status: Failure
+ Error Message: __Exception: Cannot connect...__
+ */
+
+ if (errorLinkItem != null) {
+ form.setItems(operationItem, submittedItem, completedItem, requesterItem, statusItem, errorLinkItem);
+ } else {
+ form.setItems(operationItem, submittedItem, completedItem, requesterItem, statusItem);
+ }
+
+ addMember(form);
+
+ // params/results
+
+ if (operationHistory.getParameters() != null) {
+ ConfigurationEditor editor = new ConfigurationEditor(extendLocatorId("params"), definition
+ .getParametersConfigurationDefinition(), operationHistory.getParameters());
+ editor.setReadOnly(true);
+ editor.setStructuredConfigTabTitle(MSG.view_operationHistoryDetails_parameters());
+ addMember(editor);
+ }
+
+ if (status == OperationRequestStatus.SUCCESS && operationHistory.getResults() != null) {
+ ConfigurationEditor editor = new ConfigurationEditor(extendLocatorId("results"), definition
+ .getResultsConfigurationDefinition(), operationHistory.getResults());
+ editor.setReadOnly(true);
+ editor.setStructuredConfigTabTitle(MSG.view_operationHistoryDetails_results());
+ addMember(editor);
+ }
+ }
+
+ private void lookupDetails(int historyId) {
+ ResourceOperationHistoryCriteria criteria = new ResourceOperationHistoryCriteria();
+
+ criteria.addFilterId(historyId);
+
+ criteria.fetchOperationDefinition(true);
+ criteria.fetchParameters(true);
+ criteria.fetchResults(true);
+
+ GWTServiceLookup.getOperationService().findResourceOperationHistoriesByCriteria(criteria,
+ new AsyncCallback<PageList<ResourceOperationHistory>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler()
+ .handleError(MSG.view_operationHistoryDetails_error_fetchFailure(), caught);
+ }
+
+ public void onSuccess(PageList<ResourceOperationHistory> result) {
+ ResourceOperationHistory item = result.get(0);
+ displayDetails(item);
+ }
+ });
+ }
+
+ @Override
+ public void renderView(ViewPath viewPath) {
+ int historyId = viewPath.getCurrentAsInt();
+ lookupDetails(historyId);
+ }
+
+ private String getShortErrorMessage(ResourceOperationHistory operationHistory) {
+ String errMsg = operationHistory.getErrorMessage();
+ if (errMsg == null) {
+ errMsg = MSG.common_status_failed();
+ } else if (errMsg.length() > 80) {
+ errMsg = errMsg.substring(0, 80) + "...";
+ }
+ return errMsg;
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/ExecutionSchedule.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/ExecutionSchedule.java
new file mode 100644
index 0000000..26d53a8
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/ExecutionSchedule.java
@@ -0,0 +1,311 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.schedule;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.HashSet;
+
+import com.google.gwt.i18n.client.DateTimeFormat;
+
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.Messages;
+
+/**
+ * @author Greg Hinkle
+ */
+public class ExecutionSchedule implements Serializable {
+
+ private static final Messages MSG = CoreGUI.getMessages();
+
+ public enum Start {
+ Immediately, Future
+ };
+
+ public enum End {
+ Never, EndOn
+ };
+
+ public enum Recurr {
+ Once, EveryNMinutes, Hourly, Daily, Weekly, Monthly
+ };
+
+ public enum DayOfWeek {
+ Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday
+ };
+
+ private Start start = Start.Immediately;
+
+ // start.Future
+ private Recurr recurr = Recurr.Once;
+
+ // Once
+ private Date onceDateTime;
+
+
+ // EveryNMinutes
+ private Integer minuteInterval;
+
+
+ // Hourly
+ private Integer minuteInHour;
+
+
+ // Daily
+ private Date timeOfDay;
+
+
+ // Weekly
+ // Time of Day above
+ private HashSet<DayOfWeek> daysOfWeek; // Can't use EnumSet because it doesn't have default instantiator
+
+
+ // Monthly
+ // Time of Day above
+ private Integer dayOfMonth;
+
+
+ // Used for all start.Future except for once
+ private Date startDate;
+
+ private Date endDate;
+
+
+ public Start getStart() {
+ return start;
+ }
+
+ public void setStart(Start start) {
+ this.start = start;
+ }
+
+ public Recurr getRecurr() {
+ return recurr;
+ }
+
+ public void setRecurr(Recurr recurr) {
+ this.recurr = recurr;
+ }
+
+ public Date getOnceDateTime() {
+ return onceDateTime;
+ }
+
+ public void setOnceDateTime(Date onceDateTime) {
+ this.onceDateTime = onceDateTime;
+ }
+
+ public Integer getMinuteInterval() {
+ return minuteInterval;
+ }
+
+ public void setMinuteInterval(Integer minuteInterval) {
+ this.minuteInterval = minuteInterval;
+ }
+
+ public Integer getMinuteInHour() {
+ return minuteInHour;
+ }
+
+ public void setMinuteInHour(Integer minuteInHour) {
+ this.minuteInHour = minuteInHour;
+ }
+
+ public HashSet<DayOfWeek> getDaysOfWeek() {
+ return daysOfWeek;
+ }
+
+ public void setDaysOfWeek(HashSet<DayOfWeek> daysOfWeek) {
+ this.daysOfWeek = daysOfWeek;
+ }
+
+ public Integer getDayOfMonth() {
+ return dayOfMonth;
+ }
+
+ public void setDayOfMonth(Integer dayOfMonth) {
+ this.dayOfMonth = dayOfMonth;
+ }
+
+ public Date getStartDate() {
+ return startDate;
+ }
+
+ public void setStartDate(Date startDate) {
+ this.startDate = startDate;
+ }
+
+ public Date getEndDate() {
+ return endDate;
+ }
+
+ public void setEndDate(Date endDate) {
+ this.endDate = endDate;
+ }
+
+ public Date getTimeOfDay() {
+ return timeOfDay;
+ }
+
+ public void setTimeOfDay(Date timeOfDay) {
+ this.timeOfDay = timeOfDay;
+ }
+
+ public String getMessage() {
+ DateTimeFormat dateFormat = DateTimeFormat.getMediumDateFormat();
+ DateTimeFormat timeFormat = DateTimeFormat.getMediumTimeFormat();
+
+ String message;
+ switch (start) {
+
+ case Immediately:
+ message = MSG.view_operationCreateWizard_executionSchedule_willExecuteOnce(
+ MSG.view_operationCreateWizard_executionSchedule_immediately());
+ break;
+
+ case Future:
+ if (recurr == Recurr.Once) {
+ message = MSG.view_operationCreateWizard_executionSchedule_willExecuteOnce(
+ MSG.view_operationCreateWizard_executionSchedule_onceAtGivenTime(onceDateTime.toString()));
+ } else {
+ String recurrenceMessage;
+ switch (recurr) {
+ case EveryNMinutes:
+ recurrenceMessage = MSG.view_operationCreateWizard_executionSchedule_everyNMinutes(minuteInterval.toString());
+ break;
+ case Hourly:
+ recurrenceMessage = MSG.view_operationCreateWizard_executionSchedule_everyHourOnNthMinute(suffix(minuteInHour));
+ break;
+ case Daily:
+ recurrenceMessage = MSG.view_operationCreateWizard_executionSchedule_everyDayAtGivenTime(timeFormat.format(timeOfDay));
+ break;
+ case Weekly:
+ recurrenceMessage = MSG.view_operationCreateWizard_executionSchedule_everyWeekOnGivenDayAtGivenTime(daysOfWeek.toString(), timeFormat.format(timeOfDay));
+ break;
+ case Monthly:
+ recurrenceMessage = MSG.view_operationCreateWizard_executionSchedule_everyMonthOnNthDayAtGivenTime(suffix(dayOfMonth), timeFormat.format(timeOfDay));
+ break;
+ default:
+ recurrenceMessage = "";
+ }
+
+ if (endDate != null) {
+ message = MSG.view_operationCreateWizard_executionSchedule_willExecuteRecurringWithEnd(
+ recurrenceMessage, dateFormat.format(startDate), dateFormat.format(endDate));
+ } else {
+ message = MSG.view_operationCreateWizard_executionSchedule_willExecuteRecurring(
+ recurrenceMessage, dateFormat.format(startDate));
+ }
+ }
+ break;
+
+ default:
+ message = "";
+
+ }
+
+ return message;
+ }
+
+
+ public String getCronString() {
+
+ /* Cron fields
+ 1. Seconds
+ 2. Minutes
+ 3. Hours
+ 4. Day-of-Month
+ 5. Month
+ 6. Day-of-Week
+ 7. Year (optional field)
+ */
+
+ String cseconds, cminutes = null, chours = null, cdayOfMonth = null, cmonth = null, cdayOfWeek = null;
+
+ cseconds = "0";
+
+ switch (start) {
+
+ case Immediately:
+ return null; // No cron string for immediate execution
+
+ case Future:
+
+ if (recurr == Recurr.Once) {
+ return null; // No cron string for non recurring
+ } else {
+ switch (recurr) {
+ case EveryNMinutes:
+ cminutes = "0/" + minuteInterval;
+ chours = cdayOfMonth = cmonth = "*";
+ cdayOfWeek = "?";
+ break;
+ case Hourly:
+ cminutes = "" + minuteInHour;
+ chours = "*";
+ cdayOfMonth = cmonth = cdayOfWeek = "*";
+ break;
+ case Daily:
+ cminutes = "" + timeOfDay.getMinutes();
+ chours = "" + timeOfDay.getHours();
+ cdayOfMonth = cmonth = cdayOfWeek = "*";
+ break;
+ case Weekly:
+ cminutes = "" + timeOfDay.getMinutes();
+ chours = "" + timeOfDay.getHours();
+ cdayOfMonth = "?";
+ cmonth = "*";
+ cdayOfWeek = daysOfWeek.toString();
+ break;
+ case Monthly:
+ cminutes = "" + timeOfDay.getMinutes();
+ chours = "" + timeOfDay.getHours();
+ cdayOfMonth = "" + dayOfMonth;
+ cmonth = "*";
+ cdayOfWeek = "?";
+ break;
+ }
+ }
+ break;
+ }
+ return cseconds + " " + cminutes + " " + chours + " " + cdayOfMonth + " " + cmonth + " " + cdayOfWeek;
+
+ }
+
+ public static String suffix(int number) {
+ String result;
+ String numberAsString = String.valueOf(number);
+ int last = number % 10;
+ switch (last) {
+ case 1:
+ result = MSG.common_val_n1st(numberAsString);
+ break;
+ case 2:
+ result = MSG.common_val_n2nd(numberAsString);
+ break;
+ case 3:
+ result = MSG.common_val_n3rd(numberAsString);
+ break;
+ default:
+ result = MSG.common_val_nth(numberAsString);
+ }
+ return result;
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationCreateWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationCreateWizard.java
new file mode 100644
index 0000000..fc3c6f2
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationCreateWizard.java
@@ -0,0 +1,157 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.schedule;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.widgets.IButton;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.operation.OperationDefinition;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.AbstractWizard;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardView;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+
+/**
+ * @author Greg Hinkle
+ */
+public class OperationCreateWizard extends AbstractWizard {
+
+ private Resource resource;
+ private OperationDefinition operationDefinition;
+
+ private OperationParametersStep parametersStep;
+ private OperationSchedulingStep schedulingStep;
+
+ private WizardView view;
+
+ private IButton executeNowButton;
+ private IButton executeButton;
+
+ public OperationCreateWizard(Resource resource, OperationDefinition operationDefinition) {
+ this.resource = resource;
+ this.operationDefinition = operationDefinition;
+ }
+
+ public void startOperationWizard() {
+
+ parametersStep = new OperationParametersStep(operationDefinition);
+ schedulingStep = new OperationSchedulingStep();
+
+ ArrayList<WizardStep> steps = new ArrayList<WizardStep>();
+ steps.add(parametersStep);
+ steps.add(schedulingStep);
+ setSteps(steps);
+
+ executeNowButton = new IButton(MSG.view_operationCreateWizard_button_executeImmediately());
+ executeNowButton.setAutoFit(true);
+ executeNowButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ execute();
+ }
+ });
+
+ executeButton = new IButton(MSG.view_operationCreateWizard_button_execute());
+ executeButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ execute();
+ }
+ });
+
+ view = new WizardView(this);
+ view.displayDialog();
+ }
+
+ public String getWindowTitle() {
+ return MSG.view_operationCreateWizard_title();
+ }
+
+ public String getTitle() {
+ return MSG.view_operationCreateWizard_header(operationDefinition.getDisplayName(), resource.getName());
+ }
+
+ public String getSubtitle() {
+ return operationDefinition.getDescription();
+ }
+
+ public List<IButton> getCustomButtons(int step) {
+ switch (step) {
+ case 0:
+ return Arrays.asList(executeNowButton);
+ case 1:
+ return Arrays.asList(executeButton);
+ default:
+ return Collections.emptyList();
+ }
+ }
+
+ private void execute() {
+ Configuration parameters = parametersStep.getParameterConfiguration();
+ final ExecutionSchedule schedule = schedulingStep.getExecutionSchedule();
+
+ // TODO: get the description and timeout from user input
+ String description = "";
+ int timeout = 0;
+
+ AsyncCallback<Void> operationCallback = new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_operationCreateWizard_error_scheduleOperationFailure(),
+ caught);
+ }
+
+ public void onSuccess(Void result) {
+ String opName = operationDefinition.getDisplayName();
+ String cron = schedule.getCronString();
+ if (cron == null) {
+ cron = MSG.common_val_na();
+ }
+ String concise = MSG.view_operationCreateWizard_message_scheduleOperationSuccess_short(opName);
+ String message = MSG.view_operationCreateWizard_message_scheduleOperationSuccess(opName, String
+ .valueOf(resource.getId()), cron);
+
+ CoreGUI.getMessageCenter().notify(new Message(concise, message, Message.Severity.Info));
+ }
+ };
+
+ if (schedule.getStart() == ExecutionSchedule.Start.Immediately) {
+ GWTServiceLookup.getOperationService().invokeResourceOperation(resource.getId(),
+ operationDefinition.getName(), parameters, description, timeout, operationCallback);
+ } else {
+ GWTServiceLookup.getOperationService().scheduleResourceOperation(resource.getId(),
+ operationDefinition.getName(), parameters, description, timeout, schedule.getCronString(),
+ operationCallback);
+ }
+
+ view.closeDialog();
+ }
+
+ public void cancel() {
+ // TODO: revert back to original state
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationParametersStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationParametersStep.java
new file mode 100644
index 0000000..91fae90
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationParametersStep.java
@@ -0,0 +1,72 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.schedule;
+
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.HTMLFlow;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.operation.OperationDefinition;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.AbstractWizardStep;
+
+/**
+ * @author Greg Hinkle
+ */
+public class OperationParametersStep extends AbstractWizardStep {
+
+ private OperationDefinition definition;
+
+ private ConfigurationEditor configurationEditor;
+
+ public OperationParametersStep(OperationDefinition operationDefinition) {
+ super();
+ this.definition = operationDefinition;
+ }
+
+ public Canvas getCanvas() {
+ if (definition.getParametersConfigurationDefinition() != null) {
+ if (configurationEditor == null) {
+ ConfigurationDefinition configurationDefinition = definition.getParametersConfigurationDefinition();
+ Configuration defaultConfiguration = configurationDefinition.getDefaultTemplate() != null ? configurationDefinition
+ .getDefaultTemplate().createConfiguration()
+ : new Configuration();
+ configurationEditor = new ConfigurationEditor("OperationParams", configurationDefinition,
+ defaultConfiguration);
+ }
+ return configurationEditor;
+ } else {
+ return new HTMLFlow(MSG.view_operationCreateWizard_parametersStep_noParameters());
+ }
+ }
+
+ public boolean nextPage() {
+ return true; // TODO: Implement this method.
+ }
+
+ public String getName() {
+ return MSG.view_operationCreateWizard_parametersStep_name();
+ }
+
+ public Configuration getParameterConfiguration() {
+ return configurationEditor != null ? configurationEditor.getConfiguration() : null;
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationScheduleCompositeDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationScheduleCompositeDataSource.java
new file mode 100644
index 0000000..88df113
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationScheduleCompositeDataSource.java
@@ -0,0 +1,74 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.schedule;
+
+import java.util.List;
+
+import com.smartgwt.client.data.DataSourceField;
+import com.smartgwt.client.data.fields.DataSourceIntegerField;
+import com.smartgwt.client.data.fields.DataSourceTextField;
+
+import org.rhq.core.domain.operation.composite.OperationScheduleComposite;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.gwt.OperationGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+
+/**
+ * @author Ian Springer
+ */
+public abstract class OperationScheduleCompositeDataSource extends RPCDataSource<OperationScheduleComposite> {
+
+ public static abstract class Field {
+
+ public static final String OPERATION_JOB_ID = "operationJobId";
+ public static final String OPERATION_NAME = "operationName";
+ public static final String OPERATION_NEXT_FIRE_TIME = "operationNextFireTime";
+ }
+
+ protected OperationGWTServiceAsync operationService = GWTServiceLookup.getOperationService();
+
+ public OperationScheduleCompositeDataSource() {
+ super();
+ List<DataSourceField> fields = addDataSourceFields();
+ addFields(fields);
+ }
+
+ @Override
+ protected List<DataSourceField> addDataSourceFields() {
+ List<DataSourceField> fields = super.addDataSourceFields();
+
+ // TODO: i18n
+ DataSourceIntegerField idField = new DataSourceIntegerField(Field.OPERATION_JOB_ID, "ID");
+ idField.setPrimaryKey(true);
+ idField.setCanEdit(false);
+ fields.add(idField);
+
+ DataSourceTextField nameField = createTextField(Field.OPERATION_NAME, MSG.common_title_name(), 3, 100, true);
+ fields.add(nameField);
+
+ // TODO: i18n
+ DataSourceTextField nextFireTimeField = createTextField(Field.OPERATION_NEXT_FIRE_TIME, "Next Fire Time", null,
+ 100, false);
+ fields.add(nextFireTimeField);
+
+ return fields;
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationScheduleListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationScheduleListView.java
new file mode 100644
index 0000000..29d0136
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationScheduleListView.java
@@ -0,0 +1,77 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.schedule;
+
+import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
+import org.rhq.enterprise.gui.coregui.client.components.table.TableSection;
+
+/**
+ * @author Ian Springer
+ */
+public abstract class OperationScheduleListView extends TableSection<OperationScheduleCompositeDataSource> {
+
+ private static final String HEADER_ICON = "subsystems/control/Operation_24.png";
+
+ public OperationScheduleListView(String locatorId, OperationScheduleCompositeDataSource dataSource, String title) {
+ super(locatorId, title);
+
+ setDataSource(dataSource);
+ setHeaderIcon(HEADER_ICON);
+ }
+
+ protected abstract boolean hasControlPermission();
+
+ @Override
+ protected void configureTable() {
+ super.configureTable();
+
+ ListGridField nameField = new ListGridField(OperationScheduleCompositeDataSource.Field.OPERATION_NAME, 150);
+
+ ListGridField nextFireTimeField = new ListGridField(OperationScheduleCompositeDataSource.Field.OPERATION_NEXT_FIRE_TIME);
+
+ setListGridFields(nameField, nextFireTimeField);
+
+ addTableAction(extendLocatorId("New"), MSG.common_button_new(), new TableAction() {
+ public boolean isEnabled(ListGridRecord[] selection) {
+ return hasControlPermission();
+ }
+
+ public void executeAction(ListGridRecord[] selection, Object actionValue) {
+ // TODO: wizard or details view
+ }
+ });
+
+ addTableAction(extendLocatorId("Unschedule"), MSG.common_button_delete(), getDeleteConfirmMessage(),
+ new TableAction() {
+ public boolean isEnabled(ListGridRecord[] selection) {
+ int count = selection.length;
+ return ((count >= 1) && hasControlPermission());
+ }
+
+ public void executeAction(ListGridRecord[] selection, Object actionValue) {
+ // TODO: unschedule the selected schedule items
+ }
+ });
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationSchedulingStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationSchedulingStep.java
new file mode 100644
index 0000000..ec0e40f
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/OperationSchedulingStep.java
@@ -0,0 +1,418 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.schedule;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.EnumSet;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+
+import com.smartgwt.client.types.FormErrorOrientation;
+import com.smartgwt.client.types.TimeFormatter;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.FormItemIfFunction;
+import com.smartgwt.client.widgets.form.ValuesManager;
+import com.smartgwt.client.widgets.form.events.ItemChangedEvent;
+import com.smartgwt.client.widgets.form.events.ItemChangedHandler;
+import com.smartgwt.client.widgets.form.fields.CanvasItem;
+import com.smartgwt.client.widgets.form.fields.CheckboxItem;
+import com.smartgwt.client.widgets.form.fields.DateItem;
+import com.smartgwt.client.widgets.form.fields.FormItem;
+import com.smartgwt.client.widgets.form.fields.HeaderItem;
+import com.smartgwt.client.widgets.form.fields.IntegerItem;
+import com.smartgwt.client.widgets.form.fields.RadioGroupItem;
+import com.smartgwt.client.widgets.form.fields.SpacerItem;
+import com.smartgwt.client.widgets.form.fields.StaticTextItem;
+import com.smartgwt.client.widgets.form.fields.TimeItem;
+import com.smartgwt.client.widgets.form.validator.CustomValidator;
+
+import org.rhq.enterprise.gui.coregui.client.components.wizard.AbstractWizardStep;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
+
+/**
+ * @author Greg Hinkle
+ */
+public class OperationSchedulingStep extends AbstractWizardStep implements ItemChangedHandler {
+
+ private DynamicForm form;
+ private ValuesManager valuesManager;
+
+ private ExecutionSchedule executionSchedule = new ExecutionSchedule();
+
+ public Canvas getCanvas() {
+
+ if (form == null) {
+ valuesManager = new ValuesManager();
+ form = new LocatableDynamicForm("OperationScheduling");
+ form.setValuesManager(valuesManager);
+ form.setWrapItemTitles(false);
+ form.setErrorOrientation(FormErrorOrientation.RIGHT);
+ form.setWidth100();
+ form.setPadding(10);
+ form.setNumCols(3);
+ // form.setColWidths("15%", "35%", "15%", "*");
+ form.setValidateOnChange(true);
+
+ final RadioGroupItem start = new RadioGroupItem("start",
+ MSG.view_operationCreateWizard_schedulingStep_name());
+ start.setColSpan(3);
+ start.setValueMap(enumValueMap(ExecutionSchedule.Start.class)); // "Immediately", "Future"
+ start.setRedrawOnChange(true);
+ start.setValue("Immediately");
+
+ HeaderItem scheduleHeader = new HeaderItem("scheduleHeader");
+ scheduleHeader.setValue(MSG.view_operationCreateWizard_schedulingStep_label_schedule());
+ scheduleHeader.setShowIfCondition(new FormItemIfFunction() {
+ public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
+ return !"Immediately".equals(form.getValueAsString("start"));
+ }
+ });
+
+ RadioGroupItem recurr = new RadioGroupItem("recurr",
+ MSG.view_operationCreateWizard_schedulingStep_label_recurrence());
+ recurr.setValueMap(enumValueMap(ExecutionSchedule.Recurr.class)); // "Once", "EveryNMinutes", "Hourly", "Daily", "Weekly", "Monthly");
+ recurr.setRedrawOnChange(true);
+ recurr.setValue(ExecutionSchedule.Recurr.Once.name());
+ recurr.setShowIfCondition(new FormItemIfFunction() {
+ public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
+ return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"));
+ }
+ });
+
+ CanvasItem onceForm = new CanvasItem("once", MSG.view_operationCreateWizard_schedulingStep_label_onceAt());
+ onceForm.setShowTitle(false);
+ onceForm.setCanvas(getOnceForm());
+ onceForm.setShowIfCondition(new FormItemIfFunction() {
+ public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
+ return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"))
+ && ExecutionSchedule.Recurr.Once.name().equals(form.getValueAsString("recurr"));
+ }
+ });
+
+ CanvasItem everyNMinuteForm = new CanvasItem("everyNMinutesForm",
+ MSG.view_operationCreateWizard_schedulingStep_label_everyNMinutes());
+ everyNMinuteForm.setShowTitle(false);
+ everyNMinuteForm.setCanvas(getEveryNMinutesForm());
+ everyNMinuteForm.setShowIfCondition(new FormItemIfFunction() {
+ public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
+ return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"))
+ && ExecutionSchedule.Recurr.EveryNMinutes.name().equals(form.getValueAsString("recurr"));
+ }
+ });
+
+ CanvasItem hourlyForm = new CanvasItem("hourlyForm", MSG.view_operationCreateWizard_schedulingStep_label_hourly());
+ hourlyForm.setShowTitle(false);
+ hourlyForm.setCanvas(getHourlyForm());
+ hourlyForm.setShowIfCondition(new FormItemIfFunction() {
+ public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
+ return !"Immediately".equals(form.getValueAsString("start"))
+ && ExecutionSchedule.Recurr.Hourly.name().equals(form.getValueAsString("recurr"));
+ }
+ });
+
+ CanvasItem dailyForm = new CanvasItem("daily", MSG.view_operationCreateWizard_schedulingStep_label_daily());
+ dailyForm.setShowTitle(false);
+ dailyForm.setCanvas(getDailyForm());
+ dailyForm.setShowIfCondition(new FormItemIfFunction() {
+ public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
+ return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"))
+ && ExecutionSchedule.Recurr.Daily.name().equals(form.getValueAsString("recurr"));
+ }
+ });
+
+ CanvasItem weeklyForm = new CanvasItem("weekly", MSG.view_operationCreateWizard_schedulingStep_label_weekly());
+ weeklyForm.setShowTitle(false);
+ weeklyForm.setCanvas(getWeeklyForm());
+ weeklyForm.setShowIfCondition(new FormItemIfFunction() {
+ public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
+ return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"))
+ && ExecutionSchedule.Recurr.Weekly.name().equals(form.getValueAsString("recurr"));
+ }
+ });
+
+ CanvasItem monthlyForm = new CanvasItem("monthly", MSG.view_operationCreateWizard_schedulingStep_label_monthly());
+ monthlyForm.setShowTitle(false);
+ monthlyForm.setCanvas(getMonthlyForm());
+ monthlyForm.setShowIfCondition(new FormItemIfFunction() {
+ public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
+ return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"))
+ && ExecutionSchedule.Recurr.Monthly.name().equals(form.getValueAsString("recurr"));
+ }
+ });
+
+ HeaderItem rangeHeader = new HeaderItem("timePeriod");
+ rangeHeader.setValue(MSG.view_operationCreateWizard_schedulingStep_label_timePeriod());
+ rangeHeader.setShowIfCondition(new FormItemIfFunction() {
+ public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
+ return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"))
+ && !ExecutionSchedule.Recurr.Once.name().equals(form.getValueAsString("recurr"));
+ }
+ });
+
+ DateItem startDate = new DateItem("startDate", MSG.view_operationCreateWizard_schedulingStep_label_startDate());
+ startDate.setStartRow(true);
+ startDate.setStartDate(new Date());
+ startDate.setShowIfCondition(new FormItemIfFunction() {
+ public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
+ return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"))
+ && !"Once".equals(form.getValueAsString("recurr"));
+ }
+ });
+
+ final RadioGroupItem end = new RadioGroupItem("endType", MSG.view_operationCreateWizard_schedulingStep_label_endDate());
+ end.setShowIfCondition(new FormItemIfFunction() {
+ public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
+ return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"))
+ && !"Once".equals(form.getValueAsString("recurr"));
+ }
+ });
+ end.setStartRow(true);
+ // TODO: i18n
+ end.setValueMap("Never", "End On");
+ end.setRedrawOnChange(true);
+ end.setValue("Never");
+
+ DateItem endDate = new DateItem("endDate", MSG.view_operationCreateWizard_schedulingStep_label_endDate());
+ endDate.setStartRow(true);
+ endDate.setStartDate(new Date());
+ endDate.setShowIfCondition(new FormItemIfFunction() {
+ public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
+ return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"))
+ && !"Once".equals(form.getValueAsString("recurr"))
+ && !"Never".equals(form.getValueAsString("endType"));
+ }
+ });
+ endDate.setValidators(new CustomValidator() {
+ @Override
+ protected boolean condition(Object o) {
+ return (((Date) form.getValue("startDate")).before((Date) o));
+ }
+ });
+
+ StaticTextItem messageItem = new StaticTextItem("message");
+ messageItem.setValue(MSG.view_operationCreateWizard_schedulingStep_label_willExecuteImmediately());
+ messageItem.setStartRow(true);
+ messageItem.setColSpan(3);
+ messageItem.setShowTitle(false);
+ messageItem.setCellStyle("HeaderLabel");
+
+ form.setItems(start, scheduleHeader, recurr, onceForm, everyNMinuteForm, hourlyForm, dailyForm, weeklyForm,
+ monthlyForm, rangeHeader, startDate, end, endDate, new SpacerItem(), messageItem);
+
+ form.addItemChangedHandler(this);
+ }
+
+ return form;
+ }
+
+ private DynamicForm getOnceForm() {
+ DynamicForm form = new DynamicForm();
+ form.setValuesManager(valuesManager);
+ form.setPadding(10);
+ form.setIsGroup(true);
+ form.setGroupTitle(MSG.view_operationCreateWizard_schedulingStep_label_onceAt());
+ form.addItemChangedHandler(this);
+
+ form.setWrapItemTitles(false);
+ form.setNumCols(2);
+
+ DateItem startDate = new DateItem("onceStartDate", MSG.view_operationCreateWizard_schedulingStep_label_startDate());
+ startDate.setValue(new Date());
+
+ TimeItem startTime = new TimeItem("onceStartDate", MSG.view_operationCreateWizard_schedulingStep_label_startDate());
+ startTime.setValue(new Date());
+ startTime.setDisplayFormat(TimeFormatter.TOSHORTPADDEDTIME);
+ startTime.setUseMask(true);
+ form.setItems(startDate, startTime);
+ return form;
+ }
+
+ private DynamicForm getEveryNMinutesForm() {
+ DynamicForm form = new DynamicForm();
+ form.setValuesManager(valuesManager);
+ form.setPadding(10);
+ form.setIsGroup(true);
+ form.setGroupTitle(MSG.view_operationCreateWizard_schedulingStep_label_everyNMinutes());
+ form.addItemChangedHandler(this);
+
+ form.setWrapItemTitles(false);
+ form.setNumCols(2);
+
+ IntegerItem everyNMinutes = new IntegerItem();
+ everyNMinutes.setName("minuteInterval");
+ everyNMinutes.setTitle(MSG.view_operationCreateWizard_schedulingStep_label_minuteInterval());
+ everyNMinutes.setValue(60);
+
+ form.setItems(everyNMinutes);
+ return form;
+ }
+
+ private DynamicForm getHourlyForm() {
+ DynamicForm form = new DynamicForm();
+ form.setValuesManager(valuesManager);
+ form.setPadding(10);
+ form.setIsGroup(true);
+ form.setGroupTitle(MSG.view_operationCreateWizard_schedulingStep_label_hourly());
+ form.addItemChangedHandler(this);
+
+ form.setWrapItemTitles(false);
+ form.setNumCols(2);
+
+ IntegerItem minuteOfHour = new IntegerItem();
+ minuteOfHour.setName("minuteOfHour");
+ minuteOfHour.setTitle(MSG.view_operationCreateWizard_schedulingStep_label_minuteOfHour());
+ minuteOfHour.setValue(5);
+
+ form.setItems(minuteOfHour);
+ return form;
+ }
+
+ private DynamicForm getDailyForm() {
+ DynamicForm form = new DynamicForm();
+ form.setValuesManager(valuesManager);
+ form.setPadding(10);
+ form.setWrapItemTitles(false);
+ form.setIsGroup(true);
+ form.setGroupTitle(MSG.view_operationCreateWizard_schedulingStep_label_daily());
+ form.addItemChangedHandler(this);
+
+ TimeItem timeOfDay = new TimeItem("timeOfDay", MSG.view_operationCreateWizard_schedulingStep_label_timeOfDay());
+ timeOfDay.setValue(new Date());
+ timeOfDay.setDisplayFormat(TimeFormatter.TOSHORTPADDEDTIME);
+ timeOfDay.setUseMask(true);
+
+ form.setItems(timeOfDay);
+ return form;
+ }
+
+ private DynamicForm getWeeklyForm() {
+ DynamicForm form = new DynamicForm();
+ form.setValuesManager(valuesManager);
+ form.setPadding(10);
+ form.setIsGroup(true);
+ form.setGroupTitle(MSG.view_operationCreateWizard_schedulingStep_label_weekly());
+ form.addItemChangedHandler(this);
+
+ form.setWrapItemTitles(false);
+
+ TimeItem timeOfDay = new TimeItem("dayOfWeek", MSG.view_operationCreateWizard_schedulingStep_label_dayOfWeek());
+ timeOfDay.setValue(new Date());
+ timeOfDay.setDisplayFormat(TimeFormatter.TOSHORTPADDEDTIME);
+ timeOfDay.setUseMask(true);
+
+ ExecutionSchedule.DayOfWeek[] daysOfWeek = ExecutionSchedule.DayOfWeek.values();
+ List<String> dayList = new ArrayList<String>();
+ for (ExecutionSchedule.DayOfWeek dayOfWeek : daysOfWeek) {
+ dayList.add(dayOfWeek.name());
+ }
+ FormItem[] items = new FormItem[8];
+ items[0] = timeOfDay;
+ int i = 1;
+ for (String day : dayList) {
+ CheckboxItem dayItem = new CheckboxItem(day);
+ dayItem.setShowTitle(false);
+ items[i++] = dayItem;
+ }
+ form.setItems(items);
+ return form;
+ }
+
+ private DynamicForm getMonthlyForm() {
+ DynamicForm form = new DynamicForm();
+ form.setValuesManager(valuesManager);
+ form.setPadding(10);
+ form.setWrapItemTitles(false);
+ form.setIsGroup(true);
+ form.setGroupTitle(MSG.view_operationCreateWizard_schedulingStep_label_monthly());
+ form.addItemChangedHandler(this);
+
+ IntegerItem dayItem = new IntegerItem();
+ dayItem.setName("dayOfMonth");
+ dayItem.setTitle(MSG.view_operationCreateWizard_schedulingStep_label_dayOfMonth());
+ dayItem.setValue(1);
+
+ TimeItem timeOfDay = new TimeItem("timeOfDay", MSG.view_operationCreateWizard_schedulingStep_label_timeOfDay());
+ timeOfDay.setValue(new Date());
+ timeOfDay.setDisplayFormat(TimeFormatter.TOSHORTPADDEDTIME);
+ timeOfDay.setUseMask(true);
+
+ form.setItems(dayItem, timeOfDay);
+ return form;
+ }
+
+ public boolean nextPage() {
+ return true; // TODO: Implement this method.
+ }
+
+ public String getName() {
+ return MSG.view_operationCreateWizard_schedulingStep_name();
+ }
+
+ public void onItemChanged(ItemChangedEvent itemChangeEvent) {
+
+ executionSchedule.setStart(ExecutionSchedule.Start.valueOf(valuesManager.getValueAsString("start")));
+ executionSchedule.setRecurr(ExecutionSchedule.Recurr.valueOf(valuesManager.getValueAsString("recurr")));
+
+ Date onceDate = (Date) valuesManager.getValues().get("onceStartDate");
+ executionSchedule.setOnceDateTime(onceDate);
+
+ executionSchedule.setMinuteInterval(Integer.parseInt(valuesManager.getValueAsString("minuteInterval")));
+
+ executionSchedule.setMinuteInHour(Integer.parseInt(valuesManager.getValueAsString("minuteOfHour")));
+
+ executionSchedule.setTimeOfDay((Date) valuesManager.getValues().get("timeOfDay"));
+
+ HashSet<ExecutionSchedule.DayOfWeek> selectedDays = new HashSet<ExecutionSchedule.DayOfWeek>(); //.noneOf(ExecutionSchedule.DayOfWeek.class);
+ for (ExecutionSchedule.DayOfWeek d : EnumSet.allOf(ExecutionSchedule.DayOfWeek.class)) {
+ if (valuesManager.getValues().containsKey(d.name())) {
+ selectedDays.add(d);
+ }
+ }
+ executionSchedule.setDaysOfWeek(selectedDays);
+
+ executionSchedule.setDayOfMonth(Integer.parseInt(valuesManager.getValueAsString("dayOfMonth")));
+
+ executionSchedule.setStartDate((Date) valuesManager.getValues().get("startDate"));
+
+ if ("Never".equals(valuesManager.getValues().get("endType"))) {
+ executionSchedule.setEndDate(null);
+ } else {
+ executionSchedule.setEndDate((Date) valuesManager.getValues().get("endDate"));
+ }
+
+ form.setValue("message", executionSchedule.getMessage());
+ }
+
+ private LinkedHashMap<String, String> enumValueMap(Class<? extends Enum> e) {
+ LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
+ for (Object o : EnumSet.allOf(e)) {
+ Enum v = (Enum) o;
+ map.put(v.name(), v.name()); // localize
+ }
+ return map;
+ }
+
+ public ExecutionSchedule getExecutionSchedule() {
+ return executionSchedule;
+ }
+
+}
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 1d1c754..9cd3ded 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
@@ -58,11 +58,10 @@ import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.inventory.M
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.monitoring.schedules.SchedulesView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.monitoring.traits.TraitsView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.summary.ActivityView;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSearchView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
/**
- * Right panel of the Resource view (#ResourceGroup/*).
+ * Right panel of the Resource Group view (#ResourceGroup/*).
*
* @author Jay Shaughnessy
* @author Ian Springer
@@ -94,8 +93,8 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
private SubTab inventoryMembers;
private SubTab inventoryConn;
private SubTab inventoryConnHistory;
- private SubTab opHistory;
- private SubTab opSched;
+ private SubTab operationsHistory;
+ private SubTab operationsSchedule;
private SubTab alertHistory;
private SubTab alertDef;
private SubTab configCurrent;
@@ -198,11 +197,11 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
operationsTab = new TwoLevelTab(getTabSet().extendLocatorId("Operations"), new ViewName("Operations", MSG
.view_tabs_common_operations()), "/images/icons/Operation_grey_16.png");
- this.opHistory = new SubTab(operationsTab.extendLocatorId("History"), new ViewName("History", MSG
+ this.operationsSchedule = new SubTab(operationsTab.extendLocatorId("Schedule"), new ViewName("Schedule", MSG
+ .view_tabs_common_schedule()), null);
+ this.operationsHistory = new SubTab(operationsTab.extendLocatorId("History"), new ViewName("History", MSG
.view_tabs_common_history()), null);
- this.opSched = new SubTab(operationsTab.extendLocatorId("Scheduled"), new ViewName("Scheduled", MSG
- .view_tabs_common_scheduled()), null);
- operationsTab.registerSubTabs(this.opHistory, this.opSched);
+ operationsTab.registerSubTabs(this.operationsHistory, this.operationsSchedule);
tabs.add(operationsTab);
configurationTab = new TwoLevelTab(getTabSet().extendLocatorId("Configuration"), new ViewName("Configuration",
@@ -296,10 +295,10 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
private void updateOperationsTab(int groupId, GroupCategory groupCategory, Set<ResourceTypeFacet> facets) {
if (updateTab(this.operationsTab, groupCategory == GroupCategory.COMPATIBLE
&& facets.contains(ResourceTypeFacet.OPERATION), true)) {
- updateSubTab(this.operationsTab, this.opHistory, new FullHTMLPane(this.opHistory.extendLocatorId("View"),
- "/rhq/group/operation/groupOperationHistory-plain.xhtml?groupId=" + groupId), true, true);
- updateSubTab(this.operationsTab, this.opSched, new FullHTMLPane(this.opSched.extendLocatorId("View"),
+ updateSubTab(this.operationsTab, this.operationsSchedule, new FullHTMLPane(this.operationsSchedule.extendLocatorId("View"),
"/rhq/group/operation/groupOperationSchedules-plain.xhtml?groupId=" + groupId), true, true);
+ updateSubTab(this.operationsTab, this.operationsHistory, new FullHTMLPane(this.operationsHistory.extendLocatorId("View"),
+ "/rhq/group/operation/groupOperationHistory-plain.xhtml?groupId=" + groupId), true, true);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/NewResourceTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/NewResourceTreeView.java
index 93803a5..e957d7d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/NewResourceTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/NewResourceTreeView.java
@@ -66,7 +66,7 @@ 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.gwt.ResourceTypeGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.create.OperationCreateWizard;
+import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.schedule.OperationCreateWizard;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.factory.ResourceFactoryCreateWizard;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
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 5fab7c4..de120f5 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
@@ -60,7 +60,7 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory.ResourceResourceAgentView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.schedules.SchedulesView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.traits.TraitsView;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.OperationHistoryView;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.history.ResourceOperationHistoryListView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary.ActivityView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
@@ -72,6 +72,7 @@ import org.rhq.enterprise.gui.coregui.client.util.message.Message;
* @author Ian Springer
*/
public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceComposite, ResourceTitleBar> {
+
private static final String BASE_VIEW_PATH = "Resource";
private Integer resourceId;
@@ -103,8 +104,8 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
private SubTab inventoryConnHistory;
private SubTab inventoryGroups;
private SubTab inventoryAgent;
- private SubTab opHistory;
- private SubTab opSched;
+ private SubTab operationsHistory;
+ private SubTab operationsSchedule;
private SubTab alertHistory;
private SubTab alertDef;
private SubTab configCurrent;
@@ -186,11 +187,11 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
operationsTab = new TwoLevelTab(getTabSet().extendLocatorId("Operations"), new ViewName("Operations", MSG
.view_tabs_common_operations()), "/images/icons/Operation_grey_16.png");
- this.opHistory = new SubTab(operationsTab.extendLocatorId("History"), new ViewName("History", MSG
+ this.operationsSchedule = new SubTab(operationsTab.extendLocatorId("Schedule"), new ViewName("Schedule", MSG
+ .view_tabs_common_schedule()), null);
+ this.operationsHistory = new SubTab(operationsTab.extendLocatorId("History"), new ViewName("History", MSG
.view_tabs_common_history()), null);
- this.opSched = new SubTab(operationsTab.extendLocatorId("Scheduled"), new ViewName("Scheduled", MSG
- .view_tabs_common_scheduled()), null);
- operationsTab.registerSubTabs(this.opHistory, this.opSched);
+ operationsTab.registerSubTabs(this.operationsHistory, this.operationsSchedule);
tabs.add(operationsTab);
configurationTab = new TwoLevelTab(getTabSet().extendLocatorId("Configuration"), new ViewName("Configuration",
@@ -341,10 +342,10 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
// 3) operation arguments/results become read-only configuration data in the history details pop-up
// 4) user can navigate to the group operation that spawned this resource operation history, if appropriate
// note: enabled operation execution/schedules from left-nav, if it doesn't already exist
- updateSubTab(this.operationsTab, this.opHistory, OperationHistoryView.getResourceHistoryView(operationsTab
+ updateSubTab(this.operationsTab, this.operationsHistory, new ResourceOperationHistoryListView(operationsTab
.extendLocatorId("HistoryView"), this.resourceComposite), true, true);
- updateSubTab(this.operationsTab, this.opSched, new FullHTMLPane(this.opSched.extendLocatorId("View"),
+ updateSubTab(this.operationsTab, this.operationsSchedule, new FullHTMLPane(this.operationsSchedule.extendLocatorId("View"),
"/rhq/resource/operation/resourceOperationSchedules-plain.xhtml?id=" + resource.getId()), true, true);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
index 35c6c21..dcbfaea 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
@@ -82,7 +82,7 @@ import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.ResourceGro
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.ResourceGroupDetailView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceTreeDatasource.AutoGroupTreeNode;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceTreeDatasource.ResourceTreeNode;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.create.OperationCreateWizard;
+import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.schedule.OperationCreateWizard;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.factory.ResourceFactoryCreateWizard;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.factory.ResourceFactoryImportWizard;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryDataSource.java
deleted file mode 100644
index a41e68a..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryDataSource.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation;
-
-import java.util.Date;
-import java.util.List;
-
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.data.DSRequest;
-import com.smartgwt.client.data.DSResponse;
-import com.smartgwt.client.data.DataSourceField;
-import com.smartgwt.client.data.Record;
-import com.smartgwt.client.data.fields.DataSourceTextField;
-import com.smartgwt.client.widgets.grid.ListGridRecord;
-
-import org.rhq.core.domain.criteria.ResourceOperationHistoryCriteria;
-import org.rhq.core.domain.operation.ResourceOperationHistory;
-import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.gwt.OperationGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
-
-/**
- * @author Greg Hinkle
- */
-public class OperationHistoryDataSource extends RPCDataSource<ResourceOperationHistory> {
-
- public static abstract class Field {
- public static final String ID = "id";
- public static final String OPERATION_NAME = "operationName";
- public static final String RESOURCE = "resource";
- public static final String STATUS = "status";
- public static final String STARTED_TIME = "startedTime";
- public static final String CREATED_TIME = "createdTime";
- public static final String DURATION = "duration";
- public static final String SUBJECT = "subject";
- public static final String OPERATION_DEFINITION = "operationDefinition";
- public static final String ERROR_MESSAGE = "errorMessage";
- public static final String PARAMETERS = "parameters";
- }
-
- public static abstract class CriteriaField {
- public static final String RESOURCE_ID = "resourceId";
- }
-
- private OperationGWTServiceAsync operationService = GWTServiceLookup.getOperationService();
-
- public OperationHistoryDataSource() {
- List<DataSourceField> fields = addDataSourceFields();
- addFields(fields);
- }
-
- @Override
- protected List<DataSourceField> addDataSourceFields() {
- List<DataSourceField> fields = super.addDataSourceFields();
-
- /*
- DataSourceIntegerField idField = new DataSourceIntegerField(Field.ID);
- idField.setPrimaryKey(true);
- fields.add(idField);
- */
-
- DataSourceTextField nameField = new DataSourceTextField(Field.OPERATION_NAME);
- fields.add(nameField);
-
- /*
- DataSourceTextField resourceField = new DataSourceTextField(Field.RESOURCE);
- fields.add(resourceField);
-
- DataSourceTextField statusField = new DataSourceTextField(Field.STATUS);
- fields.add(statusField);
-
- DataSourceTextField startedField = new DataSourceTextField(Field.STARTED_TIME);
- startedField.setType(FieldType.DATETIME);
- fields.add(startedField);
- */
-
- return fields;
- }
-
- @Override
- protected void executeFetch(final DSRequest request, final DSResponse response) {
- ResourceOperationHistoryCriteria criteria = new ResourceOperationHistoryCriteria();
-
- if (request.getCriteria().getValues().containsKey(CriteriaField.RESOURCE_ID)) {
- criteria.addFilterResourceIds(Integer.parseInt((String) request.getCriteria().getValues().get(
- CriteriaField.RESOURCE_ID)));
- }
-
- criteria.setPageControl(getPageControl(request));
-
- operationService.findResourceOperationHistoriesByCriteria(criteria,
- new AsyncCallback<PageList<ResourceOperationHistory>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.dataSource_operationHistory_error_fetchFailure(), caught);
- }
-
- public void onSuccess(PageList<ResourceOperationHistory> result) {
- response.setData(buildRecords(result));
- processResponse(request.getRequestId(), response);
- }
- });
- }
-
- @Override
- public ResourceOperationHistory copyValues(Record from) {
- throw new UnsupportedOperationException("ResourceOperationHistory is read only.");
- }
-
- @Override
- public ListGridRecord copyValues(ResourceOperationHistory from) {
- ListGridRecord record = new ListGridRecord();
- record.setAttribute(Field.ID, from.getId());
- record.setAttribute(Field.CREATED_TIME, from.getCreatedTime());
- record.setAttribute(Field.STARTED_TIME, new Date(from.getStartedTime()));
- record.setAttribute(Field.DURATION, from.getDuration());
- record.setAttribute(Field.RESOURCE, from.getResource());
- record.setAttribute(Field.SUBJECT, from.getSubjectName());
- record.setAttribute(Field.OPERATION_DEFINITION, from.getOperationDefinition());
- record.setAttribute(Field.OPERATION_NAME, from.getOperationDefinition().getDisplayName());
- record.setAttribute(Field.ERROR_MESSAGE, from.getErrorMessage());
- record.setAttribute(Field.STATUS, from.getStatus().name());
- record.setAttribute(Field.PARAMETERS, from.getParameters());
-
- return record;
- }
-
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
deleted file mode 100644
index fb649cc..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation;
-
-import java.util.EnumSet;
-
-import com.smartgwt.client.data.Criteria;
-import com.smartgwt.client.data.Record;
-import com.smartgwt.client.types.Alignment;
-import com.smartgwt.client.types.DateDisplayFormat;
-import com.smartgwt.client.types.ListGridFieldType;
-import com.smartgwt.client.types.Overflow;
-import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.Window;
-import com.smartgwt.client.widgets.events.CloseClickHandler;
-import com.smartgwt.client.widgets.events.CloseClientEvent;
-import com.smartgwt.client.widgets.grid.CellFormatter;
-import com.smartgwt.client.widgets.grid.HoverCustomizer;
-import com.smartgwt.client.widgets.grid.ListGridField;
-import com.smartgwt.client.widgets.grid.ListGridRecord;
-import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
-import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
-import com.smartgwt.client.widgets.menu.IMenuButton;
-import com.smartgwt.client.widgets.menu.Menu;
-import com.smartgwt.client.widgets.menu.MenuItem;
-import com.smartgwt.client.widgets.menu.events.ClickHandler;
-import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent;
-
-import org.rhq.core.domain.operation.OperationDefinition;
-import org.rhq.core.domain.operation.OperationRequestStatus;
-import org.rhq.core.domain.resource.Resource;
-import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.domain.resource.composite.ResourceComposite;
-import org.rhq.enterprise.gui.coregui.client.ImageManager;
-import org.rhq.enterprise.gui.coregui.client.components.table.TableSection;
-import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.create.OperationCreateWizard;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.detail.OperationDetailsView;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHTMLPane;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIMenuButton;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableMenu;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWindow;
-
-/**
- * @author Greg Hinkle
- * @author John Mazzitelli
- */
-public class OperationHistoryView extends TableSection<OperationHistoryDataSource> {
- public static final ViewName VIEW_ID = new ViewName("RecentOperations", MSG.common_title_recent_operations());
-
- private ResourceComposite composite;
-
- public OperationHistoryView(String locatorId) {
- super(locatorId, VIEW_ID.getTitle());
- setWidth100();
- setHeight100();
-
- setDataSource(new OperationHistoryDataSource());
- }
-
- public OperationHistoryView(String locatorId, ResourceComposite resourceComposite) {
- super(locatorId, VIEW_ID.getTitle(), new Criteria(OperationHistoryDataSource.CriteriaField.RESOURCE_ID,
- String.valueOf(resourceComposite.getResource().getId())));
- this.composite = resourceComposite;
-
- setDataSource(new OperationHistoryDataSource());
- }
-
- @Override
- protected void configureTable() {
- ListGridField idField = new ListGridField(OperationHistoryDataSource.Field.ID, MSG.common_title_id());
-
- ListGridField opNameField = new ListGridField(OperationHistoryDataSource.Field.OPERATION_NAME,
- MSG.dataSource_operationHistory_operationName());
-
- ListGridField subjectField = new ListGridField(OperationHistoryDataSource.Field.SUBJECT,
- MSG.common_title_user());
-
- ListGridField statusField = new ListGridField(OperationHistoryDataSource.Field.STATUS,
- MSG.common_title_status());
- statusField.setAlign(Alignment.CENTER);
- statusField.setCellAlign(Alignment.CENTER);
- statusField.setShowHover(true);
- statusField.setHoverCustomizer(new HoverCustomizer() {
- @Override
- public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
- String statusStr = record.getAttribute(OperationHistoryDataSource.Field.STATUS);
- OperationRequestStatus status = OperationRequestStatus.valueOf(statusStr);
- switch (status) {
- case SUCCESS: {
- return MSG.common_status_success();
- }
- case FAILURE: {
- return MSG.common_status_failed();
- }
- case INPROGRESS: {
- return MSG.common_status_inprogress();
- }
- case CANCELED: {
- return MSG.common_status_canceled();
- }
- }
- return "unknown"; // should never get here
- }
- });
- statusField.setCellFormatter(new CellFormatter() {
- public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
- OperationRequestStatus status = OperationRequestStatus.valueOf((String) o);
- String icon = ImageManager.getOperationResultsIcon(status);
- return Canvas.imgHTML(icon, 16, 16);
- }
- });
- statusField.addRecordClickHandler(new RecordClickHandler() {
- @Override
- public void onRecordClick(RecordClickEvent event) {
- Record record = event.getRecord();
- String statusStr = record.getAttribute(OperationHistoryDataSource.Field.STATUS);
- OperationRequestStatus status = OperationRequestStatus.valueOf(statusStr);
- if (status == OperationRequestStatus.FAILURE) {
- final Window winModal = new LocatableWindow(OperationHistoryView.this
- .extendLocatorId("statusDetailsWin"));
- winModal.setTitle(MSG.common_title_details());
- winModal.setOverflow(Overflow.VISIBLE);
- winModal.setShowMinimizeButton(false);
- winModal.setShowMaximizeButton(true);
- winModal.setIsModal(true);
- winModal.setShowModalMask(true);
- winModal.setAutoSize(true);
- winModal.setAutoCenter(true);
- winModal.setShowResizer(true);
- winModal.setCanDragResize(true);
- winModal.centerInPage();
- winModal.addCloseClickHandler(new CloseClickHandler() {
- @Override
- public void onCloseClick(CloseClientEvent event) {
- winModal.markForDestroy();
- }
- });
-
- LocatableHTMLPane htmlPane = new LocatableHTMLPane(OperationHistoryView.this
- .extendLocatorId("statusDetailsPane"));
- htmlPane.setMargin(10);
- htmlPane.setDefaultWidth(500);
- htmlPane.setDefaultHeight(400);
- String errorMsg = record.getAttribute(OperationHistoryDataSource.Field.ERROR_MESSAGE);
- if (errorMsg == null) {
- errorMsg = MSG.common_status_failed();
- }
- htmlPane.setContents("<pre>" + errorMsg + "</pre>");
- winModal.addItem(htmlPane);
- winModal.show();
- }
- }
- });
-
- ListGridField startedTimeField = new ListGridField(OperationHistoryDataSource.Field.STARTED_TIME,
- MSG.dataSource_operationHistory_startedTime());
- startedTimeField.setType(ListGridFieldType.DATE);
- startedTimeField.setDateFormatter(DateDisplayFormat.TOLOCALESTRING);
- startedTimeField.setAlign(Alignment.LEFT);
- startedTimeField.setCellAlign(Alignment.LEFT);
-
- final Resource resource = this.composite.getResource();
-
- if (resource == null) { // if null, we aren't viewing op history for a single resource
- ListGridField resourceField = new ListGridField(OperationHistoryDataSource.Field.RESOURCE,
- MSG.common_title_resource());
- resourceField.setAlign(Alignment.LEFT);
- resourceField.setCellAlign(Alignment.LEFT);
- resourceField.setCellFormatter(new CellFormatter() {
- public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
- Resource res = (Resource) o;
- return "<a href=\"#Resource/" + res.getId() + "\">" + res.getName() + "</a>";
- }
- });
-
- idField.setWidth(10);
- opNameField.setWidth("25%");
- subjectField.setWidth("25%");
- statusField.setWidth(50);
- startedTimeField.setWidth("25%");
- resourceField.setWidth("25%");
-
- setListGridFields(idField, opNameField, startedTimeField, subjectField, statusField, resourceField);
- } else {
- idField.setWidth(10);
- opNameField.setWidth("34%");
- subjectField.setWidth("33%");
- statusField.setWidth(50);
- startedTimeField.setWidth("33%");
-
- setListGridFields(idField, opNameField, startedTimeField, subjectField, statusField);
- }
-
- if (resource != null && composite.getResourcePermission().isControl()) {
- final Menu operationMenu = new LocatableMenu(this.extendLocatorId("Operation"));
- ResourceTypeRepository.Cache.getInstance().getResourceTypes(resource.getResourceType().getId(),
- EnumSet.of(ResourceTypeRepository.MetadataType.operations),
- new ResourceTypeRepository.TypeLoadedCallback() {
- public void onTypesLoaded(ResourceType type) {
- for (final OperationDefinition od : type.getOperationDefinitions()) {
- MenuItem menuItem = new MenuItem(od.getDisplayName());
- operationMenu.addItem(menuItem);
- menuItem.addClickHandler(new ClickHandler() {
- public void onClick(MenuItemClickEvent event) {
- new OperationCreateWizard(resource, od).startOperationWizard();
- }
- });
- }
- }
- });
-
- IMenuButton operationsButton = new LocatableIMenuButton(this.extendLocatorId("Run"),
- MSG.view_operationHistoryList_button_runOperation(), operationMenu);
- operationsButton.setShowMenuBelow(false);
- operationsButton.setAutoFit(true);
- addExtraWidget(operationsButton);
- }
-
- }
-
- @Override
- protected String getDetailsLinkColumnName() {
- return OperationHistoryDataSource.Field.OPERATION_NAME;
- }
-
- @Override
- public Canvas getDetailsView(int id) {
- OperationDetailsView detailsView = new OperationDetailsView(this.extendLocatorId("Details"));
- return detailsView;
- }
-
- public static OperationHistoryView getResourceHistoryView(String locatorId, ResourceComposite resource) {
- return new OperationHistoryView(locatorId, resource);
- }
-
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationWizard.java
deleted file mode 100644
index 47d7dae..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationWizard.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation;
-
-import org.rhq.core.domain.resource.Resource;
-
-import com.smartgwt.client.widgets.Window;
-import com.smartgwt.client.widgets.events.CloseClickHandler;
-import com.smartgwt.client.widgets.events.CloseClientEvent;
-import com.smartgwt.client.widgets.layout.VLayout;
-
-/**
- * @author Greg Hinkle
- */
-// TODO (ips, 11/17/10): Can this class be deleted?
-public class OperationWizard extends VLayout{
-
- private Resource resource;
- private String operation;
-
- public OperationWizard(Resource resource, String operation) {
- this.resource = resource;
- this.operation = operation;
- }
-
- public static void startPopupOperationWizard(Resource resource, String operation) {
- final Window dialog = new Window();
- dialog.setTitle("Execute Operation");
- dialog.setWidth(800);
- dialog.setHeight(800);
- dialog.setIsModal(true);
- dialog.setShowModalMask(true);
- dialog.setCanDragResize(true);
- dialog.setShowResizer(true);
- dialog.centerInPage();
- dialog.addCloseClickHandler(new CloseClickHandler() {
- public void onCloseClick(CloseClientEvent closeClientEvent) {
- dialog.destroy();
- }
- });
- dialog.addItem(new OperationWizard(resource, operation));
- dialog.show();
- }
-
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/ExecutionSchedule.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/ExecutionSchedule.java
deleted file mode 100644
index 6422174..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/ExecutionSchedule.java
+++ /dev/null
@@ -1,311 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.create;
-
-import java.io.Serializable;
-import java.util.Date;
-import java.util.HashSet;
-
-import com.google.gwt.i18n.client.DateTimeFormat;
-
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.Messages;
-
-/**
- * @author Greg Hinkle
- */
-public class ExecutionSchedule implements Serializable {
-
- private static final Messages MSG = CoreGUI.getMessages();
-
- public enum Start {
- Immediately, Future
- };
-
- public enum End {
- Never, EndOn
- };
-
- public enum Recurr {
- Once, EveryNMinutes, Hourly, Daily, Weekly, Monthly
- };
-
- public enum DayOfWeek {
- Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday
- };
-
- private Start start = Start.Immediately;
-
- // start.Future
- private Recurr recurr = Recurr.Once;
-
- // Once
- private Date onceDateTime;
-
-
- // EveryNMinutes
- private Integer minuteInterval;
-
-
- // Hourly
- private Integer minuteInHour;
-
-
- // Daily
- private Date timeOfDay;
-
-
- // Weekly
- // Time of Day above
- private HashSet<DayOfWeek> daysOfWeek; // Can't use EnumSet because it doesn't have default instantiator
-
-
- // Monthly
- // Time of Day above
- private Integer dayOfMonth;
-
-
- // Used for all start.Future except for once
- private Date startDate;
-
- private Date endDate;
-
-
- public Start getStart() {
- return start;
- }
-
- public void setStart(Start start) {
- this.start = start;
- }
-
- public Recurr getRecurr() {
- return recurr;
- }
-
- public void setRecurr(Recurr recurr) {
- this.recurr = recurr;
- }
-
- public Date getOnceDateTime() {
- return onceDateTime;
- }
-
- public void setOnceDateTime(Date onceDateTime) {
- this.onceDateTime = onceDateTime;
- }
-
- public Integer getMinuteInterval() {
- return minuteInterval;
- }
-
- public void setMinuteInterval(Integer minuteInterval) {
- this.minuteInterval = minuteInterval;
- }
-
- public Integer getMinuteInHour() {
- return minuteInHour;
- }
-
- public void setMinuteInHour(Integer minuteInHour) {
- this.minuteInHour = minuteInHour;
- }
-
- public HashSet<DayOfWeek> getDaysOfWeek() {
- return daysOfWeek;
- }
-
- public void setDaysOfWeek(HashSet<DayOfWeek> daysOfWeek) {
- this.daysOfWeek = daysOfWeek;
- }
-
- public Integer getDayOfMonth() {
- return dayOfMonth;
- }
-
- public void setDayOfMonth(Integer dayOfMonth) {
- this.dayOfMonth = dayOfMonth;
- }
-
- public Date getStartDate() {
- return startDate;
- }
-
- public void setStartDate(Date startDate) {
- this.startDate = startDate;
- }
-
- public Date getEndDate() {
- return endDate;
- }
-
- public void setEndDate(Date endDate) {
- this.endDate = endDate;
- }
-
- public Date getTimeOfDay() {
- return timeOfDay;
- }
-
- public void setTimeOfDay(Date timeOfDay) {
- this.timeOfDay = timeOfDay;
- }
-
- public String getMessage() {
- DateTimeFormat dateFormat = DateTimeFormat.getMediumDateFormat();
- DateTimeFormat timeFormat = DateTimeFormat.getMediumTimeFormat();
-
- String message;
- switch (start) {
-
- case Immediately:
- message = MSG.view_operationCreateWizard_executionSchedule_willExecuteOnce(
- MSG.view_operationCreateWizard_executionSchedule_immediately());
- break;
-
- case Future:
- if (recurr == Recurr.Once) {
- message = MSG.view_operationCreateWizard_executionSchedule_willExecuteOnce(
- MSG.view_operationCreateWizard_executionSchedule_onceAtGivenTime(onceDateTime.toString()));
- } else {
- String recurrenceMessage;
- switch (recurr) {
- case EveryNMinutes:
- recurrenceMessage = MSG.view_operationCreateWizard_executionSchedule_everyNMinutes(minuteInterval.toString());
- break;
- case Hourly:
- recurrenceMessage = MSG.view_operationCreateWizard_executionSchedule_everyHourOnNthMinute(suffix(minuteInHour));
- break;
- case Daily:
- recurrenceMessage = MSG.view_operationCreateWizard_executionSchedule_everyDayAtGivenTime(timeFormat.format(timeOfDay));
- break;
- case Weekly:
- recurrenceMessage = MSG.view_operationCreateWizard_executionSchedule_everyWeekOnGivenDayAtGivenTime(daysOfWeek.toString(), timeFormat.format(timeOfDay));
- break;
- case Monthly:
- recurrenceMessage = MSG.view_operationCreateWizard_executionSchedule_everyMonthOnNthDayAtGivenTime(suffix(dayOfMonth), timeFormat.format(timeOfDay));
- break;
- default:
- recurrenceMessage = "";
- }
-
- if (endDate != null) {
- message = MSG.view_operationCreateWizard_executionSchedule_willExecuteRecurringWithEnd(
- recurrenceMessage, dateFormat.format(startDate), dateFormat.format(endDate));
- } else {
- message = MSG.view_operationCreateWizard_executionSchedule_willExecuteRecurring(
- recurrenceMessage, dateFormat.format(startDate));
- }
- }
- break;
-
- default:
- message = "";
-
- }
-
- return message;
- }
-
-
- public String getCronString() {
-
- /* Cron fields
- 1. Seconds
- 2. Minutes
- 3. Hours
- 4. Day-of-Month
- 5. Month
- 6. Day-of-Week
- 7. Year (optional field)
- */
-
- String cseconds, cminutes = null, chours = null, cdayOfMonth = null, cmonth = null, cdayOfWeek = null;
-
- cseconds = "0";
-
- switch (start) {
-
- case Immediately:
- return null; // No cron string for immediate execution
-
- case Future:
-
- if (recurr == Recurr.Once) {
- return null; // No cron string for non recurring
- } else {
- switch (recurr) {
- case EveryNMinutes:
- cminutes = "0/" + minuteInterval;
- chours = cdayOfMonth = cmonth = "*";
- cdayOfWeek = "?";
- break;
- case Hourly:
- cminutes = "" + minuteInHour;
- chours = "*";
- cdayOfMonth = cmonth = cdayOfWeek = "*";
- break;
- case Daily:
- cminutes = "" + timeOfDay.getMinutes();
- chours = "" + timeOfDay.getHours();
- cdayOfMonth = cmonth = cdayOfWeek = "*";
- break;
- case Weekly:
- cminutes = "" + timeOfDay.getMinutes();
- chours = "" + timeOfDay.getHours();
- cdayOfMonth = "?";
- cmonth = "*";
- cdayOfWeek = daysOfWeek.toString();
- break;
- case Monthly:
- cminutes = "" + timeOfDay.getMinutes();
- chours = "" + timeOfDay.getHours();
- cdayOfMonth = "" + dayOfMonth;
- cmonth = "*";
- cdayOfWeek = "?";
- break;
- }
- }
- break;
- }
- return cseconds + " " + cminutes + " " + chours + " " + cdayOfMonth + " " + cmonth + " " + cdayOfWeek;
-
- }
-
- public static String suffix(int number) {
- String result;
- String numberAsString = String.valueOf(number);
- int last = number % 10;
- switch (last) {
- case 1:
- result = MSG.common_val_n1st(numberAsString);
- break;
- case 2:
- result = MSG.common_val_n2nd(numberAsString);
- break;
- case 3:
- result = MSG.common_val_n3rd(numberAsString);
- break;
- default:
- result = MSG.common_val_nth(numberAsString);
- }
- return result;
- }
-
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationCreateWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationCreateWizard.java
deleted file mode 100644
index 7afe889..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationCreateWizard.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.create;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.widgets.IButton;
-import com.smartgwt.client.widgets.events.ClickEvent;
-import com.smartgwt.client.widgets.events.ClickHandler;
-
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.operation.OperationDefinition;
-import org.rhq.core.domain.resource.Resource;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.components.wizard.AbstractWizard;
-import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
-import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardView;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message;
-
-/**
- * @author Greg Hinkle
- */
-public class OperationCreateWizard extends AbstractWizard {
-
- private Resource resource;
- private OperationDefinition operationDefinition;
-
- private OperationParametersStep parametersStep;
- private OperationSchedulingStep schedulingStep;
-
- private WizardView view;
-
- private IButton executeNowButton;
- private IButton executeButton;
-
- public OperationCreateWizard(Resource resource, OperationDefinition operationDefinition) {
- this.resource = resource;
- this.operationDefinition = operationDefinition;
- }
-
- public void startOperationWizard() {
-
- parametersStep = new OperationParametersStep(operationDefinition);
- schedulingStep = new OperationSchedulingStep();
-
- ArrayList<WizardStep> steps = new ArrayList<WizardStep>();
- steps.add(parametersStep);
- steps.add(schedulingStep);
- setSteps(steps);
-
- executeNowButton = new IButton(MSG.view_operationCreateWizard_button_executeImmediately());
- executeNowButton.setAutoFit(true);
- executeNowButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- execute();
- }
- });
-
- executeButton = new IButton(MSG.view_operationCreateWizard_button_execute());
- executeButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- execute();
- }
- });
-
- view = new WizardView(this);
- view.displayDialog();
- }
-
- public String getWindowTitle() {
- return MSG.view_operationCreateWizard_title();
- }
-
- public String getTitle() {
- return MSG.view_operationCreateWizard_header(operationDefinition.getDisplayName(), resource.getName());
- }
-
- public String getSubtitle() {
- return operationDefinition.getDescription();
- }
-
- public List<IButton> getCustomButtons(int step) {
- switch (step) {
- case 0:
- return Arrays.asList(executeNowButton);
- case 1:
- return Arrays.asList(executeButton);
- default:
- return Collections.emptyList();
- }
- }
-
- private void execute() {
- Configuration parameters = parametersStep.getParameterConfiguration();
- final ExecutionSchedule schedule = schedulingStep.getExecutionSchedule();
-
- // TODO: get the description and timeout from user input
- String description = "";
- int timeout = 0;
-
- AsyncCallback<Void> operationCallback = new AsyncCallback<Void>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.view_operationCreateWizard_error_scheduleOperationFailure(),
- caught);
- }
-
- public void onSuccess(Void result) {
- String opName = operationDefinition.getDisplayName();
- String cron = schedule.getCronString();
- if (cron == null) {
- cron = MSG.common_val_na();
- }
- String concise = MSG.view_operationCreateWizard_message_scheduleOperationSuccess_short(opName);
- String message = MSG.view_operationCreateWizard_message_scheduleOperationSuccess(opName, String
- .valueOf(resource.getId()), cron);
-
- CoreGUI.getMessageCenter().notify(new Message(concise, message, Message.Severity.Info));
- }
- };
-
- if (schedule.getStart() == ExecutionSchedule.Start.Immediately) {
- GWTServiceLookup.getOperationService().invokeResourceOperation(resource.getId(),
- operationDefinition.getName(), parameters, description, timeout, operationCallback);
- } else {
- GWTServiceLookup.getOperationService().scheduleResourceOperation(resource.getId(),
- operationDefinition.getName(), parameters, description, timeout, schedule.getCronString(),
- operationCallback);
- }
-
- view.closeDialog();
- }
-
- public void cancel() {
- // TODO: revert back to original state
- }
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationParametersStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationParametersStep.java
deleted file mode 100644
index 05489c8..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationParametersStep.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.create;
-
-import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.HTMLFlow;
-
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
-import org.rhq.core.domain.operation.OperationDefinition;
-import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
-import org.rhq.enterprise.gui.coregui.client.components.wizard.AbstractWizardStep;
-
-/**
- * @author Greg Hinkle
- */
-public class OperationParametersStep extends AbstractWizardStep {
-
- private OperationDefinition definition;
-
- private ConfigurationEditor configurationEditor;
-
- public OperationParametersStep(OperationDefinition operationDefinition) {
- super();
- this.definition = operationDefinition;
- }
-
- public Canvas getCanvas() {
- if (definition.getParametersConfigurationDefinition() != null) {
- if (configurationEditor == null) {
- ConfigurationDefinition configurationDefinition = definition.getParametersConfigurationDefinition();
- Configuration defaultConfiguration = configurationDefinition.getDefaultTemplate() != null ? configurationDefinition
- .getDefaultTemplate().createConfiguration()
- : new Configuration();
- configurationEditor = new ConfigurationEditor("OperationParams", configurationDefinition,
- defaultConfiguration);
- }
- return configurationEditor;
- } else {
- return new HTMLFlow(MSG.view_operationCreateWizard_parametersStep_noParameters());
- }
- }
-
- public boolean nextPage() {
- return true; // TODO: Implement this method.
- }
-
- public String getName() {
- return MSG.view_operationCreateWizard_parametersStep_name();
- }
-
- public Configuration getParameterConfiguration() {
- return configurationEditor != null ? configurationEditor.getConfiguration() : null;
- }
-
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java
deleted file mode 100644
index f90fd69..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java
+++ /dev/null
@@ -1,418 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.create;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.EnumSet;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.List;
-
-import com.smartgwt.client.types.FormErrorOrientation;
-import com.smartgwt.client.types.TimeFormatter;
-import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.form.DynamicForm;
-import com.smartgwt.client.widgets.form.FormItemIfFunction;
-import com.smartgwt.client.widgets.form.ValuesManager;
-import com.smartgwt.client.widgets.form.events.ItemChangedEvent;
-import com.smartgwt.client.widgets.form.events.ItemChangedHandler;
-import com.smartgwt.client.widgets.form.fields.CanvasItem;
-import com.smartgwt.client.widgets.form.fields.CheckboxItem;
-import com.smartgwt.client.widgets.form.fields.DateItem;
-import com.smartgwt.client.widgets.form.fields.FormItem;
-import com.smartgwt.client.widgets.form.fields.HeaderItem;
-import com.smartgwt.client.widgets.form.fields.IntegerItem;
-import com.smartgwt.client.widgets.form.fields.RadioGroupItem;
-import com.smartgwt.client.widgets.form.fields.SpacerItem;
-import com.smartgwt.client.widgets.form.fields.StaticTextItem;
-import com.smartgwt.client.widgets.form.fields.TimeItem;
-import com.smartgwt.client.widgets.form.validator.CustomValidator;
-
-import org.rhq.enterprise.gui.coregui.client.components.wizard.AbstractWizardStep;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
-
-/**
- * @author Greg Hinkle
- */
-public class OperationSchedulingStep extends AbstractWizardStep implements ItemChangedHandler {
-
- private DynamicForm form;
- private ValuesManager valuesManager;
-
- private ExecutionSchedule executionSchedule = new ExecutionSchedule();
-
- public Canvas getCanvas() {
-
- if (form == null) {
- valuesManager = new ValuesManager();
- form = new LocatableDynamicForm("OperationScheduling");
- form.setValuesManager(valuesManager);
- form.setWrapItemTitles(false);
- form.setErrorOrientation(FormErrorOrientation.RIGHT);
- form.setWidth100();
- form.setPadding(10);
- form.setNumCols(3);
- // form.setColWidths("15%", "35%", "15%", "*");
- form.setValidateOnChange(true);
-
- final RadioGroupItem start = new RadioGroupItem("start",
- MSG.view_operationCreateWizard_schedulingStep_name());
- start.setColSpan(3);
- start.setValueMap(enumValueMap(ExecutionSchedule.Start.class)); // "Immediately", "Future"
- start.setRedrawOnChange(true);
- start.setValue("Immediately");
-
- HeaderItem scheduleHeader = new HeaderItem("scheduleHeader");
- scheduleHeader.setValue(MSG.view_operationCreateWizard_schedulingStep_label_schedule());
- scheduleHeader.setShowIfCondition(new FormItemIfFunction() {
- public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !"Immediately".equals(form.getValueAsString("start"));
- }
- });
-
- RadioGroupItem recurr = new RadioGroupItem("recurr",
- MSG.view_operationCreateWizard_schedulingStep_label_recurrence());
- recurr.setValueMap(enumValueMap(ExecutionSchedule.Recurr.class)); // "Once", "EveryNMinutes", "Hourly", "Daily", "Weekly", "Monthly");
- recurr.setRedrawOnChange(true);
- recurr.setValue(ExecutionSchedule.Recurr.Once.name());
- recurr.setShowIfCondition(new FormItemIfFunction() {
- public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"));
- }
- });
-
- CanvasItem onceForm = new CanvasItem("once", MSG.view_operationCreateWizard_schedulingStep_label_onceAt());
- onceForm.setShowTitle(false);
- onceForm.setCanvas(getOnceForm());
- onceForm.setShowIfCondition(new FormItemIfFunction() {
- public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"))
- && ExecutionSchedule.Recurr.Once.name().equals(form.getValueAsString("recurr"));
- }
- });
-
- CanvasItem everyNMinuteForm = new CanvasItem("everyNMinutesForm",
- MSG.view_operationCreateWizard_schedulingStep_label_everyNMinutes());
- everyNMinuteForm.setShowTitle(false);
- everyNMinuteForm.setCanvas(getEveryNMinutesForm());
- everyNMinuteForm.setShowIfCondition(new FormItemIfFunction() {
- public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"))
- && ExecutionSchedule.Recurr.EveryNMinutes.name().equals(form.getValueAsString("recurr"));
- }
- });
-
- CanvasItem hourlyForm = new CanvasItem("hourlyForm", MSG.view_operationCreateWizard_schedulingStep_label_hourly());
- hourlyForm.setShowTitle(false);
- hourlyForm.setCanvas(getHourlyForm());
- hourlyForm.setShowIfCondition(new FormItemIfFunction() {
- public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !"Immediately".equals(form.getValueAsString("start"))
- && ExecutionSchedule.Recurr.Hourly.name().equals(form.getValueAsString("recurr"));
- }
- });
-
- CanvasItem dailyForm = new CanvasItem("daily", MSG.view_operationCreateWizard_schedulingStep_label_daily());
- dailyForm.setShowTitle(false);
- dailyForm.setCanvas(getDailyForm());
- dailyForm.setShowIfCondition(new FormItemIfFunction() {
- public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"))
- && ExecutionSchedule.Recurr.Daily.name().equals(form.getValueAsString("recurr"));
- }
- });
-
- CanvasItem weeklyForm = new CanvasItem("weekly", MSG.view_operationCreateWizard_schedulingStep_label_weekly());
- weeklyForm.setShowTitle(false);
- weeklyForm.setCanvas(getWeeklyForm());
- weeklyForm.setShowIfCondition(new FormItemIfFunction() {
- public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"))
- && ExecutionSchedule.Recurr.Weekly.name().equals(form.getValueAsString("recurr"));
- }
- });
-
- CanvasItem monthlyForm = new CanvasItem("monthly", MSG.view_operationCreateWizard_schedulingStep_label_monthly());
- monthlyForm.setShowTitle(false);
- monthlyForm.setCanvas(getMonthlyForm());
- monthlyForm.setShowIfCondition(new FormItemIfFunction() {
- public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"))
- && ExecutionSchedule.Recurr.Monthly.name().equals(form.getValueAsString("recurr"));
- }
- });
-
- HeaderItem rangeHeader = new HeaderItem("timePeriod");
- rangeHeader.setValue(MSG.view_operationCreateWizard_schedulingStep_label_timePeriod());
- rangeHeader.setShowIfCondition(new FormItemIfFunction() {
- public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"))
- && !ExecutionSchedule.Recurr.Once.name().equals(form.getValueAsString("recurr"));
- }
- });
-
- DateItem startDate = new DateItem("startDate", MSG.view_operationCreateWizard_schedulingStep_label_startDate());
- startDate.setStartRow(true);
- startDate.setStartDate(new Date());
- startDate.setShowIfCondition(new FormItemIfFunction() {
- public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"))
- && !"Once".equals(form.getValueAsString("recurr"));
- }
- });
-
- final RadioGroupItem end = new RadioGroupItem("endType", MSG.view_operationCreateWizard_schedulingStep_label_endDate());
- end.setShowIfCondition(new FormItemIfFunction() {
- public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"))
- && !"Once".equals(form.getValueAsString("recurr"));
- }
- });
- end.setStartRow(true);
- // TODO: i18n
- end.setValueMap("Never", "End On");
- end.setRedrawOnChange(true);
- end.setValue("Never");
-
- DateItem endDate = new DateItem("endDate", MSG.view_operationCreateWizard_schedulingStep_label_endDate());
- endDate.setStartRow(true);
- endDate.setStartDate(new Date());
- endDate.setShowIfCondition(new FormItemIfFunction() {
- public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"))
- && !"Once".equals(form.getValueAsString("recurr"))
- && !"Never".equals(form.getValueAsString("endType"));
- }
- });
- endDate.setValidators(new CustomValidator() {
- @Override
- protected boolean condition(Object o) {
- return (((Date) form.getValue("startDate")).before((Date) o));
- }
- });
-
- StaticTextItem messageItem = new StaticTextItem("message");
- messageItem.setValue(MSG.view_operationCreateWizard_schedulingStep_label_willExecuteImmediately());
- messageItem.setStartRow(true);
- messageItem.setColSpan(3);
- messageItem.setShowTitle(false);
- messageItem.setCellStyle("HeaderLabel");
-
- form.setItems(start, scheduleHeader, recurr, onceForm, everyNMinuteForm, hourlyForm, dailyForm, weeklyForm,
- monthlyForm, rangeHeader, startDate, end, endDate, new SpacerItem(), messageItem);
-
- form.addItemChangedHandler(this);
- }
-
- return form;
- }
-
- private DynamicForm getOnceForm() {
- DynamicForm form = new DynamicForm();
- form.setValuesManager(valuesManager);
- form.setPadding(10);
- form.setIsGroup(true);
- form.setGroupTitle(MSG.view_operationCreateWizard_schedulingStep_label_onceAt());
- form.addItemChangedHandler(this);
-
- form.setWrapItemTitles(false);
- form.setNumCols(2);
-
- DateItem startDate = new DateItem("onceStartDate", MSG.view_operationCreateWizard_schedulingStep_label_startDate());
- startDate.setValue(new Date());
-
- TimeItem startTime = new TimeItem("onceStartDate", MSG.view_operationCreateWizard_schedulingStep_label_startDate());
- startTime.setValue(new Date());
- startTime.setDisplayFormat(TimeFormatter.TOSHORTPADDEDTIME);
- startTime.setUseMask(true);
- form.setItems(startDate, startTime);
- return form;
- }
-
- private DynamicForm getEveryNMinutesForm() {
- DynamicForm form = new DynamicForm();
- form.setValuesManager(valuesManager);
- form.setPadding(10);
- form.setIsGroup(true);
- form.setGroupTitle(MSG.view_operationCreateWizard_schedulingStep_label_everyNMinutes());
- form.addItemChangedHandler(this);
-
- form.setWrapItemTitles(false);
- form.setNumCols(2);
-
- IntegerItem everyNMinutes = new IntegerItem();
- everyNMinutes.setName("minuteInterval");
- everyNMinutes.setTitle(MSG.view_operationCreateWizard_schedulingStep_label_minuteInterval());
- everyNMinutes.setValue(60);
-
- form.setItems(everyNMinutes);
- return form;
- }
-
- private DynamicForm getHourlyForm() {
- DynamicForm form = new DynamicForm();
- form.setValuesManager(valuesManager);
- form.setPadding(10);
- form.setIsGroup(true);
- form.setGroupTitle(MSG.view_operationCreateWizard_schedulingStep_label_hourly());
- form.addItemChangedHandler(this);
-
- form.setWrapItemTitles(false);
- form.setNumCols(2);
-
- IntegerItem minuteOfHour = new IntegerItem();
- minuteOfHour.setName("minuteOfHour");
- minuteOfHour.setTitle(MSG.view_operationCreateWizard_schedulingStep_label_minuteOfHour());
- minuteOfHour.setValue(5);
-
- form.setItems(minuteOfHour);
- return form;
- }
-
- private DynamicForm getDailyForm() {
- DynamicForm form = new DynamicForm();
- form.setValuesManager(valuesManager);
- form.setPadding(10);
- form.setWrapItemTitles(false);
- form.setIsGroup(true);
- form.setGroupTitle(MSG.view_operationCreateWizard_schedulingStep_label_daily());
- form.addItemChangedHandler(this);
-
- TimeItem timeOfDay = new TimeItem("timeOfDay", MSG.view_operationCreateWizard_schedulingStep_label_timeOfDay());
- timeOfDay.setValue(new Date());
- timeOfDay.setDisplayFormat(TimeFormatter.TOSHORTPADDEDTIME);
- timeOfDay.setUseMask(true);
-
- form.setItems(timeOfDay);
- return form;
- }
-
- private DynamicForm getWeeklyForm() {
- DynamicForm form = new DynamicForm();
- form.setValuesManager(valuesManager);
- form.setPadding(10);
- form.setIsGroup(true);
- form.setGroupTitle(MSG.view_operationCreateWizard_schedulingStep_label_weekly());
- form.addItemChangedHandler(this);
-
- form.setWrapItemTitles(false);
-
- TimeItem timeOfDay = new TimeItem("dayOfWeek", MSG.view_operationCreateWizard_schedulingStep_label_dayOfWeek());
- timeOfDay.setValue(new Date());
- timeOfDay.setDisplayFormat(TimeFormatter.TOSHORTPADDEDTIME);
- timeOfDay.setUseMask(true);
-
- ExecutionSchedule.DayOfWeek[] daysOfWeek = ExecutionSchedule.DayOfWeek.values();
- List<String> dayList = new ArrayList<String>();
- for (ExecutionSchedule.DayOfWeek dayOfWeek : daysOfWeek) {
- dayList.add(dayOfWeek.name());
- }
- FormItem[] items = new FormItem[8];
- items[0] = timeOfDay;
- int i = 1;
- for (String day : dayList) {
- CheckboxItem dayItem = new CheckboxItem(day);
- dayItem.setShowTitle(false);
- items[i++] = dayItem;
- }
- form.setItems(items);
- return form;
- }
-
- private DynamicForm getMonthlyForm() {
- DynamicForm form = new DynamicForm();
- form.setValuesManager(valuesManager);
- form.setPadding(10);
- form.setWrapItemTitles(false);
- form.setIsGroup(true);
- form.setGroupTitle(MSG.view_operationCreateWizard_schedulingStep_label_monthly());
- form.addItemChangedHandler(this);
-
- IntegerItem dayItem = new IntegerItem();
- dayItem.setName("dayOfMonth");
- dayItem.setTitle(MSG.view_operationCreateWizard_schedulingStep_label_dayOfMonth());
- dayItem.setValue(1);
-
- TimeItem timeOfDay = new TimeItem("timeOfDay", MSG.view_operationCreateWizard_schedulingStep_label_timeOfDay());
- timeOfDay.setValue(new Date());
- timeOfDay.setDisplayFormat(TimeFormatter.TOSHORTPADDEDTIME);
- timeOfDay.setUseMask(true);
-
- form.setItems(dayItem, timeOfDay);
- return form;
- }
-
- public boolean nextPage() {
- return true; // TODO: Implement this method.
- }
-
- public String getName() {
- return MSG.view_operationCreateWizard_schedulingStep_name();
- }
-
- public void onItemChanged(ItemChangedEvent itemChangeEvent) {
-
- executionSchedule.setStart(ExecutionSchedule.Start.valueOf(valuesManager.getValueAsString("start")));
- executionSchedule.setRecurr(ExecutionSchedule.Recurr.valueOf(valuesManager.getValueAsString("recurr")));
-
- Date onceDate = (Date) valuesManager.getValues().get("onceStartDate");
- executionSchedule.setOnceDateTime(onceDate);
-
- executionSchedule.setMinuteInterval(Integer.parseInt(valuesManager.getValueAsString("minuteInterval")));
-
- executionSchedule.setMinuteInHour(Integer.parseInt(valuesManager.getValueAsString("minuteOfHour")));
-
- executionSchedule.setTimeOfDay((Date) valuesManager.getValues().get("timeOfDay"));
-
- HashSet<ExecutionSchedule.DayOfWeek> selectedDays = new HashSet<ExecutionSchedule.DayOfWeek>(); //.noneOf(ExecutionSchedule.DayOfWeek.class);
- for (ExecutionSchedule.DayOfWeek d : EnumSet.allOf(ExecutionSchedule.DayOfWeek.class)) {
- if (valuesManager.getValues().containsKey(d.name())) {
- selectedDays.add(d);
- }
- }
- executionSchedule.setDaysOfWeek(selectedDays);
-
- executionSchedule.setDayOfMonth(Integer.parseInt(valuesManager.getValueAsString("dayOfMonth")));
-
- executionSchedule.setStartDate((Date) valuesManager.getValues().get("startDate"));
-
- if ("Never".equals(valuesManager.getValues().get("endType"))) {
- executionSchedule.setEndDate(null);
- } else {
- executionSchedule.setEndDate((Date) valuesManager.getValues().get("endDate"));
- }
-
- form.setValue("message", executionSchedule.getMessage());
- }
-
- private LinkedHashMap<String, String> enumValueMap(Class<? extends Enum> e) {
- LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
- for (Object o : EnumSet.allOf(e)) {
- Enum v = (Enum) o;
- map.put(v.name(), v.name()); // localize
- }
- return map;
- }
-
- public ExecutionSchedule getExecutionSchedule() {
- return executionSchedule;
- }
-
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/detail/OperationDetailsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/detail/OperationDetailsView.java
deleted file mode 100644
index db2d83e..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/detail/OperationDetailsView.java
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.detail;
-
-import java.util.Date;
-
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.types.Overflow;
-import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.Window;
-import com.smartgwt.client.widgets.events.CloseClickHandler;
-import com.smartgwt.client.widgets.events.CloseClientEvent;
-import com.smartgwt.client.widgets.form.DynamicForm;
-import com.smartgwt.client.widgets.form.fields.LinkItem;
-import com.smartgwt.client.widgets.form.fields.StaticTextItem;
-import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
-import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
-
-import org.rhq.core.domain.criteria.ResourceOperationHistoryCriteria;
-import org.rhq.core.domain.operation.OperationDefinition;
-import org.rhq.core.domain.operation.OperationRequestStatus;
-import org.rhq.core.domain.operation.ResourceOperationHistory;
-import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.ImageManager;
-import org.rhq.enterprise.gui.coregui.client.ViewPath;
-import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.OperationHistoryDataSource;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHTMLPane;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWindow;
-
-/**
- * @author Greg Hinkle
- */
-public class OperationDetailsView extends LocatableVLayout implements BookmarkableView {
-
- private OperationDefinition definition;
- private ResourceOperationHistory operationHistory;
-
- private DynamicForm form;
-
- public OperationDetailsView(String locatorId) {
- super(locatorId);
- }
-
- public OperationDetailsView(String locatorId, OperationDefinition definition,
- ResourceOperationHistory operationHistory) {
- super(locatorId);
-
- this.definition = definition;
- this.operationHistory = operationHistory;
- }
-
- @Override
- protected void onDraw() {
- super.onDraw();
-
- for (Canvas child : getMembers()) {
- child.destroy();
- }
-
- if (this.operationHistory != null) {
- displayDetails(operationHistory);
- }
- }
-
- private void displayDetails(final ResourceOperationHistory operationHistory) {
-
- for (Canvas child : getMembers()) {
- removeChild(child);
- }
-
- this.definition = operationHistory.getOperationDefinition();
- this.operationHistory = operationHistory;
-
- // Information Form
-
- form = new DynamicForm();
- form.setWidth100();
- form.setWrapItemTitles(false);
-
- OperationRequestStatus status = operationHistory.getStatus();
-
- StaticTextItem operationItem = new StaticTextItem(OperationHistoryDataSource.Field.OPERATION_NAME, MSG
- .view_operationHistoryDetails_operation());
- operationItem.setValue(definition.getDisplayName());
-
- StaticTextItem submittedItem = new StaticTextItem(OperationHistoryDataSource.Field.STARTED_TIME, MSG
- .view_operationHistoryDetails_dateSubmitted());
- submittedItem.setValue(new Date(operationHistory.getStartedTime()));
-
- StaticTextItem completedItem = new StaticTextItem("completed", MSG.view_operationHistoryDetails_dateCompleted());
- if (status == OperationRequestStatus.INPROGRESS) {
- completedItem.setValue(MSG.common_val_na());
- } else if (status == OperationRequestStatus.CANCELED) {
- completedItem.setValue(MSG.common_val_never());
- } else {
- completedItem.setValue(new Date(operationHistory.getStartedTime() + operationHistory.getDuration()));
- }
-
- StaticTextItem requesterItem = new StaticTextItem(OperationHistoryDataSource.Field.SUBJECT, MSG
- .view_operationHistoryDetails_requestor());
- requesterItem.setValue(operationHistory.getSubjectName());
-
- LinkItem errorLinkItem = null;
-
- StaticTextItem statusItem = new StaticTextItem(OperationHistoryDataSource.Field.STATUS, MSG
- .view_operationHistoryDetails_status());
- String icon = ImageManager.getFullImagePath(ImageManager.getOperationResultsIcon(status));
- statusItem.setValue("<img src='" + icon + "'/>");
- switch (status) {
- case SUCCESS:
- statusItem.setTooltip(MSG.common_status_success());
- break;
- case FAILURE:
- statusItem.setTooltip(MSG.common_status_failed());
- errorLinkItem = new LinkItem("errorLink");
- errorLinkItem.setTitle(MSG.common_title_error());
- errorLinkItem.setLinkTitle(getShortErrorMessage(operationHistory));
- errorLinkItem.addClickHandler(new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- final Window winModal = new LocatableWindow(OperationDetailsView.this.extendLocatorId("errorWin"));
- winModal.setTitle(MSG.common_title_details());
- winModal.setOverflow(Overflow.VISIBLE);
- winModal.setShowMinimizeButton(false);
- winModal.setShowMaximizeButton(true);
- winModal.setIsModal(true);
- winModal.setShowModalMask(true);
- winModal.setAutoSize(true);
- winModal.setAutoCenter(true);
- winModal.setShowResizer(true);
- winModal.setCanDragResize(true);
- winModal.centerInPage();
- winModal.addCloseClickHandler(new CloseClickHandler() {
- @Override
- public void onCloseClick(CloseClientEvent event) {
- winModal.markForDestroy();
- }
- });
-
- LocatableHTMLPane htmlPane = new LocatableHTMLPane(OperationDetailsView.this
- .extendLocatorId("statusDetailsPane"));
- htmlPane.setMargin(10);
- htmlPane.setDefaultWidth(500);
- htmlPane.setDefaultHeight(400);
- String errorMsg = operationHistory.getErrorMessage();
- if (errorMsg == null) {
- errorMsg = MSG.common_status_failed();
- }
- htmlPane.setContents("<pre>" + errorMsg + "</pre>");
- winModal.addItem(htmlPane);
- winModal.show();
- }
- });
-
- break;
- case INPROGRESS:
- statusItem.setTooltip(MSG.common_status_inprogress());
- break;
- case CANCELED:
- statusItem.setTooltip(MSG.common_status_canceled());
- break;
- }
-
- /*
- Operation: View Process List
- Date Submitted: 3/11/10, 12:24:02 PM, EST
- Date Completed: 3/11/10, 12:24:03 PM, EST
- Requester: rhqadmin
- Status: Failure
- Error Message: __Exception: Cannot connect...__
- */
-
- if (errorLinkItem != null) {
- form.setItems(operationItem, submittedItem, completedItem, requesterItem, statusItem, errorLinkItem);
- } else {
- form.setItems(operationItem, submittedItem, completedItem, requesterItem, statusItem);
- }
-
- addMember(form);
-
- // params/results
-
- if (operationHistory.getParameters() != null) {
- ConfigurationEditor editor = new ConfigurationEditor(extendLocatorId("params"), definition
- .getParametersConfigurationDefinition(), operationHistory.getParameters());
- editor.setReadOnly(true);
- editor.setStructuredConfigTabTitle(MSG.view_operationHistoryDetails_parameters());
- addMember(editor);
- }
-
- if (status == OperationRequestStatus.SUCCESS && operationHistory.getResults() != null) {
- ConfigurationEditor editor = new ConfigurationEditor(extendLocatorId("results"), definition
- .getResultsConfigurationDefinition(), operationHistory.getResults());
- editor.setReadOnly(true);
- editor.setStructuredConfigTabTitle(MSG.view_operationHistoryDetails_results());
- addMember(editor);
- }
- }
-
- private void lookupDetails(int historyId) {
- ResourceOperationHistoryCriteria criteria = new ResourceOperationHistoryCriteria();
-
- criteria.addFilterId(historyId);
-
- criteria.fetchOperationDefinition(true);
- criteria.fetchParameters(true);
- criteria.fetchResults(true);
-
- GWTServiceLookup.getOperationService().findResourceOperationHistoriesByCriteria(criteria,
- new AsyncCallback<PageList<ResourceOperationHistory>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler()
- .handleError(MSG.view_operationHistoryDetails_error_fetchFailure(), caught);
- }
-
- public void onSuccess(PageList<ResourceOperationHistory> result) {
- ResourceOperationHistory item = result.get(0);
- displayDetails(item);
- }
- });
- }
-
- @Override
- public void renderView(ViewPath viewPath) {
- int historyId = viewPath.getCurrentAsInt();
- lookupDetails(historyId);
- }
-
- private String getShortErrorMessage(ResourceOperationHistory operationHistory) {
- String errMsg = operationHistory.getErrorMessage();
- if (errMsg == null) {
- errMsg = MSG.common_status_failed();
- } else if (errMsg.length() > 80) {
- errMsg = errMsg.substring(0, 80) + "...";
- }
- return errMsg;
- }
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/history/ResourceOperationHistoryDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/history/ResourceOperationHistoryDataSource.java
new file mode 100644
index 0000000..e350042
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/history/ResourceOperationHistoryDataSource.java
@@ -0,0 +1,67 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.history;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+
+import org.rhq.core.domain.criteria.ResourceOperationHistoryCriteria;
+import org.rhq.core.domain.operation.ResourceOperationHistory;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.history.OperationHistoryDataSource;
+
+/**
+ * @author Ian Springer
+ */
+public class ResourceOperationHistoryDataSource extends OperationHistoryDataSource {
+
+ public static abstract class CriteriaField {
+ public static final String RESOURCE_ID = "resourceId";
+ }
+
+ @Override
+ protected void executeFetch(final DSRequest request, final DSResponse response) {
+ ResourceOperationHistoryCriteria criteria = new ResourceOperationHistoryCriteria();
+
+ if (request.getCriteria().getValues().containsKey(CriteriaField.RESOURCE_ID)) {
+ int resourceId = Integer.parseInt((String)request.getCriteria().getValues().get(
+ CriteriaField.RESOURCE_ID));
+ criteria.addFilterResourceIds(resourceId);
+ }
+
+ criteria.setPageControl(getPageControl(request));
+
+ operationService.findResourceOperationHistoriesByCriteria(criteria,
+ new AsyncCallback<PageList<ResourceOperationHistory>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.dataSource_operationHistory_error_fetchFailure(), caught);
+ }
+
+ public void onSuccess(PageList<ResourceOperationHistory> result) {
+ response.setData(buildRecords(result));
+ processResponse(request.getRequestId(), response);
+ }
+ });
+ }
+
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/history/ResourceOperationHistoryListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/history/ResourceOperationHistoryListView.java
new file mode 100644
index 0000000..172da98
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/history/ResourceOperationHistoryListView.java
@@ -0,0 +1,93 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.history;
+
+import java.util.EnumSet;
+
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.menu.IMenuButton;
+import com.smartgwt.client.widgets.menu.Menu;
+import com.smartgwt.client.widgets.menu.MenuItem;
+import com.smartgwt.client.widgets.menu.events.ClickHandler;
+import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent;
+
+import org.rhq.core.domain.operation.OperationDefinition;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.composite.ResourceComposite;
+import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.history.AbstractOperationHistoryListView;
+import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.history.ResourceOperationHistoryDetailsView;
+import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.schedule.OperationCreateWizard;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIMenuButton;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableMenu;
+
+/**
+ * @author Ian Springer
+ */
+public class ResourceOperationHistoryListView extends AbstractOperationHistoryListView {
+
+ private ResourceComposite resourceComposite;
+
+ public ResourceOperationHistoryListView(String locatorId, ResourceComposite resourceComposite) {
+ super(locatorId, new ResourceOperationHistoryDataSource(), null,
+ new Criteria(ResourceOperationHistoryDataSource.CriteriaField.RESOURCE_ID,
+ String.valueOf(resourceComposite.getResource().getId())));
+ this.resourceComposite = resourceComposite;
+ }
+
+ @Override
+ protected void configureTable() {
+ super.configureTable();
+
+ if (this.resourceComposite.getResourcePermission().isControl()) {
+ final Resource resource = this.resourceComposite.getResource();
+ final Menu operationMenu = new LocatableMenu(this.extendLocatorId("Operation"));
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(resource.getResourceType().getId(),
+ EnumSet.of(ResourceTypeRepository.MetadataType.operations),
+ new ResourceTypeRepository.TypeLoadedCallback() {
+ public void onTypesLoaded(ResourceType type) {
+ for (final OperationDefinition operationDefinition : type.getOperationDefinitions()) {
+ MenuItem menuItem = new MenuItem(operationDefinition.getDisplayName());
+ operationMenu.addItem(menuItem);
+ menuItem.addClickHandler(new ClickHandler() {
+ public void onClick(MenuItemClickEvent event) {
+ new OperationCreateWizard(resource, operationDefinition).startOperationWizard();
+ }
+ });
+ }
+ }
+ });
+
+ IMenuButton operationsButton = new LocatableIMenuButton(this.extendLocatorId("Run"),
+ MSG.view_operationHistoryList_button_runOperation(), operationMenu);
+ operationsButton.setShowMenuBelow(false);
+ operationsButton.setAutoFit(true);
+ addExtraWidget(operationsButton);
+ }
+ }
+
+ @Override
+ public Canvas getDetailsView(int id) {
+ return new ResourceOperationHistoryDetailsView(this.extendLocatorId("Details"));
+ }
+
+}
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 cec98e5..cc57951 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
@@ -43,9 +43,10 @@ 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;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.platform.PlatformSummaryPortlet;
+import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.history.AbstractOperationHistoryListView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration.ConfigurationHistoryView;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.OperationHistoryView;
import org.rhq.enterprise.gui.coregui.client.report.measurement.MeasurementOOBView;
+import org.rhq.enterprise.gui.coregui.client.report.operation.SubsystemOperationHistoryListView;
import org.rhq.enterprise.gui.coregui.client.report.tag.TaggedView;
/**
@@ -116,10 +117,10 @@ public class ReportTopView extends AbstractSectionedLeftNavigationView {
}
});
- NavigationItem recentOperationsItem = new NavigationItem(OperationHistoryView.VIEW_ID,
+ NavigationItem recentOperationsItem = new NavigationItem(SubsystemOperationHistoryListView.VIEW_ID,
"subsystems/control/Operation_16.png", new ViewFactory() {
public Canvas createView() {
- return new OperationHistoryView(extendLocatorId(OperationHistoryView.VIEW_ID.getName()));
+ return new SubsystemOperationHistoryListView(extendLocatorId(SubsystemOperationHistoryListView.VIEW_ID.getName()));
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/operation/SubsystemOperationHistoryListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/operation/SubsystemOperationHistoryListView.java
new file mode 100644
index 0000000..af46041
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/operation/SubsystemOperationHistoryListView.java
@@ -0,0 +1,84 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * 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.report.operation;
+
+import java.util.List;
+
+import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.grid.CellFormatter;
+import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.enterprise.gui.coregui.client.LinkManager;
+import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
+import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.history.AbstractOperationHistoryListView;
+import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.history.OperationHistoryDataSource;
+import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.history.ResourceOperationHistoryDetailsView;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.history.ResourceOperationHistoryDataSource;
+
+/**
+ * @author Ian Springer
+ */
+public class SubsystemOperationHistoryListView extends AbstractOperationHistoryListView {
+
+ public static final ViewName VIEW_ID = new ViewName("RecentOperations", MSG.common_title_recent_operations());
+
+ public SubsystemOperationHistoryListView(String locatorId) {
+ super(locatorId, new ResourceOperationHistoryDataSource(), VIEW_ID.getTitle());
+ }
+
+ @Override
+ protected List<ListGridField> createFields() {
+ List<ListGridField> fields = super.createFields();
+
+ for (ListGridField field : fields) {
+ String fieldName = field.getName();
+ if (fieldName.equals(OperationHistoryDataSource.Field.OPERATION_NAME) ||
+ fieldName.equals(OperationHistoryDataSource.Field.SUBJECT) ||
+ fieldName.equals(OperationHistoryDataSource.Field.STARTED_TIME)) {
+ field.setWidth("25%");
+ }
+ }
+
+ ListGridField resourceField = new ListGridField(OperationHistoryDataSource.Field.RESOURCE,
+ MSG.common_title_resource());
+ resourceField.setAlign(Alignment.LEFT);
+ resourceField.setCellAlign(Alignment.LEFT);
+ resourceField.setCellFormatter(new CellFormatter() {
+ public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
+ Resource resource = (Resource) o;
+ String url = LinkManager.getResourceLink(resource.getId());
+ return "<a href=\"" + url + "\">" + resource.getName() + "</a>";
+ }
+ });
+ resourceField.setWidth("25%");
+ fields.add(resourceField);
+
+ return fields;
+ }
+
+ @Override
+ public Canvas getDetailsView(int id) {
+ return new ResourceOperationHistoryDetailsView(this.extendLocatorId("Details"));
+ }
+
+}
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 0654519..2b65a7f 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
@@ -1339,8 +1339,8 @@ view_tabs_common_child_history = Child History
view_tabs_common_connectionSettings = Connection Settings
view_tabs_common_connectionSettingsHistory = Connection Settings History
view_tabs_common_operations = Operations
+view_tabs_common_schedule = Schedule
view_tabs_common_history = History
-view_tabs_common_scheduled = Scheduled
view_tabs_common_alerts = Alerts
view_tabs_common_definitions = Definitions
view_tabs_common_current = Current
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerBean.java
index 21d0770..992e401 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerBean.java
@@ -1491,12 +1491,12 @@ public class OperationManagerBean implements OperationManagerLocal, OperationMan
}
/**
- * Given an attached history object, this will see if its has completed and if it is a resource history that is part
+ * Given the id of a history object, this will see if it has completed and if it is a resource history that is part
* of an overall group operation and if so will see if all of its peer resource histories are also complete. If the
* group members are all done, the group history object will have its status updated to reflect that the group
* itself is done.
*
- * @param history an EJB3 managed (aka attached) history object
+ * @param historyId id of a history object
*/
public void checkForCompletedGroupOperation(int historyId) {
OperationHistory history = entityManager.find(OperationHistory.class, historyId);
commit 81915fdbca9b3afdb31b52d5321e2de6a6e9668c
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Dec 15 12:03:19 2010 -0500
add ant sources to eclipse
diff --git a/.classpath b/.classpath
index 14c4ae1..17aab76 100644
--- a/.classpath
+++ b/.classpath
@@ -166,7 +166,7 @@
<classpathentry exported="true" kind="var" path="M2_REPO/jboss/jboss-remoting/2.2.2.SP8/jboss-remoting-2.2.2.SP8.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/oswego-concurrent/concurrent/1.3.4/concurrent-1.3.4.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/rss4j/rss4j/0.92-on.2/rss4j-0.92-on.2.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/org/apache/ant/ant/1.8.0/ant-1.8.0.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/org/apache/ant/ant/1.8.0/ant-1.8.0.jar" sourcepath="M2_REPO/org/apache/ant/ant/1.8.0/ant-1.8.0-sources.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/apache/ant/ant-nodeps/1.8.0/ant-nodeps-1.8.0.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/javax/servlet/servlet-api/2.4/servlet-api-2.4.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/struts/struts/1.2.9/struts-1.2.9.jar"/>
commit 90a400d27f01024a9324afeabf687d11f20d613f
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Dec 15 12:59:11 2010 +0100
Add a null-check as FileUtils.toFile() may return null.
diff --git a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/ResourceUpgradeTestBase.java b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/ResourceUpgradeTestBase.java
index c299cce..afe3982 100644
--- a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/ResourceUpgradeTestBase.java
+++ b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/ResourceUpgradeTestBase.java
@@ -93,33 +93,33 @@ public abstract class ResourceUpgradeTestBase {
public String getResourceTypePluginName() {
return resourceTypePluginName;
}
-
+
@Override
public int hashCode() {
return resourceTypeName.hashCode() * resourceTypePluginName.hashCode();
}
-
+
@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}
-
+
if (!(other instanceof ResType)) {
return false;
}
-
+
ResType o = (ResType)other;
-
+
return resourceTypeName.equals(o.getResourceTypeName()) && resourceTypePluginName.equals(o.getResourceTypePluginName());
}
-
+
@Override
public String toString() {
return "ResType[name='" + resourceTypeName + "', plugin='" + resourceTypePluginName + "']";
}
}
-
+
protected interface TestPayload {
Expectations getExpectations(Mockery context) throws Exception;
@@ -315,6 +315,7 @@ public abstract class ResourceUpgradeTestBase {
File pluginFile = FileUtils.toFile(url);
+ assert pluginFile!=null : "pluginFile was null";
assertTrue(pluginFile.exists(), pluginFile.getAbsoluteFile() + " plugin jar could not be found.");
}
@@ -362,7 +363,7 @@ public abstract class ResourceUpgradeTestBase {
//execute full discovery
InventoryManager im = PluginContainer.getInstance().getInventoryManager();
im.executeServerScanImmediately();
-
+
//do the service scan a couple of times so that we can commit
//the resources deep in the type hierarchy
for(int i = 0; i < 10; ++i) {
@@ -370,12 +371,12 @@ public abstract class ResourceUpgradeTestBase {
}
Map<ResType, Set<Resource>> resources = new HashMap<ResType, Set<Resource>>();
-
+
for(ResType type : test.getExpectedResourceTypes()) {
Set<Resource> rs = getTestingResources(type.getResourceTypeName(), type.getResourceTypePluginName());
resources.put(type, rs);
}
-
+
test.test(resources);
context.assertIsSatisfied();
@@ -402,7 +403,7 @@ public abstract class ResourceUpgradeTestBase {
expectations.allowing(getCurrentDiscoveryServerService()).getResources(
expectations.with(Expectations.any(Set.class)), expectations.with(Expectations.any(boolean.class)));
expectations.will(getCurrentServerSideInventory().getResources());
-
+
expectations.allowing(getCurrentDiscoveryServerService()).postProcessNewlyCommittedResources(
expectations.with(Expectations.any(Set.class)));
}
commit 0aa2ef7be4b47d0d2a48e23ecdcd652d63a7dcca
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Dec 15 12:07:41 2010 +0100
Disable the limitation to certain groups for the moment
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java
index c75e462..4d99505 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java
@@ -63,7 +63,7 @@ import org.rhq.enterprise.server.util.LookupUtil;
* @author Greg Hinkle
*/
public abstract class AbstractEJB3Test extends AssertJUnit {
- @BeforeSuite(groups = {"integration.ejb3","PERF"})
+ @BeforeSuite//(groups = {"integration.ejb3","PERF"}) // TODO investigate again
public static void startupEmbeddedJboss() throws Exception {
// Setting content location to the tmp dir
System.setProperty(ContentSourceManagerBean.FILESYSTEM_PROPERTY, System.getProperty("java.io.tmpdir"));
commit 34e34f0feef9215c0f5cc531e9e3d806b559f3a5
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Dec 15 12:02:47 2010 +0100
Do the old try-rollback trick so that we leave no dangling stuff around.
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementDataManagerTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementDataManagerTest.java
index 53e21c9..6a09934 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementDataManagerTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementDataManagerTest.java
@@ -22,6 +22,7 @@ import java.util.Date;
import java.util.Random;
import javax.persistence.EntityManager;
+import javax.transaction.Status;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -75,8 +76,6 @@ public class MeasurementDataManagerTest extends AbstractEJB3Test {
@BeforeMethod
public void beforeMethod() {
try {
- prepareScheduler();
-
this.resourceManager = LookupUtil.getResourceManager();
this.measurementDataManager = LookupUtil.getMeasurementDataManager();
this.callTimeDataManager = LookupUtil.getCallTimeDataManager();
@@ -89,41 +88,6 @@ public class MeasurementDataManagerTest extends AbstractEJB3Test {
}
}
- @AfterMethod
- public void afterMethod() throws Exception {
- try {
- EntityManager em = getEntityManager();
- getTransactionManager().begin();
-
- MeasurementSchedule schedule1 = resource1.getSchedules().iterator().next();
- MeasurementSchedule schedule2 = resource2.getSchedules().iterator().next();
- schedule1 = em.find(MeasurementSchedule.class,schedule1.getId());
- schedule2 = em.find(MeasurementSchedule.class,schedule2.getId());
- em.remove(schedule1);
- em.remove(schedule2);
- resource1 = em.find(Resource.class,resource1.getId());
- resource2 = em.find(Resource.class,resource2.getId());
- em.remove(resource1);
- em.remove(resource2);
- theDefinition = em.find(MeasurementDefinition.class,theDefinition.getId());
- em.remove(theDefinition);
- theResourceType = em.find(ResourceType.class,theResourceType.getId());
- em.remove(theResourceType);
- theAgent = em.find(Agent.class,theAgent.getId());
- em.remove(theAgent);
-
- getTransactionManager().commit();
-
- } catch (Exception e) {
- e.printStackTrace();
- throw e;
- }
-
- finally {
- unprepareScheduler();
- }
- }
-
@Test
public void bz658491() throws Exception {
@@ -131,7 +95,6 @@ public class MeasurementDataManagerTest extends AbstractEJB3Test {
try {
setupResources(em);
- commitAndClose(em);
MeasurementSchedule schedule1 = resource1.getSchedules().iterator().next();
MeasurementSchedule schedule2 = resource2.getSchedules().iterator().next();
@@ -166,10 +129,11 @@ public class MeasurementDataManagerTest extends AbstractEJB3Test {
} catch (Exception e) {
e.printStackTrace();
throw e;
- }
-
- finally {
- unprepareScheduler();
+ } finally {
+ if (em != null) {
+ getTransactionManager().rollback();
+ em.close();
+ }
}
}
@@ -222,10 +186,4 @@ public class MeasurementDataManagerTest extends AbstractEJB3Test {
return em;
}
- private void commitAndClose(EntityManager em) throws Exception {
- getTransactionManager().commit();
- em.close();
- }
-
-
}
commit d38adb6b40ef0208b8c4c953b64d17a65e5b80b8
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Dec 15 10:43:59 2010 +0100
Adjust values to follow the recent changes for minimum in the xsd
diff --git a/modules/enterprise/server/jar/src/test/resources/test/metadata/measurement/measurementDeletion-v1_0.xml b/modules/enterprise/server/jar/src/test/resources/test/metadata/measurement/measurementDeletion-v1_0.xml
index f338aed..db954f5 100644
--- a/modules/enterprise/server/jar/src/test/resources/test/metadata/measurement/measurementDeletion-v1_0.xml
+++ b/modules/enterprise/server/jar/src/test/resources/test/metadata/measurement/measurementDeletion-v1_0.xml
@@ -2,12 +2,11 @@
version="1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:xmlns:rhq-plugin">
-
+
<server name="testServer1">
<metric displayName="One" property="connectionCount1" displayType="detail" />
<metric displayName="Two" property="connectionCount2" displayType="detail" />
<metric displayName="Three" property="connectionCount3" displayType="detail" />
- <metric displayName="Five" property="connectionCount5" displayType="detail" defaultInterval="10000" />
+ <metric displayName="Five" property="connectionCount5" displayType="detail" defaultInterval="30000" />
</server>
</plugin>
-
\ No newline at end of file
diff --git a/modules/enterprise/server/jar/src/test/resources/test/metadata/measurement/update-v1_0.xml b/modules/enterprise/server/jar/src/test/resources/test/metadata/measurement/update-v1_0.xml
index 5a55a14..6ba4994 100644
--- a/modules/enterprise/server/jar/src/test/resources/test/metadata/measurement/update-v1_0.xml
+++ b/modules/enterprise/server/jar/src/test/resources/test/metadata/measurement/update-v1_0.xml
@@ -2,14 +2,13 @@
version="1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:xmlns:rhq-plugin">
-
+
<server name="testServer1">
<metric displayName="One" property="connectionCount1" displayType="detail" />
<metric displayName="Two" property="connectionCount2" displayType="detail" />
<metric displayName="Three" property="connectionCount3" displayType="detail" />
- <metric displayName="Five" property="connectionCount5" displayType="detail" defaultInterval="10000" />
-
+ <metric displayName="Five" property="connectionCount5" displayType="detail" defaultInterval="30000" />
+
</server>
</plugin>
-
\ No newline at end of file
diff --git a/modules/enterprise/server/jar/src/test/resources/test/metadata/measurement/update-v2_0.xml b/modules/enterprise/server/jar/src/test/resources/test/metadata/measurement/update-v2_0.xml
index 83ab179..419e171 100644
--- a/modules/enterprise/server/jar/src/test/resources/test/metadata/measurement/update-v2_0.xml
+++ b/modules/enterprise/server/jar/src/test/resources/test/metadata/measurement/update-v2_0.xml
@@ -2,20 +2,19 @@
version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:xmlns:rhq-plugin">
-
+
<server name="testServer1">
<!-- one is gone -->
-
+
<!-- two stays as is-->
<metric displayName="Two" property="connectionCount2" displayType="detail" />
<!-- three is changed (display type) -->
<metric displayName="Three" property="connectionCount3" displayType="summary" />
<!-- four is new -->
<metric displayName="Four" property="connectionCount4" displayType="detail" />
- <!-- five is changed as well (defaultInterval) -->
- <metric displayName="Five" property="connectionCount5" displayType="detail" defaultInterval="20000" />
-
+ <!-- five is changed as well (defaultInterval) -->
+ <metric displayName="Five" property="connectionCount5" displayType="detail" defaultInterval="50000" />
+
</server>
</plugin>
-
\ No newline at end of file
diff --git a/modules/enterprise/server/jar/src/test/resources/test/metadata/resource-type/update4-v1_0.xml b/modules/enterprise/server/jar/src/test/resources/test/metadata/resource-type/update4-v1_0.xml
index 494aa9f..614da65 100644
--- a/modules/enterprise/server/jar/src/test/resources/test/metadata/resource-type/update4-v1_0.xml
+++ b/modules/enterprise/server/jar/src/test/resources/test/metadata/resource-type/update4-v1_0.xml
@@ -2,7 +2,7 @@
version="1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:xmlns:rhq-plugin">
-
+
<platform name="myPlatform4">
<server name="testServer1">
<metric displayName="One" property="connectionCount1" displayType="detail" />
@@ -10,8 +10,7 @@
<server name="testServer2">
<metric displayName="Two" property="connectionCount2" displayType="detail" />
<metric displayName="Three" property="connectionCount3" displayType="detail" />
- <metric displayName="Five" property="connectionCount5" displayType="detail" defaultInterval="10000" />
+ <metric displayName="Five" property="connectionCount5" displayType="detail" defaultInterval="30000" />
</server>
</platform>
</plugin>
-
\ No newline at end of file
commit 55fee749e142292c64870dae38cca0bc27ad321b
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Dec 14 23:02:45 2010 -0500
fixing more things to get the upload buttons to render appropriately
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/FileUploadForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/FileUploadForm.java
index 3a7f062..286e382 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/FileUploadForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/FileUploadForm.java
@@ -30,6 +30,8 @@ import com.smartgwt.client.widgets.form.fields.FormItem;
import com.smartgwt.client.widgets.form.fields.FormItemIcon;
import com.smartgwt.client.widgets.form.fields.HiddenItem;
import com.smartgwt.client.widgets.form.fields.UploadItem;
+import com.smartgwt.client.widgets.form.fields.events.ChangeEvent;
+import com.smartgwt.client.widgets.form.fields.events.ChangeHandler;
import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
@@ -185,9 +187,23 @@ public class FileUploadForm extends DynamicCallbackForm {
onDrawItems.add(fileUploadItem);
if (showUploadButton) {
- fileUploadItem.setEndRow(false);
+ // this intercepts an enable request and only allows it if there is a file selected
+ class EnableInterceptingButtonItem extends ButtonItem {
+ EnableInterceptingButtonItem(String name) {
+ super(name);
+ }
+
+ @Override
+ public void enable() {
+ String selectedFile = fileUploadItem.getValueAsString();
+ if (selectedFile != null && selectedFile.length() > 0) {
+ super.enable();
+ }
+ }
+ }
- uploadButton = new ButtonItem(MSG.view_upload_upload());
+ uploadButton = new EnableInterceptingButtonItem(MSG.view_upload_upload());
+ uploadButton.setDisabled(true);
uploadButton.setColSpan(1);
uploadButton.setStartRow(false);
uploadButton.setAutoFit(true);
@@ -197,6 +213,15 @@ public class FileUploadForm extends DynamicCallbackForm {
submitForm();
}
});
+
+ fileUploadItem.setEndRow(false);
+ fileUploadItem.addChangeHandler(new ChangeHandler() {
+ @Override
+ public void onChange(ChangeEvent changeEvent) {
+ uploadButton.setDisabled(false);
+ }
+ });
+
onDrawItems.add(uploadButton);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/TextFileRetrieverForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/TextFileRetrieverForm.java
index b147fe5..7bf4536 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/TextFileRetrieverForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/TextFileRetrieverForm.java
@@ -65,6 +65,7 @@ public class TextFileRetrieverForm extends DynamicCallbackForm {
setNumCols(4);
textFile = new UploadItem("textFile", MSG.view_upload_prompt_2());
+ textFile.setColSpan(1);
textFile.setEndRow(false);
textFile.setWrapTitle(false);
@@ -89,12 +90,15 @@ public class TextFileRetrieverForm extends DynamicCallbackForm {
uploadButton.setDisabled(true);
textFile.addChangeHandler(new ChangeHandler() {
+ @Override
public void onChange(ChangeEvent changeEvent) {
uploadButton.setDisabled(false);
+ uploadButton.setShowIcons(false);
}
});
uploadButton.addClickHandler(new ClickHandler() {
+ @Override
public void onClick(ClickEvent clickEvent) {
String selectedFile = textFile.getValueAsString();
if (selectedFile != null && selectedFile.length() > 0) {
@@ -103,6 +107,7 @@ public class TextFileRetrieverForm extends DynamicCallbackForm {
submitForm();
} else {
uploadButton.disable(); // no file selected, it shouldn't be able to be pressed
+ uploadButton.setShowIcons(false);
}
}
});
@@ -125,18 +130,26 @@ public class TextFileRetrieverForm extends DynamicCallbackForm {
*/
public void retrievalStatus(boolean ok) {
if (uploadButton != null) {
- FormItemIcon loadedIcon = new FormItemIcon();
+ String iconSrc;
+ Message msg;
+
if (ok) {
- loadedIcon.setSrc(ImageManager.getAvailabilityIcon(Boolean.TRUE));
- CoreGUI.getMessageCenter().notify(new Message(MSG.view_upload_success(), Severity.Info));
+ iconSrc = ImageManager.getAvailabilityIcon(Boolean.TRUE);
+ msg = new Message(MSG.view_upload_success(), Severity.Info);
} else {
- loadedIcon.setSrc(ImageManager.getAvailabilityIcon(Boolean.FALSE));
- CoreGUI.getMessageCenter().notify(new Message(MSG.view_upload_error_file(), Severity.Error));
+ iconSrc = ImageManager.getAvailabilityIcon(Boolean.FALSE);
+ msg = new Message(MSG.view_upload_error_file(), Severity.Error);
}
+
+ FormItemIcon loadedIcon = new FormItemIcon();
+ loadedIcon.setSrc(iconSrc);
loadedIcon.setWidth(16);
loadedIcon.setHeight(16);
uploadButton.setIcons(loadedIcon);
uploadButton.setShowIcons(true);
+ markForRedraw();
+
+ CoreGUI.getMessageCenter().notify(msg);
}
}
}
commit 9d4870731c6229c1469074cd2a4042c7969097ef
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Dec 14 21:53:41 2010 -0500
this fixes a bunch of little things in the create wizard's first step.
makes sure components are disabled/greyed out at the appropriate times
and re-enabled at the appropriate times.
also adds a upload icon to make it purdy
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java
index e13b67e..bdc647a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java
@@ -24,6 +24,13 @@ public class ImageManager {
public static final String IMAGES_DIR = "images/";
/**
+ * Returns a generic "upload" icon.
+ */
+ public static String getUploadIcon() {
+ return "global/upload.png";
+ }
+
+ /**
* Returns a generic edit icon.
*/
public static String getEditIcon() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDistroFileStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDistroFileStep.java
index 15f1afa..32df859 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDistroFileStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDistroFileStep.java
@@ -25,8 +25,8 @@ import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.events.FormSubmitFailedEvent;
import com.smartgwt.client.widgets.form.events.FormSubmitFailedHandler;
+import com.smartgwt.client.widgets.form.fields.ButtonItem;
import com.smartgwt.client.widgets.form.fields.CanvasItem;
-import com.smartgwt.client.widgets.form.fields.LinkItem;
import com.smartgwt.client.widgets.form.fields.TextAreaItem;
import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
@@ -36,6 +36,7 @@ import org.rhq.core.domain.bundle.BundleVersion;
import org.rhq.core.domain.criteria.BundleVersionCriteria;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.ImageManager;
import org.rhq.enterprise.gui.coregui.client.components.form.RadioGroupWithComponentsItem;
import org.rhq.enterprise.gui.coregui.client.components.upload.BundleDistributionFileUploadForm;
import org.rhq.enterprise.gui.coregui.client.components.upload.DynamicCallbackForm;
@@ -160,9 +161,9 @@ public class BundleUploadDistroFileStep extends AbstractWizardStep {
recipeForm.setMargin(Integer.valueOf(20));
recipeForm.setShowInlineErrors(false);
- final LinkItem showUpload = new LinkItem("recipeUploadLink");
- showUpload.setValue(MSG.view_bundle_createWizard_clickToUploadRecipe());
- showUpload.setShowTitle(false);
+ final ButtonItem showUpload = new ButtonItem("recipeUploadLink", MSG
+ .view_bundle_createWizard_clickToUploadRecipe());
+ showUpload.setIcon(ImageManager.getUploadIcon());
final CanvasItem upload = new CanvasItem("recipeUploadCanvas");
upload.setShowTitle(false);
@@ -173,8 +174,9 @@ public class BundleUploadDistroFileStep extends AbstractWizardStep {
showUpload.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
- recipeForm.hideItem(showUpload.getName());
- recipeForm.showItem(upload.getName());
+ showUpload.hide();
+ upload.show();
+ recipeForm.markForRedraw();
}
});
@@ -190,8 +192,9 @@ public class BundleUploadDistroFileStep extends AbstractWizardStep {
wizard.setRecipe(event.getResults());
recipe.setValue(event.getResults());
textFileRetrieverForm.retrievalStatus(true);
- recipeForm.showItem(showUpload.getName());
- recipeForm.hideItem(upload.getName());
+ showUpload.show();
+ upload.hide();
+ recipeForm.markForRedraw();
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/RadioGroupWithComponentsItem.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/RadioGroupWithComponentsItem.java
index 2fb9688..9412237 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/RadioGroupWithComponentsItem.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/RadioGroupWithComponentsItem.java
@@ -28,6 +28,7 @@ import java.util.LinkedHashMap;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.ButtonItem;
import com.smartgwt.client.widgets.form.fields.CanvasItem;
import com.smartgwt.client.widgets.form.fields.FormItem;
import com.smartgwt.client.widgets.form.fields.RadioGroupItem;
@@ -119,16 +120,32 @@ public class RadioGroupWithComponentsItem extends CanvasItem {
canvas.getItem(key).clearValue();
canvas.getItem(key).redraw();
}
- if (value != null && value instanceof DynamicForm) {
- if (!disabled.equals(value.isDisabled())) {
- value.setDisabled(disabled);
- for (FormItem item : ((DynamicForm) value).getFields()) {
- item.clearValue();
- item.redraw();
+ disableAllFormFields(value, disabled);
+ }
+ }
+
+ private void disableAllFormFields(Canvas value, Boolean disabled) {
+ if (value != null && value instanceof DynamicForm) {
+ for (FormItem item : ((DynamicForm) value).getFields()) {
+ if (item instanceof CanvasItem) {
+ // recursively drill down in case this is a dynamic form inside a dynamic form
+ disableAllFormFields(((CanvasItem) item).getCanvas(), disabled);
+ }
+
+ if (disabled) {
+ item.clearValue();
+ item.redraw();
+ if (item instanceof ButtonItem) {
+ item.disable();
+ }
+ } else {
+ if (item instanceof ButtonItem) {
+ item.enable();
}
- value.markForRedraw();
}
}
+ value.setDisabled(disabled);
+ value.markForRedraw();
}
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/FileUploadForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/FileUploadForm.java
index ee1d1de..3a7f062 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/FileUploadForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/FileUploadForm.java
@@ -191,6 +191,7 @@ public class FileUploadForm extends DynamicCallbackForm {
uploadButton.setColSpan(1);
uploadButton.setStartRow(false);
uploadButton.setAutoFit(true);
+ uploadButton.setIcon(ImageManager.getUploadIcon());
uploadButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
submitForm();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/TextFileRetrieverForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/TextFileRetrieverForm.java
index 3eae1f8..b147fe5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/TextFileRetrieverForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/TextFileRetrieverForm.java
@@ -66,8 +66,25 @@ public class TextFileRetrieverForm extends DynamicCallbackForm {
textFile = new UploadItem("textFile", MSG.view_upload_prompt_2());
textFile.setEndRow(false);
+ textFile.setWrapTitle(false);
- uploadButton = new ButtonItem("Upload");
+ // this intercepts an enable request and only allows it if there is a file selected
+ class EnableInterceptingButtonItem extends ButtonItem {
+ EnableInterceptingButtonItem(String name) {
+ super(name);
+ }
+
+ @Override
+ public void enable() {
+ String selectedFile = textFile.getValueAsString();
+ if (selectedFile != null && selectedFile.length() > 0) {
+ super.enable();
+ }
+ }
+ }
+
+ uploadButton = new EnableInterceptingButtonItem(MSG.view_upload_upload());
+ uploadButton.setIcon(ImageManager.getUploadIcon());
uploadButton.setStartRow(false);
uploadButton.setDisabled(true);
@@ -79,9 +96,14 @@ public class TextFileRetrieverForm extends DynamicCallbackForm {
uploadButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
- uploadButton.setShowIcons(true);
- markForRedraw();
- submitForm();
+ String selectedFile = textFile.getValueAsString();
+ if (selectedFile != null && selectedFile.length() > 0) {
+ uploadButton.setShowIcons(true);
+ markForRedraw();
+ submitForm();
+ } else {
+ uploadButton.disable(); // no file selected, it shouldn't be able to be pressed
+ }
}
});
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 dc736de..0654519 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
@@ -989,7 +989,7 @@ view_bundle_createWizard_urlOption = URL
view_bundle_createWizard_uploadOption = Upload
view_bundle_createWizard_recipeOption = Recipe
view_bundle_createWizard_provideBundleDistro = Provide a Bundle Distribution
-view_bundle_createWizard_clickToUploadRecipe = Click to upload a recipe file
+view_bundle_createWizard_clickToUploadRecipe = Click to load a recipe file
view_bundle_createWizard_createFailure = Failed to create the bundle
view_bundle_createWizard_createSuccessful = You have successfully created a bundle named [{0}] with a version of [{1}]
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/global/upload.png b/modules/enterprise/gui/coregui/src/main/webapp/images/global/upload.png
new file mode 100644
index 0000000..335a235
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/global/upload.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/global/upload_Disabled.png b/modules/enterprise/gui/coregui/src/main/webapp/images/global/upload_Disabled.png
new file mode 100644
index 0000000..dec31e9
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/global/upload_Disabled.png differ
commit e81a2719637d4f30e113f92b40f6c5be5db94fe5
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Dec 14 19:26:17 2010 -0500
short circuit when no bundle file/recipe is supplied
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDistroFileStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDistroFileStep.java
index d06ad6c..15f1afa 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDistroFileStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDistroFileStep.java
@@ -203,6 +203,13 @@ public class BundleUploadDistroFileStep extends AbstractWizardStep {
private void processUrl() {
String urlString = (String) this.urlTextItem.getValue();
+ if (urlString == null || urlString.trim().length() == 0) {
+ wizard.getView().showMessage(MSG.view_bundle_createWizard_enterUrl());
+ wizard.setBundleVersion(null);
+ setButtonsDisableMode(false);
+ return;
+ }
+
BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
bundleServer.createBundleVersionViaURL(urlString, new AsyncCallback<BundleVersion>() {
public void onSuccess(BundleVersion result) {
@@ -257,7 +264,16 @@ public class BundleUploadDistroFileStep extends AbstractWizardStep {
}
private void processRecipe() {
- this.wizard.setRecipe((String) this.recipeForm.getItem("recipeText").getValue());
+ String recipeString = (String) this.recipeForm.getItem("recipeText").getValue();
+
+ if (recipeString == null || recipeString.trim().length() == 0) {
+ wizard.getView().showMessage(MSG.view_bundle_createWizard_enterRecipe());
+ wizard.setBundleVersion(null);
+ setButtonsDisableMode(false);
+ return;
+ }
+
+ this.wizard.setRecipe(recipeString);
BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
bundleServer.createBundleVersionViaRecipe(this.wizard.getRecipe(), new AsyncCallback<BundleVersion>() {
public void onSuccess(BundleVersion result) {
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 ab5d9c0..dc736de 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
@@ -976,6 +976,8 @@ view_bundle_createWizard_cancelFailure = Failed to fully cancel the creation of
view_bundle_createWizard_noBundleTypesSupported = No bundle types are supported - you must deploy a valid plugin that supports bundle deployments
view_bundle_createWizard_noBundleTypesAvail = No bundle types are available
view_bundle_createWizard_loadBundleFileFailure = Cannot obtain bundle file information from server
+view_bundle_createWizard_enterUrl = Please enter a valid URL where the bundle distribution file can be downloaded from
+view_bundle_createWizard_enterRecipe = Please supply a valid recipe
view_bundle_createWizard_uploadInProgress = Upload is in progress... This can take several minutes for large files
view_bundle_createWizard_uploadStepName = Upload Bundle Files
view_bundle_createWizard_noAdditionalFilesNeeded = No additional files need to be uploaded for this bundle
commit 338008671aa986d0e67ada3ea1ce333fe5e7f484
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Dec 14 19:17:17 2010 -0500
bz 616261 fix the broken icons
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/FileUploadForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/FileUploadForm.java
index e2ae778..ee1d1de 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/FileUploadForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/FileUploadForm.java
@@ -29,7 +29,6 @@ import com.smartgwt.client.widgets.form.fields.ButtonItem;
import com.smartgwt.client.widgets.form.fields.FormItem;
import com.smartgwt.client.widgets.form.fields.FormItemIcon;
import com.smartgwt.client.widgets.form.fields.HiddenItem;
-import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.form.fields.UploadItem;
import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
@@ -50,7 +49,6 @@ public class FileUploadForm extends DynamicCallbackForm {
private UploadItem fileUploadItem;
private ButtonItem uploadButton;
- private StaticTextItem icon;
private Boolean uploadResult;
private String uploadError;
@@ -148,18 +146,23 @@ public class FileUploadForm extends DynamicCallbackForm {
Object value = fileUploadItem.getValue();
if (value == null || value.toString().length() == 0) {
String message = MSG.view_upload_prompt_1(name);
- icon.setIcons(iconRed);
- icon.setTooltip(message);
+ changeIcon(iconRed, message);
setUploadError(message);
// note - don't even submit this definite failure
} else {
- icon.setIcons(iconLoading);
- icon.setTooltip(MSG.common_msg_loading());
+ changeIcon(iconLoading, MSG.common_msg_loading());
uploadInProgress = true;
super.submitForm();
}
}
+ protected void changeIcon(FormItemIcon icon, String tooltip) {
+ FormItem item = (this.showUploadButton) ? this.uploadButton : this.fileUploadItem;
+ item.setIcons(icon);
+ item.setIconPrompt(tooltip);
+ markForRedraw();
+ }
+
protected List<FormItem> getOnDrawItems() {
List<FormItem> onDrawItems = new ArrayList<FormItem>();
@@ -176,40 +179,37 @@ public class FileUploadForm extends DynamicCallbackForm {
onDrawItems.add(versionField);
fileUploadItem = new UploadItem("fileUploadItem", name);
- fileUploadItem.setEndRow(false);
fileUploadItem.setShowTitle(showNameLabel);
+ fileUploadItem.setWrapTitle(false);
+ fileUploadItem.setColSpan(1);
onDrawItems.add(fileUploadItem);
- uploadButton = new ButtonItem(MSG.view_upload_upload());
- uploadButton.setVisible(this.showUploadButton);
- uploadButton.setStartRow(false);
- uploadButton.setEndRow(false);
- uploadButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- submitForm();
- }
- });
- onDrawItems.add(uploadButton);
+ if (showUploadButton) {
+ fileUploadItem.setEndRow(false);
+
+ uploadButton = new ButtonItem(MSG.view_upload_upload());
+ uploadButton.setColSpan(1);
+ uploadButton.setStartRow(false);
+ uploadButton.setAutoFit(true);
+ uploadButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ submitForm();
+ }
+ });
+ onDrawItems.add(uploadButton);
+ }
- icon = new StaticTextItem("icon");
- icon.setStartRow(false);
- icon.setShowTitle(false);
if (uploadResult != null) {
if (uploadResult.booleanValue()) {
- icon.setIcons(iconGreen);
- icon.setTooltip(MSG.view_upload_alreadyUploaded());
+ changeIcon(iconGreen, MSG.view_upload_alreadyUploaded());
} else {
String message = MSG.view_upload_tooltip_2();
- icon.setIcons(iconRed);
- icon.setTooltip(message);
+ changeIcon(iconRed, message);
setUploadError(message);
}
} else {
- icon.setIcons(iconGrey);
- icon.setTooltip(MSG.view_upload_tooltip_1());
+ changeIcon(iconGrey, (showUploadButton) ? MSG.view_upload_tooltip_1a() : MSG.view_upload_tooltip_1b());
}
- icon.setShowIcons(true);
- onDrawItems.add(icon);
return onDrawItems;
}
@@ -222,22 +222,15 @@ public class FileUploadForm extends DynamicCallbackForm {
String results = event.getResults();
if (processSubmitCompleteResults(results)) {
uploadResult = Boolean.TRUE;
- icon.setIcons(iconGreen);
- icon.setTooltip(MSG.view_upload_success());
+ changeIcon(iconGreen, MSG.view_upload_success());
CoreGUI.getMessageCenter().notify(new Message(MSG.view_upload_success(), results, Severity.Info));
- icon.hide();
- icon.show();
} else {
uploadResult = Boolean.FALSE;
String cause = "[" + name + "] " + parseCauseFromResponse(results);
- icon.setIcons(iconRed);
- icon.setTooltip(cause);
+ changeIcon(iconRed, cause);
setUploadError(cause);
- icon.setTooltip(cause);
CoreGUI.getMessageCenter().notify(
new Message(MSG.view_upload_error_fileName(name), results, Severity.Error));
- icon.hide();
- icon.show();
}
}
};
@@ -250,12 +243,9 @@ public class FileUploadForm extends DynamicCallbackForm {
uploadResult = Boolean.FALSE;
String cause = MSG.view_upload_error_fileName_2(name);
- icon.setIcons(iconRed);
- icon.setTooltip(cause);
+ changeIcon(iconRed, cause);
setUploadError(cause);
CoreGUI.getMessageCenter().notify(new Message(cause, Severity.Error));
- icon.hide();
- icon.show();
}
};
}
@@ -265,13 +255,7 @@ public class FileUploadForm extends DynamicCallbackForm {
super.onDraw();
List<FormItem> onDrawItems = getOnDrawItems();
- int numCols = 0;
- for (FormItem fi : onDrawItems) {
- if (!(fi instanceof HiddenItem)) {
- ++numCols;
- }
- }
- setNumCols(numCols);
+ setNumCols(((this.showUploadButton) ? 2 : 1) + ((this.showNameLabel) ? 1 : 0));
setItems(onDrawItems.toArray(new FormItem[onDrawItems.size()]));
// push the form handler so it executes first if the form creator has also added a handler
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 f5d15c3..ab5d9c0 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
@@ -1105,9 +1105,10 @@ view_upload_error_fileName_2 = Error uploading file [{0}], check for invalid fil
view_upload_error_packageVersionFile = Error uploading Package Version File
view_upload_error_results = Error uploading file, unexpected results: [{0}]
view_upload_inProgress = Can not submit, upload is currently in progress
-view_upload_prompt_1 = [{0}] File to Upload
+view_upload_prompt_1 = Please select a file to upload [{0}]
view_upload_prompt_2 = File to Upload
-view_upload_tooltip_1 = Select a file to upload, then click Upload or Next
+view_upload_tooltip_1a = Select a file to upload, then click Upload or Next
+view_upload_tooltip_1b = Select a file to upload, then click Next
view_upload_tooltip_2 = File upload had previously failed
view_upload_success = File successfully uploaded
view_upload_upload = Upload
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/availability/availability_green_16_Disabled.png b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/availability/availability_green_16_Disabled.png
new file mode 100644
index 0000000..4131950
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/availability/availability_green_16_Disabled.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/availability/availability_grey_16_Disabled.png b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/availability/availability_grey_16_Disabled.png
new file mode 100644
index 0000000..666da45
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/availability/availability_grey_16_Disabled.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/availability/availability_red_16_Disabled.png b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/availability/availability_red_16_Disabled.png
new file mode 100644
index 0000000..8e1ff7d
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/availability/availability_red_16_Disabled.png differ
commit 131052fc2f6c294910d93323699a0a5ff0b6d832
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Dec 14 15:49:10 2010 -0500
fix the concise message - make it small, the full error msg is the details
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
index a5490bf..6b90111 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
@@ -226,8 +226,7 @@ public class BundleUploadDataStep extends AbstractWizardStep {
if (sendToMessageCenter) {
CoreGUI.getMessageCenter().notify(
- new Message(MSG.view_bundle_createWizard_failedToUploadDistroFile() + ": " + errorMessage,
- Severity.Error));
+ new Message(MSG.view_bundle_createWizard_failedToUploadDistroFile(), errorMessage, Severity.Error));
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDistroFileStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDistroFileStep.java
index b776302..d06ad6c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDistroFileStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDistroFileStep.java
@@ -293,8 +293,7 @@ public class BundleUploadDistroFileStep extends AbstractWizardStep {
if (sendToMessageCenter) {
CoreGUI.getMessageCenter().notify(
- new Message(MSG.view_bundle_createWizard_failedToUploadDistroFile() + ": " + errorMessage,
- Severity.Error));
+ new Message(MSG.view_bundle_createWizard_failedToUploadDistroFile(), errorMessage, Severity.Error));
}
}
}
commit a70b0b2c11e7b7be8f27013f18c3e060ebfb6028
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Dec 14 21:07:29 2010 +0100
Catch a possible NPE and prevent explict call to start as this is done in AbstractEJB3Test and also re-arrange for cleanup.
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdateSubsytemTestBase.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdateSubsytemTestBase.java
index e43e3f9..19b2e8e 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdateSubsytemTestBase.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdateSubsytemTestBase.java
@@ -48,7 +48,6 @@ import org.rhq.core.clientapi.descriptor.plugin.PluginDescriptor;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.criteria.ResourceTypeCriteria;
-import org.rhq.core.domain.measurement.DataType;
import org.rhq.core.domain.measurement.MeasurementData;
import org.rhq.core.domain.measurement.MeasurementDataRequest;
import org.rhq.core.domain.measurement.ResourceMeasurementScheduleRequest;
@@ -113,15 +112,16 @@ public class UpdateSubsytemTestBase extends AbstractEJB3Test {
public void afterClass() throws Exception {
unprepareForTestAgents();
unprepareScheduler();
- }
-
- @BeforeTest
- public void beforeTest() throws Exception {
- startTest();
- // cleanup anything left over from a previous, interrupted run.
cleanupTest();
}
+// @BeforeTest
+// public void beforeTest() throws Exception {
+//// startTest(); Done in super.@BeforeMethod already ??
+// // cleanup anything left over from a previous, interrupted run.
+// cleanupTest();
+// }
+
protected ResourceType getResourceType(String typeName) {
return getResourceType(typeName, PLUGIN_NAME);
}
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java
index 1bd4600..c75e462 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java
@@ -144,7 +144,10 @@ public abstract class AbstractEJB3Test extends AssertJUnit {
}
}
- start = stats.getQueryExecutionCount();
+ if (stats!=null)
+ start = stats.getQueryExecutionCount();
+ else
+ start = 0;
}
public static Connection getConnection() throws SQLException {
commit a3c0dd9e67de3c26858840e4ba9bf2ba567732ef
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Dec 14 17:53:13 2010 +0100
Pull into one method that is executed ahead of the test
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementViewManagerTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementViewManagerTest.java
index cd2291d..a2936db 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementViewManagerTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementViewManagerTest.java
@@ -8,7 +8,6 @@ import javax.persistence.Query;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import org.rhq.core.domain.auth.Subject;
@@ -42,15 +41,12 @@ public class MeasurementViewManagerTest extends AbstractEJB3Test {
}
@BeforeMethod
- public void beforeSuite() throws Exception {
+ public void init() throws Exception {
viewManager = LookupUtil.getMeasurementViewManager();
subjectManager = LookupUtil.getSubjectManager();
overlord = subjectManager.getOverlord();
- }
- @BeforeTest
- public void beforeTest() throws Exception {
getTransactionManager().begin();
try {
EntityManager em = getEntityManager();
commit 04454683ca084b87270f073a11c6e162c8e7ecfd
Merge: 83175aa... 98b7898...
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Dec 14 17:15:20 2010 +0100
Merge branch 'master' of ssh://git.fedorahosted.org/git/rhq/rhq
commit 83175aa7541754e8172f2c945f88204083620a14
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Dec 14 17:12:15 2010 +0100
More changes from BeforeSuite to BeforeMethod.
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/test/PluginDescriptorValidationTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/test/PluginDescriptorValidationTest.java
index abd0da4..cff1b0c 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/test/PluginDescriptorValidationTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/test/PluginDescriptorValidationTest.java
@@ -28,6 +28,7 @@ import javax.xml.bind.util.ValidationEventCollector;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.Test;
@@ -36,7 +37,7 @@ import org.rhq.core.clientapi.descriptor.DescriptorPackages;
/**
* Try to validate the rhq-plugin.xml plugin descriptors
*
- * @author Heiko W. Rupp
+ * @author Heiko W. Rupp
* TODO get the plugins dynamically - see comment in {@link #testPluginDescriptors()}
*/
public class PluginDescriptorValidationTest extends UpdateSubsytemTestBase {
@@ -49,7 +50,7 @@ public class PluginDescriptorValidationTest extends UpdateSubsytemTestBase {
*/
String[] plugins = { "database", "postgres", "platform", "jmx", "rhq-agent", "apache" };
- @BeforeSuite
+ @BeforeMethod
@Override
protected void init() {
super.init();
commit 98b7898e296ca6a9bc26baafcf642ff7afefcd66
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Tue Dec 14 10:47:24 2010 -0500
fix bug where content of Resource Summary>Activity subtab was not rendered on first selection of that subtab; change so ResourceSelectListeners are registered on ResourceDetailView and actually called when a Resource is selected (though there is currently no code that register selection listeners, so we can consider getting rid of the API altogether)
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 50e994f..5fab7c4 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
@@ -53,6 +53,7 @@ import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.AbstractTwo
import org.rhq.enterprise.gui.coregui.client.inventory.common.event.EventCompositeHistoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupListView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceCompositeSearchView;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration.ConfigurationHistoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration.ResourceConfigurationEditView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory.PluginConfigurationEditView;
@@ -77,6 +78,8 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
private ResourceComposite resourceComposite;
+ private List<ResourceSelectListener> selectListeners = new ArrayList<ResourceSelectListener>();
+
private TwoLevelTab summaryTab;
private TwoLevelTab monitoringTab;
private TwoLevelTab inventoryTab;
@@ -221,6 +224,9 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
protected void updateTabContent(ResourceComposite resourceComposite) {
this.resourceComposite = resourceComposite;
+ for (ResourceSelectListener selectListener : this.selectListeners) {
+ selectListener.onResourceSelected(this.resourceComposite);
+ }
Resource resource = this.resourceComposite.getResource();
getTitleBar().setResource(this.resourceComposite);
@@ -379,6 +385,10 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
return this.resourceId;
}
+ public void addResourceSelectListener(ResourceSelectListener listener) {
+ this.selectListeners.add(listener);
+ }
+
@Override
protected ResourceComposite getSelectedItem() {
return this.resourceComposite;
@@ -423,7 +433,6 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
new ResourceTypeRepository.TypeLoadedCallback() {
public void onTypesLoaded(ResourceType type) {
resourceComposite.getResource().setResourceType(type);
- ResourceDetailView.this.resourceComposite = resourceComposite;
updateTabContent(resourceComposite);
selectTab(getTabName(), getSubTabName(), viewPath);
}
@@ -440,4 +449,5 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
}
return false;
}
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
index ffcfce4..35c6c21 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
@@ -80,7 +80,6 @@ import org.rhq.enterprise.gui.coregui.client.gwt.ResourceTypeGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.inventory.InventoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.ResourceGroupContextMenu;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.ResourceGroupDetailView;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceTreeDatasource.AutoGroupTreeNode;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceTreeDatasource.ResourceTreeNode;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.create.OperationCreateWizard;
@@ -105,8 +104,6 @@ public class ResourceTreeView extends LocatableVLayout {
private Menu resourceContextMenu;
private ResourceGroupContextMenu autoGroupContextMenu;
- private List<ResourceSelectListener> selectListeners = new ArrayList<ResourceSelectListener>();
-
// Maps autogroup/type backing group ids to the corresponding autogroup/type nodes.
private Map<Integer, AutoGroupTreeNode> autoGroupNodeMap = new HashMap<Integer, AutoGroupTreeNode>();
@@ -300,7 +297,7 @@ public class ResourceTreeView extends LocatableVLayout {
private void updateSelection() {
- TreeNode selectedNode = null;
+ TreeNode selectedNode;
if (treeGrid != null && treeGrid.getTree() != null
&& (selectedNode = treeGrid.getTree().findById(selectedNodeId)) != null) {
@@ -820,10 +817,6 @@ public class ResourceTreeView extends LocatableVLayout {
}
*/
- public void addResourceSelectListener(ResourceSelectListener listener) {
- this.selectListeners.add(listener);
- }
-
public void renderView(ViewPath viewPath) {
currentViewId = viewPath.getCurrent();
String currentViewIdPath = currentViewId.getPath();
@@ -839,4 +832,5 @@ public class ResourceTreeView extends LocatableVLayout {
setSelectedResource(resourceId);
}
}
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
index 225f0c8..c7b6dee 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
@@ -30,7 +30,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
* @author Ian Springer
*/
// TODO: Implement this.
-public class ActivityView extends LocatableVLayout implements ResourceSelectListener, RefreshableView {
+public class ActivityView extends LocatableVLayout implements RefreshableView {
private ResourceComposite resourceComposite;
private FullHTMLPane iFrame;
@@ -47,22 +47,13 @@ public class ActivityView extends LocatableVLayout implements ResourceSelectList
this.iFrame = new FullHTMLPane(extendLocatorId("IFrame"), null);
addMember(this.iFrame);
- if (this.resourceComposite != null) {
- onResourceSelected(this.resourceComposite);
- }
- }
-
- @Override
- public void onResourceSelected(ResourceComposite resourceComposite) {
- this.resourceComposite = resourceComposite;
+ refresh();
}
@Override
public void refresh() {
- if (this.iFrame != null) {
- this.iFrame.setContentsURL("/rhq/resource/summary/overview-plain.xhtml?id=" +
- this.resourceComposite.getResource().getId());
- }
+ int resourceId = this.resourceComposite.getResource().getId();
+ this.iFrame.setContentsURL("/rhq/resource/summary/overview-plain.xhtml?id=" + resourceId);
}
}
commit 6763d2a6177fd73844bc7f9fc272da939c22e9ff
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Dec 14 16:43:09 2010 +0100
More changes from BeforeSuite to BeforeMethod.
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementViewManagerTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementViewManagerTest.java
index bb7b9a2..cd2291d 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementViewManagerTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementViewManagerTest.java
@@ -7,7 +7,7 @@ import javax.persistence.EntityManager;
import javax.persistence.Query;
import org.testng.annotations.AfterTest;
-import org.testng.annotations.BeforeSuite;
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
@@ -41,7 +41,7 @@ public class MeasurementViewManagerTest extends AbstractEJB3Test {
// TODO: jmarques - write unit tests for MeasurementViewManager
}
- @BeforeSuite
+ @BeforeMethod
public void beforeSuite() throws Exception {
viewManager = LookupUtil.getMeasurementViewManager();
subjectManager = LookupUtil.getSubjectManager();
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/cluster/ClusterManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/cluster/ClusterManagerBeanTest.java
index 3729a60..81b3aad 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/cluster/ClusterManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/cluster/ClusterManagerBeanTest.java
@@ -23,7 +23,7 @@ import java.util.List;
import javax.persistence.EntityManager;
-import org.testng.annotations.BeforeSuite;
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.rhq.core.domain.auth.Subject;
@@ -54,7 +54,7 @@ public class ClusterManagerBeanTest extends AbstractEJB3Test {
private ResourceGroupManagerLocal resourceGroupManager;
private ResourceManagerLocal resourceManager;
- @BeforeSuite
+ @BeforeMethod
@SuppressWarnings( { "unused" })
private void init() {
clusterManager = LookupUtil.getClusterManager();
@@ -122,7 +122,7 @@ public class ClusterManagerBeanTest extends AbstractEJB3Test {
assertEquals(backingGroup.getClusterKey(), clusterKey.toString());
assertEquals(backingGroup.getClusterResourceGroup(), clusterGroup);
//Set<Resource> backingGroupResources = backingGroup.getExplicitResources();
- // explicitResources for backingGroup is lazy, so we need to hit resourceManager for the answer
+ // explicitResources for backingGroup is lazy, so we need to hit resourceManager for the answer
List<Resource> backingGroupResources = resourceManager.findExplicitResourcesByResourceGroup(subject,
backingGroup, PageControl.getUnlimitedInstance());
assertEquals(backingGroupResources.size(), resources.size());
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/group/test/RecursiveResourceGroupTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/group/test/RecursiveResourceGroupTest.java
index 793a976..d6ab390 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/group/test/RecursiveResourceGroupTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/group/test/RecursiveResourceGroupTest.java
@@ -25,7 +25,7 @@ import java.util.Random;
import javax.persistence.EntityManager;
-import org.testng.annotations.BeforeSuite;
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.rhq.core.domain.auth.Subject;
@@ -50,7 +50,7 @@ public class RecursiveResourceGroupTest extends AbstractEJB3Test {
private RoleManagerLocal roleManager;
private SubjectManagerLocal subjectManager;
- @BeforeSuite
+ @BeforeMethod
@SuppressWarnings({ "unused" })
private void init() {
resourceGroupManager = LookupUtil.getResourceGroupManager();
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdateSubsytemTestBase.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdateSubsytemTestBase.java
index d8effb3..e43e3f9 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdateSubsytemTestBase.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdateSubsytemTestBase.java
@@ -39,7 +39,7 @@ import javax.xml.validation.SchemaFactory;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
-import org.testng.annotations.BeforeSuite;
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeTest;
import org.rhq.core.clientapi.agent.measurement.MeasurementAgentService;
@@ -87,7 +87,7 @@ public class UpdateSubsytemTestBase extends AbstractEJB3Test {
protected static ResourceTypeManagerLocal resourceTypeManager;
protected static ResourceManagerLocal resourceManager;
- @BeforeSuite
+ @BeforeMethod
protected void init() {
try {
metadataManager = LookupUtil.getResourceMetadataManager();
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/test/ResourceGroupManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/test/ResourceGroupManagerBeanTest.java
index 340af16..a4c60ce 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/test/ResourceGroupManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/test/ResourceGroupManagerBeanTest.java
@@ -20,7 +20,7 @@ package org.rhq.enterprise.server.resource.test;
import javax.persistence.EntityManager;
-import org.testng.annotations.BeforeSuite;
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.rhq.core.domain.auth.Subject;
@@ -40,7 +40,7 @@ import org.rhq.enterprise.server.util.SessionTestHelper;
public class ResourceGroupManagerBeanTest extends AbstractEJB3Test {
private static ResourceGroupManagerLocal resourceGroupManager;
- @BeforeSuite
+ @BeforeMethod
@SuppressWarnings("unused")
private void init() {
try {
commit dab1eabe1bd3f4bc1ba640c3a2cde5db3d7a6025
Merge: 11d549c... 1b03621...
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Dec 14 16:03:26 2010 +0100
Merge branch 'master' of ssh://git.fedorahosted.org/git/rhq/rhq
commit 11d549c4d83ca63b94670d0a1ff4670e82ce8667
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Dec 14 16:03:01 2010 +0100
BeforeSuite may be too early.
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/authz/test/AuthorizationManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/authz/test/AuthorizationManagerBeanTest.java
index 181dccc..ccd8eec 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/authz/test/AuthorizationManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/authz/test/AuthorizationManagerBeanTest.java
@@ -27,7 +27,6 @@ import java.util.Set;
import javax.persistence.EntityManager;
import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.BeforeSuite;
import org.testng.annotations.Test;
import org.rhq.core.domain.auth.Subject;
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/event/test/EventManagerTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/event/test/EventManagerTest.java
index dc708f5..ad390d4 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/event/test/EventManagerTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/event/test/EventManagerTest.java
@@ -28,7 +28,7 @@ import java.util.Set;
import javax.persistence.EntityManager;
import javax.persistence.Query;
-import org.testng.annotations.BeforeSuite;
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.rhq.core.domain.auth.Subject;
@@ -47,7 +47,7 @@ import org.rhq.enterprise.server.test.AbstractEJB3Test;
import org.rhq.enterprise.server.util.LookupUtil;
/**
- * Tests around the event subsystem
+ * Tests around the event subsystem
* @author Heiko W. Rupp
*/
public class EventManagerTest extends AbstractEJB3Test {
@@ -55,7 +55,7 @@ public class EventManagerTest extends AbstractEJB3Test {
EventManagerLocal eventManager;
EntityManager em;
- @BeforeSuite
+ @BeforeMethod
public void init() {
try {
eventManager = LookupUtil.getEventManager();
@@ -90,7 +90,7 @@ public class EventManagerTest extends AbstractEJB3Test {
em.persist(ev);
em.flush();
- /*
+ /*
* do NOT use addEventData method until this test is refactored to support the fact that
* insertions made via direct SQL won't be visible to the entity manager in this xaction
*/
@@ -142,7 +142,7 @@ public class EventManagerTest extends AbstractEJB3Test {
//em.persist(ev);
//em.flush();
- /*
+ /*
* do NOT use addEventData method until this test is refactored to support the fact that
* insertions made via direct SQL won't be visible to the entity manager in this xaction
*/
commit 1b03621cccec1f55400611b67f29e3e5322c2053
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Dec 14 09:45:17 2010 -0500
A while back the default profile's activation was changed to be active
if java.home is defined. The problem with that approach is that the
java.home property is typically defined, so default modules are
always activated. This causes duplicate module decls when trying to
use many other profiles, or minimally adds the default modules when
they are not wanted.
So, changing back. this may cause an issue for intellij maven plugin users
(as per the original commit comment)
Also, changed "model" profile to "coregui" profile. -Pcoregui will build
just CoreGui and its deps (domain,server jar), from the top level.
diff --git a/modules/pom.xml b/modules/pom.xml
index 231804e..35040d3 100644
--- a/modules/pom.xml
+++ b/modules/pom.xml
@@ -29,9 +29,15 @@
<profile>
<id>default</id>
<activation>
+ <activeByDefault>true</activeByDefault>
+ <!-- The problem with the below approach is that the default modules are
+ always activated. This causes duplicate module decls when trying to use other
+ profiles, or adds the default modules when they are not wanted.
+
<property>
- <name>java.home</name>
+ <name>java.home</name>
</property>
+ -->
</activation>
<modules>
<module>core</module>
@@ -73,10 +79,10 @@
</profile>
<profile>
- <id>model</id>
+ <id>coregui</id>
<activation>
<property>
- <name>model</name>
+ <name>coregui</name>
</property>
</activation>
<modules>
commit 616565e371522bf931e1b7c10917514a84963c02
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Dec 14 15:30:14 2010 +0100
BeforeSuite may be too early.
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/authz/test/AuthorizationManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/authz/test/AuthorizationManagerBeanTest.java
index 2afafb7..181dccc 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/authz/test/AuthorizationManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/authz/test/AuthorizationManagerBeanTest.java
@@ -26,6 +26,7 @@ import java.util.Set;
import javax.persistence.EntityManager;
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.Test;
@@ -44,7 +45,7 @@ import org.rhq.enterprise.server.util.SessionTestHelper;
public class AuthorizationManagerBeanTest extends AbstractEJB3Test {
private AuthorizationManagerLocal authorizationManager;
- @BeforeSuite
+ @BeforeMethod
@SuppressWarnings( { "unused" })
private void init() {
try {
commit 2ca38db2901ff56a78dbcfda105916a2396e6fcf
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Dec 14 14:46:54 2010 +0100
One more null check.
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/pc/generic/GenericServerPluginTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/pc/generic/GenericServerPluginTest.java
index dbc586f..7eb7917 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/pc/generic/GenericServerPluginTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/pc/generic/GenericServerPluginTest.java
@@ -191,6 +191,10 @@ public class GenericServerPluginTest extends AbstractEJB3Test {
}
private void deleteAllTestPluginJars() {
+ if (this.pluginService==null) {
+ System.err.println("Plugin service was null !!");
+ return;
+ }
MasterServerPluginContainerConfiguration masterConfig = this.pluginService.masterConfig;
if (masterConfig==null)
return;
commit a36f8d319b79c54e45ac5418c2c01097b73028eb
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Dec 14 14:19:30 2010 +0100
Null check.
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/pc/generic/GenericServerPluginTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/pc/generic/GenericServerPluginTest.java
index f3aa994..dbc586f 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/pc/generic/GenericServerPluginTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/pc/generic/GenericServerPluginTest.java
@@ -191,8 +191,10 @@ public class GenericServerPluginTest extends AbstractEJB3Test {
}
private void deleteAllTestPluginJars() {
- TestGenericServerPluginService pluginService1 = this.pluginService;
- MasterServerPluginContainerConfiguration masterConfig = pluginService1.masterConfig;
+ MasterServerPluginContainerConfiguration masterConfig = this.pluginService.masterConfig;
+ if (masterConfig==null)
+ return;
+
File pluginDirectory = masterConfig.getPluginDirectory();
File[] files = pluginDirectory.listFiles();
commit b0a0ac4b888e814e3dfa3e7804b608b1a8714602
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Dec 14 13:42:43 2010 +0100
Be a little more verbose in case of error.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/LookupUtil.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/LookupUtil.java
index 61f613e..456208c 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/LookupUtil.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/LookupUtil.java
@@ -630,10 +630,12 @@ public final class LookupUtil {
@SuppressWarnings("unchecked")
private static <T> T lookupLocal(Class<? super T> type) {
+ String localJNDIName = "-not initialized-";
try {
- return (T) lookup(getLocalJNDIName(type));
+ localJNDIName = getLocalJNDIName(type);
+ return (T) lookup(localJNDIName);
} catch (NamingException e) {
- throw new RuntimeException("Failed to lookup local interface to EJB " + type, e);
+ throw new RuntimeException("Failed to lookup local interface to EJB " + type + ", localJNDI=[" + localJNDIName + "]", e);
}
}
commit 2fcd970852de9f5468df6bfd676a2ca456d6970d
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Dec 14 13:42:19 2010 +0100
Split to find offender.
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/pc/generic/GenericServerPluginTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/pc/generic/GenericServerPluginTest.java
index 73849b7..f3aa994 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/pc/generic/GenericServerPluginTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/plugin/pc/generic/GenericServerPluginTest.java
@@ -38,6 +38,7 @@ import org.rhq.core.domain.plugin.ServerPlugin;
import org.rhq.core.util.MessageDigestGenerator;
import org.rhq.core.util.stream.StreamUtil;
import org.rhq.enterprise.server.plugin.ServerPluginsLocal;
+import org.rhq.enterprise.server.plugin.pc.MasterServerPluginContainerConfiguration;
import org.rhq.enterprise.server.plugin.pc.ServerPluginType;
import org.rhq.enterprise.server.plugin.pc.generic.TestGenericServerPluginService.State;
import org.rhq.enterprise.server.plugin.pc.generic.TestGenericServerPluginService.TestGenericPluginManager;
@@ -190,7 +191,11 @@ public class GenericServerPluginTest extends AbstractEJB3Test {
}
private void deleteAllTestPluginJars() {
- File[] files = this.pluginService.masterConfig.getPluginDirectory().listFiles();
+ TestGenericServerPluginService pluginService1 = this.pluginService;
+ MasterServerPluginContainerConfiguration masterConfig = pluginService1.masterConfig;
+ File pluginDirectory = masterConfig.getPluginDirectory();
+
+ File[] files = pluginDirectory.listFiles();
if (files != null) {
for (File file : files) {
if (file.getName().endsWith(".jar")) {
commit d35402236a2c8e63abd5c110cf575b7ca1c84044
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Dec 14 12:41:38 2010 +0100
New test class around measurement handling. First case is bz 658491
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementDataManagerTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementDataManagerTest.java
new file mode 100644
index 0000000..53e21c9
--- /dev/null
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementDataManagerTest.java
@@ -0,0 +1,231 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.server.measurement.test;
+
+import java.util.Date;
+import java.util.Random;
+
+import javax.persistence.EntityManager;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.measurement.DataType;
+import org.rhq.core.domain.measurement.DisplayType;
+import org.rhq.core.domain.measurement.MeasurementCategory;
+import org.rhq.core.domain.measurement.MeasurementDefinition;
+import org.rhq.core.domain.measurement.MeasurementReport;
+import org.rhq.core.domain.measurement.MeasurementSchedule;
+import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
+import org.rhq.core.domain.measurement.MeasurementUnits;
+import org.rhq.core.domain.measurement.calltime.CallTimeData;
+import org.rhq.core.domain.measurement.calltime.CallTimeDataComposite;
+import org.rhq.core.domain.resource.Agent;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceCategory;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.util.PageControl;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.server.measurement.CallTimeDataManagerLocal;
+import org.rhq.enterprise.server.measurement.MeasurementDataManagerLocal;
+import org.rhq.enterprise.server.resource.ResourceManagerLocal;
+import org.rhq.enterprise.server.test.AbstractEJB3Test;
+import org.rhq.enterprise.server.util.LookupUtil;
+
+/**
+ * Test some measurement subsystem functionality
+ * @author Heiko W. Rupp
+ */
+
+public class MeasurementDataManagerTest extends AbstractEJB3Test {
+
+ private final Log log = LogFactory.getLog(MeasurementDataManagerTest.class);
+
+ private ResourceManagerLocal resourceManager;
+ private MeasurementDataManagerLocal measurementDataManager;
+ private CallTimeDataManagerLocal callTimeDataManager;
+
+ private Subject overlord;
+
+ private Resource resource1,resource2;
+ private ResourceType theResourceType;
+ private Agent theAgent;
+ private MeasurementDefinition theDefinition;
+
+ @BeforeMethod
+ public void beforeMethod() {
+ try {
+ prepareScheduler();
+
+ this.resourceManager = LookupUtil.getResourceManager();
+ this.measurementDataManager = LookupUtil.getMeasurementDataManager();
+ this.callTimeDataManager = LookupUtil.getCallTimeDataManager();
+ this.overlord = LookupUtil.getSubjectManager().getOverlord();
+ } catch (Throwable t) {
+ // Catch RuntimeExceptions and Errors and dump their stack trace, because Surefire will completely swallow them
+ // and throw a cryptic NPE (see http://jira.codehaus.org/browse/SUREFIRE-157)!
+ t.printStackTrace();
+ throw new RuntimeException(t);
+ }
+ }
+
+ @AfterMethod
+ public void afterMethod() throws Exception {
+ try {
+ EntityManager em = getEntityManager();
+ getTransactionManager().begin();
+
+ MeasurementSchedule schedule1 = resource1.getSchedules().iterator().next();
+ MeasurementSchedule schedule2 = resource2.getSchedules().iterator().next();
+ schedule1 = em.find(MeasurementSchedule.class,schedule1.getId());
+ schedule2 = em.find(MeasurementSchedule.class,schedule2.getId());
+ em.remove(schedule1);
+ em.remove(schedule2);
+ resource1 = em.find(Resource.class,resource1.getId());
+ resource2 = em.find(Resource.class,resource2.getId());
+ em.remove(resource1);
+ em.remove(resource2);
+ theDefinition = em.find(MeasurementDefinition.class,theDefinition.getId());
+ em.remove(theDefinition);
+ theResourceType = em.find(ResourceType.class,theResourceType.getId());
+ em.remove(theResourceType);
+ theAgent = em.find(Agent.class,theAgent.getId());
+ em.remove(theAgent);
+
+ getTransactionManager().commit();
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw e;
+ }
+
+ finally {
+ unprepareScheduler();
+ }
+ }
+
+
+ @Test
+ public void bz658491() throws Exception {
+ EntityManager em = beginTx();
+
+ try {
+ setupResources(em);
+ commitAndClose(em);
+
+ MeasurementSchedule schedule1 = resource1.getSchedules().iterator().next();
+ MeasurementSchedule schedule2 = resource2.getSchedules().iterator().next();
+ MeasurementScheduleRequest request1 = new MeasurementScheduleRequest(schedule1);
+ MeasurementScheduleRequest request2 = new MeasurementScheduleRequest(schedule2);
+
+ CallTimeData data1 = new CallTimeData(request1);
+ CallTimeData data2 = new CallTimeData(request2);
+
+ data1.addCallData("/foo", new Date(),100);
+ data2.addCallData("/bar", new Date(),200);
+
+ MeasurementReport report = new MeasurementReport();
+ report.addData(data1);
+ report.addData(data2);
+
+ measurementDataManager.mergeMeasurementReport(report);
+
+
+ PageList<CallTimeDataComposite> list1 = callTimeDataManager.findCallTimeDataForResource(overlord,schedule1.getId(),
+ 0,System.currentTimeMillis(),new PageControl());
+ PageList<CallTimeDataComposite> list2 = callTimeDataManager.findCallTimeDataForResource(overlord,schedule2.getId(),
+ 0,System.currentTimeMillis(),new PageControl());
+
+ assert list1 != null;
+ assert list2 != null;
+
+ assert list1.size() == 1 : "List 1 returned " + list1.size() + " entries, expected was 1";
+ assert list2.size() == 1 : "List 2 returned " + list2.size() + " entries, expected was 1";
+
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw e;
+ }
+
+ finally {
+ unprepareScheduler();
+ }
+ }
+
+
+ /**
+ * Just set up a resource where we can attach the availabilities to
+ *
+ * @param em The EntityManager to use
+ *
+ * @return A Resource ready to use
+ */
+ private void setupResources(EntityManager em) {
+ theAgent = new Agent("testagent", "localhost", 1234, "", "randomToken");
+ em.persist(theAgent);
+
+ theResourceType = new ResourceType("test-plat", "test-plugin", ResourceCategory.PLATFORM, null);
+ em.persist(theResourceType);
+
+ theDefinition = new MeasurementDefinition("CT-Def", MeasurementCategory.PERFORMANCE,
+ MeasurementUnits.MILLISECONDS, DataType.CALLTIME,true,60000, DisplayType.SUMMARY);
+ theDefinition.setResourceType(theResourceType);
+ em.persist(theDefinition);
+
+
+ resource1 = new Resource("test-platform-key1", "test-platform-name", theResourceType);
+ resource1.setUuid("" + new Random().nextInt());
+ resource1.setAgent(theAgent);
+ em.persist(resource1);
+ resource2 = new Resource("test-platform-key2", "test-platform-name", theResourceType);
+ resource2.setUuid("" + new Random().nextInt());
+ resource2.setAgent(theAgent);
+ em.persist(resource2);
+
+ MeasurementSchedule schedule1 = new MeasurementSchedule(theDefinition,resource1);
+ em.persist(schedule1);
+ theDefinition.addSchedule(schedule1);
+ resource1.addSchedule(schedule1);
+
+ MeasurementSchedule schedule2 = new MeasurementSchedule(theDefinition,resource2);
+ em.persist(schedule2);
+ theDefinition.addSchedule(schedule2);
+ resource2.addSchedule(schedule2);
+
+ em.flush();
+ }
+
+ private EntityManager beginTx() throws Exception {
+ getTransactionManager().begin();
+ EntityManager em = getEntityManager();
+ return em;
+ }
+
+ private void commitAndClose(EntityManager em) throws Exception {
+ getTransactionManager().commit();
+ em.close();
+ }
+
+
+}
commit b1bb8f858e37c8b6f6d9a99f3d1f7afb28927528
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Dec 14 12:40:55 2010 +0100
Catch a possible NPE
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
index e61fc0c..a5b5a38 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
@@ -403,21 +403,23 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
}
// one more thing, delete any autogroup backing groups
- List<ResourceGroup> backingGroups = attachedResource.getAutoGroupBackingGroups();
- if (null != backingGroups && !backingGroups.isEmpty()) {
- int size = backingGroups.size();
- int[] backingGroupIds = new int[size];
- for (int i = 0; (i < size); ++i) {
- backingGroupIds[i] = backingGroups.get(i).getId();
- }
- try {
- resourceGroupManager.deleteResourceGroups(user, backingGroupIds);
- } catch (Throwable t) {
- if (log.isDebugEnabled()) {
- log.error("Bulk delete error for autogroup backing group deletion for " + backingGroupIds, t);
- } else {
- log.error("Bulk delete error for autogroup backing group deletion for " + backingGroupIds + ": "
- + t.getMessage());
+ if (attachedResource!=null) {
+ List<ResourceGroup> backingGroups = attachedResource.getAutoGroupBackingGroups();
+ if (null != backingGroups && !backingGroups.isEmpty()) {
+ int size = backingGroups.size();
+ int[] backingGroupIds = new int[size];
+ for (int i = 0; (i < size); ++i) {
+ backingGroupIds[i] = backingGroups.get(i).getId();
+ }
+ try {
+ resourceGroupManager.deleteResourceGroups(user, backingGroupIds);
+ } catch (Throwable t) {
+ if (log.isDebugEnabled()) {
+ log.error("Bulk delete error for autogroup backing group deletion for " + backingGroupIds, t);
+ } else {
+ log.error("Bulk delete error for autogroup backing group deletion for " + backingGroupIds + ": "
+ + t.getMessage());
+ }
}
}
}
@@ -742,7 +744,7 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
resource.getId())));
}
- // fill out the tree, including only the direct ancestors and all viewable relations
+ // fill out the tree, including only the direct ancestors and all viewable relations
List<ResourceLineageComposite> result = new LinkedList<ResourceLineageComposite>();
for (ResourceLineageComposite ancestor : resourceLineage) {
@@ -750,14 +752,14 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
result.add(ancestor);
// if the ancestor is not locked, include relevant children. Also, always show viewable
- // siblings of the target resource.
+ // siblings of the target resource.
if (!ancestor.isLocked() || ancestor.getResource() == parent) {
// get children
Set<Resource> children = ancestor.getResource().getChildResources();
// remove any that are in the ancestry to avoid repeated handling
children.removeAll(rawResourceLineage);
- // only add the viewable children
+ // only add the viewable children
List<Resource> viewableChildren = new ArrayList<Resource>(children.size());
for (Resource child : children) {
boolean isCommitted = (child.getInventoryStatus() == InventoryStatus.COMMITTED);
@@ -788,7 +790,7 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
if (isCommitted && isViewable) {
// if not a direct ancestor add to the list (direct ancestors already added by default)
if (!rawResourceLineage.contains(grandChild)) {
- // ensure we have the parent in the entity
+ // ensure we have the parent in the entity
grandChild.getParentResource().getId();
ResourceLineageComposite composite = new ResourceLineageComposite(grandChild, false);
result.add(composite);
@@ -1827,7 +1829,7 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
if (resourceError.getErrorType() == ResourceErrorType.INVALID_PLUGIN_CONFIGURATION
|| resourceError.getErrorType() == ResourceErrorType.AVAILABILITY_CHECK
|| resourceError.getErrorType() == ResourceErrorType.UPGRADE) {
- // there should be at most one invalid plugin configuration error, availability check
+ // there should be at most one invalid plugin configuration error, availability check
// or upgrade error per resource, so delete any currently existing ones before we add this new one
List<ResourceError> doomedErrors = resource.getResourceErrors(resourceError.getErrorType());
commit d353fefd3135e16e5d2e8444986f25b52f0645de
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Dec 14 11:18:48 2010 +0100
Fix an issue that prevented building the UI for German locale.
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
index de58cee..e78f5be 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
@@ -1624,7 +1624,7 @@ datasource_templateSchedules_enabled_detailed=Sammeln der Daten für Metrik [{0}
datasource_templateSchedules_enabled_failed=Konnte das Sammeln der Daten für die Metrik [{0}] [{1}] als Standard für Ressourcen mit Type-ID [{2}] nicht beginnen.
datasource_templateSchedules_updated=Zeitpläne für die ausgewählte Metrik [{0}] aktualisiert.
datasource_templateSchedules_updated_detail=Zeitplan für das Sammeln von Daten für Metrik [{0}] [{1}] als Standard für Ressourcen mit Typ-ID [{2}] auf [{3}] Sekunden gesetzt.
-datasource_templateSchedules_updated_failed=Aktualisieren des Zeitplans für das Sammeln von Daten für Metrik [{0}] [{1}] als Standard für Ressourcen mit Typ-ID [{2}] ist fehlgeschlagen.
+datasource_templateSchedules_updated_failed=Aktualisieren des Zeitplans auf [{0}] Sekunden für das Sammeln von Daten für Metrik [{1}] [{2}] als Standard für Ressourcen mit Typ-ID [{3}] ist fehlgeschlagen.
view_table_drawFail=Konnte die Tabelle [{0}] nicht zeichnen.
view_dashboardManager_deleteFail=Konnte das Dashboard nicht löschen.
view_tree_common_loadFailed_group=Konnte die Gruppe mit ID [{0}] nicht laden
commit 32f014cc679547fb39547165beb08d48196dc369
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Dec 13 23:42:18 2010 -0500
remove resource overview page - its obsolete. "activity" subtab is now the one we are using
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 f2bd570..50e994f 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
@@ -61,7 +61,6 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitorin
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.traits.TraitsView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.OperationHistoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary.ActivityView;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary.OverviewView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
@@ -87,7 +86,6 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
private TwoLevelTab eventsTab;
private TwoLevelTab contentTab;
- private SubTab summaryOverview;
private SubTab summaryActivity;
private SubTab summaryTimeline;
private SubTab monitorGraphs;
@@ -124,13 +122,11 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
summaryTab = new TwoLevelTab(getTabSet().extendLocatorId("Summary"), new ViewName("Summary", MSG
.view_tabs_common_summary()), ImageManager.getResourceIcon(ResourceCategory.SERVICE, Boolean.TRUE));
- summaryOverview = new SubTab(summaryTab.extendLocatorId("Overview"), new ViewName("Overview", MSG
- .view_tabs_common_overview()), null);
summaryActivity = new SubTab(summaryTab.extendLocatorId("Activity"), new ViewName("Activity", MSG
.view_tabs_common_activity()), null);
summaryTimeline = new SubTab(summaryTab.extendLocatorId("Timeline"), new ViewName("Timeline", MSG
.view_tabs_common_timeline()), null);
- summaryTab.registerSubTabs(summaryOverview, summaryActivity, summaryTimeline);
+ summaryTab.registerSubTabs(summaryActivity, summaryTimeline);
tabs.add(summaryTab);
inventoryTab = new TwoLevelTab(getTabSet().extendLocatorId("Inventory"), new ViewName("Inventory", MSG
@@ -145,8 +141,6 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
"ConnectionSettingsHistory", MSG.view_tabs_common_connectionSettingsHistory()), null);
inventoryGroups = new SubTab(inventoryTab.extendLocatorId("Groups"), new ViewName("Groups", MSG
.view_tabs_common_groups()), null);
- //inventoryGroupMembership = new SubTab(inventoryTab.extendLocatorId("GroupMembership"), new ViewName(
- // "GroupMembership", MSG.view_tabs_common_group_membership()), null);
inventoryAgent = new SubTab(inventoryTab.extendLocatorId("Agent"), new ViewName("Agent", MSG
.view_tabs_common_agent()), null);
inventoryTab.registerSubTabs(this.inventoryChildren, this.inventoryChildHistory, this.inventoryConn,
@@ -251,9 +245,6 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
}
private void updateSummaryTabContent(Resource resource) {
- updateSubTab(this.summaryTab, this.summaryOverview, new OverviewView(this.summaryTab
- .extendLocatorId("OverviewView"), this.resourceComposite), true, true);
-
updateSubTab(this.summaryTab, this.summaryActivity, new ActivityView(this.summaryActivity
.extendLocatorId("View"), this.resourceComposite), true, true);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewView.java
deleted file mode 100644
index d7b787b..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewView.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary;
-
-import com.smartgwt.client.widgets.HTMLFlow;
-
-import org.rhq.core.domain.resource.composite.ResourceComposite;
-import org.rhq.enterprise.gui.coregui.client.RefreshableView;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
-
-/**
- * The Resource Summary>Overview tab.
- *
- * @author Lukas Krejci
- *
- * @deprecated This can be removed, since we now display the overview info in the collapsible pane above
- * the Resource tabs (ips, 12/10/10).
- */
-@Deprecated
-public class OverviewView extends LocatableVLayout implements RefreshableView {
-
- private OverviewForm form;
-
- public OverviewView(String locatorId, ResourceComposite resourceComposite) {
- super(locatorId);
- this.form = new OverviewForm(extendLocatorId("form"), resourceComposite);
- HTMLFlow separator = new HTMLFlow();
- separator.setContents("<hr>");
-
- form.setHeight("200");
- setLeft("10%");
-
- addMember(form);
- }
-
- @Override
- public void refresh() {
- form.loadData();
- }
-
-}
commit 084cdb16d42a49864392ecd9b5546950bf6677b7
Author: Joseph Marques <joseph(a)redhat.com>
Date: Mon Dec 13 16:53:21 2010 -0500
update sample settings.xml file to provide rhq.test.* and rhq.dev.* properties for each database
diff --git a/etc/m2/settings.xml b/etc/m2/settings.xml
index fc7d47f..8c0dada 100644
--- a/etc/m2/settings.xml
+++ b/etc/m2/settings.xml
@@ -105,6 +105,21 @@
<rhq.test.quartz.driverDelegateClass>org.quartz.impl.jdbcjobstore.PostgreSQLDelegate</rhq.test.quartz.driverDelegateClass>
<rhq.test.quartz.selectWithLockSQL>SELECT * FROM {0}LOCKS ROWLOCK WHERE LOCK_NAME = ? FOR UPDATE</rhq.test.quartz.selectWithLockSQL>
<rhq.test.quartz.lockHandlerClass>org.quartz.impl.jdbcjobstore.StdRowLockSemaphore</rhq.test.quartz.lockHandlerClass>
+
+ <rhq.dev.ds.connection-url>jdbc:postgresql://127.0.0.1:5432/rhq</rhq.dev.ds.connection-url>
+ <rhq.dev.ds.user-name>rhqadmin</rhq.dev.ds.user-name>
+ <rhq.dev.ds.password>rhqadmin</rhq.dev.ds.password>
+ <rhq.dev.ds.type-mapping>PostgreSQL</rhq.dev.ds.type-mapping>
+ <rhq.dev.ds.driver-class>org.postgresql.Driver</rhq.dev.ds.driver-class>
+ <rhq.dev.ds.xa-datasource-class>org.postgresql.xa.PGXADataSource</rhq.dev.ds.xa-datasource-class>
+ <rhq.dev.ds.server-name>127.0.0.1</rhq.dev.ds.server-name>
+ <rhq.dev.ds.port>5432</rhq.dev.ds.port>
+ <rhq.dev.ds.db-name>rhq</rhq.dev.ds.db-name>
+ <rhq.dev.ds.hibernate-dialect>org.hibernate.dialect.PostgreSQLDialect</rhq.dev.ds.hibernate-dialect>
+ <!-- quartz properties -->
+ <rhq.dev.quartz.driverDelegateClass>org.quartz.impl.jdbcjobstore.PostgreSQLDelegate</rhq.dev.quartz.driverDelegateClass>
+ <rhq.dev.quartz.selectWithLockSQL>SELECT * FROM {0}LOCKS ROWLOCK WHERE LOCK_NAME = ? FOR UPDATE</rhq.dev.quartz.selectWithLockSQL>
+ <rhq.dev.quartz.lockHandlerClass>org.quartz.impl.jdbcjobstore.StdRowLockSemaphore</rhq.dev.quartz.lockHandlerClass>
</properties>
</profile>
@@ -126,6 +141,22 @@
<rhq.test.quartz.driverDelegateClass>org.quartz.impl.jdbcjobstore.StdJDBCDelegate</rhq.test.quartz.driverDelegateClass>
<rhq.test.quartz.selectWithLockSQL>SELECT * FROM {0}LOCKS ROWLOCK WHERE LOCK_NAME = ? FOR UPDATE</rhq.test.quartz.selectWithLockSQL>
<rhq.test.quartz.lockHandlerClass>org.quartz.impl.jdbcjobstore.StdRowLockSemaphore</rhq.test.quartz.lockHandlerClass>
+
+ <rhq.dev.ds.driver-class>org.h2.Driver</rhq.dev.ds.driver-class>
+ <rhq.dev.ds.connection-url>jdbc:h2:~/rhq;MVCC=TRUE;DB_CLOSE_ON_EXIT=FALSE;LOG=2</rhq.dev.ds.connection-url>
+ <rhq.dev.ds.user-name>rhqadmin</rhq.dev.ds.user-name>
+ <rhq.dev.ds.password>rhqadmin</rhq.dev.ds.password>
+ <rhq.dev.ds.type-mapping>h2</rhq.dev.ds.type-mapping>
+ <rhq.dev.ds.xa-datasource-class>org.h2.jdbcx.JdbcDataSource</rhq.dev.ds.xa-datasource-class>
+ <rhq.dev.ds.server-name>127.0.0.1</rhq.dev.ds.server-name>
+ <rhq.dev.ds.port>9092</rhq.dev.ds.port>
+ <rhq.dev.ds.db-name>rhq</rhq.dev.ds.db-name>
+ <!-- This custom dialect is required for proper operation using H2, see class JavaDoc for more info -->
+ <rhq.dev.ds.hibernate-dialect>org.rhq.core.server.H2CustomDialect</rhq.dev.ds.hibernate-dialect>
+ <!-- quartz properties -->
+ <rhq.dev.quartz.driverDelegateClass>org.quartz.impl.jdbcjobstore.StdJDBCDelegate</rhq.dev.quartz.driverDelegateClass>
+ <rhq.dev.quartz.selectWithLockSQL>SELECT * FROM {0}LOCKS ROWLOCK WHERE LOCK_NAME = ? FOR UPDATE</rhq.dev.quartz.selectWithLockSQL>
+ <rhq.dev.quartz.lockHandlerClass>org.quartz.impl.jdbcjobstore.StdRowLockSemaphore</rhq.dev.quartz.lockHandlerClass>
</properties>
</profile>
@@ -146,6 +177,21 @@
<rhq.test.quartz.driverDelegateClass>org.quartz.impl.jdbcjobstore.MSSQLDelegate</rhq.test.quartz.driverDelegateClass>
<rhq.test.quartz.selectWithLockSQL>UPDATE {0}LOCKS SET LOCK_NAME = LOCK_NAME WHERE LOCK_NAME = ?</rhq.test.quartz.selectWithLockSQL>
<rhq.test.quartz.lockHandlerClass>org.quartz.impl.jdbcjobstore.UpdateLockRowSemaphore</rhq.test.quartz.lockHandlerClass>
+
+ <rhq.dev.ds.driver-class>net.sourceforge.jtds.jdbc.Driver</rhq.dev.ds.driver-class>
+ <rhq.dev.ds.connection-url>jdbc:jtds:sqlserver://localhost:1433;databaseName=rhq</rhq.dev.ds.connection-url>
+ <rhq.dev.ds.user-name>rhqadmin</rhq.dev.ds.user-name>
+ <rhq.dev.ds.password>rhqadmin</rhq.dev.ds.password>
+ <rhq.dev.ds.type-mapping>sqlserver</rhq.dev.ds.type-mapping>
+ <rhq.dev.ds.xa-datasource-class>net.sourceforge.jtds.jdbcx.JtdsDataSource</rhq.dev.ds.xa-datasource-class>
+ <rhq.dev.ds.server-name>localhost</rhq.dev.ds.server-name>
+ <rhq.dev.ds.port>1433</rhq.dev.ds.port>
+ <rhq.dev.ds.db-name>rhq</rhq.dev.ds.db-name>
+ <rhq.dev.ds.hibernate-dialect>org.hibernate.dialect.SQLServerDialect</rhq.dev.ds.hibernate-dialect>
+ <!-- quartz properties -->
+ <rhq.dev.quartz.driverDelegateClass>org.quartz.impl.jdbcjobstore.MSSQLDelegate</rhq.dev.quartz.driverDelegateClass>
+ <rhq.dev.quartz.selectWithLockSQL>UPDATE {0}LOCKS SET LOCK_NAME = LOCK_NAME WHERE LOCK_NAME = ?</rhq.dev.quartz.selectWithLockSQL>
+ <rhq.dev.quartz.lockHandlerClass>org.quartz.impl.jdbcjobstore.UpdateLockRowSemaphore</rhq.dev.quartz.lockHandlerClass>
</properties>
</profile>
@@ -166,6 +212,21 @@
<rhq.test.quartz.driverDelegateClass>org.quartz.impl.jdbcjobstore.oracle.OracleDelegate</rhq.test.quartz.driverDelegateClass>
<rhq.test.quartz.selectWithLockSQL>SELECT * FROM {0}LOCKS ROWLOCK WHERE LOCK_NAME = ? FOR UPDATE</rhq.test.quartz.selectWithLockSQL>
<rhq.test.quartz.lockHandlerClass>org.quartz.impl.jdbcjobstore.StdRowLockSemaphore</rhq.test.quartz.lockHandlerClass>
+
+ <rhq.dev.ds.connection-url>jdbc:oracle:thin:@127.0.0.1:1521:xe</rhq.dev.ds.connection-url>
+ <rhq.dev.ds.user-name>rhqadmin</rhq.dev.ds.user-name>
+ <rhq.dev.ds.password>rhqadmin</rhq.dev.ds.password>
+ <rhq.dev.ds.type-mapping>Oracle10g</rhq.dev.ds.type-mapping>
+ <rhq.dev.ds.driver-class>oracle.jdbc.driver.OracleDriver</rhq.dev.ds.driver-class>
+ <rhq.dev.ds.xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</rhq.dev.ds.xa-datasource-class>
+ <rhq.dev.ds.server-name></rhq.dev.ds.server-name> <!-- can be left blank, oracle does not use this -->
+ <rhq.dev.ds.port></rhq.dev.ds.port> <!-- can be left blank, oracle does not use this -->
+ <rhq.dev.ds.db-name></rhq.dev.ds.db-name> <!-- can be left blank, oracle does not use this -->
+ <rhq.dev.ds.hibernate-dialect>org.hibernate.dialect.Oracle10gDialect</rhq.dev.ds.hibernate-dialect>
+ <!-- quartz properties -->
+ <rhq.dev.quartz.driverDelegateClass>org.quartz.impl.jdbcjobstore.oracle.OracleDelegate</rhq.dev.quartz.driverDelegateClass>
+ <rhq.dev.quartz.selectWithLockSQL>SELECT * FROM {0}LOCKS ROWLOCK WHERE LOCK_NAME = ? FOR UPDATE</rhq.dev.quartz.selectWithLockSQL>
+ <rhq.dev.quartz.lockHandlerClass>org.quartz.impl.jdbcjobstore.StdRowLockSemaphore</rhq.dev.quartz.lockHandlerClass>
</properties>
</profile>
commit 917151ed255b6a96ddc12dd39cc5b8e0f53586bb
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Mon Dec 13 19:46:02 2010 -0500
3rd and hopefully final take of fix for https://bugzilla.redhat.com/show_bug.cgi?id=661528
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BookmarkableView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BookmarkableView.java
index 73eeceb..eccb940 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BookmarkableView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BookmarkableView.java
@@ -55,6 +55,10 @@ package org.rhq.enterprise.gui.coregui.client;
* }
* </code>
*
+ * <b>NOTE:</b> If the view implementing BookmarkableView also implements {@link RefreshableView}, the
+ * {@link #renderView} implementation is responsible for invoking {@link RefreshableView#refresh()} to ensure the
+ * view's data is fresh.
+ *
* @author Ian Springer
*/
public interface BookmarkableView {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/RefreshableView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/RefreshableView.java
index 162e950..6f078e0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/RefreshableView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/RefreshableView.java
@@ -29,4 +29,5 @@ public interface RefreshableView {
* Refresh this view, i.e. reload its data from the Server.
*/
void refresh();
+
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
index 7a4c292..0b2d1e6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
@@ -22,6 +22,7 @@
*/
package org.rhq.enterprise.gui.coregui.client.components.table;
+import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.History;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.data.SortSpecifier;
@@ -315,7 +316,9 @@ public abstract class TableSection<DS extends RPCDataSource> extends Table<DS> i
protected void switchToTableView() {
final Canvas contents = getTableContents();
if (contents != null) {
-
+ // First refresh the table's data.
+ Log.debug("Refreshing data for [" + getClass().getName() + "]...");
+ refresh();
if (detailsHolder != null && detailsHolder.isVisible()) {
detailsHolder.animateHide(AnimationEffect.WIPE, new AnimationCallback() {
@Override
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/AbstractSectionedLeftNavigationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/AbstractSectionedLeftNavigationView.java
index 5bab96c..0951e8d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/AbstractSectionedLeftNavigationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/AbstractSectionedLeftNavigationView.java
@@ -23,6 +23,7 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import com.allen_sauer.gwt.log.client.Log;
import com.smartgwt.client.types.VisibilityMode;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.grid.events.CellClickEvent;
@@ -54,6 +55,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableTreeGrid;
*/
public abstract class AbstractSectionedLeftNavigationView extends LocatableHLayout implements BookmarkableView,
InitializableView {
+
private String viewId;
private boolean initialized;
private ViewId currentSectionViewId;
@@ -222,8 +224,9 @@ public abstract class AbstractSectionedLeftNavigationView extends LocatableHLayo
} else {
if (this.currentContent instanceof BookmarkableView) {
((BookmarkableView) this.currentContent).renderView(viewPath.next().next());
- }
- if (this.currentContent instanceof RefreshableView) {
+ } else if (this.currentContent instanceof RefreshableView && this.currentContent.isDrawn()) {
+ // Refresh the data on the content pane, so it's not stale.
+ Log.debug("Refreshing data for [" + this.currentContent.getClass().getName() + "]...");
((RefreshableView) this.currentContent).refresh();
}
}
@@ -245,4 +248,5 @@ public abstract class AbstractSectionedLeftNavigationView extends LocatableHLayo
}
}
}
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
index a4f76c8..d36e17c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
@@ -240,9 +240,7 @@ public abstract class AbstractTwoLevelTabSetView<T, U extends Layout> extends Lo
if (subView instanceof BookmarkableView) {
// Handle any remaining view items (e.g. id of a selected item in a subtab that contains a Master-Details view).
((BookmarkableView) subView).renderView(viewPath);
- }
-
- if (subView instanceof RefreshableView && viewPath.isEnd() && subView.isDrawn()) {
+ } else if (subView instanceof RefreshableView && subView.isDrawn()) {
// Refresh the data on the subtab, so it's not stale.
Log.debug("Refreshing data for [" + subView.getClass().getName() + "]...");
((RefreshableView) subView).refresh();
commit 10366d80d5bb45b47012e939f180c9b2ba511b3f
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Dec 13 18:20:24 2010 -0500
remotely installing agents takes a long time, up the gwt timeout
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 17769a7..3241cd5 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
@@ -63,7 +63,7 @@ public class RemoteAgentInstallView extends LocatableVLayout {
public static final ViewName VIEW_ID = new ViewName("RemoteAgentInstall", MSG
.view_adminTopology_remoteAgentInstall());
- private RemoteInstallGWTServiceAsync remoteInstallService = GWTServiceLookup.getRemoteInstallService();
+ private RemoteInstallGWTServiceAsync remoteInstallService = GWTServiceLookup.getRemoteInstallService(600000);
private DynamicForm connectionForm;
private DynamicForm buttonsForm;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
index d5cb3c0..5ec9af2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
@@ -113,8 +113,8 @@ public class GWTServiceLookup {
return secure(TagGWTServiceAsync.Util.getInstance());
}
- public static RemoteInstallGWTServiceAsync getRemoteInstallService() {
- return secure(RemoteInstallGWTServiceAsync.Util.getInstance());
+ public static RemoteInstallGWTServiceAsync getRemoteInstallService(int timeout) {
+ return secure(RemoteInstallGWTServiceAsync.Util.getInstance(), timeout);
}
public static RepoGWTServiceAsync getRepoService() {
commit c1d60232ce99c61922b24fa488217ef4b8a010e7
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Dec 13 17:43:21 2010 -0500
ResourceTree Context menu work
- Instead of pop up dialogs for configuration view/edit, navigate to the
resource's config view and keep the interaction consistent.
- Protect the context menu options with user resource permission checking
- Don't select the right-clicked tree node because a right click does not
force navigation to the right-clicked resource.
- Use same "Connection Settings" title in context menu as found in
Inventory subtab. Removed obsolete property.
- Added a linkmanager call to get to a specific subtab (gwt only)
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 a1284ba..6528e76 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
@@ -40,6 +40,14 @@ public class LinkManager {
}
}
+ public static String getResourceTabLink(int resourceId, String tabName, String subTabName) {
+ if (GWT) {
+ return "#Resource/" + resourceId + "/" + tabName + ((null == subTabName) ? "" : ("/" + subTabName));
+ } else {
+ return "/rhq/resource/summary/overview.xhtml?id=" + resourceId;
+ }
+ }
+
public static String getResourceGroupLink(int groupId) {
if (GWT) {
return "#ResourceGroup/" + groupId;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupContextMenu.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupContextMenu.java
index 7d68c72..972ba73 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupContextMenu.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupContextMenu.java
@@ -92,7 +92,7 @@ public class ResourceGroupContextMenu extends LocatableMenu {
addItem(new MenuItem("Type: " + resourceType.getName()));
- MenuItem editPluginConfiguration = new MenuItem(MSG.view_tree_common_contextMenu_pluginConfiguration());
+ MenuItem editPluginConfiguration = new MenuItem(MSG.view_tabs_common_connectionSettings());
editPluginConfiguration.addClickHandler(new ClickHandler() {
public void onClick(MenuItemClickEvent event) {
int groupId = group.getId();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/NewResourceTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/NewResourceTreeView.java
index 4f899b9..93803a5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/NewResourceTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/NewResourceTreeView.java
@@ -191,7 +191,7 @@ public class NewResourceTreeView extends LocatableVLayout {
contextMenu.addItem(new MenuItem(MSG.view_tree_common_contextMenu_type_name_label(resourceType.getName())));
- MenuItem editPluginConfiguration = new MenuItem(MSG.view_tree_common_contextMenu_pluginConfiguration());
+ MenuItem editPluginConfiguration = new MenuItem(MSG.view_tabs_common_connectionSettings());
editPluginConfiguration.addClickHandler(new ClickHandler() {
public void onClick(MenuItemClickEvent event) {
int resourceId = resource.getId();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
index 92193a3..ffcfce4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
@@ -35,9 +35,6 @@ import com.smartgwt.client.data.DSCallback;
import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.types.SelectionStyle;
-import com.smartgwt.client.widgets.Window;
-import com.smartgwt.client.widgets.events.CloseClickHandler;
-import com.smartgwt.client.widgets.events.CloseClientEvent;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionEvent;
@@ -64,20 +61,23 @@ import org.rhq.core.domain.operation.OperationDefinition;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.resource.composite.ResourceLineageComposite;
+import org.rhq.core.domain.resource.composite.ResourcePermission;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.Breadcrumb;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
+import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.ViewId;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
-import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.inventory.resource.graph.GraphPortlet;
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.gwt.ResourceGroupGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceTypeGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.inventory.InventoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.ResourceGroupContextMenu;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.ResourceGroupDetailView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
@@ -197,9 +197,15 @@ public class ResourceTreeView extends LocatableVLayout {
treeGrid.addNodeContextClickHandler(new NodeContextClickHandler() {
public void onNodeContextClick(final NodeContextClickEvent event) {
- event.getNode();
+ // stop the browser right-click menu
event.cancel();
+ // don't select the node on a right click, since we're not navigating to it
+ treeGrid.deselectRecord(event.getNode());
+ if (null != selectedNodeId) {
+ treeGrid.selectRecord(treeGrid.getTree().findById(selectedNodeId));
+ }
+
if (event.getNode() instanceof AutoGroupTreeNode) {
showContextMenu((AutoGroupTreeNode) event.getNode());
} else if (event.getNode() instanceof ResourceTreeNode) {
@@ -354,161 +360,183 @@ public class ResourceTreeView extends LocatableVLayout {
}
private void showContextMenu(final ResourceTreeNode node) {
- ResourceType type = node.getResource().getResourceType();
- ResourceTypeRepository.Cache.getInstance().getResourceTypes(
- type.getId(),
- EnumSet.of(ResourceTypeRepository.MetadataType.operations, ResourceTypeRepository.MetadataType.children,
- ResourceTypeRepository.MetadataType.subCategory,
- ResourceTypeRepository.MetadataType.pluginConfigurationDefinition,
- ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
- new ResourceTypeRepository.TypeLoadedCallback() {
- public void onTypesLoaded(ResourceType type) {
- buildResourceContextMenu(node.getResource(), type);
- resourceContextMenu.showContextMenu();
+ final Resource resource = node.getResource();
+ final int resourceId = resource.getId();
+
+ // fetch the resource composite, we need resource permission info for enablement decisions
+ ResourceCriteria criteria = new ResourceCriteria();
+ criteria.addFilterId(resourceId);
+ GWTServiceLookup.getResourceService().findResourceCompositesByCriteria(criteria,
+ new AsyncCallback<PageList<ResourceComposite>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getMessageCenter().notify(
+ new Message(MSG.view_inventory_resource_loadFailed(String.valueOf(resourceId)),
+ Message.Severity.Warning));
+
+ CoreGUI.goToView(InventoryView.VIEW_ID.getName());
+ }
+
+ public void onSuccess(PageList<ResourceComposite> result) {
+ if (result.isEmpty()) {
+ onFailure(new Exception(MSG.view_inventory_resource_loadFailed(String.valueOf(resourceId))));
+ } else {
+ final ResourceComposite resourceComposite = result.get(0);
+
+ // make sure we have all the Type information necessary to render the menus
+ ResourceType type = resource.getResourceType();
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(
+ type.getId(),
+ EnumSet.of(ResourceTypeRepository.MetadataType.operations,
+ ResourceTypeRepository.MetadataType.children,
+ ResourceTypeRepository.MetadataType.subCategory,
+ ResourceTypeRepository.MetadataType.pluginConfigurationDefinition,
+ ResourceTypeRepository.MetadataType.resourceConfigurationDefinition,
+ ResourceTypeRepository.MetadataType.measurements),
+ new ResourceTypeRepository.TypeLoadedCallback() {
+ public void onTypesLoaded(ResourceType type) {
+ buildResourceContextMenu(resourceComposite, type);
+ resourceContextMenu.showContextMenu();
+ }
+ });
+ }
}
});
}
- private void buildResourceContextMenu(final Resource resource, final ResourceType resourceType) {
+ private void buildResourceContextMenu(final ResourceComposite resourceComposite, final ResourceType resourceType) {
+ final Resource resource = resourceComposite.getResource();
+ final ResourcePermission resourcePermission = resourceComposite.getResourcePermission();
+
+ // resource name
resourceContextMenu.setItems(new MenuItem(resource.getName()));
+ // resource type name
resourceContextMenu.addItem(new MenuItem(MSG.view_tree_common_contextMenu_type_name_label(resourceType
.getName())));
- MenuItem editPluginConfiguration = new MenuItem(MSG.view_tree_common_contextMenu_pluginConfiguration());
+ // separator
+ resourceContextMenu.addItem(new MenuItemSeparator());
+
+ // plugin config
+ MenuItem editPluginConfiguration = new MenuItem(MSG.view_tabs_common_connectionSettings());
editPluginConfiguration.addClickHandler(new ClickHandler() {
public void onClick(MenuItemClickEvent event) {
- int resourceId = resource.getId();
- int resourceTypeId = resourceType.getId();
-
- Window configEditor = new Window();
- configEditor.setTitle(MSG.view_tree_common_contextMenu_editPluginConfiguration(resource.getName()));
- configEditor.setWidth(800);
- configEditor.setHeight(800);
- configEditor.setIsModal(true);
- configEditor.setShowModalMask(true);
- configEditor.setCanDragResize(true);
- configEditor.centerInPage();
- configEditor.addItem(new ConfigurationEditor("PluginConfig-" + resource.getName(), resourceId,
- resourceTypeId, ConfigurationEditor.ConfigType.plugin));
- configEditor.show();
-
+ CoreGUI.goToView(LinkManager.getResourceTabLink(resource.getId(), "Inventory", "ConnectionSettings"));
}
});
editPluginConfiguration.setEnabled(resourceType.getPluginConfigurationDefinition() != null);
resourceContextMenu.addItem(editPluginConfiguration);
+ // resource config
MenuItem editResourceConfiguration = new MenuItem(MSG.view_tree_common_contextMenu_resourceConfiguration());
- editResourceConfiguration.addClickHandler(new ClickHandler() {
- public void onClick(MenuItemClickEvent event) {
- int resourceId = resource.getId();
- int resourceTypeId = resourceType.getId();
-
- final Window configEditor = new Window();
- configEditor.setTitle(MSG.view_tree_common_contextMenu_editResourceConfiguration(resource.getName()));
- configEditor.setWidth(800);
- configEditor.setHeight(800);
- configEditor.setIsModal(true);
- configEditor.setShowModalMask(true);
- configEditor.setCanDragResize(true);
- configEditor.setShowResizer(true);
- configEditor.centerInPage();
- configEditor.addCloseClickHandler(new CloseClickHandler() {
- public void onCloseClick(CloseClientEvent closeClientEvent) {
- configEditor.destroy();
- }
- });
- configEditor.addItem(new ConfigurationEditor("ResourceConfig-" + resource.getName(), resourceId,
- resourceTypeId, ConfigurationEditor.ConfigType.resource));
- configEditor.show();
-
- }
- });
- editResourceConfiguration.setEnabled(resourceType.getResourceConfigurationDefinition() != null);
+ boolean enabled = resourcePermission.isConfigureRead()
+ && resourceType.getResourceConfigurationDefinition() != null;
+ editResourceConfiguration.setEnabled(enabled);
+ if (enabled) {
+ editResourceConfiguration.addClickHandler(new ClickHandler() {
+ public void onClick(MenuItemClickEvent event) {
+ CoreGUI.goToView(LinkManager.getResourceTabLink(resource.getId(), "Configuration", "Current"));
+ }
+ });
+ }
resourceContextMenu.addItem(editResourceConfiguration);
+ // separator
resourceContextMenu.addItem(new MenuItemSeparator());
// Operations Menu
MenuItem operations = new MenuItem(MSG.view_tree_common_contextMenu_operations());
- Menu opSubMenu = new Menu();
- for (final OperationDefinition operationDefinition : resourceType.getOperationDefinitions()) {
- MenuItem operationItem = new MenuItem(operationDefinition.getDisplayName());
- operationItem.addClickHandler(new ClickHandler() {
- public void onClick(MenuItemClickEvent event) {
- int resourceId = ((ResourceTreeNode) treeGrid.getTree().findById(selectedNodeId)).getResource()
- .getId();
+ enabled = (resourcePermission.isControl() && !resourceType.getOperationDefinitions().isEmpty());
+ operations.setEnabled(enabled);
+ if (enabled) {
+ Menu opSubMenu = new Menu();
+ for (final OperationDefinition operationDefinition : resourceType.getOperationDefinitions()) {
+ MenuItem operationItem = new MenuItem(operationDefinition.getDisplayName());
+ operationItem.addClickHandler(new ClickHandler() {
+ public void onClick(MenuItemClickEvent event) {
+ int resourceId = ((ResourceTreeNode) treeGrid.getTree().findById(selectedNodeId)).getResource()
+ .getId();
- ResourceCriteria criteria = new ResourceCriteria();
- criteria.addFilterId(resourceId);
+ ResourceCriteria criteria = new ResourceCriteria();
+ criteria.addFilterId(resourceId);
- GWTServiceLookup.getResourceService().findResourcesByCriteria(criteria,
- new AsyncCallback<PageList<Resource>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(
- MSG.view_tree_common_contextMenu_operations_loadFailed(), caught);
- }
+ GWTServiceLookup.getResourceService().findResourcesByCriteria(criteria,
+ new AsyncCallback<PageList<Resource>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+ MSG.view_tree_common_contextMenu_operations_loadFailed(), caught);
+ }
- public void onSuccess(PageList<Resource> result) {
- new OperationCreateWizard(result.get(0), operationDefinition).startOperationWizard();
- }
- });
+ public void onSuccess(PageList<Resource> result) {
+ new OperationCreateWizard(result.get(0), operationDefinition)
+ .startOperationWizard();
+ }
+ });
- }
- });
- opSubMenu.addItem(operationItem);
- // todo action
+ }
+ });
+ opSubMenu.addItem(operationItem);
+ // todo action
+ }
+ operations.setSubmenu(opSubMenu);
}
- operations.setEnabled(!resourceType.getOperationDefinitions().isEmpty());
- operations.setSubmenu(opSubMenu);
resourceContextMenu.addItem(operations);
+ // Metric graph addition menu
resourceContextMenu.addItem(buildMetricsMenu(resourceType));
- // Create Menu
+ // Create Child Menu
MenuItem createChildMenu = new MenuItem(MSG.common_button_create_child());
- Menu createChildSubMenu = new Menu();
- for (final ResourceType childType : resourceType.getChildResourceTypes()) {
- if (childType.isCreatable()) {
- MenuItem createItem = new MenuItem(childType.getName());
-
- createItem.addClickHandler(new ClickHandler() {
- public void onClick(MenuItemClickEvent event) {
- ResourceFactoryCreateWizard.showCreateWizard(resource, childType);
- }
- });
+ enabled = resourcePermission.isCreateChildResources();
+ if (enabled) {
+ Menu createChildSubMenu = new Menu();
+ for (final ResourceType childType : resourceType.getChildResourceTypes()) {
+ if (childType.isCreatable()) {
+ MenuItem createItem = new MenuItem(childType.getName());
+
+ createItem.addClickHandler(new ClickHandler() {
+ public void onClick(MenuItemClickEvent event) {
+ ResourceFactoryCreateWizard.showCreateWizard(resource, childType);
+ }
+ });
- createChildSubMenu.addItem(createItem);
+ createChildSubMenu.addItem(createItem);
+ }
}
+ createChildMenu.setSubmenu(createChildSubMenu);
+ enabled = createChildSubMenu.getItems().length > 0;
}
- createChildMenu.setSubmenu(createChildSubMenu);
- createChildMenu.setEnabled(createChildSubMenu.getItems().length > 0);
+ createChildMenu.setEnabled(enabled);
resourceContextMenu.addItem(createChildMenu);
- // Manually Add Menu
+ // Manual Import Menu
MenuItem importChildMenu = new MenuItem(MSG.common_button_import());
- Menu importChildSubMenu = new Menu();
- for (final ResourceType childType : resourceType.getChildResourceTypes()) {
- if (childType.isSupportsManualAdd()) {
- MenuItem importItem = new MenuItem(childType.getName());
+ enabled = resourcePermission.isCreateChildResources();
+ if (enabled) {
+ Menu importChildSubMenu = new Menu();
+ for (final ResourceType childType : resourceType.getChildResourceTypes()) {
+ if (childType.isSupportsManualAdd()) {
+ MenuItem importItem = new MenuItem(childType.getName());
+
+ importItem.addClickHandler(new ClickHandler() {
+ public void onClick(MenuItemClickEvent event) {
+ ResourceFactoryImportWizard.showImportWizard(resource, childType);
+ }
+ });
- importItem.addClickHandler(new ClickHandler() {
- public void onClick(MenuItemClickEvent event) {
- ResourceFactoryImportWizard.showImportWizard(resource, childType);
- }
- });
+ importChildSubMenu.addItem(importItem);
+ }
+ }
- importChildSubMenu.addItem(importItem);
+ if (resourceType.getCategory() == ResourceCategory.PLATFORM) {
+ loadManuallyAddServersToPlatforms(importChildSubMenu, resource);
}
- }
- if (resourceType.getCategory() == ResourceCategory.PLATFORM) {
- loadManuallyAddServersToPlatforms(importChildSubMenu, resource);
+ importChildMenu.setSubmenu(importChildSubMenu);
+ enabled = importChildSubMenu.getItems().length > 0;
}
-
- importChildMenu.setSubmenu(importChildSubMenu);
- importChildMenu.setEnabled(importChildSubMenu.getItems().length > 0);
+ importChildMenu.setEnabled(enabled);
resourceContextMenu.addItem(importChildMenu);
}
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 33ff980..f5d15c3 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
@@ -1300,7 +1300,6 @@ view_tree_common_contextMenu_loadFail_children = Failed to load platform manual
view_tree_common_contextMenu_loadFail_dashboards = Failed to load user dashboards
view_tree_common_contextMenu_loadFail_group = Failed to load group for context menu
view_tree_common_contextMenu_type_name_label = Type: {0}
-view_tree_common_contextMenu_pluginConfiguration = Plugin Configuration
view_tree_common_contextMenu_resourceConfiguration = Resource Configuration
view_tree_common_contextMenu_editPluginConfiguration = Edit [{0}] Plugin Configuration
view_tree_common_contextMenu_editResourceConfiguration = Edit [{0}] Resource Configuration
commit ea307199f414e3f155c4ababaabb5fee769c6c9c
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Mon Dec 13 12:30:56 2010 -0500
2nd attempt at fixing subtab refresh when switching back to a subtab from another subtab on the same Resource or group, hopefully this time without breaking TableSection detail views (https://bugzilla.redhat.com/show_bug.cgi?id=661528); disable ack-all and delete-all buttons on alert history view if there are 0 alerts in the history
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 d84b01f..bf936be 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
@@ -29,6 +29,7 @@ import com.smartgwt.client.types.MultipleAppearance;
import com.smartgwt.client.types.SortDirection;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.form.fields.SelectItem;
+import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
@@ -38,6 +39,7 @@ import org.rhq.core.domain.criteria.AlertCriteria;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableAction;
+import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
import org.rhq.enterprise.gui.coregui.client.components.table.TableSection;
import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
@@ -112,8 +114,6 @@ public class AlertHistoryView extends TableSection<AlertDataSource> {
private void setupTableInteractions() {
TableActionEnablement singleTargetEnablement = hasWriteAccess ? TableActionEnablement.ANY
: TableActionEnablement.NEVER;
- TableActionEnablement multipleTargetEnablement = hasWriteAccess ? TableActionEnablement.ALWAYS
- : TableActionEnablement.NEVER;
addTableAction("DeleteAlert", MSG.common_button_delete(), MSG.view_alerts_delete_confirm(),
new AbstractTableAction(singleTargetEnablement) {
@@ -122,7 +122,12 @@ public class AlertHistoryView extends TableSection<AlertDataSource> {
}
});
addTableAction("DeleteAll", MSG.common_button_delete_all(), MSG.view_alerts_delete_confirm_all(),
- new AbstractTableAction(multipleTargetEnablement) {
+ new TableAction() {
+ public boolean isEnabled(ListGridRecord[] selection) {
+ ListGrid grid = getListGrid();
+ return (hasWriteAccess && grid != null && (getListGrid().getRecords().length >= 1));
+ }
+
public void executeAction(ListGridRecord[] selection, Object actionValue) {
deleteAll();
}
@@ -134,7 +139,12 @@ public class AlertHistoryView extends TableSection<AlertDataSource> {
}
});
addTableAction("AcknowledgeAll", MSG.common_button_ack_all(), MSG.view_alerts_ack_confirm_all(),
- new AbstractTableAction(multipleTargetEnablement) {
+ new TableAction() {
+ public boolean isEnabled(ListGridRecord[] selection) {
+ ListGrid grid = getListGrid();
+ return (hasWriteAccess && grid != null && (grid.getRecords().length >= 1));
+ }
+
public void executeAction(ListGridRecord[] selection, Object actionValue) {
acknowledgeAll();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
index fb1fec9..eeb428b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
@@ -26,6 +26,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
+import com.allen_sauer.gwt.log.client.Log;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.data.DSCallback;
import com.smartgwt.client.data.DSRequest;
@@ -476,7 +477,7 @@ public class Table<DS extends RPCDataSource> extends LocatableHLayout implements
}
public void refresh() {
- if (null != this.listGrid) {
+ if (null != this.listGrid) {
this.listGrid.invalidateCache();
this.listGrid.markForRedraw();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
index 6040959..a4f76c8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
@@ -240,11 +240,12 @@ public abstract class AbstractTwoLevelTabSetView<T, U extends Layout> extends Lo
if (subView instanceof BookmarkableView) {
// Handle any remaining view items (e.g. id of a selected item in a subtab that contains a Master-Details view).
((BookmarkableView) subView).renderView(viewPath);
- } else if (subView instanceof RefreshableView) {
- if (subView.isDrawn()) {
- // Refresh the data on the subtab, so it's not stale.
- ((RefreshableView) subView).refresh();
- }
+ }
+
+ if (subView instanceof RefreshableView && viewPath.isEnd() && subView.isDrawn()) {
+ // Refresh the data on the subtab, so it's not stale.
+ Log.debug("Refreshing data for [" + subView.getClass().getName() + "]...");
+ ((RefreshableView) subView).refresh();
}
this.tabSet.markForRedraw();
commit 20347e5bafd43473101b5a5f27977ba9a1ad3690
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Dec 13 10:56:03 2010 -0500
fix the width problem - now the editable form items are as wide as the rest of the form items.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EditableFormItem.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EditableFormItem.java
index 7f1a96c..09c2273 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EditableFormItem.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EditableFormItem.java
@@ -99,6 +99,7 @@ public class EditableFormItem extends CanvasItem {
this.editItem = prepareEditFormItem();
this.innerForm.setItems(staticItem, editItem);
this.innerForm.setCanFocus(true);
+ this.innerForm.setNumCols(1);
// if we are not in edit-mode, we want to show the edit icon, but only if the mouse hovers over us
this.innerForm.addMouseOutHandler(new MouseOutHandler() {
commit c4003544a82e3aa8f0a1c4b67f9b67b00b7c2ee7
Merge: 7521850... 11720e2...
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Mon Dec 13 10:00:37 2010 -0500
Merge branch 'track-master'
commit 11720e297face9b2e4736ca8f581817afa8f223d
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Sun Dec 12 15:58:10 2010 -0500
oops. Forgot assignment.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java
index 8ca8525..ad26a09 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java
@@ -570,7 +570,7 @@ class AlertResourceSelectorRegion extends LocatableVLayout {
public Integer[] getListGridValues() {
Integer[] listGridValues = new Integer[0];
if (null != selector) {
- selector.getAssignedListGridValues();
+ listGridValues = selector.getAssignedListGridValues();
}
return listGridValues;
}
commit b62561e0cfc02e90d86c1c1fea5308ba5a3e70e3
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Sun Dec 12 14:57:01 2010 -0500
fix recent alert portlet resource filtration ui bug. Refactored away use of deprecated methods.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java
index 07d204b..8ca8525 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java
@@ -19,9 +19,6 @@
package org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.alerts;
import com.google.gwt.user.client.Timer;
-import com.smartgwt.client.data.Record;
-import com.smartgwt.client.data.RecordList;
-import com.smartgwt.client.types.ListGridFieldType;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.form.DynamicForm;
@@ -31,9 +28,6 @@ import com.smartgwt.client.widgets.form.fields.SelectItem;
import com.smartgwt.client.widgets.form.fields.SpacerItem;
import com.smartgwt.client.widgets.form.fields.events.ChangeEvent;
import com.smartgwt.client.widgets.form.fields.events.ChangeHandler;
-import com.smartgwt.client.widgets.grid.ListGridField;
-import com.smartgwt.client.widgets.grid.events.DataArrivedEvent;
-import com.smartgwt.client.widgets.grid.events.DataArrivedHandler;
import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.alert.AlertPriority;
@@ -50,11 +44,11 @@ import org.rhq.enterprise.gui.coregui.client.dashboard.CustomSettingsPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletWindow;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.selection.ResourceSelector;
import org.rhq.enterprise.gui.coregui.client.util.MeasurementUtility;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableLabel;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
* @author Simeon Pinder
@@ -442,14 +436,17 @@ public class RecentAlertsPortlet extends AlertHistoryView implements CustomSetti
//if portlet config setting exist, then retrieve
Integer[] alertFilterResourceIds = null;
alertFilterResourceIds = getDataSource().extractFilterResourceIds(storedPortlet, alertFilterResourceIds);
- if (alertFilterResourceIds != null) {
- getDataSource().setAlertFilterResourceId(alertFilterResourceIds);
- }
LocatableHLayout resourceSelectionRegion = new LocatableHLayout(extendLocatorId("selection-canvas"));
- resourceSelector = new AlertResourceSelectorRegion(alertFilterResourceIds);
+ resourceSelector = new AlertResourceSelectorRegion(extendLocatorId("ResourcesWithAlerts"),
+ alertFilterResourceIds);
resourceSelectionRegion.setWidth100();
+ if (alertFilterResourceIds != null) {
+ getDataSource().setAlertFilterResourceId(alertFilterResourceIds);
+ resourceSelector.setCurrentlyAssignedIds(alertFilterResourceIds);
+ }
+
//instantiate canvas area to display empty or rich resource selection based on dropdown selection
containerCanvas = new Canvas();
String previousAlertFilterChoice = storedPortlet.getConfiguration().getSimple(ALERT_RANGE_RESOURCES_VALUE)
@@ -555,9 +552,14 @@ public class RecentAlertsPortlet extends AlertHistoryView implements CustomSetti
/** Bundles a ResourceSelector instance with labelling in Canvas for display.
* Also modifies the AssignedGrid to listen for AvailbleGrid completion and act accordingly.
*/
-class AlertResourceSelectorRegion {
+class AlertResourceSelectorRegion extends LocatableVLayout {
+ public AlertResourceSelectorRegion(String locatorId, Integer[] assigned) {
+ super(locatorId);
+ this.currentlyAssignedIds = assigned;
+ }
+
private static final Messages MSG = CoreGUI.getMessages();
- private ResourceSelector selector = null;
+ private PortletAlertSelector selector = null;
private Integer[] currentlyAssignedIds;
@@ -567,62 +569,16 @@ class AlertResourceSelectorRegion {
public Integer[] getListGridValues() {
Integer[] listGridValues = new Integer[0];
- if ((null != selector) && (null != selector.getAssignedGrid())) {
- RecordList allRecords = selector.getAssignedGrid().getDataAsRecordList();
- if (allRecords.getLength() > 0) {
- listGridValues = new Integer[allRecords.getLength()];
- for (int i = 0; i < allRecords.getLength(); i++) {
- Record record = allRecords.get(i);
- listGridValues[i] = record.getAttributeAsInt(RecentAlertsPortlet.ID);
- }
- }
+ if (null != selector) {
+ selector.getAssignedListGridValues();
}
return listGridValues;
}
- public AlertResourceSelectorRegion(Integer[] assigned) {
- this.currentlyAssignedIds = assigned;
- }
-
public Canvas getCanvas() {
if (selector == null) {
- selector = new ResourceSelector(MSG.view_portlet_recentAlerts_config_members(),
- ResourceType.ANY_PLATFORM_TYPE, true);
- selector.setWidth100();
- selector.setWidth(RecentAlertsPortlet.ALERT_RESOURCE_SELECTION_WIDTH);
- //widget ui updates
- selector.getAvailableGrid().setTitle(MSG.common_title_available_resources());
- selector.getAvailableGrid().setEmptyMessage(MSG.common_msg_loading());
- selector.getAssignedGrid().setTitle(MSG.common_title_selected_resources());
- //disable display typeFilter.
- selector.setDisplayResourceTypeFilter(false);
-
- //populate fields for grid.
- ListGridField nameField = new ListGridField("name", MSG.common_title_name());
- ListGridField iconField = new ListGridField("icon", MSG.common_title_icon(), 50);
- iconField.setImageURLPrefix("types/");
- iconField.setType(ListGridFieldType.ICON);
- selector.getAssignedGrid().setFields(iconField, nameField);
-
- //add listener to AvailableGrid, to act after successfully populated.
- selector.getAvailableGrid().addDataArrivedHandler(new DataArrivedHandler() {
- @Override
- public void onDataArrived(DataArrivedEvent event) {
- if ((getCurrentlyAssignedIds() != null) && (getCurrentlyAssignedIds().length > 0)) {
- //retrieve the loaded data and add to the table itself
- RecordList recordList = selector.getAvailableGrid().getDataAsRecordList();
- //for each of the resource ids loaded from settings, select that row for transfer.
- for (int ci : getCurrentlyAssignedIds()) {
- int located = recordList.findIndex("id", ci);
- if (located > -1) {
- selector.getAvailableGrid().selectRecord(located);
- }
- }
- //simulate 'add' button push.
- selector.addSelectedRows();
- }
- }
- });
+ selector = new PortletAlertSelector(extendLocatorId("AlertSelector"), this.currentlyAssignedIds,
+ ResourceType.ANY_PLATFORM_TYPE, false);
}
return selector;
}
@@ -630,4 +586,4 @@ class AlertResourceSelectorRegion {
public void setCurrentlyAssignedIds(Integer[] currentlyAssignedIds) {
this.currentlyAssignedIds = currentlyAssignedIds;
}
-}
+}
\ 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 defb4a1..33ff980 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
@@ -1202,6 +1202,7 @@ view_portlet_recentAlerts_config_members = Select Members
view_portlet_recentAlerts_config_priority_label = priority Alerts,
view_portlet_recentAlerts_config_when = within the past
view_portlet_recentAlerts_help_msg = Displays recent alerts fired on resources visible to the current user login.
+view_portlet_recentAlerts_fail_msg = Failed to load resources assigned for alert filtering.
# // dup in common
view_portlet_recentAlerts_title = Recent Alerts
view_portlet_recentlyAdded_approved_platforms = recently approved platforms on dashboard.
commit c8abbf40631f646b83d70bdb8c02ed526baf0ae0
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Sun Dec 12 14:51:38 2010 -0500
refactor of portlet alert resource filter selector.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/PortletAlertSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/PortletAlertSelector.java
new file mode 100644
index 0000000..c6ffa2a
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/PortletAlertSelector.java
@@ -0,0 +1,97 @@
+/*
+ * 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.dashboard.portlets.recent.alerts;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.Record;
+import com.smartgwt.client.data.RecordList;
+import com.smartgwt.client.types.ListGridFieldType;
+import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+import org.rhq.core.domain.criteria.ResourceCriteria;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.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.inventory.resource.ResourceDatasource;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.selection.ResourceSelector;
+
+/**
+ * @author Simeon Pinder
+ */
+public class PortletAlertSelector extends ResourceSelector {
+
+ public PortletAlertSelector(String locatorId, Integer[] currentlyAssignedIds, ResourceType resourceTypeFilter,
+ boolean forceResourceTypeFilter) {
+ super(locatorId, resourceTypeFilter, forceResourceTypeFilter);
+
+ //populate fields for grid.
+ ListGridField nameField = new ListGridField("name", MSG.common_title_name());
+ ListGridField iconField = new ListGridField("icon", MSG.common_title_icon(), 50);
+ iconField.setImageURLPrefix("types/");
+ iconField.setType(ListGridFieldType.ICON);
+ assignedGrid.setFields(iconField, nameField);
+
+ setWidth(RecentAlertsPortlet.ALERT_RESOURCE_SELECTION_WIDTH);
+
+ //retrieve the previously assigned resource ids
+ if ((currentlyAssignedIds != null) && currentlyAssignedIds.length > 0) {
+ //build listgrid records
+ ResourceCriteria criteria = new ResourceCriteria();
+ criteria.addFilterIds(currentlyAssignedIds);
+
+ GWTServiceLookup.getResourceService().findResourcesByCriteria(criteria,
+ new AsyncCallback<PageList<Resource>>() {
+ @Override
+ public void onSuccess(PageList<Resource> result) {
+ if (result.size() > 0) {
+ ListGridRecord[] data = (new ResourceDatasource()).buildRecords(result);
+ assignedGrid.setData(data);
+ }
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_portlet_recentAlerts_fail_msg(), caught);
+ }
+ });
+ }
+ }
+
+ public Integer[] getAssignedListGridValues() {
+ Integer[] listGridValues = new Integer[0];
+ if ((null != assignedGrid)) {
+ RecordList allRecords = assignedGrid.getDataAsRecordList();
+ if (allRecords.getLength() > 0) {
+ listGridValues = new Integer[allRecords.getLength()];
+ for (int i = 0; i < allRecords.getLength(); i++) {
+ Record record = allRecords.get(i);
+ listGridValues[i] = record.getAttributeAsInt(RecentAlertsPortlet.ID);
+ }
+ }
+ }
+ return listGridValues;
+ }
+}
commit 4274a46c50244c0b29ed0d82cfd74272d223f164
Author: Joseph Marques <joseph(a)redhat.com>
Date: Sun Dec 12 22:52:30 2010 -0500
cosmetic - relayout according to formatting conventions
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
index beebe28..19994ec 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
@@ -42,8 +42,8 @@ import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
* @author Greg Hinkle
*/
public class ConfigurationHistoryView extends TableSection {
- public static final ViewName VIEW_ID = new ViewName("RecentConfigurationChanges", MSG
- .view_configurationHistoryList_title());
+ public static final ViewName VIEW_ID = new ViewName("RecentConfigurationChanges",
+ MSG.view_configurationHistoryList_title());
private Integer resourceId;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
index e232b0d..fb649cc 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
@@ -76,8 +76,8 @@ public class OperationHistoryView extends TableSection<OperationHistoryDataSourc
}
public OperationHistoryView(String locatorId, ResourceComposite resourceComposite) {
- super(locatorId, VIEW_ID.getTitle(), new Criteria(OperationHistoryDataSource.CriteriaField.RESOURCE_ID, String
- .valueOf(resourceComposite.getResource().getId())));
+ super(locatorId, VIEW_ID.getTitle(), new Criteria(OperationHistoryDataSource.CriteriaField.RESOURCE_ID,
+ String.valueOf(resourceComposite.getResource().getId())));
this.composite = resourceComposite;
setDataSource(new OperationHistoryDataSource());
@@ -87,14 +87,14 @@ public class OperationHistoryView extends TableSection<OperationHistoryDataSourc
protected void configureTable() {
ListGridField idField = new ListGridField(OperationHistoryDataSource.Field.ID, MSG.common_title_id());
- ListGridField opNameField = new ListGridField(OperationHistoryDataSource.Field.OPERATION_NAME, MSG
- .dataSource_operationHistory_operationName());
+ ListGridField opNameField = new ListGridField(OperationHistoryDataSource.Field.OPERATION_NAME,
+ MSG.dataSource_operationHistory_operationName());
- ListGridField subjectField = new ListGridField(OperationHistoryDataSource.Field.SUBJECT, MSG
- .common_title_user());
+ ListGridField subjectField = new ListGridField(OperationHistoryDataSource.Field.SUBJECT,
+ MSG.common_title_user());
- ListGridField statusField = new ListGridField(OperationHistoryDataSource.Field.STATUS, MSG
- .common_title_status());
+ ListGridField statusField = new ListGridField(OperationHistoryDataSource.Field.STATUS,
+ MSG.common_title_status());
statusField.setAlign(Alignment.CENTER);
statusField.setCellAlign(Alignment.CENTER);
statusField.setShowHover(true);
@@ -170,8 +170,8 @@ public class OperationHistoryView extends TableSection<OperationHistoryDataSourc
}
});
- ListGridField startedTimeField = new ListGridField(OperationHistoryDataSource.Field.STARTED_TIME, MSG
- .dataSource_operationHistory_startedTime());
+ ListGridField startedTimeField = new ListGridField(OperationHistoryDataSource.Field.STARTED_TIME,
+ MSG.dataSource_operationHistory_startedTime());
startedTimeField.setType(ListGridFieldType.DATE);
startedTimeField.setDateFormatter(DateDisplayFormat.TOLOCALESTRING);
startedTimeField.setAlign(Alignment.LEFT);
@@ -180,8 +180,8 @@ public class OperationHistoryView extends TableSection<OperationHistoryDataSourc
final Resource resource = this.composite.getResource();
if (resource == null) { // if null, we aren't viewing op history for a single resource
- ListGridField resourceField = new ListGridField(OperationHistoryDataSource.Field.RESOURCE, MSG
- .common_title_resource());
+ ListGridField resourceField = new ListGridField(OperationHistoryDataSource.Field.RESOURCE,
+ MSG.common_title_resource());
resourceField.setAlign(Alignment.LEFT);
resourceField.setCellAlign(Alignment.LEFT);
resourceField.setCellFormatter(new CellFormatter() {
@@ -227,8 +227,8 @@ public class OperationHistoryView extends TableSection<OperationHistoryDataSourc
}
});
- IMenuButton operationsButton = new LocatableIMenuButton(this.extendLocatorId("Run"), MSG
- .view_operationHistoryList_button_runOperation(), operationMenu);
+ IMenuButton operationsButton = new LocatableIMenuButton(this.extendLocatorId("Run"),
+ MSG.view_operationHistoryList_button_runOperation(), operationMenu);
operationsButton.setShowMenuBelow(false);
operationsButton.setAutoFit(true);
addExtraWidget(operationsButton);
commit 995e5ac70be8f2b3ca0384c04e23abc08debcad6
Author: Joseph Marques <joseph(a)redhat.com>
Date: Sun Dec 12 22:51:53 2010 -0500
improve hyperlink implementation to navigation from master to details view
* instead of subclasses having to override a method that knows how to get the ListGridField
for the column they wish to link to the details view, just have them return the string
name of the column. this centralizes the error handling (null checks for ListGrid and
ListGridField), and makes the contract easier to implement for subclasses.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
index 5ab13b6..7a4c292 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
@@ -40,7 +40,6 @@ import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.DetailsView;
-import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.components.buttons.BackButton;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
@@ -111,13 +110,14 @@ public abstract class TableSection<DS extends RPCDataSource> extends Table<DS> i
protected void onDraw() {
super.onDraw();
- // Make the value of the name field a link to the details view for the corresponding record.
- ListGridField nameField = getNameField();
- if (nameField != null) {
- nameField.setCellFormatter(new CellFormatter() {
+ // Make the value of some specific field a link to the details view for the corresponding record
+ ListGrid grid = getListGrid();
+ ListGridField field = (grid != null) ? grid.getField(getDetailsLinkColumnName()) : null;
+ if (field != null) {
+ field.setCellFormatter(new CellFormatter() {
public String format(Object value, ListGridRecord record, int i, int i1) {
Integer recordId = getId(record);
- String detailsUrl = "#" + TableSection.this.basePath + "/" + recordId;
+ String detailsUrl = "#" + getBasePath() + "/" + recordId;
return SeleniumUtility.getLocatableHref(detailsUrl, value.toString(), null);
}
});
@@ -132,9 +132,8 @@ public abstract class TableSection<DS extends RPCDataSource> extends Table<DS> i
});
}
- protected ListGridField getNameField() {
- ListGrid grid = getListGrid();
- return (grid != null) ? grid.getField(FIELD_NAME) : null;
+ protected String getDetailsLinkColumnName() {
+ return FIELD_NAME;
}
/**
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
index 860339b..beebe28 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
@@ -24,7 +24,6 @@ import java.util.List;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.grid.CellFormatter;
-import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
@@ -143,9 +142,8 @@ public class ConfigurationHistoryView extends TableSection {
}
@Override
- protected ListGridField getNameField() {
- ListGrid grid = getListGrid();
- return (grid != null) ? grid.getField(FIELD_ID) : null;
+ protected String getDetailsLinkColumnName() {
+ return FIELD_ID;
}
@Override
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
index 9e8d660..e232b0d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
@@ -32,7 +32,6 @@ import com.smartgwt.client.widgets.events.CloseClickHandler;
import com.smartgwt.client.widgets.events.CloseClientEvent;
import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.HoverCustomizer;
-import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
@@ -238,9 +237,8 @@ public class OperationHistoryView extends TableSection<OperationHistoryDataSourc
}
@Override
- protected ListGridField getNameField() {
- // TODO: What field if any should we return here?
- return null;
+ protected String getDetailsLinkColumnName() {
+ return OperationHistoryDataSource.Field.OPERATION_NAME;
}
@Override
commit afd18a628eb1a8e101a005b1be96f65f2b453763
Author: Joseph Marques <joseph(a)redhat.com>
Date: Sun Dec 12 22:45:59 2010 -0500
rollback part of b20dc08 (BZ-661528) -- master/details navigation is otherwise broken
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
index 91f42a8..6040959 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
@@ -236,8 +236,8 @@ public abstract class AbstractTwoLevelTabSetView<T, U extends Layout> extends Lo
this.tabSet.selectTab(tab);
}
- Canvas subView = subtab.getCanvas();
- if (subView instanceof BookmarkableView && !viewPath.isEnd()) {
+ Canvas subView = subtab.getCanvas();
+ if (subView instanceof BookmarkableView) {
// Handle any remaining view items (e.g. id of a selected item in a subtab that contains a Master-Details view).
((BookmarkableView) subView).renderView(viewPath);
} else if (subView instanceof RefreshableView) {
commit 7521850ce1a76409a6fe11f5d3e0961e6ca8832a
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Sun Dec 12 14:51:38 2010 -0500
refactor of portlet alert resource filter selector.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/PortletAlertSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/PortletAlertSelector.java
new file mode 100644
index 0000000..c6ffa2a
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/PortletAlertSelector.java
@@ -0,0 +1,97 @@
+/*
+ * 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.dashboard.portlets.recent.alerts;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.Record;
+import com.smartgwt.client.data.RecordList;
+import com.smartgwt.client.types.ListGridFieldType;
+import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+import org.rhq.core.domain.criteria.ResourceCriteria;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.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.inventory.resource.ResourceDatasource;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.selection.ResourceSelector;
+
+/**
+ * @author Simeon Pinder
+ */
+public class PortletAlertSelector extends ResourceSelector {
+
+ public PortletAlertSelector(String locatorId, Integer[] currentlyAssignedIds, ResourceType resourceTypeFilter,
+ boolean forceResourceTypeFilter) {
+ super(locatorId, resourceTypeFilter, forceResourceTypeFilter);
+
+ //populate fields for grid.
+ ListGridField nameField = new ListGridField("name", MSG.common_title_name());
+ ListGridField iconField = new ListGridField("icon", MSG.common_title_icon(), 50);
+ iconField.setImageURLPrefix("types/");
+ iconField.setType(ListGridFieldType.ICON);
+ assignedGrid.setFields(iconField, nameField);
+
+ setWidth(RecentAlertsPortlet.ALERT_RESOURCE_SELECTION_WIDTH);
+
+ //retrieve the previously assigned resource ids
+ if ((currentlyAssignedIds != null) && currentlyAssignedIds.length > 0) {
+ //build listgrid records
+ ResourceCriteria criteria = new ResourceCriteria();
+ criteria.addFilterIds(currentlyAssignedIds);
+
+ GWTServiceLookup.getResourceService().findResourcesByCriteria(criteria,
+ new AsyncCallback<PageList<Resource>>() {
+ @Override
+ public void onSuccess(PageList<Resource> result) {
+ if (result.size() > 0) {
+ ListGridRecord[] data = (new ResourceDatasource()).buildRecords(result);
+ assignedGrid.setData(data);
+ }
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_portlet_recentAlerts_fail_msg(), caught);
+ }
+ });
+ }
+ }
+
+ public Integer[] getAssignedListGridValues() {
+ Integer[] listGridValues = new Integer[0];
+ if ((null != assignedGrid)) {
+ RecordList allRecords = assignedGrid.getDataAsRecordList();
+ if (allRecords.getLength() > 0) {
+ listGridValues = new Integer[allRecords.getLength()];
+ for (int i = 0; i < allRecords.getLength(); i++) {
+ Record record = allRecords.get(i);
+ listGridValues[i] = record.getAttributeAsInt(RecentAlertsPortlet.ID);
+ }
+ }
+ }
+ return listGridValues;
+ }
+}
commit b837feaebab8ed184f2022bb8317d6e5c003420e
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Sat Dec 11 19:52:43 2010 -0500
use the same style as the old toggleable implementation did (green text).
this at least gives some visual clue that the field is editable.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EditableFormItem.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EditableFormItem.java
index 8727538..7f1a96c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EditableFormItem.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EditableFormItem.java
@@ -139,6 +139,8 @@ public class EditableFormItem extends CanvasItem {
return !isEditing();
}
});
+ item.setTextBoxStyle("editableText");
+
return item;
}
@@ -398,6 +400,8 @@ public class EditableFormItem extends CanvasItem {
public void setReadOnly(boolean readOnly) {
this.readOnly = readOnly;
+ this.staticItem.setTextBoxStyle((!readOnly) ? "editableText" : null);
+ markForRedraw();
}
/**
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
index 94fecf9..dd7d3f3 100644
--- 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
@@ -172,7 +172,7 @@ public class GeneralProperties extends LocatableVLayout {
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());
+ dynamicItem.setValue(dynamic ? MSG.common_val_yes() : MSG.common_val_no());
formItems.add(dynamicItem);
EditableFormItem recursiveItem = new CheckboxEditableFormItem("recursive", MSG.view_group_summary_recursive());
@@ -195,7 +195,7 @@ public class GeneralProperties extends LocatableVLayout {
});
}
});
- recursiveItem.setValue((group.isRecursive()) ? MSG.common_val_yes_lower() : MSG.common_val_no_lower());
+ recursiveItem.setValue((group.isRecursive()) ? MSG.common_val_yes() : MSG.common_val_no());
formItems.add(recursiveItem);
StaticTextItem createdItem = new StaticTextItem("created", MSG.common_title_dateCreated());
commit ffd054195e9efc6946c5824a8fc2e80c04de6535
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Sat Dec 11 16:10:16 2010 -0500
BZ 661887 we can now change the recursive setting for groups via the GWT group summary view
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGroupGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGroupGWTService.java
index f48fd96..17c0f6c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGroupGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGroupGWTService.java
@@ -69,4 +69,5 @@ public interface ResourceGroupGWTService extends RemoteService {
void updateResourceGroup(ResourceGroup group, boolean updateMembership);
+ void setRecursive(int groupId, boolean isRecursive) throws Exception;
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/GeneralProperties.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/GeneralProperties.java
index 83b8831..94fecf9 100644
--- 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
@@ -179,7 +179,20 @@ public class GeneralProperties extends LocatableVLayout {
recursiveItem.setValueEditedHandler(new ValueEditedHandler() {
@Override
public void editedValue(Object newValue) {
- CoreGUI.getMessageCenter().notify(new Message("TODO: set recursive flag to=" + newValue));
+ boolean isRecursive = (newValue != null) ? ((Boolean) newValue).booleanValue() : false;
+ resourceGroupService.setRecursive(group.getId(), isRecursive, new AsyncCallback<Void>() {
+ @Override
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message(MSG.view_group_detail_recursiveChange(group.getName())));
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+ MSG.view_group_detail_failRecursiveChange(String.valueOf(group.getName())));
+ }
+ });
}
});
recursiveItem.setValue((group.isRecursive()) ? MSG.common_val_yes_lower() : MSG.common_val_no_lower());
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGroupGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGroupGWTServiceImpl.java
index c0ba7b0..2ef7eec 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGroupGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGroupGWTServiceImpl.java
@@ -172,4 +172,12 @@ public class ResourceGroupGWTServiceImpl extends AbstractGWTServiceImpl implemen
}
}
+ @Override
+ public void setRecursive(int groupId, boolean isRecursive) throws Exception {
+ try {
+ groupManager.setRecursive(getSessionSubject(), groupId, isRecursive);
+ } catch (Throwable t) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(t));
+ }
+ }
}
\ 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 cf0ce57..defb4a1 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
@@ -1389,6 +1389,8 @@ view_dynagroup_permDenied = You do not have permission to view group definitions
view_dynagroup_definitions = DynaGroup Definitions
view_group_detail_failLoad = Failed to load group for group with ID [{0}]
view_group_detail_failLoadComp = Failed to load group composite for group with ID [{0}]
+view_group_detail_recursiveChange = You successfully changed the recursive setting for group [{0}]
+view_group_detail_failRecursiveChange = Failed to update the recursive setting for group [{0}]
view_group_membership_failFetch = Failed to fetch Resource Group
view_group_membership_saveFailure = Failed to update membership of group [{0}]
view_group_membership_saveSuccessful = You have updated the membership of group [{0}]
commit 2cf91834c144eb4ca30294b3a8d8d01d94847d39
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Sat Dec 11 16:05:37 2010 -0500
we want to give the handler the actual value coming from the edit item, not the converted value that is being set on the static item
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EditableFormItem.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EditableFormItem.java
index 74838d5..8727538 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EditableFormItem.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EditableFormItem.java
@@ -294,9 +294,9 @@ public class EditableFormItem extends CanvasItem {
* @param newValue the new value just accepted by the user and validated by the system
*/
protected void setApprovedNewValue(Object newValue) {
- Object convertedValue = setStaticItemValue(this.staticItem, newValue);
+ setStaticItemValue(this.staticItem, newValue);
if (this.valueEditedHandler != null) {
- this.valueEditedHandler.editedValue(convertedValue);
+ this.valueEditedHandler.editedValue(newValue);
}
}
commit 073c3c9dd5cfc49d30d2989561038a5e2e75b9de
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Sat Dec 11 16:03:02 2010 -0500
this looks like a copy-n-paste error. this should be passing changeType down, but its ignoring the param changeType and its passing null.
fixing this so changeType is passed down
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java
index 1106619..0a9419a 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java
@@ -187,7 +187,7 @@ public class ResourceGroupManagerBean implements ResourceGroupManagerLocal, Reso
@RequiredPermission(Permission.MANAGE_INVENTORY)
public ResourceGroup updateResourceGroup(Subject subject, ResourceGroup group, RecursivityChangeType changeType)
throws ResourceGroupUpdateException {
- return updateResourceGroup(subject, group, null, true);
+ return updateResourceGroup(subject, group, changeType, true);
}
@RequiredPermission(Permission.MANAGE_INVENTORY)
commit 241b6d5807ddee1756819ab3460adccb9dd8e3b1
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Sat Dec 11 15:35:41 2010 -0500
resource overview page is going away - have the link go to the activity subtab instead
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 faaffa0..a1284ba 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
@@ -34,7 +34,7 @@ public class LinkManager {
public static String getResourceLink(int resourceId) {
if (GWT) {
- return "#Resource/" + resourceId + "/Summary/Overview";
+ return "#Resource/" + resourceId + "/Summary/Activity";
} else {
return "/rhq/resource/summary/overview.xhtml?id=" + resourceId;
}
commit 4912858149e5fc0b87a3b17cd5c09e521a815d5a
Merge: b5c5147... f4f09d4...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Sat Dec 11 15:26:15 2010 -0500
Merge commit 'origin/master'
commit b5c514736859c7289915ad7715d843865c9830d8
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Sat Dec 11 15:25:44 2010 -0500
BZ 662337 - finishing up the new editable field. The ToggleableTextItem/ValueUpdatedHandler has gone away, EnhancedDynamicForm has been changed to no longer look for that kind of item.
The resource/group summary views now use the new EditableFormItem.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EnhancedDynamicForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EnhancedDynamicForm.java
index 0f27a5c..e30a6bb 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EnhancedDynamicForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EnhancedDynamicForm.java
@@ -26,36 +26,18 @@ import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
-import com.google.gwt.user.client.Timer;
import com.smartgwt.client.types.DSOperationType;
-import com.smartgwt.client.widgets.form.DynamicForm;
-import com.smartgwt.client.widgets.form.FormItemIfFunction;
import com.smartgwt.client.widgets.form.fields.BooleanItem;
import com.smartgwt.client.widgets.form.fields.CanvasItem;
import com.smartgwt.client.widgets.form.fields.FormItem;
-import com.smartgwt.client.widgets.form.fields.FormItemIcon;
import com.smartgwt.client.widgets.form.fields.HiddenItem;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
-import com.smartgwt.client.widgets.form.fields.events.BlurEvent;
-import com.smartgwt.client.widgets.form.fields.events.BlurHandler;
-import com.smartgwt.client.widgets.form.fields.events.IconClickEvent;
-import com.smartgwt.client.widgets.form.fields.events.IconClickHandler;
-import com.smartgwt.client.widgets.form.fields.events.ItemHoverEvent;
-import com.smartgwt.client.widgets.form.fields.events.ItemHoverHandler;
-import com.smartgwt.client.widgets.form.fields.events.KeyPressEvent;
-import com.smartgwt.client.widgets.form.fields.events.KeyPressHandler;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.ImageManager;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
/**
- * A subclass of SmartGWT's DynamicForm widget that provides the following additional feature:
- * <p/>
- * If any {@link TogglableTextItem}s are added to the form, they will initially be rendered as static text items, except
- * when the user hovers over one of them, an edit icon will be displayed immediately to the right of it for five
- * seconds. If the user clicks this icon, the form item will become editable and the user can update its value. Once the
- * user hits Enter or switches focus somewhere outside the form item, the form item will become static again.
+ * A subclass of SmartGWT's DynamicForm widget that can provides additional layout settings and features.
*
* @author Ian Springer
*/
@@ -108,7 +90,6 @@ public class EnhancedDynamicForm extends LocatableDynamicForm {
// which simply delegates to setFields().
public void setFields(FormItem... items) {
List<FormItem> itemsList = new ArrayList<FormItem>();
- List<String> togglableTextItemNames = new ArrayList<String>();
boolean hasIdField = false;
for (FormItem item : items) {
if (item.getName().equals(FIELD_ID)) {
@@ -116,6 +97,10 @@ public class EnhancedDynamicForm extends LocatableDynamicForm {
}
if (this.isReadOnly) {
if ((item instanceof StaticTextItem) || (item instanceof CanvasItem)) {
+ // note: EditableFormItem is a subclass of CanvasItem
+ if (item instanceof EditableFormItem) {
+ ((EditableFormItem) item).setReadOnly(true);
+ }
itemsList.add(item);
} else {
StaticTextItem staticItem = new StaticTextItem(item.getName(), item.getTitle());
@@ -132,77 +117,6 @@ public class EnhancedDynamicForm extends LocatableDynamicForm {
itemsList.add(staticItem);
}
- } else if (item instanceof TogglableTextItem) {
- final TogglableTextItem togglableTextItem = (TogglableTextItem) item;
- togglableTextItemNames.add(togglableTextItem.getName());
-
- final StaticTextItem staticTextItem = new StaticTextItem(getStaticTextItemName(togglableTextItem
- .getName()), togglableTextItem.getTitle());
- staticTextItem.setAttribute("editing", false);
- staticTextItem.setTextBoxStyle("editableText");
-
- FormItemIcon editIcon = new FormItemIcon();
- editIcon.setName("Edit");
- editIcon.setSrc(ImageManager.getEditIcon());
- staticTextItem.setIcons(editIcon);
- staticTextItem.setShowIcons(false);
-
- staticTextItem.setShowIfCondition(new FormItemIfFunction() {
- public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- boolean editing = staticTextItem.getAttributeAsBoolean("editing");
- return !editing;
- }
- });
- staticTextItem.addIconClickHandler(new IconClickHandler() {
- public void onIconClick(IconClickEvent iconClickEvent) {
- if ("Edit".equals(iconClickEvent.getIcon().getName())) {
- staticTextItem.setAttribute("editing", true);
- staticTextItem.setShowIcons(false);
- markForRedraw();
- }
- }
- });
- staticTextItem.addItemHoverHandler(new ItemHoverHandler() {
- public void onItemHover(ItemHoverEvent itemHoverEvent) {
- staticTextItem.setShowIcons(true);
- markForRedraw();
- new Timer() {
- public void run() {
- staticTextItem.setShowIcons(false);
- markForRedraw();
- }
- }.schedule(5000);
- }
- });
- staticTextItem.addClickHandler(new com.smartgwt.client.widgets.form.fields.events.ClickHandler() {
- public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent clickEvent) {
- staticTextItem.setAttribute("editing", true);
- markForRedraw();
- }
- });
- staticTextItem.setRedrawOnChange(true);
- itemsList.add(staticTextItem);
-
- togglableTextItem.addKeyPressHandler(new KeyPressHandler() {
- public void onKeyPress(KeyPressEvent keyPressEvent) {
- if (keyPressEvent.getKeyName().equals("Enter")) {
- updateValue(staticTextItem, togglableTextItem);
- }
- }
- });
- togglableTextItem.addBlurHandler(new BlurHandler() {
- public void onBlur(BlurEvent blurEvent) {
- updateValue(staticTextItem, togglableTextItem);
- }
- });
- togglableTextItem.setShowIfCondition(new FormItemIfFunction() {
- public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- @SuppressWarnings( { "UnnecessaryLocalVariable" })
- boolean editing = staticTextItem.getAttributeAsBoolean("editing");
- return editing;
- }
- });
- itemsList.add(togglableTextItem);
} else {
itemsList.add(item);
}
@@ -227,32 +141,9 @@ public class EnhancedDynamicForm extends LocatableDynamicForm {
}
super.setFields((FormItem[]) itemsList.toArray(new FormItem[itemsList.size()]));
-
- // SmartGWT annoyingly barfs if getValue() is called on a form item before it's been added to a form, so
- // we wait until after we've added all of the items to the form to set the values of the static items we
- // added, because only at that point can we grab the values of the corresponding togglable items.
- for (String name : togglableTextItemNames) {
- String value = getValueAsString(name);
- setValue(getStaticTextItemName(name), value);
- }
}
public boolean isReadOnly() {
return isReadOnly;
}
-
- private String getStaticTextItemName(String togglableTextItemName) {
- return "static" + togglableTextItemName;
- }
-
- private void updateValue(StaticTextItem staticTextItem, TogglableTextItem textItem) {
- String value = (String) textItem.getValue();
- staticTextItem.setValue(value);
- staticTextItem.setAttribute("editing", false);
- for (ValueUpdatedHandler handler : textItem.getValueUpdatedHandlers()) {
- handler.onValueUpdated(value);
- }
- markForRedraw();
- }
-
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/StringLengthValidator.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/StringLengthValidator.java
new file mode 100644
index 0000000..1fea959
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/StringLengthValidator.java
@@ -0,0 +1,71 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2009 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.components.form;
+
+import com.smartgwt.client.widgets.form.validator.CustomValidator;
+import com.smartgwt.client.widgets.form.validator.LengthRangeValidator;
+
+/**
+ * Similar to {@link LengthRangeValidator} except this also checks to see if
+ * the value is <code>null</code>.
+ *
+ * Note that if the minimum length is 0, the validator will pass the minimum check
+ * if the value is null. However, if the value is not allowed to be null,
+ * the validator will fail, even if the minimum length is 0.
+ *
+ * @author John Mazzitelli
+ */
+public class StringLengthValidator extends CustomValidator {
+
+ private final Integer min;
+ private final Integer max;
+ private final Boolean allowForNull;
+
+ public StringLengthValidator(Integer min, Integer max, Boolean allowForNull) {
+ this.min = min;
+ this.max = max;
+ this.allowForNull = allowForNull;
+ }
+
+ @Override
+ protected boolean condition(Object value) {
+ if (allowForNull != null) {
+ if (!allowForNull.booleanValue() && value == null) {
+ return false;
+ }
+ }
+
+ int length = (value != null) ? value.toString().length() : 0;
+
+ if (min != null) {
+ if (length < min.intValue()) {
+ return false;
+ }
+ }
+
+ if (max != null) {
+ if (length > max.intValue()) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/TogglableTextItem.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/TogglableTextItem.java
deleted file mode 100644
index 9807b35..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/TogglableTextItem.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, 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.components.form;
-
-import com.google.gwt.core.client.JavaScriptObject;
-import com.smartgwt.client.widgets.form.fields.TextItem;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * This class should only be used on conjunction with an {@link EnhancedDynamicForm}. See that class's Javadoc for
- * all the details.
- *
- * @author Ian Springer
- */
-public class TogglableTextItem extends TextItem {
- List<ValueUpdatedHandler> valueUpdatedHandlers = new ArrayList<ValueUpdatedHandler>();
-
- public TogglableTextItem() {
- }
-
- public TogglableTextItem(JavaScriptObject jsObj) {
- super(jsObj);
- }
-
- public TogglableTextItem(String name) {
- super(name);
- }
-
- public TogglableTextItem(String name, String title) {
- super(name, title);
- }
-
- public void addValueUpdatedHandler(ValueUpdatedHandler handler) {
- this.valueUpdatedHandlers.add(handler);
- }
-
- public List<ValueUpdatedHandler> getValueUpdatedHandlers() {
- return valueUpdatedHandlers;
- }
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/ValueUpdatedHandler.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/ValueUpdatedHandler.java
deleted file mode 100644
index ac35115..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/ValueUpdatedHandler.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package org.rhq.enterprise.gui.coregui.client.components.form;
-
-/**
- * @author Ian Springer
- */
-public interface ValueUpdatedHandler {
- void onValueUpdated(String newValue);
-}
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
index c81e648..83b8831 100644
--- 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
@@ -38,8 +38,7 @@ import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.components.form.CheckboxEditableFormItem;
import org.rhq.enterprise.gui.coregui.client.components.form.EditableFormItem;
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.components.form.StringLengthValidator;
import org.rhq.enterprise.gui.coregui.client.components.form.EditableFormItem.ValueEditedHandler;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGroupGWTServiceAsync;
@@ -77,14 +76,20 @@ public class GeneralProperties extends LocatableVLayout {
boolean dynamic = (group.getGroupDefinition() != null);
- final FormItem nameItem = (dynamic) ? new StaticTextItem() : new TogglableTextItem();
+ StringLengthValidator notEmptyOrNullValidator = new StringLengthValidator(1, null, false);
+ StringLengthValidator notNullValidator = new StringLengthValidator(null, null, false);
+
+ final FormItem nameItem = (dynamic) ? new StaticTextItem() : new EditableFormItem();
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) {
+ if (nameItem instanceof EditableFormItem) {
+ final EditableFormItem togglableNameItem = (EditableFormItem) nameItem;
+ togglableNameItem.setValidators(notEmptyOrNullValidator);
+ togglableNameItem.setValueEditedHandler(new ValueEditedHandler() {
+ @Override
+ public void editedValue(Object newValue) {
+ final String newName = newValue.toString();
final String oldName = group.getName();
if (newName.equals(oldName)) {
return;
@@ -129,14 +134,17 @@ public class GeneralProperties extends LocatableVLayout {
countItem.setValue(memberCount);
formItems.add(countItem);
- final FormItem descriptionItem = (dynamic) ? new StaticTextItem() : new TogglableTextItem();
+ final FormItem descriptionItem = (dynamic) ? new StaticTextItem() : new EditableFormItem();
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) {
+ if (descriptionItem instanceof EditableFormItem) {
+ final EditableFormItem togglableDescriptionItem = (EditableFormItem) descriptionItem;
+ togglableDescriptionItem.setValidators(notNullValidator);
+ togglableDescriptionItem.setValueEditedHandler(new ValueEditedHandler() {
+ @Override
+ public void editedValue(Object newValue) {
+ final String newDescription = newValue.toString();
final String oldDescription = group.getDescription();
if (newDescription.equals(oldDescription)) {
return;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewForm.java
index 1884cec..5720661 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewForm.java
@@ -39,9 +39,10 @@ import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.components.form.EditableFormItem;
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.components.form.StringLengthValidator;
+import org.rhq.enterprise.gui.coregui.client.components.form.EditableFormItem.ValueEditedHandler;
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;
@@ -133,6 +134,9 @@ public class OverviewForm extends EnhancedDynamicForm {
}
}
+ StringLengthValidator notEmptyOrNullValidator = new StringLengthValidator(1, null, false);
+ StringLengthValidator notNullValidator = new StringLengthValidator(null, null, false);
+
List<FormItem> formItems = new ArrayList<FormItem>();
if (isHeaderEnabled()) {//conditionally display header
@@ -152,14 +156,16 @@ public class OverviewForm extends EnhancedDynamicForm {
boolean modifiable = this.resourceComposite.getResourcePermission().isInventory();
// Name
- final FormItem nameItem = (modifiable) ? new TogglableTextItem() : new StaticTextItem();
+ final FormItem nameItem = (modifiable) ? new EditableFormItem() : new StaticTextItem();
nameItem.setName("name");
nameItem.setTitle(MSG.view_summaryOverviewForm_field_name());
nameItem.setValue(resource.getName());
- if (nameItem instanceof TogglableTextItem) {
- TogglableTextItem togglableNameItem = (TogglableTextItem) nameItem;
- togglableNameItem.addValueUpdatedHandler(new ValueUpdatedHandler() {
- public void onValueUpdated(final String newName) {
+ if (nameItem instanceof EditableFormItem) {
+ EditableFormItem togglableNameItem = (EditableFormItem) nameItem;
+ togglableNameItem.setValidators(notEmptyOrNullValidator);
+ togglableNameItem.setValueEditedHandler(new ValueEditedHandler() {
+ public void editedValue(Object newValue) {
+ final String newName = newValue.toString();
final String oldName = resource.getName();
if (newName.equals(oldName)) {
return;
@@ -188,14 +194,16 @@ public class OverviewForm extends EnhancedDynamicForm {
formItems.add(nameItem);
// Description
- final FormItem descriptionItem = (modifiable) ? new TogglableTextItem() : new StaticTextItem();
+ final FormItem descriptionItem = (modifiable) ? new EditableFormItem() : new StaticTextItem();
descriptionItem.setName("description");
descriptionItem.setTitle(MSG.view_summaryOverviewForm_field_description());
descriptionItem.setValue(resource.getDescription());
- if (descriptionItem instanceof TogglableTextItem) {
- TogglableTextItem togglableDescriptionItem = (TogglableTextItem) descriptionItem;
- togglableDescriptionItem.addValueUpdatedHandler(new ValueUpdatedHandler() {
- public void onValueUpdated(final String newDescription) {
+ if (descriptionItem instanceof EditableFormItem) {
+ EditableFormItem togglableDescriptionItem = (EditableFormItem) descriptionItem;
+ togglableDescriptionItem.setValidators(notNullValidator);
+ togglableDescriptionItem.setValueEditedHandler(new ValueEditedHandler() {
+ public void editedValue(Object newValue) {
+ final String newDescription = newValue.toString();
final String oldDescription = resource.getDescription();
if (newDescription.equals(oldDescription)) {
return;
@@ -226,14 +234,16 @@ public class OverviewForm extends EnhancedDynamicForm {
formItems.add(descriptionItem);
// Location
- final FormItem locationItem = (modifiable) ? new TogglableTextItem() : new StaticTextItem();
+ final FormItem locationItem = (modifiable) ? new EditableFormItem() : new StaticTextItem();
locationItem.setName("location");
locationItem.setTitle(MSG.view_summaryOverviewForm_field_location());
locationItem.setValue(resource.getLocation());
- if (locationItem instanceof TogglableTextItem) {
- TogglableTextItem togglableNameItem = (TogglableTextItem) locationItem;
- togglableNameItem.addValueUpdatedHandler(new ValueUpdatedHandler() {
- public void onValueUpdated(final String newLocation) {
+ if (locationItem instanceof EditableFormItem) {
+ EditableFormItem togglableLocationItem = (EditableFormItem) locationItem;
+ togglableLocationItem.setValidators(notNullValidator);
+ togglableLocationItem.setValueEditedHandler(new ValueEditedHandler() {
+ public void editedValue(Object newValue) {
+ final String newLocation = newValue.toString();
final String oldLocation = resource.getLocation();
if (newLocation.equals(oldLocation)) {
return;
@@ -294,7 +304,7 @@ public class OverviewForm extends EnhancedDynamicForm {
formItems.add(new SpacerItem());
}
- setItems(formItems.toArray(new FormItem[formItems.size()]));
+ setItems(formItems.toArray(new FormItem[formItems.size()]));
}
public void loadData() {
commit fc9a86274835b1cbf5f06919534723f33152016f
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Sat Dec 11 15:19:07 2010 -0500
use blank icon rather than hide the icon so the fields don't resize themselves
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EditableFormItem.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EditableFormItem.java
index 727e622..74838d5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EditableFormItem.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EditableFormItem.java
@@ -91,6 +91,9 @@ public class EditableFormItem extends CanvasItem {
setValueEditedHandler(handler);
}
+ final FormItemIcon blankIcon = createBlankIcon();
+ final FormItemIcon editIcon = createEditIcon();
+
this.innerForm = new LocatableDynamicForm(getName() + "_innerForm");
this.staticItem = prepareStaticFormItem();
this.editItem = prepareEditFormItem();
@@ -102,7 +105,7 @@ public class EditableFormItem extends CanvasItem {
@Override
public void onMouseOut(MouseOutEvent event) {
if (!isEditing()) {
- EditableFormItem.this.staticItem.setShowIcons(false);
+ EditableFormItem.this.staticItem.setIcons(blankIcon);
EditableFormItem.this.markForRedraw();
}
}
@@ -111,7 +114,7 @@ public class EditableFormItem extends CanvasItem {
@Override
public void onMouseOver(MouseOverEvent event) {
if (!isEditing() && !isReadOnly()) {
- EditableFormItem.this.staticItem.setShowIcons(true);
+ EditableFormItem.this.staticItem.setIcons(editIcon);
EditableFormItem.this.markForRedraw();
}
}
@@ -122,14 +125,14 @@ public class EditableFormItem extends CanvasItem {
}
protected FormItem prepareStaticFormItem() {
- FormItemIcon editIcon = createEditIcon();
+ FormItemIcon blankIcon = createBlankIcon();
FormItem item = instantiateStaticFormItem();
item.setShowTitle(false);
- item.setIcons(editIcon);
+ item.setIcons(blankIcon);
item.setIconVAlign(VerticalAlignment.CENTER);
item.setIconHeight(16);
item.setIconWidth(16);
- item.setShowIcons(false);
+ item.setShowIcons(true);
item.setShowIfCondition(new FormItemIfFunction() {
@Override
public boolean execute(FormItem item, Object value, DynamicForm form) {
@@ -241,6 +244,12 @@ public class EditableFormItem extends CanvasItem {
return cancelIcon;
}
+ protected FormItemIcon createBlankIcon() {
+ FormItemIcon blankIcon = new FormItemIcon();
+ blankIcon.setSrc("blank.png");
+ return blankIcon;
+ }
+
/**
* This sets the {@link #setEditing(boolean) edit flag} to false and ensures
* the component switches to the static, read-only mode.
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/blank.png b/modules/enterprise/gui/coregui/src/main/webapp/images/blank.png
index cee9cd3..7a810cb 100644
Binary files a/modules/enterprise/gui/coregui/src/main/webapp/images/blank.png and b/modules/enterprise/gui/coregui/src/main/webapp/images/blank.png differ
commit f4f09d4790c8f36493a73d96f418baa01862708f
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Sat Dec 11 15:13:35 2010 -0500
there should not be a availability grid nor any add/remove buttons when in read-only mode.
avoid NPE by not doing anything in updatebuttonenablement method if in r/o mode
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/AbstractSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/AbstractSelector.java
index 81997f0..e23c0f1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/AbstractSelector.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/AbstractSelector.java
@@ -528,10 +528,12 @@ public abstract class AbstractSelector<T> extends LocatableVLayout {
}
protected void updateButtonEnablement() {
- addButton.setDisabled(!availableGrid.anySelected());
- removeButton.setDisabled(!assignedGrid.anySelected());
- addAllButton.setDisabled(!containsAtLeastOneEnabledRecord(this.availableGrid));
- removeAllButton.setDisabled(!containsAtLeastOneEnabledRecord(this.assignedGrid));
+ if (!isReadOnly) {
+ addButton.setDisabled(!availableGrid.anySelected());
+ removeButton.setDisabled(!assignedGrid.anySelected());
+ addAllButton.setDisabled(!containsAtLeastOneEnabledRecord(this.availableGrid));
+ removeAllButton.setDisabled(!containsAtLeastOneEnabledRecord(this.assignedGrid));
+ }
}
@Deprecated
commit e5be8ebe3dc06802fbcdaa401121725356960d49
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Sat Dec 11 01:33:42 2010 -0500
avoid NPE
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EditableFormItem.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EditableFormItem.java
index d711c60..727e622 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EditableFormItem.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EditableFormItem.java
@@ -303,7 +303,7 @@ public class EditableFormItem extends CanvasItem {
* @return the converted value that was set in the edit item
*/
protected Object setEditItemValue(FormItem editItem, Object value) {
- String convertedValue = value.toString();
+ String convertedValue = (value != null) ? value.toString() : null;
editItem.setValue(convertedValue);
return convertedValue;
}
@@ -320,7 +320,7 @@ public class EditableFormItem extends CanvasItem {
* @return the converted value that was set in the static item
*/
protected Object setStaticItemValue(FormItem staticItem, Object value) {
- String convertedValue = value.toString();
+ String convertedValue = (value != null) ? value.toString() : null;
staticItem.setValue(convertedValue);
return convertedValue;
}
commit 60e9e7f45486235d57db510c8e99dbd5e3c3a019
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Dec 10 23:24:56 2010 -0500
add read-only flag
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EditableFormItem.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EditableFormItem.java
index 41637d7..d711c60 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EditableFormItem.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EditableFormItem.java
@@ -64,6 +64,7 @@ public class EditableFormItem extends CanvasItem {
protected static Messages MSG = CoreGUI.getMessages();
+ private boolean readOnly = false;
private boolean editing = false;
private FormItem staticItem;
private FormItem editItem;
@@ -109,7 +110,7 @@ public class EditableFormItem extends CanvasItem {
this.innerForm.addMouseOverHandler(new MouseOverHandler() {
@Override
public void onMouseOver(MouseOverEvent event) {
- if (!isEditing()) {
+ if (!isEditing() && !isReadOnly()) {
EditableFormItem.this.staticItem.setShowIcons(true);
EditableFormItem.this.markForRedraw();
}
@@ -201,7 +202,10 @@ public class EditableFormItem extends CanvasItem {
editIcon.addFormItemClickHandler(new FormItemClickHandler() {
@Override
public void onFormItemClick(FormItemIconClickEvent event) {
- switchToEditMode();
+ // should never get here if read-only (the icon is hidden) but just to be sure, check read-only status again
+ if (!isReadOnly()) {
+ switchToEditMode();
+ }
}
});
return editIcon;
@@ -376,6 +380,18 @@ public class EditableFormItem extends CanvasItem {
}
/**
+ * If the user is not allowed to edit this form item, <code>true</code> is returned.
+ * @return flag to indicate if the user is allowed to change the value or not
+ */
+ public boolean isReadOnly() {
+ return readOnly;
+ }
+
+ public void setReadOnly(boolean readOnly) {
+ this.readOnly = readOnly;
+ }
+
+ /**
* Returns the handler that will be called when a user edits the current value.
* This is only called after the user accepts the new value and it passes validation.
*
commit 055fd407f45695063653ff91f1165b44f9ded3e3
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Dec 10 22:47:21 2010 -0500
BZ 661887 - the start to getting the recursive bit editable. this includes a custom form item that we can use to edit other summary items like descripton and name.
this can be a replacement to the "ghost pencil" problem that exists in the EnhancedDynamicForm object
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java
index f9d38a8..e13b67e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java
@@ -31,6 +31,20 @@ public class ImageManager {
}
/**
+ * Returns a generic approve (aka "ok") icon.
+ */
+ public static String getApproveIcon() {
+ return "[SKIN]/actions/approve.png";
+ }
+
+ /**
+ * Returns a generic cancel icon.
+ */
+ public static String getCancelIcon() {
+ return "[SKIN]/actions/undo.png";
+ }
+
+ /**
* Returns the operation status icon. If status is null, returns
* the plain, unbadged, operation icon.
*/
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/CheckboxEditableFormItem.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/CheckboxEditableFormItem.java
new file mode 100644
index 0000000..67e31fc
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/CheckboxEditableFormItem.java
@@ -0,0 +1,111 @@
+/*
+ * 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.components.form;
+
+import com.smartgwt.client.widgets.form.fields.CheckboxItem;
+import com.smartgwt.client.widgets.form.fields.FormItem;
+
+public class CheckboxEditableFormItem extends EditableFormItem {
+ private boolean yesNoFlag = true;
+
+ public CheckboxEditableFormItem() {
+ super();
+ }
+
+ public CheckboxEditableFormItem(String name, String title) {
+ super(name, title);
+ }
+
+ public CheckboxEditableFormItem(String name, String title, ValueEditedHandler handler) {
+ super(name, title, handler);
+ }
+
+ /**
+ * If you want the static item to show "yes" for true and "no" for false, set this
+ * flag to true. If you want the static item to show the actual boolean
+ * value ("true" or "false"), this flag should be set to false.
+ *
+ * @param yesNoFlag true if yes/no should be shown in the static text (default is true)
+ */
+ public void setYesNo(boolean yesNoFlag) {
+ this.yesNoFlag = yesNoFlag;
+ }
+
+ @Override
+ protected FormItem instantiateEditFormItem() {
+ CheckboxItem item = new CheckboxItem();
+ item.setTitle(" ");
+ return item;
+ }
+
+ @Override
+ protected Object setEditItemValue(FormItem editItem, Object value) {
+ boolean convertedValue; // note: this MUST be of primitive boolean type, not Boolean
+
+ if (value == null) {
+ value = Boolean.FALSE;
+ }
+ if (value instanceof Boolean) {
+ convertedValue = ((Boolean) value).booleanValue();
+ } else {
+ String str = value.toString();
+ if (str.equalsIgnoreCase(MSG.common_val_yes_lower())) {
+ convertedValue = true;
+ } else if (str.equalsIgnoreCase(MSG.common_val_no_lower())) {
+ convertedValue = false;
+ } else {
+ convertedValue = Boolean.parseBoolean(str);
+ }
+ }
+
+ editItem.setValue(convertedValue); // this doesn't work if convertedValue is of type java.lang.Boolean
+ return convertedValue;
+ }
+
+ @Override
+ protected Object setStaticItemValue(FormItem staticItem, Object value) {
+ String convertedValue;
+
+ if (value == null) {
+ convertedValue = "";
+ }
+
+ if (value instanceof Boolean) {
+ if (this.yesNoFlag) {
+ if (((Boolean) value).booleanValue()) {
+ convertedValue = MSG.common_val_yes();
+ } else {
+ convertedValue = MSG.common_val_no();
+ }
+ } else {
+ convertedValue = value.toString();
+ }
+ } else {
+ convertedValue = value.toString();
+ }
+
+ staticItem.setValue(convertedValue);
+ return convertedValue;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EditableFormItem.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EditableFormItem.java
new file mode 100644
index 0000000..41637d7
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EditableFormItem.java
@@ -0,0 +1,407 @@
+/*
+ * 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.components.form;
+
+import java.util.Date;
+
+import com.google.gwt.event.dom.client.KeyCodes;
+import com.smartgwt.client.types.VerticalAlignment;
+import com.smartgwt.client.widgets.events.MouseOutEvent;
+import com.smartgwt.client.widgets.events.MouseOutHandler;
+import com.smartgwt.client.widgets.events.MouseOverEvent;
+import com.smartgwt.client.widgets.events.MouseOverHandler;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.FormItemIfFunction;
+import com.smartgwt.client.widgets.form.fields.CanvasItem;
+import com.smartgwt.client.widgets.form.fields.FormItem;
+import com.smartgwt.client.widgets.form.fields.FormItemIcon;
+import com.smartgwt.client.widgets.form.fields.StaticTextItem;
+import com.smartgwt.client.widgets.form.fields.TextItem;
+import com.smartgwt.client.widgets.form.fields.events.FormItemClickHandler;
+import com.smartgwt.client.widgets.form.fields.events.FormItemIconClickEvent;
+import com.smartgwt.client.widgets.form.fields.events.KeyPressEvent;
+import com.smartgwt.client.widgets.form.fields.events.KeyPressHandler;
+import com.smartgwt.client.widgets.form.validator.Validator;
+
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.ImageManager;
+import org.rhq.enterprise.gui.coregui.client.Messages;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
+
+/**
+ * This form item can be used to display a value normally in "read-only" form (i.e. as a StaticTextItem),
+ * but can be toggled into an "editable" form that allows the user to enter a different value.
+ *
+ * This default implementation provides editing the value within a text field. However, this class
+ * is designed to be extended, thus allowing the subclasses to edit values via
+ * checkboxes, radio buttons, etc.
+ *
+ * @author John Mazzitelli
+ *
+ */
+public class EditableFormItem extends CanvasItem {
+
+ protected static Messages MSG = CoreGUI.getMessages();
+
+ private boolean editing = false;
+ private FormItem staticItem;
+ private FormItem editItem;
+ private DynamicForm innerForm;
+
+ private ValueEditedHandler valueEditedHandler;
+
+ public EditableFormItem() {
+ this(null, null);
+ }
+
+ public EditableFormItem(String name, String title) {
+ this(name, title, null);
+ }
+
+ public EditableFormItem(String name, String title, ValueEditedHandler handler) {
+ if (name != null) {
+ setName(name);
+ }
+ if (title != null) {
+ setTitle(title);
+ }
+ if (handler != null) {
+ setValueEditedHandler(handler);
+ }
+
+ this.innerForm = new LocatableDynamicForm(getName() + "_innerForm");
+ this.staticItem = prepareStaticFormItem();
+ this.editItem = prepareEditFormItem();
+ this.innerForm.setItems(staticItem, editItem);
+ this.innerForm.setCanFocus(true);
+
+ // if we are not in edit-mode, we want to show the edit icon, but only if the mouse hovers over us
+ this.innerForm.addMouseOutHandler(new MouseOutHandler() {
+ @Override
+ public void onMouseOut(MouseOutEvent event) {
+ if (!isEditing()) {
+ EditableFormItem.this.staticItem.setShowIcons(false);
+ EditableFormItem.this.markForRedraw();
+ }
+ }
+ });
+ this.innerForm.addMouseOverHandler(new MouseOverHandler() {
+ @Override
+ public void onMouseOver(MouseOverEvent event) {
+ if (!isEditing()) {
+ EditableFormItem.this.staticItem.setShowIcons(true);
+ EditableFormItem.this.markForRedraw();
+ }
+ }
+ });
+
+ setCanvas(this.innerForm);
+ setCanFocus(true);
+ }
+
+ protected FormItem prepareStaticFormItem() {
+ FormItemIcon editIcon = createEditIcon();
+ FormItem item = instantiateStaticFormItem();
+ item.setShowTitle(false);
+ item.setIcons(editIcon);
+ item.setIconVAlign(VerticalAlignment.CENTER);
+ item.setIconHeight(16);
+ item.setIconWidth(16);
+ item.setShowIcons(false);
+ item.setShowIfCondition(new FormItemIfFunction() {
+ @Override
+ public boolean execute(FormItem item, Object value, DynamicForm form) {
+ return !isEditing();
+ }
+ });
+ return item;
+ }
+
+ protected FormItem prepareEditFormItem() {
+ FormItemIcon cancelIcon = createCancelIcon();
+ FormItemIcon approveIcon = createApproveIcon();
+ FormItem item = instantiateEditFormItem();
+ item.setShowTitle(false);
+ item.setIcons(approveIcon, cancelIcon);
+ item.setIconVAlign(VerticalAlignment.CENTER);
+ item.setIconHeight(16);
+ item.setIconWidth(16);
+ item.setShowIcons(true);
+ item.setShowIfCondition(new FormItemIfFunction() {
+ @Override
+ public boolean execute(FormItem item, Object value, DynamicForm form) {
+ return isEditing();
+ }
+ });
+ item.addKeyPressHandler(new KeyPressHandler() {
+ public void onKeyPress(KeyPressEvent event) {
+ if ((event.getCharacterValue() != null) && (event.getCharacterValue() == KeyCodes.KEY_ENTER)) {
+ if (EditableFormItem.this.innerForm.validate(false)) {
+ Object newValue = event.getItem().getValue();
+ setApprovedNewValue(newValue);
+ switchToStaticMode();
+ }
+ }
+ }
+ });
+
+ return item;
+ }
+
+ /**
+ * This instantiates the static item. The form item created by this method will
+ * be further customized by {@link #prepareStaticFormItem()}.
+ *
+ * @return the form item used to show the static (read-only) value
+ */
+ protected FormItem instantiateStaticFormItem() {
+ StaticTextItem item = new StaticTextItem();
+ return item;
+ }
+
+ /**
+ * This instantiates the edit item. The form item created by this method will
+ * be further customized by {@link #prepareEditFormItem()}.
+ *
+ * Subclasses will usually override this method to provide a different form
+ * item such as a checkbox, radio buttons, etc.
+ *
+ * @return the form item used to edit the value
+ */
+ protected FormItem instantiateEditFormItem() {
+ TextItem item = new TextItem();
+ return item;
+ }
+
+ protected FormItemIcon createEditIcon() {
+ FormItemIcon editIcon = new FormItemIcon();
+ editIcon.setSrc(ImageManager.getEditIcon());
+ editIcon.setPrompt(MSG.common_button_edit()); // TODO have better message?
+ editIcon.addFormItemClickHandler(new FormItemClickHandler() {
+ @Override
+ public void onFormItemClick(FormItemIconClickEvent event) {
+ switchToEditMode();
+ }
+ });
+ return editIcon;
+ }
+
+ protected FormItemIcon createApproveIcon() {
+ FormItemIcon approveIcon = new FormItemIcon();
+ approveIcon.setSrc(ImageManager.getApproveIcon());
+ approveIcon.setPrompt(MSG.common_button_ok()); // TODO have better message?
+ approveIcon.addFormItemClickHandler(new FormItemClickHandler() {
+ @Override
+ public void onFormItemClick(FormItemIconClickEvent event) {
+ if (EditableFormItem.this.innerForm.validate(false)) {
+ Object newValue = event.getItem().getValue();
+ setApprovedNewValue(newValue);
+ switchToStaticMode();
+ }
+ }
+ });
+ return approveIcon;
+ }
+
+ protected FormItemIcon createCancelIcon() {
+ FormItemIcon cancelIcon = new FormItemIcon();
+ cancelIcon.setSrc(ImageManager.getCancelIcon());
+ cancelIcon.setPrompt(MSG.common_button_cancel()); // TODO have better message?
+ cancelIcon.addFormItemClickHandler(new FormItemClickHandler() {
+ @Override
+ public void onFormItemClick(FormItemIconClickEvent event) {
+ switchToStaticMode();
+ }
+ });
+ return cancelIcon;
+ }
+
+ /**
+ * This sets the {@link #setEditing(boolean) edit flag} to false and ensures
+ * the component switches to the static, read-only mode.
+ */
+ protected void switchToStaticMode() {
+ if (isEditing()) {
+ setEditing(false);
+ markForRedraw();
+ }
+ }
+
+ /**
+ * This sets the {@link #setEditing(boolean) edit flag} to true and ensures
+ * the component switches to the edit, read-write mode.
+ */
+ protected void switchToEditMode() {
+ if (!isEditing()) {
+ setEditing(true);
+ setEditItemValue(this.editItem, this.staticItem.getValue());
+ markForRedraw();
+ }
+ }
+
+ protected boolean isEditing() {
+ return this.editing;
+ }
+
+ /**
+ * This just sets the internal flag indicating if the form is in editing mode.
+ * To switch modes, you use {@link #switchToEditMode()} and {@link #switchToStaticMode()}.
+ *
+ * @param editing the new editing flag
+ */
+ protected void setEditing(boolean editing) {
+ this.editing = editing;
+ }
+
+ /**
+ * When the user has accepted a new edited value for this form item, this method is called.
+ * This method is responsible for invoking the {@link #getValueEditedHandler() handler}.
+ *
+ * @param newValue the new value just accepted by the user and validated by the system
+ */
+ protected void setApprovedNewValue(Object newValue) {
+ Object convertedValue = setStaticItemValue(this.staticItem, newValue);
+ if (this.valueEditedHandler != null) {
+ this.valueEditedHandler.editedValue(convertedValue);
+ }
+ }
+
+ /**
+ * When a user first elects to edit a value (i.e. switches from static, read-only mode
+ * to edit mode), the static value needs to be converted to an object that is appropriate
+ * for the edit form item value. This method performs that necessary conversion and
+ * sets the edit item's value to that converted value. The converted value is also returned.
+ *
+ * @param editItem the edit form item whose value needs to be set
+ * @param value the static value that needs to be converted and set in the given edit item
+ *
+ * @return the converted value that was set in the edit item
+ */
+ protected Object setEditItemValue(FormItem editItem, Object value) {
+ String convertedValue = value.toString();
+ editItem.setValue(convertedValue);
+ return convertedValue;
+ }
+
+ /**
+ * When a user enters and accepts a new value, the new value needs to be converted
+ * to an appropriate value for display in the static, read-only item.
+ * This method performs that necessary conversion and sets the static item's value
+ * to that converted value. The converted value is also returned.
+ *
+ * @param staticItem the static form item whose value needs to be set
+ * @param value the value that needs to be converted for display in the static item
+ *
+ * @return the converted value that was set in the static item
+ */
+ protected Object setStaticItemValue(FormItem staticItem, Object value) {
+ String convertedValue = value.toString();
+ staticItem.setValue(convertedValue);
+ return convertedValue;
+ }
+
+ //
+ // Below are delegating methods to setValue().
+ // When setting this form item's value, we are really setting the static item's value.
+ //
+
+ @Override
+ public void setValue(boolean value) {
+ this.staticItem.setValue(value);
+ }
+
+ @Override
+ public void setValue(Date value) {
+ this.staticItem.setValue(value);
+ }
+
+ @Override
+ public void setValue(double value) {
+ this.staticItem.setValue(value);
+ }
+
+ @Override
+ public void setValue(float value) {
+ this.staticItem.setValue(value);
+ }
+
+ @Override
+ public void setValue(int value) {
+ this.staticItem.setValue(value);
+ }
+
+ @Override
+ public void setValue(Object value) {
+ this.staticItem.setValue(value);
+ }
+
+ @Override
+ public void setValue(String value) {
+ this.staticItem.setValue(value);
+ }
+
+ @Override
+ public Object getValue() {
+ return this.staticItem.getValue();
+ }
+
+ //
+ // this delegates to the edit item allowing custom validators to be added
+ //
+
+ @Override
+ public void setValidators(Validator... validators) {
+ this.editItem.setValidators(validators);
+ }
+
+ /**
+ * Returns the handler that will be called when a user edits the current value.
+ * This is only called after the user accepts the new value and it passes validation.
+ *
+ * @return the callback handler that is invoked when the old value is edited resulting in a new value
+ */
+ public ValueEditedHandler getValueEditedHandler() {
+ return this.valueEditedHandler;
+ }
+
+ public void setValueEditedHandler(ValueEditedHandler handler) {
+ this.valueEditedHandler = handler;
+ }
+
+ /**
+ * Marks the canvas item for redraw, which enables both the static and edit items to redraw themselves.
+ */
+ private void markForRedraw() {
+ getForm().markForRedraw();
+ this.innerForm.markForRedraw();
+ }
+
+ /**
+ * When a user has changed the value of the editable field item, this
+ * is the type of callback that is called to be informed of the change.
+ */
+ public static interface ValueEditedHandler {
+ public void editedValue(Object newValue);
+ }
+}
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
index a945d0d..c81e648 100644
--- 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
@@ -35,9 +35,12 @@ 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.CheckboxEditableFormItem;
+import org.rhq.enterprise.gui.coregui.client.components.form.EditableFormItem;
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.components.form.EditableFormItem.ValueEditedHandler;
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;
@@ -164,7 +167,13 @@ public class GeneralProperties extends LocatableVLayout {
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());
+ EditableFormItem recursiveItem = new CheckboxEditableFormItem("recursive", MSG.view_group_summary_recursive());
+ recursiveItem.setValueEditedHandler(new ValueEditedHandler() {
+ @Override
+ public void editedValue(Object newValue) {
+ CoreGUI.getMessageCenter().notify(new Message("TODO: set recursive flag to=" + newValue));
+ }
+ });
recursiveItem.setValue((group.isRecursive()) ? MSG.common_val_yes_lower() : MSG.common_val_no_lower());
formItems.add(recursiveItem);
commit 5a23353b89323730340564ad2d3c5f5031f1fc23
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Dec 10 18:04:16 2010 -0500
give group Inventory>Members subtab its own class
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 6b800b3..1d1c754 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
@@ -54,6 +54,7 @@ import org.rhq.enterprise.gui.coregui.client.inventory.common.event.EventComposi
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.configuration.GroupResourceConfigurationEditView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.inventory.CurrentGroupPluginConfigurationView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.inventory.HistoryGroupPluginConfigurationView;
+import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.inventory.MembersView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.monitoring.schedules.SchedulesView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.monitoring.traits.TraitsView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.summary.ActivityView;
@@ -282,7 +283,7 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
// Inventory tab is always visible and enabled.
boolean canModifyMembers = (!isAutoGroup() && !isAutoCluster()
&& globalPermissions.contains(Permission.MANAGE_INVENTORY));
- updateSubTab(this.inventoryTab, this.inventoryMembers, ResourceSearchView.getMembersOf(this.inventoryMembers
+ updateSubTab(this.inventoryTab, this.inventoryMembers, new MembersView(this.inventoryMembers
.extendLocatorId("View"), groupId, canModifyMembers), true, true);
updateSubTab(this.inventoryTab, this.inventoryConn, new CurrentGroupPluginConfigurationView(this.inventoryConn
.extendLocatorId("View"), this.groupComposite), facets.contains(ResourceTypeFacet.PLUGIN_CONFIGURATION),
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/MembersView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/MembersView.java
new file mode 100644
index 0000000..ed222b1
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/MembersView.java
@@ -0,0 +1,99 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.inventory;
+
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.types.Overflow;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.events.CloseClickHandler;
+import com.smartgwt.client.widgets.events.CloseClientEvent;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableAction;
+import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDatasource;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSearchView;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWindow;
+
+/**
+ * The content pane for the group Inventory>Members subtab.
+ *
+ * @author Jay Shaughnessy
+ */
+public class MembersView extends ResourceSearchView {
+
+ private int groupId;
+ private boolean canModifyMembers;
+
+ public MembersView(String locatorId, int groupId, boolean canModifyMembers) {
+ super(locatorId, new Criteria(ResourceDatasource.FILTER_GROUP_ID, String.valueOf(groupId)),
+ MSG.view_inventory_resources_title_members());
+ this.canModifyMembers = canModifyMembers;
+ this.groupId = groupId;
+ }
+
+ @Override
+ protected void configureTable() {
+ super.configureTable();
+
+ addTableAction(extendLocatorId("Members"), MSG.view_groupInventoryMembers_button_updateMembership() + "...",
+ new AbstractTableAction((this.canModifyMembers) ? TableActionEnablement.ALWAYS :
+ TableActionEnablement.NEVER) {
+ @Override
+ public void executeAction(ListGridRecord[] selection, Object actionValue) {
+ final LocatableWindow winModal = new LocatableWindow(extendLocatorId("MembersWindow"));
+ winModal.setTitle(MSG.view_groupInventoryMembers_title_updateMembership());
+ winModal.setOverflow(Overflow.VISIBLE);
+ winModal.setShowMinimizeButton(false);
+ winModal.setIsModal(true);
+ winModal.setShowModalMask(true);
+ winModal.setWidth(700);
+ winModal.setHeight(450);
+ winModal.setAutoCenter(true);
+ winModal.setShowResizer(true);
+ winModal.setCanDragResize(true);
+ winModal.centerInPage();
+ winModal.addCloseClickHandler(new CloseClickHandler() {
+ @Override
+ public void onCloseClick(CloseClientEvent event) {
+ winModal.markForDestroy();
+ }
+ });
+
+ ResourceGroupMembershipView membershipView = new ResourceGroupMembershipView(
+ MembersView.this.extendLocatorId("View"), MembersView.this.groupId);
+
+ membershipView.setSaveButtonHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ winModal.markForDestroy();
+ CoreGUI.refresh();
+ }
+ });
+
+ winModal.addItem(membershipView);
+ winModal.show();
+ }
+ });
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceCompositeSearchView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceCompositeSearchView.java
index 0c4df49..f08f1ac 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceCompositeSearchView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceCompositeSearchView.java
@@ -44,7 +44,7 @@ public class ResourceCompositeSearchView extends ResourceSearchView {
this(locatorId, null, criteria, title, headerIcons);
}
- protected RPCDataSource<?> getDataSourceInstance() {
+ protected RPCDataSource getDataSourceInstance() {
return ResourceCompositeDataSource.getInstance();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
index 9abe462..0b3ef89 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
@@ -58,6 +58,9 @@ import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
* @author Greg Hinkle
*/
public class ResourceDatasource extends RPCDataSource<Resource> {
+
+ public static final String FILTER_GROUP_ID = "groupId";
+
private ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();
private static ResourceDatasource INSTANCE;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
index 41f9b0e..07c1bcc 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
@@ -33,11 +33,6 @@ import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.data.SortSpecifier;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.ListGridFieldType;
-import com.smartgwt.client.types.Overflow;
-import com.smartgwt.client.widgets.events.ClickEvent;
-import com.smartgwt.client.widgets.events.ClickHandler;
-import com.smartgwt.client.widgets.events.CloseClickHandler;
-import com.smartgwt.client.widgets.events.CloseClientEvent;
import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
@@ -50,12 +45,10 @@ import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
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.groups.detail.inventory.ResourceGroupMembershipView;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
import org.rhq.enterprise.gui.coregui.client.util.TableUtility;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWindow;
/**
* @author Greg Hinkle
@@ -66,9 +59,6 @@ public class ResourceSearchView extends Table {
private List<ResourceSelectListener> selectListeners = new ArrayList<ResourceSelectListener>();
- // our static factory method will set this to a non-null resource group ID if the user can modify that group's membership
- private Integer groupIdToModify = null;
-
/**
* A list of all Resources in the system.
*/
@@ -115,11 +105,11 @@ public class ResourceSearchView extends Table {
// searchPanel.setWrapItemTitles(false);
// searchPanel.setFields(searchBox);
- final RPCDataSource<?> datasource = getDataSourceInstance();
+ final RPCDataSource datasource = getDataSourceInstance();
setDataSource(datasource);
}
- protected RPCDataSource<?> getDataSourceInstance() {
+ protected RPCDataSource getDataSourceInstance() {
return ResourceDatasource.getInstance();
}
@@ -195,48 +185,6 @@ public class ResourceSearchView extends Table {
}
});
- if (this.groupIdToModify != null) {
- addTableAction(extendLocatorId("Members"), MSG.view_tabs_common_group_members() + "...",
- new AbstractTableAction(TableActionEnablement.ALWAYS) {
- @Override
- public void executeAction(ListGridRecord[] selection, Object actionValue) {
- final LocatableWindow winModal = new LocatableWindow(extendLocatorId("MembersWindow"));
- winModal.setTitle(MSG.view_tabs_common_group_members());
- winModal.setOverflow(Overflow.VISIBLE);
- winModal.setShowMinimizeButton(false);
- winModal.setIsModal(true);
- winModal.setShowModalMask(true);
- winModal.setWidth(700);
- winModal.setHeight(450);
- winModal.setAutoCenter(true);
- winModal.setShowResizer(true);
- winModal.setCanDragResize(true);
- winModal.centerInPage();
- winModal.addCloseClickHandler(new CloseClickHandler() {
- @Override
- public void onCloseClick(CloseClientEvent event) {
- winModal.markForDestroy();
- }
- });
-
- ResourceGroupMembershipView membershipView = new ResourceGroupMembershipView(
- ResourceSearchView.this.extendLocatorId("View"), ResourceSearchView.this.groupIdToModify
- .intValue());
-
- membershipView.setSaveButtonHandler(new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- winModal.markForDestroy();
- CoreGUI.refresh();
- }
- });
-
- winModal.addItem(membershipView);
- winModal.show();
- }
- });
- }
-
// //load double click handler for this table
// configureDoubleClickHandler();
@@ -283,20 +231,4 @@ public class ResourceSearchView extends Table {
selectListeners.add(listener);
}
- // -------- Static Utility loaders ------------
-
- public static ResourceSearchView getChildrenOf(String locatorId, int resourceId) {
- return new ResourceSearchView(locatorId, new Criteria("parentId", String.valueOf(resourceId)), MSG
- .view_inventory_resources_title_children());
- }
-
- public static ResourceSearchView getMembersOf(String locatorId, int groupId, boolean canModifyMembers) {
- ResourceSearchView view = new ResourceSearchView(locatorId, new Criteria("groupId", String.valueOf(groupId)),
- MSG.view_inventory_resources_title_members());
- if (canModifyMembers) {
- view.groupIdToModify = Integer.valueOf(groupId);
- }
- return view;
- }
-
}
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 8972e87..cf0ce57 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
@@ -1568,6 +1568,11 @@ view_summaryOverviewForm_message_descriptionChangeSuccess = Description of Resou
view_summaryOverviewForm_error_locationChangeFailure = Failed to change location of Resource with id {0} from [{1}] to [{2}].
view_summaryOverviewForm_message_locationChangeSuccess = Location of Resource with id {0} was changed from [{1}] to [{2}].
+# Group Inventory>Members subtab
+#-----------------------------------------
+view_groupInventoryMembers_button_updateMembership = Update Membership...
+view_groupInventoryMembers_title_updateMembership = Update Membership
+
#==================== Reports ======================
commit df02dc1fcfd0669940a35f0bb9a758cf389fc753
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Dec 10 17:11:35 2010 -0500
make Resource Activity view implement Refreshable
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
index 1f40051..225f0c8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
@@ -19,6 +19,7 @@
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary;
import org.rhq.core.domain.resource.composite.ResourceComposite;
+import org.rhq.enterprise.gui.coregui.client.RefreshableView;
import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
@@ -29,7 +30,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
* @author Ian Springer
*/
// TODO: Implement this.
-public class ActivityView extends LocatableVLayout implements ResourceSelectListener {
+public class ActivityView extends LocatableVLayout implements ResourceSelectListener, RefreshableView {
private ResourceComposite resourceComposite;
private FullHTMLPane iFrame;
@@ -54,7 +55,14 @@ public class ActivityView extends LocatableVLayout implements ResourceSelectList
@Override
public void onResourceSelected(ResourceComposite resourceComposite) {
this.resourceComposite = resourceComposite;
- this.iFrame.setContentsURL("/rhq/resource/summary/overview-plain.xhtml?id=" + resourceComposite.getResource().getId());
}
+ @Override
+ public void refresh() {
+ if (this.iFrame != null) {
+ this.iFrame.setContentsURL("/rhq/resource/summary/overview-plain.xhtml?id=" +
+ this.resourceComposite.getResource().getId());
+ }
+ }
+
}
commit ac06d5dd2a35294540fa8047adc3c2640fd1a702
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Dec 10 17:04:54 2010 -0500
rename group Summary>Overview subtab to Activity; deprecate Resource Summary>Overview subtab and add TODO for its removal; split out code for updating content of group tabs into multiple methods
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 8f6fe0e..6b800b3 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
@@ -56,12 +56,12 @@ import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.inventory.C
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.inventory.HistoryGroupPluginConfigurationView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.monitoring.schedules.SchedulesView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.monitoring.traits.TraitsView;
-import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.summary.OverviewView;
+import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.summary.ActivityView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSearchView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
/**
- * Be able to view members as a resource list, or edit members via selector.
+ * Right panel of the Resource view (#ResourceGroup/*).
*
* @author Jay Shaughnessy
* @author Ian Springer
@@ -83,7 +83,7 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
private TwoLevelTab eventsTab;
// subtabs
- private SubTab summaryOverview;
+ private SubTab summaryActivity;
private SubTab summaryTimeline;
private SubTab monitorGraphs;
private SubTab monitorTables;
@@ -145,11 +145,11 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
summaryTab = new TwoLevelTab(getTabSet().extendLocatorId("Summary"), new ViewName("Summary", MSG
.view_tabs_common_summary()), ImageManager.getResourceIcon(ResourceCategory.SERVICE, Boolean.TRUE));
- summaryOverview = new SubTab(summaryTab.extendLocatorId("Overview"), new ViewName("Overview", MSG
- .view_tabs_common_overview()), null);
+ summaryActivity = new SubTab(summaryTab.extendLocatorId("Activity"), new ViewName("Activity", MSG
+ .view_tabs_common_activity()), null);
summaryTimeline = new SubTab(summaryTab.extendLocatorId("Timeline"), new ViewName("Timeline", MSG
.view_tabs_common_timeline()), null);
- summaryTab.registerSubTabs(summaryOverview, summaryTimeline);
+ summaryTab.registerSubTabs(summaryActivity, summaryTimeline);
tabs.add(summaryTab);
inventoryTab = new TwoLevelTab(getTabSet().extendLocatorId("Inventory"), new ViewName("Inventory", MSG
@@ -217,10 +217,6 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
}
protected void updateTabContent(ResourceGroupComposite groupComposite) {
- boolean enabled;
- boolean visible;
- Canvas canvas;
-
this.groupComposite = groupComposite;
ResourceGroup group = groupComposite.getResourceGroup();
int groupId = group.getId();
@@ -233,13 +229,28 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
GroupCategory groupCategory = groupComposite.getResourceGroup().getGroupCategory();
Set<ResourceTypeFacet> facets = groupComposite.getResourceFacets().getFacets();
- // FullHTMLPane timelinePane = new FullHTMLPane("/rhq/resource/summary/timeline-plain.xhtml?id=" + resource.getId());
- // summaryTab.updateSubTab("Overview", new DashboardView(resource));
- // summaryTab.updateSubTab("Timeline", timelinePane);
+ updateSummaryTab();
+ updateMonitoringTab(groupId, groupCategory, facets);
+ updateInventoryTab(groupId, facets);
+ updateOperationsTab(groupId, groupCategory, facets);
+ updateAlertsTab(groupComposite, groupCategory);
+ updateConfigurationTab(groupId, groupCategory, facets);
+ updateEventsTab(groupComposite, groupCategory, facets);
+
+ this.show();
+ markForRedraw();
+ }
+
+ private void updateSummaryTab() {
// Summary tab is always visible and enabled.
- updateSubTab(this.summaryTab, this.summaryOverview, new OverviewView(this.summaryOverview
+ updateSubTab(this.summaryTab, this.summaryActivity, new ActivityView(this.summaryActivity
.extendLocatorId("View"), this.groupComposite), true, true);
+ // TODO (ips): Add Timeline subtab?
+ }
+ private void updateMonitoringTab(int groupId, GroupCategory groupCategory, Set<ResourceTypeFacet> facets) {
+ boolean visible;
+ Canvas canvas;
if (updateTab(this.monitoringTab, groupCategory == GroupCategory.COMPATIBLE, true)) {
visible = hasMetricsOfType(this.groupComposite, DataType.MEASUREMENT);
canvas = (visible) ? new FullHTMLPane(this.monitorGraphs.extendLocatorId("View"),
@@ -265,10 +276,12 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
updateSubTab(this.monitoringTab, this.monitorCallTime, canvas, visible, true);
// TODO (ips): Add Availability subtab.
}
+ }
+ private void updateInventoryTab(int groupId, Set<ResourceTypeFacet> facets) {
// Inventory tab is always visible and enabled.
- boolean canModifyMembers = !isAutoGroup() && !isAutoCluster()
- && globalPermissions.contains(Permission.MANAGE_INVENTORY);
+ boolean canModifyMembers = (!isAutoGroup() && !isAutoCluster()
+ && globalPermissions.contains(Permission.MANAGE_INVENTORY));
updateSubTab(this.inventoryTab, this.inventoryMembers, ResourceSearchView.getMembersOf(this.inventoryMembers
.extendLocatorId("View"), groupId, canModifyMembers), true, true);
updateSubTab(this.inventoryTab, this.inventoryConn, new CurrentGroupPluginConfigurationView(this.inventoryConn
@@ -277,7 +290,9 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
updateSubTab(this.inventoryTab, this.inventoryConnHistory, new HistoryGroupPluginConfigurationView(
this.inventoryConnHistory.extendLocatorId("View"), this.groupComposite), facets
.contains(ResourceTypeFacet.PLUGIN_CONFIGURATION), true);
+ }
+ private void updateOperationsTab(int groupId, GroupCategory groupCategory, Set<ResourceTypeFacet> facets) {
if (updateTab(this.operationsTab, groupCategory == GroupCategory.COMPATIBLE
&& facets.contains(ResourceTypeFacet.OPERATION), true)) {
updateSubTab(this.operationsTab, this.opHistory, new FullHTMLPane(this.opHistory.extendLocatorId("View"),
@@ -285,20 +300,24 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
updateSubTab(this.operationsTab, this.opSched, new FullHTMLPane(this.opSched.extendLocatorId("View"),
"/rhq/group/operation/groupOperationSchedules-plain.xhtml?groupId=" + groupId), true, true);
}
+ }
+ private void updateAlertsTab(ResourceGroupComposite groupComposite, GroupCategory groupCategory) {
// alerts tab is always visible, even for mixed groups
if (updateTab(this.alertsTab, true, true)) {
// alert history is always available
updateSubTab(this.alertsTab, this.alertHistory, GroupAlertHistoryView.get(this.alertHistory
.extendLocatorId("View"), groupComposite), true, true);
// but alert definitions can only be created on compatible groups
- visible = (groupCategory == GroupCategory.COMPATIBLE);
- canvas = (visible) ? new GroupAlertDefinitionsView(alertDef.extendLocatorId("View"), this.groupComposite)
+ boolean visible = (groupCategory == GroupCategory.COMPATIBLE);
+ Canvas canvas = (visible) ? new GroupAlertDefinitionsView(alertDef.extendLocatorId("View"), this.groupComposite)
: null;
updateSubTab(this.alertsTab, this.alertDef, canvas, visible, true);
}
+ }
- visible = groupCategory == GroupCategory.COMPATIBLE && facets.contains(ResourceTypeFacet.CONFIGURATION);
+ private void updateConfigurationTab(int groupId, GroupCategory groupCategory, Set<ResourceTypeFacet> facets) {
+ boolean visible = (groupCategory == GroupCategory.COMPATIBLE && facets.contains(ResourceTypeFacet.CONFIGURATION));
Set<Permission> groupPermissions = this.groupComposite.getResourcePermission().getPermissions();
if (updateTab(this.configurationTab, visible, visible && groupPermissions.contains(Permission.CONFIGURE_READ))) {
//updateSubTab(this.configurationTab, this.configCurrent, new FullHTMLPane(
@@ -309,16 +328,17 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
.extendLocatorId("View"), "/rhq/group/configuration/history-plain.xhtml?groupId=" + groupId), true,
true);
}
+ }
+
+ private void updateEventsTab(ResourceGroupComposite groupComposite, GroupCategory groupCategory,
+ Set<ResourceTypeFacet> facets) {
// allow mixed groups to show events from supporting resources
- visible = groupCategory == GroupCategory.MIXED
- || (groupCategory == GroupCategory.COMPATIBLE && facets.contains(ResourceTypeFacet.EVENT));
+ boolean visible = (groupCategory == GroupCategory.MIXED
+ || (groupCategory == GroupCategory.COMPATIBLE && facets.contains(ResourceTypeFacet.EVENT)));
if (updateTab(this.eventsTab, visible, true)) {
updateSubTab(this.eventsTab, this.eventHistory, EventCompositeHistoryView.get(this.eventHistory
.extendLocatorId("View"), groupComposite), true, true);
}
-
- this.show();
- markForRedraw();
}
@Override
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java
new file mode 100644
index 0000000..8b34662
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java
@@ -0,0 +1,55 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.summary;
+
+import com.smartgwt.client.widgets.Label;
+
+import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
+import org.rhq.enterprise.gui.coregui.client.RefreshableView;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+
+/**
+ * The content pane for the group Summary>Activity subtab.
+ *
+ * @author Ian Springer
+ */
+// TODO: Implement this.
+public class ActivityView extends LocatableVLayout implements RefreshableView {
+
+ private ResourceGroupComposite groupComposite;
+
+ public ActivityView(String locatorId, ResourceGroupComposite groupComposite) {
+ super(locatorId);
+ this.groupComposite = groupComposite;
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+
+ Label label = new Label("<h3>Coming soon...</h3>");
+ addMember(label);
+ }
+
+ @Override
+ public void refresh() {
+ // TODO: Reload the data.
+ }
+
+}
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
deleted file mode 100644
index 6186726..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/OverviewView.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.summary;
-
-import com.smartgwt.client.widgets.HTMLFlow;
-import com.smartgwt.client.widgets.layout.HLayout;
-
-import org.rhq.core.domain.resource.group.ResourceGroup;
-import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
-import org.rhq.enterprise.gui.coregui.client.RefreshableView;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
-
-/**
- * The content pane for the group Inventory>Overview subtab.
- *
- * @author Ian Springer
- */
-public class OverviewView extends LocatableVLayout implements RefreshableView {
-
- private ResourceGroupComposite groupComposite;
-
- public OverviewView(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(15);
- addMember(spacer);
-
- // TODO
- HTMLFlow html = new HTMLFlow("Activity information will go here");
- addMember(html);
- }
-
- @Override
- public void refresh() {
- // TODO: Reload the data.
- }
-
-}
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 3fe0db2..f2bd570 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
@@ -66,7 +66,7 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTyp
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
/**
- * Right panel of the Resource view.
+ * Right panel of the Resource view (#Resource/*).
*
* @author Greg Hinkle
* @author Ian Springer
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
index f6d2ef7..1f40051 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
@@ -21,18 +21,21 @@ package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary;
import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
* The content pane of the Resource Summary>Activity tab.
*
- * @author Greg Hinkle
+ * @author Ian Springer
*/
-public class ActivityView extends FullHTMLPane implements ResourceSelectListener {
+// TODO: Implement this.
+public class ActivityView extends LocatableVLayout implements ResourceSelectListener {
private ResourceComposite resourceComposite;
+ private FullHTMLPane iFrame;
public ActivityView(String locatorId, ResourceComposite resourceComposite) {
- super(locatorId, null);
+ super(locatorId);
this.resourceComposite = resourceComposite;
}
@@ -40,6 +43,9 @@ public class ActivityView extends FullHTMLPane implements ResourceSelectListener
protected void onDraw() {
super.onDraw();
+ this.iFrame = new FullHTMLPane(extendLocatorId("IFrame"), null);
+ addMember(this.iFrame);
+
if (this.resourceComposite != null) {
onResourceSelected(this.resourceComposite);
}
@@ -48,7 +54,7 @@ public class ActivityView extends FullHTMLPane implements ResourceSelectListener
@Override
public void onResourceSelected(ResourceComposite resourceComposite) {
this.resourceComposite = resourceComposite;
- setContentsURL("/rhq/resource/summary/overview-plain.xhtml?id=" + resourceComposite.getResource().getId());
+ this.iFrame.setContentsURL("/rhq/resource/summary/overview-plain.xhtml?id=" + resourceComposite.getResource().getId());
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewView.java
index 38bbefb..d7b787b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewView.java
@@ -28,8 +28,13 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
* The Resource Summary>Overview tab.
*
* @author Lukas Krejci
+ *
+ * @deprecated This can be removed, since we now display the overview info in the collapsible pane above
+ * the Resource tabs (ips, 12/10/10).
*/
+@Deprecated
public class OverviewView extends LocatableVLayout implements RefreshableView {
+
private OverviewForm form;
public OverviewView(String locatorId, ResourceComposite resourceComposite) {
@@ -48,4 +53,5 @@ public class OverviewView extends LocatableVLayout implements RefreshableView {
public void refresh() {
form.loadData();
}
+
}
commit 363127c74bcf40d9d66708bc6dd417b9c256c5ab
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Dec 10 14:40:11 2010 -0500
Merge "Group Membership" subtab into "Groups" tab for ResourceDetail
Inventory tab. Same pattern as the "Inventory->Members" subtab for
the group view. A button on the "Groups" view will invoke a dialog
window for changing the assigned groups for the resource. Requires
inventory manager permission.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
index 2041523..85625d6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
@@ -27,6 +27,11 @@ import static org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGro
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.types.Overflow;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.events.CloseClickHandler;
+import com.smartgwt.client.widgets.events.CloseClientEvent;
import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
@@ -42,8 +47,10 @@ import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablem
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGroupGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.wizard.GroupCreateWizard;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory.ResourceResourceGroupsView;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWindow;
import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
/**
@@ -54,6 +61,9 @@ public class ResourceGroupListView extends Table<ResourceGroupCompositeDataSourc
private static final String DEFAULT_TITLE = MSG.view_inventory_groups_resourceGroups();
+ // our static factory method will set this to a non-null resource ID if the user can modify that resource's group membership
+ private Integer resourceIdToModify = null;
+
private boolean showDeleteButton = true;
private boolean showNewButton = true;
@@ -176,6 +186,48 @@ public class ResourceGroupListView extends Table<ResourceGroupCompositeDataSourc
});
}
+ if (this.resourceIdToModify != null) {
+ addTableAction(extendLocatorId("Membership"), MSG.view_tabs_common_group_membership() + "...",
+ new AbstractTableAction(TableActionEnablement.ALWAYS) {
+ @Override
+ public void executeAction(ListGridRecord[] selection, Object actionValue) {
+ final LocatableWindow winModal = new LocatableWindow(extendLocatorId("MembershipWindow"));
+ winModal.setTitle(MSG.view_tabs_common_group_membership());
+ winModal.setOverflow(Overflow.VISIBLE);
+ winModal.setShowMinimizeButton(false);
+ winModal.setIsModal(true);
+ winModal.setShowModalMask(true);
+ winModal.setWidth(700);
+ winModal.setHeight(450);
+ winModal.setAutoCenter(true);
+ winModal.setShowResizer(true);
+ winModal.setCanDragResize(true);
+ winModal.centerInPage();
+ winModal.addCloseClickHandler(new CloseClickHandler() {
+ @Override
+ public void onCloseClick(CloseClientEvent event) {
+ winModal.markForDestroy();
+ }
+ });
+
+ ResourceResourceGroupsView membershipView = new ResourceResourceGroupsView(
+ ResourceGroupListView.this.extendLocatorId("MembershipView"),
+ ResourceGroupListView.this.resourceIdToModify.intValue());
+
+ membershipView.setSaveButtonHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ winModal.markForDestroy();
+ CoreGUI.refresh();
+ }
+ });
+
+ winModal.addItem(membershipView);
+ winModal.show();
+ }
+ });
+ }
+
//adding cell double click handler
getListGrid().addCellDoubleClickHandler(new CellDoubleClickHandler() {
@Override
@@ -188,9 +240,16 @@ public class ResourceGroupListView extends Table<ResourceGroupCompositeDataSourc
// -------- Static Utility loaders ------------
- public static ResourceGroupListView getGroupsOf(String locatorId, int explicitResourceId) {
- return new ResourceGroupListView(locatorId, new Criteria("explicitResourceId", String
+ public static ResourceGroupListView getGroupsOf(String locatorId, int explicitResourceId,
+ boolean canModifyMembership) {
+
+ ResourceGroupListView view = new ResourceGroupListView(locatorId, new Criteria("explicitResourceId", String
.valueOf(explicitResourceId)), MSG.view_inventory_groups_resourceGroups());
+ if (canModifyMembership) {
+ view.resourceIdToModify = Integer.valueOf(explicitResourceId);
+ }
+
+ return view;
}
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
index 4c5c31a..8f6fe0e 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
@@ -267,9 +267,10 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
}
// Inventory tab is always visible and enabled.
- enabled = !isAutoGroup() && !isAutoCluster() && globalPermissions.contains(Permission.MANAGE_INVENTORY); // true, then user can modify group membership
+ boolean canModifyMembers = !isAutoGroup() && !isAutoCluster()
+ && globalPermissions.contains(Permission.MANAGE_INVENTORY);
updateSubTab(this.inventoryTab, this.inventoryMembers, ResourceSearchView.getMembersOf(this.inventoryMembers
- .extendLocatorId("View"), groupId, enabled), true, true);
+ .extendLocatorId("View"), groupId, canModifyMembers), true, true);
updateSubTab(this.inventoryTab, this.inventoryConn, new CurrentGroupPluginConfigurationView(this.inventoryConn
.extendLocatorId("View"), this.groupComposite), facets.contains(ResourceTypeFacet.PLUGIN_CONFIGURATION),
true);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
index cf354a0..41f9b0e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
@@ -66,7 +66,7 @@ public class ResourceSearchView extends Table {
private List<ResourceSelectListener> selectListeners = new ArrayList<ResourceSelectListener>();
- // our static factory method will set this to a non-null resource group ID iff the user can modify that group's membership
+ // our static factory method will set this to a non-null resource group ID if the user can modify that group's membership
private Integer groupIdToModify = null;
/**
@@ -196,12 +196,12 @@ public class ResourceSearchView extends Table {
});
if (this.groupIdToModify != null) {
- addTableAction(extendLocatorId("Membership"), MSG.view_tabs_common_group_membership() + "...",
+ addTableAction(extendLocatorId("Members"), MSG.view_tabs_common_group_members() + "...",
new AbstractTableAction(TableActionEnablement.ALWAYS) {
@Override
public void executeAction(ListGridRecord[] selection, Object actionValue) {
- final LocatableWindow winModal = new LocatableWindow(extendLocatorId("MembershipWindow"));
- winModal.setTitle(MSG.view_tabs_common_group_membership());
+ final LocatableWindow winModal = new LocatableWindow(extendLocatorId("MembersWindow"));
+ winModal.setTitle(MSG.view_tabs_common_group_members());
winModal.setOverflow(Overflow.VISIBLE);
winModal.setShowMinimizeButton(false);
winModal.setIsModal(true);
@@ -290,10 +290,10 @@ public class ResourceSearchView extends Table {
.view_inventory_resources_title_children());
}
- public static ResourceSearchView getMembersOf(String locatorId, int groupId, boolean canModifyMembership) {
+ public static ResourceSearchView getMembersOf(String locatorId, int groupId, boolean canModifyMembers) {
ResourceSearchView view = new ResourceSearchView(locatorId, new Criteria("groupId", String.valueOf(groupId)),
MSG.view_inventory_resources_title_members());
- if (canModifyMembership) {
+ if (canModifyMembers) {
view.groupIdToModify = Integer.valueOf(groupId);
}
return view;
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 3702e88..3fe0db2 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
@@ -261,8 +261,10 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
.extendLocatorId("View"), "/rhq/resource/summary/timeline-plain.xhtml?id=" + resource.getId()), true, true);
}
+ // Inventory Tab (always enabled and visible)
private void updateInventoryTabContent(ResourceComposite resourceComposite, Resource resource,
- Set<ResourceTypeFacet> facets) {
+ Set<ResourceTypeFacet> facets) {
+
ResourceType type = this.resourceComposite.getResource().getResourceType();
boolean visible = !type.getChildResourceTypes().isEmpty();
Canvas canvas = (visible) ? ResourceCompositeSearchView.getChildrenOf(this.inventoryTab
@@ -280,13 +282,9 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
canvas = (visible) ? new Canvas() : null; // TODO: Add real canvas when visible
updateSubTab(this.inventoryTab, this.inventoryConnHistory, canvas, visible, true);
+ boolean canModifyMembership = globalPermissions.contains(Permission.MANAGE_INVENTORY);
updateSubTab(this.inventoryTab, this.inventoryGroups, ResourceGroupListView.getGroupsOf(this.inventoryTab
- .extendLocatorId("GroupsView"), resource.getId()), true, true);
-
- //enabled = globalPermissions.contains(Permission.MANAGE_INVENTORY);
- //canvas = (enabled) ? new ResourceResourceGroupsView(this.inventoryTab.extendLocatorId("GroupMembershipView"),
- // resourceId) : null;
- //updateSubTab(this.inventoryTab, this.inventoryGroupMembership, canvas, true, enabled);
+ .extendLocatorId("GroupsView"), resource.getId(), canModifyMembership), true, true);
boolean enabled = globalPermissions.contains(Permission.MANAGE_INVENTORY);
canvas = (enabled) ? new ResourceResourceAgentView(this.inventoryTab.extendLocatorId("AgentView"), resourceId)
@@ -355,7 +353,7 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
}
private void updateConfigurationTabContent(ResourceComposite resourceComposite, Resource resource,
- ResourcePermission resourcePermissions, Set<ResourceTypeFacet> facets) {
+ ResourcePermission resourcePermissions, Set<ResourceTypeFacet> facets) {
if (updateTab(this.configurationTab, facets.contains(ResourceTypeFacet.CONFIGURATION), resourcePermissions
.isConfigureRead())) {
@@ -366,7 +364,7 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
.extendLocatorId("ConfigHistView"), resource.getId()), true, true);
}
}
-
+
private void updateContentTabContent(Resource resource, Set<ResourceTypeFacet> facets) {
if (updateTab(this.contentTab, facets.contains(ResourceTypeFacet.CONTENT), true)) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/ResourceResourceGroupsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/ResourceResourceGroupsView.java
index 8b34aee..dad7b42 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/ResourceResourceGroupsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/ResourceResourceGroupsView.java
@@ -25,7 +25,6 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
-import com.smartgwt.client.widgets.layout.LayoutSpacer;
import com.smartgwt.client.widgets.toolbar.ToolStrip;
import org.rhq.core.domain.criteria.ResourceCriteria;
@@ -45,6 +44,7 @@ public class ResourceResourceGroupsView extends LocatableVLayout {
private int resourceId;
private Resource resource;
private ResourceResourceGroupSelector selector;
+ private ClickHandler saveButtonHandler;
public ResourceResourceGroupsView(String locatorId, int resourceId) {
super(locatorId);
@@ -52,6 +52,17 @@ public class ResourceResourceGroupsView extends LocatableVLayout {
this.resourceId = resourceId;
}
+ /**
+ * Allows an external component to hook into the save button. The given
+ * handler will be invoked when the save button is pressed. If <code>null</code>
+ * is given, then no external handler will be called.
+ *
+ * @param saveButtonHandler
+ */
+ public void setSaveButtonHandler(ClickHandler saveButtonHandler) {
+ this.saveButtonHandler = saveButtonHandler;
+ }
+
@Override
protected void onDraw() {
super.onDraw();
@@ -62,13 +73,17 @@ public class ResourceResourceGroupsView extends LocatableVLayout {
public void build() {
ToolStrip toolStrip = new ToolStrip();
toolStrip.setWidth100();
-
- toolStrip.addMember(new LayoutSpacer());
+ toolStrip.setExtraSpace(10);
+ toolStrip.setMembersMargin(5);
+ toolStrip.setLayoutMargin(5);
IButton saveButton = new LocatableIButton(this.extendLocatorId("Save"), MSG.common_button_save());
saveButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
save();
+ if (ResourceResourceGroupsView.this.saveButtonHandler != null) {
+ ResourceResourceGroupsView.this.saveButtonHandler.onClick(clickEvent);
+ }
}
});
@@ -104,9 +119,13 @@ public class ResourceResourceGroupsView extends LocatableVLayout {
}
public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(
- new Message(MSG.view_resourceResourceGroupList_message_updateSuccess(
- ResourceResourceGroupsView.this.resource.getName()), Message.Severity.Info));
+ CoreGUI
+ .getMessageCenter()
+ .notify(
+ new Message(
+ MSG
+ .view_resourceResourceGroupList_message_updateSuccess(ResourceResourceGroupsView.this.resource
+ .getName()), Message.Severity.Info));
CoreGUI.refresh();
}
});
@@ -114,7 +133,7 @@ public class ResourceResourceGroupsView extends LocatableVLayout {
private int[] getSelectedResourceGroupIds() {
Set<Integer> selectedIds = this.selector.getSelection();
- int[] selection = new int[selectedIds.size()];
+ int[] selection = new int[selectedIds.size()];
int i = 0;
for (Integer id : selectedIds) {
selection[i++] = id;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGroupGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGroupGWTServiceImpl.java
index 2015091..c0ba7b0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGroupGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGroupGWTServiceImpl.java
@@ -81,7 +81,8 @@ public class ResourceGroupGWTServiceImpl extends AbstractGWTServiceImpl implemen
public void setAssignedResourceGroupsForResource(int resourceId, int[] resourceGroupIds, boolean setType) {
try {
- groupManager.setAssignedResources(getSessionSubject(), resourceId, resourceGroupIds, setType);
+ groupManager.setAssignedResourceGroupsForResource(getSessionSubject(), resourceId, resourceGroupIds,
+ setType);
} catch (Throwable t) {
throw new RuntimeException(ThrowableUtil.getAllMessages(t));
}
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index ec86ed5..8972e87 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
@@ -1328,8 +1328,9 @@ view_tabs_common_schedules = Schedules
view_tabs_common_calltime = Calltime
view_tabs_common_inventory = Inventory
view_tabs_common_groups = Groups
-view_tabs_common_group_membership = Group Membership
view_tabs_common_members = Members
+view_tabs_common_group_members = Group Members
+view_tabs_common_group_membership = Group Membership
view_tabs_common_child_resources = Child Resources
view_tabs_common_child_history = Child History
view_tabs_common_connectionSettings = Connection Settings
@@ -1556,7 +1557,6 @@ view_summaryOverviewForm_field_name = Name
view_summaryOverviewForm_field_description = Description
view_summaryOverviewForm_field_location = Location
view_summaryOverviewForm_field_version = Version
-view_summaryOverviewForm_field_parent = Parent
view_summaryOverviewForm_error_traitsLoadFailure = Failed to load traits for {0}.
view_summaryOverviewForm_label_plugin = Plugin:
view_summaryOverviewForm_label_type = Type:
commit 0c5d2a59cb88d563a4b0798f94a19c48c97467b4
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Dec 10 13:46:35 2010 -0500
use image manager to get the edit icon (in case we want to change the pencil in the future)
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java
index ee55644..f9d38a8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java
@@ -24,6 +24,13 @@ public class ImageManager {
public static final String IMAGES_DIR = "images/";
/**
+ * Returns a generic edit icon.
+ */
+ public static String getEditIcon() {
+ return "[SKIN]/actions/edit.png";
+ }
+
+ /**
* Returns the operation status icon. If status is null, returns
* the plain, unbadged, operation icon.
*/
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
index 481bbc8..9b6a063 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
@@ -128,6 +128,7 @@ import org.rhq.core.domain.configuration.definition.constraint.IntegerRangeConst
import org.rhq.core.domain.configuration.definition.constraint.RegexConstraint;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.ImageManager;
import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
@@ -971,8 +972,8 @@ public class ConfigurationEditor extends LocatableVLayout {
ListGridField editField = new ListGridField("edit", 20);
editField.setType(ListGridFieldType.ICON);
- // editField.setIcon(Window.getImgURL("[SKIN]/actions/edit.png"));
- editField.setCellIcon(Window.getImgURL("[SKIN]/actions/edit.png"));
+ // editField.setIcon(Window.getImgURL(ImageManager.getEditIcon()));
+ editField.setCellIcon(Window.getImgURL(ImageManager.getEditIcon()));
editField.setCanEdit(false);
editField.setCanGroupBy(false);
editField.setCanSort(false);
@@ -1652,5 +1653,5 @@ public class ConfigurationEditor extends LocatableVLayout {
return valid;
}
}
-
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
index 3e2f090..1f266b8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
@@ -54,6 +54,7 @@ import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.configuration.definition.PropertyDefinition;
import org.rhq.core.domain.configuration.definition.PropertyDefinitionList;
import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
+import org.rhq.enterprise.gui.coregui.client.ImageManager;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
@@ -161,7 +162,7 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
final PropertySimple propertySimple, final FormItem dynamicItem) {
FormItemIcon icon = new FormItemIcon();
- icon.setSrc("[SKIN]/actions/edit.png");
+ icon.setSrc(ImageManager.getEditIcon());
icon.setName("Edit Member Values");
icon.setNeverDisable(true);
icon.addFormItemClickHandler(new FormItemClickHandler() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EnhancedDynamicForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EnhancedDynamicForm.java
index b2a4bf9..0f27a5c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EnhancedDynamicForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EnhancedDynamicForm.java
@@ -46,6 +46,7 @@ import com.smartgwt.client.widgets.form.fields.events.KeyPressEvent;
import com.smartgwt.client.widgets.form.fields.events.KeyPressHandler;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.ImageManager;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
/**
@@ -142,7 +143,7 @@ public class EnhancedDynamicForm extends LocatableDynamicForm {
FormItemIcon editIcon = new FormItemIcon();
editIcon.setName("Edit");
- editIcon.setSrc("[SKIN]/actions/edit.png");
+ editIcon.setSrc(ImageManager.getEditIcon());
staticTextItem.setIcons(editIcon);
staticTextItem.setShowIcons(false);
@@ -196,7 +197,7 @@ public class EnhancedDynamicForm extends LocatableDynamicForm {
});
togglableTextItem.setShowIfCondition(new FormItemIfFunction() {
public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- @SuppressWarnings({"UnnecessaryLocalVariable"})
+ @SuppressWarnings( { "UnnecessaryLocalVariable" })
boolean editing = staticTextItem.getAttributeAsBoolean("editing");
return editing;
}
commit 5f0e41cd9e4d0530dacc76077b3ff568422bf8ba
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Dec 10 11:49:05 2010 -0500
rename resource Summary>Dashboard subtab to Summary>Activity; split up tab update code in ResourceDetailsView into multiple methods
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 8181b88..3702e88 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
@@ -60,7 +60,7 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.schedules.SchedulesView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.traits.TraitsView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.OperationHistoryView;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary.DashboardView;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary.ActivityView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary.OverviewView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
@@ -88,7 +88,7 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
private TwoLevelTab contentTab;
private SubTab summaryOverview;
- private SubTab summaryDashboard;
+ private SubTab summaryActivity;
private SubTab summaryTimeline;
private SubTab monitorGraphs;
private SubTab monitorTables;
@@ -126,11 +126,11 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
.view_tabs_common_summary()), ImageManager.getResourceIcon(ResourceCategory.SERVICE, Boolean.TRUE));
summaryOverview = new SubTab(summaryTab.extendLocatorId("Overview"), new ViewName("Overview", MSG
.view_tabs_common_overview()), null);
- summaryDashboard = new SubTab(summaryTab.extendLocatorId("Dashboard"), new ViewName("Dashboard", MSG
- .view_tabs_common_dashboard()), null);
+ summaryActivity = new SubTab(summaryTab.extendLocatorId("Activity"), new ViewName("Activity", MSG
+ .view_tabs_common_activity()), null);
summaryTimeline = new SubTab(summaryTab.extendLocatorId("Timeline"), new ViewName("Timeline", MSG
.view_tabs_common_timeline()), null);
- summaryTab.registerSubTabs(summaryOverview, summaryDashboard, summaryTimeline);
+ summaryTab.registerSubTabs(summaryOverview, summaryActivity, summaryTimeline);
tabs.add(summaryTab);
inventoryTab = new TwoLevelTab(getTabSet().extendLocatorId("Inventory"), new ViewName("Inventory", MSG
@@ -226,10 +226,6 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
}
protected void updateTabContent(ResourceComposite resourceComposite) {
- boolean enabled;
- boolean visible;
- Canvas canvas;
-
this.resourceComposite = resourceComposite;
Resource resource = this.resourceComposite.getResource();
getTitleBar().setResource(this.resourceComposite);
@@ -241,47 +237,35 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
ResourcePermission resourcePermissions = this.resourceComposite.getResourcePermission();
Set<ResourceTypeFacet> facets = this.resourceComposite.getResourceFacets().getFacets();
- // Summary Tab
+ updateSummaryTabContent(resource);
+ updateInventoryTabContent(resourceComposite, resource, facets);
+ updateAlertsTabContent(resourceComposite);
+ updateMonitoringTabContent(resource, facets);
+ updateEventsTabContent(resourceComposite, facets);
+ updateOperationsTabContent(resource, facets);
+ updateConfigurationTabContent(resourceComposite, resource, resourcePermissions, facets);
+ updateContentTabContent(resource, facets);
+
+ this.show();
+ markForRedraw();
+ }
+
+ private void updateSummaryTabContent(Resource resource) {
updateSubTab(this.summaryTab, this.summaryOverview, new OverviewView(this.summaryTab
.extendLocatorId("OverviewView"), this.resourceComposite), true, true);
- updateSubTab(this.summaryTab, this.summaryDashboard, new DashboardView(this.summaryDashboard
+ updateSubTab(this.summaryTab, this.summaryActivity, new ActivityView(this.summaryActivity
.extendLocatorId("View"), this.resourceComposite), true, true);
updateSubTab(this.summaryTab, this.summaryTimeline, new FullHTMLPane(this.summaryTimeline
.extendLocatorId("View"), "/rhq/resource/summary/timeline-plain.xhtml?id=" + resource.getId()), true, true);
+ }
- // Monitoring Tab
- visible = hasMetricsOfType(this.resourceComposite, DataType.MEASUREMENT);
- //canvas = (visible) ? new GraphListView(this.monitoringTab.extendLocatorId("GraphListView"), resource) : null;
- canvas = (visible) ? new FullHTMLPane(this.monitorGraphs.extendLocatorId("View"),
- "/rhq/resource/monitor/graphs-plain.xhtml?id=" + resource.getId()) : null;
- updateSubTab(this.monitoringTab, this.monitorGraphs, canvas, visible, true);
-
- // visible = same test as above
- canvas = (visible) ? new FullHTMLPane(this.monitorTables.extendLocatorId("View"),
- "/rhq/common/monitor/tables-plain.xhtml?id=" + resource.getId()) : null;
- updateSubTab(this.monitoringTab, this.monitorTables, canvas, visible, true);
-
- visible = hasMetricsOfType(this.resourceComposite, DataType.TRAIT);
- canvas = (visible) ? new TraitsView(this.monitoringTab.extendLocatorId("TraitsView"), resource.getId()) : null;
- updateSubTab(this.monitoringTab, this.monitorTraits, canvas, visible, true);
-
- updateSubTab(this.monitoringTab, this.monitorAvail, new FullHTMLPane(this.monitorAvail.extendLocatorId("View"),
- "/rhq/resource/monitor/availabilityHistory-plain.xhtml?id=" + resource.getId()), true, true);
-
- updateSubTab(this.monitoringTab, this.monitorSched, new SchedulesView(monitoringTab
- .extendLocatorId("SchedulesView"), resource.getId()), hasMetricsOfType(this.resourceComposite, null), true);
-
- visible = facets.contains(ResourceTypeFacet.CALL_TIME);
- canvas = (visible) ? new FullHTMLPane(this.monitorCallTime.extendLocatorId("View"),
- "/rhq/resource/monitor/response-plain.xhtml?id=" + resource.getId()) : null;
- updateSubTab(this.monitoringTab, this.monitorCallTime, canvas, visible, true);
-
- // Inventory Tab
+ private void updateInventoryTabContent(ResourceComposite resourceComposite, Resource resource,
+ Set<ResourceTypeFacet> facets) {
ResourceType type = this.resourceComposite.getResource().getResourceType();
- visible = !type.getChildResourceTypes().isEmpty();
- canvas = (visible) ? ResourceCompositeSearchView.getChildrenOf(this.inventoryTab
+ boolean visible = !type.getChildResourceTypes().isEmpty();
+ Canvas canvas = (visible) ? ResourceCompositeSearchView.getChildrenOf(this.inventoryTab
.extendLocatorId("ChildrenView"), resourceComposite) : null;
updateSubTab(this.inventoryTab, this.inventoryChildren, canvas, visible, true);
@@ -293,7 +277,7 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
updateSubTab(this.inventoryTab, this.inventoryConn, canvas, visible, true);
// same test, use above setting for 'visible'
- canvas = (visible) ? new Canvas() : null; // TODO: Add real canvas when visible
+ canvas = (visible) ? new Canvas() : null; // TODO: Add real canvas when visible
updateSubTab(this.inventoryTab, this.inventoryConnHistory, canvas, visible, true);
updateSubTab(this.inventoryTab, this.inventoryGroups, ResourceGroupListView.getGroupsOf(this.inventoryTab
@@ -304,13 +288,57 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
// resourceId) : null;
//updateSubTab(this.inventoryTab, this.inventoryGroupMembership, canvas, true, enabled);
- //Agent subtab
- enabled = globalPermissions.contains(Permission.MANAGE_INVENTORY);
+ boolean enabled = globalPermissions.contains(Permission.MANAGE_INVENTORY);
canvas = (enabled) ? new ResourceResourceAgentView(this.inventoryTab.extendLocatorId("AgentView"), resourceId)
: null;
updateSubTab(this.inventoryTab, this.inventoryAgent, canvas, true, enabled);
+ }
+
+ private void updateAlertsTabContent(ResourceComposite resourceComposite) {
+ updateSubTab(this.alertsTab, this.alertHistory, ResourceAlertHistoryView.get(this.alertHistory
+ .extendLocatorId("View"), resourceComposite), true, true);
+
+ updateSubTab(this.alertsTab, this.alertDef, new ResourceAlertDefinitionsView(alertsTab
+ .extendLocatorId("AlertDefView"), this.resourceComposite), true, true);
+ }
- // Operations Tab
+ private void updateMonitoringTabContent(Resource resource, Set<ResourceTypeFacet> facets) {
+ boolean visible = hasMetricsOfType(this.resourceComposite, DataType.MEASUREMENT);
+ //canvas = (visible) ? new GraphListView(this.monitoringTab.extendLocatorId("GraphListView"), resource) : null;
+ Canvas canvas = (visible) ? new FullHTMLPane(this.monitorGraphs.extendLocatorId("View"),
+ "/rhq/resource/monitor/graphs-plain.xhtml?id=" + resource.getId()) : null;
+ updateSubTab(this.monitoringTab, this.monitorGraphs, canvas, visible, true);
+
+ // visible = same test as above
+ canvas = (visible) ? new FullHTMLPane(this.monitorTables.extendLocatorId("View"),
+ "/rhq/common/monitor/tables-plain.xhtml?id=" + resource.getId()) : null;
+ updateSubTab(this.monitoringTab, this.monitorTables, canvas, visible, true);
+
+ visible = hasMetricsOfType(this.resourceComposite, DataType.TRAIT);
+ canvas = (visible) ? new TraitsView(this.monitoringTab.extendLocatorId("TraitsView"), resource.getId()) : null;
+ updateSubTab(this.monitoringTab, this.monitorTraits, canvas, visible, true);
+
+ updateSubTab(this.monitoringTab, this.monitorAvail, new FullHTMLPane(this.monitorAvail.extendLocatorId("View"),
+ "/rhq/resource/monitor/availabilityHistory-plain.xhtml?id=" + resource.getId()), true, true);
+
+ updateSubTab(this.monitoringTab, this.monitorSched, new SchedulesView(monitoringTab
+ .extendLocatorId("SchedulesView"), resource.getId()), hasMetricsOfType(this.resourceComposite, null), true);
+
+ visible = facets.contains(ResourceTypeFacet.CALL_TIME);
+ canvas = (visible) ? new FullHTMLPane(this.monitorCallTime.extendLocatorId("View"),
+ "/rhq/resource/monitor/response-plain.xhtml?id=" + resource.getId()) : null;
+ updateSubTab(this.monitoringTab, this.monitorCallTime, canvas, visible, true);
+ }
+
+ private void updateEventsTabContent(ResourceComposite resourceComposite, Set<ResourceTypeFacet> facets) {
+ if (updateTab(this.eventsTab, facets.contains(ResourceTypeFacet.EVENT), true)) {
+
+ updateSubTab(this.eventsTab, this.eventHistory, EventCompositeHistoryView.get(this.eventsTab
+ .extendLocatorId("CompositeHistoryView"), resourceComposite), true, true);
+ }
+ }
+
+ private void updateOperationsTabContent(Resource resource, Set<ResourceTypeFacet> facets) {
if (updateTab(this.operationsTab, facets.contains(ResourceTypeFacet.OPERATION), true)) {
// comment out GWT-based operation history until...
// 1) user can delete history if they possess the appropriate permissions
@@ -324,15 +352,10 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
updateSubTab(this.operationsTab, this.opSched, new FullHTMLPane(this.opSched.extendLocatorId("View"),
"/rhq/resource/operation/resourceOperationSchedules-plain.xhtml?id=" + resource.getId()), true, true);
}
+ }
- // Alerts Tab
- updateSubTab(this.alertsTab, this.alertHistory, ResourceAlertHistoryView.get(this.alertHistory
- .extendLocatorId("View"), resourceComposite), true, true);
-
- updateSubTab(this.alertsTab, this.alertDef, new ResourceAlertDefinitionsView(alertsTab
- .extendLocatorId("AlertDefView"), this.resourceComposite), true, true);
-
- // Configuration Tab
+ private void updateConfigurationTabContent(ResourceComposite resourceComposite, Resource resource,
+ ResourcePermission resourcePermissions, Set<ResourceTypeFacet> facets) {
if (updateTab(this.configurationTab, facets.contains(ResourceTypeFacet.CONFIGURATION), resourcePermissions
.isConfigureRead())) {
@@ -342,15 +365,9 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
updateSubTab(this.configurationTab, this.configHistory, ConfigurationHistoryView.getHistoryOf(this
.extendLocatorId("ConfigHistView"), resource.getId()), true, true);
}
-
- // Events Tab
- if (updateTab(this.eventsTab, facets.contains(ResourceTypeFacet.EVENT), true)) {
-
- updateSubTab(this.eventsTab, this.eventHistory, EventCompositeHistoryView.get(this.eventsTab
- .extendLocatorId("CompositeHistoryView"), resourceComposite), true, true);
- }
-
- // Content Tab
+ }
+
+ private void updateContentTabContent(Resource resource, Set<ResourceTypeFacet> facets) {
if (updateTab(this.contentTab, facets.contains(ResourceTypeFacet.CONTENT), true)) {
updateSubTab(this.contentTab, this.contentDeployed, new FullHTMLPane(this.contentDeployed
@@ -367,9 +384,6 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
.extendLocatorId("View"), "/rhq/resource/content/history-plain.xhtml?id=" + resource.getId()), true,
true);
}
-
- this.show();
- markForRedraw();
}
public Integer getSelectedItemId() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
new file mode 100644
index 0000000..f6d2ef7
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
@@ -0,0 +1,54 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary;
+
+import org.rhq.core.domain.resource.composite.ResourceComposite;
+import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
+
+/**
+ * The content pane of the Resource Summary>Activity tab.
+ *
+ * @author Greg Hinkle
+ */
+public class ActivityView extends FullHTMLPane implements ResourceSelectListener {
+
+ private ResourceComposite resourceComposite;
+
+ public ActivityView(String locatorId, ResourceComposite resourceComposite) {
+ super(locatorId, null);
+ this.resourceComposite = resourceComposite;
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+ if (this.resourceComposite != null) {
+ onResourceSelected(this.resourceComposite);
+ }
+ }
+
+ @Override
+ public void onResourceSelected(ResourceComposite resourceComposite) {
+ this.resourceComposite = resourceComposite;
+ setContentsURL("/rhq/resource/summary/overview-plain.xhtml?id=" + resourceComposite.getResource().getId());
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/DashboardView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/DashboardView.java
deleted file mode 100644
index cb25a1d..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/DashboardView.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary;
-
-import org.rhq.core.domain.resource.composite.ResourceComposite;
-import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
-
-/**
- * The Resource Summary>Dashboard tab.
- *
- * @author Greg Hinkle
- */
-public class DashboardView extends FullHTMLPane implements ResourceSelectListener {
-
- private ResourceComposite resourceComposite;
-
- public DashboardView(String locatorId, ResourceComposite resourceComposite) {
- super(locatorId, null);
- this.resourceComposite = resourceComposite;
- }
-
- @Override
- protected void onDraw() {
- super.onDraw();
-
- if (this.resourceComposite != null) {
- onResourceSelected(this.resourceComposite);
- }
- }
-
- @Override
- public void onResourceSelected(ResourceComposite resourceComposite) {
- this.resourceComposite = resourceComposite;
- setContentsURL("/rhq/resource/summary/overview-plain.xhtml?id=" + resourceComposite.getResource().getId());
- }
-
-}
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 1f37cfc..ec86ed5 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
@@ -1313,6 +1313,7 @@ view_tree_common_contextMenu_saveChartToDashboardFailure = Failed to save the da
view_tree_common_contextMenu_loadFailed_dashboard = Failed to load user dashboards
view_tree_common_contextMenu_loadFailed_manualAddChildren = Failed to load platform manual add children
view_tree_group_error_updateAutoCluster = Failed to create or update autocluster backing group. key: [{0}]
+view_tabs_common_activity = Activity
view_tabs_common_agent = Agent
view_tabs_common_summary = Summary
view_tabs_common_overview = Overview
commit b20dc08959a393b0f938cc4c2ecdac8ab614afd6
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Dec 10 11:07:38 2010 -0500
fix so subtab content refreshes when you switch back to a subtab (https://bugzilla.redhat.com/show_bug.cgi?id=661528)
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 fc22c7a..d84b01f 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
@@ -19,6 +19,7 @@
*/
package org.rhq.enterprise.gui.coregui.client.alert;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashMap;
@@ -103,7 +104,8 @@ public class AlertHistoryView extends TableSection<AlertDataSource> {
@Override
protected void configureTable() {
- getListGrid().setFields(getDataSource().getListGridFields().toArray(new ListGridField[0]));
+ ArrayList<ListGridField> dataSourceFields = getDataSource().getListGridFields();
+ getListGrid().setFields(dataSourceFields.toArray(new ListGridField[dataSourceFields.size()]));
setupTableInteractions();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
index 6040959..91f42a8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
@@ -236,8 +236,8 @@ public abstract class AbstractTwoLevelTabSetView<T, U extends Layout> extends Lo
this.tabSet.selectTab(tab);
}
- Canvas subView = subtab.getCanvas();
- if (subView instanceof BookmarkableView) {
+ Canvas subView = subtab.getCanvas();
+ if (subView instanceof BookmarkableView && !viewPath.isEnd()) {
// Handle any remaining view items (e.g. id of a selected item in a subtab that contains a Master-Details view).
((BookmarkableView) subView).renderView(viewPath);
} else if (subView instanceof RefreshableView) {
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 f848f36..6186726 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
@@ -23,17 +23,16 @@ import com.smartgwt.client.widgets.layout.HLayout;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
-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.RefreshableView;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
- * The group Inventory>Overview subtab.
+ * The content pane for the group Inventory>Overview subtab.
*
* @author Ian Springer
*/
-public class OverviewView extends LocatableVLayout {
- private ResourceGroupGWTServiceAsync resourceGroupService = GWTServiceLookup.getResourceGroupService();
+public class OverviewView extends LocatableVLayout implements RefreshableView {
+
private ResourceGroupComposite groupComposite;
public OverviewView(String locatorId, ResourceGroupComposite groupComposite) {
@@ -55,4 +54,10 @@ public class OverviewView extends LocatableVLayout {
HTMLFlow html = new HTMLFlow("Activity information will go here");
addMember(html);
}
+
+ @Override
+ public void refresh() {
+ // TODO: Reload the data.
+ }
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/ResourceResourceAgentView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/ResourceResourceAgentView.java
index 1ebf586..227eac9 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/ResourceResourceAgentView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/ResourceResourceAgentView.java
@@ -16,7 +16,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory;
import java.util.ArrayList;
@@ -33,20 +32,23 @@ import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import org.rhq.core.domain.resource.Agent;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
+import org.rhq.enterprise.gui.coregui.client.RefreshableView;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
+ * The content pane for the Resource Inventory>Agent subtab.
+ *
* @author Simeon Pinder
*/
-public class ResourceResourceAgentView extends LocatableVLayout {
+public class ResourceResourceAgentView extends LocatableVLayout implements RefreshableView {
private int resourceId;
+ private LocatableDynamicForm form;
private StaticTextItem nameValue;
private StaticTextItem addressValue;
private StaticTextItem portValue;
- private StaticTextItem agentStatus;
private FormItemIcon agentStatusIcon;
private StaticTextItem lastAvailReportValue;
private StaticTextItem endpointValue;
@@ -61,100 +63,108 @@ public class ResourceResourceAgentView extends LocatableVLayout {
protected void onDraw() {
super.onDraw();
- build();
+ setLeft("10%");
+ setWidth("80%");
+
+ this.form = new LocatableDynamicForm(extendLocatorId("Agent_Info"));
+ final List<FormItem> formItems = createFormItems();
+ this.form.setItems(formItems.toArray(new FormItem[formItems.size()]));
+ loadData();
+ this.addMember(this.form);
}
- public void build() {
- LocatableDynamicForm currentAgentInfo = new LocatableDynamicForm(extendLocatorId("Agent_Info"));
- populateAgentInfo(this.resourceId, currentAgentInfo);
- this.addMember(currentAgentInfo);
+ @Override
+ public void refresh() {
+ loadData();
}
- private void populateAgentInfo(final int id, final LocatableDynamicForm currentAgentInfo) {
- if (currentAgentInfo != null) {
- setLeft("10%");
- setWidth("80%");
- final List<FormItem> formItems = new ArrayList<FormItem>();
- HeaderItem headerItem = new HeaderItem("header", MSG.view_inventory_summary_agent_title());
- headerItem.setValue(MSG.view_inventory_summary_agent_title());
- formItems.add(headerItem);
- formItems.add(new SpacerItem());
- //populate remaining details
- GWTServiceLookup.getAgentService().getAgentForResource(id, new AsyncCallback<Agent>() {
- @Override
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.view_inventory_summary_agent_error1() + id + ".", caught);
- }
+ private List<FormItem> createFormItems() {
+ final List<FormItem> formItems = new ArrayList<FormItem>();
+ HeaderItem headerItem = new HeaderItem("header", MSG.view_inventory_summary_agent_title());
+ headerItem.setValue(MSG.view_inventory_summary_agent_title());
+ formItems.add(headerItem);
+ formItems.add(new SpacerItem());
+
+ // Name
+ nameValue = new StaticTextItem("name", MSG.common_title_name());
+ formItems.add(nameValue);
+
+ // Address
+ String address = "address";
+ addressValue = new StaticTextItem(address, MSG.common_title_address());
+ formItems.add(addressValue);
+
+ // Port
+ String port = "port";
+ portValue = new StaticTextItem(port, MSG.common_title_port());
+ formItems.add(portValue);
+
+ // Agent Status
+ agentStatusIcon = new FormItemIcon();
+ agentStatusIcon.setSrc(ImageManager.getAvailabilityLargeIcon(null));
+ StaticTextItem agentStatus =
+ new StaticTextItem("agent-comm-status", MSG.view_inventory_summary_agent_status_title());
+ agentStatus.setIcons(agentStatusIcon);
+ agentStatus.setWrapTitle(false);
+ formItems.add(agentStatus);
+
+ // Last Received Avail report
+ String lastAvailReport = "last-avail-report";
+ lastAvailReportValue = new StaticTextItem(lastAvailReport, MSG
+ .view_inventory_summary_agent_last_title());
+ lastAvailReportValue.setWrapTitle(false);
+ formItems.add(lastAvailReportValue);
+
+ // Full Endpoint
+ String fullEndpoint = "full-endpoint";
+ endpointValue = new StaticTextItem(fullEndpoint, MSG.view_inventory_summary_agent_fullEnpoint());
+ formItems.add(endpointValue);
+
+ return formItems;
+ }
- @Override
- public void onSuccess(Agent agent) {
- //name
- String name = "name";
- nameValue = new StaticTextItem(name, MSG.common_title_name());
- nameValue.setValue(agent.getName());
- formItems.add(nameValue);
- //address
- String address = "address";
- addressValue = new StaticTextItem(address, MSG.common_title_address());
- addressValue.setValue(agent.getAddress());
- formItems.add(addressValue);
- //port
- String port = "port";
- portValue = new StaticTextItem(port, MSG.common_title_port());
- portValue.setValue(agent.getPort());
- formItems.add(portValue);
-
- //agent-comm-status
- String agentComStatus = "agent-comm-status";
- agentStatusIcon = new FormItemIcon();
- agentStatusIcon.setSrc(ImageManager.getAvailabilityLargeIcon(null));
- agentStatus = new StaticTextItem(agentComStatus, MSG.view_inventory_summary_agent_status_title());
- agentStatus.setIcons(agentStatusIcon);
- agentStatus.setWrapTitle(false);
- formItems.add(agentStatus);
- GWTServiceLookup.getAgentService().pingAgentForResource(id, new AsyncCallback<Boolean>() {
- @Override
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.view_inventory_summary_agent_error2() + id + ".",
- caught);
- }
-
- @Override
- public void onSuccess(Boolean result) {
- //update icon with correct status
- agentStatusIcon.setSrc(ImageManager.getAvailabilityLargeIcon(result));
- currentAgentInfo.markForRedraw();
- }
- });
-
- //Last Received Avail report
- String lastAvailReport = "last-avail-report";
- lastAvailReportValue = new StaticTextItem(lastAvailReport, MSG
- .view_inventory_summary_agent_last_title());
- lastAvailReportValue.setWrapTitle(false);
- lastAvailReportValue.setValue(new Date(agent.getLastAvailabilityReport()));
- formItems.add(lastAvailReportValue);
-
- //Full Endpoint
- String fullEndpoint = "full-endpoint";
- endpointValue = new StaticTextItem(fullEndpoint, MSG.view_inventory_summary_agent_fullEnpoint());
- String remoteEndpoint = agent.getRemoteEndpoint();
- if (remoteEndpoint != null) {
- // some browsers (firefox in particular) won't wrap unless you put breaks in the string
- remoteEndpoint = remoteEndpoint.replaceAll("&", " &");
- } else {
- remoteEndpoint = MSG.view_inventory_summary_agent_fullEnpoint_err1();
+ private void loadData() {
+ GWTServiceLookup.getAgentService().getAgentForResource(this.resourceId, new AsyncCallback<Agent>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_inventory_summary_agent_error1() + resourceId + ".", caught);
+ }
+
+ @Override
+ public void onSuccess(Agent agent) {
+ GWTServiceLookup.getAgentService().pingAgentForResource(resourceId, new AsyncCallback<Boolean>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_inventory_summary_agent_error2() + resourceId + ".",
+ caught);
+ agentStatusIcon.setSrc(ImageManager.getAvailabilityLargeIcon(null));
+ form.markForRedraw();
}
- endpointValue.setValue(remoteEndpoint);
- formItems.add(endpointValue);
- currentAgentInfo.setItems(formItems.toArray(new FormItem[formItems.size()]));
- currentAgentInfo.markForRedraw();
+ @Override
+ public void onSuccess(Boolean isUp) {
+ //update icon with correct status
+ agentStatusIcon.setSrc(ImageManager.getAvailabilityLargeIcon(isUp));
+ form.markForRedraw();
+ }
+ });
+
+ nameValue.setValue(agent.getName());
+ addressValue.setValue(agent.getAddress());
+ portValue.setValue(agent.getPort());
+ lastAvailReportValue.setValue(new Date(agent.getLastAvailabilityReport()));
+ String remoteEndpoint = agent.getRemoteEndpoint();
+ if (remoteEndpoint != null) {
+ // some browsers (firefox in particular) won't wrap unless you put breaks in the string
+ remoteEndpoint = remoteEndpoint.replaceAll("&", " &");
+ } else {
+ remoteEndpoint = MSG.view_inventory_summary_agent_fullEnpoint_err1();
}
- });
+ endpointValue.setValue(remoteEndpoint);
- //final form population
- currentAgentInfo.setItems(formItems.toArray(new FormItem[formItems.size()]));
- }
+ form.markForRedraw();
+ }
+ });
}
+
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewForm.java
index 7c10442..1884cec 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewForm.java
@@ -108,13 +108,11 @@ public class OverviewForm extends EnhancedDynamicForm {
}
public void onSuccess(List<MeasurementDataTrait> result) {
- // TODO: Implement this method.
for (MeasurementDataTrait trait : result) {
- String formId = trait.getName().replaceAll("\\.", "_").replaceAll(" ", "__");
- FormItem item = getItem(formId);
-
+ String formItemId = buildFormItemIdFromTraitDisplayName(trait.getName());
+ FormItem item = getItem(formItemId);
if (item != null) {
- setValue(formId, trait.getValue());
+ setValue(formItemId, trait.getValue());
}
}
markForRedraw();
@@ -122,6 +120,10 @@ public class OverviewForm extends EnhancedDynamicForm {
});
}
+ private static String buildFormItemIdFromTraitDisplayName(String traitName) {
+ return traitName.replaceAll("\\.", "_").replaceAll(" ", "__");
+ }
+
private void buildForm(ResourceType type) {
List<MeasurementDefinition> traits = new ArrayList<MeasurementDefinition>();
@@ -131,12 +133,6 @@ public class OverviewForm extends EnhancedDynamicForm {
}
}
- Collections.sort(traits, new Comparator<MeasurementDefinition>() {
- public int compare(MeasurementDefinition o1, MeasurementDefinition o2) {
- return new Integer(o1.getDisplayOrder()).compareTo(o2.getDisplayOrder());
- }
- });
-
List<FormItem> formItems = new ArrayList<FormItem>();
if (isHeaderEnabled()) {//conditionally display header
@@ -145,6 +141,7 @@ public class OverviewForm extends EnhancedDynamicForm {
formItems.add(headerItem);
}
+ // Type
StaticTextItem typeItem = new StaticTextItem("type", MSG.view_summaryOverviewForm_field_type());
typeItem.setTooltip(MSG.view_summaryOverviewForm_label_plugin() + type.getPlugin() + "\n<br>"
+ MSG.view_summaryOverviewForm_label_type() + type.getName());
@@ -154,6 +151,7 @@ public class OverviewForm extends EnhancedDynamicForm {
final Resource resource = this.resourceComposite.getResource();
boolean modifiable = this.resourceComposite.getResourcePermission().isInventory();
+ // Name
final FormItem nameItem = (modifiable) ? new TogglableTextItem() : new StaticTextItem();
nameItem.setName("name");
nameItem.setTitle(MSG.view_summaryOverviewForm_field_name());
@@ -189,6 +187,7 @@ public class OverviewForm extends EnhancedDynamicForm {
}
formItems.add(nameItem);
+ // Description
final FormItem descriptionItem = (modifiable) ? new TogglableTextItem() : new StaticTextItem();
descriptionItem.setName("description");
descriptionItem.setTitle(MSG.view_summaryOverviewForm_field_description());
@@ -226,6 +225,7 @@ public class OverviewForm extends EnhancedDynamicForm {
}
formItems.add(descriptionItem);
+ // Location
final FormItem locationItem = (modifiable) ? new TogglableTextItem() : new StaticTextItem();
locationItem.setName("location");
locationItem.setTitle(MSG.view_summaryOverviewForm_field_location());
@@ -261,16 +261,25 @@ public class OverviewForm extends EnhancedDynamicForm {
}
formItems.add(locationItem);
+ // Version
StaticTextItem versionItem = new StaticTextItem("version", MSG.view_summaryOverviewForm_field_version());
+ versionItem.setValue((resource.getVersion() != null) ? resource.getVersion() : "<i>" + MSG.common_label_none()
+ + "</i>");
versionItem.setEndRow(true);
formItems.add(versionItem);
- for (MeasurementDefinition trait : traits) {
- String id = trait.getDisplayName().replaceAll("\\.", "_").replaceAll(" ", "__");
+ // Traits
+ Collections.sort(traits, new Comparator<MeasurementDefinition>() {
+ public int compare(MeasurementDefinition o1, MeasurementDefinition o2) {
+ return new Integer(o1.getDisplayOrder()).compareTo(o2.getDisplayOrder());
+ }
+ });
- StaticTextItem item = new StaticTextItem(id, trait.getDisplayName());
- item.setTooltip(trait.getDescription());
- formItems.add(item);
+ for (MeasurementDefinition trait : traits) {
+ String formItemId = buildFormItemIdFromTraitDisplayName(trait.getDisplayName());
+ StaticTextItem formItem = new StaticTextItem(formItemId, trait.getDisplayName());
+ formItem.setTooltip(trait.getDescription());
+ formItems.add(formItem);
// item.setValue("?");
}
@@ -284,14 +293,14 @@ public class OverviewForm extends EnhancedDynamicForm {
if (!isDisplayCondensed()) {
formItems.add(new SpacerItem());
}
- setItems(formItems.toArray(new FormItem[formItems.size()]));
- setValue("type", type.getName() + " (" + type.getPlugin() + ")");
- setValue("name", resource.getName());
- setValue("description", resource.getDescription());
- setValue("location", resource.getLocation());
- setValue("version", (resource.getVersion() != null) ? resource.getVersion() : "<i>" + MSG.common_label_none()
- + "</i>");
+ setItems(formItems.toArray(new FormItem[formItems.size()]));
+ }
+
+ public void loadData() {
+ // TODO: Reload the ResourceComposite too.
+ loadTraitValues();
+ markForRedraw();
}
public boolean isHeaderEnabled() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewView.java
index 5470e92..38bbefb 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewView.java
@@ -21,6 +21,7 @@ package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary;
import com.smartgwt.client.widgets.HTMLFlow;
import org.rhq.core.domain.resource.composite.ResourceComposite;
+import org.rhq.enterprise.gui.coregui.client.RefreshableView;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
@@ -28,11 +29,12 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
*
* @author Lukas Krejci
*/
-public class OverviewView extends LocatableVLayout {
+public class OverviewView extends LocatableVLayout implements RefreshableView {
+ private OverviewForm form;
public OverviewView(String locatorId, ResourceComposite resourceComposite) {
super(locatorId);
- OverviewForm form = new OverviewForm(extendLocatorId("form"), resourceComposite);
+ this.form = new OverviewForm(extendLocatorId("form"), resourceComposite);
HTMLFlow separator = new HTMLFlow();
separator.setContents("<hr>");
@@ -43,7 +45,7 @@ public class OverviewView extends LocatableVLayout {
}
@Override
- public void onInit() {
- super.onInit();
+ public void refresh() {
+ form.loadData();
}
}
commit 01bef839fe16f15ac03b60695a0d609e886209ea
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Fri Dec 10 08:36:05 2010 -0500
removed redundant labelling from recent alerts portlet ui.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java
index 3b0b574..07d204b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java
@@ -24,7 +24,6 @@ import com.smartgwt.client.data.RecordList;
import com.smartgwt.client.types.ListGridFieldType;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
-import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.events.SubmitValuesEvent;
import com.smartgwt.client.widgets.form.events.SubmitValuesHandler;
@@ -100,7 +99,6 @@ public class RecentAlertsPortlet extends AlertHistoryView implements CustomSetti
private AlertPortletDataSource dataSource;
//instance ui widgets
private Canvas containerCanvas;
- private LocatableHLayout resourceSelectionLabelRow;
private Timer reloader;
public RecentAlertsPortlet(String locatorId) {
@@ -269,7 +267,7 @@ public class RecentAlertsPortlet extends AlertHistoryView implements CustomSetti
//root dynamic form instance
final LocatableDynamicForm form = new LocatableDynamicForm(extendLocatorId("custom-settings"));
form.setWidth(RecentAlertsPortlet.ALERT_RESOURCE_SELECTION_WIDTH + 40);//largest widget display + 40 for buttons
- form.setHeight(450);
+ form.setHeight(400);
form.setMargin(5);
//vertical container
@@ -412,16 +410,8 @@ public class RecentAlertsPortlet extends AlertHistoryView implements CustomSetti
}
if (selectedItem.equals(RESOURCES_SELECTED)) {
containerCanvas.addChild(resourceSelector.getCanvas());
- resourceSelectionLabelRow.setVisible(true);
- for (Canvas c : resourceSelectionLabelRow.getMembers()) {
- c.setVisible(true);
- }
} else {
containerCanvas.addChild(new Canvas());
- resourceSelectionLabelRow.setVisible(false);
- for (Canvas c : resourceSelectionLabelRow.getMembers()) {
- c.setVisible(false);
- }
}
}
});
@@ -449,25 +439,6 @@ public class RecentAlertsPortlet extends AlertHistoryView implements CustomSetti
row2.addMember(timeSelectionWrapper);
row2.addMember(resourceSelectionWrapper);
- //Row 3 of labels for the alert selected resources area
- resourceSelectionLabelRow = new LocatableHLayout(extendLocatorId("resource-selection-label"));
- resourceSelectionLabelRow.setHeight(30);
- resourceSelectionLabelRow.setMembersMargin(5);
- resourceSelectionLabelRow.setWidth(RecentAlertsPortlet.ALERT_RESOURCE_SELECTION_WIDTH);//ui size + fixed button widths
- LocatableLabel availableResourcesLabel = new LocatableLabel(extendLocatorId("available-resources"), "<b>"
- + ALERT_LABEL_AVAILABLE_RESOURCES + "</b>");
- availableResourcesLabel.setHeight(20);
- availableResourcesLabel.setWrap(false);
- resourceSelectionLabelRow.addMember(availableResourcesLabel);
- Label spacer = new Label("");
- spacer.setWidth(400);
- LocatableLabel selectedResourcesLabel = new LocatableLabel(extendLocatorId("selected-resources"), "<b>"
- + ALERT_LABEL_SELECTED_RESOURCES + "</b>");
- selectedResourcesLabel.setHeight(20);
- selectedResourcesLabel.setWrap(false);
- resourceSelectionLabelRow.addMember(spacer);
- resourceSelectionLabelRow.addMember(selectedResourcesLabel);
-
//if portlet config setting exist, then retrieve
Integer[] alertFilterResourceIds = null;
alertFilterResourceIds = getDataSource().extractFilterResourceIds(storedPortlet, alertFilterResourceIds);
@@ -489,10 +460,6 @@ public class RecentAlertsPortlet extends AlertHistoryView implements CustomSetti
containerCanvas.addChild(resourceSelector.getCanvas());
} else {// define empty canvas
containerCanvas.addChild(new Canvas());
- //iterate over children of row3 and make invisible
- for (Canvas c : resourceSelectionLabelRow.getMembers()) {
- c.setVisible(false);
- }
}
//add contain resource selection region.
@@ -506,7 +473,6 @@ public class RecentAlertsPortlet extends AlertHistoryView implements CustomSetti
DynamicForm spacerWrapper = new DynamicForm();
spacerWrapper.setItems(verticalSpace);
column.addMember(spacerWrapper);
- column.addMember(resourceSelectionLabelRow);
column.addMember(resourceSelectionRegion);
form.addChild(column);
commit 2bf3c72a7da8cf1995a72598d2245eff6867b03c
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Fri Dec 10 08:11:58 2010 -0500
fix problem with autodiscovery portlet display.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/queue/AutodiscoveryPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/queue/AutodiscoveryPortlet.java
index c36f3d7..87d2911 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/queue/AutodiscoveryPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/queue/AutodiscoveryPortlet.java
@@ -66,18 +66,10 @@ public class AutodiscoveryPortlet extends ResourceAutodiscoveryView implements C
super.onInit();
//initialize the datasource to include Portlet instance
this.dataSource = new AutodiscoveryQueueDataSource(getTreeGrid());
- if ((getTreeGrid() != null) && (getDataSource() != null)) {
+ if (getTreeGrid() != null) {
getTreeGrid().setDataSource(getDataSource());
}
- }
-
- /** Implements configure action. Stores reference to the initiating DashboardPortlet.
- * Method loads i)initial portlet settings OR ii)retrieves previous settings and adds to
- * the datasource.
- */
- @Override
- public void configure(PortletWindow portletWindow, DashboardPortlet storedPortlet) {
- this.storedPortlet = storedPortlet;
+ //loads/retrieves initial portlet settings for datasource
String retrieved = null;
//if settings already exist for this portlet
if (storedPortlet.getConfiguration().getSimple(AUTODISCOVERY_PLATFORM_MAX) != null) {
@@ -88,21 +80,25 @@ public class AutodiscoveryPortlet extends ResourceAutodiscoveryView implements C
retrieved = defaultValue;
}
- if (getDataSource() != null) {
- if (retrieved.equals(unlimited)) {
- getDataSource().setMaximumPlatformsToDisplay(-1);
- } else {
- getDataSource().setMaximumPlatformsToDisplay(Integer.parseInt(retrieved));
- }
+ if (retrieved.equals(unlimited)) {
+ getDataSource().setMaximumPlatformsToDisplay(-1);
+ } else {
+ getDataSource().setMaximumPlatformsToDisplay(Integer.parseInt(retrieved));
}
}
+ /** Implements configure action. Stores reference to the initiating DashboardPortlet.
+ */
+ @Override
+ public void configure(PortletWindow portletWindow, DashboardPortlet storedPortlet) {
+ this.storedPortlet = storedPortlet;
+ }
+
public Canvas getHelpCanvas() {
return new HTMLFlow(MSG.view_portlet_autodiscovery_help_msg());
}
- /** Build custom for to dispaly the Portlet Configuration settings.
- *
+ /** Build custom settings form.
*/
public DynamicForm getCustomSettingsForm() {
final LocatableDynamicForm form = new LocatableDynamicForm(extendLocatorId("Settings"));
@@ -142,13 +138,16 @@ public class AutodiscoveryPortlet extends ResourceAutodiscoveryView implements C
//default selected value to 'unlimited'(live lists) and check both combobox settings here.
String selectedValue = defaultValue;
- if (getDataSource() != null) {
- if (getDataSource().getMaximumPlatformsToDisplay() == -1) {
+ PropertySimple simpleProperty = null;
+ if ((simpleProperty = storedPortlet.getConfiguration().getSimple(AUTODISCOVERY_PLATFORM_MAX)) != null) {
+ String retrieved = simpleProperty.getStringValue();
+ if (retrieved.equals(unlimited)) {
selectedValue = unlimited;
} else {
- selectedValue = String.valueOf(getDataSource().getMaximumPlatformsToDisplay());
+ selectedValue = String.valueOf(retrieved);
}
}
+
//prepopulate the combobox with the previously stored selection
maximumPlatformsComboBox.setDefaultValue(selectedValue);
@@ -162,6 +161,11 @@ public class AutodiscoveryPortlet extends ResourceAutodiscoveryView implements C
//persist this value to configuration
storedPortlet.getConfiguration().put(
new PropertySimple(AUTODISCOVERY_PLATFORM_MAX, form.getValue(AUTODISCOVERY_PLATFORM_MAX)));
+ //save to datasource
+ String value = form.getValue(AUTODISCOVERY_PLATFORM_MAX) + "";
+ int maximumPlatformsToDisplay = value.equals(unlimited) ? -1 : Integer.parseInt(value);
+ getDataSource().setMaximumPlatformsToDisplay(maximumPlatformsToDisplay);
+ markForRedraw();
}
}
});
commit 349abc0d2d5b837c95c763a348093451b43ec028
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Thu Dec 9 17:35:06 2010 -0500
fixing untitled About box in Help menu.
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
index 6c696db..d5380a8 100644
--- 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
@@ -25,9 +25,12 @@ package org.rhq.enterprise.gui.coregui.client.help;
import java.util.ArrayList;
import java.util.List;
+import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
+import org.rhq.core.domain.common.ProductInfo;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
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;
@@ -35,6 +38,7 @@ 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;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
/**
* The Help top-level view.
@@ -47,6 +51,7 @@ public class HelpView extends AbstractSectionedLeftNavigationView {
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());
+ private static ProductInfo PRODUCT_INFO;
public HelpView() {
// This is a top level view, so our locator id can simply be our view id.
@@ -79,7 +84,21 @@ public class HelpView extends AbstractSectionedLeftNavigationView {
NavigationItem aboutItem = new NavigationItem(new ViewName("AboutBox", MSG.view_help_docAbout()),
"[SKIN]/../actions/help.png", new ViewFactory() {
public Canvas createView() {
- AboutModalWindow aboutModalWindow = new AboutModalWindow();
+ final AboutModalWindow aboutModalWindow = new AboutModalWindow();
+ if (PRODUCT_INFO == null) {
+ GWTServiceLookup.getSystemService().getProductInfo(new AsyncCallback<ProductInfo>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_aboutBox_failedToLoad(), caught);
+ }
+
+ public void onSuccess(ProductInfo result) {
+ PRODUCT_INFO = result;
+ aboutModalWindow.setTitle(MSG.view_aboutBox_title(PRODUCT_INFO.getFullName()));
+ }
+ });
+ } else {
+ aboutModalWindow.setTitle(MSG.view_aboutBox_title(PRODUCT_INFO.getFullName()));
+ }
aboutModalWindow.show();
return aboutModalWindow;
}
commit 7b6e96662778c3058aa0db5fec3bf25318a541cd
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Fri Dec 10 12:06:29 2010 +0100
More translations
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
index 5578472..de58cee 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
@@ -92,7 +92,6 @@ common_title_duration=Dauer
common_title_edit_mode=Bearbeitungsmodus
common_title_enabled=Aktiviert?
common_title_end = Ende
-common_title_favorites=Lesezeichen
common_title_generalProp = Allgemeine Eigenschaften
common_title_group_def_total=Anzahl Gruppen-Definitionen
common_title_icon = Ikone
@@ -202,8 +201,8 @@ widget_recordEditor_title_new = Neue {0} anlegen
# // dup in common
widget_recordEditor_label_loading = Laden...
widget_recordEditor_error_invalidViewPath = Ungültiger Anzeigepfad: [{0}]
-widget_recordEditor_error_noRecords = No records were returned - expected exactly one.~
-widget_recordEditor_error_multipleRecords = Multiple records were returned - expected exactly one.~
+widget_recordEditor_error_noRecords = Keine Datensätze gefunden - erwartet wurde genau einer.
+widget_recordEditor_error_multipleRecords = Mehrere Datensätze gefunden - erwartet wurde genau einer.
widget_recordEditor_info_recordCreatedConcise = {0} angelegt.
widget_recordEditor_info_recordCreatedDetailed = {0} [{1}] angelegt.
widget_recordEditor_info_recordUpdatedConcise = {0} aktualisiert.
@@ -240,7 +239,7 @@ widget_resourceFactoryWizard_importSubmitted=A request to import a new resource
widget_resourceFactoryWizard_createWizardWindowTitle=Resource Create Wizard~
widget_resourceFactoryWizard_createWizardTitle=Create New Resource of Type [{0}]~
widget_resourceFactoryWizard_execute1=Failed to create a new resource - there is no package version~
-widget_resourceFactoryWizard_execute2=Failed to create a new resource~
+widget_resourceFactoryWizard_execute2=Konnte keine neue Ressource anlegen
widget_resourceFactoryWizard_createSubmitType=A request to create a resource of type [{0}] has been submitted successfully.~
widget_resourceFactoryWizard_createSubmit=A request to create a resource with the name of [{0}] has been submitted successfully.~
widget_resourceFactoryWizard_failedToGetType=Failed to get backing package type for new resource~
@@ -313,14 +312,14 @@ dataSource_users_field_factive = Darf sich einloggen?
# Platforms
#------
-dataSource_platforms_field_cpu=CPU~
+dataSource_platforms_field_cpu=CPU
dataSource_platforms_field_memory=Speicher
dataSource_platforms_field_swap=Swap
# Traits
#------
dataSource_traits_field_primaryKey=Primärschlüssel
-dataSource_traits_field_definitionID=Definition ID~
+dataSource_traits_field_definitionID=Definition-ID
dataSource_traits_field_lastChanged=Zuletzt geändert
dataSource_traits_field_trait=Trait
dataSource_traits_group_field_groupId=Gruppen-ID
@@ -339,7 +338,7 @@ dataSource_measurementOob_error_fetchFailure = Konnte die Informationen über Au
# Measurements
#----------------------
dataSource_definitions_loadFailed = Failed to load metric definitions~
-dataSource_schedules_loadFailed = Failed to load metric schedules~
+dataSource_schedules_loadFailed = Konte die Zeitpläne für das Erfassen der Metriken nicht laden
dataSource_schedules_field_resourceGroupId = Gruppen-ID
dataSource_schedules_enableFailure_resource=Failed to enable the collection of [{0}] metrics for resource with ID [{1}]. The metrics were: [{2}]~
@@ -395,7 +394,7 @@ dataSource_operationHistory_error_fetchFailure = Konnte den Verlauf der Operatio
# Configuration History
#-------------------------------
-dataSource_configurationHistory_field_id = ID~
+dataSource_configurationHistory_field_id = ID
dataSource_configurationHistory_field_resource = Ressource
dataSource_configurationHistory_field_createdTime = Angelegt
dataSource_configurationHistory_field_status = Status
@@ -434,7 +433,7 @@ view_adminConfig_downloads = Downloads
view_adminConfig_license = Lizenz
view_adminConfig_plugins = Plugins
view_adminConfig_systemSettings = Systemeinstellungen
-view_adminConfig_templates = Templates~
+view_adminConfig_templates = Voreinstellungen
# Administration/Security/Users
#--------------------------------
@@ -447,19 +446,19 @@ view_adminUsersDetails_dataTypeName = Benutzer
# Administration/Security/Roles/#
#--------------------------------
-view_adminRoles_assignedGroups = Assigned Resource Groups~
-view_adminRoles_assignedSubjects = Assigned Subjects~
-view_adminRoles_failLdap = Failed to determine if LDAP configured - assuming no LDAP.~
+view_adminRoles_assignedGroups = Zugewiesene Ressourcen-Gruppen
+view_adminRoles_assignedSubjects = Zugewisene Benutzer
+view_adminRoles_failLdap = Konnte nicht ermitteln, ob LDAP konfiguriert ist - gehe von keiner LDAP-Konfiguration aus.
view_adminRoles_failLdapGroups = Failed to retrieve available LDAP groups - assuming no LDAP groups.~
view_adminRoles_failLdapGroupsRole = Failed to load LDAP groups available for role.~
-view_adminRoles_failRoles = Failed to fetch roles.~
-view_adminRoles_globalPerms = Global Permissions~
+view_adminRoles_failRoles = Konnte die Rollen nicht laden.
+view_adminRoles_globalPerms = Applikationsweite Rechte
view_adminRoles_ldapGroups = LDAP-Gruppen
view_adminRoles_ldapGroupsReadOnly = LDAP group data is read only~
view_adminRoles_noItems = Keine Einträge vorhanden
view_adminRoles_noLdap = The LDAP security integration is not configured. To configure LDAP go to <a {0}>{1}</a>.~
-view_adminRoles_perms = Permissions~
-view_adminRoles_resourcePerms = Resource Permissions~
+view_adminRoles_perms = Rechte
+view_adminRoles_resourcePerms = Rechte auf Ressourcen
view_adminRoles_roleAdded = Rolle [{0}] hinzugefügt
view_adminRoles_roleDeleteFailed = Konnte die Rolle [{0}] nicht löschen.
view_adminRoles_roleDeleted = Rolle [{0}] gelöscht.
@@ -468,10 +467,10 @@ view_adminRoles_roleUpdated = Rolle [{0}] aktualisiert.
# Administration/Topology/RemoteAgentInstall/#
#--------------------------------
-view_remoteAgentInstall_agentStatus = Agent Status~
+view_remoteAgentInstall_agentStatus = Status des Agenten
view_remoteAgentInstall_agentStatusDefault = -Click Update Status Button-~
view_remoteAgentInstall_connInfo = Connection Information~
-view_remoteAgentInstall_buttonFindAgent = Find Agent~
+view_remoteAgentInstall_buttonFindAgent = Agent suchen
view_remoteAgentInstall_error_1 = Error occurred while trying to find agent install path~
view_remoteAgentInstall_error_2 = Could not find an agent installed when looking in common locations
view_remoteAgentInstall_error_3 = Could not find an agent installed at or under [{0}]
@@ -1596,6 +1595,42 @@ view_operationCreateWizard_executionSchedule_willExecuteRecurringWithEnd=Wird {0
view_operationCreateWizard_executionSchedule_willExecuteRecurring=Wird {0} beginnend am {1} ausgeführt.
view_operationCreateWizard_executionSchedule_everyWeekOnGivenDayAtGivenTime=Wöchntlich an {0} um {1}
view_operationCreateWizard_message_scheduleOperationSuccess_short=Sie haben die Operation [{0}] für diese Ressource geplant.
+favorites=Lesezeichen
+favorites_resources=Gemerkte Ressourcen
+favorites_groups=Gemerkte Gruppen
+favorites_recentlyViewed=Kürzlich angesehen
+common_msg_notYetImplemented=Noch nicht implementiert
+widget_recordEditor_error_operation=Die Operation ist fehlgeschlagen. Ein Fehler ist aufgetreten.
+widget_recordEditor_error_operationInvalidValues=Die Operation ist fehlgeschlagen - ein oder mehrere Felder haben ungültige Werte
+widget_recordEditor_error_permissionCreate=Sie haben nicht die nötigen Rechte, um ein neues [{0}] anzulegen
+widget_recordEditor_warn_validation=Ein oder mehrere Felder haben ungültige Werte. Diese [{0}] kann nicht gesichert werden bis die Werte korrigiert wurden.
+widget_resourceFactoryWizard_infoStep_loadFail=Konnte die verfügbaren Architekturen nicht ermitteln
+widget_typeCache_loadFail=Konnte die Metadaten für den Ressourcen-Typ nicht laden
+widget_typeTree_badTemplateType=Ungültige URL. Unbekannter Template-Type [{0}]
+widget_typeTree_badTypeId=Ungültige URL. Unbekannte Ressource-Typ-ID [{0}]
+widget_typeTree_loadFail=Konnte die Ressource-Typen nicht laden
+dataSource_bundle_loadFailed=Konnte die Bundle-Daten nicht laden
+dataSource_users_delete=Benutzer [{0}] wurde gelöscht
+dataSource_users_deleteFailed=Konnte den Benutzer [{0}] nicht löschen
+dataSource_traits_failFetch=Konnte die Traits für das Kiriterium [{0}] nicht ermitteln.
+dataSource_schedules_loadFailedCriteria=Konnte die Zeitpläne für Metriken für die Kriterien [{0}] nicht laden
+dataSource_schedules_loadFailedContext=Konnte die Zeitpläne für Metriken für den Kontext [{0}] nicht laden
+dataSource_resourceGroups_loadFailed=Konnte die Ressourcen-Gruppe nicht laden
+datasource_templateSchedules_disabled=Das Erfassen der Messwerte für [{0}] wurde eingestellt.
+datasource_templateSchedules_disabled_detailed=Sammeln der Daten für Metrik [{0}] [{1}] als Standard für Ressource-Tpypen mit ID [{2}] eingestellt.
+datasource_templateSchedules_disabled_failed=Konnte das Sammeln der Daten für die Metrik [{0}] [{1}] als Standard für Ressourcen-Typ [{2}] nicht einstellen.
+datasource_templateSchedules_enabled=Sammeln der Daten für Metrik [{0}] gestartet.
+datasource_templateSchedules_enabled_detailed=Sammeln der Daten für Metrik [{0}] [{1}] als Standard für Ressourcen mit Typ-ID [{2}] gestartet.
+datasource_templateSchedules_enabled_failed=Konnte das Sammeln der Daten für die Metrik [{0}] [{1}] als Standard für Ressourcen mit Type-ID [{2}] nicht beginnen.
+datasource_templateSchedules_updated=Zeitpläne für die ausgewählte Metrik [{0}] aktualisiert.
+datasource_templateSchedules_updated_detail=Zeitplan für das Sammeln von Daten für Metrik [{0}] [{1}] als Standard für Ressourcen mit Typ-ID [{2}] auf [{3}] Sekunden gesetzt.
+datasource_templateSchedules_updated_failed=Aktualisieren des Zeitplans für das Sammeln von Daten für Metrik [{0}] [{1}] als Standard für Ressourcen mit Typ-ID [{2}] ist fehlgeschlagen.
+view_table_drawFail=Konnte die Tabelle [{0}] nicht zeichnen.
+view_dashboardManager_deleteFail=Konnte das Dashboard nicht löschen.
+view_tree_common_loadFailed_group=Konnte die Gruppe mit ID [{0}] nicht laden
+view_tree_common_loadFailed_groupTree=Konnte die Baumansicht der Gruppe nicht laden
+view_tree_common_contextMenu_loadFail_dashboards=Konnte die benutzerspezifischen Dashboards nicht laden
+view_group_membership_failFetch=Konnte die Ressourcen-Gruppe nicht laden
commit 6931d5af42f89a220b3e6020b9469ef5367b04c5
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Dec 9 18:05:43 2010 -0500
Removing "parent" from resource overview because the parent resource
may not be viewable to the viewer of the resource. This is not the main
issue but its rather the fact that to gain the parent info you need
manage_inventory perms, not possessed by typical users.
note - this checkin will temporarily remove group membership manipulation
for a resource. I'll add that back but wanted to get this in asap.
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 a4ccd2e..8181b88 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
@@ -57,7 +57,6 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configura
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration.ResourceConfigurationEditView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory.PluginConfigurationEditView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory.ResourceResourceAgentView;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory.ResourceResourceGroupsView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.schedules.SchedulesView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.traits.TraitsView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.OperationHistoryView;
@@ -102,7 +101,6 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
private SubTab inventoryConn;
private SubTab inventoryConnHistory;
private SubTab inventoryGroups;
- private SubTab inventoryGroupMembership;
private SubTab inventoryAgent;
private SubTab opHistory;
private SubTab opSched;
@@ -147,12 +145,12 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
"ConnectionSettingsHistory", MSG.view_tabs_common_connectionSettingsHistory()), null);
inventoryGroups = new SubTab(inventoryTab.extendLocatorId("Groups"), new ViewName("Groups", MSG
.view_tabs_common_groups()), null);
- inventoryGroupMembership = new SubTab(inventoryTab.extendLocatorId("GroupMembership"), new ViewName(
- "GroupMembership", MSG.view_tabs_common_group_membership()), null);
+ //inventoryGroupMembership = new SubTab(inventoryTab.extendLocatorId("GroupMembership"), new ViewName(
+ // "GroupMembership", MSG.view_tabs_common_group_membership()), null);
inventoryAgent = new SubTab(inventoryTab.extendLocatorId("Agent"), new ViewName("Agent", MSG
.view_tabs_common_agent()), null);
inventoryTab.registerSubTabs(this.inventoryChildren, this.inventoryChildHistory, this.inventoryConn,
- this.inventoryConnHistory, this.inventoryGroups, this.inventoryGroupMembership, this.inventoryAgent);
+ this.inventoryConnHistory, this.inventoryGroups, this.inventoryAgent);
tabs.add(inventoryTab);
alertsTab = new TwoLevelTab(getTabSet().extendLocatorId("Alerts"), new ViewName("Alerts", MSG
@@ -301,12 +299,13 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
updateSubTab(this.inventoryTab, this.inventoryGroups, ResourceGroupListView.getGroupsOf(this.inventoryTab
.extendLocatorId("GroupsView"), resource.getId()), true, true);
- enabled = globalPermissions.contains(Permission.MANAGE_INVENTORY);
- canvas = (enabled) ? new ResourceResourceGroupsView(this.inventoryTab.extendLocatorId("GroupMembershipView"),
- resourceId) : null;
- updateSubTab(this.inventoryTab, this.inventoryGroupMembership, canvas, true, enabled);
+ //enabled = globalPermissions.contains(Permission.MANAGE_INVENTORY);
+ //canvas = (enabled) ? new ResourceResourceGroupsView(this.inventoryTab.extendLocatorId("GroupMembershipView"),
+ // resourceId) : null;
+ //updateSubTab(this.inventoryTab, this.inventoryGroupMembership, canvas, true, enabled);
//Agent subtab
+ enabled = globalPermissions.contains(Permission.MANAGE_INVENTORY);
canvas = (enabled) ? new ResourceResourceAgentView(this.inventoryTab.extendLocatorId("AgentView"), resourceId)
: null;
updateSubTab(this.inventoryTab, this.inventoryAgent, canvas, true, enabled);
@@ -388,7 +387,6 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterId(resourceId);
criteria.fetchTags(true);
- criteria.fetchParentResource(true);
GWTServiceLookup.getResourceService().findResourceCompositesByCriteria(criteria,
new AsyncCallback<PageList<ResourceComposite>>() {
public void onFailure(Throwable caught) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewForm.java
index 74bafdb..7c10442 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewForm.java
@@ -262,11 +262,9 @@ public class OverviewForm extends EnhancedDynamicForm {
formItems.add(locationItem);
StaticTextItem versionItem = new StaticTextItem("version", MSG.view_summaryOverviewForm_field_version());
+ versionItem.setEndRow(true);
formItems.add(versionItem);
- StaticTextItem parentItem = new StaticTextItem("parent", MSG.view_summaryOverviewForm_field_parent());
- formItems.add(parentItem);
-
for (MeasurementDefinition trait : traits) {
String id = trait.getDisplayName().replaceAll("\\.", "_").replaceAll(" ", "__");
@@ -294,9 +292,6 @@ public class OverviewForm extends EnhancedDynamicForm {
setValue("location", resource.getLocation());
setValue("version", (resource.getVersion() != null) ? resource.getVersion() : "<i>" + MSG.common_label_none()
+ "</i>");
- Resource parentResource = this.resourceComposite.getParent();
- setValue("parent", parentResource != null ? ("<a href=\"#Resource/" + parentResource.getId() + "\">"
- + parentResource.getName() + "</a>") : "<i>" + MSG.common_label_none() + "</i>");
}
public boolean isHeaderEnabled() {
commit 502d95dc3d1fe3469edf2658155c4b7fa1ac6dea
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Thu Dec 9 17:35:14 2010 -0500
fix unable to change checkbox value in modal issue (https://bugzilla.redhat.com/show_bug.cgi?id=661899)
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
index 3da811f..481bbc8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
@@ -158,6 +158,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
//
@SuppressWarnings( { "UnnecessarySemicolon" })
public class ConfigurationEditor extends LocatableVLayout {
+
private static final String RHQ_PROPERTY_ATTRIBUTE_NAME = "rhq:property";
private ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService();
@@ -529,7 +530,7 @@ public class ConfigurationEditor extends LocatableVLayout {
LocatableDynamicForm form = new LocatableDynamicForm(locatorId);
form.setValuesManager(valuesManager);
- form.setValidateOnChange(true);
+ form.setValidateOnExit(true);
form.setHiliteRequiredFields(true);
form.addItemChangedHandler(new ItemChangedHandler() {
@@ -1651,4 +1652,5 @@ public class ConfigurationEditor extends LocatableVLayout {
return valid;
}
}
+
}
commit 667f5cb1f1827762716b37af29f376912546225e
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Thu Dec 9 17:26:58 2010 -0500
being adding support for refreshing of subtab data when switching back to a subtab
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
index a0ff4bf..6040959 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
@@ -23,6 +23,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.Side;
@@ -235,17 +236,20 @@ public abstract class AbstractTwoLevelTabSetView<T, U extends Layout> extends Lo
this.tabSet.selectTab(tab);
}
- // Handle any remaining view items (e.g. id of a selected item in a subtab that contains a Master-Details view).
Canvas subView = subtab.getCanvas();
if (subView instanceof BookmarkableView) {
+ // Handle any remaining view items (e.g. id of a selected item in a subtab that contains a Master-Details view).
((BookmarkableView) subView).renderView(viewPath);
} else if (subView instanceof RefreshableView) {
- ((RefreshableView) subView).refresh();
+ if (subView.isDrawn()) {
+ // Refresh the data on the subtab, so it's not stale.
+ ((RefreshableView) subView).refresh();
+ }
}
this.tabSet.markForRedraw();
} catch (Exception e) {
- com.allen_sauer.gwt.log.client.Log.info("Failed to select tab " + tabName + "/" + subtabName + ": " + e);
+ Log.info("Failed to select tab " + tabName + "/" + subtabName + ": " + e);
}
}
commit 1df6324366bb5f2b1ab690dab27a37c7962adf8a
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Thu Dec 9 16:26:23 2010 -0500
add generic support in TableSection for making name column values links to the corresponding detail views (https://bugzilla.redhat.com/show_bug.cgi?id=661800)
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
index 65a426d..3c1c5f1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
@@ -23,21 +23,18 @@ import java.util.Set;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.core.domain.authz.Permission;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.admin.AdministrationView;
import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
import org.rhq.enterprise.gui.coregui.client.components.table.TableSection;
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.util.message.Message;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
/**
* A table that lists all roles and provides the ability to view details of or delete those roles and to create new
@@ -69,13 +66,6 @@ public class RolesView extends TableSection<RolesDataSource> implements Bookmark
super.configureTable();
ListGridField nameField = new ListGridField(RolesDataSource.Field.NAME, 150);
- nameField.setCellFormatter(new CellFormatter() {
- public String format(Object value, ListGridRecord record, int i, int i1) {
- Integer roleId = getId(record);
- String roleUrl = LinkManager.getRoleLink(roleId);
- return SeleniumUtility.getLocatableHref(roleUrl, value.toString(), null);
- }
- });
ListGridField descriptionField = new ListGridField(RolesDataSource.Field.DESCRIPTION);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
index 0e69751..26ef84d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
@@ -25,20 +25,17 @@ import java.util.Set;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.core.domain.authz.Permission;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.admin.AdministrationView;
import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
import org.rhq.enterprise.gui.coregui.client.components.table.TableSection;
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.util.message.Message;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
/**
* A table that lists all users and provides the ability to view or edit details of users, delete users, or create new
@@ -101,13 +98,6 @@ public class UsersView extends TableSection<UsersDataSource> {
List<ListGridField> fields = new ArrayList<ListGridField>();
ListGridField nameField = new ListGridField(UsersDataSource.Field.NAME, 150);
- nameField.setCellFormatter(new CellFormatter() {
- public String format(Object value, ListGridRecord record, int i, int i1) {
- Integer subjectId = getId(record);
- String userUrl = LinkManager.getUserLink(subjectId);
- return SeleniumUtility.getLocatableHref(userUrl, value.toString(), null);
- }
- });
fields.add(nameField);
ListGridField activeField = new ListGridField(UsersDataSource.Field.FACTIVE, 90);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
index d7b3039..fb1fec9 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
@@ -89,8 +89,8 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableMenu;
*/
public class Table<DS extends RPCDataSource> extends LocatableHLayout implements RefreshableView {
- private static final String FIELD_ID = "id";
- private static final String FIELD_NAME = "name";
+ protected static final String FIELD_ID = "id";
+ protected static final String FIELD_NAME = "name";
private VLayout contents;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
index 4d5c96e..5ab13b6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
@@ -29,6 +29,9 @@ import com.smartgwt.client.types.AnimationEffect;
import com.smartgwt.client.types.VerticalAlignment;
import com.smartgwt.client.widgets.AnimationCallback;
import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.grid.CellFormatter;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.grid.events.CellDoubleClickEvent;
import com.smartgwt.client.widgets.grid.events.CellDoubleClickHandler;
@@ -37,9 +40,11 @@ import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.DetailsView;
+import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.components.buttons.BackButton;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
/**
* @author Greg Hinkle
@@ -105,6 +110,20 @@ public abstract class TableSection<DS extends RPCDataSource> extends Table<DS> i
@Override
protected void onDraw() {
super.onDraw();
+
+ // Make the value of the name field a link to the details view for the corresponding record.
+ ListGridField nameField = getNameField();
+ if (nameField != null) {
+ nameField.setCellFormatter(new CellFormatter() {
+ public String format(Object value, ListGridRecord record, int i, int i1) {
+ Integer recordId = getId(record);
+ String detailsUrl = "#" + TableSection.this.basePath + "/" + recordId;
+ return SeleniumUtility.getLocatableHref(detailsUrl, value.toString(), null);
+ }
+ });
+ }
+
+ // Make double-clicking the row an alternate means to go to the details view.
getListGrid().addCellDoubleClickHandler(new CellDoubleClickHandler() {
@Override
public void onCellDoubleClick(CellDoubleClickEvent event) {
@@ -113,6 +132,11 @@ public abstract class TableSection<DS extends RPCDataSource> extends Table<DS> i
});
}
+ protected ListGridField getNameField() {
+ ListGrid grid = getListGrid();
+ return (grid != null) ? grid.getField(FIELD_NAME) : null;
+ }
+
/**
* Shows the details view for the given record of the table.
*
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
index 6b16fda..860339b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
@@ -24,6 +24,7 @@ import java.util.List;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.grid.CellFormatter;
+import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
@@ -142,6 +143,12 @@ public class ConfigurationHistoryView extends TableSection {
}
@Override
+ protected ListGridField getNameField() {
+ ListGrid grid = getListGrid();
+ return (grid != null) ? grid.getField(FIELD_ID) : null;
+ }
+
+ @Override
public Canvas getDetailsView(int id) {
ConfigurationHistoryDetailView detailView = new ConfigurationHistoryDetailView(this.getLocatorId());
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
index bab2f81..9e8d660 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
@@ -32,6 +32,7 @@ import com.smartgwt.client.widgets.events.CloseClickHandler;
import com.smartgwt.client.widgets.events.CloseClientEvent;
import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.HoverCustomizer;
+import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
@@ -237,6 +238,12 @@ public class OperationHistoryView extends TableSection<OperationHistoryDataSourc
}
@Override
+ protected ListGridField getNameField() {
+ // TODO: What field if any should we return here?
+ return null;
+ }
+
+ @Override
public Canvas getDetailsView(int id) {
OperationDetailsView detailsView = new OperationDetailsView(this.extendLocatorId("Details"));
return detailsView;
commit 8af3f44a41b60ba2d4d084bd7b1458bef3e11b69
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Thu Dec 9 16:28:16 2010 -0500
resource error modal wrap fix.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ResourceErrorsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ResourceErrorsView.java
index f66839a..0309602 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ResourceErrorsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ResourceErrorsView.java
@@ -57,8 +57,7 @@ public class ResourceErrorsView extends Table {
htmlPane.setMargin(10);
htmlPane.setDefaultWidth(550);
htmlPane.setDefaultHeight(550);
- htmlPane.setContents("<pre>" + (event.getRecord().getAttribute(ResourceErrorsDataSource.Field.DETAIL))
- + "</pre>");
+ htmlPane.setContents((event.getRecord().getAttribute(ResourceErrorsDataSource.Field.DETAIL)));
winModal.addItem(htmlPane);
winModal.show();
}
commit e87e0e62a2b93743da88a73ae3a1460d22a46568
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Thu Dec 9 14:32:13 2010 -0500
fix enablement logic for addAll and removeAll buttons so it takes into account record enablement
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/AbstractSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/AbstractSelector.java
index e79e608..81997f0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/AbstractSelector.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/AbstractSelector.java
@@ -51,8 +51,6 @@ import com.smartgwt.client.widgets.form.events.ItemChangedHandler;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
-import com.smartgwt.client.widgets.grid.events.DataArrivedEvent;
-import com.smartgwt.client.widgets.grid.events.DataArrivedHandler;
import com.smartgwt.client.widgets.grid.events.RecordDropEvent;
import com.smartgwt.client.widgets.grid.events.RecordDropHandler;
import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
@@ -267,12 +265,7 @@ public abstract class AbstractSelector<T> extends LocatableVLayout {
}
// Add event handlers.
- this.availableGrid.addDataArrivedHandler(new DataArrivedHandler() {
- public void onDataArrived(DataArrivedEvent event) {
- updateButtonEnablement();
- }
- });
-
+
this.availableGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
public void onSelectionChanged(SelectionEvent selectionEvent) {
updateButtonEnablement();
@@ -318,7 +311,7 @@ public abstract class AbstractSelector<T> extends LocatableVLayout {
}
} else {
availableRecords.addAll(Arrays.asList(allRecords));
- }
+ }
availableGrid.setData(availableRecords.toArray(new Record[availableRecords.size()]));
} finally {
updateButtonEnablement();
@@ -537,8 +530,8 @@ public abstract class AbstractSelector<T> extends LocatableVLayout {
protected void updateButtonEnablement() {
addButton.setDisabled(!availableGrid.anySelected());
removeButton.setDisabled(!assignedGrid.anySelected());
- addAllButton.setDisabled(!containsAtLeastOneRecord(this.availableGrid));
- removeAllButton.setDisabled(!containsAtLeastOneRecord(this.assignedGrid));
+ addAllButton.setDisabled(!containsAtLeastOneEnabledRecord(this.availableGrid));
+ removeAllButton.setDisabled(!containsAtLeastOneEnabledRecord(this.assignedGrid));
}
@Deprecated
@@ -555,8 +548,20 @@ public abstract class AbstractSelector<T> extends LocatableVLayout {
return SELECTOR_KEY;
}
- private static boolean containsAtLeastOneRecord(ListGrid grid) {
- return grid.getTotalRows() > 0;
+ private static boolean containsAtLeastOneEnabledRecord(ListGrid grid) {
+ boolean result = false;
+ ListGridRecord[] assignedRecords = grid.getRecords();
+ for (ListGridRecord assignedRecord : assignedRecords) {
+ if (isEnabled(assignedRecord)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
+
+ private static boolean isEnabled(ListGridRecord assignedRecord) {
+ return assignedRecord.getAttribute("enabled") == null || assignedRecord.getEnabled();
}
}
commit 31a992ef87bfbe6c63c3453f4919ac4733a0fe71
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Thu Dec 9 12:38:51 2010 -0500
add a few missing post record create/delete/update Table refreshes
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 a284cb4..fc22c7a 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
@@ -103,7 +103,7 @@ public class AlertHistoryView extends TableSection<AlertDataSource> {
@Override
protected void configureTable() {
- getListGrid().setFields(((AlertDataSource) getDataSource()).getListGridFields().toArray(new ListGridField[0]));
+ getListGrid().setFields(getDataSource().getListGridFields().toArray(new ListGridField[0]));
setupTableInteractions();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java
index 811c4d8..a1c48f6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java
@@ -96,7 +96,6 @@ public abstract class AbstractAlertDefinitionsView extends TableSection<Abstract
.view_alert_definitions_delete_confirm(), new AbstractTableAction(enablement) {
public void executeAction(ListGridRecord[] selection, Object actionValue) {
deleteButtonPressed(selection);
- refresh();
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GroupAlertDefinitionsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GroupAlertDefinitionsView.java
index eeac74a..5a68af8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GroupAlertDefinitionsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GroupAlertDefinitionsView.java
@@ -208,6 +208,7 @@ public class GroupAlertDefinitionsView extends AbstractAlertDefinitionsView {
CoreGUI.getMessageCenter().notify(
new Message(MSG.view_alert_definitions_create_success(), Severity.Info));
alertDefinition.setId(result.intValue());
+ GroupAlertDefinitionsView.this.refresh();
}
@Override
@@ -222,6 +223,7 @@ public class GroupAlertDefinitionsView extends AbstractAlertDefinitionsView {
public void onSuccess(AlertDefinition result) {
CoreGUI.getMessageCenter().notify(
new Message(MSG.view_alert_definitions_update_success(), Severity.Info));
+ GroupAlertDefinitionsView.this.refresh();
}
@Override
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsView.java
index cf8398c..6ad4392 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsView.java
@@ -204,6 +204,7 @@ public class ResourceAlertDefinitionsView extends AbstractAlertDefinitionsView {
CoreGUI.getMessageCenter().notify(
new Message(MSG.view_alert_definitions_create_success(), Severity.Info));
alertDefinition.setId(result.intValue());
+ ResourceAlertDefinitionsView.this.refresh();
}
@Override
@@ -218,6 +219,7 @@ public class ResourceAlertDefinitionsView extends AbstractAlertDefinitionsView {
public void onSuccess(AlertDefinition result) {
CoreGUI.getMessageCenter().notify(
new Message(MSG.view_alert_definitions_update_success(), Severity.Info));
+ ResourceAlertDefinitionsView.this.refresh();
}
@Override
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/SingleAlertDefinitionView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/SingleAlertDefinitionView.java
index 6ef3b00..82aeea7 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/SingleAlertDefinitionView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/SingleAlertDefinitionView.java
@@ -121,9 +121,7 @@ public class SingleAlertDefinitionView extends LocatableVLayout {
setAlertDefinition(getAlertDefinition()); // loads data into static fields
makeViewOnly();
- alertDefView.commitAlertDefinition(getAlertDefinition());
-
- alertDefView.refresh();
+ alertDefView.commitAlertDefinition(getAlertDefinition());
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/TemplateAlertDefinitionsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/TemplateAlertDefinitionsView.java
index 0394520..ff98eec 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/TemplateAlertDefinitionsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/TemplateAlertDefinitionsView.java
@@ -208,6 +208,7 @@ public class TemplateAlertDefinitionsView extends AbstractAlertDefinitionsView {
CoreGUI.getMessageCenter().notify(
new Message(MSG.view_alert_definitions_create_success(), Severity.Info));
alertDefinition.setId(result.intValue());
+ TemplateAlertDefinitionsView.this.refresh();
}
@Override
@@ -222,6 +223,7 @@ public class TemplateAlertDefinitionsView extends AbstractAlertDefinitionsView {
public void onSuccess(AlertDefinition result) {
CoreGUI.getMessageCenter().notify(
new Message(MSG.view_alert_definitions_update_success(), Severity.Info));
+ TemplateAlertDefinitionsView.this.refresh();
}
@Override
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
index 7534d0d..d7b3039 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
@@ -682,7 +682,8 @@ public class Table<DS extends RPCDataSource> extends LocatableHLayout implements
}
Message message = new Message(MSG
- .widget_recordEditor_info_recordUpdatedConcise(getDataTypeNamePlural()), MSG
+ .widget_recordEditor_info_recordsDeletedConcise(String.valueOf(deletedRecords.length),
+ getDataTypeNamePlural()), MSG
.widget_recordEditor_info_recordsDeletedDetailed(String.valueOf(deletedRecords.length),
getDataTypeNamePlural(), recordNames.toString()));
CoreGUI.getMessageCenter().notify(message);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java
index ad52f97..0fb0e77 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java
@@ -137,7 +137,6 @@ public class GroupDefinitionListView extends TableSection {
CoreGUI.getMessageCenter().notify(
new Message(MSG.view_dynagroup_recalcSuccessfulSelection(String
.valueOf(groupDefinitionIds.length)), Severity.Info));
-
GroupDefinitionListView.this.refresh();
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
index c5d321f..6f9ecbf 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
@@ -153,6 +153,9 @@ public class ResourceAutodiscoveryView extends LocatableVLayout {
treeGrid.setShowPartialSelection(true);
treeGrid.setCascadeSelection(true);
+ // Do this last since it causes the TreeGrid to be initialized.
+ treeGrid.deselectAllRecords();
+
addMember(treeGrid);
footer = new ToolStrip();
13 years, 6 months