[rhq] modules/enterprise
by ips
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java | 261 +++++-----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java | 119 +++-
2 files changed, 225 insertions(+), 155 deletions(-)
New commits:
commit 2d314c765251509e6a0cf4f075a2f9fad4b8b3bd
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Oct 22 23:07:25 2010 -0400
add support for dynamic/open maps to group config editor; inform user that viewing/editing of list properties is not currently supported for group configs
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 163ff47..a46b8bb 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,7 +128,6 @@ 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.components.table.PropertyGrid;
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;
@@ -406,7 +405,7 @@ public class ConfigurationEditor extends LocatableVLayout {
protected VLayout buildStructuredPane() {
LocatableVLayout layout = new LocatableVLayout(extendLocatorId("Structured"));
- List<PropertyGroupDefinition> definitions = configurationDefinition.getGroupDefinitions();
+ List<PropertyGroupDefinition> groupDefinitions = configurationDefinition.getGroupDefinitions();
final SectionStack sectionStack = new LocatableSectionStack(layout.extendLocatorId("Sections"));
sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE);
@@ -415,11 +414,11 @@ public class ConfigurationEditor extends LocatableVLayout {
sectionStack.setScrollSectionIntoView(true);
sectionStack.setOverflow(Overflow.AUTO);
- if (configurationDefinition.getNonGroupedProperties().size() > 0) {
+ if (!configurationDefinition.getNonGroupedProperties().isEmpty()) {
sectionStack.addSection(buildGroupSection(layout.extendLocatorId("NoGroup"), null));
}
- for (PropertyGroupDefinition definition : definitions) {
+ for (PropertyGroupDefinition definition : groupDefinitions) {
// com.allen_sauer.gwt.log.client.Log.info("building: " + definition.getDisplayName());
sectionStack.addSection(buildGroupSection(layout.extendLocatorId(definition.getName()), definition));
}
@@ -527,15 +526,14 @@ public class ConfigurationEditor extends LocatableVLayout {
form.setColWidths(190, 28, 210);
List<FormItem> fields = new ArrayList<FormItem>();
- addItemsForPropertiesRecursively(locatorId, propertyDefinitions, propertyMap, fields, firePropertyChangedEvents);
+ addItemsForPropertiesRecursively(locatorId, propertyDefinitions, propertyMap, fields);
form.setFields(fields.toArray(new FormItem[fields.size()]));
return form;
}
private void addItemsForPropertiesRecursively(String locatorId, Collection<PropertyDefinition> propertyDefinitions,
- AbstractPropertyMap propertyMap, List<FormItem> fields,
- boolean firePropertyChangedEvents) {
+ AbstractPropertyMap propertyMap, List<FormItem> fields) {
boolean odd = true;
List<PropertyDefinition> sortedPropertyDefinitions = new ArrayList<PropertyDefinition>(propertyDefinitions);
Collections.sort(sortedPropertyDefinitions, new PropertyDefinitionComparator());
@@ -548,7 +546,7 @@ public class ConfigurationEditor extends LocatableVLayout {
}
}
addItemsForPropertyRecursively(locatorId + "_" + propertyDefinition.getName(), propertyDefinition, property,
- odd, fields, firePropertyChangedEvents);
+ odd, fields);
odd = !odd;
}
}
@@ -556,7 +554,7 @@ public class ConfigurationEditor extends LocatableVLayout {
public void addItemsForPropertyRecursively(String locatorId, PropertyDefinition propertyDefinition,
Property property,
boolean oddRow,
- List<FormItem> fields, final boolean firePropertyChangedEvents) {
+ List<FormItem> fields) {
List<FormItem> fieldsForThisProperty;
if (propertyDefinition instanceof PropertyDefinitionSimple) {
@@ -640,8 +638,8 @@ public class ConfigurationEditor extends LocatableVLayout {
SpacerItem unsetItem = new SpacerItem();
fields.add(unsetItem);
- CanvasItem listOfSimplesItem = buildListOfSimplesField(locatorId, propertyDefinitionList, propertyList,
- oddRow);
+ CanvasItem listOfSimplesItem = buildListOfSimplesField(locatorId, propertyDefinitionList, propertyList
+ );
fields.add(listOfSimplesItem);
StaticTextItem descriptionItem = buildDescriptionField(propertyDefinition);
@@ -674,7 +672,7 @@ public class ConfigurationEditor extends LocatableVLayout {
return fields;
}
- private StaticTextItem buildNameItem(PropertyDefinition propertyDefinition) {
+ protected StaticTextItem buildNameItem(PropertyDefinition propertyDefinition) {
StaticTextItem nameItem = new StaticTextItem();
nameItem.setStartRow(true);
String title = "<b>"
@@ -693,9 +691,9 @@ public class ConfigurationEditor extends LocatableVLayout {
return descriptionItem;
}
- private void firePropertyChangedEvent(Property property,
- PropertyDefinition propertyDefinition,
- boolean isValid) {
+ protected void firePropertyChangedEvent(Property property,
+ PropertyDefinition propertyDefinition,
+ boolean isValid) {
boolean wasValidBefore = this.invalidPropertyNames.isEmpty();
Property topLevelProperty = getTopLevelProperty(property);
if (isValid) {
@@ -719,76 +717,31 @@ public class ConfigurationEditor extends LocatableVLayout {
private FormItem buildMapField(String parentLocatorId, PropertyDefinitionMap propertyDefinitionMap,
final PropertyMap propertyMap) {
- Canvas canvas;
- Map<String, PropertyDefinition> memberPropertyDefinitions = propertyDefinitionMap.getPropertyDefinitions();
String locatorId = parentLocatorId + "_" + propertyDefinitionMap.getName();
- if (memberPropertyDefinitions == null || memberPropertyDefinitions.isEmpty()) {
- canvas = buildDynamicMapField(locatorId, propertyDefinitionMap, propertyMap);
- } else {
- canvas = buildStaticMapField(locatorId, propertyDefinitionMap, propertyMap);
+ boolean isDynamic = isDynamic(propertyDefinitionMap);
+ if (isDynamic) {
+ PropertyDefinitionMap propertyDefinitionMapClone = new PropertyDefinitionMap(propertyDefinitionMap.getName(),
+ propertyDefinitionMap.getDescription(), propertyDefinitionMap.isRequired());
+ propertyDefinitionMapClone.setConfigurationDefinition(propertyDefinitionMap.getConfigurationDefinition());
+ addMemberPropertyDefinitionsToDynamicPropertyMap(propertyDefinitionMapClone, propertyMap);
+ propertyDefinitionMap = propertyDefinitionMapClone;
}
- CanvasItem canvasItem = buildComplexPropertyField(canvas);
- canvasItem.setColSpan(3);
- canvasItem.setEndRow(true);
-
- return canvasItem;
- }
-
- private CanvasItem buildComplexPropertyField(Canvas canvas) {
- CanvasItem canvasItem = new CanvasItem();
- canvasItem.setCanvas(canvas);
- canvasItem.setShowTitle(false);
- return canvasItem;
- }
-
- private Canvas buildDynamicMapField(String parentLocatorId, PropertyDefinitionMap propertyDefinitionMap,
- final PropertyMap propertyMap) {
- Log.debug("Building dynamic map field for " + propertyMap + "...");
-
- // create the property grid
- final PropertyGrid propertyGrid = new PropertyGrid();
- propertyGrid.getNameField().setName("Name");
- propertyGrid.getValuesField().setName("Value");
-
- // create the editors
- Map<String, FormItem> editorsMap = new HashMap<String, FormItem>();
- TextItem textEditor = new TextItem();
- editorsMap.put("simpleText", textEditor);
-
- // set the editors and attribute name where to find the record type
- propertyGrid.setEditorsMap("fieldType", editorsMap);
+ VLayout layout = new VLayout();
- ListGridRecord[] records = new ListGridRecord[propertyMap.getMap().size()];
- int i = 0;
- for (Property prop : propertyMap.getMap().values()) {
- if (!(prop instanceof PropertySimple)) {
- Log.warn("Unsupported Configuration permutation: PropertyMap " + propertyMap
- + " contains non-simple member Property " + prop + " - skipping...");
- continue;
- }
- PropertySimple propSimple = (PropertySimple)prop;
- ListGridRecord record = new ListGridRecord();
- String propertyName = prop.getName();
- record.setAttribute("Name", propertyName);
- String value = propSimple.getStringValue();
- record.setAttribute("Value", value);
- record.setAttribute("fieldType", "simpleText");
- records[i++] = record;
- }
- propertyGrid.setData(records);
-
- VLayout canvas = new VLayout();
- canvas.addMember(propertyGrid);
+ final PropertyDefinitionMap propertyDefinitionMapFinal = propertyDefinitionMap;
+ Canvas valuesCanvas = buildPropertiesForm(parentLocatorId, propertyDefinitionMapFinal.getPropertyDefinitions().values(),
+ propertyMap, true);
+ layout.addMember(valuesCanvas);
- if (!isReadOnly(propertyDefinitionMap, propertyMap)) {
+ if (isDynamic && !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);
- footer.setWidth100();
- footer.setMembersMargin(15);
- canvas.addMember(footer);
+ ToolStrip buttonBar = new ToolStrip();
+ buttonBar.setPadding(5);
+ buttonBar.setWidth100();
+ buttonBar.setMembersMargin(15);
+ layout.addMember(buttonBar);
- final IButton deleteButton = new LocatableIButton(extendLocatorId(propertyMap.getName()), "Delete");
+ /*final IButton deleteButton = new LocatableIButton(extendLocatorId(propertyMap.getName()), "Delete");
deleteButton.setDisabled(true);
deleteButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
public void onClick(ClickEvent clickEvent) {
@@ -815,7 +768,7 @@ public class ConfigurationEditor extends LocatableVLayout {
int count = propertyGrid.getSelection().length;
deleteButton.setDisabled(count < 1);
}
- });
+ });*/
final IButton newButton = new LocatableIButton(extendLocatorId(propertyMap.getName()), "New");
newButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
@@ -829,16 +782,11 @@ public class ConfigurationEditor extends LocatableVLayout {
+ "', because the set already contains a property with that name.",
Message.Severity.Error, EnumSet.of(Message.Option.Transient)));
} else {
- propertyMap.put(new PropertySimple(propertyName, null));
-
- ListGridRecord record = new ListGridRecord();
- record.setAttribute("Name", propertyName);
- record.setAttribute("Value", "");
- record.setAttribute("fieldType", "simpleText");
+ PropertySimple memberPropertySimple = new PropertySimple(propertyName, null);
+ addPropertyToDynamicMap(memberPropertySimple, propertyMap);
+ firePropertyChangedEvent(propertyMap, propertyDefinitionMapFinal, true);
- propertyGrid.addData(record);
- propertyGrid.focus();
- propertyGrid.enableSpecificEditor(record);
+ reload();
CoreGUI.getMessageCenter().notify(new Message("Added property to the set.", EnumSet.of(
Message.Option.Transient)));
@@ -847,33 +795,103 @@ public class ConfigurationEditor extends LocatableVLayout {
});
}
});
- footer.addMember(newButton);
- }
+ buttonBar.addMember(newButton);
+
+ DynamicForm deleteForm = new DynamicForm();
+ deleteForm.setNumCols(3);
+ buttonBar.addMember(deleteForm);
+
+ final SelectItem selectItem = new SelectItem();
+ selectItem.setValueMap(propertyDefinitionMap.getPropertyDefinitions().keySet().toArray(
+ new String[propertyDefinitionMap.getPropertyDefinitions().size()]));
+ selectItem.setMultiple(true);
+ selectItem.setMultipleAppearance(MultipleAppearance.GRID);
+ selectItem.setTitle("Delete");
+
+ final ButtonItem okButtonItem = new ButtonItem();
+ okButtonItem.setTitle("OK");
+ okButtonItem.setDisabled(true);
+ okButtonItem.setEndRow(true);
+ okButtonItem.addClickHandler(new com.smartgwt.client.widgets.form.fields.events.ClickHandler() {
+ public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent clickEvent) {
+ SC.confirm("Are you sure you want to delete the selected properties from the set?", new BooleanCallback() {
+ @Override
+ public void execute(Boolean confirmed) {
+ if (confirmed) {
+ Object value = selectItem.getValue();
+ if (value != null) {
+ String stringValue = value.toString();
+ String[] memberPropertyNames = stringValue.split(",");
+ for (final String memberPropertyName : memberPropertyNames) {
+ PropertySimple memberPropertySimple = propertyMap.getSimple(memberPropertyName);
+ removePropertyFromDynamicMap(memberPropertySimple);
+ firePropertyChangedEvent(propertyMap, propertyDefinitionMapFinal, true);
+ }
+ }
- propertyGrid.addCellSavedHandler(new CellSavedHandler() {
- @Override
- public void onCellSaved(CellSavedEvent cellSavedEvent) {
- Record record = cellSavedEvent.getRecord();
- String propertyName = record.getAttribute("Name");
- PropertySimple prop = propertyMap.getSimple(propertyName);
- if (prop == null) {
- prop = new PropertySimple(propertyName, null);
- propertyMap.put(prop);
+ reload();
+ CoreGUI.getMessageCenter().notify(new Message("Removed properties from the set.", EnumSet.of(
+ Message.Option.Transient)));
+ }
+ }
+ });
}
- String value = record.getAttribute("Value");
- prop.setStringValue(value);
- }
- });
+ });
- return canvas;
+ selectItem.addChangedHandler(new ChangedHandler() {
+ @Override
+ public void onChanged(ChangedEvent changedEvent) {
+ Object value = changedEvent.getValue();
+ if (value != null) {
+ String stringValue = value.toString();
+ String[] memberPropertyNames = stringValue.split(",");
+ okButtonItem.setDisabled(memberPropertyNames.length == 0);
+ }
+ }
+ });
+
+ deleteForm.setFields(selectItem, okButtonItem);
+ }
+
+ CanvasItem canvasItem = buildComplexPropertyField(layout);
+ canvasItem.setColSpan(3);
+ canvasItem.setEndRow(true);
+
+ return canvasItem;
}
- private Canvas buildStaticMapField(String parentLocatorId, PropertyDefinitionMap propertyDefinitionMap,
- PropertyMap propertyMap) {
- Log.debug("Building static map field for " + propertyMap + "...");
+ protected void addPropertyToDynamicMap(PropertySimple memberPropertySimple, PropertyMap propertyMap) {
+ memberPropertySimple.setOverride(true);
+ propertyMap.put(memberPropertySimple);
+ }
- return buildPropertiesForm(parentLocatorId, propertyDefinitionMap.getPropertyDefinitions().values(),
- propertyMap, true);
+ protected void removePropertyFromDynamicMap(PropertySimple propertySimple) {
+ PropertyMap parentMap = propertySimple.getParentMap();
+ parentMap.getMap().remove(propertySimple.getName());
+ }
+
+ private boolean isDynamic(PropertyDefinitionMap propertyDefinitionMap) {
+ Map<String, PropertyDefinition> memberPropertyDefinitions = propertyDefinitionMap.getPropertyDefinitions();
+ return memberPropertyDefinitions == null || memberPropertyDefinitions.isEmpty();
+ }
+
+ private void addMemberPropertyDefinitionsToDynamicPropertyMap(PropertyDefinitionMap propertyDefinitionMap,
+ PropertyMap propertyMap) {
+ for (String propertyName : propertyMap.getMap().keySet()) {
+ PropertySimple memberPropertySimple = propertyMap.getSimple(propertyName);
+ if (memberPropertySimple != null) {
+ PropertyDefinitionSimple memberPropertyDefinitionSimple = new PropertyDefinitionSimple(propertyName,
+ null, false, PropertySimpleType.STRING);
+ propertyDefinitionMap.put(memberPropertyDefinitionSimple);
+ }
+ }
+ }
+
+ private CanvasItem buildComplexPropertyField(Canvas canvas) {
+ CanvasItem canvasItem = new CanvasItem();
+ canvasItem.setCanvas(canvas);
+ canvasItem.setShowTitle(false);
+ return canvasItem;
}
private CanvasItem buildListOfMapsField(final String locatorId,
@@ -1064,7 +1082,7 @@ public class ConfigurationEditor extends LocatableVLayout {
}
private CanvasItem buildListOfSimplesField(String locatorId, final PropertyDefinitionList propertyDefinitionList,
- final PropertyList propertyList, boolean oddRow) {
+ final PropertyList propertyList) {
Log.debug("Building list-of-simples field for " + propertyList + "...");
LocatableVLayout vLayout = new LocatableVLayout(locatorId);
@@ -1369,14 +1387,14 @@ public class ConfigurationEditor extends LocatableVLayout {
return currentProperty;
}
- protected FormItem buildUnsetItem(PropertyDefinitionSimple propertyDefinition, final PropertySimple property,
+ protected FormItem buildUnsetItem(final PropertyDefinitionSimple propertyDefinitionSimple, final PropertySimple propertySimple,
final FormItem valueItem) {
FormItem item;
- if (!propertyDefinition.isRequired()) {
+ if (!propertyDefinitionSimple.isRequired()) {
final CheckboxItem unsetItem = new CheckboxItem();
- boolean unset = isUnset(propertyDefinition, property);
+ boolean unset = isUnset(propertyDefinitionSimple, propertySimple);
unsetItem.setValue(unset);
- unsetItem.setDisabled(isReadOnly(propertyDefinition, property));
+ unsetItem.setDisabled(isReadOnly(propertyDefinitionSimple, propertySimple));
unsetItem.setShowLabel(false);
unsetItem.setShowTitle(false);
unsetItem.setLabelAsTitle(false);
@@ -1387,27 +1405,20 @@ public class ConfigurationEditor extends LocatableVLayout {
Boolean isUnset = (Boolean) changeEvent.getValue();
valueItem.setDisabled(isUnset);
if (isUnset) {
+ updatePropertySimpleValue(null, propertySimple, propertyDefinitionSimple);
setValue(valueItem, null);
} else {
valueItem.focusInItem();
}
valueItem.redraw();
- property.setValue(valueItem.getValue());
- }
- });
-
-/*
- valueItem.addChangeHandler(new ChangeHandler() {
- public void onChange(ChangeEvent changeEvent) {
- Object value = changeEvent.getValue();
- unsetItem.setDisabled(value == null);
+ propertySimple.setValue(valueItem.getValue());
}
});
-*/
item = unsetItem;
} else {
item = new SpacerItem();
+ item.setShowTitle(false);
}
return item;
}
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 c2e2eb7..f544ac6 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
@@ -53,6 +53,7 @@ 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.PropertyDefinitionList;
import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
@@ -113,6 +114,26 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
}
@Override
+ protected List<FormItem> buildFieldsForPropertyList(String locatorId, PropertyDefinition propertyDefinition,
+ boolean oddRow, PropertyDefinitionList propertyDefinitionList,
+ PropertyDefinition memberDefinition,
+ PropertyList propertyList) {
+ List<FormItem> fields = new ArrayList<FormItem>();
+
+ StaticTextItem nameItem = buildNameItem(propertyDefinition);
+ fields.add(nameItem);
+
+ StaticTextItem staticTextItem = new StaticTextItem();
+ staticTextItem.setShowTitle(false);
+ staticTextItem.setValue("List properties are not currently supported for group configurations.");
+ staticTextItem.setColSpan(3);
+ staticTextItem.setEndRow(true);
+ fields.add(staticTextItem);
+
+ return fields;
+ }
+
+ @Override
protected FormItem buildSimpleField(final PropertyDefinitionSimple propertyDefinitionSimple,
final PropertySimple propertySimple) {
final FormItem item = super.buildSimpleField(propertyDefinitionSimple, propertySimple);
@@ -138,6 +159,7 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
return item;
}
+
private FormItemIcon buildEditMemberValuesIcon(final PropertyDefinitionSimple propertyDefinitionSimple,
final PropertySimple propertySimple, final FormItem dynamicItem) {
FormItemIcon icon = new FormItemIcon();
@@ -161,10 +183,9 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
private void updateMemberProperties(PropertyDefinitionSimple propertyDefinitionSimple,
PropertySimple propertySimple, Object value
) {
- for (GroupMemberConfiguration memberConfiguration : memberConfigurations) {
+ for (GroupMemberConfiguration memberConfiguration : this.memberConfigurations) {
Configuration configuration = memberConfiguration.getConfiguration();
- PropertySimple memberPropertySimple =
- getPropertySimple(configuration, propertyDefinitionSimple, null);
+ PropertySimple memberPropertySimple = (PropertySimple)getProperty(configuration, propertySimple, null);
memberPropertySimple.setValue(value);
}
}
@@ -173,7 +194,7 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
protected FormItem buildUnsetItem(final PropertyDefinitionSimple propertyDefinitionSimple, final PropertySimple propertySimple,
final FormItem valueItem) {
final FormItem unsetItem = super.buildUnsetItem(propertyDefinitionSimple, propertySimple, valueItem);
- if (!isHomogeneous(propertySimple) && isAggregateProperty(propertySimple)) {
+ if (unsetItem instanceof CheckboxItem && !isHomogeneous(propertySimple) && isAggregateProperty(propertySimple)) {
// non-homogeneous aggregate property (i.e. members have mixed values)
unsetItem.setValue(false);
unsetItem.setDisabled(true);
@@ -287,7 +308,8 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
memberItem.setDefaultValue(memberName);
items.add(memberItem);
Configuration configuration = memberConfiguration.getConfiguration();
- PropertySimple memberPropertySimple = getPropertySimple(configuration, propertyDefinitionSimple, index);
+ PropertySimple memberPropertySimple =
+ (PropertySimple)getProperty(configuration, aggregatePropertySimple, index);
FormItem valueItem = buildSimpleField(propertyDefinitionSimple, memberPropertySimple);
valueItems.add(valueItem);
valueItemNameToPropertySimpleMap.put(valueItem.getName(), memberPropertySimple);
@@ -303,12 +325,15 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
okButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
public void onClick(ClickEvent clickEvent) {
boolean valuesHomogeneous = true;
+ boolean isValid = true;
+
Object firstValue = valueItems.get(0).getValue();
for (FormItem valueItem : valueItems) {
Object value = valueItem.getValue();
if ((value != null && !value.equals(firstValue)) || (value == null && firstValue != null)) {
valuesHomogeneous = false;
}
+ isValid = isValid && valueItem.validate();
PropertySimple memberPropertySimple = valueItemNameToPropertySimpleMap.get(valueItem.getName());
memberPropertySimple.setValue(value);
memberPropertySimple.setErrorMessage(null);
@@ -332,7 +357,6 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
aggregateValueItem.setDisabled(false);
aggregateStaticItem.hide();
-
} else {
aggregatePropertySimple.setValue(null);
aggregatePropertySimple.setOverride(false);
@@ -342,6 +366,8 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
aggregateStaticItem.show();
}
+ firePropertyChangedEvent(aggregatePropertySimple, propertyDefinitionSimple, isValid);
+
membersForm.markForRedraw();
popup.destroy();
}
@@ -406,46 +432,79 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
// Update all the member properties.
for (GroupMemberConfiguration memberConfiguration : this.memberConfigurations) {
Configuration configuration = memberConfiguration.getConfiguration();
- PropertySimple memberPropertySimple =
- getPropertySimple(configuration, propertyDefinitionSimple, null);
+ PropertySimple memberPropertySimple = (PropertySimple)getProperty(configuration, propertySimple, null);
memberPropertySimple.setErrorMessage(null);
memberPropertySimple.setValue(value);
}
}
- private PropertySimple getPropertySimple(Configuration configuration,
- PropertyDefinitionSimple propertyDefinitionSimple,
- Integer index) {
- LinkedList<PropertyDefinition> propertyDefinitionHierarchy = new LinkedList<PropertyDefinition>();
- PropertyDefinition currentPropertyDefinition = propertyDefinitionSimple;
- propertyDefinitionHierarchy.add(currentPropertyDefinition);
+ @Override
+ protected void removePropertyFromDynamicMap(PropertySimple propertySimple) {
+ // Remove the aggregate property.
+ super.removePropertyFromDynamicMap(propertySimple);
+
+ // Remove the member properties.
+ for (GroupMemberConfiguration memberConfiguration : this.memberConfigurations) {
+ Configuration configuration = memberConfiguration.getConfiguration();
+ PropertySimple memberPropertySimple = (PropertySimple)getProperty(configuration, propertySimple, null);
+ PropertyMap parentMap = memberPropertySimple.getParentMap();
+ parentMap.getMap().remove(memberPropertySimple.getName());
+ }
+ }
+
+ @Override
+ protected void addPropertyToDynamicMap(PropertySimple propertySimple, PropertyMap propertyMap) {
+ // Add the aggregate property.
+ super.addPropertyToDynamicMap(propertySimple, propertyMap);
+
+ // Add the member properties.
+ for (GroupMemberConfiguration memberConfiguration : this.memberConfigurations) {
+ Configuration configuration = memberConfiguration.getConfiguration();
+ // The below call will create the member property and add it to the appropriate parent property in the member config.
+ PropertySimple memberPropertySimple = (PropertySimple)getProperty(configuration, propertySimple, null);
+ }
+ }
+
+ private Property getProperty(Configuration configuration,
+ Property referenceProperty,
+ Integer index) {
+ LinkedList<Property> propertyHierarchy = new LinkedList<Property>();
+ Property currentProperty = referenceProperty;
+ propertyHierarchy.add(currentProperty);
do {
- 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.");
+ if (currentProperty.getParentMap() != null) {
+ currentProperty = currentProperty.getParentMap();
+ } else if (currentProperty.getParentList() != null) {
+ currentProperty = currentProperty.getParentList();
+ } else if (currentProperty.getConfiguration() == null) {
+ throw new IllegalStateException(currentProperty + " has no parent.");
}
- propertyDefinitionHierarchy.addFirst(currentPropertyDefinition);
+ propertyHierarchy.addFirst(currentProperty);
}
- while (currentPropertyDefinition.getConfigurationDefinition() == null);
+ while (currentProperty.getConfiguration() == null);
- Property property = configuration.get(propertyDefinitionHierarchy.get(0).getName());
- for (int i = 1, propertyDefinitionHierarchySize = propertyDefinitionHierarchy.size();
- i < propertyDefinitionHierarchySize; i++) {
- PropertyDefinition propertyDefinition = propertyDefinitionHierarchy.get(i);
+ Property property = configuration.get(propertyHierarchy.get(0).getName());
+ for (int i = 1, propertyHierarchySize = propertyHierarchy.size(); i < propertyHierarchySize; i++) {
+ String childPropertyName = propertyHierarchy.get(i).getName();
if (property instanceof PropertyMap) {
PropertyMap propertyMap = (PropertyMap)property;
- property = propertyMap.get(propertyDefinition.getName());
+ property = propertyMap.get(childPropertyName);
+ if (property == null) {
+ property = new PropertySimple(childPropertyName, null);
+ propertyMap.put(property);
+ }
} else if (property instanceof PropertyList) {
PropertyList propertyList = (PropertyList)property;
- property = propertyList.getList().get(index);
+ if (index < propertyList.getList().size()) {
+ property = propertyList.getList().get(index);
+ } else {
+ property = new PropertySimple(childPropertyName, null);
+ propertyList.add(property);
+ }
}
}
- PropertySimple propertySimple = (PropertySimple)property;
- return propertySimple;
+ return property;
}
private boolean isAggregateProperty(PropertySimple propertySimple) {
13 years, 7 months
[rhq] 2 commits - modules/core modules/enterprise modules/pom.xml
by ips
modules/core/domain/src/main/java/org/rhq/core/domain/util/StringUtils.java | 8 -
modules/core/pom.xml | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/InventorySummaryView.java | 44 +++++-----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java | 7 -
modules/pom.xml | 5 -
5 files changed, 36 insertions(+), 32 deletions(-)
New commits:
commit 3fb1547bb631a16537556ad15ea1cdceaf661c5d
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Oct 22 14:48:13 2010 -0400
fix the links on the summary counts portlet so they go to the correct views; fix bug that was causing resource search list views from displaying
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/InventorySummaryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/InventorySummaryView.java
index 0336a29..90c8bc1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/InventorySummaryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/InventorySummaryView.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
+ * Copyright (C) 2005-2010 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -20,13 +20,11 @@
* 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.summary;
import java.util.ArrayList;
import java.util.List;
-import com.google.gwt.user.client.History;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.form.DynamicForm;
@@ -44,12 +42,10 @@ 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.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceBossGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.InventoryView;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
public class InventorySummaryView extends LocatableVLayout implements Portlet {
-
private ResourceBossGWTServiceAsync resourceBossService = GWTServiceLookup.getResourceBossService();
private LocatableDynamicForm form;
@@ -76,30 +72,32 @@ public class InventorySummaryView extends LocatableVLayout implements Portlet {
// formItems.add(headerItem);
StaticTextItem platformTotal = createSummaryRow("platformTotal", "Platform Total", summary
- .getPlatformCount());
+ .getPlatformCount(), "Inventory/Resources/Platforms");
formItems.add(platformTotal);
- StaticTextItem serverTotal = createSummaryRow("serverTotal", "Server Total", summary.getServerCount());
+ StaticTextItem serverTotal = createSummaryRow("serverTotal", "Server Total", summary.getServerCount(),
+ "Inventory/Resources/Servers");
formItems.add(serverTotal);
StaticTextItem serviceTotal = createSummaryRow("serviceTotal", "Service Total", summary
- .getServiceCount());
+ .getServiceCount(), "Inventory/Resources/Services");
formItems.add(serviceTotal);
StaticTextItem compatibleGroupTotal = createSummaryRow("compatibleGroupTotal",
- "Compatible Group Total", summary.getCompatibleGroupCount());
+ "Compatible Group Total", summary.getCompatibleGroupCount(), "Inventory/Groups/CompatibleGroups");
formItems.add(compatibleGroupTotal);
StaticTextItem mixedGroupTotal = createSummaryRow("mixedGroupTotal", "Mixed Group Total", summary
- .getMixedGroupCount());
+ .getMixedGroupCount(), "Inventory/Groups/MixedGroups");
formItems.add(mixedGroupTotal);
StaticTextItem groupDefinitionTotal = createSummaryRow("groupDefinitionTotal",
- "Group Definition Total", summary.getGroupDefinitionCount());
+ "Group Definition Total", summary.getGroupDefinitionCount(), "Inventory/Groups/DynagroupManager");
formItems.add(groupDefinitionTotal);
StaticTextItem avergeMetricsTotal = createSummaryRow("averageMetricsTotal",
- "Average Metrics per Minute", summary.getScheduledMeasurementsPerMinute());
+ "Average Metrics per Minute", summary.getScheduledMeasurementsPerMinute(),
+ null);
formItems.add(avergeMetricsTotal);
form.setItems(formItems.toArray(new FormItem[formItems.size()]));
@@ -110,16 +108,21 @@ public class InventorySummaryView extends LocatableVLayout implements Portlet {
});
}
- private StaticTextItem createSummaryRow(String name, String label, int value) {
- final LinkItem item = new LinkItem(name);
+ private StaticTextItem createSummaryRow(String name, String label, int value, final String viewPath) {
+ final StaticTextItem item;
+ if (viewPath != null) {
+ item = new LinkItem(name);
+ item.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ CoreGUI.goToView(viewPath);
+ }
+ });
+ } else {
+ item = new StaticTextItem(name);
+ }
+
item.setTitle(label);
item.setValue(value);
- item.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- // TODO Figure out to where the click events should be navigating
- History.newItem(InventoryView.VIEW_ID);
- }
- });
return item;
}
@@ -155,5 +158,4 @@ public class InventorySummaryView extends LocatableVLayout implements Portlet {
return new InventorySummaryView(locatorId);
}
}
-
}
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 e55d846..4702e21 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
@@ -51,7 +51,6 @@ import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
* @author Greg Hinkle
*/
public class ResourceDatasource extends RPCDataSource<Resource> {
-
private ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();
private static ResourceDatasource INSTANCE;
@@ -165,15 +164,15 @@ public class ResourceDatasource extends RPCDataSource<Resource> {
record.setAttribute(DESCRIPTION.propertyName(), from.getDescription());
record.setAttribute(TYPE.propertyName(), from.getResourceType().getId());
record.setAttribute(PLUGIN.propertyName(), from.getResourceType().getPlugin());
- record.setAttribute(CATEGORY.propertyName(), from.getResourceType().getCategory().getDisplayName());
+ record.setAttribute(CATEGORY.propertyName(), from.getResourceType().getCategory().name());
record.setAttribute("icon", from.getResourceType().getCategory().getDisplayName() + "_"
+ (from.getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP ? "up" : "down") + "_16.png");
record
.setAttribute(
AVAILABILITY.propertyName(),
- from.getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP ? "/images/icons/availability_green_16.png"
- : "/images/icons/availability_red_16.png");
+ from.getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP ?
+ "/images/icons/availability_green_16.png" : "/images/icons/availability_red_16.png");
return record;
}
commit f3abb55db3af3eb6a0e8674a332b54fc7d6c1c23
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Oct 22 12:08:53 2010 -0400
fix for StringUtils.deCamelCase(); stop using activeByDefault in root and core poms, since it breaks intellij's maven plugin
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/util/StringUtils.java b/modules/core/domain/src/main/java/org/rhq/core/domain/util/StringUtils.java
index 01a6ddb..ec52b1e 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/util/StringUtils.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/util/StringUtils.java
@@ -79,11 +79,11 @@ public class StringUtils {
for (int i = 1; i < target.length(); i++) {
currentChar = target.charAt(i);
- // Make sure to insert spaces in the middle of acronyms or multi-digit numbers.
+ // Make sure to not insert spaces in the middle of acronyms or multi-digit numbers.
if ((previousChar == ' ' && currentChar != ' ')
|| (Character.isDigit(currentChar) && !Character.isDigit(previousChar))
- || (Character.isUpperCase(currentChar) && (!Character.isUpperCase(previousChar)
- || ((i < (target.length() - 1)) && Character.isLowerCase(target.charAt(i + 1)))))) {
+ || (Character.isUpperCase(currentChar) &&
+ (i < (target.length() - 1)) && Character.isLowerCase(target.charAt(i + 1)))) {
// We're at the start of a new word.
appendWord(result, currentWord.toString());
currentWord = new StringBuilder();
@@ -147,4 +147,4 @@ public class StringUtils {
return builder.toString();
}
-}
\ No newline at end of file
+}
diff --git a/modules/core/pom.xml b/modules/core/pom.xml
index 5853b59..f6f8289 100644
--- a/modules/core/pom.xml
+++ b/modules/core/pom.xml
@@ -37,7 +37,9 @@
<profile>
<id>default</id>
<activation>
- <activeByDefault>true</activeByDefault>
+ <property>
+ <name>java.home</name>
+ </property>
</activation>
<modules>
<module>util</module>
diff --git a/modules/pom.xml b/modules/pom.xml
index ef98301..c7b9224 100644
--- a/modules/pom.xml
+++ b/modules/pom.xml
@@ -22,7 +22,6 @@
</scm>
<properties>
- <scm.module.path>modules/</scm.module.path>
</properties>
<profiles>
@@ -30,7 +29,9 @@
<profile>
<id>default</id>
<activation>
- <activeByDefault>true</activeByDefault>
+ <property>
+ <name>java.home</name>
+ </property>
</activation>
<modules>
<module>core</module>
13 years, 7 months
[rhq] modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java | 12 +++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
New commits:
commit dd89c2f58af8a86d06ba171912a4a27387a386f5
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Oct 22 13:35:47 2010 -0400
quick-n-dirty - get metric template functionality back - this reuses the old jsp page. will have to refactor later with a new GWT impl
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java
index 340b8fc..bd0a433 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java
@@ -23,7 +23,6 @@ import com.smartgwt.client.data.Record;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.SelectionStyle;
import com.smartgwt.client.types.VisibilityMode;
-import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.ImgButton;
import com.smartgwt.client.widgets.events.ClickEvent;
@@ -49,6 +48,7 @@ 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.alert.definitions.TemplateAlertDefinitionsView;
+import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
import org.rhq.enterprise.gui.coregui.client.components.buttons.BackButton;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableListGrid;
@@ -150,6 +150,7 @@ public class ResourceTypeTreeView extends LocatableVLayout implements Bookmarkab
LocatableVLayout layout = new LocatableVLayout(extendLocatorId("alertTemplateLayout"));
layout.setHeight100();
layout.setWidth100();
+ layout.setMargin(5);
this.alertTemplateCanvas = layout;
}
@@ -161,6 +162,7 @@ public class ResourceTypeTreeView extends LocatableVLayout implements Bookmarkab
LocatableVLayout layout = new LocatableVLayout(extendLocatorId("metricTemplateLayout"));
layout.setHeight100();
layout.setWidth100();
+ layout.setMargin(5);
this.metricTemplateCanvas = layout;
}
@@ -233,8 +235,12 @@ public class ResourceTypeTreeView extends LocatableVLayout implements Bookmarkab
}
private void editMetricTemplate(int resourceTypeId) {
- // http://localhost:7080/admin/platform/monitor/Config.do?nomenu=true&mode=c...
- SC.say("Metric Template : " + resourceTypeId);
+ // TODO: convert this to GWT
+ Layout metricCanvas = getMetricTemplateCanvas();
+ FullHTMLPane jspPage = new FullHTMLPane("/admin/platform/monitor/Config.do?nomenu=true&mode=configure&id="
+ + resourceTypeId + "&type=" + resourceTypeId);
+ prepareSubCanvas(metricCanvas, jspPage, true);
+ switchToCanvas(ResourceTypeTreeView.this, metricCanvas);
}
public class CustomResourceTypeListGrid extends LocatableListGrid {
13 years, 7 months
[rhq] 2 commits - modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java | 49 ++++++----
1 file changed, 30 insertions(+), 19 deletions(-)
New commits:
commit 2bf75b1f2f702f38df5fe3e6c694361f19d98f34
Merge: e874b2f... 7ad728b...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Oct 22 13:22:21 2010 -0400
Merge commit 'origin/master'
commit e874b2f1adca6feaafd946daa0f35e49197f7e9f
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Oct 22 13:21:13 2010 -0400
get the admin view to correctly select the proper node when directly navigating to an internal page via a direct URL.
also allow the user to reload the content when clicking an already selected node
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
index 2d854b3..b28f6a6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
@@ -21,12 +21,11 @@ package org.rhq.enterprise.gui.coregui.client.admin;
import java.util.LinkedHashMap;
import java.util.Map;
-import com.google.gwt.user.client.History;
import com.smartgwt.client.types.VisibilityMode;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
-import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
-import com.smartgwt.client.widgets.grid.events.SelectionEvent;
+import com.smartgwt.client.widgets.grid.events.CellClickEvent;
+import com.smartgwt.client.widgets.grid.events.CellClickHandler;
import com.smartgwt.client.widgets.layout.SectionStack;
import com.smartgwt.client.widgets.layout.SectionStackSection;
import com.smartgwt.client.widgets.tree.Tree;
@@ -107,20 +106,21 @@ public class AdministrationView extends LocatableHLayout implements Bookmarkable
addMember(contentCanvas);
}
- private void addSection(TreeGrid treeGrid) {
+ private void addSection(final TreeGrid treeGrid) {
final String sectionName = treeGrid.getTree().getRoot().getName();
this.treeGrids.put(sectionName, treeGrid);
- treeGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
- public void onSelectionChanged(SelectionEvent selectionEvent) {
- if (selectionEvent.getState()) {
- TreeNode node = (TreeNode) selectionEvent.getRecord();
- String pageName = node.getName();
+ treeGrid.addCellClickHandler(new CellClickHandler() {
+ @Override
+ public void onCellClick(CellClickEvent event) {
+ // we use cell click as opposed to selected changed handler
+ // because we want to be able to refresh even if clicking
+ // on an already selected node
+ TreeNode selectedRecord = (TreeNode) treeGrid.getSelectedRecord();
+ if (selectedRecord != null) {
+ String pageName = selectedRecord.getName();
String viewPath = AdministrationView.VIEW_ID + "/" + sectionName + "/" + pageName;
- String currentViewPath = History.getToken();
- if (!currentViewPath.startsWith(viewPath)) {
- CoreGUI.goToView(viewPath);
- }
+ CoreGUI.goToView(viewPath);
}
}
});
@@ -276,12 +276,7 @@ public class AdministrationView extends LocatableHLayout implements Bookmarkable
}
// when changing sections make sure the previous section's selection is deselected
- for (String name : treeGrids.keySet()) {
- TreeGrid treeGrid = treeGrids.get(name);
- if (!name.equals(sectionName)) {
- treeGrid.deselectAllRecords();
- }
- }
+ selectSectionPageTreeGridNode(sectionName, pageName);
// ignore clicks on subsection folder nodes
if (null != content) {
@@ -308,6 +303,22 @@ public class AdministrationView extends LocatableHLayout implements Bookmarkable
}
}
+ private void selectSectionPageTreeGridNode(String sectionName, String pageName) {
+ for (String name : treeGrids.keySet()) {
+ TreeGrid treeGrid = treeGrids.get(name);
+ if (!name.equals(sectionName)) {
+ treeGrid.deselectAllRecords();
+ } else {
+ TreeNode node = treeGrid.getTree().find(pageName);
+ if (node != null) {
+ treeGrid.selectSingleRecord(node);
+ } else {
+ CoreGUI.getErrorHandler().handleError("Unknown page name - URL is incorrect");
+ }
+ }
+ }
+ }
+
private static String addQueryStringParam(String url, String param) {
char separatorChar = (url.indexOf('?') == -1) ? '?' : '&';
return url + separatorChar + param;
13 years, 7 months
[rhq] modules/enterprise
by Jay Shaughnessy
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java | 4 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java | 28 ++++++----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java | 27 +++++----
3 files changed, 34 insertions(+), 25 deletions(-)
New commits:
commit 7ad728b11eed2b2cf1117510afdff6c4c4f0b2da
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Oct 22 12:20:11 2010 -0400
Fix issue with resource lists not rendering in debug mode. The issue was
that the ResourceDatsource was setting the listgrid category attribute
to the ResourceCategory object. In non-debug this seemed to render
just fine, using, I guess toString. But in debug it failed silently,
requiring specifically the name string to be set for the attribute.
Unrelated:
- Add support for singleton use of ResourceDatasource and use it for the
ResourceSearchView.
- Use ResourceDataField object where not used and use imports of these
objects where applicable ( just for cleaner code )
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 dab49e6..86f90bc 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
@@ -327,8 +327,8 @@ public class Table extends LocatableHLayout implements RefreshableView {
public void onClick(ClickEvent clickEvent) {
if (tableAction.confirmMessage != null) {
- String message = tableAction.confirmMessage.replaceAll("\\#",
- String.valueOf(listGrid.getSelection().length));
+ String message = tableAction.confirmMessage.replaceAll("\\#", String.valueOf(listGrid
+ .getSelection().length));
SC.ask(message, new BooleanCallback() {
public void execute(Boolean confirmed) {
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 c2c2e0e..e55d846 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
@@ -54,6 +54,15 @@ public class ResourceDatasource extends RPCDataSource<Resource> {
private ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();
+ private static ResourceDatasource INSTANCE;
+
+ public static ResourceDatasource getInstance() {
+ if (INSTANCE == null) {
+ INSTANCE = new ResourceDatasource();
+ }
+ return INSTANCE;
+ }
+
public ResourceDatasource() {
super();
List<DataSourceField> fields = addDataSourceFields();
@@ -110,12 +119,18 @@ public class ResourceDatasource extends RPCDataSource<Resource> {
}
public void onSuccess(PageList<Resource> result) {
-
dataRetrieved(result, response, request);
}
});
}
+ protected void dataRetrieved(PageList<Resource> result, DSResponse response, DSRequest request) {
+ ListGridRecord[] records = buildRecords(result);
+ response.setData(records);
+ response.setTotalRows(result.getTotalSize()); // for paging to work we have to specify size of full result set
+ processResponse(request.getRequestId(), response);
+ }
+
protected ResourceCriteria getFetchCriteria(final DSRequest request) {
ResourceCriteria criteria = new ResourceCriteria();
criteria.setPageControl(getPageControl(request));
@@ -136,13 +151,6 @@ public class ResourceDatasource extends RPCDataSource<Resource> {
return criteria;
}
- protected void dataRetrieved(PageList<Resource> result, DSResponse response, DSRequest request) {
- ListGridRecord[] records = buildRecords(result);
- response.setData(records);
- response.setTotalRows(result.getTotalSize()); // for paging to work we have to specify size of full result set
- processResponse(request.getRequestId(), response);
- }
-
@Override
public Resource copyValues(ListGridRecord from) {
return new Resource(from.getAttributeAsInt("id"));
@@ -157,13 +165,13 @@ public class ResourceDatasource extends RPCDataSource<Resource> {
record.setAttribute(DESCRIPTION.propertyName(), from.getDescription());
record.setAttribute(TYPE.propertyName(), from.getResourceType().getId());
record.setAttribute(PLUGIN.propertyName(), from.getResourceType().getPlugin());
- record.setAttribute(CATEGORY.propertyName(), from.getResourceType().getCategory());
+ record.setAttribute(CATEGORY.propertyName(), from.getResourceType().getCategory().getDisplayName());
record.setAttribute("icon", from.getResourceType().getCategory().getDisplayName() + "_"
+ (from.getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP ? "up" : "down") + "_16.png");
record
.setAttribute(
- "currentAvailability",
+ AVAILABILITY.propertyName(),
from.getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP ? "/images/icons/availability_green_16.png"
: "/images/icons/availability_red_16.png");
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 82595af..f0154d3 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
@@ -18,6 +18,13 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource;
+import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.AVAILABILITY;
+import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.CATEGORY;
+import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.DESCRIPTION;
+import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.NAME;
+import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.PLUGIN;
+import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.TYPE;
+
import java.util.ArrayList;
import java.util.List;
@@ -88,7 +95,7 @@ public class ResourceSearchView extends Table {
// searchPanel.setWrapItemTitles(false);
// searchPanel.setFields(searchBox);
- final ResourceDatasource datasource = new ResourceDatasource();
+ final ResourceDatasource datasource = ResourceDatasource.getInstance();
setDataSource(datasource);
}
@@ -99,8 +106,7 @@ public class ResourceSearchView extends Table {
iconField.setType(ListGridFieldType.IMAGE);
iconField.setImageURLPrefix("types/");
- ListGridField nameField = new ListGridField(ResourceDataSourceField.NAME.propertyName(),
- ResourceDataSourceField.NAME.title(), 250);
+ ListGridField nameField = new ListGridField(NAME.propertyName(), NAME.title(), 250);
nameField.setCellFormatter(new CellFormatter() {
public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
return "<a href=\"" + LinkManager.getResourceLink(listGridRecord.getAttributeAsInt("id")) + "\">" + o
@@ -108,20 +114,15 @@ public class ResourceSearchView extends Table {
}
});
- ListGridField descriptionField = new ListGridField(ResourceDataSourceField.DESCRIPTION.propertyName(),
- ResourceDataSourceField.DESCRIPTION.title());
+ ListGridField descriptionField = new ListGridField(DESCRIPTION.propertyName(), DESCRIPTION.title());
- ListGridField typeNameField = new ListGridField(ResourceDataSourceField.TYPE.propertyName(),
- ResourceDataSourceField.TYPE.title(), 130);
+ ListGridField typeNameField = new ListGridField(TYPE.propertyName(), TYPE.title(), 130);
- ListGridField pluginNameField = new ListGridField(ResourceDataSourceField.PLUGIN.propertyName(),
- ResourceDataSourceField.PLUGIN.title(), 100);
+ ListGridField pluginNameField = new ListGridField(PLUGIN.propertyName(), PLUGIN.title(), 100);
- ListGridField categoryField = new ListGridField(ResourceDataSourceField.CATEGORY.propertyName(),
- ResourceDataSourceField.CATEGORY.title(), 60);
+ ListGridField categoryField = new ListGridField(CATEGORY.propertyName(), CATEGORY.title(), 60);
- ListGridField availabilityField = new ListGridField(ResourceDataSourceField.AVAILABILITY.propertyName(),
- ResourceDataSourceField.AVAILABILITY.title(), 55);
+ ListGridField availabilityField = new ListGridField(AVAILABILITY.propertyName(), AVAILABILITY.title(), 55);
availabilityField.setType(ListGridFieldType.IMAGE);
availabilityField.setAlign(Alignment.CENTER);
13 years, 7 months
[rhq] modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java | 36 ++++++----
1 file changed, 24 insertions(+), 12 deletions(-)
New commits:
commit 0a979fb7c481d111dab06cdf06833bc5366fb9d4
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Oct 22 11:30:15 2010 -0400
this doesn't fix anything but it refactors it to look like what AdministrationView code will look like.
because the authz check is async, the treeGrids collection isn't populated at the time we need it. this should be fixed in the future
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java
index d913229..5ade636 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java
@@ -286,18 +286,8 @@ public class InventoryView extends LocatableHLayout implements BookmarkableView
}
}
- for (String name : treeGrids.keySet()) {
- TreeGrid treeGrid = treeGrids.get(name);
- if (name.equals(sectionName)) {
- for (TreeNode node : treeGrid.getTree().getAllNodes()) {
- if (pageName.equals(node.getName())) {
- treeGrid.selectSingleRecord(node);
- }
- }
- } else {
- treeGrid.deselectAllRecords();
- }
- }
+ // when changing sections make sure the previous section's selection is deselected
+ selectSectionPageTreeGridNode(sectionName, pageName);
// ignore clicks on subsection folder nodes
if (null != content) {
@@ -309,6 +299,28 @@ public class InventoryView extends LocatableHLayout implements BookmarkableView
}
}
+ private void selectSectionPageTreeGridNode(String sectionName, String pageName) {
+ // TODO this method works, however, its getting invoked prior to treeGrids getting populated due to async authz check. need to fix that
+ for (String name : treeGrids.keySet()) {
+ TreeGrid treeGrid = treeGrids.get(name);
+ if (!name.equals(sectionName)) {
+ treeGrid.deselectAllRecords();
+ } else {
+ boolean gotIt = false;
+ for (TreeNode node : treeGrid.getTree().getAllNodes()) {
+ if (node.getName().equals(pageName)) {
+ treeGrid.selectSingleRecord(node);
+ gotIt = true;
+ break;
+ }
+ }
+ if (!gotIt) {
+ CoreGUI.getErrorHandler().handleError("Unknown page name - URL is incorrect");
+ }
+ }
+ }
+ }
+
public void renderView(ViewPath viewPath) {
if (!viewPath.isCurrent(currentSectionViewId) || !viewPath.isNext(currentPageViewId)) {
if (viewPath.isEnd()) {
13 years, 7 months
[rhq] modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java | 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java | 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java | 225 ++++++++--
3 files changed, 191 insertions(+), 40 deletions(-)
New commits:
commit bd67b5b987759c5a1057f1b8371ed37923c724e8
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Oct 21 18:52:17 2010 -0400
preliminary work on getting the alert template window to show up.
this exposes some minor problems with AdministrationView that need to be fixed - mainly dealing with attempting to go back to the main Configuration/Templates URL if we are already showing it (e.g. clicking "Templates" while it is already selected does nothing)
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 3888cdc..143045c 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
@@ -258,6 +258,11 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
}
public static void goToView(String viewPath) {
+ // if path starts with "#" (e.g. if caller used LinkManager to obtain some of the path), strip it off
+ if (viewPath.charAt(0) == '#') {
+ viewPath = viewPath.substring(1);
+ }
+
String currentViewPath = History.getToken();
if (currentViewPath.equals(viewPath)) {
// We're already there - just refresh the view.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
index 614ac1e..2d854b3 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
@@ -248,6 +248,7 @@ public class AdministrationView extends LocatableHLayout implements Bookmarkable
url = "/admin/config/Config.do?mode=edit";
} else if (PAGE_TEMPLATES_VIEW_ID.equals(pageName)) {
content = new ResourceTypeTreeView(this.extendLocatorId("Templates"));
+ currentPageViewId = null; // we always want to refresh, even if we renavigate back
} else if (PAGE_DOWNLOADS_VIEW_ID.equals(pageName)) {
url = "/rhq/admin/downloads-body.xhtml";
} else if (PAGE_LICENSE_VIEW_ID.equals(pageName)) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java
index ff50be7..340b8fc 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java
@@ -18,6 +18,7 @@
*/
package org.rhq.enterprise.gui.coregui.client.admin.templates;
+import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Record;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.SelectionStyle;
@@ -31,13 +32,25 @@ 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.HLayout;
+import com.smartgwt.client.widgets.layout.Layout;
import com.smartgwt.client.widgets.layout.SectionStack;
import com.smartgwt.client.widgets.layout.SectionStackSection;
import com.smartgwt.client.widgets.tree.TreeGrid;
import com.smartgwt.client.widgets.tree.TreeGridField;
import com.smartgwt.client.widgets.tree.TreeNode;
+import org.rhq.core.domain.criteria.ResourceTypeCriteria;
import org.rhq.core.domain.resource.ResourceCategory;
+import org.rhq.core.domain.resource.ResourceType;
+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.LinkManager;
+import org.rhq.enterprise.gui.coregui.client.ViewId;
+import org.rhq.enterprise.gui.coregui.client.ViewPath;
+import org.rhq.enterprise.gui.coregui.client.alert.definitions.TemplateAlertDefinitionsView;
+import org.rhq.enterprise.gui.coregui.client.components.buttons.BackButton;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableListGrid;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableTreeGrid;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
@@ -46,61 +59,185 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
* @author Greg Hinkle
* @author John Mazzitelli
*/
-public class ResourceTypeTreeView extends LocatableVLayout {
+public class ResourceTypeTreeView extends LocatableVLayout implements BookmarkableView {
+
+ private Layout gridCanvas;
+ private Layout alertTemplateCanvas;
+ private Layout metricTemplateCanvas;
public ResourceTypeTreeView(String locatorId) {
super(locatorId);
setWidth100();
setHeight100();
+ }
+
+ @Override
+ public void renderView(ViewPath viewPath) {
+ if (viewPath.isEnd()) {
+ switchToCanvas(this, getGridCanvas());
+ } else {
+ // we must be asked to go to a specific resource type
+ // the path must be one of "Alert/#####" or "Metric/#####"
+ // where ##### is a resource type ID
+ ViewId typeOfTemplatePath = viewPath.getCurrent();
+ final boolean isAlertTemplate; // true=alert template; false=metric template
+ if ("Alert".equals(typeOfTemplatePath.getPath())) {
+ isAlertTemplate = true;
+ } else if ("Metric".equals(typeOfTemplatePath.getPath())) {
+ isAlertTemplate = false;
+ } else {
+ CoreGUI.getErrorHandler().handleError(
+ "Invalid URL. Unknown template type: " + typeOfTemplatePath.getPath());
+ return;
+ }
+
+ viewPath.next();
+ final int resourceTypeId;
+ try {
+ resourceTypeId = viewPath.getCurrentAsInt();
+ } catch (Exception e) {
+ CoreGUI.getErrorHandler().handleError("Invalid URL. Bad resource type ID: " + viewPath.getCurrent());
+ return;
+ }
+
+ if (isAlertTemplate) {
+ editAlertTemplate(resourceTypeId, viewPath);
+ } else {
+ editMetricTemplate(resourceTypeId);
+ }
+ }
+ }
- SectionStack sectionStack = new SectionStack();
- sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE);
+ private Canvas getGridCanvas() {
+ if (this.gridCanvas == null) {
+ LocatableVLayout layout = new LocatableVLayout(extendLocatorId("gridLayout"));
- ListGrid platformsList = new CustomResourceTypeListGrid(extendLocatorId("platformsList"));
- SectionStackSection platforms = new SectionStackSection("Platforms");
- platforms.setExpanded(true);
- platforms.addItem(platformsList);
+ SectionStack sectionStack = new SectionStack();
+ sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE);
- ListGrid platformServicesList = new CustomResourceTypeListGrid(extendLocatorId("platformServicesList"));
- SectionStackSection platformServices = new SectionStackSection("Platform Services");
- platformServices.setExpanded(true);
- platformServices.addItem(platformServicesList);
+ ListGrid platformsList = new CustomResourceTypeListGrid(extendLocatorId("platformsList"));
+ SectionStackSection platforms = new SectionStackSection("Platforms");
+ platforms.setExpanded(true);
+ platforms.addItem(platformsList);
- TreeGrid serversTreeGrid = new CustomResourceTypeTreeGrid(extendLocatorId("serversTree"));
- SectionStackSection servers = new SectionStackSection("Servers");
- servers.setExpanded(true);
- servers.addItem(serversTreeGrid);
+ ListGrid platformServicesList = new CustomResourceTypeListGrid(extendLocatorId("platformServicesList"));
+ SectionStackSection platformServices = new SectionStackSection("Platform Services");
+ platformServices.setExpanded(true);
+ platformServices.addItem(platformServicesList);
- sectionStack.addSection(platforms);
- sectionStack.addSection(platformServices);
- sectionStack.addSection(servers);
+ TreeGrid serversTreeGrid = new CustomResourceTypeTreeGrid(extendLocatorId("serversTree"));
+ SectionStackSection servers = new SectionStackSection("Servers");
+ servers.setExpanded(true);
+ servers.addItem(serversTreeGrid);
- addMember(sectionStack);
+ sectionStack.addSection(platforms);
+ sectionStack.addSection(platformServices);
+ sectionStack.addSection(servers);
- new ResourceTypeTreeNodeBuilder(platformsList, platformServicesList, serversTreeGrid);
+ layout.addMember(sectionStack);
+ this.gridCanvas = layout;
+
+ // this will asynchronously populate the grids with the appropriate data
+ new ResourceTypeTreeNodeBuilder(platformsList, platformServicesList, serversTreeGrid);
+ }
+
+ return this.gridCanvas;
+ }
+
+ private Layout getAlertTemplateCanvas() {
+ if (this.alertTemplateCanvas == null) {
+ LocatableVLayout layout = new LocatableVLayout(extendLocatorId("alertTemplateLayout"));
+ layout.setHeight100();
+ layout.setWidth100();
+ this.alertTemplateCanvas = layout;
+ }
+
+ return this.alertTemplateCanvas;
}
- private static void editAlertTemplate(Record record) {
- SC.say("Alert Template : " //
- + record.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_NAME)
- + "==>"
- + record.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_PLUGIN)
- + "==>"
- + record.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_ID));
+ private Layout getMetricTemplateCanvas() {
+ if (this.metricTemplateCanvas == null) {
+ LocatableVLayout layout = new LocatableVLayout(extendLocatorId("metricTemplateLayout"));
+ layout.setHeight100();
+ layout.setWidth100();
+ this.metricTemplateCanvas = layout;
+ }
+
+ return this.metricTemplateCanvas;
}
- private static void editMetricTemplate(Record record) {
+ /**
+ * This will remove all members from the given parent canvas and then add
+ * the canvasToShow as the only member to the parent.
+ *
+ * @param parentCanvas parent to show the given canvas
+ * @param canvasToShow the canvas to show in the parent
+ */
+ private void switchToCanvas(Layout parentCanvas, Canvas canvasToShow) {
+ Canvas[] members = getMembers();
+ if (members != null) {
+ for (Canvas c : members) {
+ parentCanvas.removeMember(c);
+ }
+ }
+ parentCanvas.addMember(canvasToShow);
+ parentCanvas.markForRedraw();
+ }
+
+ private void prepareSubCanvas(Layout parentCanvas, Canvas canvasToShow, boolean showBackButton) {
+ Canvas[] members = getMembers();
+ if (members != null) {
+ for (Canvas c : members) {
+ parentCanvas.removeMember(c);
+ c.destroy();
+ }
+ }
+
+ if (showBackButton) {
+ String backLink = LinkManager.getAdminTemplatesLink().substring(1); // strip the #
+ BackButton backButton = new BackButton(extendLocatorId("BackButton"), "Back to List", backLink);
+ parentCanvas.addMember(backButton);
+ }
+ parentCanvas.addMember(canvasToShow);
+ parentCanvas.markForRedraw();
+ }
+
+ private void editAlertTemplate(final int resourceTypeId, final ViewPath viewPath) {
+ ResourceTypeCriteria criteria = new ResourceTypeCriteria();
+ criteria.addFilterId(resourceTypeId);
+ // TODO we need to fetch some collections here
+
+ GWTServiceLookup.getResourceTypeGWTService().findResourceTypesByCriteria(criteria,
+ new AsyncCallback<PageList<ResourceType>>() {
+ @Override
+ public void onSuccess(PageList<ResourceType> result) {
+ if (result != null && result.size() == 1) {
+ ResourceType rt = result.get(0);
+ Layout alertCanvas = getAlertTemplateCanvas();
+ String locatorId = extendLocatorId("alertTemplateDef");
+ TemplateAlertDefinitionsView def = new TemplateAlertDefinitionsView(locatorId, rt);
+ def.renderView(viewPath.next());
+ prepareSubCanvas(alertCanvas, def, viewPath.isEnd()); // don't show our back button if we are going to a template details pane which has its own back button
+ switchToCanvas(ResourceTypeTreeView.this, alertCanvas);
+ } else {
+ CoreGUI.getErrorHandler().handleError("Failed to get resource type: " + resourceTypeId);
+ }
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Error getting resource type: " + resourceTypeId, caught);
+ }
+ });
+ }
+
+ private void editMetricTemplate(int resourceTypeId) {
// http://localhost:7080/admin/platform/monitor/Config.do?nomenu=true&mode=c...
- SC.say("Metric Template: " //
- + record.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_NAME)
- + "==>"
- + record.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_PLUGIN)
- + "==>"
- + record.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_ID));
+ SC.say("Metric Template : " + resourceTypeId);
}
- public static class CustomResourceTypeListGrid extends LocatableListGrid {
+ public class CustomResourceTypeListGrid extends LocatableListGrid {
private HLayout rollOverCanvas;
private ListGridRecord rollOverRecord;
@@ -168,7 +305,7 @@ public class ResourceTypeTreeView extends LocatableVLayout {
metricTemplateImg.setWidth(16);
metricTemplateImg.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
- editMetricTemplate(rollOverRecord);
+ CoreGUI.goToView(LinkManager.getAdminTemplatesLink() + "/Metric/" + getRollOverId());
}
});
@@ -183,7 +320,7 @@ public class ResourceTypeTreeView extends LocatableVLayout {
alertTemplateImg.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
- editAlertTemplate(rollOverRecord);
+ CoreGUI.goToView(LinkManager.getAdminTemplatesLink() + "/Alert/" + getRollOverId());
}
});
@@ -192,9 +329,13 @@ public class ResourceTypeTreeView extends LocatableVLayout {
}
return rollOverCanvas;
}
+
+ private int getRollOverId() {
+ return Integer.parseInt(rollOverRecord.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_ID));
+ }
}
- public static class CustomResourceTypeTreeGrid extends LocatableTreeGrid {
+ public class CustomResourceTypeTreeGrid extends LocatableTreeGrid {
private HLayout rollOverCanvas;
private ListGridRecord rollOverRecord;
@@ -260,7 +401,7 @@ public class ResourceTypeTreeView extends LocatableVLayout {
metricTemplateImg.setWidth(16);
metricTemplateImg.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
- editMetricTemplate(rollOverRecord);
+ CoreGUI.goToView(LinkManager.getAdminTemplatesLink() + "/Metric/" + getRollOverId());
}
});
@@ -275,7 +416,7 @@ public class ResourceTypeTreeView extends LocatableVLayout {
alertTemplateImg.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
- editAlertTemplate(rollOverRecord);
+ CoreGUI.goToView(LinkManager.getAdminTemplatesLink() + "/Alert/" + getRollOverId());
}
});
@@ -285,6 +426,10 @@ public class ResourceTypeTreeView extends LocatableVLayout {
return rollOverCanvas;
}
+ private int getRollOverId() {
+ return Integer.parseInt(rollOverRecord.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_ID));
+ }
+
@Override
protected String getIcon(Record record, boolean defaultState) {
13 years, 7 months
[rhq] Branch 'delete-agent-plugin' - modules/core
by John Sanda
modules/core/domain/pom.xml | 3 +++
1 file changed, 3 insertions(+)
New commits:
commit 82a6dcfcb586b5d461dd74647a04e1a2534566bc
Author: John Sanda <jsanda(a)redhat.com>
Date: Thu Oct 21 16:39:23 2010 -0400
Temporarily disabling tests to try and get hudson job back working
diff --git a/modules/core/domain/pom.xml b/modules/core/domain/pom.xml
index e00488c..c7cca99 100644
--- a/modules/core/domain/pom.xml
+++ b/modules/core/domain/pom.xml
@@ -278,6 +278,9 @@
<value>${rhq.test.ds.hibernate-dialect}</value>
</property>
</systemProperties>
+ <excludes>
+ <exclude>**/ResourceTypeTest.java</exclude>
+ </excludes>
<!-- The below is required for tests to run against Oracle. -->
<additionalClasspathElements>
<additionalClasspathElement>${settings.localRepository}/com/oracle/ojdbc5/${ojdbc5.version}/ojdbc5-${ojdbc5.version}.jar</additionalClasspathElement>
13 years, 7 months
[rhq] modules/enterprise
by Jay Shaughnessy
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeView.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit ad3a5abde7fa98bd78caebda87a88d4366bba2ca
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Oct 21 16:33:01 2010 -0400
Fix Selecting from Bundle Tree
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 c795669..236f728 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
@@ -56,7 +56,7 @@ public class BundleTreeView extends LocatableTreeGrid {
addNodeClickHandler(new NodeClickHandler() {
public void onNodeClick(NodeClickEvent event) {
- String path = event.getNode().getAttribute("id").replaceAll(":", "/");
+ String path = event.getNode().getAttribute("id").replaceAll("_", "/");
History.newItem("Bundles/Bundle/" + path);
}
});
13 years, 7 months
[rhq] modules/enterprise
by Jay Shaughnessy
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java | 49 ++++++----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java | 11 +-
2 files changed, 38 insertions(+), 22 deletions(-)
New commits:
commit e81f607e26a3d8d260b2bc465e7fa771b0bd34ca
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Oct 21 16:15:15 2010 -0400
Group Fixes
- Avoid NPE and save time by not constructing Group Alert Def subtab for
Mixed Group.
- Fix issue now preventing the user from navigating away from
Group->Inventory->Membership
- Fix Inventory compat and mixed group tree options to actually return the
desired group category
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 0295877..bcef904 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
@@ -45,6 +45,7 @@ import org.rhq.enterprise.gui.coregui.client.alert.definitions.GroupAlertDefinit
import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
import org.rhq.enterprise.gui.coregui.client.components.tab.SubTab;
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.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.AbstractTwoLevelTabSetView;
import org.rhq.enterprise.gui.coregui.client.inventory.common.event.EventCompositeHistoryView;
@@ -107,16 +108,28 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
@Override
public Integer getSelectedItemId() {
+ return this.groupId;
+ }
+
+ @Override
+ public void onTabSelected(TwoLevelTabSelectedEvent tabSelectedEvent) {
// if moving from membership subtab then re-load the detail view as the membership and
// group type may have changed.
- if (this.inventoryTab.getTitle().equals(currentTab)
+ if ((null != this.groupId) && this.inventoryTab.getTitle().equals(currentTab)
&& this.inventoryMembership.getTitle().equals(currentSubTab)) {
+
+ String tabPath = "/" + tabSelectedEvent.getId() + "/" + tabSelectedEvent.getSubTabId();
+ String path = this.getBaseViewPath() + "/" + getSelectedItemId() + tabPath;
+
this.currentTab = null;
this.currentSubTab = null;
this.groupId = null;
- }
- return this.groupId;
+ CoreGUI.goToView(path);
+
+ } else {
+ super.onTabSelected(tabSelectedEvent);
+ }
}
@Override
@@ -202,8 +215,8 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
// summaryTab.updateSubTab("Overview", new DashboardView(resource));
// summaryTab.updateSubTab("Timeline", timelinePane);
// Summary tab is always visible and enabled.
- updateSubTab(this.summaryTab, this.summaryOverview,
- new OverviewView(this.summaryTab.extendLocatorId("OverviewView"), this.groupComposite), true, true);
+ updateSubTab(this.summaryTab, this.summaryOverview, new OverviewView(this.summaryTab
+ .extendLocatorId("OverviewView"), this.groupComposite), true, true);
if (updateTab(this.monitoringTab, groupCategory == GroupCategory.COMPATIBLE, true)) {
visible = hasMetricsOfType(this.groupComposite, DataType.MEASUREMENT);
@@ -225,8 +238,8 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
}
// Inventory tab is always visible and enabled.
- updateSubTab(this.inventoryTab, this.inventoryMembers,
- ResourceSearchView.getMembersOf(this.inventoryTab.extendLocatorId("MembersView"), groupId), true, true);
+ updateSubTab(this.inventoryTab, this.inventoryMembers, ResourceSearchView.getMembersOf(this.inventoryTab
+ .extendLocatorId("MembersView"), groupId), true, true);
// TODO: Uncomment this once the group config component is done.
//updateSubTab(this.inventoryTab, this.inventoryConn,
// new GroupPluginConfigurationEditView(this.group.getId(), this.group.getResourceType().getId(), ConfigurationEditor.ConfigType.plugin),
@@ -236,8 +249,8 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
groupId) : null;
updateSubTab(this.inventoryTab, this.inventoryMembership, canvas, true, enabled);
- if (updateTab(this.operationsTab,
- groupCategory == GroupCategory.COMPATIBLE && facets.contains(ResourceTypeFacet.OPERATION), true)) {
+ if (updateTab(this.operationsTab, groupCategory == GroupCategory.COMPATIBLE
+ && facets.contains(ResourceTypeFacet.OPERATION), true)) {
updateSubTab(this.operationsTab, this.opHistory, new FullHTMLPane(
"/rhq/group/operation/groupOperationHistory-plain.xhtml?groupId=" + groupId), true, true);
updateSubTab(this.operationsTab, this.opSched, new FullHTMLPane(
@@ -249,9 +262,10 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
// alert history is always available
updateSubTab(this.alertsTab, this.alertHistory, GroupAlertHistoryView.get(groupComposite), true, true);
// but alert definitions can only be created on compatible groups
- updateSubTab(this.alertsTab, this.alertDef,
- new GroupAlertDefinitionsView(alertsTab.extendLocatorId("AlertDefView"), this.groupComposite),
- groupCategory == GroupCategory.COMPATIBLE, true);
+ visible = (groupCategory == GroupCategory.COMPATIBLE);
+ canvas = (visible) ? new GroupAlertDefinitionsView(alertsTab.extendLocatorId("AlertDefView"),
+ this.groupComposite) : null;
+ updateSubTab(this.alertsTab, this.alertDef, canvas, visible, true);
}
visible = groupCategory == GroupCategory.COMPATIBLE && facets.contains(ResourceTypeFacet.CONFIGURATION);
@@ -263,13 +277,12 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
updateSubTab(this.configurationTab, this.configHistory, new FullHTMLPane(
"/rhq/group/configuration/history-plain.xhtml?groupId=" + groupId), true, true);
}
-
- visible = groupCategory == GroupCategory.MIXED || // allow mixed groups to show events from supporting resources
- (groupCategory == GroupCategory.COMPATIBLE && facets.contains(ResourceTypeFacet.EVENT));
+ // allow mixed groups to show events from supporting resources
+ 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.eventsTab.extendLocatorId("CompositeHistView"), groupComposite),
- true, true);
+ updateSubTab(this.eventsTab, this.eventHistory, EventCompositeHistoryView.get(this.eventsTab
+ .extendLocatorId("CompositeHistView"), groupComposite), true, true);
}
this.show();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java
index dee71d2..d913229 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java
@@ -46,6 +46,7 @@ import org.rhq.enterprise.gui.coregui.client.ViewId;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.components.tree.EnhancedTreeNode;
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;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.discovery.ResourceAutodiscoveryView;
@@ -265,11 +266,13 @@ public class InventoryView extends LocatableHLayout implements BookmarkableView
}
} else if (GROUPS_SECTION_VIEW_ID.equals(sectionName)) {
if (PAGE_COMPATIBLE_GROUPS.equals(pageName)) {
- content = new ResourceGroupListView(extendLocatorId("Compatible"), new Criteria("category",
- GroupCategory.COMPATIBLE.name()), "Compatible Groups", "types/Cluster_up_24.png");
+ content = new ResourceGroupListView(extendLocatorId("Compatible"), new Criteria(
+ ResourceGroupDataSourceField.CATEGORY.propertyName(), GroupCategory.COMPATIBLE.name()),
+ "Compatible Groups", "types/Cluster_up_24.png");
} else if (PAGE_MIXED_GROUPS.equals(pageName)) {
- content = new ResourceGroupListView(extendLocatorId("Mixed"), new Criteria("category",
- GroupCategory.MIXED.name()), "Mixed Groups", "types/Group_up_24.png");
+ content = new ResourceGroupListView(extendLocatorId("Mixed"), new Criteria(
+ ResourceGroupDataSourceField.CATEGORY.propertyName(), GroupCategory.MIXED.name()), "Mixed Groups",
+ "types/Group_up_24.png");
} else if (PAGE_GROUP_DEFINITIONS.equals(pageName)) {
content = new GroupDefinitionListView(extendLocatorId("Definitions"), "types/GroupDefinition_16.png");
} else if (PAGE_PROBLEM_GROUPS.equals(pageName)) {
13 years, 7 months