modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/ConfigurationMetadataParser.java | 4 modules/core/client-api/src/main/resources/rhq-configuration.xsd | 11 modules/core/dbutils/pom.xml | 2 modules/core/dbutils/src/main/scripts/dbsetup/config-schema.xml | 1 modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml | 7 modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinitionEnumeration.java | 29 - modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinitionSimple.java | 1 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java | 54 +- modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java | 201 +++++++ modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ListGridConfigurationEditor.java | 255 ---------- modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java | 199 +++++++ modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml | 21 modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml | 6 modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml | 16 modules/plugins/jboss-cache/src/main/resources/META-INF/rhq-plugin.xml | 10 modules/plugins/jmx/src/main/resources/META-INF/rhq-plugin.xml | 5 modules/plugins/lsof/src/main/resources/META-INF/rhq-plugin.xml | 4 modules/plugins/netservices/src/main/resources/META-INF/rhq-plugin.xml | 4 modules/plugins/perftest/src/main/resources/META-INF/rhq-plugin.xml | 4 modules/plugins/platform/src/main/resources/META-INF/rhq-plugin.xml | 8 modules/plugins/rhq-agent/src/main/resources/META-INF/rhq-plugin.xml | 28 - modules/plugins/sshd/src/main/resources/META-INF/rhq-plugin.xml | 17 modules/plugins/tomcat/src/main/resources/META-INF/rhq-plugin.xml | 3 modules/plugins/twitter/src/main/resources/META-INF/rhq-plugin.xml | 5 24 files changed, 527 insertions(+), 368 deletions(-)
New commits: commit 5dacfc94663d163f92d499f6ccddf901e6207b05 Author: Ian Springer ian.springer@redhat.com Date: Thu Oct 7 12:44:02 2010 -0400
start of group resource config view
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java new file mode 100644 index 0000000..d77b10e --- /dev/null +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java @@ -0,0 +1,199 @@ +/* + * 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.groups.detail.configuration; + +import java.util.EnumSet; +import java.util.Map; +import java.util.Set; + +import com.smartgwt.client.types.Overflow; +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.configuration.Configuration; +import org.rhq.core.domain.configuration.definition.ConfigurationDefinition; +import org.rhq.core.domain.resource.ResourceType; +import org.rhq.core.domain.resource.composite.ResourcePermission; +import org.rhq.core.domain.resource.group.ResourceGroup; +import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite; +import org.rhq.enterprise.gui.coregui.client.CoreGUI; +import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor; +import org.rhq.enterprise.gui.coregui.client.components.configuration.GroupConfigurationEditor; +import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeEvent; +import org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeListener; +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.message.MessageCenter; +import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton; +import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout; + +/** + * A view for editing a group's configuration. + * + * @author Ian Springer + */ +public class GroupResourceConfigurationEditView extends LocatableVLayout implements PropertyValueChangeListener { + private ResourceGroup group; + private ResourcePermission resourcePermission; + private ConfigurationDefinition configurationDefinition; + private Configuration aggregateConfiguration; + private Map<Integer, Configuration> memberConfigurations; + + private ConfigurationEditor editor; + private IButton saveButton; + + public GroupResourceConfigurationEditView(String locatorId, ResourceGroupComposite groupComposite) { + super(locatorId); + + this.group = groupComposite.getResourceGroup(); + this.resourcePermission = groupComposite.getResourcePermission(); + } + + @Override + protected void onDraw() { + super.onDraw(); + build(); + } + + public void build() { + ToolStrip toolStrip = new ToolStrip(); + toolStrip.setWidth100(); + + toolStrip.addMember(new LayoutSpacer()); + + this.saveButton = new LocatableIButton(this.extendLocatorId("Save"), "Save"); + this.saveButton.addClickHandler(new ClickHandler() { + public void onClick(ClickEvent clickEvent) { + save(); + } + }); + toolStrip.addMember(saveButton); + + addMember(toolStrip); + reloadConfiguration(); + + if (!this.resourcePermission.isConfigureWrite()) { + Message message = new Message("You do not have permission to edit this group's configuration.", + Message.Severity.Info, EnumSet.of(Message.Option.Transient, Message.Option.Sticky)); + CoreGUI.getMessageCenter().notify(message); + } + } + + private void reloadConfiguration() { + this.saveButton.disable(); + if (editor != null) { + editor.destroy(); + removeMember(editor); + } + + loadConfigurationDefinition(); + loadConfigurations(); + } + + private void initEditor() { + if (this.configurationDefinition != null && this.aggregateConfiguration != null) { + this.editor = new GroupConfigurationEditor(this.extendLocatorId("Editor"), this.configurationDefinition, + this.aggregateConfiguration, null); + this.editor.setOverflow(Overflow.AUTO); + this.editor.addPropertyValueChangeListener(this); + this.editor.setReadOnly(!this.resourcePermission.isConfigureWrite()); + addMember(this.editor); + } + } + + private void loadConfigurationDefinition() { + if (configurationDefinition == null) { + final ResourceType type = this.group.getResourceType(); + ResourceTypeRepository.Cache.getInstance().getResourceTypes(new Integer[] { type.getId() }, + EnumSet.of(ResourceTypeRepository.MetadataType.resourceConfigurationDefinition), + new ResourceTypeRepository.TypesLoadedCallback() { + public void onTypesLoaded(Map<Integer, ResourceType> types) { + configurationDefinition = types.get(type.getId()).getResourceConfigurationDefinition(); + if (configurationDefinition == null) { + throw new IllegalStateException("Configuration is not supported by this group."); + } + initEditor(); + } + }); + } + } + + private void loadConfigurations() { + // TODO + this.aggregateConfiguration = null; + /*configurationService.getResourceConfiguration(resourceId, new AsyncCallback<Configuration>() { + public void onFailure(Throwable caught) { + showError(caught); + } + + public void onSuccess(Configuration result) { + configuration = result; + Log.info("Config retreived in: " + (System.currentTimeMillis() - start)); + initEditor(); + } + });*/ + } + + private void save() { + Configuration updatedConfiguration = this.editor.getConfiguration(); + + // TODO +/* + GWTServiceLookup.getConfigurationService().updateResourceConfiguration(resource.getId(), updatedConfiguration, + new AsyncCallback<ResourceConfigurationUpdate>() { + public void onFailure(Throwable caught) { + CoreGUI.getErrorHandler().handleError("Failed to update configuration.", caught); + } + + public void onSuccess(ResourceConfigurationUpdate result) { + CoreGUI.getMessageCenter().notify( + new Message("Configuration updated.", + "Configuration updated for Resource [" + resource.getName() + "].", + Message.Severity.Info)); + reloadConfiguration(); + } + }); +*/ + } + + @Override + public void propertyValueChanged(PropertyValueChangeEvent event) { + MessageCenter messageCenter = CoreGUI.getMessageCenter(); + Message message; + if (event.isValidationStateChanged()) { + Set<String> invalidPropertyNames = event.getInvalidPropertyNames(); + if (invalidPropertyNames.isEmpty()) { + this.saveButton.enable(); + message = new Message("All configuration properties have valid values, so the configuration can now be saved.", + Message.Severity.Info, EnumSet.of(Message.Option.Transient, Message.Option.Sticky)); + } else { + this.saveButton.disable(); + message = new Message("The following configuration properties have invalid values: " + + invalidPropertyNames + ". The values must be corrected before the configuration can be saved.", + Message.Severity.Error, EnumSet.of(Message.Option.Transient, Message.Option.Sticky)); + } + messageCenter.notify(message); + } else { + this.saveButton.enable(); + } + } +}
commit 1d814e59264be7bb2c4fcc6a54be6518cc61be53 Author: Ian Springer ian.springer@redhat.com Date: Thu Oct 7 12:41:34 2010 -0400
get rid of unused is_default field in PropertyDefinitionEnumeration (https://bugzilla.redhat.com/show_bug.cgi?id=536496)
diff --git a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/ConfigurationMetadataParser.java b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/ConfigurationMetadataParser.java index 9d09ba1..72e107a 100644 --- a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/ConfigurationMetadataParser.java +++ b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/ConfigurationMetadataParser.java @@ -265,8 +265,8 @@ public class ConfigurationMetadataParser { name = option.getValue(); }
- parentProperty.addEnumeratedValues(new PropertyDefinitionEnumeration(name, option.getValue(), option - .isDefault())); + PropertyDefinitionEnumeration enumeration = new PropertyDefinitionEnumeration(name, option.getValue()); + parentProperty.addEnumeratedValues(enumeration); }
parentProperty.setAllowCustomEnumeratedValue(options.isAllowCustomValue()); diff --git a/modules/core/client-api/src/main/resources/rhq-configuration.xsd b/modules/core/client-api/src/main/resources/rhq-configuration.xsd index 590f459..fe898f2 100644 --- a/modules/core/client-api/src/main/resources/rhq-configuration.xsd +++ b/modules/core/client-api/src/main/resources/rhq-configuration.xsd @@ -442,7 +442,7 @@
<xs:complexType name="option"> xs:annotation - xs:documentationUsed to describe items available in a property with a list type. + xs:documentationDescribes an allowed value for an enumerated simple property. </xs:documentation> </xs:annotation> <xs:attribute name="name" use="optional"> @@ -463,15 +463,6 @@ <xs:restriction base="xs:string"/> </xs:simpleType> </xs:attribute> - <xs:attribute name="default" default="false" use="optional"> - xs:annotation - xs:documentationIndicates this item is the default item in the list. Default value is false. - </xs:documentation> - </xs:annotation> - xs:simpleType - <xs:restriction base="xs:boolean"/> - </xs:simpleType> - </xs:attribute> </xs:complexType>
<!-- == Property Constraints ================= --> diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml index 4cf8ae1..cb7f1d7 100644 --- a/modules/core/dbutils/pom.xml +++ b/modules/core/dbutils/pom.xml @@ -22,7 +22,7 @@
<properties> <scm.module.path>modules/core/dbutils/</scm.module.path> - <db.schema.version>2.97</db.schema.version> + <db.schema.version>2.98</db.schema.version> </properties>
<dependencies> diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/config-schema.xml b/modules/core/dbutils/src/main/scripts/dbsetup/config-schema.xml index 4db0a57..209a8a9 100644 --- a/modules/core/dbutils/src/main/scripts/dbsetup/config-schema.xml +++ b/modules/core/dbutils/src/main/scripts/dbsetup/config-schema.xml @@ -54,7 +54,6 @@ <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/> <column name="STRING_VALUE" type="VARCHAR2" required="false" size="500"/> <column name="ORDER_INDEX" type="INTEGER" required="false"/> - <column name="IS_DEFAULT" type="BOOLEAN" required="false"/> <column name="NAME" type="VARCHAR2" required="false" size="100"/> <column name="PROPERTY_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_PROP_DEF"/> </table> diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml index b477b09..70e4c46 100644 --- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml +++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml @@ -3240,7 +3240,12 @@ </statement> </schema-directSQL> </schemaSpec> - + + <schemaSpec version="2.98"> + <!-- Remove is_default field from simple prop def enums --> + <schema-deleteColumn ignoreError="true" table="RHQ_CONF_PROP_DEF_ENUM" column="IS_DEFAULT" /> + </schemaSpec> + </dbupgrade> </target> </project> diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinitionEnumeration.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinitionEnumeration.java index fbcabb4..4412cec 100644 --- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinitionEnumeration.java +++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinitionEnumeration.java @@ -64,6 +64,10 @@ public class PropertyDefinitionEnumeration implements Serializable { private int orderIndex = -1;
@Column(name = "IS_DEFAULT") + @Deprecated + /** + * @deprecated - not used; TODO: remove in dbsetup/dbupgrade scripts + */ private boolean isDefault;
@JoinColumn(name = "PROPERTY_DEF_ID") @@ -76,13 +80,8 @@ public class PropertyDefinitionEnumeration implements Serializable { }
public PropertyDefinitionEnumeration(@NotNull String name, String value) { - this(name, value, false); - } - - public PropertyDefinitionEnumeration(@NotNull String name, String value, boolean isDefault) { this.name = name; this.value = value; - this.isDefault = isDefault; }
// @PrePersist @@ -142,39 +141,27 @@ public class PropertyDefinitionEnumeration implements Serializable { this.orderIndex = orderIndex; }
- /** - * Two items are equal if they have the same name and share the same PropertyDefinitionSimple - */ @Override public boolean equals(Object o) { if (this == o) { return true; } - - if ((o == null) || (!(o instanceof PropertyDefinitionEnumeration))) { + if (o == null || getClass() != o.getClass()) { return false; }
- PropertyDefinitionEnumeration that = (PropertyDefinitionEnumeration) o; + PropertyDefinitionEnumeration that = (PropertyDefinitionEnumeration)o;
- if ((name != null) ? (!name.equals(that.name)) : (that.name != null)) { + if (!value.equals(that.value)) { return false; }
- /*if ((propertyDefinitionSimple != null) ? (!propertyDefinitionSimple.equals(that.propertyDefinitionSimple)) - : (that.propertyDefinitionSimple != null)) { - return false; - }*/ - return true; }
@Override public int hashCode() { - int result; - result = ((name != null) ? name.hashCode() : 0); - // result = (31 * result) + ((propertyDefinitionSimple != null) ? propertyDefinitionSimple.hashCode() : 0); - return result; + return value.hashCode(); }
@Override diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinitionSimple.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinitionSimple.java index 782dc99..174aa8e 100644 --- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinitionSimple.java +++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinitionSimple.java @@ -24,7 +24,6 @@ package org.rhq.core.domain.configuration.definition;
import java.util.ArrayList; import java.util.HashSet; -import java.util.LinkedHashSet; import java.util.List; import java.util.Set;
diff --git a/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml index b3f5aa3..420aa01 100644 --- a/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml @@ -150,7 +150,7 @@ UseCanonicalName DNS is intended for use with mass IP-based virtual hosting to support ancient clients that do not provide a Host: header. With this option Apache does a reverse DNS lookup on the server IP address that the client connected to in order to work out self-referential URLs. </c:description> <c:property-options> - <c:option value="Off" default="true"/> + <c:option value="Off"/> <c:option value="On"/> <c:option value="DNS"/> </c:property-options> @@ -163,7 +163,7 @@ In many situations Apache must construct a self-referential URL -- that is, a URL that refers back to the same server. With UseCanonicalPhysicalPort On Apache will, when constructing the canonical port for the server to honor the UseCanonicalName directive, provide the actual physical port number being used by this request as a potential port. With UseCanonicalPhysicalPort Off Apache will not ever use the actual physical port number, instead relying on all configured information to construct a valid port number. </c:description> <c:property-options> - <c:option value="Off" default="true"/> + <c:option value="Off"/> <c:option value="On"/> </c:property-options> </c:simple-property> @@ -175,16 +175,16 @@ The Options directive controls which server features are available in a particular directory. </c:description> <c:map-property name="Options"> - <c:simple-property name="Mode"> + <c:simple-property name="Mode" default="Set"> <c:property-options> - <c:option value="Set" default="true"/> + <c:option value="Set"/> <c:option value="Add"/> <c:option value="Remove"/> </c:property-options> </c:simple-property> - <c:simple-property name="Option"> + <c:simple-property name="Option" default="All"> <c:property-options> - <c:option value="All" default="true"/> + <c:option value="All"/> <c:option value="None"/> <c:option value="ExecCGI"/> <c:option value="FollowSymLinks"/> @@ -295,7 +295,7 @@ <c:simple-property name="augeasEnabled" displayName="Enable augeas support" description="Enable augeas support" default="no"> <c:property-options> <c:option value="yes" name="Yes"/> - <c:option value="no" name="No" default="true"/> + <c:option value="no" name="No"/> </c:property-options> </c:simple-property>
@@ -309,10 +309,11 @@ </c:group>
<c:group name="Virtual Hosts"> - <c:simple-property name="vhostCreationPolicy" displayName="Virtual Hosts Configuration Placement" description="How should the new virtual host definitions be put in the configuration" default="vhost-per-file"> + <c:simple-property name="vhostCreationPolicy" displayName="Virtual Hosts Configuration Placement" + description="How should the new virtual host definitions be put in the configuration" default="vhost-per-file"> <c:property-options> <c:option value="single-file" name="In the main configuration file"/> - <c:option value="vhost-per-file" name="Each Virtual Host in a standalone file" default="true"/> + <c:option value="vhost-per-file" name="Each Virtual Host in a standalone file"/> </c:property-options> </c:simple-property>
@@ -339,7 +340,7 @@ <c:option name="debug" value="debug"/> <c:option name="info" value="info"/> <c:option name="warn" value="warn"/> - <c:option name="error" value="error" default="true"/> + <c:option name="error" value="error"/> <c:option name="fatal" value="fatal"/> </c:property-options> </c:simple-property> diff --git a/modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml index 47ca3e0..473daf1 100644 --- a/modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml @@ -572,9 +572,9 @@ </c:description> <c:map-property name="config-property"> <c:simple-property name="name" description="The name of the configuration property." /> - <c:simple-property name="type" description="The type of the configuration property."> + <c:simple-property name="type" description="The type of the configuration property." default="java.lang.String"> <c:property-options> - <c:option value="java.lang.String" default="true"/> + <c:option value="java.lang.String"/> <c:option value="java.lang.Boolean"/> <c:option value="java.lang.Integer"/> <c:option value="java.lang.Double"/> @@ -1067,7 +1067,7 @@ <c:option name="debug" value="debug"/> <c:option name="info" value="info"/> <c:option name="warn" value="warn"/> - <c:option name="error" value="error" default="true"/> + <c:option name="error" value="error"/> <c:option name="fatal" value="fatal"/> </c:property-options> </c:simple-property> diff --git a/modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml index b3ea3f5..19eed1e 100644 --- a/modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml @@ -62,7 +62,7 @@ description="The method used to execute the Shutdown operation; defaults to 'JMX MBean'."> <c:property-options> - <c:option value="JMX" name="JMX MBean" default="true"/> + <c:option value="JMX" name="JMX MBean"/> <c:option value="SCRIPT" name="shutdown script"/> </c:property-options> </c:simple-property> @@ -103,7 +103,7 @@ <c:option name="debug" value="debug"/> <c:option name="info" value="info"/> <c:option name="warn" value="warn"/> - <c:option name="error" value="error" default="true"/> + <c:option name="error" value="error"/> <c:option name="fatal" value="fatal"/> </c:property-options> </c:simple-property> @@ -443,10 +443,10 @@ <resource-configuration>
<c:group name="connection" displayName="Connection Information"> - <c:simple-property name="type"> + <c:simple-property name="type" default="local-tx-datasource"> <c:property-options> <c:option value="no-tx-datasource" name="No TX Datasource"/> - <c:option value="local-tx-datasource" name="Local TX Datasource" default="true"/> + <c:option value="local-tx-datasource" name="Local TX Datasource"/> <c:option value="xa-datasource" name="XA Datasource"/> </c:property-options> </c:simple-property> @@ -466,11 +466,11 @@ </c:group>
<c:group name="advanced" displayName="Advanced"> - <c:simple-property name="transaction-isolation" required="false" + <c:simple-property name="transaction-isolation" required="false" default="TRANSACTION_READ_COMMITTED" description="The Transaction Isolation level. The default setting is to use whichever isolation level is provided by default by the database."> <c:property-options> <c:option value="TRANSACTION_READ_UNCOMMITTED" name="Read Uncommitted"/> - <c:option value="TRANSACTION_READ_COMMITTED" default="true" name="Read Committed"/> + <c:option value="TRANSACTION_READ_COMMITTED" name="Read Committed"/> <c:option value="TRANSACTION_REPEATABLE_READ" name="Repeatable Read"/> <c:option value="TRANSACTION_SERIALIZABLE" name="Serializable"/> <c:option value="TRANSACTION_NONE" name="None"/> @@ -749,11 +749,11 @@ <c:simple-property name="transaction-type" type="string" displayName="Transaction Type" - default="true" + default="Local Transaction" description="Whether to use local or xa transactions. If nothing is specified, the default of local will be used." required="false"> <c:property-options> - <c:option value="Local Transaction" default="true"/> + <c:option value="Local Transaction"/> <c:option value="XA Transaction"/> </c:property-options> </c:simple-property> diff --git a/modules/plugins/jboss-cache/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-cache/src/main/resources/META-INF/rhq-plugin.xml index 2ef0f4f..61c4d08 100644 --- a/modules/plugins/jboss-cache/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/jboss-cache/src/main/resources/META-INF/rhq-plugin.xml @@ -99,8 +99,8 @@ <c:simple-property name="Flavour" default="treecache" description="Is this going to be a Pojo Cache or a Tree Cache"> <c:property-options> - <c:option name="POJO Cache" value="cache" default="false"/> - <c:option name="Tree Cache" value="treecache" default="true"/> + <c:option name="POJO Cache" value="cache"/> + <c:option name="Tree Cache" value="treecache"/> </c:property-options> </c:simple-property> <c:simple-property name="TransactionManagerLookupClass" @@ -110,7 +110,7 @@ description="The isolation level for access to the cache"> <c:property-options> <c:option value="SERIALIZABLE"/> - <c:option value="REPEATABLE_READ" default="true"/> + <c:option value="REPEATABLE_READ"/> <c:option value="READ_COMMITTED"/> <c:option value="READ_UNCOMMITTED"/> <c:option value="NONE"/> @@ -119,12 +119,12 @@ <c:simple-property name="NodeLockingScheme" default="PESSIMISTIC"> <c:property-options> <c:option value="OPTIMISTIC"/> - <c:option value="PESSIMISTIC" default="true"/> + <c:option value="PESSIMISTIC"/> </c:property-options> </c:simple-property> <c:simple-property name="CacheMode" default="LOCAL"> <c:property-options> - <c:option value="LOCAL" default="true"/> + <c:option value="LOCAL"/> <c:option value="REPL_ASYNC"/> <c:option value="REPL_SYNC"/> </c:property-options> diff --git a/modules/plugins/jmx/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jmx/src/main/resources/META-INF/rhq-plugin.xml index dc5a4cf..b142a22 100644 --- a/modules/plugins/jmx/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/jmx/src/main/resources/META-INF/rhq-plugin.xml @@ -17,9 +17,10 @@ <!-- Properties are connection/lookup configurations. They are values that the plugin components need to connect and interact with the resource. --> <plugin-configuration> - <c:simple-property name="type" type="string" description="The EMS connection type for this JMX Server"> + <c:simple-property name="type" type="string" default="LocalVMTypeDescriptor" + description="The EMS connection type for this JMX Server"> <c:property-options> - <c:option value="LocalVMTypeDescriptor" name="Local" default="true"/> + <c:option value="LocalVMTypeDescriptor" name="Local"/> <c:option value="org.mc4j.ems.connection.support.metadata.JBossConnectionTypeDescriptor" name="JBoss"/> <c:option value="org.mc4j.ems.connection.support.metadata.Tomcat55ConnectionTypeDescriptor" name="Tomcat"/> <c:option value="org.mc4j.ems.connection.support.metadata.JDMKConnectionTypeDescriptor" name="JDMK"/> diff --git a/modules/plugins/lsof/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/lsof/src/main/resources/META-INF/rhq-plugin.xml index a280d27..0053a9d 100644 --- a/modules/plugins/lsof/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/lsof/src/main/resources/META-INF/rhq-plugin.xml @@ -17,9 +17,9 @@ supportsManualAdd="true">
<plugin-configuration> - <c:simple-property name="detectionMechanism" required="true" defaultValue="EXTERNAL" description="Determines how to perform network resource detection. 'external' means that an external executable tool (e.g. lsof) will be used; 'internal' means internal Java detection code provided by the RHQ plugin will be used."> + <c:simple-property name="detectionMechanism" required="true" default="EXTERNAL" description="Determines how to perform network resource detection. 'external' means that an external executable tool (e.g. lsof) will be used; 'internal' means internal Java detection code provided by the RHQ plugin will be used."> <c:property-options> - <c:option value="EXTERNAL" default="true" /> + <c:option value="EXTERNAL" /> <c:option value="INTERNAL" /> </c:property-options> </c:simple-property> diff --git a/modules/plugins/netservices/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/netservices/src/main/resources/META-INF/rhq-plugin.xml index 1db41e0..a3b869c 100644 --- a/modules/plugins/netservices/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/netservices/src/main/resources/META-INF/rhq-plugin.xml @@ -21,7 +21,7 @@ <c:simple-property name="validateResponseCode" type="boolean" default="false"/> <c:simple-property name="sslProtocol" default="none"> <c:property-options> - <c:option value="none" default="true"/> + <c:option value="none"/> <c:option value="SSL"/> <c:option value="TLS"/> </c:property-options> @@ -29,7 +29,7 @@ <c:simple-property name="method" default="GET"> <c:property-options> <c:option value="HEAD"/> - <c:option value="GET" default="true"/> + <c:option value="GET"/> </c:property-options> </c:simple-property> <c:simple-property name="followRedirects" type="boolean" default="false"/> diff --git a/modules/plugins/perftest/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/perftest/src/main/resources/META-INF/rhq-plugin.xml index 34a4e71..06900c8 100644 --- a/modules/plugins/perftest/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/perftest/src/main/resources/META-INF/rhq-plugin.xml @@ -175,10 +175,10 @@ <c:simple-property name="file" type="file"/> <c:simple-property name="directory" type="directory"/>
- <c:simple-property name="enum"> + <c:simple-property name="enum" default="Blue"> <c:property-options> <c:option value="red" name="Red"/> - <c:option value="blue" name="Blue" default="true"/> + <c:option value="blue" name="Blue"/> <c:option value="green" name="Green"/> </c:property-options> </c:simple-property> diff --git a/modules/plugins/platform/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/platform/src/main/resources/META-INF/rhq-plugin.xml index 5a4a8a7..493382e 100644 --- a/modules/plugins/platform/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/platform/src/main/resources/META-INF/rhq-plugin.xml @@ -156,13 +156,13 @@ <c:simple-property name="logTrackingMinimumSeverity" displayName="Minimum Severity" required="false" default="Warning" description="The minimum severity of log messages that will be collected. If not specified, there is no minimum severity (i.e. all will be collected)."> <c:property-options> <c:option value="Information"/> - <c:option value="Warning" default="true"/> + <c:option value="Warning"/> <c:option value="Error"/> </c:property-options> </c:simple-property> <c:simple-property name="logTrackingType" summary="true" required="true" default="file" description="Defines if the log messages are to be found by polling a file or listening to a TCP socket"> <c:property-options> - <c:option value="file" default="true"/> + <c:option value="file"/> <c:option value="listener"/> </c:property-options> </c:simple-property> @@ -220,7 +220,7 @@ <c:simple-property name="minimumSeverity" default="Warning" description="The minimum severity event that will be collected"> <c:property-options> <c:option value="Information"/> - <c:option value="Warning" default="true"/> + <c:option value="Warning"/> <c:option value="Error"/> </c:property-options> </c:simple-property> @@ -573,7 +573,7 @@ <plugin-configuration> <c:simple-property name="type" default="pidFile" description="Choice of using a pid file or a PIQL query to find the process to monitor"> <c:property-options> - <c:option value="pidFile" default="true" name="Pid File"/> + <c:option value="pidFile" name="Pid File"/> <c:option value="piql" name="Process Query"/> </c:property-options> </c:simple-property> diff --git a/modules/plugins/rhq-agent/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/rhq-agent/src/main/resources/META-INF/rhq-plugin.xml index df799fe..d59b312 100644 --- a/modules/plugins/rhq-agent/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/rhq-agent/src/main/resources/META-INF/rhq-plugin.xml @@ -36,7 +36,7 @@ to determine if an event should be fired for that entry. If not specified, no filtering of log entries will be done based on their detail."/> - <c:simple-property name="minimumSeverity" required="false" default="error" + <c:simple-property name="minimumSeverity" required="false" default="ERROR" description="The minimum severity of log messages that should be collected for this source. If not specified, there is no minimum severity (i.e. all log messages will be collected)."> @@ -44,7 +44,7 @@ <c:option name="debug" value="DEBUG"/> <c:option name="info" value="INFO"/> <c:option name="warn" value="WARN"/> - <c:option name="error" value="ERROR" default="true"/> + <c:option name="error" value="ERROR"/> <c:option name="fatal" value="FATAL"/> </c:property-options> </c:simple-property> @@ -364,7 +364,7 @@ <c:description>Communication settings that define the endpoints of this RHQ Agent and its RHQ Server</c:description> <c:simple-property name="rhq.agent.server.transport" type="string" activationPolicy="restart" required="true" default="servlet" displayName="RHQ Server Transport Protocol" description="The transport protocol used to send commands to the RHQ Server. If you want secure communications, the RHQ Server must use an SSL-enabled transport"> <c:property-options> - <c:option name="servlet" value="servlet" default="true" /> + <c:option name="servlet" value="servlet" /> <c:option name="sslservlet" value="sslservlet" /> <c:option name="socket" value="socket" /> <c:option name="sslsocket" value="sslsocket" /> @@ -382,7 +382,7 @@ <c:simple-property name="rhq.agent.server.alias" type="string" activationPolicy="restart" required="false" default="rhqserver" displayName="RHQ Server Alias" description="If the RHQ Server IP address is not defined, this is the DNS alias name that will be looked up to determine the RHQ Server IP address." /> <c:simple-property name="rhq.communications.connector.transport" type="string" activationPolicy="restart" required="true" default="socket" displayName="Agent Transport Protocol" description="The transport protocol used to receive commands from the RHQ Server. e.g. socket, sslsocket. If you want secure communications, you must use an SSL-enabled transport"> <c:property-options> - <c:option name="socket" value="socket" default="true" /> + <c:option name="socket" value="socket" /> <c:option name="sslsocket" value="sslsocket" /> </c:property-options> </c:simple-property> @@ -399,7 +399,7 @@ <c:simple-property name="rhq.communications.connector.security.secure-socket-protocol" type="string" activationPolicy="restart" required="false" default="TLS" displayName="Incoming: Secure Socket Protocol"> <c:property-options allowCustomValue="true"> - <c:option name="TLS" value="TLS" default="true" /> + <c:option name="TLS" value="TLS" /> <c:option name="SSL_TLS" value="SSL_TLS" /> <c:option name="SSL" value="SSL" /> <c:option name="SSLv3" value="SSLv3" /> @@ -410,7 +410,7 @@ <c:simple-property name="rhq.communications.connector.security.keystore.algorithm" type="string" activationPolicy="restart" required="false" default="SunX509" displayName="Incoming: Keystore Algorithm" > <c:property-options allowCustomValue="true"> - <c:option name="SunX509" value="SunX509" default="true" /> + <c:option name="SunX509" value="SunX509" /> <c:option name="IbmX509" value="IbmX509" /> </c:property-options> </c:simple-property> @@ -432,14 +432,14 @@ <c:simple-property name="rhq.communications.connector.security.truststore.algorithm" type="string" activationPolicy="restart" required="false" default="SunX509" displayName="Incoming: Truststore Algorithm"> <c:property-options allowCustomValue="true"> - <c:option name="SunX509" value="SunX509" default="true" /> + <c:option name="SunX509" value="SunX509" /> <c:option name="IbmX509" value="IbmX509" /> </c:property-options> </c:simple-property> <c:simple-property name="rhq.communications.connector.security.truststore.type" type="string" activationPolicy="restart" required="false" default="JKS" displayName="Incoming: Truststore Type"> <c:property-options allowCustomValue="true"> - <c:option name="JKS" value="JKS" default="true" /> + <c:option name="JKS" value="JKS" /> <c:option name="PKCS12" value="PKCS12" /> </c:property-options> </c:simple-property> @@ -449,7 +449,7 @@ type="string" activationPolicy="restart" required="false" default="none" displayName="Incoming: Client Authentication Mode" description="Determines if the agent should authenticate a RHQ Server before accepting incoming commands from it"> <c:property-options> - <c:option name="none" value="none" default="true" /> + <c:option name="none" value="none" /> <c:option name="want" value="want" /> <c:option name="need" value="need" /> </c:property-options> @@ -458,7 +458,7 @@ <c:simple-property name="rhq.agent.client.security.secure-socket-protocol" type="string" activationPolicy="restart" required="false" default="TLS" displayName="Outgoing: Secure Socket Protocol"> <c:property-options allowCustomValue="true"> - <c:option name="TLS" value="TLS" default="true" /> + <c:option name="TLS" value="TLS" /> <c:option name="SSL_TLS" value="SSL_TLS" /> <c:option name="SSL" value="SSL" /> <c:option name="SSLv3" value="SSLv3" /> @@ -469,14 +469,14 @@ <c:simple-property name="rhq.agent.client.security.keystore.algorithm" type="string" activationPolicy="restart" required="false" default="SunX509" displayName="Outgoing: Keystore Algorithm"> <c:property-options allowCustomValue="true"> - <c:option name="SunX509" value="SunX509" default="true" /> + <c:option name="SunX509" value="SunX509" /> <c:option name="IbmX509" value="IbmX509" /> </c:property-options> </c:simple-property> <c:simple-property name="rhq.agent.client.security.keystore.type" type="string" activationPolicy="restart" required="false" default="JKS" displayName="Outgoing: Keystore Type"> <c:property-options allowCustomValue="true"> - <c:option name="JKS" value="JKS" default="true" /> + <c:option name="JKS" value="JKS" /> <c:option name="PKCS12" value="PKCS12" /> </c:property-options> </c:simple-property> @@ -491,14 +491,14 @@ <c:simple-property name="rhq.agent.client.security.truststore.algorithm" type="string" activationPolicy="restart" required="false" default="SunX509" displayName="Outgoing: Truststore Algorithm"> <c:property-options allowCustomValue="true"> - <c:option name="SunX509" value="SunX509" default="true" /> + <c:option name="SunX509" value="SunX509" /> <c:option name="IbmX509" value="IbmX509" /> </c:property-options> </c:simple-property> <c:simple-property name="rhq.agent.client.security.truststore.type" type="string" activationPolicy="restart" required="false" default="JKS" displayName="Outgoing: Truststore Type"> <c:property-options allowCustomValue="true"> - <c:option name="JKS" value="JKS" default="true" /> + <c:option name="JKS" value="JKS" /> <c:option name="PKCS12" value="PKCS12" /> </c:property-options> </c:simple-property> diff --git a/modules/plugins/sshd/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/sshd/src/main/resources/META-INF/rhq-plugin.xml index 06f359f..b5abbdf 100644 --- a/modules/plugins/sshd/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/sshd/src/main/resources/META-INF/rhq-plugin.xml @@ -64,7 +64,8 @@
<c:group name="Settings">
- <c:simple-property name="Protocol" required="false" description=" + <c:simple-property name="Protocol" required="false" default="2" + description=" Specifies the protocol versions sshd(8) supports. The possible values are `1' and `2'. Multiple versions must be comma-separat- ed. The default is ``2,1''. Note that the order of the protocol @@ -73,12 +74,13 @@ ing ``2,1'' is identical to ``1,2''."> <c:property-options> <c:option value="1" name="Version 1 Only"/> - <c:option value="2" default="true" name="Version 2 Only"/> + <c:option value="2" name="Version 2 Only"/> <c:option value="1,2" name="Both Version 1 and Version 2"/> </c:property-options> </c:simple-property>
- <c:simple-property name="LogLevel" required="false" description=" + <c:simple-property name="LogLevel" required="false" default="INFO" + description=" Gives the verbosity level that is used when logging messages from sshd(8). The possible values are: QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3. The default is INFO. @@ -89,18 +91,18 @@ <c:option value="QUIET" name="QUIET"/> <c:option value="FATAL" name="FATAL"/> <c:option value="ERROR" name="ERROR"/> - <c:option value="INFO" default="true" name="INFO"/> + <c:option value="INFO" name="INFO"/> <c:option value="VERBOSE" name="VERBOSE"/> <c:option value="DEBUG" name="DEBUG"/> <c:option value="DEBUG1" name="DEBUG1"/> <c:option value="DEBUG2" name="DEBUG2"/> <c:option value="DEBUG3" name="DEBUG3"/> - </c:property-options> </c:simple-property>
- <c:simple-property name="PermitRootLogin" required="false" description=" + <c:simple-property name="PermitRootLogin" required="false" default="yes" + description=" Specifies whether root can log in using ssh(1). The argument must be ``yes'', ``without-password'', ``forced-commands-only'', or ``no''. The default is ``yes''. @@ -116,11 +118,10 @@
If this option is set to ``no'', root is not allowed to log in."> <c:property-options> - <c:option value="yes" name="Allow Login" default="true"/> + <c:option value="yes" name="Allow Login"/> <c:option value="no" name="Deny Login"/> <c:option value="without-password" name="Login without password"/> <c:option value="forced-commands-only" name="Allow commands only"/> - </c:property-options> </c:simple-property>
diff --git a/modules/plugins/tomcat/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/tomcat/src/main/resources/META-INF/rhq-plugin.xml index 4ba4d91..5d511cc 100644 --- a/modules/plugins/tomcat/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/tomcat/src/main/resources/META-INF/rhq-plugin.xml @@ -69,8 +69,7 @@ name="RPM System V init script" /> <c:option value="SCRIPT" - name="shutdown script" - default="true" /> + name="shutdown script" /> </c:property-options> </c:simple-property>
diff --git a/modules/plugins/twitter/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/twitter/src/main/resources/META-INF/rhq-plugin.xml index fc11bab..a066afc 100644 --- a/modules/plugins/twitter/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/twitter/src/main/resources/META-INF/rhq-plugin.xml @@ -1,4 +1,5 @@ <?xml version="1.0"?> + <plugin name="Twitter" displayName="Twitter Plugin" package="org.rhq.plugins.twitter" @@ -7,7 +8,6 @@ description="Monitor various timelines on Twitter" xmlns:c="urn:xmlns:rhq-configuration">
- <server name="Twitter" discovery="TwitterDiscovery" @@ -68,7 +68,7 @@ <plugin-configuration> <c:simple-property name="kind" default="user"> <c:property-options allowCustomValue="false"> - <c:option value="user" name="User timeline" default="true"/> + <c:option value="user" name="User timeline"/> <c:option value="search" name="Keyword search"/> </c:property-options> </c:simple-property> @@ -86,5 +86,4 @@
</server>
- </plugin>
commit f60319dfe12918ff42bcaada1d0f0fecbb3a346a Author: Ian Springer ian.springer@redhat.com Date: Wed Oct 6 18:31:29 2010 -0400
start of the group config editor component
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 ed165ea..d47f8e1 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 @@ -73,6 +73,7 @@ import com.smartgwt.client.widgets.form.fields.events.ChangedHandler; import com.smartgwt.client.widgets.form.validator.CustomValidator; import com.smartgwt.client.widgets.form.validator.FloatRangeValidator; import com.smartgwt.client.widgets.form.validator.IntegerRangeValidator; +import com.smartgwt.client.widgets.form.validator.LengthRangeValidator; import com.smartgwt.client.widgets.form.validator.RegExpValidator; import com.smartgwt.client.widgets.form.validator.Validator; import com.smartgwt.client.widgets.grid.ListGrid; @@ -147,6 +148,11 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout; * @author Greg Hinkle * @author Ian Springer */ +// +// Note: There was a failed attempt at an editor composed with ListGrid components instead of DynamicForm components, +// but there were problems with having different editors active for different rows in the table at the same time. +// Smart says they're working on enhancing this area, but the DynamicForm might be a better option anyway. (ghinkle) +// @SuppressWarnings({"UnnecessarySemicolon"}) public class ConfigurationEditor extends LocatableVLayout { private static final String RHQ_PROPERTY_ATTRIBUTE_NAME = "rhq:property"; @@ -732,7 +738,7 @@ public class ConfigurationEditor extends LocatableVLayout { VLayout canvas = new VLayout(); canvas.addMember(propertyGrid);
- if (!isReadOnly(propertyDefinitionMap)) { + if (!isReadOnly(propertyDefinitionMap, propertyMap)) { // Map is not read-only - add footer with New and Delete buttons to allow user to add or remove members. ToolStrip footer = new ToolStrip(); footer.setPadding(5); @@ -1034,7 +1040,7 @@ public class ConfigurationEditor extends LocatableVLayout { membersItem.setValueMap(memberValueToIndexMap); listGrid.setItems(membersItem);
- if (!isReadOnly(propertyDefinitionList)) { + if (!isReadOnly(propertyDefinitionList, propertyList)) { // List is not read-only - add footer with New and Delete buttons to allow user to add or remove members. ToolStrip footer = new ToolStrip(); footer.setPadding(5); @@ -1199,8 +1205,8 @@ public class ConfigurationEditor extends LocatableVLayout { return memberValueToIndexMap; }
- private FormItem buildSimpleField(final PropertyDefinitionSimple propertyDefinitionSimple, - final PropertySimple propertySimple) { + protected FormItem buildSimpleField(final PropertyDefinitionSimple propertyDefinitionSimple, + final PropertySimple propertySimple) { Log.debug("Building simple field for " + propertySimple + "...");
FormItem valueItem = null; @@ -1267,7 +1273,8 @@ public class ConfigurationEditor extends LocatableVLayout { List<Validator> validators = buildValidators(propertyDefinitionSimple, propertySimple); valueItem.setValidators(validators.toArray(new Validator[validators.size()]));
- valueItem.setDisabled(isReadOnly(propertyDefinitionSimple) || isUnset(propertyDefinitionSimple, propertySimple)); + valueItem.setDisabled(isReadOnly(propertyDefinitionSimple, propertySimple) + || isUnset(propertyDefinitionSimple, propertySimple)); /* Click handlers seem to be turned off for disabled fields... need an alternative valueItem.addClickHandler(new com.smartgwt.client.widgets.form.fields.events.ClickHandler() { @@ -1301,14 +1308,14 @@ public class ConfigurationEditor extends LocatableVLayout { return currentProperty; }
- private FormItem buildUnsetItem(PropertyDefinitionSimple propertyDefinition, final PropertySimple property, + protected FormItem buildUnsetItem(PropertyDefinitionSimple propertyDefinition, final PropertySimple property, final FormItem valueItem) { FormItem item; if (!propertyDefinition.isRequired()) { CheckboxItem unsetItem = new CheckboxItem(); boolean unset = isUnset(propertyDefinition, property); unsetItem.setValue(unset); - unsetItem.setDisabled(isReadOnly(propertyDefinition)); + unsetItem.setDisabled(isReadOnly(propertyDefinition, property)); unsetItem.setShowLabel(false); unsetItem.setShowTitle(false); unsetItem.setLabelAsTitle(false); @@ -1339,15 +1346,38 @@ public class ConfigurationEditor extends LocatableVLayout { (propertySimple == null || propertySimple.getStringValue() == null)); }
- private boolean isReadOnly(PropertyDefinition propertyDefinition) { - return propertyDefinition.isReadOnly() || this.readOnly; + private boolean isReadOnly(PropertyDefinition propertyDefinition, Property property) { + boolean isInvalidRequiredProperty = false; + if (property instanceof PropertySimple) { + PropertySimple propertySimple = (PropertySimple)property; + String errorMessage = propertySimple.getErrorMessage(); + if ((null == propertySimple.getStringValue()) || "".equals(propertySimple.getStringValue()) + || ((null != errorMessage) && (!"".equals(errorMessage.trim())))) { + // Required properties with no value, or an invalid value (assumed if we see an error message) should + // never be set to read-only, otherwise the user will have no way to give the property a new value and + // thereby get things to a valid state. + isInvalidRequiredProperty = true; + } + } + return !isInvalidRequiredProperty && (propertyDefinition.isReadOnly() || this.readOnly); }
private List<Validator> buildValidators(PropertyDefinitionSimple propertyDefinition, Property property) { List<Validator> validators = new ArrayList<Validator>(); - if (propertyDefinition.getConstraints() != null) { - Set<Constraint> constraints = propertyDefinition.getConstraints();
+ switch (propertyDefinition.getType()) { + case STRING: + case LONG_STRING: + case FILE: + case DIRECTORY: + LengthRangeValidator validator = new LengthRangeValidator(); + validator.setMax(PropertySimple.MAX_VALUE_LENGTH); + validators.add(validator); + break; + } + + Set<Constraint> constraints = propertyDefinition.getConstraints(); + if (constraints != null) { for (Constraint constraint : constraints) { if (constraint instanceof IntegerRangeConstraint) { IntegerRangeConstraint integerConstraint = ((IntegerRangeConstraint) constraint); @@ -1376,11 +1406,13 @@ public class ConfigurationEditor extends LocatableVLayout { } } } + if (property.getErrorMessage() != null) { this.invalidPropertyNames.add(property.getName()); PluginReportedErrorValidator validator = new PluginReportedErrorValidator(property); validators.add(validator); } + return validators; }
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 new file mode 100644 index 0000000..a7150e1 --- /dev/null +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java @@ -0,0 +1,201 @@ +/* + * 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.components.configuration; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import com.smartgwt.client.types.Alignment; +import com.smartgwt.client.widgets.IButton; +import com.smartgwt.client.widgets.Window; +import com.smartgwt.client.widgets.events.ClickEvent; +import com.smartgwt.client.widgets.form.DynamicForm; +import com.smartgwt.client.widgets.form.events.ItemChangedEvent; +import com.smartgwt.client.widgets.form.events.ItemChangedHandler; +import com.smartgwt.client.widgets.form.fields.FormItem; +import com.smartgwt.client.widgets.form.fields.StaticTextItem; +import com.smartgwt.client.widgets.layout.HLayout; + +import org.rhq.core.domain.configuration.Configuration; +import org.rhq.core.domain.configuration.Property; +import org.rhq.core.domain.configuration.PropertyList; +import org.rhq.core.domain.configuration.PropertyMap; +import org.rhq.core.domain.configuration.PropertySimple; +import org.rhq.core.domain.configuration.definition.ConfigurationDefinition; +import org.rhq.core.domain.configuration.definition.PropertyDefinition; +import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple; +import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout; + +/** + * A SmartGWT widget for editing a group of RHQ {@link Configuration}s that conform to the same + * {@link ConfigurationDefinition}. + * + * @author Ian Springer + */ +public class GroupConfigurationEditor extends ConfigurationEditor { + private Map<String, Configuration> memberConfigurations; + + public GroupConfigurationEditor(String locatorId, ConfigurationDefinition configurationDefinition, + Configuration aggregateConfiguration, + Map<String, Configuration> memberConfigurations) { + super(locatorId, configurationDefinition, aggregateConfiguration); + this.memberConfigurations = memberConfigurations; + } + + private void displayMemberValuesEditor(String locatorId, PropertyDefinitionSimple propertyDefinitionSimple, + final FormItem aggregateValueItem, + final PropertySimple aggregatePropertySimple, Integer index) { + LocatableVLayout layout = new LocatableVLayout(locatorId); + layout.setHeight100(); + + // TODO: Add 'Set All Values To' and 'Unset All' controls in a separate DynamicForm. + + final DynamicForm form = new DynamicForm(); + form.setHeight100(); + form.setColWidths("55%", "5%", "40%"); + layout.addMember(form); + + // Add header row. + List<FormItem> items = new ArrayList<FormItem>(); + StaticTextItem memberHeader = new StaticTextItem("memberHeader", "Member"); + items.add(memberHeader); + StaticTextItem unsetHeader = new StaticTextItem("unsetHeader", "Unset"); + items.add(unsetHeader); + StaticTextItem valueHeader = new StaticTextItem("valueHeader", "Value"); + valueHeader.setEndRow(true); + items.add(valueHeader); + + // Add data rows. + final Map<String, PropertySimple> memberProperties = new HashMap<String, PropertySimple>(this.memberConfigurations.size()); + final List<FormItem> valueItems = new ArrayList<FormItem>(this.memberConfigurations.size()); + for (String memberName : this.memberConfigurations.keySet()) { + StaticTextItem memberItem = new StaticTextItem("member", memberName); + items.add(memberItem); + Configuration memberConfiguration = this.memberConfigurations.get(memberName); + PropertySimple memberPropertySimple = getPropertySimple(memberConfiguration, propertyDefinitionSimple, index); + memberProperties.put(memberName, memberPropertySimple); + FormItem valueItem = buildSimpleField(propertyDefinitionSimple, memberPropertySimple); + valueItem.setAttribute("rhq:property", memberPropertySimple); + valueItems.add(valueItem); + FormItem unsetItem = buildUnsetItem(propertyDefinitionSimple, memberPropertySimple, valueItem); + items.add(unsetItem); + items.add(valueItem); + valueItem.setEndRow(true); + } + form.setItems(items.toArray(new FormItem[items.size()])); + + final Window popup = new Window(); + popup.setTitle("Member Values for Property '" + propertyDefinitionSimple.getName()); + popup.setWidth(800); + popup.setHeight(600); + popup.setIsModal(true); + popup.setShowModalMask(true); + popup.setShowCloseButton(false); + popup.centerInPage(); + + final IButton okButton = new IButton("OK"); + okButton.disable(); + okButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() { + public void onClick(ClickEvent clickEvent) { + boolean valuesHomogeneous = true; + String firstValue = (String)valueItems.get(0).getValue(); + for (FormItem valueItem : valueItems) { + String value = (String)valueItem.getValue(); + if ((value != null && !value.equals(firstValue)) || firstValue != null) { + valuesHomogeneous = false; + } + PropertySimple memberPropertySimple = + (PropertySimple)valueItem.getAttributeAsObject("rhq:property"); + memberPropertySimple.setStringValue(value); + memberPropertySimple.setErrorMessage(null); + } + if (valuesHomogeneous) { + // Values are all the same, so update the value of the aggregate property and set its override flag to true. + aggregateValueItem.setValue(firstValue); + // TODO: Will this cause a value changed event to fire for the aggregate form item? + aggregatePropertySimple.setStringValue(firstValue); + aggregatePropertySimple.setErrorMessage(null); + aggregatePropertySimple.setOverride(true); + } + popup.destroy(); + } + }); + + // Only enable the OK button if all properties are valid. + form.addItemChangedHandler(new ItemChangedHandler() { + public void onItemChanged(ItemChangedEvent itemChangedEvent) { + okButton.setDisabled(!form.validate()); + } + }); + + final IButton cancelButton = new IButton("Cancel"); + cancelButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() { + public void onClick(ClickEvent clickEvent) { + popup.destroy(); + } + }); + + // TODO: Anchor the button bar at the bottom of the modal window, so it's always visible. + HLayout buttons = new HLayout(); + buttons.setAlign(Alignment.CENTER); + buttons.setMembersMargin(10); + buttons.setMembers(okButton, cancelButton); + layout.addMember(buttons); + + popup.addItem(layout); + + popup.show(); + } + + private PropertySimple getPropertySimple(Configuration configuration, + PropertyDefinitionSimple propertyDefinitionSimple, Integer index) { + LinkedList<PropertyDefinition> propertyDefinitionHierarchy = new LinkedList<PropertyDefinition>(); + PropertyDefinition currentPropertyDefinition = propertyDefinitionSimple; + do { + propertyDefinitionHierarchy.addFirst(currentPropertyDefinition); + if (currentPropertyDefinition.getParentPropertyMapDefinition() != null) { + currentPropertyDefinition = currentPropertyDefinition.getParentPropertyMapDefinition(); + } else if (currentPropertyDefinition.getParentPropertyListDefinition() != null) { + currentPropertyDefinition = currentPropertyDefinition.getParentPropertyListDefinition(); + } else if (currentPropertyDefinition.getConfigurationDefinition() == null) { + throw new IllegalStateException(currentPropertyDefinition + " has no parent."); + } + } + while (currentPropertyDefinition.getConfigurationDefinition() == null); + + Property property = configuration.get(propertyDefinitionHierarchy.get(0).getName()); + for (int i = 1, propertyDefinitionHierarchySize = propertyDefinitionHierarchy.size(); + i < propertyDefinitionHierarchySize; i++) { + PropertyDefinition propertyDefinition = propertyDefinitionHierarchy.get(i); + if (property instanceof PropertyMap) { + PropertyMap propertyMap = (PropertyMap)property; + property = propertyMap.get(propertyDefinition.getName()); + } else if (property instanceof PropertyList) { + PropertyList propertyList = (PropertyList)property; + property = propertyList.getList().get(index); + } + } + + return (PropertySimple)property; + } +} diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ListGridConfigurationEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ListGridConfigurationEditor.java deleted file mode 100644 index 7136199..0000000 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ListGridConfigurationEditor.java +++ /dev/null @@ -1,255 +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.components.configuration; - -import org.rhq.core.domain.configuration.Configuration; -import org.rhq.core.domain.configuration.PropertySimple; -import org.rhq.core.domain.configuration.definition.ConfigurationDefinition; -import org.rhq.core.domain.configuration.definition.PropertyDefinition; -import org.rhq.core.domain.configuration.definition.PropertyGroupDefinition; -import org.rhq.enterprise.gui.coregui.client.CoreGUI; -import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync; -import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup; - -import com.google.gwt.user.client.rpc.AsyncCallback; -import com.smartgwt.client.types.Autofit; -import com.smartgwt.client.types.ListGridFieldType; -import com.smartgwt.client.types.Overflow; -import com.smartgwt.client.types.SelectionStyle; -import com.smartgwt.client.types.VisibilityMode; -import com.smartgwt.client.widgets.Canvas; -import com.smartgwt.client.widgets.Label; -import com.smartgwt.client.widgets.WidgetCanvas; -import com.smartgwt.client.widgets.form.fields.CanvasItem; -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.layout.SectionStack; -import com.smartgwt.client.widgets.layout.SectionStackSection; -import com.smartgwt.client.widgets.layout.VLayout; - -import java.util.List; - -/** - * Note: This was a failed attempt at an editor composed with ListGrid components instead of DynamicForm components. - * I had problems with having different editors active for different rows in the table at the same time. Smart says - * they're working on enhancing this area... but the DynamicForm might be a better option anyway. - * @author Greg Hinkle - */ -public class ListGridConfigurationEditor extends VLayout { - - private ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService(); - - private ConfigurationDefinition definition; - private Configuration configuration; - - public ListGridConfigurationEditor() { - - - setOverflow(Overflow.AUTO); - - - configurationService.getResourceConfiguration(10005, new AsyncCallback<Configuration>() { - public void onFailure(Throwable caught) { - // TODO: Implement this method. - } - - public void onSuccess(Configuration result) { - configuration = result; - com.allen_sauer.gwt.log.client.Log.info("Got config"); - reload(); - } - }); - - configurationService.getResourceConfigurationDefinition(10060, new AsyncCallback<ConfigurationDefinition>() { - public void onFailure(Throwable caught) { - // TODO: Implement this method. - } - - public void onSuccess(ConfigurationDefinition result) { - definition = result; - com.allen_sauer.gwt.log.client.Log.info("Got def"); - reload(); - } - - ; - }); - } - - - public void reload() { - if (definition == null || configuration == null) { - return; - } - - List<PropertyGroupDefinition> definitions = definition.getGroupDefinitions(); - - - final SectionStack sectionStack = new SectionStack(); - sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE); - sectionStack.setWidth100(); - sectionStack.setOverflow(Overflow.VISIBLE); - - for (PropertyGroupDefinition definition : definitions) { - com.allen_sauer.gwt.log.client.Log.info("building: " + definition.getDisplayName()); - sectionStack.addSection(buildGroupSection(definition)); - } - - addMember(sectionStack); - - this.redraw(); - } - - - public SectionStackSection buildGroupSection(PropertyGroupDefinition group) { - SectionStackSection section = new SectionStackSection(group.getDisplayName() + "<div style='text-align: right; font-size: -2'>" + group.getDescription() + "</div>"); - section.setExpanded(true); - - - ListGrid grid = new ListGrid(); - grid.setAlternateRecordStyles(true); - grid.setSelectionType(SelectionStyle.NONE); - grid.setEditByCell(false); - - grid.setShowHover(false); - grid.setShowAllRecords(true); - grid.setShowAllRecords(true); - grid.setWrapCells(true); - grid.setOverflow(Overflow.VISIBLE); - grid.setBodyOverflow(Overflow.VISIBLE); - grid.setCanSort(false); - - grid.setFixedRecordHeights(false); - grid.setAutoFitMaxHeight(50); - grid.setAutoFitData(Autofit.VERTICAL); - - grid.setAlwaysShowEditors(true); - - - ListGridField nameField = new ListGridField("displayName", "Name", 180); - nameField.setCanEdit(false); - //nameField - - ListGridField unsetField = new ListGridField("unset", "unset", 25); - unsetField.setType(ListGridFieldType.BOOLEAN); - unsetField.setCanEdit(true); - - ListGridField valueField = new ListGridField("value", "Value", 160); - valueField.setCanEdit(true); -// valueField.setEditorType(new TextItem()); - valueField.setEditorType(new ConfigEditor()); - - - final ConfigEditor ce = new ConfigEditor(); - valueField.setCellFormatter(new CellFormatter() { - public String format(Object value, ListGridRecord record, int rowNum, int colNum) { - - - return ce.tc.getInnerHTML(); -// "<input type='radio' name='foo' checked='checked'/> alpha<br/>" + -// "<input type='radio' name='foo' /> beta<br/>" + -// "<input type='radio' name='foo' /> delta<br/>"; - - } - }); - ListGridField descriptionField = new ListGridField("description", "Description"); - descriptionField.setCanEdit(false); - grid.setFields(nameField, unsetField, valueField, descriptionField); - - - for (PropertyDefinition property : definition.getPropertiesInGroup(group.getName())) { - grid.addData(new PropertyRecord(property)); - } - - section.addItem(grid); - return section; - } - - - public class ConfigurationListGrid extends ListGrid { - - public ConfigurationListGrid() { - super(); // TODO: Implement this method. - - - } - - - // Crap, they didn't implement the override for getEditorType yet - - } - - - public class PropertyRecord extends ListGridRecord { - - PropertyDefinition propertyDefinition; - - public PropertyRecord(PropertyDefinition definition) { - this.propertyDefinition = definition; - setAttribute("name", definition.getName()); - setAttribute("displayName", definition.getDisplayName()); - - setAttribute("required", definition.isRequired()); - setAttribute("readOnly", definition.isReadOnly()); - - PropertySimple property = configuration.getSimple(definition.getName()); - - setAttribute("unset", property.getStringValue() == null); - setAttribute("value", property.getStringValue()); - - setAttribute("description", definition.getDescription()); - - } - } - - public class ConfigEditor extends CanvasItem { - - int x = 1; - TestCanvas tc = new TestCanvas(); - - public ConfigEditor() { - super(); - - setCanvas(new WidgetCanvas(new Label("testing"))); - } - - @Override - public Canvas getCanvas() { - - tc.val = "" + x++; - - return tc; - } - - - } - - public class TestCanvas extends Canvas { - - String val; - - - @Override - public String getInnerHTML() { - return val; - } - } - -} \ No newline at end of file
rhq-commits@lists.fedorahosted.org