Thread View
j: Next unread message
k: Previous unread message
j a: Jump to all threads
j l: Jump to MailingList overview
.classpath | 21
dev/null |binary
etc/eclipse-tools/RHQ | 19
etc/eclipse-tools/maven/RHQ | 33
etc/m2/settings.xml | 2
modules/common/ant-bundle/pom.xml | 50
modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/AbstractBundleTask.java | 27
modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/AntLauncher.java | 204 ++
modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/BundleAntProject.java | 50
modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/BundleTask.java | 29
modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/LoggerAntBuildListener.java | 115 +
modules/common/ant-bundle/src/main/resources/bundle-ant-tasks.properties | 1
modules/common/ant-bundle/src/test/java/org/rhq/bundle/ant/AntLauncherTest.java | 87
modules/common/ant-bundle/src/test/resources/simple-build.xml | 12
modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/ConfigDefRecipeCommand.java | 81
modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/RecipeContext.java | 3
modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/RecipeParser.java | 5
modules/common/filetemplate-bundle/src/test/java/org/rhq/bundle/filetemplate/recipe/RecipeParserTest.java | 64
modules/common/jboss-as/src/main/java/org/jboss/on/common/jbossas/AbstractJBossASContentFacetDelegate.java | 3
modules/common/pom.xml | 1
modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/content/ContentAgentService.java | 10
modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/discovery/DiscoveryAgentService.java | 2
modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/PluginMetadataParser.java | 14
modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/bundle/BundleServerService.java | 14
modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/content/ContentDiscoveryReport.java | 83
modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/content/ContentServerService.java | 2
modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/content/ContentServiceResponse.java | 6
modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/content/DeletePackagesRequest.java | 69
modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/content/DeployPackagesRequest.java | 78
modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/content/RetrievePackageBitsRequest.java | 70
modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/discovery/AutoDiscoveryRequest.java | 86
modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/discovery/DiscoveryServerService.java | 2
modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/discovery/InvalidInventoryReportException.java | 2
modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/discovery/InventoryReport.java | 143 +
modules/core/dbutils/pom.xml | 74
modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml | 17
modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml | 99
modules/core/domain/pom.xml | 79
modules/core/domain/src/main/java/META-INF/MANIFEST.MF | 14
modules/core/domain/src/main/java/org/rhq/core/RHQDomain.gwt.xml | 18
modules/core/domain/src/main/java/org/rhq/core/client/RHQDomain.java | 31
modules/core/domain/src/main/java/org/rhq/core/domain/alert/Alert.java | 12
modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertConditionLog.java | 3
modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertDampeningEvent.java | 4
modules/core/domain/src/main/java/org/rhq/core/domain/auth/Principal.java | 4
modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java | 28
modules/core/domain/src/main/java/org/rhq/core/domain/authz/Role.java | 4
modules/core/domain/src/main/java/org/rhq/core/domain/bundle/Bundle.java | 31
modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeployDefinition.java | 16
modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeployment.java | 39
modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeploymentStatus.java | 48
modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleGroupDeployment.java | 291 ++
modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleVersion.java | 36
modules/core/domain/src/main/java/org/rhq/core/domain/bundle/composite/BundleWithLatestVersionComposite.java | 101 +
modules/core/domain/src/main/java/org/rhq/core/domain/cloud/composite/FailoverListComposite.java | 77
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/AbstractConfigurationUpdate.java | 19
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/Configuration.java | 58
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/Property.java | 130 -
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertyList.java | 29
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertyMap.java | 29
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/PropertySimple.java | 17
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java | 51
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ResourceConfigurationUpdate.java | 4
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/ConfigurationDefinition.java | 2
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinition.java | 2
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/constraint/Constraint.java | 2
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/group/GroupPluginConfigurationUpdate.java | 2
modules/core/domain/src/main/java/org/rhq/core/domain/content/Advisory.java | 2
modules/core/domain/src/main/java/org/rhq/core/domain/content/CVE.java | 2
modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentServiceRequest.java | 16
modules/core/domain/src/main/java/org/rhq/core/domain/content/Distribution.java | 10
modules/core/domain/src/main/java/org/rhq/core/domain/content/DistributionType.java | 2
modules/core/domain/src/main/java/org/rhq/core/domain/content/InstalledPackageHistory.java | 17
modules/core/domain/src/main/java/org/rhq/core/domain/content/PackageCategory.java | 51
modules/core/domain/src/main/java/org/rhq/core/domain/content/PackageType.java | 2
modules/core/domain/src/main/java/org/rhq/core/domain/content/RepoSyncResults.java | 2
modules/core/domain/src/main/java/org/rhq/core/domain/content/transfer/ContentDiscoveryReport.java | 82
modules/core/domain/src/main/java/org/rhq/core/domain/content/transfer/ContentResponseResult.java | 2
modules/core/domain/src/main/java/org/rhq/core/domain/content/transfer/DeletePackagesRequest.java | 67
modules/core/domain/src/main/java/org/rhq/core/domain/content/transfer/DeployIndividualPackageResponse.java | 25
modules/core/domain/src/main/java/org/rhq/core/domain/content/transfer/DeployPackagesRequest.java | 76
modules/core/domain/src/main/java/org/rhq/core/domain/content/transfer/DeployPackagesResponse.java | 22
modules/core/domain/src/main/java/org/rhq/core/domain/content/transfer/RemoveIndividualPackageResponse.java | 24
modules/core/domain/src/main/java/org/rhq/core/domain/content/transfer/RemovePackagesResponse.java | 23
modules/core/domain/src/main/java/org/rhq/core/domain/content/transfer/RetrievePackageBitsRequest.java | 68
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AlertCriteria.java | 45
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AlertDefinitionCriteria.java | 7
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleCriteria.java | 39
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeployDefinitionCriteria.java | 13
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java | 27
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleFileCriteria.java | 6
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleVersionCriteria.java | 15
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java | 133 -
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/EventCriteria.java | 5
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/GroupOperationHistoryCriteria.java | 7
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/InstalledPackageCriteria.java | 7
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementDefinitionCriteria.java | 7
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementScheduleCriteria.java | 5
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/OperationDefinitionCriteria.java | 7
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/OperationHistoryCriteria.java | 23
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/PackageVersionCriteria.java | 10
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/RepoCriteria.java | 11
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java | 27
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupCriteria.java | 20
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupDefinitionCriteria.java | 108 +
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceOperationHistoryCriteria.java | 7
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceTypeCriteria.java | 15
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/RoleCriteria.java | 16
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/SavedSearchCriteria.java | 5
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/SubjectCriteria.java | 6
modules/core/domain/src/main/java/org/rhq/core/domain/dialect/H2CustomDialect.java | 45
modules/core/domain/src/main/java/org/rhq/core/domain/discovery/AvailabilityReport.java | 11
modules/core/domain/src/main/java/org/rhq/core/domain/discovery/InventoryReport.java | 143 -
modules/core/domain/src/main/java/org/rhq/core/domain/discovery/ResourceSyncInfo.java | 13
modules/core/domain/src/main/java/org/rhq/core/domain/event/Event.java | 2
modules/core/domain/src/main/java/org/rhq/core/domain/event/EventDefinition.java | 26
modules/core/domain/src/main/java/org/rhq/core/domain/event/EventSource.java | 13
modules/core/domain/src/main/java/org/rhq/core/domain/event/transfer/EventReport.java | 8
modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementConverterClient.java | 360 +++
modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDataNumeric.java | 3
modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDataNumeric1D.java | 3
modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDataNumeric1H.java | 3
modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDataNumeric6H.java | 16
modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDataPK.java | 9
modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementReport.java | 42
modules/core/domain/src/main/java/org/rhq/core/domain/measurement/calltime/CallTimeData.java | 6
modules/core/domain/src/main/java/org/rhq/core/domain/measurement/calltime/CallTimeDataComposite.java | 2
modules/core/domain/src/main/java/org/rhq/core/domain/measurement/calltime/CallTimeDataValue.java | 22
modules/core/domain/src/main/java/org/rhq/core/domain/measurement/composite/MeasurementNumericValueAndUnits.java | 5
modules/core/domain/src/main/java/org/rhq/core/domain/measurement/composite/MeasurementOOBComposite.java | 12
modules/core/domain/src/main/java/org/rhq/core/domain/measurement/composite/MeasurementStringValueAndUnits.java | 7
modules/core/domain/src/main/java/org/rhq/core/domain/measurement/util/MeasurementConverter.java | 426 ----
modules/core/domain/src/main/java/org/rhq/core/domain/operation/OperationHistory.java | 20
modules/core/domain/src/main/java/org/rhq/core/domain/operation/ResourceOperationHistory.java | 5
modules/core/domain/src/main/java/org/rhq/core/domain/plugin/AbstractPlugin.java | 7
modules/core/domain/src/main/java/org/rhq/core/domain/plugin/Plugin.java | 5
modules/core/domain/src/main/java/org/rhq/core/domain/plugin/ServerPlugin.java | 5
modules/core/domain/src/main/java/org/rhq/core/domain/resource/Agent.java | 41
modules/core/domain/src/main/java/org/rhq/core/domain/resource/CreateResourceHistory.java | 8
modules/core/domain/src/main/java/org/rhq/core/domain/resource/DeleteResourceHistory.java | 17
modules/core/domain/src/main/java/org/rhq/core/domain/resource/InventorySummary.java | 114 +
modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java | 366 +--
modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceError.java | 3
modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java | 20
modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/RecentlyAddedResourceComposite.java | 11
modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java | 16
modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/AutoGroupComposite.java | 2
modules/core/domain/src/main/java/org/rhq/core/domain/state/discovery/AutoDiscoveryRequest.java | 84
modules/core/domain/src/main/java/org/rhq/core/domain/util/EntitySerializer.java | 281 --
modules/core/domain/src/main/java/org/rhq/core/domain/util/OrderingField.java | 2
modules/core/domain/src/main/java/org/rhq/core/domain/util/PageControl.java | 28
modules/core/domain/src/main/java/org/rhq/core/domain/util/PageList.java | 4
modules/core/domain/src/main/java/org/rhq/core/domain/util/PersistenceUtility.java | 589 -----
modules/core/domain/src/main/java/org/rhq/core/domain/util/Recordizable.java | 28
modules/core/domain/src/main/java/org/rhq/core/domain/util/ReportUtils.java | 50
modules/core/domain/src/main/java/org/rhq/core/domain/util/serial/ExternalizableStrategy.java | 65
modules/core/domain/src/main/java/org/rhq/core/public/RHQDomain.css | 7
modules/core/domain/src/main/java/org/rhq/core/public/RHQDomain.html | 10
modules/core/domain/src/main/java/org/rhq/core/rebind/RecordBuilderGenerator.java | 172 +
modules/core/domain/src/main/java/org/rhq/core/server/EntitySerializer.java | 281 ++
modules/core/domain/src/main/java/org/rhq/core/server/ExternalizableStrategy.java | 65
modules/core/domain/src/main/java/org/rhq/core/server/H2CustomDialect.java | 45
modules/core/domain/src/main/java/org/rhq/core/server/MeasurementConverter.java | 355 +++
modules/core/domain/src/main/java/org/rhq/core/server/MeasurementParser.java | 104 +
modules/core/domain/src/main/java/org/rhq/core/server/PersistenceUtility.java | 602 +++++
modules/core/domain/src/test/java/org/rhq/core/domain/bundle/test/BundleTest.java | 173 +
modules/core/domain/src/test/java/org/rhq/core/domain/configuration/ConfigurationTest.java | 149 -
modules/core/domain/src/test/java/org/rhq/core/domain/configuration/RawConfigurationIntegrationTest.java | 15
modules/core/domain/src/test/java/org/rhq/core/domain/configuration/RawConfigurationTest.java | 59
modules/core/domain/src/test/java/org/rhq/core/domain/configuration/test/ConfigurationTest.java | 28
modules/core/domain/src/test/java/org/rhq/core/domain/content/test/ContentSourceSyncResultsTest.java | 22
modules/core/domain/src/test/java/org/rhq/core/domain/content/test/ContentSourceTest.java | 51
modules/core/domain/src/test/java/org/rhq/core/domain/content/test/PackageVersionContentSourceTest.java | 4
modules/core/domain/src/test/java/org/rhq/core/domain/content/test/RepoGroupTest.java | 53
modules/core/domain/src/test/java/org/rhq/core/domain/measurement/test/CompositeLoadingTest.java | 48
modules/core/domain/src/test/java/org/rhq/core/domain/measurement/test/MeasurementTest.java | 3
modules/core/domain/src/test/java/org/rhq/core/domain/operation/OperationHistoryTest.java | 47
modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/ProblemResourceTest.java | 3
modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/ResourceErrorTest.java | 46
modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/ResourceGroupTest.java | 49
modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/TokenGenerationTest.java | 6
modules/core/domain/src/test/java/org/rhq/core/domain/test/QueryAllTest.java | 2
modules/core/domain/src/test/java/org/rhq/core/domain/test/SerializableTest.java | 3
modules/core/domain/src/test/java/org/rhq/core/domain/util/units/test/MeasurementConverterTest.java | 73
modules/core/native-system/src/main/java/org/rhq/core/system/SystemInfoFactory.java | 10
modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainerMBeanImpl.java | 2
modules/core/plugin-container/src/main/java/org/rhq/core/pc/StandaloneContainer.java | 2
modules/core/plugin-container/src/main/java/org/rhq/core/pc/bundle/BundleManager.java | 14
modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java | 13
modules/core/plugin-container/src/main/java/org/rhq/core/pc/content/ContentDiscoveryRunner.java | 5
modules/core/plugin-container/src/main/java/org/rhq/core/pc/content/ContentManager.java | 12
modules/core/plugin-container/src/main/java/org/rhq/core/pc/content/CreateContentRunner.java | 12
modules/core/plugin-container/src/main/java/org/rhq/core/pc/content/DeleteContentRunner.java | 9
modules/core/plugin-container/src/main/java/org/rhq/core/pc/content/RetrieveContentBitsRunner.java | 4
modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/AutoDiscoveryExecutor.java | 4
modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/CreateResourceRunner.java | 27
modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/DeleteResourceRunner.java | 26
modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java | 4
modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/RuntimeDiscoveryExecutor.java | 2
modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigManagementTest.java | 41
modules/core/util/src/main/java/org/rhq/core/template/TemplateEngine.java | 6
modules/core/util/src/main/java/org/rhq/core/util/MessageDigestGenerator.java | 108 -
modules/core/util/src/main/java/org/rhq/core/util/NumberUtil.java | 65
modules/core/util/src/main/java/org/rhq/core/util/exception/ThrowableUtil.java | 9
modules/core/util/src/test/java/org/rhq/core/util/NumberUtilTest.java | 44
modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/ExternalizableStrategyCommandPreprocessor.java | 2
modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/PluginUpdate.java | 2
modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/promptcmd/DiscoveryPromptCommand.java | 2
modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/promptcmd/FailoverPromptCommand.java | 2
modules/enterprise/gui/coregui/pom.xml | 426 ++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml | 61
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Breadcrumb.java | 115 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadcrumbTrailPane.java | 109 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java | 355 +++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/DemoCanvas.java | 115 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java | 73
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UnknownViewException.java | 33
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/View.java | 120 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewId.java | 97
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewRenderer.java | 34
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java | 371 +++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/PermissionEditorView.java | 131 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java | 175 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleGroupsEditorItem.java | 100
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java | 227 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java | 120 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/SubjectRolesEditorItem.java | 126 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java | 166 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java | 290 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java | 128 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java | 298 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertFormatUtility.java | 186 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java | 286 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/SubsystemResourceAlertDataSource.java | 46
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AlertDefinitionsDataSource.java | 194 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AlertDefinitionsView.java | 59
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/AbstractBundleWizard.java | 87
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java | 56
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/AbstractBundleCreateWizard.java | 120 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreateWizard.java | 38
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java | 208 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleSummaryStep.java | 94
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUpdateWizard.java | 40
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java | 175 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java | 170 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/AbstractBundleDeployWizard.java | 163 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployDefinitionInfoStep.java | 85
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployWizard.java | 88
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/CreateConfigStep.java | 57
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployOptionsStep.java | 96
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java | 147 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployTargetStep.java | 68
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleVersionStep.java | 154 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectTemplateStep.java | 89
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleVersionDataSource.java | 125 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java | 176 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesDataSource.java | 99
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java | 167 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesWithLatestVersionDataSource.java | 112 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java | 96
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/EnhancedListGrid.java | 63
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/FullHTMLPane.java | 35
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/HeaderLabel.java | 35
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/SimpleCollapsiblePanel.java | 81
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/SubTabLayout.java | 101 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationComparisonView.java | 248 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java | 1004 ++++++++++
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/components/measurement/MeasurementRangeEditor.java | 123 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java | 194 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java | 59
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSelectedEvent.java | 101 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSelectedHandler.java | 28
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java | 84
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/PropertyGrid.java | 133 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java | 370 +++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableAction.java | 30
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleFileUploadForm.java | 206 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackForm.java | 147 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackFormHandlerCollection.java | 34
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackFormImpl.java | 101 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackFormImplHost.java | 23
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackFormImplIE6.java | 49
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicFormHandler.java | 33
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicFormSubmitCompleteEvent.java | 54
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/TextFileRetrieverForm.java | 116 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/Wizard.java | 44
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardStep.java | 33
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java | 251 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java | 224 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalColumn.java | 54
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalLayout.java | 52
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/Portlet.java | 97
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletSettingsWindow.java | 87
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/RecentlyAddedResource.java | 78
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/RecentlyAddedResourceDS.java | 226 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/RecentlyAddedView.java | 56
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java | 101 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/AlertGWTService.java | 65
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/AuthorizationGWTService.java | 79
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java | 70
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java | 31
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java | 139 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/MeasurementDataGWTService.java | 52
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/OperationGWTService.java | 45
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceBossGWTService.java | 39
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java | 63
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGroupGWTService.java | 42
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceTypeGWTService.java | 20
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/RoleGWTService.java | 40
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/SubjectGWTService.java | 103 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java | 95
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java | 134 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionDataSource.java | 113 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java | 93
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java | 182 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java | 161 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java | 146 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSelectListener.java | 29
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/CustomResourceTreeGrid.java | 58
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java | 315 +++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java | 125 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java | 331 +++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java | 445 ++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java | 163 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/alert/ResourceAlertHistoryView.java | 51
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java | 114 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDetailView.java | 64
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java | 159 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java | 102 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/GraphListView.java | 148 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/LiveGraphView.java | 309 +++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java | 304 +++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeDataSource.java | 130 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeView.java | 144 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryDataSource.java | 111 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java | 107 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationWizard.java | 69
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/ExecutionSchedule.java | 292 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationCreateWizard.java | 148 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationParametersStep.java | 70
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java | 406 ++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/detail/OperationDetailsView.java | 116 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/overview/ResourceOverviewView.java | 57
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/overview/ResourceSummaryView.java | 186 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/AutodiscoveryQueueDataSource.java | 221 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java | 229 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ConfigurationStep.java | 62
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ConfigurationTemplateStep.java | 87
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryCreateWizard.java | 172 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/AbstractSelector.java | 254 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceGroupSelector.java | 81
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java | 88
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/SelectedResourceDataSource.java | 73
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java | 254 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeTreeDataSource.java | 260 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeTreeView.java | 115 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/summary/SummaryCountsView.java | 110 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java | 160 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/SearchBarPane.java | 89
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/CanvasUtility.java | 53
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/ErrorHandler.java | 43
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java | 174 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/Message.java | 48
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenter.java | 51
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java | 201 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferenceChangeEvent.java | 47
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferenceChangeListener.java | 30
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferenceNames.java | 242 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferences.java | 136 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/rpc/MonitoringRequestCallback.java | 66
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/rpc/RPCManager.java | 92
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AbstractGWTServiceImpl.java | 66
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AlertGWTServiceImpl.java | 60
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AuthorizationGWTServiceImpl.java | 66
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleFileUploadServlet.java | 81
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java | 178 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java | 77
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/FileUploadServlet.java | 184 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/MeasurementDataGWTServiceImpl.java | 72
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ObjectFilter.java | 86
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/OperationGWTServiceImpl.java | 78
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceBossGWTServiceImpl.java | 47
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java | 210 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGroupGWTServiceImpl.java | 57
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceTypeGWTServiceImpl.java | 29
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/RoleGWTServiceImpl.java | 65
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/SubjectGWTServiceImpl.java | 78
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/util/SerialUtility.java | 61
modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css | 263 ++
modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.html | 30
modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml | 130 +
modules/enterprise/gui/coregui/src/main/webapp/images/Favorite_24.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/Favorite_24_Selected.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/RHQ.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/ajax-loader.gif |binary
modules/enterprise/gui/coregui/src/main/webapp/images/header/header_bg.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/header/header_bg_line.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/header/header_bg_selected.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/header/rhq_logo_28px.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/info/icn_info_blue.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/info/icn_info_orange.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/info/icn_info_red.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/resources/Service_down_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/resources/Service_down_24.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/resources/Service_up_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/resources/Service_up_24.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/resources/availability_green_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/resources/availability_green_24.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/resources/availability_grey_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/resources/availability_grey_24.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/resources/availability_red_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/resources/availability_red_24.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/resources/availability_yellow_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/resources/availability_yellow_24.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/resources/dir_closed.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/resources/dir_opened.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/resources/folder_closed.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/resources/folder_down_closed.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/resources/folder_down_opened.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/resources/folder_group_closed.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/resources/folder_group_opened.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/resources/folder_opened.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/rhq_logo_animated_100px.gif |binary
modules/enterprise/gui/coregui/src/main/webapp/images/types/Platform_down_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/types/Platform_down_24.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/types/Platform_up_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/types/Platform_up_24.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/types/Server_down_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/types/Server_down_24.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/types/Server_up_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/types/Server_up_24.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/types/Service_down_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/types/Service_down_24.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/types/Service_up_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/types/Service_up_24.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/types/plugin_16.png |binary
modules/enterprise/gui/coregui/src/main/webapp/images/types/plugin_24.png |binary
modules/enterprise/gui/pom.xml | 1
modules/enterprise/gui/portal-war/pom.xml | 3
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/ListAlertHistoryUIBean.java | 2
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/ListGroupAlertHistoryUIBean.java | 2
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/converter/MetricPercentConverter.java | 4
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/description/BaselineDescriber.java | 2
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/description/ThresholdDescriber.java | 2
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java | 46
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java | 10
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/ShowInstalledPackageHistoryUIBean.java | 3
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/image/chart/HorizontalChart.java | 8
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/image/chart/PerformanceChart.java | 5
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/image/chart/VerticalChart.java | 12
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/browse/InventorySummaryUIBean.java | 2
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/AlertDefUtil.java | 2
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/ViewAlertAction.java | 2
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/condition/MeasurementConverterValidator.java | 7
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/visibility/ViewChartAction.java | 6
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/visibility/ViewChartFormPrepareAction.java | 2
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/hub/GroupHubPortalAction.java | 2
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/hub/ResourceHubPortalAction.java | 2
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/portlet/summaryCounts/ViewAction.java | 2
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/taglib/MetricDisplayTag.java | 17
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/taglib/display/MetricDecorator.java | 2
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/util/MonitorUtils.java | 7
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/resource/ResourceTreeModelUIBean.java | 2
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/startup/ExternalizableStrategyCommandListener.java | 10
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/startup/StartupServlet.java | 5
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/subsystem/SubsystemAlertHistoryUIBean.java | 4
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/util/StatisticsUtility.java | 2
modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/web.xml | 5
modules/enterprise/gui/portal-war/src/main/webapp/admin/test/browser.jsp | 2
modules/enterprise/gui/portal-war/src/main/webapp/admin/test/control.jsp | 3
modules/enterprise/gui/portal-war/src/main/webapp/admin/test/hibernate.jsp | 2
modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/downloads-body.xhtml | 101 +
modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/largeenv.xhtml | 4
modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/listAlertTemplates.xhtml | 3
modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/report/resourceInstallReport-body.xhtml | 93
modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/events/history-plain.xhtml | 257 ++
modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/menu/menu.xhtml | 1
modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/monitor/tables-plain.xhtml | 168 +
modules/enterprise/gui/portal-war/src/main/webapp/rhq/discovery/queue.xhtml | 1
modules/enterprise/gui/portal-war/src/main/webapp/rhq/group/alert/listGroupAlertDefinitions.xhtml | 3
modules/enterprise/gui/portal-war/src/main/webapp/rhq/layout/main-layout.xhtml | 4
modules/enterprise/gui/portal-war/src/main/webapp/rhq/layout/main.xhtml | 6
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/deploy-plain.xhtml | 148 +
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/history-plain.xhtml | 363 +++
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/installed_package_details-plain.xhtml | 157 +
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/subscription-plain.xhtml | 259 ++
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/view-plain.xhtml | 170 +
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/availabilityHistory-plain.xhtml | 200 +
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/schedules-plain.xhtml | 172 +
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/traits-plain.xhtml | 105 +
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/summary/overview-plain.xhtml | 69
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/summary/table/recentOOBs.xhtml | 2
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/summary/timeline-plain.xhtml | 53
modules/enterprise/gui/portal-war/src/test/resources/log4j.xml | 51
modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/proxy/ResourceClientProxy.java | 18
modules/enterprise/remoting/client-api/src/main/java/org/rhq/enterprise/client/RemoteClientProxy.java | 2
modules/enterprise/remoting/scripts/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManager.js | 45
modules/enterprise/server/container/pom.xml | 31
modules/enterprise/server/container/src/main/bin-resources/bin/generate-db-password.bat | 11
modules/enterprise/server/container/src/main/scripts/rhq-container.build.xml | 69
modules/enterprise/server/ear/pom.xml | 18
modules/enterprise/server/jar/pom.xml | 2
modules/enterprise/server/jar/src/main/java/META-INF/MANIFEST.MF | 30
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/agentclient/impl/AgentClientImpl.java | 11
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertConditionManagerBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertDefinitionManagerBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java | 24
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerLocal.java | 11
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertTemplateManagerBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/GroupAlertDefinitionManagerBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java | 13
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerLocal.java | 13
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java | 337 ++-
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerLocal.java | 31
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java | 73
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleServerServiceImpl.java | 12
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/AffinityGroupManagerBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/CloudManagerBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/PartitionEventManagerBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java | 22
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java | 19
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/AdvisoryManagerBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java | 30
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerLocal.java | 8
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentServerServiceImpl.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentSourceManagerBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentUIManagerBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/RepoManagerBean.java | 12
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CoreServerServiceImpl.java | 23
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java | 25
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossLocal.java | 12
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryServerServiceImpl.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/event/EventManagerBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/CallTimeDataManagerBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementOOBManagerBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementProblemManagerBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementScheduleManagerBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/util/MeasurementFormatter.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/GroupOperationJob.java | 5
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/ResourceOperationJob.java | 3
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginService.java | 8
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/bundle/BundleServerPluginManager.java | 44
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/remote/RemoteSafeInvocationHandler.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/remote/RemoteWsInvocationHandler.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/InventorySummary.java | 114 -
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceAvailabilityManagerLocal.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceBossBean.java | 1
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceBossLocal.java | 1
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceFactoryManagerBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java | 15
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java | 10
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeManagerBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java | 10
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/definition/GroupDefinitionManagerBean.java | 21
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/definition/GroupDefinitionManagerLocal.java | 3
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/EnhancedSchedulerImpl.java | 17
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/subsystem/AlertSubsystemManagerBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/subsystem/ConfigurationSubsystemManagerBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/subsystem/OperationHistorySubsystemManagerBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/test/AccessBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/test/CoreTestBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/test/DiscoveryTestBean.java | 4
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java | 146 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryRunner.java | 4
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/HibernatePerformanceMonitor.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/HibernateStatisticsStopWatch.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java | 31
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/alert/test/AlertManagerBeanTest.java | 5
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java | 354 +++
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/TestBundleServerPluginService.java | 5
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java | 84
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanUnitTest.java | 3
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/content/test/ContentManagerBeanTest.java | 13
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/content/test/ContentSourceManagerBeanTest.java | 2
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/content/test/ContentUIManagerBeanEligiblePackagesTest.java | 3
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/discovery/test/DiscoveryBossBeanTest.java | 17
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/event/test/EventManagerTest.java | 2
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java | 3
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementBaselineManagerTest.java | 4
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementViewManagerTest.java | 3
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/operation/OperationManagerBeanTest.java | 2
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/group/test/RecursiveResourceGroupTest.java | 3
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdateEventsSubsystemTest.java | 2
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdateMeasurementSubsystemTest.java | 3
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/test/ResourceFactoryManagerBeanTest.java | 3
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/test/ResourceManagerBeanTest.java | 2
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/scheduler/jobs/DataPurgeJobTest.java | 4
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java | 2
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/TestAgentClient.java | 10
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/ResourceTreeHelper.java | 3
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/SessionTestHelper.java | 3
modules/enterprise/server/plugins/ant-bundle/pom.xml | 214 ++
modules/enterprise/server/plugins/ant-bundle/src/main/java/org/rhq/enterprise/server/plugins/ant/AntBundleServerPluginComponent.java | 125 +
modules/enterprise/server/plugins/ant-bundle/src/main/resources/META-INF/rhq-serverplugin.xml | 20
modules/enterprise/server/plugins/filetemplate-bundle/pom.xml | 6
modules/enterprise/server/plugins/filetemplate-bundle/src/main/java/org/rhq/enterprise/server/plugins/filetemplate/BundleServerPluginComponent.java | 7
modules/enterprise/server/plugins/jboss-software/src/main/resources/META-INF/rhq-serverplugin.xml | 2
modules/enterprise/server/plugins/perspectives/core/perspective/src/main/resources/META-INF/rhq-serverplugin.xml | 17
modules/enterprise/server/plugins/pom.xml | 1
modules/enterprise/server/plugins/validate-all-serverplugins/pom.xml | 1
modules/enterprise/server/safe-invoker/src/main/java/org/rhq/enterprise/server/util/HibernateDetachUtility.java | 91
modules/plugins/ant-bundle/pom.xml | 267 ++
modules/plugins/ant-bundle/src/main/java/org/rhq/plugins/ant/AntBundlePluginComponent.java | 136 +
modules/plugins/ant-bundle/src/main/java/org/rhq/plugins/ant/AntBundlePluginDiscoveryComponent.java | 51
modules/plugins/ant-bundle/src/main/resources/META-INF/rhq-plugin.xml | 20
modules/plugins/ant-bundle/src/test/java/org/rhq/plugins/ant/AntBundlePluginComponentTest.java | 166 +
modules/plugins/ant-bundle/src/test/resources/log4j.xml | 35
modules/plugins/ant-bundle/src/test/resources/simple-build.xml | 8
modules/plugins/ant-bundle/src/test/resources/test-build.xml | 27
modules/plugins/apache/src/test/java/org/rhq/plugins/apache/ApachePluginTest.java | 7
modules/plugins/augeas/src/main/java/org/rhq/plugins/augeas/helper/AugeasRawConfigHelper.java | 5
modules/plugins/byteman/src/main/java/org/rhq/plugins/byteman/BytemanAgentComponent.java | 10
modules/plugins/cobbler/src/main/java/org/rhq/plugins/cobbler/CobblerComponent.java | 9
modules/plugins/filetemplate-bundle/src/main/java/org/rhq/plugins/filetemplate/ProcessingRecipeContext.java | 8
modules/plugins/hibernate/src/test/java/org/rhq/plugins/hibernate/test/HibernatePluginTest.java | 2
modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerComponent.java | 4
modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerContentFacetDelegate.java | 10
modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/StandaloneManagedDeploymentComponent.java | 6
modules/plugins/jboss-as-5/testsuite/src/main/java/org/rhq/plugins/jbossas5/JBossServerTest.java | 2
modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/ApplicationComponent.java | 4
modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/JBossASServerComponent.java | 5
modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/util/WarDiscoveryHelper.java | 7
modules/plugins/jboss-as/src/test/java/org/rhq/plugins/jbossas/test/JBossASPluginTest.java | 2
modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/MBeanResourceComponent.java | 3
modules/plugins/jmx/src/test/java/org/rhq/plugins/jmx/test/JMXPluginTest.java | 3
modules/plugins/nss/src/main/java/org/rhq/plugin/nss/NameServiceSwitchComponent.java | 5
modules/plugins/perftest/src/main/java/org/rhq/plugins/perftest/PerfTestComponent.java | 6
modules/plugins/platform/src/main/java/org/rhq/plugins/platform/LinuxPlatformComponent.java | 8
modules/plugins/platform/src/main/java/org/rhq/plugins/platform/WindowsPlatformComponent.java | 2
modules/plugins/platform/src/test/java/org/rhq/plugins/platform/test/PlatformPluginTest.java | 2
modules/plugins/pom.xml | 17
modules/plugins/postgres/src/test/java/org/rhq/plugins/postgres/test/PostgresPluginTest.java | 3
modules/plugins/rhq-agent/src/test/java/org/rhq/plugins/agent/AgentPluginTest.java | 2
modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatGroupComponent.java | 16
modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatUserComponent.java | 24
modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatVHostComponent.java | 3
modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatWarComponent.java | 8
modules/plugins/tomcat/src/test/java/org/jboss/on/plugins/tomcat/test/TomcatPluginTest.java | 3
modules/plugins/validate-all-plugins/pom.xml | 1
pom.xml | 21
647 files changed, 35130 insertions(+), 4251 deletions(-)
New commits:
commit 09a34d0f20f378e27055b466b343943f0711a282
Merge: bd65937... 8593598...
Author: John Sanda <jsanda(a)redhat.com>
Date: Thu Apr 1 20:23:07 2010 -0400
Merge branch 'master' into bugfixes
commit 8593598f69e6bca1a886818b3ec0b4f41da59277
Merge: 22ce633... 85c35b5...
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Thu Apr 1 17:58:16 2010 -0400
Merge branch 'master' of ssh://git.fedorahosted.org/git/rhq/rhq
commit 22ce63359bb5856a1e51bad5c4923113d9ebc9a9
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Thu Apr 1 17:57:43 2010 -0400
add a4j keep-alive annotation to UIBean will survive across AJAX requests
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/ShowInstalledPackageHistoryUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/ShowInstalledPackageHistoryUIBean.java
index 075d273..668d980 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/ShowInstalledPackageHistoryUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/ShowInstalledPackageHistoryUIBean.java
@@ -23,6 +23,8 @@ import java.util.ArrayList;
import javax.servlet.http.HttpServletRequest;
import javax.faces.component.UIData;
import javax.faces.model.SelectItem;
+
+import org.ajax4jsf.model.KeepAlive;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.rhq.core.domain.content.InstalledPackageHistory;
@@ -37,6 +39,7 @@ import org.rhq.enterprise.server.content.ContentUIManagerLocal;
*
* @author Jason Dobies
*/
+@KeepAlive
public class ShowInstalledPackageHistoryUIBean {
private InstalledPackageHistory history;
commit 13277b3af1bf163ac712260821c4d3db189e52a1
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Thu Apr 1 17:57:00 2010 -0400
add better error handling when calling deleteJob() on Quartz scheduler returns false
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/EnhancedSchedulerImpl.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/EnhancedSchedulerImpl.java
index 23a8381..b3c213a 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/EnhancedSchedulerImpl.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/EnhancedSchedulerImpl.java
@@ -63,12 +63,17 @@ public class EnhancedSchedulerImpl implements EnhancedScheduler {
try {
// see if the job is already scheduled and if so,
// either remove it so we can reschedule it or keep it (based on rescheduleIfExists)
- if (this.scheduler.getJobDetail(name, groupName) != null) {
+ JobDetail job = this.scheduler.getJobDetail(name, groupName);
+ if (job != null) {
if (rescheduleIfExists) {
log.debug("Looks like repeating job [" + name + ':' + groupName
+ "] is already scheduled - removing it so it can be rescheduled");
this.scheduler.deleteJob(name, groupName);
+ if (!this.scheduler.deleteJob(name, groupName)) {
+ log.error("Failed to delete job [" + job + "] in order to reschedule it.");
+ return;
+ }
} else {
log.debug("Looks like repeating job [" + name + ':' + groupName
+ "] is already scheduled - leaving the original job as-is");
@@ -107,12 +112,16 @@ public class EnhancedSchedulerImpl implements EnhancedScheduler {
try {
// see if the job is already scheduled and if so,
// either remove it so we can reschedule it or keep it (based on rescheduleIfExists)
- if (this.scheduler.getJobDetail(name, groupName) != null) {
+ JobDetail job = this.scheduler.getJobDetail(name, groupName);
+ if (job != null) {
if (rescheduleIfExists) {
log.debug("Looks like cron job [" + name + ':' + groupName
+ "] is already scheduled - removing it so it can be rescheduled");
- this.scheduler.deleteJob(name, groupName);
+ if (!this.scheduler.deleteJob(name, groupName)) {
+ log.error("Failed to delete job [" + job + "] in order to reschedule it.");
+ return;
+ }
} else {
log.debug("Looks like cron job [" + name + ':' + groupName
+ "] is already scheduled - leaving the original job as-is");
@@ -142,7 +151,7 @@ public class EnhancedSchedulerImpl implements EnhancedScheduler {
Date next = this.scheduler.scheduleJob(job, trigger);
log.info("Scheduled cron job [" + name + ':' + groupName + "] to fire next at [" + next
- + "] with the cronString of [" + cronString + "]");
+ + "] with the cronString of [" + cronString + "].");
return;
}
commit 85c35b5409a9de7c9a03a79730f03087714dca4c
Merge: 9d11886... 6c1cda8...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Apr 1 16:15:20 2010 -0400
Merge branch 'master' of ssh://git.fedorahosted.org/git/rhq/rhq
commit 6c1cda84cc39eaa183d237ae669710ac85eaebe3
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Thu Apr 1 15:57:33 2010 -0400
fix overlap of dbupgrade version 2.59 between RHQ 1.3.1 and HEAD; fix a few minor typos
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 23f1fbd..de2d2ca 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -1471,6 +1471,20 @@
</schemaSpec>
<schemaSpec version="2.59">
+ <schema-directSQL>
+ <statement desc="Changing default persistence mode to FILESYSTEM for new JBoss CSP content sources">
+ UPDATE rhq_content_source_type SET default_download_mode = 'FILESYSTEM'
+ WHERE id = 101
+ </statement>
+ <statement desc="Changing persistence mode to FILESYSTEM on out-of-box JBoss CSP content source">
+ UPDATE rhq_content_source SET download_mode = 'FILESYSTEM'
+ WHERE id = 101 AND configuration_id =
+ (SELECT configuration_id FROM rhq_config_property WHERE id = 112 AND string_value IS null)
+ </statement>
+ </schema-directSQL>
+ </schemaSpec>
+
+ <schemaSpec version="2.60">
<schema-directSQL>
<statement desc="Creating table RHQ_RAW_CONFIG">
CREATE TABLE RHQ_RAW_CONFIG (ID INTEGER)
@@ -1479,7 +1493,7 @@
<schema-alterColumn table="RHQ_RAW_CONFIG" column="ID" columnType="INTEGER" nullable="FALSE" />
<schema-createSequence name="RHQ_RAW_CONFIG_ID_SEQ" initial="10001" />
<schema-directSQL>
- <statement desc="Creating primary key for RHQ_PARTITION_EVENT">
+ <statement desc="Creating primary key for RHQ_RAW_CONFIG">
ALTER TABLE RHQ_RAW_CONFIG ADD PRIMARY KEY (ID)
</statement>
</schema-directSQL>
@@ -1532,7 +1546,7 @@
</schemaSpec>
- <schemaSpec version="2.59.1">
+ <schemaSpec version="2.60.1">
<schema-addColumn table="RHQ_PLUGIN" column="AMPS_VERSION" columnType="VARCHAR2" />
<schema-alterColumn table="RHQ_PLUGIN"
column="AMPS_VERSION"
@@ -1540,7 +1554,7 @@
precision="16"/>
</schemaSpec>
- <schemaSpec version="2.59.2">
+ <schemaSpec version="2.60.2">
<schema-directSQL>
<!-- RHN_CHANNEL => RHQ_REPO -->
<statement>
@@ -2696,6 +2710,7 @@
</statement>
</schema-directSQL>
</schemaSpec>
+
<schemaSpec version="2.78">
<!-- Remove obsolete tables RHQ_BUNDLE_CONFIG and RHQ_BUNDLE_DEPLOYMENT (the latter by cascade) -->
<schema-dropTable table="RHQ_BUNDLE_DEPLOYMENT" />
@@ -2908,7 +2923,7 @@
</statement>
</schema-directSQL>
<schema-directSQL>
- <statement desc="Creating primary key for RHQ_AFFINITY_GROUP">
+ <statement desc="Creating primary key for RHQ_SAVED_SEARCH">
ALTER TABLE RHQ_SAVED_SEARCH ADD PRIMARY KEY ( ID )
</statement>
</schema-directSQL>
@@ -2971,4 +2986,3 @@
</dbupgrade>
</target>
</project>
-
commit 9d1188637cd4854be5253428a98998b1cd432d48
Merge: 8a99109... b1a26f1...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Apr 1 15:51:52 2010 -0400
Merge branch 'gwt'
commit 0af2eed9684a2e0a16be0fc5a110210ba350e6da
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Thu Apr 1 13:30:36 2010 -0400
update copyright date in javadoc footer; link JEE5 javadoc in to domain javadoc
diff --git a/modules/core/domain/pom.xml b/modules/core/domain/pom.xml
index 05e1a4b..3fe0ff1 100644
--- a/modules/core/domain/pom.xml
+++ b/modules/core/domain/pom.xml
@@ -330,6 +330,7 @@
<breakiterator>true</breakiterator>
<links>
<link>http://java.sun.com/j2se/1.5.0/docs/api/</link>
+ <link>http://java.sun.com/javaee/5/docs/api/</link>
</links>
</configuration>
</execution>
diff --git a/modules/enterprise/server/jar/pom.xml b/modules/enterprise/server/jar/pom.xml
index bfb4d67..5458784 100644
--- a/modules/enterprise/server/jar/pom.xml
+++ b/modules/enterprise/server/jar/pom.xml
@@ -641,7 +641,7 @@
<link href="../domain" />
<link href="../plugin-api" />
<link href="http://java.sun.com/j2se/1.5.0/docs/api/" />
- <bottom><![CDATA[Copyright © 2008-2009 <a href="http://rhq-project.org/">Red Hat, Inc.</a>. All Rights Reserved.]]></bottom>
+ <bottom><![CDATA[Copyright © 2008-2010 <a href="http://rhq-project.org/">Red Hat, Inc.</a>. All Rights Reserved.]]></bottom>
</javadoc>
</tasks>
</configuration>
commit 8a99109184c38e490ea7c793db7b3eb8bdf314bd
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Thu Apr 1 13:17:45 2010 -0400
fix annoying sporadic test failures in ConfigurationManagerBeanTest
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index dbd2395..4158d8b 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -840,6 +840,9 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
Resource resource = entityManager.find(Resource.class, resourceId);
+ // TODO (ips, 04/01/10): Our id's are not guaranteed to be sequential, because our sequences are configured to
+ // pre-create and cache blocks of 10 sequence id's, so it may be better to order by
+ // "cu.createdTime", rather than "cu.id".
pc.initDefaultOrderingField("cu.id", PageOrdering.DESC);
String queryName = ResourceConfigurationUpdate.QUERY_FIND_ALL_BY_RESOURCE_ID;
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
index 774f44c..2854544 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
@@ -107,29 +107,38 @@ public interface ConfigurationManagerLocal {
Long endDate, PageControl pc);
/**
- * Returns the list of all resource configuration updates for the given resource. This will show you an audit trail
- * of the update history for the resource (who updated it, when and what did they do). You can pick one
+ * Returns the list of all Resource configuration updates for the given Resource, in reverse of the order in which
+ * they were created (i.e. most recent update will be the first item in the list). This will show you an audit trail
+ * of the update history for the Resource (who updated it, when and what did they change). You can pick one
* configuration version to later rollback to that version via
* {@link #updateResourceConfiguration(Subject, int, Configuration)}.
*
- * @param subject the user who wants to see the information
+ * @param subject the user who wants to see the information
* @param resourceId the resource whose update requests are to be returned, if null will not filter by resourceId
* @param beginDate filter used to show only results occurring after this epoch millis parameter, nullable
* @param endDate filter used to show only results occurring before this epoch millis parameter, nullable
* @param suppressOldest if true, will not include the oldest element in the history (usually the initial update)
* @param pc the pagination controls
*
- * @return the resource's complete list of updates (will be empty (not <code>null</code>) if none)
+ * @return the Resource's complete list of updates (will be empty (not <code>null</code>) if none)
*/
PageList<ResourceConfigurationUpdate> findResourceConfigurationUpdates(Subject subject, Integer resourceId,
Long beginDate, Long endDate, boolean suppressOldest, PageControl pc);
+ /**
+ * Returns a single plugin configuration update.
+ *
+ * @param subject the user who wants to see the information
+ * @param configurationUpdateId the ID of the configuration update entity to return
+ *
+ * @return the plugin configuration update
+ */
PluginConfigurationUpdate getPluginConfigurationUpdate(Subject subject, int configurationUpdateId);
/**
* Returns a single resource configuration update
*
- * @param subject the user who wants to see the information
+ * @param subject the user who wants to see the information
* @param configurationUpdateId the ID of the configuration update entity to return
*
* @return the resource configuration update
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java
index 45164d2..c79506d 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
+ * Copyright (C) 2005-2010 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -23,7 +23,6 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Collection;
import javax.persistence.EntityManager;
@@ -46,7 +45,6 @@ import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
import org.rhq.core.domain.configuration.PluginConfigurationUpdate;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
-import org.rhq.core.domain.configuration.RawConfiguration;
import org.rhq.core.domain.configuration.group.GroupPluginConfigurationUpdate;
import org.rhq.core.domain.discovery.AvailabilityReport;
import org.rhq.core.domain.discovery.InventoryReport;
@@ -78,7 +76,7 @@ public class ConfigurationManagerBeanTest extends AbstractEJB3Test {
private Resource newResource1;
private Resource newResource2;
private ResourceGroup compatibleGroup;
- private PageControl pageControl;
+ private PageControl configUpdatesPageControl;
private Agent agent;
private Subject overlord;
@@ -87,9 +85,12 @@ public class ConfigurationManagerBeanTest extends AbstractEJB3Test {
*/
@BeforeClass
public void beforeClass() {
- // make sure page control sorts so the latest config is last
- pageControl = PageControl.getUnlimitedInstance();
- pageControl.addDefaultOrderingField("cu.id", PageOrdering.ASC);
+ // Make sure page control sorts so the latest config update is last (the default is for the latest to be first).
+ configUpdatesPageControl = PageControl.getUnlimitedInstance();
+ // (ips, 04/01/10): Use createdTime, rather than id, to order by, since the id's are not guaranteed to be
+ // ordered sequentially (this is because, dbsetup configures our sequences to pre-create
+ // and cache sequence values 10 at a time.
+ configUpdatesPageControl.addDefaultOrderingField("cu.createdTime", PageOrdering.ASC);
configurationManager = LookupUtil.getConfigurationManager();
resourceManager = LookupUtil.getResourceManager();
@@ -224,7 +225,7 @@ public class ConfigurationManagerBeanTest extends AbstractEJB3Test {
assert history1 != null;
PropertySimple myprop = history1.getConfiguration().getSimple("myboolean");
assert myprop != null;
- assert myprop.getStringValue().equals("true");
+ assert "true".equals(myprop.getStringValue());
// now update to that second config - the "agent" will sleep for a bit before it completes
// so we will have an INPROGRESS configuration for a few seconds before it goes to SUCCESS
@@ -244,7 +245,7 @@ public class ConfigurationManagerBeanTest extends AbstractEJB3Test {
assert history2.getId() == history1.getId();
myprop = history2.getConfiguration().getSimple("myboolean");
assert myprop != null;
- assert myprop.getStringValue().equals("true");
+ assert "true".equals(myprop.getStringValue());
myprop = history2.getConfiguration().getSimple("mysleep"); // this wasn't in the first config
assert myprop == null;
// record that this test case ran, we expect it will if the agent delay is there
@@ -256,9 +257,10 @@ public class ConfigurationManagerBeanTest extends AbstractEJB3Test {
assert history2.getId() != history1.getId();
myprop = history2.getConfiguration().getSimple("myboolean");
assert myprop != null;
- assert myprop.getStringValue().equals("false");
+ assert "false".equals(myprop.getStringValue());
myprop = history2.getConfiguration().getSimple("mysleep");
- assert myprop.getLongValue() == 7000L;
+ assert myprop.getLongValue() != null;
+ assert myprop.getLongValue().longValue() == 7000L;
}
} while (inProgress);
@@ -555,7 +557,7 @@ public class ConfigurationManagerBeanTest extends AbstractEJB3Test {
configurationManager.updateResourceConfiguration(overlord, resource.getId(), configuration);
- Thread.sleep(4000); // wait for the test agent to complete the request
+ Thread.sleep(2000); // wait for the test agent to complete the request
// our test service pretends the agent got an error - it will set some errors and the call to
// completedConfigurationUpdate is made inline (in the real code, this would be asynchronous)
@@ -626,13 +628,13 @@ public class ConfigurationManagerBeanTest extends AbstractEJB3Test {
configurationManager.updateResourceConfiguration(overlord, resource.getId(), configuration);
- Thread.sleep(4000); // wait for the test agent to complete the request
+ Thread.sleep(2000); // wait for the test agent to complete the request
// at this point in time, the round trip messaging is done and we have the agent response
List<ResourceConfigurationUpdate> requests;
requests = configurationManager.findResourceConfigurationUpdates(overlord, resource.getId(), null, null, false,
- pageControl);
+ configUpdatesPageControl);
assert requests.size() == 1;
assert requests.get(0) != null;
@@ -663,7 +665,7 @@ public class ConfigurationManagerBeanTest extends AbstractEJB3Test {
assert live != null;
mybool = live.getSimple("myboolean");
assert mybool != null;
- assert mybool.getStringValue().equals("true");
+ assert "true".equals(mybool.getStringValue());
assert mybool.getErrorMessage() == null;
// purging a non-existing request is a no-op
@@ -674,7 +676,7 @@ public class ConfigurationManagerBeanTest extends AbstractEJB3Test {
configurationManager.purgeResourceConfigurationUpdate(overlord, request.getId(), false);
requests = configurationManager.findResourceConfigurationUpdates(overlord, resource.getId(), null, null, false,
- pageControl);
+ configUpdatesPageControl);
assert requests.size() == 1; // it will create one for us from the "live" configuration
}
@@ -704,34 +706,35 @@ public class ConfigurationManagerBeanTest extends AbstractEJB3Test {
List<ResourceConfigurationUpdate> history;
history = configurationManager.findResourceConfigurationUpdates(overlord, resource.getId(), null, null, false,
- pageControl);
+ configUpdatesPageControl);
assert history != null;
assert history.size() == 3;
- Configuration currentConfiguration = history.get(2).getConfiguration(); // the last is the current one
+
+ Configuration currentConfiguration = history.get(2).getConfiguration();
PropertySimple mybool = currentConfiguration.getSimple("myboolean");
assert mybool != null;
- assert mybool.getStringValue().equals("TRUE");
+ assert "TRUE".equals(mybool.getStringValue()) : "actual: " + mybool.getStringValue();
// now grab one of the earlier configurations and rollback to it
Configuration rollbackToHere = history.get(1).getConfiguration(); // the "false" one
mybool = rollbackToHere.getSimple("myboolean");
assert mybool != null;
- assert mybool.getStringValue().equals("false");
+ assert "false".equals(mybool.getStringValue()) : "actual: " + mybool.getStringValue();
configurationManager.updateResourceConfiguration(overlord, resource.getId(), rollbackToHere);
Thread.sleep(2000); // wait for the test agent to complete the request
history = configurationManager.findResourceConfigurationUpdates(overlord, resource.getId(), null, null, false,
- pageControl);
+ configUpdatesPageControl);
assert history != null;
assert history.size() == 4;
- ResourceConfigurationUpdate newConfigUpdate = history.get(3);
- Configuration newConfiguration = newConfigUpdate.getConfiguration(); // the last is the new one
+ ResourceConfigurationUpdate newConfigUpdate = history.get(3); // the last one is the new one
+ Configuration newConfiguration = newConfigUpdate.getConfiguration();
assert newConfiguration.getId() != rollbackToHere.getId();
mybool = newConfiguration.getSimple("myboolean");
assert mybool != null;
- assert mybool.getStringValue().equals("false");
+ assert "false".equals(mybool.getStringValue());
assert mybool.getErrorMessage() == null;
ResourceConfigurationUpdate current = configurationManager.getLatestResourceConfigurationUpdate(overlord,
@@ -768,7 +771,7 @@ public class ConfigurationManagerBeanTest extends AbstractEJB3Test {
List<ResourceConfigurationUpdate> requests;
requests = configurationManager.findResourceConfigurationUpdates(overlord, resource.getId(), null, null, false,
- pageControl);
+ configUpdatesPageControl);
assert requests != null;
assert requests.size() == 1 : "Got " + requests.size() + " config update requests - expected 1.";
@@ -799,7 +802,7 @@ public class ConfigurationManagerBeanTest extends AbstractEJB3Test {
List<ResourceConfigurationUpdate> requests;
requests = configurationManager.findResourceConfigurationUpdates(overlord, resource.getId(), null, null, false,
- pageControl);
+ configUpdatesPageControl);
assert requests != null;
assert requests.size() == 2 : "Got " + requests.size() + " config update requests - expected 2.";
@@ -813,7 +816,7 @@ public class ConfigurationManagerBeanTest extends AbstractEJB3Test {
// now get the current configs/requests and
// make sure we deleted just the one configuration, leaving one left
requests = configurationManager.findResourceConfigurationUpdates(overlord, resource.getId(), null, null, false,
- pageControl);
+ configUpdatesPageControl);
assert requests.size() == 1;
assert requests.get(0).getId() == savedRequest.getId();
@@ -835,14 +838,14 @@ public class ConfigurationManagerBeanTest extends AbstractEJB3Test {
Configuration activeConfigurationBefore = configurationManager.getResourceConfiguration(resource.getId());
configurationManager.updateResourceConfiguration(overlord, resource.getId(), configuration1);
- Thread.sleep(4000); // wait for the test agent to complete the request
+ Thread.sleep(2000); // wait for the test agent to complete the request
Configuration activeConfigurationAfter = configurationManager.getResourceConfiguration(resource.getId());
assert activeConfigurationBefore.equals(activeConfigurationAfter) : "ActiveResourceConfiguration was not supposed to change for a failed update -- old was: "
+ activeConfigurationBefore + ", new was: " + activeConfigurationAfter;
configurationManager.updateResourceConfiguration(overlord, resource.getId(), configuration2);
- Thread.sleep(4000); // wait for the test agent to complete the request
+ Thread.sleep(2000); // wait for the test agent to complete the request
Configuration activeConfiguration = configurationManager.getResourceConfiguration(resource.getId());
assert activeConfiguration != null : "ActiveResourceConfiguration was not updated with configuration2";
@@ -851,19 +854,19 @@ public class ConfigurationManagerBeanTest extends AbstractEJB3Test {
assert activeProperties.containsKey("myboolean");
PropertySimple activeProperty = activeProperties.get("myboolean");
assert activeProperty.getName().equals("myboolean");
- assert activeProperty.getStringValue().equals("true");
+ assert "true".equals(activeProperty.getStringValue());
// at this point in time, the round trip messaging is done and we have the agent response
List<ResourceConfigurationUpdate> requests;
requests = configurationManager.findResourceConfigurationUpdates(overlord, resource.getId(), null, null, false,
- pageControl);
+ configUpdatesPageControl);
assert requests != null;
assert requests.size() == 2; // one succeeded and one failed
- assert requests.get(0).getStatus() == ConfigurationUpdateStatus.FAILURE;
- assert requests.get(1).getStatus() == ConfigurationUpdateStatus.SUCCESS;
+ assert requests.get(0).getStatus() == ConfigurationUpdateStatus.FAILURE : "actual: " + requests.get(0).getStatus();
+ assert requests.get(1).getStatus() == ConfigurationUpdateStatus.SUCCESS : "actual: " + requests.get(1).getStatus();
ResourceConfigurationUpdate savedRequest = requests.get(0); // this is the one that failed
ResourceConfigurationUpdate doomedRequest = requests.get(1); // this is the one that succeeded
@@ -873,7 +876,7 @@ public class ConfigurationManagerBeanTest extends AbstractEJB3Test {
// now get the current configs/requests and
// make sure we deleted the only one configuration that succeeded, leaving one update record
requests = configurationManager.findResourceConfigurationUpdates(overlord, resource.getId(), null, null, false,
- pageControl);
+ configUpdatesPageControl);
assert requests.size() == 1;
commit f62d8fbeb79eb7aa419280137b8fec069f2126f9
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Thu Apr 1 10:20:07 2010 -0400
improve description for CSP content source type
diff --git a/modules/enterprise/server/plugins/jboss-software/src/main/resources/META-INF/rhq-serverplugin.xml b/modules/enterprise/server/plugins/jboss-software/src/main/resources/META-INF/rhq-serverplugin.xml
index 55e2a64..9f98351 100644
--- a/modules/enterprise/server/plugins/jboss-software/src/main/resources/META-INF/rhq-serverplugin.xml
+++ b/modules/enterprise/server/plugins/jboss-software/src/main/resources/META-INF/rhq-serverplugin.xml
@@ -13,7 +13,7 @@
<contentSourceType name="JBossASPatchSource"
displayName="JBoss Patch Content Source"
- description="This content source retrieves patches from the JBoss CSP RSS feed."
+ description="a content source that retrieves package metadata from an RSS feed; the feed must be in the format used by the JBoss CSP"
lazyLoad="true"
apiClass="org.rhq.enterprise.server.plugins.jboss.software.JBossSoftwareContentSourceAdapter">
commit 79e3d2335729acb132e4085d254353d87225e867
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Thu Apr 1 10:19:30 2010 -0400
use two different DBs for tests and dev-container
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index 2fb6a90..9e8e258 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -93,7 +93,12 @@
return
}
- database = project.properties['rhq.test.ds.db-name']
+ db = project.properties.db
+ if (db == 'dev') {
+ database = project.properties['rhq.dev.ds.db-name']
+ } else {
+ database = project.properties['rhq.test.ds.db-name']
+ }
project.properties.dbsetup = 'true'
sql = Sql.newInstance(
@@ -141,6 +146,20 @@
<configuration>
<tasks>
<property name="settings.localRepository" location="${user.home}/.m2/repository" />
+
+ <condition property="rhq.ds.type-mapping" value="${rhq.dev.ds.type-mapping}" else="${rhq.test.ds.type-mapping}">
+ <equals arg1="${db}" arg2="dev"/>
+ </condition>
+ <condition property="rhq.ds.connection-url" value="${rhq.dev.ds.connection-url}" else="${rhq.test.ds.connection-url}">
+ <equals arg1="${db}" arg2="dev"/>
+ </condition>
+ <condition property="rhq.ds.user-name" value="${rhq.dev.ds.user-name}" else="${rhq.test.ds.user-name}">
+ <equals arg1="${db}" arg2="dev"/>
+ </condition>
+ <condition property="rhq.ds.password" value="${rhq.dev.ds.password}" else="${rhq.test.ds.password}">
+ <equals arg1="${db}" arg2="dev"/>
+ </condition>
+
<ant antfile="${basedir}/src/main/scripts/dbsetup-build.xml">
<property name="settings.localRepository" value="${settings.localRepository}" />
<property name="ojdbc5.version" value="${ojdbc5.version}" />
@@ -148,10 +167,10 @@
<property name="h2.version" value="${h2.version}" />
<property name="jtds.version" value="${jtds.version}" />
<property name="task.classpath.property" refid="maven.test.classpath" />
- <property name="rhq.ds.type-mapping" value="${rhq.test.ds.type-mapping}" />
- <property name="rhq.ds.connection-url" value="${rhq.test.ds.connection-url}" />
- <property name="rhq.ds.user-name" value="${rhq.test.ds.user-name}" />
- <property name="rhq.ds.password" value="${rhq.test.ds.password}" />
+ <property name="rhq.ds.type-mapping" value="${rhq.ds.type-mapping}" />
+ <property name="rhq.ds.connection-url" value="${rhq.ds.connection-url}" />
+ <property name="rhq.ds.user-name" value="${rhq.ds.user-name}" />
+ <property name="rhq.ds.password" value="${rhq.ds.password}" />
<property name="project.version" value="${project.version}" />
<property name="db.schema.version" value="${db.schema.version}" />
<property name="dbsetup" value="${dbsetup}" />
@@ -172,6 +191,20 @@
<configuration>
<tasks>
<property name="settings.localRepository" location="${user.home}/.m2/repository" />
+
+ <condition property="rhq.ds.type-mapping" value="${rhq.dev.ds.type-mapping}" else="${rhq.test.ds.type-mapping}">
+ <equals arg1="${db}" arg2="dev"/>
+ </condition>
+ <condition property="rhq.ds.connection-url" value="${rhq.dev.ds.connection-url}" else="${rhq.test.ds.connection-url}">
+ <equals arg1="${db}" arg2="dev"/>
+ </condition>
+ <condition property="rhq.ds.user-name" value="${rhq.dev.ds.user-name}" else="${rhq.test.ds.user-name}">
+ <equals arg1="${db}" arg2="dev"/>
+ </condition>
+ <condition property="rhq.ds.password" value="${rhq.dev.ds.password}" else="${rhq.test.ds.password}">
+ <equals arg1="${db}" arg2="dev"/>
+ </condition>
+
<ant antfile="${basedir}/src/main/scripts/dbsetup-build.xml" target="dbsetup-combine">
<property name="settings.localRepository" value="${settings.localRepository}" />
<property name="ojdbc5.version" value="${ojdbc5.version}" />
@@ -179,10 +212,10 @@
<property name="h2.version" value="${h2.version}" />
<property name="jtds.version" value="${jtds.version}" />
<property name="task.classpath.property" refid="maven.test.classpath" />
- <property name="rhq.ds.type-mapping" value="${rhq.test.ds.type-mapping}" />
- <property name="rhq.ds.connection-url" value="${rhq.test.ds.connection-url}" />
- <property name="rhq.ds.user-name" value="${rhq.test.ds.user-name}" />
- <property name="rhq.ds.password" value="${rhq.test.ds.password}" />
+ <property name="rhq.ds.type-mapping" value="${rhq.ds.type-mapping}" />
+ <property name="rhq.ds.connection-url" value="${rhq.ds.connection-url}" />
+ <property name="rhq.ds.user-name" value="${rhq.ds.user-name}" />
+ <property name="rhq.ds.password" value="${rhq.ds.password}" />
<property name="project.version" value="${project.version}" />
<property name="db.schema.version" value="${db.schema.version}" />
</ant>
@@ -204,6 +237,20 @@
<configuration>
<tasks>
<property name="settings.localRepository" location="${user.home}/.m2/repository" />
+
+ <condition property="rhq.ds.type-mapping" value="${rhq.dev.ds.type-mapping}" else="${rhq.test.ds.type-mapping}">
+ <equals arg1="${db}" arg2="dev"/>
+ </condition>
+ <condition property="rhq.ds.connection-url" value="${rhq.dev.ds.connection-url}" else="${rhq.test.ds.connection-url}">
+ <equals arg1="${db}" arg2="dev"/>
+ </condition>
+ <condition property="rhq.ds.user-name" value="${rhq.dev.ds.user-name}" else="${rhq.test.ds.user-name}">
+ <equals arg1="${db}" arg2="dev"/>
+ </condition>
+ <condition property="rhq.ds.password" value="${rhq.dev.ds.password}" else="${rhq.test.ds.password}">
+ <equals arg1="${db}" arg2="dev"/>
+ </condition>
+
<ant antfile="${basedir}/src/main/scripts/dbsetup-build.xml" target="dbsetup-check-schema">
<property name="settings.localRepository" value="${settings.localRepository}" />
<property name="ojdbc5.version" value="${ojdbc5.version}" />
@@ -211,10 +258,10 @@
<property name="h2.version" value="${h2.version}" />
<property name="jtds.version" value="${jtds.version}" />
<property name="task.classpath.property" refid="maven.test.classpath" />
- <property name="rhq.ds.type-mapping" value="${rhq.test.ds.type-mapping}" />
- <property name="rhq.ds.connection-url" value="${rhq.test.ds.connection-url}" />
- <property name="rhq.ds.user-name" value="${rhq.test.ds.user-name}" />
- <property name="rhq.ds.password" value="${rhq.test.ds.password}" />
+ <property name="rhq.ds.type-mapping" value="${rhq.ds.type-mapping}" />
+ <property name="rhq.ds.connection-url" value="${rhq.ds.connection-url}" />
+ <property name="rhq.ds.user-name" value="${rhq.ds.user-name}" />
+ <property name="rhq.ds.password" value="${rhq.ds.password}" />
<property name="project.version" value="${project.version}" />
<property name="db.schema.version" value="${db.schema.version}" />
<property name="rhq.ds.driver-class" value="${rhq.test.ds.driver-class}" />
@@ -313,3 +360,4 @@
</profiles>
</project>
+
diff --git a/modules/enterprise/server/container/pom.xml b/modules/enterprise/server/container/pom.xml
index 39c7122..db4bf11 100644
--- a/modules/enterprise/server/container/pom.xml
+++ b/modules/enterprise/server/container/pom.xml
@@ -179,20 +179,20 @@
<property name="hibernate3.version" value="${hibernate3.version}" />
<property name="quartz.version" value="${quartz.version}" />
- <!-- dev/test DB settings (used to init rhq-server.properties if dev profile is active or developer prop is set) -->
- <property name="rhq.test.ds.connection-url" value="${rhq.test.ds.connection-url}" />
- <property name="rhq.test.ds.driver-class" value="${rhq.test.ds.driver-class}" />
- <property name="rhq.test.ds.xa-datasource-class" value="${rhq.test.ds.xa-datasource-class}" />
- <property name="rhq.test.ds.user-name" value="${rhq.test.ds.user-name}" />
- <property name="rhq.test.ds.password" value="${rhq.test.ds.password}" />
- <property name="rhq.test.ds.type-mapping" value="${rhq.test.ds.type-mapping}" />
- <property name="rhq.test.ds.server-name" value="${rhq.test.ds.server-name}" />
- <property name="rhq.test.ds.port" value="${rhq.test.ds.port}" />
- <property name="rhq.test.ds.db-name" value="${rhq.test.ds.db-name}" />
- <property name="rhq.test.ds.hibernate-dialect" value="${rhq.test.ds.hibernate-dialect}" />
- <property name="rhq.test.quartz.driverDelegateClass" value="${rhq.test.quartz.driverDelegateClass}" />
- <property name="rhq.test.quartz.selectWithLockSQL" value="${rhq.test.quartz.selectWithLockSQL}" />
- <property name="rhq.test.quartz.lockHandlerClass" value="${rhq.test.quartz.lockHandlerClass}" />
+ <!-- dev DB settings (used to init rhq-server.properties if dev profile is active or developer prop is set) -->
+ <property name="rhq.dev.ds.connection-url" value="${rhq.dev.ds.connection-url}" />
+ <property name="rhq.dev.ds.driver-class" value="${rhq.dev.ds.driver-class}" />
+ <property name="rhq.dev.ds.xa-datasource-class" value="${rhq.dev.ds.xa-datasource-class}" />
+ <property name="rhq.dev.ds.user-name" value="${rhq.dev.ds.user-name}" />
+ <property name="rhq.dev.ds.password.encrypted" value="${rhq.dev.ds.password.encrypted}" />
+ <property name="rhq.dev.ds.type-mapping" value="${rhq.dev.ds.type-mapping}" />
+ <property name="rhq.dev.ds.server-name" value="${rhq.dev.ds.server-name}" />
+ <property name="rhq.dev.ds.port" value="${rhq.dev.ds.port}" />
+ <property name="rhq.dev.ds.db-name" value="${rhq.dev.ds.db-name}" />
+ <property name="rhq.dev.ds.hibernate-dialect" value="${rhq.dev.ds.hibernate-dialect}" />
+ <property name="rhq.dev.quartz.driverDelegateClass" value="${rhq.dev.quartz.driverDelegateClass}" />
+ <property name="rhq.dev.quartz.selectWithLockSQL" value="${rhq.dev.quartz.selectWithLockSQL}" />
+ <property name="rhq.dev.quartz.lockHandlerClass" value="${rhq.dev.quartz.lockHandlerClass}" />
<!-- default server settings used by installer -->
<property name="rhq.server.http.port" value="${rhq.server.http.port}" />
@@ -356,4 +356,5 @@
</profiles>
-</project>
\ No newline at end of file
+</project>
+
diff --git a/modules/enterprise/server/container/src/main/scripts/rhq-container.build.xml b/modules/enterprise/server/container/src/main/scripts/rhq-container.build.xml
index a7e313a..f3c37fe 100644
--- a/modules/enterprise/server/container/src/main/scripts/rhq-container.build.xml
+++ b/modules/enterprise/server/container/src/main/scripts/rhq-container.build.xml
@@ -9,8 +9,8 @@
<property name="default.rhq.server.database.driver-class" value="org.postgresql.Driver" />
<property name="default.rhq.server.database.xa-datasource-class" value="org.postgresql.xa.PGXADataSource" />
<property name="default.rhq.server.database.user-name" value="rhqadmin" />
- <!-- NOTE: The below value is "rhqadmin" encrypted. -->
- <property name="default.rhq.server.database.password" value="1eeb2f255e832171df8592078de921bc" />
+ <property name="default.rhq.server.database.password" value="rhqadmin" />
+ <property name="default.rhq.server.database.password.encrypted" value="1eeb2f255e832171df8592078de921bc" />
<property name="default.rhq.server.database.type-mapping" value="PostgreSQL" />
<!-- these are needed for the PostgreSQL XADataSource setup -->
<property name="default.rhq.server.database.server-name" value="127.0.0.1" />
@@ -31,19 +31,19 @@
<target name="set-dev-server-props" if="predeploy">
<echo>*** Using dev database settings in rhq-server.properties...</echo>
- <property name="rhq.server.database.hibernate-dialect" value="${rhq.test.ds.hibernate-dialect}" />
- <property name="rhq.server.database.connection-url" value="${rhq.test.ds.connection-url}" />
- <property name="rhq.server.database.driver-class" value="${rhq.test.ds.driver-class}" />
- <property name="rhq.server.database.xa-datasource-class" value="${rhq.test.ds.xa-datasource-class}" />
- <property name="rhq.server.database.user-name" value="${rhq.test.ds.user-name}" />
- <property name="rhq.server.database.password" value="${rhq.test.ds.password}" />
- <property name="rhq.server.database.type-mapping" value="${rhq.test.ds.type-mapping}" />
- <property name="rhq.server.database.server-name" value="${rhq.test.ds.server-name}" />
- <property name="rhq.server.database.port" value="${rhq.test.ds.port}" />
- <property name="rhq.server.database.db-name" value="${rhq.test.ds.db-name}" />
- <property name="rhq.server.quartz.driverDelegateClass" value="${rhq.test.quartz.driverDelegateClass}" />
- <property name="rhq.server.quartz.selectWithLockSQL" value="${rhq.test.quartz.selectWithLockSQL}" />
- <property name="rhq.server.quartz.lockHandlerClass" value="${rhq.test.quartz.lockHandlerClass}" />
+ <property name="rhq.server.database.hibernate-dialect" value="${rhq.dev.ds.hibernate-dialect}" />
+ <property name="rhq.server.database.connection-url" value="${rhq.dev.ds.connection-url}" />
+ <property name="rhq.server.database.driver-class" value="${rhq.dev.ds.driver-class}" />
+ <property name="rhq.server.database.xa-datasource-class" value="${rhq.dev.ds.xa-datasource-class}" />
+ <property name="rhq.server.database.user-name" value="${rhq.dev.ds.user-name}" />
+ <property name="rhq.server.database.password" value="${rhq.dev.ds.password.encrypted}" />
+ <property name="rhq.server.database.type-mapping" value="${rhq.dev.ds.type-mapping}" />
+ <property name="rhq.server.database.server-name" value="${rhq.dev.ds.server-name}" />
+ <property name="rhq.server.database.port" value="${rhq.dev.ds.port}" />
+ <property name="rhq.server.database.db-name" value="${rhq.dev.ds.db-name}" />
+ <property name="rhq.server.quartz.driverDelegateClass" value="${rhq.dev.quartz.driverDelegateClass}" />
+ <property name="rhq.server.quartz.selectWithLockSQL" value="${rhq.dev.quartz.selectWithLockSQL}" />
+ <property name="rhq.server.quartz.lockHandlerClass" value="${rhq.dev.quartz.lockHandlerClass}" />
</target>
<target name="set-default-server-props" unless="predeploy">
@@ -53,7 +53,7 @@
<property name="rhq.server.database.driver-class" value="${default.rhq.server.database.driver-class}" />
<property name="rhq.server.database.xa-datasource-class" value="${default.rhq.server.database.xa-datasource-class}" />
<property name="rhq.server.database.user-name" value="${default.rhq.server.database.user-name}" />
- <property name="rhq.server.database.password" value="${default.rhq.server.database.password}" />
+ <property name="rhq.server.database.password" value="${default.rhq.server.database.password.encrypted}" />
<property name="rhq.server.database.type-mapping" value="${default.rhq.server.database.type-mapping}" />
<property name="rhq.server.database.server-name" value="${default.rhq.server.database.server-name}" />
<property name="rhq.server.database.port" value="${default.rhq.server.database.port}" />
@@ -164,7 +164,7 @@
</not>
</condition>
- </target>
+ </target>
<target name="prepare-container"
depends="prepare-web-services-1,
@@ -212,8 +212,8 @@
<echo>Running upgrade script for JBossWS ${jbossws-native-dist.version} </echo>
<ant antfile="${basedir}/target/${jboss-native-dir}/build.xml" target="deploy-jboss423" dir="${basedir}/target/${jboss-native-dir}" />
- <echo> </echo>
- <echo>Installing safe ejb3 web invoker ...</echo>
+ <echo/>
+ <echo>Installing safe ejb3 web invoker ...</echo>
<delete verbose="true">
<fileset dir="${jboss.deploy.dir}/jbossws.sar">
<include name="safe-invoker*" />
@@ -272,7 +272,7 @@
<fileset dir="${jboss.deploy.dir}/jms">
<include name="jbossmq-destinations-service.xml" />
<include name="uil2-service.xml" />
- <include name="hsqldb-jdbc2-service.xml" /> <!-- no longer use Hypersonic for JMS backend -->
+ <include name="hsqldb-jdbc2-service.xml" /> <!-- no longer use Hypersonic for JMS backend -->
</fileset>
</delete>
@@ -329,16 +329,16 @@
<echo>Deploying installer webapp ...</echo>
<mkdir dir="${jboss.deploy.dir}/rhq-installer.war" />
- <unwar src="${settings.localRepository}/org/rhq/rhq-installer/${rhq.version}/rhq-installer-${rhq.version}.war"
- dest="${jboss.deploy.dir}/rhq-installer.war" />
+ <unwar src="${settings.localRepository}/org/rhq/rhq-installer/${rhq.version}/rhq-installer-${rhq.version}.war"
+ dest="${jboss.deploy.dir}/rhq-installer.war" />
<echo>Deploying embedded agent sar ...</echo>
- <unjar src="${settings.localRepository}/org/rhq/rhq-enterprise-server-agent-sar/${rhq.version}/rhq-enterprise-server-agent-sar-${rhq.version}.sar"
- dest="${jboss.deploy.dir}/rhq-agent.sar" />
+ <unjar src="${settings.localRepository}/org/rhq/rhq-enterprise-server-agent-sar/${rhq.version}/rhq-enterprise-server-agent-sar-${rhq.version}.sar"
+ dest="${jboss.deploy.dir}/rhq-agent.sar" />
<echo>Deploying RT filter jar ...</echo>
- <copy file="${settings.localRepository}/org/rhq/rhq-rtfilter/${rhq.version}/rhq-rtfilter-${rhq.version}.jar"
- todir="${jboss.home}/server/default/lib" verbose="true" />
+ <copy file="${settings.localRepository}/org/rhq/rhq-rtfilter/${rhq.version}/rhq-rtfilter-${rhq.version}.jar"
+ todir="${jboss.home}/server/default/lib" verbose="true" />
<!-- Delete docs dir and README files... -->
<delete dir="${jboss.home}/docs" />
@@ -354,17 +354,17 @@
<!-- deploy the agent update binary to the downloads location -->
<echo>Deploying the latest agent update binary and renaming it rhq-enterprise-agent-${rhq.version}.jar</echo>
- <copy file="${settings.localRepository}/org/rhq/rhq-enterprise-agentupdate/${rhq.version}/rhq-enterprise-agentupdate-${rhq.version}.jar"
- tofile="${jboss.deploy.dir}/${rhq.earName}/rhq-downloads/rhq-agent/rhq-enterprise-agent-${rhq.version}.jar"
- verbose="true"
- failonerror="true"/>
+ <copy file="${settings.localRepository}/org/rhq/rhq-enterprise-agentupdate/${rhq.version}/rhq-enterprise-agentupdate-${rhq.version}.jar"
+ tofile="${jboss.deploy.dir}/${rhq.earName}/rhq-downloads/rhq-agent/rhq-enterprise-agent-${rhq.version}.jar"
+ verbose="true"
+ failonerror="true"/>
<!-- deploy the remote client binary to the downloads location. -->
<echo>Deploying the latest remote client binary</echo>
- <copy file="${settings.localRepository}/org/rhq/rhq-remoting-cli/${rhq.version}/rhq-remoting-cli-${rhq.version}.zip"
- tofile="${jboss.deploy.dir}/${rhq.earName}/rhq-downloads/rhq-client/rhq-remoting-cli-${rhq.version}.zip"
- verbose="true"
- failonerror="false"/>
+ <copy file="${settings.localRepository}/org/rhq/rhq-remoting-cli/${rhq.version}/rhq-remoting-cli-${rhq.version}.zip"
+ tofile="${jboss.deploy.dir}/${rhq.earName}/rhq-downloads/rhq-client/rhq-remoting-cli-${rhq.version}.zip"
+ verbose="true"
+ failonerror="false"/>
<!-- optionally package the connectors -->
<antcall target="package-connectors" />
@@ -895,3 +895,4 @@ rhq.autoinstall.public-endpoint-address=
</target>
</project>
+
diff --git a/pom.xml b/pom.xml
index 562120a..b3f59cc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -80,7 +80,7 @@
<quartz.version>1.6.5</quartz.version>
<jna.version>3.2.2</jna.version>
- <!-- defaults for datasource used by dbsetup, unit+integration tests, and dev container build -
+ <!-- defaults for datasource used by integration tests -
these may be overridden in ~/.m2/settings.xml -->
<rhq.test.ds.connection-url>jdbc:postgresql://127.0.0.1:5432/rhq</rhq.test.ds.connection-url>
<rhq.test.ds.driver-class>org.postgresql.Driver</rhq.test.ds.driver-class>
@@ -96,6 +96,23 @@
<rhq.test.quartz.selectWithLockSQL>SELECT * FROM {0}LOCKS ROWLOCK WHERE LOCK_NAME = ? FOR UPDATE</rhq.test.quartz.selectWithLockSQL>
<rhq.test.quartz.lockHandlerClass>org.quartz.impl.jdbcjobstore.StdRowLockSemaphore</rhq.test.quartz.lockHandlerClass>
+ <!-- defaults for datasource used by the dev container build (see dev docs on the 'dev' profile) -
+ these may be overridden in ~/.m2/settings.xml -->
+ <rhq.dev.ds.connection-url>jdbc:postgresql://127.0.0.1:5432/rhqdev</rhq.dev.ds.connection-url>
+ <rhq.dev.ds.driver-class>org.postgresql.Driver</rhq.dev.ds.driver-class>
+ <rhq.dev.ds.xa-datasource-class>org.postgresql.xa.PGXADataSource</rhq.dev.ds.xa-datasource-class>
+ <rhq.dev.ds.user-name>rhqadmin</rhq.dev.ds.user-name>
+ <rhq.dev.ds.password>rhqadmin</rhq.dev.ds.password>
+ <rhq.dev.ds.password.encrypted>1eeb2f255e832171df8592078de921bc</rhq.dev.ds.password.encrypted>
+ <rhq.dev.ds.type-mapping>PostgreSQL</rhq.dev.ds.type-mapping>
+ <rhq.dev.ds.server-name>127.0.0.1</rhq.dev.ds.server-name>
+ <rhq.dev.ds.port>5432</rhq.dev.ds.port>
+ <rhq.dev.ds.db-name>rhqdev</rhq.dev.ds.db-name>
+ <rhq.dev.ds.hibernate-dialect>org.hibernate.dialect.PostgreSQLDialect</rhq.dev.ds.hibernate-dialect>
+ <rhq.dev.quartz.driverDelegateClass>org.quartz.impl.jdbcjobstore.PostgreSQLDelegate</rhq.dev.quartz.driverDelegateClass>
+ <rhq.dev.quartz.selectWithLockSQL>SELECT * FROM {0}LOCKS ROWLOCK WHERE LOCK_NAME = ? FOR UPDATE</rhq.dev.quartz.selectWithLockSQL>
+ <rhq.dev.quartz.lockHandlerClass>org.quartz.impl.jdbcjobstore.StdRowLockSemaphore</rhq.dev.quartz.lockHandlerClass>
+
<!-- default port numbers for RHQ server -->
<rhq.server.http.port>7080</rhq.server.http.port>
<rhq.server.https.port>7443</rhq.server.https.port>
@@ -744,7 +761,7 @@
<execution>
<id>enforce-versions</id>
<goals>
- <goal>enforce-once</goal>
+ <goal>enforce</goal>
</goals>
<configuration>
<rules>
commit b1a26f14dcbabcbf34f76647a705376958784676
Merge: 0a830f2... b1a907f...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 31 18:22:08 2010 -0400
Merge branch 'gwt-jay' into gwt
commit b1a907fd8877c8cc483ba1d2dd5ac8c91a5bc4ce
Merge: 5e4feb1... ab70b6f...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 31 17:46:52 2010 -0400
Merge branch 'master' into gwt-jay
Conflicts:
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/subscription.xhtml
commit 5e4feb14930798edbb51fc04d8d188ed8c45c838
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 31 17:46:18 2010 -0400
LT commit
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/subscription.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/subscription.xhtml
index 01ef108..e0462ad 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/subscription.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/subscription.xhtml
@@ -1,263 +1,263 @@
-<?xml version="1.0"?>
-
-<!DOCTYPE html
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:c="http://java.sun.com/jstl/core"
- xmlns:onc="http://jboss.org/on/component"
- xmlns:onf="http://jboss.org/on/function"
- xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
- xmlns:rich="http://richfaces.ajax4jsf.org/rich">
-
-<ui:composition template="/rhq/resource/layout/main.xhtml">
-
+<?xml version="1.0"?>
+
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:onc="http://jboss.org/on/component"
+ xmlns:onf="http://jboss.org/on/function"
+ xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+
+<ui:composition template="/rhq/resource/layout/main.xhtml">
+
<ui:param name="pageTitle" value="View Repo Subscriptions for Resource '#{ResourceUIBean.name}'"/>
- <ui:param name="selectedTabName" value="Content.Subscriptions"/>
-
- <ui:define name="content">
-
- <!-- CURRENT REPOS -->
+ <ui:param name="selectedTabName" value="Content.Subscriptions"/>
+
+ <ui:define name="content">
+
+ <!-- CURRENT REPOS -->
<h:form id="currentRepoForm">
- <input type="hidden" name="id" value="${param.id}"/>
-
- <rich:panel styleClass="BlockContent">
- <f:facet name="header"><h:outputText value="Current Resource Subscriptions"/></f:facet>
+ <input type="hidden" name="id" value="${param.id}"/>
+
+ <rich:panel styleClass="BlockContent">
+ <f:facet name="header"><h:outputText value="Current Resource Subscriptions"/></f:facet>
<a4j:keepAlive beanName="ResourceReposUIBean"/>
-
+
<ui:param name="resourceReposDataModel" value="#{ResourceReposUIBean.dataModel}"/>
<rich:dataTable id="resourceReposDataTable"
rows="#{PageControl.ResourceReposList.pageSize}"
value="#{resourceReposDataModel}"
- var="item"
- width="100%"
- columnsWidth="1%, 25%, 40%, 5%, 15%, 15%"
- headerClass="tableRowHeader"
- footerClass="on-pager-footer"
- onRowMouseOver="this.style.backgroundColor='#E7E7E7'"
- onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
-
- <f:facet name="PageControlView">
+ var="item"
+ width="100%"
+ columnsWidth="1%, 25%, 40%, 5%, 15%, 15%"
+ headerClass="tableRowHeader"
+ footerClass="on-pager-footer"
+ onRowMouseOver="this.style.backgroundColor='#E7E7E7'"
+ onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
+
+ <f:facet name="PageControlView">
<onc:paginationControl id="ResourceReposList" />
- </f:facet>
-
- <rich:column>
- <f:facet name="header">
+ </f:facet>
+
+ <rich:column>
+ <f:facet name="header">
<onc:allSelect target="selectedResourceRepos" />
- </f:facet>
-
+ </f:facet>
+
<onc:select name="selectedResourceRepos" value="#{item.repo.id}"/>
- </rich:column>
-
- <rich:column>
- <f:facet name="header">
- <onc:sortableColumnHeader sort="c.name">
- <h:outputText styleClass="headerText" value="Name" />
- </onc:sortableColumnHeader>
- </f:facet>
-
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="c.name">
+ <h:outputText styleClass="headerText" value="Name" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
<h:outputLink value="/rhq/content/repo.xhtml">
- <f:param name="mode" value="view"/>
+ <f:param name="mode" value="view"/>
<f:param name="id" value="#{item.repo.id}"/>
<h:outputText value="#{item.repo.name}" />
- </h:outputLink>
- </rich:column>
-
- <rich:column>
- <f:facet name="header">
- <h:outputText styleClass="headerText" value="Description" />
- </f:facet>
-
+ </h:outputLink>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Description" />
+ </f:facet>
+
<h:outputText value="#{item.repo.description}"/>
- </rich:column>
-
- <rich:column>
- <f:facet name="header">
- <onc:sortableColumnHeader sort="COUNT(pv)">
- <h:outputText styleClass="headerText" value="Package Count" />
- </onc:sortableColumnHeader>
- </f:facet>
-
- <h:outputText value="#{item.packageVersionCount}" />
- </rich:column>
-
- <rich:column>
- <f:facet name="header">
- <onc:sortableColumnHeader sort="c.creationDate">
- <h:outputText styleClass="headerText" value="Created" />
- </onc:sortableColumnHeader>
- </f:facet>
-
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="COUNT(pv)">
+ <h:outputText styleClass="headerText" value="Package Count" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.packageVersionCount}" />
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="c.creationDate">
+ <h:outputText styleClass="headerText" value="Created" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
<h:outputText value="#{item.repo.creationDate}">
- <f:convertDateTime pattern="M/d/yy, h:mm:ss aa, zzz" timeZone="#{ServerInfoUIBean.timeZone}"/>
- </h:outputText>
- </rich:column>
-
- <rich:column>
- <f:facet name="header">
- <onc:sortableColumnHeader sort="c.lastModifiedDate">
- <h:outputText styleClass="headerText" value="Last Modified" />
- </onc:sortableColumnHeader>
- </f:facet>
-
+ <f:convertDateTime pattern="M/d/yy, h:mm:ss aa, zzz" timeZone="#{ServerInfoUIBean.timeZone}"/>
+ </h:outputText>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="c.lastModifiedDate">
+ <h:outputText styleClass="headerText" value="Last Modified" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
<h:outputText value="#{item.repo.lastModifiedDate}">
- <f:convertDateTime pattern="M/d/yy, h:mm:ss aa, zzz" timeZone="#{ServerInfoUIBean.timeZone}"/>
- </h:outputText>
- </rich:column>
-
- <f:facet name="footer">
- <rich:columnGroup>
- <rich:column colspan="6" width="100%">
+ <f:convertDateTime pattern="M/d/yy, h:mm:ss aa, zzz" timeZone="#{ServerInfoUIBean.timeZone}"/>
+ </h:outputText>
+ </rich:column>
+
+ <f:facet name="footer">
+ <rich:columnGroup>
+ <rich:column colspan="6" width="100%">
<onc:selectCommandButton action="#{ResourceReposUIBean.deleteSelectedResourceRepos}"
- value="REMOVE SUBSCRIPTIONS"
+ value="REMOVE SUBSCRIPTIONS"
target="selectedResourceRepos"
- styleClass="on-pager-button buttonsmall"
- rendered="${GlobalPermissionsUIBean.inventory}"/>
-
- <ui:include src="/rhq/resource/include/pagination.xhtml">
+ styleClass="on-pager-button buttonsmall"
+ rendered="${GlobalPermissionsUIBean.inventory}"/>
+
+ <ui:include src="/rhq/resource/include/pagination.xhtml">
<ui:param name="paginationDataTableName" value="resourceReposDataTable"/>
<ui:param name="paginationDataModel" value="#{resourceReposDataModel}"/>
<ui:param name="paginationPageControl" value="#{PageControl.ResourceReposList}"/>
- </ui:include>
- </rich:column>
- </rich:columnGroup>
- </f:facet>
-
- </rich:dataTable>
-
- </rich:panel>
- </h:form>
-
-
- <!-- AVAILABLE REPOS -->
+ </ui:include>
+ </rich:column>
+ </rich:columnGroup>
+ </f:facet>
+
+ </rich:dataTable>
+
+ </rich:panel>
+ </h:form>
+
+
+ <!-- AVAILABLE REPOS -->
<h:form id="availableRepoForm"
- rendered="${GlobalPermissionsUIBean.inventory}">
- <input type="hidden" name="id" value="${param.id}"/>
- <rich:panel styleClass="BlockContent">
+ rendered="${GlobalPermissionsUIBean.inventory}">
+ <input type="hidden" name="id" value="${param.id}"/>
+ <rich:panel styleClass="BlockContent">
<f:facet name="header"><h:outputText value="Available Repositories"/></f:facet>
-
+
<a4j:keepAlive beanName="AvailableResourceReposUIBean"/>
-
+
<ui:param name="availableResourceReposDataModel" value="#{AvailableResourceReposUIBean.dataModel}"/>
<rich:dataTable id="availableResourceReposDataTable"
rows="#{PageControl.AvailableResourceReposList.pageSize}"
value="#{availableResourceReposDataModel}"
- var="item"
- width="100%"
- columnsWidth="1%, 25%, 40%, 5%, 15%, 15%"
- headerClass="tableRowHeader"
- footerClass="on-pager-footer"
- onRowMouseOver="this.style.backgroundColor='#E7E7E7'"
- onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
-
- <f:facet name="PageControlView">
+ var="item"
+ width="100%"
+ columnsWidth="1%, 25%, 40%, 5%, 15%, 15%"
+ headerClass="tableRowHeader"
+ footerClass="on-pager-footer"
+ onRowMouseOver="this.style.backgroundColor='#E7E7E7'"
+ onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
+
+ <f:facet name="PageControlView">
<onc:paginationControl id="AvailableResourceReposList" />
- </f:facet>
-
- <rich:column>
- <f:facet name="header">
+ </f:facet>
+
+ <rich:column>
+ <f:facet name="header">
<onc:allSelect target="selectedAvailableResourceRepos" />
- </f:facet>
-
+ </f:facet>
+
<onc:select name="selectedAvailableResourceRepos" value="#{item.repo.id}"/>
- </rich:column>
-
- <rich:column>
- <f:facet name="header">
- <onc:sortableColumnHeader sort="c.name">
- <h:outputText styleClass="headerText" value="Name" />
- </onc:sortableColumnHeader>
- </f:facet>
-
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="c.name">
+ <h:outputText styleClass="headerText" value="Name" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
<h:outputLink value="/rhq/content/repo.xhtml">
- <f:param name="mode" value="view"/>
+ <f:param name="mode" value="view"/>
<f:param name="id" value="#{item.repo.id}"/>
<h:outputText value="#{item.repo.name}" />
- </h:outputLink>
- </rich:column>
-
- <rich:column>
- <f:facet name="header">
- <h:outputText styleClass="headerText" value="Description" />
- </f:facet>
-
+ </h:outputLink>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Description" />
+ </f:facet>
+
<h:outputText value="#{item.repo.description}"/>
- </rich:column>
-
- <rich:column>
- <f:facet name="header">
- <onc:sortableColumnHeader sort="COUNT(pv)">
- <h:outputText styleClass="headerText" value="Package Count" />
- </onc:sortableColumnHeader>
- </f:facet>
-
- <h:outputText value="#{item.packageVersionCount}" />
- </rich:column>
-
- <rich:column>
- <f:facet name="header">
- <onc:sortableColumnHeader sort="c.creationDate">
- <h:outputText styleClass="headerText" value="Created" />
- </onc:sortableColumnHeader>
- </f:facet>
-
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="COUNT(pv)">
+ <h:outputText styleClass="headerText" value="Package Count" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.packageVersionCount}" />
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="c.creationDate">
+ <h:outputText styleClass="headerText" value="Created" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
<h:outputText value="#{item.repo.creationDate}">
- <f:convertDateTime pattern="M/d/yy, h:mm:ss aa, zzz" timeZone="#{ServerInfoUIBean.timeZone}"/>
- </h:outputText>
- </rich:column>
-
- <rich:column>
- <f:facet name="header">
- <onc:sortableColumnHeader sort="c.lastModifiedDate">
- <h:outputText styleClass="headerText" value="Last Modified" />
- </onc:sortableColumnHeader>
- </f:facet>
-
+ <f:convertDateTime pattern="M/d/yy, h:mm:ss aa, zzz" timeZone="#{ServerInfoUIBean.timeZone}"/>
+ </h:outputText>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="c.lastModifiedDate">
+ <h:outputText styleClass="headerText" value="Last Modified" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
<h:outputText value="#{item.repo.lastModifiedDate}">
- <f:convertDateTime pattern="M/d/yy, h:mm:ss aa, zzz" timeZone="#{ServerInfoUIBean.timeZone}"/>
- </h:outputText>
- </rich:column>
-
- <f:facet name="footer">
- <rich:columnGroup>
- <rich:column colspan="6" width="100%">
+ <f:convertDateTime pattern="M/d/yy, h:mm:ss aa, zzz" timeZone="#{ServerInfoUIBean.timeZone}"/>
+ </h:outputText>
+ </rich:column>
+
+ <f:facet name="footer">
+ <rich:columnGroup>
+ <rich:column colspan="6" width="100%">
<onc:selectCommandButton action="#{AvailableResourceReposUIBean.subscribeSelectedResourceRepos}"
- value="ADD SUBSCRIPTIONS"
+ value="ADD SUBSCRIPTIONS"
target="selectedAvailableResourceRepos"
- styleClass="on-pager-button buttonsmall"
- rendered="${GlobalPermissionsUIBean.inventory}"/>
-
- <ui:include src="/rhq/resource/include/pagination.xhtml">
+ styleClass="on-pager-button buttonsmall"
+ rendered="${GlobalPermissionsUIBean.inventory}"/>
+
+ <ui:include src="/rhq/resource/include/pagination.xhtml">
<ui:param name="paginationDataTableName" value="availableResourceReposDataTable"/>
<ui:param name="paginationDataModel" value="#{availableResourceReposDataModel}"/>
<ui:param name="paginationPageControl" value="#{PageControl.AvailableResourceReposList}"/>
- </ui:include>
- </rich:column>
- </rich:columnGroup>
- </f:facet>
-
- </rich:dataTable>
-
- </rich:panel>
-
- <ui:remove><!-- The package mode isn't returning enough data to differentiate it from the new subtab, so
- disabling it for now until we decide if this is needed. --></ui:remove>
- <!--
- <p align="center">
- <h:outputLink value="/rhq/resource/content/subscription_packages.xhtml">
- <f:param name="id" value="${param.id}"/>
- <h:outputText value="Switch To Package Mode" />
- </h:outputLink>
- </p>
- -->
-
- </h:form>
-
- </ui:define>
-</ui:composition>
-
-</html>
+ </ui:include>
+ </rich:column>
+ </rich:columnGroup>
+ </f:facet>
+
+ </rich:dataTable>
+
+ </rich:panel>
+
+ <ui:remove><!-- The package mode isn't returning enough data to differentiate it from the new subtab, so
+ disabling it for now until we decide if this is needed. --></ui:remove>
+ <!--
+ <p align="center">
+ <h:outputLink value="/rhq/resource/content/subscription_packages.xhtml">
+ <f:param name="id" value="${param.id}"/>
+ <h:outputText value="Switch To Package Mode" />
+ </h:outputLink>
+ </p>
+ -->
+
+ </h:form>
+
+ </ui:define>
+</ui:composition>
+
+</html>
commit 0a830f22ba3c81d74b11264ee28ac3f870543e8c
Merge: 6bc7cb3... d9c400d...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 31 17:34:34 2010 -0400
Merge branch 'gwt-jay' into gwt
commit d9c400da11052832f2842232c54791052b7289fd
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 31 17:34:03 2010 -0400
A change in the Bundle constructor to include the required Repo and
PackageType. This is a safer way to go and is part of fixing up
some domain tests.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/Bundle.java b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/Bundle.java
index 261a54e..1a59123 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/Bundle.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/Bundle.java
@@ -101,14 +101,11 @@ public class Bundle implements Serializable {
// for JPA use
}
- public Bundle(String name, BundleType type) {
+ public Bundle(String name, BundleType type, Repo repo, PackageType packageType) {
setName(name);
setBundleType(type);
- // add implicit Repo
- Repo repo = new Repo(name);
- repo.setCandidate(false);
- repo.setSyncSchedule(null);
setRepo(repo);
+ setPackageType(packageType);
}
public int getId() {
diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/bundle/test/BundleTest.java b/modules/core/domain/src/test/java/org/rhq/core/domain/bundle/test/BundleTest.java
index 2004766..7e041ab 100644
--- a/modules/core/domain/src/test/java/org/rhq/core/domain/bundle/test/BundleTest.java
+++ b/modules/core/domain/src/test/java/org/rhq/core/domain/bundle/test/BundleTest.java
@@ -36,6 +36,8 @@ import org.rhq.core.domain.bundle.BundleVersionRepo;
import org.rhq.core.domain.bundle.BundleVersionRepoPK;
import org.rhq.core.domain.content.Distribution;
import org.rhq.core.domain.content.DistributionType;
+import org.rhq.core.domain.content.PackageCategory;
+import org.rhq.core.domain.content.PackageType;
import org.rhq.core.domain.content.Repo;
import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.ResourceType;
@@ -67,12 +69,8 @@ public class BundleTest extends AbstractEJB3Test {
assert q.getResultList().size() == 0 : "should not have repo2 mapping in the db yet";
BundleType bundleType = createBundleType(em, name + "-Type", createResourceType(em));
+ Bundle bundle = createBundle(em, name + "-Bundle", bundleType);
- Repo bundleRepo = new Repo(name + "-Bundle");
- em.persist(bundleRepo);
- Bundle bundle = new Bundle(name + "-Bundle", bundleType);
- bundle.setRepo(bundleRepo);
- em.persist(bundle);
BundleVersion bundleVersion = new BundleVersion(name, "1.0.0.BETA", bundle, recipe);
bundleVersion.setVersionOrder(0);
em.persist(bundleVersion);
@@ -133,13 +131,8 @@ public class BundleTest extends AbstractEJB3Test {
String name = "BundleTest-testBundleVersion";
String recipe = "action/script/recipe is here";
- Repo repo1 = new Repo(name + "-Repo1");
- em.persist(repo1);
-
BundleType bundleType = createBundleType(em, name + "-Type", createResourceType(em));
- Bundle bundle = new Bundle(name + "-Bundle", bundleType);
- bundle.setRepo(repo1);
- em.persist(bundle);
+ Bundle bundle = createBundle(em, name + "-Bundle", bundleType);
id = bundle.getId();
assert id > 0;
assert bundle.getBundleType().getId() != 0 : "bundleType should have been cascade persisted too";
@@ -207,12 +200,15 @@ public class BundleTest extends AbstractEJB3Test {
assert q.getResultList().size() == 1;
bundle = (Bundle) q.getSingleResult();
bundleType = bundle.getBundleType();
+ Repo repo = bundle.getRepo();
em.remove(bundle);
- em.remove(bundleType);
+ em.remove(repo);
+
+ deleteResourceType(em, bundleType.getResourceType());
+
assert q.getResultList().size() == 0 : "didn't clean up test bundle";
assert em.find(BundleType.class, bundleType.getId()) == null : "didn't clean up bundle type";
- deleteResourceType(em, bundleType.getResourceType());
em.close();
} catch (Throwable t) {
@@ -232,13 +228,8 @@ public class BundleTest extends AbstractEJB3Test {
String name = "BundleTest-testMultipleBundleVersions";
String recipe = "action/script/recipe is here";
- Repo repo1 = new Repo(name + "-Repo1");
- em.persist(repo1);
-
BundleType bundleType = createBundleType(em, name + "-Type", createResourceType(em));
- Bundle bundle = new Bundle(name + "-Bundle", bundleType);
- bundle.setRepo(repo1);
- em.persist(bundle);
+ Bundle bundle = createBundle(em, name + "-Bundle", bundleType);
id = bundle.getId();
assert id > 0;
assert bundle.getBundleType().getId() != 0 : "bundleType should have been cascade persisted too";
@@ -350,25 +341,19 @@ public class BundleTest extends AbstractEJB3Test {
try {
int id;
- String name = "BundleTest-testBundle";
+ String name = "BundleTest-testBundle-Bundle";
Query q = em.createNamedQuery(Bundle.QUERY_FIND_BY_NAME);
q.setParameter("name", name);
assert q.getResultList().size() == 0; // not in the db yet
BundleType bundleType = createBundleType(em, name + "-Type", createResourceType(em));
-
- Repo bundleRepo = new Repo(name);
- em.persist(bundleRepo);
-
- Bundle b = new Bundle(name, bundleType);
- b.setRepo(bundleRepo);
- em.persist(b);
+ Bundle b = createBundle(em, name, bundleType);
id = b.getId();
assert id > 0;
assert b.getBundleType().getId() != 0 : "bundleType should have been persisted independently";
assert b.getRepo().getId() != 0 : "bundle's repo should have been cascade persisted with the bundle";
- assert name.equals(b.getRepo().getName()) : "bundle's repo should have same name as bundle";
+ assert b.getName().equals(b.getRepo().getName()) : "bundle's repo should have same name as bundle";
q = em.createNamedQuery(Bundle.QUERY_FIND_BY_NAME);
q.setParameter("name", name);
@@ -483,6 +468,22 @@ public class BundleTest extends AbstractEJB3Test {
return bt;
}
+ private Bundle createBundle(EntityManager em, String name, BundleType bt) throws Exception {
+ // implicit Bundle'sRepo
+ Repo repo = new Repo(name);
+ repo.setCandidate(false);
+ repo.setSyncSchedule(null);
+ em.persist(repo);
+
+ // Bundle's packageType
+ PackageType pt = new PackageType(name, bt.getResourceType());
+ pt.setCategory(PackageCategory.BUNDLE);
+
+ Bundle bundle = new Bundle(name, bt, repo, pt);
+ em.persist(bundle);
+ return bundle;
+ }
+
private ResourceType deleteResourceType(EntityManager em, ResourceType rt) {
rt = em.find(ResourceType.class, rt.getId());
em.remove(rt);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
index ec2e788..642c843 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
@@ -142,16 +142,12 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
throw new IllegalArgumentException("Invalid bundleTypeId: " + bundleTypeId);
}
- Bundle bundle = new Bundle(name, bundleType);
- bundle.setDescription(description);
-
// create and add the required Repo. the Repo is a detached object which helps in its eventual
// removal.
Repo repo = new Repo(name);
repo.setCandidate(false);
repo.setSyncSchedule(null);
repo = repoManager.createRepo(subject, repo);
- bundle.setRepo(repo);
// add the required PackageType. the PackageType is an attached object which helps in cascade removal
// of packages in the bundle's repo.
@@ -164,6 +160,9 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
packageType.setDiscoveryInterval(-1L);
packageType.setCreationData(false);
packageType.setDeploymentConfigurationDefinition(null);
+
+ Bundle bundle = new Bundle(name, bundleType, repo, packageType);
+ bundle.setDescription(description);
bundle.setPackageType(packageType);
log.info("Creating bundle: " + bundle);
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
index 427714b..e9594f4 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
@@ -176,7 +176,7 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
em.remove(em.getReference(BundleDeployDefinition.class, ((BundleDeployDefinition) removeMe).getId()));
}
- // remove bundles which cascade remove repos and packageTypes
+ // remove bundles which cascade remove packageTypes
// packagetypes cascade remove packages
// package cascade remove packageversions
q = em.createQuery("SELECT b FROM Bundle b WHERE b.name LIKE '" + TEST_PREFIX + "%'");
@@ -204,7 +204,8 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
for (Object removeMe : doomed) {
em.remove(em.getReference(PackageType.class, ((PackageType) removeMe).getId()));
}
- // remove any orphaned repos
+
+ // remove repos no longer referenced by bundles
q = em.createQuery("SELECT r FROM Repo r WHERE r.name LIKE '" + TEST_PREFIX + "%'");
doomed = q.getResultList();
for (Object removeMe : doomed) {
diff --git a/modules/plugins/ant-bundle/src/test/java/org/rhq/plugins/ant/AntBundlePluginComponentTest.java b/modules/plugins/ant-bundle/src/test/java/org/rhq/plugins/ant/AntBundlePluginComponentTest.java
index 4f2f28b..07c48fc 100644
--- a/modules/plugins/ant-bundle/src/test/java/org/rhq/plugins/ant/AntBundlePluginComponentTest.java
+++ b/modules/plugins/ant-bundle/src/test/java/org/rhq/plugins/ant/AntBundlePluginComponentTest.java
@@ -38,6 +38,8 @@ import org.rhq.core.domain.bundle.BundleType;
import org.rhq.core.domain.bundle.BundleVersion;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.content.PackageType;
+import org.rhq.core.domain.content.Repo;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.ResourceType;
@@ -81,7 +83,9 @@ public class AntBundlePluginComponentTest {
public void testSimpleBundle() throws Exception {
ResourceType resourceType = new ResourceType("testSimpleBundle", "plugin", ResourceCategory.SERVER, null);
BundleType bundleType = new BundleType("testSimpleBundle", resourceType);
- Bundle bundle = new Bundle("testSimpleBundle", bundleType);
+ Repo repo = new Repo("testSimpleBundle");
+ PackageType packageType = new PackageType("testSimpleBundle", resourceType);
+ Bundle bundle = new Bundle("testSimpleBundle", bundleType, repo, packageType);
BundleVersion bundleVersion = new BundleVersion("testSimpleBundle", "1.0", bundle,
getRecipeFromFile("simple-build.xml"));
@@ -107,7 +111,9 @@ public class AntBundlePluginComponentTest {
public void testAntBundle() throws Exception {
ResourceType resourceType = new ResourceType("testSimpleBundle", "plugin", ResourceCategory.SERVER, null);
BundleType bundleType = new BundleType("testSimpleBundle", resourceType);
- Bundle bundle = new Bundle("testSimpleBundle", bundleType);
+ Repo repo = new Repo("testSimpleBundle");
+ PackageType packageType = new PackageType("testSimpleBundle", resourceType);
+ Bundle bundle = new Bundle("testSimpleBundle", bundleType, repo, packageType);
BundleVersion bundleVersion = new BundleVersion("testSimpleBundle", "1.0", bundle,
getRecipeFromFile("test-build.xml"));
@@ -141,7 +147,9 @@ public class AntBundlePluginComponentTest {
assert props.getProperty("f.exists").equals("true") : props;
assert props.getProperty("pkg.exists").equals("true") : props;
assert props.getProperty("hostname").equals(SystemInfoFactory.createSystemInfo().getHostname()) : props;
- assert props.getProperty("tmpdir").equals(System.getProperty("java.io.tmpdir")) : props;
+ String javaIoTmpDir = System.getProperty("java.io.tmpdir");
+ String val = props.getProperty("tmpdir");
+ assert val.equals(javaIoTmpDir) : props;
}
private void assertResultsSuccess(BundleDeployResult results) {
commit 041c4a4f1f0131eded7795941af36f20179d9590
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 31 17:32:12 2010 -0400
**MAZZ REVIEW** Escape backslashes in properties being sent to Ant. I'm not
positive about this but in the tests the props are echoed to a file and
when read in via Properties.load() the backslashes are eaten. This solves
that problem but is it the right thing to do?
diff --git a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/AntLauncher.java b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/AntLauncher.java
index 86e397f..cd18395 100644
--- a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/AntLauncher.java
+++ b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/AntLauncher.java
@@ -94,7 +94,10 @@ public class AntLauncher {
if (properties != null) {
for (Map.Entry<Object, Object> property : properties.entrySet()) {
- project.setProperty(property.getKey().toString(), property.getValue().toString());
+ // On the assumption that these properties will be slurped in via Properties.load we
+ // need to escape backslashes to have them treated as literals
+ project.setProperty(property.getKey().toString(), property.getValue().toString().replace("\\",
+ "\\\\"));
}
}
commit ab70b6f2369183dba274e3cf713b23f319b4695a
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Mar 31 21:07:13 2010 +0200
Revert navigation to the struts-based alert-configuration
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/listAlertTemplates.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/listAlertTemplates.xhtml
index 2f30a9c..3f94eca 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/listAlertTemplates.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/listAlertTemplates.xhtml
@@ -92,7 +92,8 @@
</onc:sortableColumnHeader>
</f:facet>
- <h:outputLink value="/rhq/resource/alert/viewAlert.xhtml">
+ <h:outputLink value="/alerts/Config.do">
+ <f:param name="mode" value="viewRoles"/>
<f:param name="type" value="#{param.type}"/>
<f:param name="ad" value="#{item.id}"/>
<h:outputText value="#{item.name}" />
commit 9a38c1e09b617adb83adf75f450dbd07a707fbb5
Merge: eedc12d... 175a985...
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Mar 31 21:02:28 2010 +0200
Merge branch 'master' of ssh://git.fedorahosted.org/git/rhq/rhq
commit eedc12dcf9b635e9d5bc9d414bd252325ccfe489
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Mar 31 21:02:03 2010 +0200
Revert navigation to the struts-based alert-configuration
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/group/alert/listGroupAlertDefinitions.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/group/alert/listGroupAlertDefinitions.xhtml
index 5768c23..79b6af5 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/group/alert/listGroupAlertDefinitions.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/group/alert/listGroupAlertDefinitions.xhtml
@@ -64,7 +64,8 @@
</onc:sortableColumnHeader>
</f:facet>
- <h:outputLink value="/rhq/resource/alert/viewAlert.xhtml">
+ <h:outputLink value="/alerts/Config.do">
+ <f:param name="mode" value="viewRoles"/>
<f:param name="groupId" value="#{param.groupId}"/>
<f:param name="ad" value="#{item.id}"/>
<h:outputText value="#{item.name}" />
commit 6bc7cb38fcfa35bd5175e50eda94f02d44130a71
Merge: 2417946... 883be24...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 31 13:44:00 2010 -0400
Merge branch 'gwt-jay' into gwt
commit 883be246e15d72714fd72050405dfc60d861af41
Merge: c08d04c... 16f3c0a...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 31 13:43:33 2010 -0400
Merge branch 'master' into gwt-jay
commit 24179466a0ccf6b8d442a4c321eabac814f4bc40
Merge: 5848b67... c08d04c...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 31 13:41:39 2010 -0400
Merge branch 'gwt-jay' into gwt
commit 5848b67876495c2483f5c8f9f7088fbb4d49aede
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 31 13:41:28 2010 -0400
LT commit
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/create.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/create.xhtml
index dfe7cd8..fd72919 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/create.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/create.xhtml
@@ -1,125 +1,125 @@
-<?xml version="1.0"?>
-
-<!DOCTYPE html
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:c="http://java.sun.com/jstl/core"
- xmlns:a4j="http://richfaces.org/a4j"
- xmlns:rich="http://richfaces.ajax4jsf.org/rich">
-
-<ui:composition template="/rhq/resource/layout/main.xhtml">
-
- <ui:param name="pageTitle" value="Upload New Package"/>
- <ui:param name="selectedTabName" value="Content.New"/>
- <ui:define name="content">
-
- <rich:panel id="fileUploadPanel">
- <f:facet name="header">
- <h:outputText value="Package File"/>
- </f:facet>
-
- <h:panelGrid columns="1" width="100%" rendered="${ResourceUIBean.permissions.content}">
- <rich:panel>
- <input type="button"
- class="buttonmed"
- value="UPLOAD FILE..."
- onclick="javascript:open('/rhq/resource/content/file-upload.xhtml', 'uploadwin', 'titlebar=0,toolbar=0,location=0,menubar=0,directories=0,resizable=0,height=160,width=450')"/>
- <rich:spacer width="5" />
- <h:outputText rendered="#{UploadNewPackageUIBean.fileUploaded}"
- value="File Uploaded: #{UploadNewPackageUIBean.fileItem.fileName}"/>
- </rich:panel>
- </h:panelGrid>
-
- <h:outputText rendered="#{!ResourceUIBean.permissions.content}"
- value="You do not have permissions to upload content"/>
-
- </rich:panel>
-
- <h:form id="uploadForm">
- <input type="hidden" name="id" value="${param.id}"/>
-
- <rich:panel rendered="#{CreateNewPackageUIBean.needRequestPackageDetails}">
-
- <f:facet name="header">New Package Details</f:facet>
-
- <input type="hidden" name="newPackage" value="true"/>
-
- <table>
- <tr>
- <td align="right"><b>Name*</b></td>
- <td align="left"><h:inputText value="#{CreateNewPackageUIBean.packageName}"/></td>
- </tr>
- <tr>
- <td align="right"><b>Version*</b></td>
- <td align="left"><h:inputText value="#{CreateNewPackageUIBean.version}"/></td>
- </tr>
- <tr>
- <td align="right"><b>Architecture*</b></td>
- <td align="left">
- <h:selectOneMenu value="#{CreateNewPackageUIBean.selectedArchitectureId}">
- <f:selectItems value="#{CreateNewPackageUIBean.architectures}" />
- </h:selectOneMenu>
- </td>
- </tr>
- <tr>
- <td align="right"><b>Type*</b></td>
- <td align="left">
- <h:selectOneMenu value="#{CreateNewPackageUIBean.selectedPackageTypeId}">
- <f:selectItems value="#{CreateNewPackageUIBean.packageTypes}" />
- </h:selectOneMenu>
- </td>
- </tr>
- </table>
-
- <div class="note-panel"><span class="required-marker-text">*</span><span> denotes a required field.</span></div>
-
- </rich:panel>
-
- <rich:panel>
-
+<?xml version="1.0"?>
+
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+
+<ui:composition template="/rhq/resource/layout/main.xhtml">
+
+ <ui:param name="pageTitle" value="Upload New Package"/>
+ <ui:param name="selectedTabName" value="Content.New"/>
+ <ui:define name="content">
+
+ <rich:panel id="fileUploadPanel">
+ <f:facet name="header">
+ <h:outputText value="Package File"/>
+ </f:facet>
+
+ <h:panelGrid columns="1" width="100%" rendered="${ResourceUIBean.permissions.content}">
+ <rich:panel>
+ <input type="button"
+ class="buttonmed"
+ value="UPLOAD FILE..."
+ onclick="javascript:open('/rhq/resource/content/file-upload.xhtml', 'uploadwin', 'titlebar=0,toolbar=0,location=0,menubar=0,directories=0,resizable=0,height=160,width=450')"/>
+ <rich:spacer width="5" />
+ <h:outputText rendered="#{UploadNewPackageUIBean.fileUploaded}"
+ value="File Uploaded: #{UploadNewPackageUIBean.fileItem.fileName}"/>
+ </rich:panel>
+ </h:panelGrid>
+
+ <h:outputText rendered="#{!ResourceUIBean.permissions.content}"
+ value="You do not have permissions to upload content"/>
+
+ </rich:panel>
+
+ <h:form id="uploadForm">
+ <input type="hidden" name="id" value="${param.id}"/>
+
+ <rich:panel rendered="#{CreateNewPackageUIBean.needRequestPackageDetails}">
+
+ <f:facet name="header">New Package Details</f:facet>
+
+ <input type="hidden" name="newPackage" value="true"/>
+
+ <table>
+ <tr>
+ <td align="right"><b>Name*</b></td>
+ <td align="left"><h:inputText value="#{CreateNewPackageUIBean.packageName}"/></td>
+ </tr>
+ <tr>
+ <td align="right"><b>Version*</b></td>
+ <td align="left"><h:inputText value="#{CreateNewPackageUIBean.version}"/></td>
+ </tr>
+ <tr>
+ <td align="right"><b>Architecture*</b></td>
+ <td align="left">
+ <h:selectOneMenu value="#{CreateNewPackageUIBean.selectedArchitectureId}">
+ <f:selectItems value="#{CreateNewPackageUIBean.architectures}" />
+ </h:selectOneMenu>
+ </td>
+ </tr>
+ <tr>
+ <td align="right"><b>Type*</b></td>
+ <td align="left">
+ <h:selectOneMenu value="#{CreateNewPackageUIBean.selectedPackageTypeId}">
+ <f:selectItems value="#{CreateNewPackageUIBean.packageTypes}" />
+ </h:selectOneMenu>
+ </td>
+ </tr>
+ </table>
+
+ <div class="note-panel"><span class="required-marker-text">*</span><span> denotes a required field.</span></div>
+
+ </rich:panel>
+
+ <rich:panel>
+
<f:facet name="header">Repository</f:facet>
-
+
<p>Select one of the following options describing in which repository the new package should be created.</p>
-
+
<input type="radio" name="repoOption" value="subscribed">Currently Subscribed Repository</input>
- <rich:spacer width="5"/>
+ <rich:spacer width="5"/>
<h:selectOneMenu value="#{CreateNewPackageUIBean.subscribedRepoId}">
<f:selectItems value="#{CreateNewPackageUIBean.subscribedRepos}" />
- </h:selectOneMenu>
- <br/>
+ </h:selectOneMenu>
+ <br/>
<input type="radio" name="repoOption" value="unsubscribed">Existing Repository</input>
- <rich:spacer width="5"/>
+ <rich:spacer width="5"/>
<h:selectOneMenu value="#{CreateNewPackageUIBean.unsubscribedRepoId}">
<f:selectItems value="#{CreateNewPackageUIBean.unsubscribedRepos}" />
- </h:selectOneMenu>
- <br/>
+ </h:selectOneMenu>
+ <br/>
<input type="radio" name="repoOption" value="new">New Repository</input>
<rich:spacer width="5"/><h:inputText value="#{CreateNewPackageUIBean.newRepoName}"/>
-
- </rich:panel>
-
- <h:panelGrid id="buttonGrid" columns="2" styleClass="buttons-table" columnClasses="button-cell">
-
- <h:commandButton style="margin-top: 10px;" value="CONTINUE"
- action="#{CreateNewPackageUIBean.createPackage}" styleClass="buttonmed"
- rendered="#{UploadNewPackageUIBean.fileUploaded}"/>
- <h:commandButton style="margin-top: 10px;" value="CONTINUE"
- disabled="true" styleClass="buttonmed-disabled"
- rendered="#{!UploadNewPackageUIBean.fileUploaded}"/>
-
- <h:commandButton style="margin-top: 10px;" value="CANCEL"
- action="#{CreateNewPackageUIBean.cancel}" styleClass="buttonmed"/>
-
- </h:panelGrid>
-
- </h:form>
-
- </ui:define>
-</ui:composition>
-
-</html>
+
+ </rich:panel>
+
+ <h:panelGrid id="buttonGrid" columns="2" styleClass="buttons-table" columnClasses="button-cell">
+
+ <h:commandButton style="margin-top: 10px;" value="CONTINUE"
+ action="#{CreateNewPackageUIBean.createPackage}" styleClass="buttonmed"
+ rendered="#{UploadNewPackageUIBean.fileUploaded}"/>
+ <h:commandButton style="margin-top: 10px;" value="CONTINUE"
+ disabled="true" styleClass="buttonmed-disabled"
+ rendered="#{!UploadNewPackageUIBean.fileUploaded}"/>
+
+ <h:commandButton style="margin-top: 10px;" value="CANCEL"
+ action="#{CreateNewPackageUIBean.cancel}" styleClass="buttonmed"/>
+
+ </h:panelGrid>
+
+ </h:form>
+
+ </ui:define>
+</ui:composition>
+
+</html>
commit c08d04c186c2346d097a93fdaf42d4a8de18e9bd
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 31 13:37:19 2010 -0400
Avoid Exception by ensuring param is passed.
Protect against spaces in java exe path.
diff --git a/modules/enterprise/server/container/src/main/bin-resources/bin/generate-db-password.bat b/modules/enterprise/server/container/src/main/bin-resources/bin/generate-db-password.bat
index 223c581..147e602 100644
--- a/modules/enterprise/server/container/src/main/bin-resources/bin/generate-db-password.bat
+++ b/modules/enterprise/server/container/src/main/bin-resources/bin/generate-db-password.bat
@@ -48,6 +48,15 @@ if "%RHQ_SERVER_DEBUG%" == "false" (
)
rem ----------------------------------------------------------------------
+rem Ensure password parameter is present
+rem ----------------------------------------------------------------------
+
+if /i "%1"=="" (
+ echo Usage: %0 { plainTextPassword }
+ goto :done
+)
+
+rem ----------------------------------------------------------------------
rem Change directory so the current directory is the Server home.
rem ----------------------------------------------------------------------
@@ -86,7 +95,7 @@ if not exist "%RHQ_SERVER_JAVA_EXE_FILE_PATH%" (
)
set _JB_DIR=%RHQ_SERVER_HOME%\jbossas
-%RHQ_SERVER_JAVA_EXE_FILE_PATH% -cp %_JB_DIR%\lib\jboss-common.jar;%_JB_DIR%\lib\jboss-jmx.jar;%_JB_DIR%\server\default\lib\jbosssx.jar;%_JB_DIR%\server\default\lib\jboss-jca.jar org.jboss.resource.security.SecureIdentityLoginModule %1
+"%RHQ_SERVER_JAVA_EXE_FILE_PATH%" -cp %_JB_DIR%\lib\jboss-common.jar;%_JB_DIR%\lib\jboss-jmx.jar;%_JB_DIR%\server\default\lib\jbosssx.jar;%_JB_DIR%\server\default\lib\jboss-jca.jar org.jboss.resource.security.SecureIdentityLoginModule %1
goto :done
commit c8911e339f9c2a3723f16c59bb4a00ece8d15773
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 31 13:29:49 2010 -0400
give the server side bundle plugins their own profile to ensure they
don't get omitted by -P!misc-plugins.
diff --git a/modules/plugins/pom.xml b/modules/plugins/pom.xml
index 76ee0ee..6e999e2 100644
--- a/modules/plugins/pom.xml
+++ b/modules/plugins/pom.xml
@@ -111,6 +111,20 @@
</profile>
<profile>
+ <id>bundle-plugins</id>
+ <activation>
+ <property>
+ <name>java.home</name>
+ </property>
+ </activation>
+
+ <modules>
+ <module>filetemplate-bundle</module>
+ <module>ant-bundle</module>
+ </modules>
+ </profile>
+
+ <profile>
<id>linux-plugins</id>
<activation>
<property>
@@ -159,10 +173,6 @@
<module>perftest</module>
<module>snmptrapd</module>
<module>twitter</module>
-
- <!-- bundle plugins -->
- <module>filetemplate-bundle</module>
- <module>ant-bundle</module>
</modules>
</profile>
commit 2a9ef1e3581dff3c45da41fb19aa0ef7f1bfbc26
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 31 13:28:27 2010 -0400
fix import of PersistenceUtility
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/HibernatePerformanceMonitor.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/HibernatePerformanceMonitor.java
index 848a067..1bc9188 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/HibernatePerformanceMonitor.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/HibernatePerformanceMonitor.java
@@ -31,7 +31,7 @@ import org.apache.commons.logging.LogFactory;
import org.hibernate.stat.QueryStatistics;
import org.hibernate.stat.Statistics;
-import org.rhq.core.domain.util.PersistenceUtility;
+import org.rhq.core.server.PersistenceUtility;
/**
* @author Joseph Marques
commit 613b7b2d8b09c5b3202b7bf7fc3460f5b76ffcde
Merge: 788f917... 722cd2d...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 31 10:36:16 2010 -0400
Merge branch 'master' into gwt-jay
commit 788f9174965433412e1f83155f941615f977b67c
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 31 10:36:08 2010 -0400
LT commit
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/create.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/create.xhtml
index dfe7cd8..fd72919 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/create.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/create.xhtml
@@ -1,125 +1,125 @@
-<?xml version="1.0"?>
-
-<!DOCTYPE html
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:c="http://java.sun.com/jstl/core"
- xmlns:a4j="http://richfaces.org/a4j"
- xmlns:rich="http://richfaces.ajax4jsf.org/rich">
-
-<ui:composition template="/rhq/resource/layout/main.xhtml">
-
- <ui:param name="pageTitle" value="Upload New Package"/>
- <ui:param name="selectedTabName" value="Content.New"/>
- <ui:define name="content">
-
- <rich:panel id="fileUploadPanel">
- <f:facet name="header">
- <h:outputText value="Package File"/>
- </f:facet>
-
- <h:panelGrid columns="1" width="100%" rendered="${ResourceUIBean.permissions.content}">
- <rich:panel>
- <input type="button"
- class="buttonmed"
- value="UPLOAD FILE..."
- onclick="javascript:open('/rhq/resource/content/file-upload.xhtml', 'uploadwin', 'titlebar=0,toolbar=0,location=0,menubar=0,directories=0,resizable=0,height=160,width=450')"/>
- <rich:spacer width="5" />
- <h:outputText rendered="#{UploadNewPackageUIBean.fileUploaded}"
- value="File Uploaded: #{UploadNewPackageUIBean.fileItem.fileName}"/>
- </rich:panel>
- </h:panelGrid>
-
- <h:outputText rendered="#{!ResourceUIBean.permissions.content}"
- value="You do not have permissions to upload content"/>
-
- </rich:panel>
-
- <h:form id="uploadForm">
- <input type="hidden" name="id" value="${param.id}"/>
-
- <rich:panel rendered="#{CreateNewPackageUIBean.needRequestPackageDetails}">
-
- <f:facet name="header">New Package Details</f:facet>
-
- <input type="hidden" name="newPackage" value="true"/>
-
- <table>
- <tr>
- <td align="right"><b>Name*</b></td>
- <td align="left"><h:inputText value="#{CreateNewPackageUIBean.packageName}"/></td>
- </tr>
- <tr>
- <td align="right"><b>Version*</b></td>
- <td align="left"><h:inputText value="#{CreateNewPackageUIBean.version}"/></td>
- </tr>
- <tr>
- <td align="right"><b>Architecture*</b></td>
- <td align="left">
- <h:selectOneMenu value="#{CreateNewPackageUIBean.selectedArchitectureId}">
- <f:selectItems value="#{CreateNewPackageUIBean.architectures}" />
- </h:selectOneMenu>
- </td>
- </tr>
- <tr>
- <td align="right"><b>Type*</b></td>
- <td align="left">
- <h:selectOneMenu value="#{CreateNewPackageUIBean.selectedPackageTypeId}">
- <f:selectItems value="#{CreateNewPackageUIBean.packageTypes}" />
- </h:selectOneMenu>
- </td>
- </tr>
- </table>
-
- <div class="note-panel"><span class="required-marker-text">*</span><span> denotes a required field.</span></div>
-
- </rich:panel>
-
- <rich:panel>
-
+<?xml version="1.0"?>
+
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+
+<ui:composition template="/rhq/resource/layout/main.xhtml">
+
+ <ui:param name="pageTitle" value="Upload New Package"/>
+ <ui:param name="selectedTabName" value="Content.New"/>
+ <ui:define name="content">
+
+ <rich:panel id="fileUploadPanel">
+ <f:facet name="header">
+ <h:outputText value="Package File"/>
+ </f:facet>
+
+ <h:panelGrid columns="1" width="100%" rendered="${ResourceUIBean.permissions.content}">
+ <rich:panel>
+ <input type="button"
+ class="buttonmed"
+ value="UPLOAD FILE..."
+ onclick="javascript:open('/rhq/resource/content/file-upload.xhtml', 'uploadwin', 'titlebar=0,toolbar=0,location=0,menubar=0,directories=0,resizable=0,height=160,width=450')"/>
+ <rich:spacer width="5" />
+ <h:outputText rendered="#{UploadNewPackageUIBean.fileUploaded}"
+ value="File Uploaded: #{UploadNewPackageUIBean.fileItem.fileName}"/>
+ </rich:panel>
+ </h:panelGrid>
+
+ <h:outputText rendered="#{!ResourceUIBean.permissions.content}"
+ value="You do not have permissions to upload content"/>
+
+ </rich:panel>
+
+ <h:form id="uploadForm">
+ <input type="hidden" name="id" value="${param.id}"/>
+
+ <rich:panel rendered="#{CreateNewPackageUIBean.needRequestPackageDetails}">
+
+ <f:facet name="header">New Package Details</f:facet>
+
+ <input type="hidden" name="newPackage" value="true"/>
+
+ <table>
+ <tr>
+ <td align="right"><b>Name*</b></td>
+ <td align="left"><h:inputText value="#{CreateNewPackageUIBean.packageName}"/></td>
+ </tr>
+ <tr>
+ <td align="right"><b>Version*</b></td>
+ <td align="left"><h:inputText value="#{CreateNewPackageUIBean.version}"/></td>
+ </tr>
+ <tr>
+ <td align="right"><b>Architecture*</b></td>
+ <td align="left">
+ <h:selectOneMenu value="#{CreateNewPackageUIBean.selectedArchitectureId}">
+ <f:selectItems value="#{CreateNewPackageUIBean.architectures}" />
+ </h:selectOneMenu>
+ </td>
+ </tr>
+ <tr>
+ <td align="right"><b>Type*</b></td>
+ <td align="left">
+ <h:selectOneMenu value="#{CreateNewPackageUIBean.selectedPackageTypeId}">
+ <f:selectItems value="#{CreateNewPackageUIBean.packageTypes}" />
+ </h:selectOneMenu>
+ </td>
+ </tr>
+ </table>
+
+ <div class="note-panel"><span class="required-marker-text">*</span><span> denotes a required field.</span></div>
+
+ </rich:panel>
+
+ <rich:panel>
+
<f:facet name="header">Repository</f:facet>
-
+
<p>Select one of the following options describing in which repository the new package should be created.</p>
-
+
<input type="radio" name="repoOption" value="subscribed">Currently Subscribed Repository</input>
- <rich:spacer width="5"/>
+ <rich:spacer width="5"/>
<h:selectOneMenu value="#{CreateNewPackageUIBean.subscribedRepoId}">
<f:selectItems value="#{CreateNewPackageUIBean.subscribedRepos}" />
- </h:selectOneMenu>
- <br/>
+ </h:selectOneMenu>
+ <br/>
<input type="radio" name="repoOption" value="unsubscribed">Existing Repository</input>
- <rich:spacer width="5"/>
+ <rich:spacer width="5"/>
<h:selectOneMenu value="#{CreateNewPackageUIBean.unsubscribedRepoId}">
<f:selectItems value="#{CreateNewPackageUIBean.unsubscribedRepos}" />
- </h:selectOneMenu>
- <br/>
+ </h:selectOneMenu>
+ <br/>
<input type="radio" name="repoOption" value="new">New Repository</input>
<rich:spacer width="5"/><h:inputText value="#{CreateNewPackageUIBean.newRepoName}"/>
-
- </rich:panel>
-
- <h:panelGrid id="buttonGrid" columns="2" styleClass="buttons-table" columnClasses="button-cell">
-
- <h:commandButton style="margin-top: 10px;" value="CONTINUE"
- action="#{CreateNewPackageUIBean.createPackage}" styleClass="buttonmed"
- rendered="#{UploadNewPackageUIBean.fileUploaded}"/>
- <h:commandButton style="margin-top: 10px;" value="CONTINUE"
- disabled="true" styleClass="buttonmed-disabled"
- rendered="#{!UploadNewPackageUIBean.fileUploaded}"/>
-
- <h:commandButton style="margin-top: 10px;" value="CANCEL"
- action="#{CreateNewPackageUIBean.cancel}" styleClass="buttonmed"/>
-
- </h:panelGrid>
-
- </h:form>
-
- </ui:define>
-</ui:composition>
-
-</html>
+
+ </rich:panel>
+
+ <h:panelGrid id="buttonGrid" columns="2" styleClass="buttons-table" columnClasses="button-cell">
+
+ <h:commandButton style="margin-top: 10px;" value="CONTINUE"
+ action="#{CreateNewPackageUIBean.createPackage}" styleClass="buttonmed"
+ rendered="#{UploadNewPackageUIBean.fileUploaded}"/>
+ <h:commandButton style="margin-top: 10px;" value="CONTINUE"
+ disabled="true" styleClass="buttonmed-disabled"
+ rendered="#{!UploadNewPackageUIBean.fileUploaded}"/>
+
+ <h:commandButton style="margin-top: 10px;" value="CANCEL"
+ action="#{CreateNewPackageUIBean.cancel}" styleClass="buttonmed"/>
+
+ </h:panelGrid>
+
+ </h:form>
+
+ </ui:define>
+</ui:composition>
+
+</html>
commit 2c28670eafacf818240ee8e22e696dd3a955ce3c
Merge: 546a772... 43e85fb...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Mar 30 16:49:40 2010 -0400
Merge branch 'gwt' into gwt-jay
commit 546a7720c20e6985dcf6a36b5c7e3fcdf7a4aa36
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Mar 30 16:48:48 2010 -0400
More support for deployment status and group deployment status
diff --git a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/bundle/BundleServerService.java b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/bundle/BundleServerService.java
index d248fc2..466dce1 100644
--- a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/bundle/BundleServerService.java
+++ b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/bundle/BundleServerService.java
@@ -30,6 +30,7 @@ import org.rhq.core.communications.command.annotation.Asynchronous;
import org.rhq.core.communications.command.annotation.LimitedConcurrency;
import org.rhq.core.communications.command.annotation.Timeout;
import org.rhq.core.domain.bundle.BundleDeploymentHistory;
+import org.rhq.core.domain.bundle.BundleDeploymentStatus;
import org.rhq.core.domain.content.PackageVersion;
/**
@@ -43,8 +44,6 @@ public interface BundleServerService {
@Asynchronous(guaranteedDelivery = true)
void addDeploymentHistory(int bundleDeploymentId, BundleDeploymentHistory history);
- List<PackageVersion> getAllBundleVersionPackageVersions(int bundleVersionId);
-
/**
* Requests that the server download and stream the bits for the specified package version.
* If the package cannot be found, an exception will be thrown.
@@ -60,4 +59,15 @@ public interface BundleServerService {
@Timeout(45 * 60 * 1000L)
@LimitedConcurrency(ContentServerService.CONCURRENCY_LIMIT_CONTENT_DOWNLOAD)
long downloadPackageBits(PackageVersion packageVersion, OutputStream outputStream);
+
+ List<PackageVersion> getAllBundleVersionPackageVersions(int bundleVersionId);
+
+ /**
+ * Set the (completion) status of a deployment. If required, detailed messages should be provided via
+ * addDeploymentHistory(). Deployments are automatically initialized to IN_PROGRESS.
+ * @param bundleDeploymentId
+ * @param status
+ */
+ @Asynchronous(guaranteedDelivery = true)
+ void setBundleDeploymentStatus(int bundleDeploymentId, BundleDeploymentStatus status);
}
\ No newline at end of file
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java
index 7db3060..66ad88a 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java
@@ -37,6 +37,7 @@ public class BundleDeploymentCriteria extends Criteria {
private Integer filterId;
private Integer filterBundleDeployDefinitionId; // requires override
private String filterBundleDeployDefinitionName; // requires override
+ private Integer filterBundleGroupDeploymentId; // requires override
private Integer filterResourceId; // requires override
private String filterResourceName; // requires override
private BundleDeploymentStatus filterStatus;
@@ -46,10 +47,11 @@ public class BundleDeploymentCriteria extends Criteria {
private boolean fetchHistory;
public BundleDeploymentCriteria() {
- filterOverrides.put("resourceId", "resource.id = ?");
- filterOverrides.put("resourceName", "resource.name like ?");
filterOverrides.put("bundleDeployDefinitionId", "parentResource.id = ?");
filterOverrides.put("bundleDeployDefinitionName", "parentResource.name like ?");
+ filterOverrides.put("bundleGroupDeploymentId", "bundleGroupDeployment.id = ?");
+ filterOverrides.put("resourceId", "resource.id = ?");
+ filterOverrides.put("resourceName", "resource.name like ?");
}
@Override
@@ -69,6 +71,10 @@ public class BundleDeploymentCriteria extends Criteria {
this.filterBundleDeployDefinitionName = filterBundleDeployDefinitionName;
}
+ public void addFilterBundleGroupDeploymentId(Integer filterBundleGroupDeploymentId) {
+ this.filterBundleGroupDeploymentId = filterBundleGroupDeploymentId;
+ }
+
public void addFilterResourceId(Integer filterResourceId) {
this.filterResourceId = filterResourceId;
}
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/bundle/BundleManager.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/bundle/BundleManager.java
index 04b29a8..9602eed 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/bundle/BundleManager.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/bundle/BundleManager.java
@@ -43,6 +43,7 @@ import org.rhq.core.domain.bundle.BundleDeployDefinition;
import org.rhq.core.domain.bundle.BundleDeployment;
import org.rhq.core.domain.bundle.BundleDeploymentAction;
import org.rhq.core.domain.bundle.BundleDeploymentHistory;
+import org.rhq.core.domain.bundle.BundleDeploymentStatus;
import org.rhq.core.domain.bundle.BundleType;
import org.rhq.core.domain.bundle.BundleVersion;
import org.rhq.core.domain.content.PackageVersion;
@@ -146,7 +147,7 @@ public class BundleManager extends AgentService implements BundleAgentService, B
if (!result.isSuccess()) {
response.setErrorMessage(result.getErrorMessage());
}
- auditDeployment(deployment, BundleDeploymentAction.DEPLOYMENT_END, "Success");
+ completeDeployment(deployment, BundleDeploymentStatus.SUCCESS, "Success");
} catch (Throwable t) {
log.error("Failed to schedule bundle request: " + request, t);
response.setErrorMessage(t);
@@ -205,6 +206,11 @@ public class BundleManager extends AgentService implements BundleAgentService, B
return packageVersionFiles;
}
+ private void completeDeployment(BundleDeployment deployment, BundleDeploymentStatus status, String message) {
+ getBundleServerService().setBundleDeploymentStatus(deployment.getId(), status);
+ auditDeployment(deployment, BundleDeploymentAction.DEPLOYMENT_END, message);
+ }
+
private void auditDeployment(BundleDeployment deployment, BundleDeploymentAction action, String message) {
BundleDeploymentHistory history = new BundleDeploymentHistory("Bundle Plugin", action, message);
getBundleServerService().addDeploymentHistory(deployment.getId(), history);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
index db9c232..ec2e788 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
@@ -49,6 +49,7 @@ import org.rhq.core.domain.bundle.BundleDeployDefinition;
import org.rhq.core.domain.bundle.BundleDeployment;
import org.rhq.core.domain.bundle.BundleDeploymentAction;
import org.rhq.core.domain.bundle.BundleDeploymentHistory;
+import org.rhq.core.domain.bundle.BundleDeploymentStatus;
import org.rhq.core.domain.bundle.BundleFile;
import org.rhq.core.domain.bundle.BundleGroupDeployment;
import org.rhq.core.domain.bundle.BundleType;
@@ -71,6 +72,7 @@ import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.util.PageList;
+import org.rhq.core.domain.util.StringUtils;
import org.rhq.core.util.NumberUtil;
import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.agentclient.AgentClient;
@@ -155,7 +157,13 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
// of packages in the bundle's repo.
ResourceType resourceType = entityManager.find(ResourceType.class, bundleType.getResourceType().getId());
PackageType packageType = new PackageType(name, resourceType);
+ packageType.setDescription("Package type for content of bundle " + name);
packageType.setCategory(PackageCategory.BUNDLE);
+ packageType.setSupportsArchitecture(false);
+ packageType.setDisplayName(StringUtils.deCamelCase(name));
+ packageType.setDiscoveryInterval(-1L);
+ packageType.setCreationData(false);
+ packageType.setDeploymentConfigurationDefinition(null);
bundle.setPackageType(packageType);
log.info("Creating bundle: " + bundle);
@@ -241,6 +249,7 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
return bv;
}
+ @SuppressWarnings("unchecked")
@RequiredPermission(Permission.MANAGE_INVENTORY)
public BundleVersion createBundleVersion(Subject subject, int bundleId, String name, String description,
String version, String recipe) throws Exception {
@@ -310,6 +319,7 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
return bundleVersion;
}
+ @SuppressWarnings("unchecked")
private String getVersion(String version, Bundle bundle) {
if (null != version && version.trim().length() > 0) {
return version;
@@ -492,6 +502,7 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
if (!response.isSuccess()) {
history = new BundleDeploymentHistory(subject.getName(), BundleDeploymentAction.DEPLOYMENT_END, "Failure: "
+ response.getErrorMessage());
+ bundleManager.setBundleDeploymentStatus(subject, deployment.getId(), BundleDeploymentStatus.FAILURE);
bundleManager.addBundleDeploymentHistory(subject, deployment.getId(), history);
}
@@ -553,6 +564,37 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
return deployment;
}
+ @RequiredPermission(Permission.MANAGE_INVENTORY)
+ public BundleDeployment setBundleDeploymentStatus(Subject subject, int bundleDeploymentId,
+ BundleDeploymentStatus status) throws Exception {
+
+ BundleDeployment deployment = entityManager.find(BundleDeployment.class, bundleDeploymentId);
+ if (null == deployment) {
+ throw new IllegalArgumentException("Invalid bundleDeploymentId: " + bundleDeploymentId);
+ }
+
+ deployment.setStatus(status);
+ this.entityManager.persist(deployment);
+
+ // If this is part of a group deployment then update the group status, if necessary.
+ BundleGroupDeployment groupDeployment = deployment.getBundleGroupDeployment();
+ if ((null != groupDeployment) && (BundleDeploymentStatus.INPROGRESS.equals(groupDeployment.getStatus()))) {
+ if (BundleDeploymentStatus.FAILURE.equals(status)) {
+ groupDeployment.setStatus(status);
+ } else {
+ BundleDeploymentCriteria c = new BundleDeploymentCriteria();
+ c.addFilterBundleGroupDeploymentId(groupDeployment.getId());
+ c.addFilterStatus(BundleDeploymentStatus.INPROGRESS);
+ List<BundleDeployment> inProgressDeployments = findBundleDeploymentsByCriteria(subject, c);
+ if (inProgressDeployments.isEmpty()) {
+ groupDeployment.setStatus(BundleDeploymentStatus.SUCCESS);
+ }
+ }
+ }
+
+ return deployment;
+ }
+
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public BundleGroupDeployment createBundleGroupDeployment(BundleGroupDeployment bundleGroupDeployment)
throws Exception {
@@ -711,7 +753,7 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
return results;
}
- // TODO This is not adequate!!!
+ @SuppressWarnings("unchecked")
@RequiredPermission(Permission.MANAGE_INVENTORY)
public void deleteBundle(Subject subject, int bundleId) throws Exception {
Bundle bundle = this.entityManager.find(Bundle.class, bundleId);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerLocal.java
index b265f0e..e55959f 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerLocal.java
@@ -25,6 +25,7 @@ import javax.ejb.Local;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.bundle.BundleDeployment;
import org.rhq.core.domain.bundle.BundleDeploymentHistory;
+import org.rhq.core.domain.bundle.BundleDeploymentStatus;
import org.rhq.core.domain.bundle.BundleGroupDeployment;
import org.rhq.core.domain.bundle.BundleType;
@@ -81,4 +82,15 @@ public interface BundleManagerLocal extends BundleManagerRemote {
// added here because the same method in @Remote was commented out to bypass a WSProvide issue
Map<String, Boolean> getAllBundleVersionFilenames(Subject subject, int bundleVersionId) throws Exception;
+ /**
+ * Called internally to set deployment status. Typically to a completion status when deployment ends.
+ *
+ * @param subject
+ * @param bundleDeploymentId id of the deployment appending the history record
+ * @param status
+ * @return the updated BundleDeployment
+ */
+ BundleDeployment setBundleDeploymentStatus(Subject subject, int bundleDeploymentId, BundleDeploymentStatus status)
+ throws Exception;
+
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleServerServiceImpl.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleServerServiceImpl.java
index afda193..8350784 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleServerServiceImpl.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleServerServiceImpl.java
@@ -28,6 +28,7 @@ import org.apache.commons.logging.LogFactory;
import org.rhq.core.clientapi.server.bundle.BundleServerService;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.bundle.BundleDeploymentHistory;
+import org.rhq.core.domain.bundle.BundleDeploymentStatus;
import org.rhq.core.domain.bundle.BundleFile;
import org.rhq.core.domain.content.PackageVersion;
import org.rhq.core.domain.criteria.BundleFileCriteria;
@@ -94,4 +95,15 @@ public class BundleServerServiceImpl implements BundleServerService {
throw new WrappedRemotingException(e);
}
}
+
+ public void setBundleDeploymentStatus(int bundleDeploymentId, BundleDeploymentStatus status) {
+ try {
+ BundleManagerLocal bm = LookupUtil.getBundleManager();
+ bm.setBundleDeploymentStatus(LookupUtil.getSubjectManager().getOverlord(), bundleDeploymentId, status);
+ } catch (Exception e) {
+ log.error("Failed to set status for deployment id: " + bundleDeploymentId, e);
+ throw new WrappedRemotingException(e);
+ }
+ }
+
}
\ No newline at end of file
commit 43e85fb5f3ff7526794ffeaced196a7e7471eda9
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Mar 30 14:33:40 2010 -0400
provide ant contrib tasks out of box for user
diff --git a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/AntLauncher.java b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/AntLauncher.java
index b184274..86e397f 100644
--- a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/AntLauncher.java
+++ b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/AntLauncher.java
@@ -26,9 +26,11 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.PrintWriter;
+import java.util.HashSet;
import java.util.Hashtable;
import java.util.Map;
import java.util.Properties;
+import java.util.Set;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
@@ -42,14 +44,17 @@ import org.rhq.core.domain.configuration.definition.PropertySimpleType;
public class AntLauncher {
// currently, the bundle plugins don't need custom ant tasks, but there is an ant task stubbed for future use here
- private static final String ANT_TASKS = "bundle-ant-tasks.properties";
+ private static final String BUNDLE_ANT_TASKS = "bundle-ant-tasks.properties";
+
+ // "out of box" we will provide the antcontrib optional tasks
+ private static final String ANTCONTRIB_ANT_TASKS = "net/sf/antcontrib/antcontrib.properties";
/**
* Launches ANT and parses the given build file and optionally executes it.
*
* @param buildFile the build file that ANT will run
* @param target the target to run, <code>null</code> will run the default target
- * @param customTaskDefs the properties file found in classloader that contains all the taskdef definitions
+ * @param customTaskDefs the properties files found in classloader that contains all the taskdef definitions
* @param properties set of properties to set for the ANT task to access
* @param logFile where ANT messages will be logged
* @param logStdOut if <code>true</code>, log messages will be sent to stdout as well as the log file
@@ -57,7 +62,7 @@ public class AntLauncher {
*
* @throws RuntimeException
*/
- public BundleAntProject startAnt(File buildFile, String target, String customTaskDefs, Properties properties,
+ public BundleAntProject startAnt(File buildFile, String target, Set<String> customTaskDefs, Properties properties,
File logFile, boolean logStdOut, boolean execute) {
PrintWriter logFileOutput = null;
@@ -67,9 +72,14 @@ public class AntLauncher {
ClassLoader classLoader = getClass().getClassLoader();
+ if (customTaskDefs == null) {
+ customTaskDefs = new HashSet<String>(1);
+ }
+ customTaskDefs.add(ANTCONTRIB_ANT_TASKS); // we always want to provide these
+
Properties taskDefs = new Properties();
- if (customTaskDefs != null) {
- InputStream taskDefsStream = classLoader.getResourceAsStream(customTaskDefs);
+ for (String customTaskDef : customTaskDefs) {
+ InputStream taskDefsStream = classLoader.getResourceAsStream(customTaskDef);
try {
taskDefs.load(taskDefsStream);
} finally {
commit c171369abcd868a407b9f9c71eceb6000dc6e8d4
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Mar 30 13:58:58 2010 -0400
remove package type creation for the bundle type
diff --git a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/PluginMetadataParser.java b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/PluginMetadataParser.java
index 26bf354..686b16b 100644
--- a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/PluginMetadataParser.java
+++ b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/PluginMetadataParser.java
@@ -50,7 +50,6 @@ import org.rhq.core.clientapi.descriptor.plugin.ServerDescriptor;
import org.rhq.core.clientapi.descriptor.plugin.ServiceDescriptor;
import org.rhq.core.clientapi.descriptor.plugin.SubCategoryDescriptor;
import org.rhq.core.domain.bundle.BundleType;
-import org.rhq.core.domain.content.PackageType;
import org.rhq.core.domain.event.EventDefinition;
import org.rhq.core.domain.measurement.MeasurementDefinition;
import org.rhq.core.domain.resource.ClassLoaderType;
@@ -60,7 +59,6 @@ import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.ResourceCreationDataType;
import org.rhq.core.domain.resource.ResourceSubCategory;
import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.domain.util.StringUtils;
/**
* This is a stateful class intended to hold the related metadata for a single plugin descriptor. It is designed to be
@@ -527,18 +525,6 @@ public class PluginMetadataParser {
if (bundle != null) {
String typeName = bundle.getType();
resourceType.setBundleType(new BundleType(typeName, resourceType));
-
- // create the peer package type for the bundle type
- PackageType bundlePackageType = new PackageType();
- bundlePackageType.setName(typeName);
- bundlePackageType.setDescription("Package type for content of bundles of type " + typeName);
- bundlePackageType.setCategory(null);
- bundlePackageType.setSupportsArchitecture(false);
- bundlePackageType.setDisplayName(StringUtils.deCamelCase(typeName));
- bundlePackageType.setDiscoveryInterval(-1L);
- bundlePackageType.setCreationData(false);
- bundlePackageType.setDeploymentConfigurationDefinition(null);
- resourceType.addPackageType(bundlePackageType);
}
} catch (InvalidPluginDescriptorException e) {
commit c43e74fbf53cfd2dd58ee9babd328c5866dacb8c
Merge: b3313d9... 96a5298...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Mar 29 15:39:05 2010 -0400
Merge branch 'bundle-jay' into gwt
Conflicts:
modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
modules/plugins/filetemplate-bundle/src/main/java/org/rhq/plugins/filetemplate/ProcessingRecipeContext.java
commit b3313d96a919adf6168c4dc3065e54fdc71ae69c
Merge: ef3638d... 8bd78f0...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Mar 29 15:37:14 2010 -0400
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
commit ef3638df66757fbfd2f84f03c38af3dfa3556513
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Mar 29 15:35:55 2010 -0400
Incorporate group deployment into bundle deploy wizard. Make initial
use of Selection widgets. Refactored Pulled AbstractSelector out of
ResourceSelector and subclassed ResourceGroupSelector as well.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/AbstractBundleDeployWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/AbstractBundleDeployWizard.java
index 5b11249..369569b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/AbstractBundleDeployWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/AbstractBundleDeployWizard.java
@@ -21,6 +21,7 @@ package org.rhq.enterprise.gui.coregui.client.bundle.deploy;
import org.rhq.core.domain.bundle.Bundle;
import org.rhq.core.domain.bundle.BundleDeployDefinition;
import org.rhq.core.domain.bundle.BundleDeployment;
+import org.rhq.core.domain.bundle.BundleGroupDeployment;
import org.rhq.core.domain.bundle.BundleVersion;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.definition.ConfigurationTemplate;
@@ -33,14 +34,15 @@ public abstract class AbstractBundleDeployWizard extends AbstractBundleWizard {
private BundleVersion bundleVersion;
private BundleDeployDefinition bundleDeployDefinition;
private BundleDeployment bundleDeployment;
+ private BundleGroupDeployment bundleGroupDeployment;
private String name;
private String description;
private ConfigurationTemplate template;
private Configuration config;
- private Integer platformGroupId;
- private Integer platformId;
+ private Integer deployTargetId;
private Boolean newDefinition = Boolean.TRUE;
- private Boolean deployNow = null;
+ private boolean deployNow = true;
+ private boolean resourceDeploy = true;
public Bundle getBundle() {
return bundle;
@@ -110,32 +112,36 @@ public abstract class AbstractBundleDeployWizard extends AbstractBundleWizard {
this.newDefinition = newDefinition;
}
- public boolean isDeployNow() {
- return Boolean.TRUE.equals(deployNow);
+ public Integer getPlatformGroupId() {
+ return deployTargetId;
}
- public Boolean getDeployNow() {
- return deployNow;
+ public void setPlatformGroupId(Integer platformGroupId) {
+ this.deployTargetId = platformGroupId;
}
- public void setDeployNow(Boolean deployNow) {
- this.deployNow = deployNow;
+ public Integer getDeployTargetId() {
+ return deployTargetId;
}
- public Integer getPlatformGroupId() {
- return platformGroupId;
+ public void setDeployTargetId(Integer deployTargetId) {
+ this.deployTargetId = deployTargetId;
}
- public void setPlatformGroupId(Integer platformGroupId) {
- this.platformGroupId = platformGroupId;
+ public boolean isResourceDeploy() {
+ return resourceDeploy;
+ }
+
+ public Boolean isDeployNow() {
+ return deployNow;
}
- public Integer getPlatformId() {
- return platformId;
+ public void setDeployNow(Boolean deployNow) {
+ this.deployNow = deployNow;
}
- public void setPlatformId(Integer platformId) {
- this.platformId = platformId;
+ public void setResourceDeploy(boolean resourceDeploy) {
+ this.resourceDeploy = resourceDeploy;
}
public BundleDeployment getBundleDeployment() {
@@ -146,4 +152,12 @@ public abstract class AbstractBundleDeployWizard extends AbstractBundleWizard {
this.bundleDeployment = bundleDeployment;
}
+ public BundleGroupDeployment getBundleGroupDeployment() {
+ return bundleGroupDeployment;
+ }
+
+ public void setBundleGroupDeployment(BundleGroupDeployment bundleGroupDeployment) {
+ this.bundleGroupDeployment = bundleGroupDeployment;
+ }
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployWizard.java
index 284d94c..b1b2671 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployWizard.java
@@ -36,8 +36,8 @@ public class BundleDeployWizard extends AbstractBundleDeployWizard {
steps.add(new BundleDeployDefinitionInfoStep(this));
steps.add(new SelectTemplateStep(this));
steps.add(new CreateConfigStep(this));
- steps.add(new DeployNowStep(this));
- steps.add(new SelectPlatformsStep(this));
+ steps.add(new DeployOptionsStep(this));
+ steps.add(new DeployTargetStep(this));
steps.add(new DeployStep(this));
}
@@ -49,8 +49,8 @@ public class BundleDeployWizard extends AbstractBundleDeployWizard {
steps.add(new BundleDeployDefinitionInfoStep(this));
steps.add(new SelectTemplateStep(this));
steps.add(new CreateConfigStep(this));
- steps.add(new DeployNowStep(this));
- steps.add(new SelectPlatformsStep(this));
+ steps.add(new DeployOptionsStep(this));
+ steps.add(new DeployTargetStep(this));
steps.add(new DeployStep(this));
}
@@ -63,8 +63,8 @@ public class BundleDeployWizard extends AbstractBundleDeployWizard {
steps.add(new SelectTemplateStep(this));
steps.add(new CreateConfigStep(this));
- steps.add(new DeployNowStep(this));
- steps.add(new SelectPlatformsStep(this));
+ steps.add(new DeployOptionsStep(this));
+ steps.add(new DeployTargetStep(this));
steps.add(new DeployStep(this));
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployNowStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployNowStep.java
deleted file mode 100644
index aacf46f..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployNowStep.java
+++ /dev/null
@@ -1,76 +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.bundle.deploy;
-
-import java.util.LinkedHashMap;
-
-import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.form.DynamicForm;
-import com.smartgwt.client.widgets.form.fields.RadioGroupItem;
-import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
-import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
-
-import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
-
-public class DeployNowStep implements WizardStep {
-
- static private final String DEPLOY_LATER = "later";
- static private final String DEPLOY_NOW = "now";
-
- private final BundleDeployWizard wizard;
- private DynamicForm form;
-
- public DeployNowStep(BundleDeployWizard bundleCreationWizard) {
- this.wizard = bundleCreationWizard;
- }
-
- public String getName() {
- return "Deploy Now or Later";
- }
-
- public Canvas getCanvas() {
- if (form == null) {
- form = new DynamicForm();
- form.setWidth100();
- form.setNumCols(2);
- form.setColWidths("50%", "*");
-
- RadioGroupItem radioGroupItem = new RadioGroupItem("deployTime", "Deployment Time");
- LinkedHashMap<String, String> radioGroupValues = new LinkedHashMap<String, String>();
- radioGroupValues.put(DEPLOY_NOW, "Deploy Now");
- radioGroupValues.put(DEPLOY_LATER, "Save Definition and Deploy Later");
- radioGroupItem.setRequired(true);
- radioGroupItem.setValueMap(radioGroupValues);
- radioGroupItem.setValue(DEPLOY_NOW);
- wizard.setDeployNow(true);
- radioGroupItem.addChangedHandler(new ChangedHandler() {
- public void onChanged(ChangedEvent event) {
- wizard.setDeployNow(DEPLOY_NOW.equals(event.getValue()));
- }
- });
-
- form.setItems(radioGroupItem);
- }
- return form;
- }
-
- public boolean nextPage() {
- return form.validate();
- }
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployOptionsStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployOptionsStep.java
new file mode 100644
index 0000000..730a466
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployOptionsStep.java
@@ -0,0 +1,96 @@
+/*
+ * 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.bundle.deploy;
+
+import java.util.LinkedHashMap;
+
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.RadioGroupItem;
+import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
+import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
+
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+
+public class DeployOptionsStep implements WizardStep {
+
+ static private final String DEPLOY_LATER = "later";
+ static private final String DEPLOY_NOW = "now";
+
+ static private final String DEPLOY_GROUP = "group";
+ static private final String DEPLOY_RESOURCE = "resource";
+
+ private final BundleDeployWizard wizard;
+ private DynamicForm form;
+ private RadioGroupItem rgDeployTimeItem;
+ private RadioGroupItem rgDeployTypeItem;
+
+ public DeployOptionsStep(BundleDeployWizard bundleCreationWizard) {
+ this.wizard = bundleCreationWizard;
+ }
+
+ public String getName() {
+ return "Deploy Options";
+ }
+
+ public Canvas getCanvas() {
+ if (form == null) {
+ form = new DynamicForm();
+ form.setWidth100();
+ form.setNumCols(2);
+ form.setColWidths("50%", "*");
+
+ rgDeployTimeItem = new RadioGroupItem("deployTime", "Deployment Time");
+ LinkedHashMap<String, String> deployTimeValues = new LinkedHashMap<String, String>();
+ deployTimeValues.put(DEPLOY_NOW, "Deploy Now");
+ deployTimeValues.put(DEPLOY_LATER, "Deploy Later");
+ rgDeployTimeItem.setRequired(true);
+ rgDeployTimeItem.setValueMap(deployTimeValues);
+ rgDeployTimeItem.setValue(DEPLOY_NOW);
+ wizard.setDeployNow(true);
+ rgDeployTimeItem.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent event) {
+ wizard.setDeployNow(DEPLOY_NOW.equals(event.getValue()));
+ rgDeployTypeItem.setDisabled(!wizard.isDeployNow());
+ }
+ });
+
+ rgDeployTypeItem = new RadioGroupItem("deployTarget", "Deployment Target");
+ LinkedHashMap<String, String> deployTypeValues = new LinkedHashMap<String, String>();
+ deployTypeValues.put(DEPLOY_RESOURCE, "Deploy to Single Resource");
+ deployTypeValues.put(DEPLOY_GROUP, "Deploy to Group of Resources");
+ rgDeployTypeItem.setRequired(true);
+ rgDeployTypeItem.setValueMap(deployTypeValues);
+ rgDeployTypeItem.setValue(DEPLOY_RESOURCE);
+ wizard.setResourceDeploy(true);
+ rgDeployTypeItem.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent event) {
+ wizard.setResourceDeploy(DEPLOY_RESOURCE.equals(event.getValue()));
+ }
+ });
+
+ form.setItems(rgDeployTimeItem, rgDeployTypeItem);
+ }
+ return form;
+ }
+
+ public boolean nextPage() {
+ return form.validate();
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java
index bf3b8b1..197bd9f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java
@@ -28,6 +28,7 @@ import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.bundle.BundleDeployDefinition;
import org.rhq.core.domain.bundle.BundleDeployment;
+import org.rhq.core.domain.bundle.BundleGroupDeployment;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
@@ -80,27 +81,51 @@ public class DeployStep implements WizardStep {
+ result.getDescription(), Severity.Info));
wizard.setBundleDeployDefinition(result);
- bundleServer.scheduleBundleDeployment(wizard.getBundleDeployDefinition().getId(), wizard
- .getPlatformId(), //
- new AsyncCallback<BundleDeployment>() {
- public void onSuccess(BundleDeployment result) {
- deployingImage.setSrc("/images/status_complete.gif");
- deployingMessage.setText("Bundle Deployment Scheduled!");
- CoreGUI.getMessageCenter().notify(
- new Message("Schedule bundle deployment ["
- + wizard.getBundleDeployDefinition().getName() + "] resource ["
- + result.getResource() + "]", Severity.Info));
- wizard.setBundleDeployment(result);
- }
-
- public void onFailure(Throwable caught) {
- deployingImage.setSrc("/images/status_error.gif");
- deployingMessage.setText("Failed to Schedule Deployment!");
- CoreGUI.getErrorHandler().handleError(
- "Failed to schedule deployment: " + caught.getMessage(), caught);
- wizard.setBundleDeployment(null);
- }
- });
+ if (wizard.isResourceDeploy()) {
+ bundleServer.scheduleBundleDeployment(wizard.getBundleDeployDefinition().getId(),
+ wizard.getDeployTargetId(), //
+ new AsyncCallback<BundleDeployment>() {
+ public void onSuccess(BundleDeployment result) {
+ deployingImage.setSrc("/images/status_complete.gif");
+ deployingMessage.setText("Bundle Deployment Scheduled!");
+ CoreGUI.getMessageCenter().notify(
+ new Message("Schedule bundle deployment ["
+ + wizard.getBundleDeployDefinition().getName() + "] resource ["
+ + result.getResource() + "]", Severity.Info));
+ wizard.setBundleDeployment(result);
+ }
+
+ public void onFailure(Throwable caught) {
+ deployingImage.setSrc("/images/status_error.gif");
+ deployingMessage.setText("Failed to Schedule Deployment!");
+ CoreGUI.getErrorHandler().handleError(
+ "Failed to schedule deployment: " + caught.getMessage(), caught);
+ wizard.setBundleDeployment(null);
+ }
+ });
+ } else {
+ bundleServer.scheduleBundleGroupDeployment(wizard.getBundleDeployDefinition().getId(),
+ wizard.getDeployTargetId(), //
+ new AsyncCallback<BundleGroupDeployment>() {
+ public void onSuccess(BundleGroupDeployment result) {
+ deployingImage.setSrc("/images/status_complete.gif");
+ deployingMessage.setText("Bundle Group Deployment Scheduled!");
+ CoreGUI.getMessageCenter().notify(
+ new Message("Schedule bundle group deployment ["
+ + wizard.getBundleDeployDefinition().getName()
+ + "] resource group [" + result.getGroup() + "]", Severity.Info));
+ wizard.setBundleGroupDeployment(result);
+ }
+
+ public void onFailure(Throwable caught) {
+ deployingImage.setSrc("/images/status_error.gif");
+ deployingMessage.setText("Failed to Schedule Group Deployment!");
+ CoreGUI.getErrorHandler().handleError(
+ "Failed to schedule group deployment: " + caught.getMessage(), caught);
+ wizard.setBundleGroupDeployment(null);
+ }
+ });
+ }
}
public void onFailure(Throwable caught) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployTargetStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployTargetStep.java
new file mode 100644
index 0000000..b6803bb
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployTargetStep.java
@@ -0,0 +1,68 @@
+/*
+ * 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.bundle.deploy;
+
+import java.util.HashSet;
+
+import com.smartgwt.client.util.SC;
+import com.smartgwt.client.widgets.Canvas;
+
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.selection.AbstractSelector;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.selection.ResourceGroupSelector;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.selection.ResourceSelector;
+
+public class DeployTargetStep implements WizardStep {
+
+ private final BundleDeployWizard wizard;
+
+ private AbstractSelector selector;
+
+ public DeployTargetStep(BundleDeployWizard bundleCreationWizard) {
+ this.wizard = bundleCreationWizard;
+ }
+
+ public String getName() {
+ return this.wizard.isResourceDeploy() ? "Select Target Resource" : "Select Target Group";
+ }
+
+ public Canvas getCanvas() {
+ if ((null == selector) || isMismatch()) {
+ selector = this.wizard.isResourceDeploy() ? new ResourceSelector() : new ResourceGroupSelector();
+ }
+
+ return selector;
+ }
+
+ private boolean isMismatch() {
+ return ((selector instanceof ResourceSelector && !this.wizard.isResourceDeploy()) || (selector instanceof ResourceGroupSelector && this.wizard
+ .isResourceDeploy()));
+ }
+
+ public boolean nextPage() {
+ HashSet<Integer> selection = selector.getSelection();
+ if (selection.size() != 1) {
+ SC.warn("Select only a single target resource for deployment. Use group deploy for multiple targets.");
+ return false;
+ }
+
+ wizard.setDeployTargetId(selection.iterator().next());
+ return true;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectPlatformsStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectPlatformsStep.java
deleted file mode 100644
index 1e38fab..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectPlatformsStep.java
+++ /dev/null
@@ -1,71 +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.bundle.deploy;
-
-import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.form.DynamicForm;
-import com.smartgwt.client.widgets.form.fields.TextItem;
-import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
-import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
-
-import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
-
-public class SelectPlatformsStep implements WizardStep {
-
- private final BundleDeployWizard wizard;
- private DynamicForm form;
-
- public SelectPlatformsStep(BundleDeployWizard bundleCreationWizard) {
- this.wizard = bundleCreationWizard;
- }
-
- public String getName() {
- return "Select Target Platforms";
- }
-
- public Canvas getCanvas() {
- if (form == null) {
- form = new DynamicForm();
- form.setWidth100();
- form.setNumCols(2);
- form.setColWidths("50%", "*");
-
- // TODO: this is temporary until we have a resource selection step
- final TextItem platformIdTextItem = new TextItem("platformId", "Platform Resource Id");
- platformIdTextItem.setRequired(true);
- platformIdTextItem.addChangedHandler(new ChangedHandler() {
- public void onChanged(ChangedEvent event) {
- Object value = event.getValue();
- if (value == null) {
- value = "";
- }
- wizard.setPlatformId(Integer.valueOf(value.toString()));
- }
- });
-
- form.setItems(platformIdTextItem);
- }
-
- return form;
- }
-
- public boolean nextPage() {
- return form.validate();
- }
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java
index 5743653..b55c172 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java
@@ -26,6 +26,7 @@ import com.google.gwt.user.client.rpc.RemoteService;
import org.rhq.core.domain.bundle.Bundle;
import org.rhq.core.domain.bundle.BundleDeployDefinition;
import org.rhq.core.domain.bundle.BundleDeployment;
+import org.rhq.core.domain.bundle.BundleGroupDeployment;
import org.rhq.core.domain.bundle.BundleType;
import org.rhq.core.domain.bundle.BundleVersion;
import org.rhq.core.domain.bundle.composite.BundleWithLatestVersionComposite;
@@ -63,4 +64,7 @@ public interface BundleGWTService extends RemoteService {
ArrayList<BundleType> getAllBundleTypes() throws Exception;
BundleDeployment scheduleBundleDeployment(int bundleDeployDefinitionId, int resourceId) throws Exception;
+
+ BundleGroupDeployment scheduleBundleGroupDeployment(int bundleDeployDefinitionId, int resourceGroupId)
+ throws Exception;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java
index 421a66e..7499f0b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java
@@ -54,7 +54,7 @@ public class ResourceGroupsDataSource extends RPCDataSource<ResourceGroup> {
return INSTANCE;
}
- private ResourceGroupsDataSource() {
+ public ResourceGroupsDataSource() {
super("ResourceGroups");
DataSourceField idDataField = new DataSourceIntegerField("id", "ID", 20);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/AbstractSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/AbstractSelector.java
new file mode 100644
index 0000000..06c322c
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/AbstractSelector.java
@@ -0,0 +1,254 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.selection;
+
+import java.util.HashSet;
+
+import com.google.gwt.user.client.Timer;
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.data.Record;
+import com.smartgwt.client.types.DragDataAction;
+import com.smartgwt.client.types.DragTrackerMode;
+import com.smartgwt.client.types.ListGridFieldType;
+import com.smartgwt.client.types.VerticalAlignment;
+import com.smartgwt.client.widgets.ImgProperties;
+import com.smartgwt.client.widgets.TransferImgButton;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.events.KeyPressEvent;
+import com.smartgwt.client.widgets.events.KeyPressHandler;
+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.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.grid.events.RecordDropEvent;
+import com.smartgwt.client.widgets.grid.events.RecordDropHandler;
+import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
+import com.smartgwt.client.widgets.grid.events.SelectionEvent;
+import com.smartgwt.client.widgets.layout.HLayout;
+import com.smartgwt.client.widgets.layout.LayoutSpacer;
+import com.smartgwt.client.widgets.layout.VLayout;
+import com.smartgwt.client.widgets.layout.VStack;
+
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+
+/**
+ * @author Greg Hinkle
+ */
+public abstract class AbstractSelector extends HLayout {
+
+ protected HashSet<Integer> selection = new HashSet<Integer>();
+
+ protected ListGrid availableGrid;
+ protected ListGrid assignedGrid;
+
+ protected TransferImgButton addButton;
+ protected TransferImgButton removeButton;
+ protected TransferImgButton addAllButton;
+ protected TransferImgButton removeAllButton;
+
+ protected Criteria latestCriteria;
+
+ public AbstractSelector() {
+ setAlign(VerticalAlignment.BOTTOM);
+ setHeight(380);
+ }
+
+ public HashSet<Integer> getSelection() {
+ return selection;
+ }
+
+ protected abstract DynamicForm getAvailableFilterForm();
+
+ protected abstract RPCDataSource<?> getDataSource();
+
+ protected abstract Criteria getLatestCriteria(DynamicForm availableFilterForm);
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+ final DynamicForm availableFilterForm = getAvailableFilterForm();
+
+ VLayout availableLayout = new VLayout();
+ availableLayout.addMember(new LayoutSpacer());
+
+ availableLayout.addMember(availableFilterForm);
+
+ availableGrid = new ListGrid();
+ availableGrid.setHeight(350);
+ availableGrid.setCanDragRecordsOut(true);
+ availableGrid.setDragTrackerMode(DragTrackerMode.ICON);
+ availableGrid.setTrackerImage(new ImgProperties("types/Service_up_16.png", 16, 16));
+ availableGrid.setDragDataAction(DragDataAction.COPY);
+ availableGrid.setDataSource(getDataSource());
+ availableGrid.setFetchDelay(700);
+
+ availableGrid.setAutoFetchData(true);
+ availableGrid.setFields(new ListGridField("icon", 50), new ListGridField("name"));
+
+ availableLayout.addMember(availableGrid);
+
+ addMember(availableLayout);
+
+ availableFilterForm.addItemChangedHandler(new ItemChangedHandler() {
+ public void onItemChanged(ItemChangedEvent itemChangedEvent) {
+ latestCriteria = getLatestCriteria(availableFilterForm);
+
+ Timer t = new Timer() {
+ @Override
+ public void run() {
+ if (latestCriteria != null) {
+ Criteria c = latestCriteria;
+ latestCriteria = null;
+ availableGrid.fetchData(c);
+ }
+ }
+ };
+ t.schedule(500);
+ }
+ });
+
+ VStack moveButtonStack = new VStack(6);
+ moveButtonStack.setAlign(VerticalAlignment.CENTER);
+ moveButtonStack.setWidth(40);
+
+ addButton = new TransferImgButton(TransferImgButton.RIGHT);
+ addButton.setDisabled(true);
+ removeButton = new TransferImgButton(TransferImgButton.LEFT);
+ removeButton.setDisabled(true);
+ addAllButton = new TransferImgButton(TransferImgButton.RIGHT_ALL);
+ removeAllButton = new TransferImgButton(TransferImgButton.LEFT_ALL);
+ removeAllButton.setDisabled(true);
+
+ moveButtonStack.addMember(addButton);
+ moveButtonStack.addMember(removeButton);
+ moveButtonStack.addMember(addAllButton);
+ moveButtonStack.addMember(removeAllButton);
+
+ addMember(moveButtonStack);
+
+ VLayout assignedLayout = new VLayout();
+ assignedLayout.addMember(new LayoutSpacer());
+
+ assignedGrid = new ListGrid();
+ assignedGrid.setHeight(350);
+ assignedGrid.setCanReorderRecords(true);
+ assignedGrid.setCanDragRecordsOut(true);
+
+ assignedGrid.setCanAcceptDroppedRecords(true);
+ ListGridField iconField = new ListGridField("icon", 50);
+ iconField.setType(ListGridFieldType.ICON);
+ assignedGrid.setFields(iconField, new ListGridField("name"));
+
+ assignedLayout.addMember(assignedGrid);
+ addMember(assignedLayout);
+
+ addButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ assignedGrid.transferSelectedData(availableGrid);
+ select(assignedGrid.getSelection());
+ updateButtons();
+ }
+ });
+ removeButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ deselect(assignedGrid.getSelection());
+ assignedGrid.removeSelectedData();
+ updateButtons();
+ }
+ });
+ addAllButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ availableGrid.selectAllRecords();
+ assignedGrid.transferSelectedData(availableGrid);
+ select(availableGrid.getSelection());
+ updateButtons();
+ }
+ });
+ removeAllButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ assignedGrid.selectAllRecords();
+ deselect(assignedGrid.getSelection());
+ assignedGrid.removeSelectedData();
+ updateButtons();
+ }
+ });
+
+ availableGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
+ public void onSelectionChanged(SelectionEvent selectionEvent) {
+ updateButtons();
+ }
+ });
+
+ assignedGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
+ public void onSelectionChanged(SelectionEvent selectionEvent) {
+ updateButtons();
+ }
+ });
+
+ assignedGrid.addKeyPressHandler(new KeyPressHandler() {
+ public void onKeyPress(KeyPressEvent event) {
+ if ("Delete".equals(event.getKeyName())) {
+ deselect(assignedGrid.getSelection());
+ assignedGrid.removeSelectedData();
+ }
+ }
+ });
+
+ assignedGrid.addRecordDropHandler(new RecordDropHandler() {
+ public void onRecordDrop(RecordDropEvent recordDropEvent) {
+ select(recordDropEvent.getDropRecords());
+ }
+ });
+ }
+
+ protected void updateButtons() {
+ addButton.setDisabled(!availableGrid.anySelected() || availableGrid.getTotalRows() == 0);
+ removeButton.setDisabled(!assignedGrid.anySelected() || assignedGrid.getTotalRows() == 0);
+ addAllButton.setDisabled(availableGrid.getTotalRows() == 0);
+ removeAllButton.setDisabled(assignedGrid.getTotalRows() == 0);
+ }
+
+ protected void select(ListGridRecord[] records) {
+ availableGrid.deselectAllRecords();
+ for (ListGridRecord record : records) {
+ record.setEnabled(false);
+ selection.add(record.getAttributeAsInt("id"));
+ }
+ }
+
+ protected void deselect(ListGridRecord[] records) {
+ HashSet<Integer> toRemove = new HashSet<Integer>();
+ for (ListGridRecord record : records) {
+ toRemove.add(record.getAttributeAsInt("id"));
+ }
+ selection.removeAll(toRemove);
+
+ for (Integer id : toRemove) {
+ Record r = availableGrid.getDataAsRecordList().find("id", id);
+ if (r != null) {
+ ((ListGridRecord) r).setEnabled(true);
+ }
+ }
+ availableGrid.markForRedraw();
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceGroupSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceGroupSelector.java
new file mode 100644
index 0000000..06f6e4b
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceGroupSelector.java
@@ -0,0 +1,81 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.selection;
+
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.SelectItem;
+import com.smartgwt.client.widgets.form.fields.TextItem;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupsDataSource;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+
+/**
+ * @author Greg Hinkle
+ */
+public class ResourceGroupSelector extends AbstractSelector {
+
+ public ResourceGroupSelector() {
+ super();
+ }
+
+ protected DynamicForm getAvailableFilterForm() {
+ DynamicForm availableFilterForm = new DynamicForm();
+ availableFilterForm.setNumCols(4);
+ final TextItem search = new TextItem("search", "Search");
+
+ SelectItem groupCategorySelect = new SelectItem("groupCategory", "Group Category");
+ groupCategorySelect.setValueMap("Compatible", "Mixed");
+ groupCategorySelect.setAllowEmptyValue(true);
+ availableFilterForm.setItems(search, groupCategorySelect);
+
+ return availableFilterForm;
+ }
+
+ protected RPCDataSource<?> getDataSource() {
+ return new SelectedResourceGroupsDataSource();
+ }
+
+ protected Criteria getLatestCriteria(DynamicForm availableFilterForm) {
+ Criteria latestCriteria = new Criteria();
+ Object search = availableFilterForm.getValue("search");
+ Object category = availableFilterForm.getValue("groupCategory");
+ latestCriteria.setAttribute("name", search);
+ latestCriteria.setAttribute("groupCategory", category);
+
+ return latestCriteria;
+ }
+
+ private class SelectedResourceGroupsDataSource extends ResourceGroupsDataSource {
+
+ @Override
+ public ListGridRecord[] buildRecords(PageList<ResourceGroup> resourceGroups) {
+ ListGridRecord[] records = super.buildRecords(resourceGroups);
+ for (ListGridRecord record : records) {
+ if (selection.contains(record.getAttributeAsInt("id"))) {
+ record.setEnabled(false);
+ }
+ }
+ return records;
+ }
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java
index a309ce1..ea092d5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java
@@ -18,72 +18,30 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.selection;
-import java.util.HashSet;
-
-import com.google.gwt.user.client.Timer;
import com.smartgwt.client.data.Criteria;
-import com.smartgwt.client.data.Record;
-import com.smartgwt.client.types.DragDataAction;
-import com.smartgwt.client.types.DragTrackerMode;
-import com.smartgwt.client.types.ListGridFieldType;
-import com.smartgwt.client.types.VerticalAlignment;
-import com.smartgwt.client.widgets.ImgProperties;
-import com.smartgwt.client.widgets.TransferImgButton;
-import com.smartgwt.client.widgets.events.ClickEvent;
-import com.smartgwt.client.widgets.events.ClickHandler;
-import com.smartgwt.client.widgets.events.KeyPressEvent;
-import com.smartgwt.client.widgets.events.KeyPressHandler;
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.IPickTreeItem;
import com.smartgwt.client.widgets.form.fields.SelectItem;
import com.smartgwt.client.widgets.form.fields.TextItem;
-import com.smartgwt.client.widgets.grid.ListGrid;
-import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
-import com.smartgwt.client.widgets.grid.events.RecordDropEvent;
-import com.smartgwt.client.widgets.grid.events.RecordDropHandler;
-import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
-import com.smartgwt.client.widgets.grid.events.SelectionEvent;
-import com.smartgwt.client.widgets.layout.HLayout;
-import com.smartgwt.client.widgets.layout.LayoutSpacer;
-import com.smartgwt.client.widgets.layout.VLayout;
-import com.smartgwt.client.widgets.layout.VStack;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDatasource;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeTreeDataSource;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
/**
* @author Greg Hinkle
*/
-public class ResourceSelector extends HLayout {
-
- private HashSet<Integer> selection = new HashSet<Integer>();
-
- private ListGrid availableGrid;
- private ListGrid assignedGrid;
-
- private TransferImgButton addButton;
- private TransferImgButton removeButton;
- private TransferImgButton addAllButton;
- private TransferImgButton removeAllButton;
-
- private Criteria latestCriteria;
+public class ResourceSelector extends AbstractSelector {
public ResourceSelector() {
- setAlign(VerticalAlignment.BOTTOM);
- setHeight(380);
+ super();
}
- @Override
- protected void onDraw() {
- super.onDraw();
-
-
- final DynamicForm availableFilterForm = new DynamicForm();
+ protected DynamicForm getAvailableFilterForm() {
+ DynamicForm availableFilterForm = new DynamicForm();
availableFilterForm.setNumCols(6);
final TextItem search = new TextItem("search", "Search");
@@ -93,190 +51,29 @@ public class ResourceSelector extends HLayout {
typeSelectItem.setCanSelectParentItems(true);
typeSelectItem.setLoadDataOnDemand(false);
-
SelectItem categorySelect = new SelectItem("category", "Category");
categorySelect.setValueMap("Platform", "Server", "Service");
categorySelect.setAllowEmptyValue(true);
availableFilterForm.setItems(search, typeSelectItem, categorySelect);
- VLayout availableLayout = new VLayout();
- availableLayout.addMember(new LayoutSpacer());
-
- availableLayout.addMember(availableFilterForm);
-
- availableGrid = new ListGrid();
- availableGrid.setHeight(350);
- availableGrid.setCanDragRecordsOut(true);
- availableGrid.setDragTrackerMode(DragTrackerMode.ICON);
- availableGrid.setTrackerImage(new ImgProperties("types/Service_up_16.png", 16, 16));
- availableGrid.setDragDataAction(DragDataAction.COPY);
- availableGrid.setDataSource(new SelectedResourceDataSource());
- availableGrid.setFetchDelay(700);
-
- availableGrid.setAutoFetchData(true);
- availableGrid.setFields(new ListGridField("icon", 50), new ListGridField("name"));
-
- availableLayout.addMember(availableGrid);
-
- addMember(availableLayout);
-
-
- availableFilterForm.addItemChangedHandler(new ItemChangedHandler() {
- public void onItemChanged(ItemChangedEvent itemChangedEvent) {
- latestCriteria = new Criteria();
- latestCriteria.setAttribute("name", availableFilterForm.getValue("search"));
- latestCriteria.setAttribute("type", availableFilterForm.getValue("type"));
- latestCriteria.setAttribute("category", availableFilterForm.getValue("category"));
-
- Timer t = new Timer() {
- @Override
- public void run() {
- if (latestCriteria != null) {
- Criteria c = latestCriteria;
- latestCriteria = null;
- availableGrid.fetchData(c);
- }
- }
- };
- t.schedule(500);
- }
- });
-
-
- VStack moveButtonStack = new VStack(6);
- moveButtonStack.setAlign(VerticalAlignment.CENTER);
- moveButtonStack.setWidth(40);
-
- addButton = new TransferImgButton(TransferImgButton.RIGHT);
- addButton.setDisabled(true);
- removeButton = new TransferImgButton(TransferImgButton.LEFT);
- removeButton.setDisabled(true);
- addAllButton = new TransferImgButton(TransferImgButton.RIGHT_ALL);
- removeAllButton = new TransferImgButton(TransferImgButton.LEFT_ALL);
- removeAllButton.setDisabled(true);
-
- moveButtonStack.addMember(addButton);
- moveButtonStack.addMember(removeButton);
- moveButtonStack.addMember(addAllButton);
- moveButtonStack.addMember(removeAllButton);
-
- addMember(moveButtonStack);
-
-
- VLayout assignedLayout = new VLayout();
- assignedLayout.addMember(new LayoutSpacer());
-
- assignedGrid = new ListGrid();
- assignedGrid.setHeight(350);
- assignedGrid.setCanReorderRecords(true);
- assignedGrid.setCanDragRecordsOut(true);
-
- assignedGrid.setCanAcceptDroppedRecords(true);
- ListGridField iconField = new ListGridField("icon", 50);
- iconField.setType(ListGridFieldType.ICON);
- assignedGrid.setFields(iconField, new ListGridField("name"));
-
- assignedLayout.addMember(assignedGrid);
- addMember(assignedLayout);
-
-
-
- addButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- assignedGrid.transferSelectedData(availableGrid);
- select(assignedGrid.getSelection());
- updateButtons();
- }
- });
- removeButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- deselect(assignedGrid.getSelection());
- assignedGrid.removeSelectedData();
- updateButtons();
- }
- });
- addAllButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- availableGrid.selectAllRecords();
- assignedGrid.transferSelectedData(availableGrid);
- select(availableGrid.getSelection());
- updateButtons();
- }
- });
- removeAllButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- assignedGrid.selectAllRecords();
- deselect(assignedGrid.getSelection());
- assignedGrid.removeSelectedData();
- updateButtons();
- }
- });
-
- availableGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
- public void onSelectionChanged(SelectionEvent selectionEvent) {
- updateButtons();
- }
- });
-
- assignedGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
- public void onSelectionChanged(SelectionEvent selectionEvent) {
- updateButtons();
- }
- });
-
- assignedGrid.addKeyPressHandler(new KeyPressHandler() {
- public void onKeyPress(KeyPressEvent event) {
- if ("Delete".equals(event.getKeyName())) {
- deselect(assignedGrid.getSelection());
- assignedGrid.removeSelectedData();
- }
- }
- });
-
-
- assignedGrid.addRecordDropHandler(new RecordDropHandler() {
- public void onRecordDrop(RecordDropEvent recordDropEvent) {
- select(recordDropEvent.getDropRecords());
- }
- });
+ return availableFilterForm;
}
- private void updateButtons() {
- addButton.setDisabled(!availableGrid.anySelected() || availableGrid.getTotalRows() == 0);
- removeButton.setDisabled(!assignedGrid.anySelected() || assignedGrid.getTotalRows() == 0);
- addAllButton.setDisabled(availableGrid.getTotalRows() == 0);
- removeAllButton.setDisabled(assignedGrid.getTotalRows() == 0);
+ protected RPCDataSource<?> getDataSource() {
+ return new SelectedResourceDataSource();
}
- private void select(ListGridRecord[] records) {
- availableGrid.deselectAllRecords();
- for (ListGridRecord record : records) {
- record.setEnabled(false);
- selection.add(record.getAttributeAsInt("id"));
- }
- }
+ protected Criteria getLatestCriteria(DynamicForm availableFilterForm) {
+ Criteria latestCriteria = new Criteria();
+ latestCriteria.setAttribute("name", availableFilterForm.getValue("search"));
+ latestCriteria.setAttribute("type", availableFilterForm.getValue("type"));
+ latestCriteria.setAttribute("category", availableFilterForm.getValue("category"));
- private void deselect(ListGridRecord[] records) {
- HashSet<Integer> toRemove = new HashSet<Integer>();
- for (ListGridRecord record : records) {
- toRemove.add(record.getAttributeAsInt("id"));
- }
- selection.removeAll(toRemove);
-
-
- for (Integer id : toRemove) {
- Record r = availableGrid.getDataAsRecordList().find("id", id);
- if (r != null) {
- ((ListGridRecord) r).setEnabled(true);
- }
- }
- availableGrid.markForRedraw();
+ return latestCriteria;
}
-
private class SelectedResourceDataSource extends ResourceDatasource {
-
@Override
public ListGridRecord[] buildRecords(PageList<Resource> resources) {
ListGridRecord[] records = super.buildRecords(resources);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
index 5473a94..1477e95 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
@@ -24,6 +24,7 @@ import java.util.HashMap;
import org.rhq.core.domain.bundle.Bundle;
import org.rhq.core.domain.bundle.BundleDeployDefinition;
import org.rhq.core.domain.bundle.BundleDeployment;
+import org.rhq.core.domain.bundle.BundleGroupDeployment;
import org.rhq.core.domain.bundle.BundleType;
import org.rhq.core.domain.bundle.BundleVersion;
import org.rhq.core.domain.bundle.composite.BundleWithLatestVersionComposite;
@@ -163,4 +164,15 @@ public class BundleGWTServiceImpl extends AbstractGWTServiceImpl implements Bund
throw new RuntimeException(ThrowableUtil.getAllMessages(e));
}
}
+
+ public BundleGroupDeployment scheduleBundleGroupDeployment(int bundleDeployDefinitionId, int resourceGroupId)
+ throws Exception {
+ try {
+ BundleGroupDeployment result = bundleManager.scheduleBundleGroupDeployment(getSessionSubject(),
+ bundleDeployDefinitionId, resourceGroupId);
+ return SerialUtility.prepare(result, "scheduleBundleGroupDeployment");
+ } catch (Exception e) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ }
+ }
}
\ No newline at end of file
commit 8bd78f0b3a282f09d4549dee054d94855509d484
Merge: c3bb31e... ae88c7c...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Mar 29 00:31:34 2010 -0400
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
commit c3bb31e179881380b02df5d9dee0743878a3e4c5
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Mar 29 00:31:14 2010 -0400
introduce a new bundle type - ANT
we now two kinds of bundles - one has a simple recipe style (file template)
and the second uses Ant scripts as its recipe (thus providing a
more advanced way to lay down bundle content on the agent)
diff --git a/.classpath b/.classpath
index 082cf31..c1a9e78 100644
--- a/.classpath
+++ b/.classpath
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="modules/common/jboss-as/src/main/java"/>
+ <classpathentry kind="src" path="modules/common/ant-bundle/src/main/java"/>
+ <classpathentry kind="src" path="modules/common/ant-bundle/src/test/java"/>
<classpathentry kind="src" path="modules/common/filetemplate-bundle/src/main/java"/>
<classpathentry kind="src" path="modules/common/filetemplate-bundle/src/test/java"/>
<classpathentry kind="src" path="modules/enterprise/gui/base-perspective-jar/src/main/java"/>
@@ -71,6 +73,7 @@
<classpathentry kind="src" path="modules/enterprise/server/plugins/alert-microblog/src/main/java"/>
<classpathentry kind="src" path="modules/enterprise/server/plugins/alert-mobicents/src/main/java"/>
<classpathentry kind="src" path="modules/enterprise/server/plugins/cobbler/src/main/java"/>
+ <classpathentry kind="src" path="modules/enterprise/server/plugins/ant-bundle/src/main/java"/>
<classpathentry kind="src" path="modules/enterprise/server/plugins/filetemplate-bundle/src/main/java"/>
<classpathentry kind="src" path="modules/enterprise/gui/portal-war/src/main/java"/>
<classpathentry kind="src" path="modules/enterprise/gui/portal-war/src/test/java"/>
@@ -129,6 +132,8 @@
<classpathentry kind="src" path="modules/plugins/jdbctrace/src/main/java"/>
<classpathentry kind="src" path="modules/plugins/augeas/src/main/java"/>
<classpathentry kind="src" path="modules/plugins/augeas/src/test/java"/>
+ <classpathentry kind="src" path="modules/plugins/ant-bundle/src/main/java"/>
+ <classpathentry kind="src" path="modules/plugins/ant-bundle/src/test/java"/>
<classpathentry kind="src" path="modules/plugins/filetemplate-bundle/src/main/java"/>
<classpathentry kind="src" path="modules/plugins/filetemplate-bundle/src/test/java"/>
<classpathentry kind="src" path="modules/helpers/rtfilter/src/main/java"/>
diff --git a/modules/common/ant-bundle/pom.xml b/modules/common/ant-bundle/pom.xml
new file mode 100644
index 0000000..90e3f39
--- /dev/null
+++ b/modules/common/ant-bundle/pom.xml
@@ -0,0 +1,50 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-common-parent</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-ant-bundle-common</artifactId>
+ <packaging>jar</packaging>
+
+ <name>RHQ Ant Bundle Plugins Common Library</name>
+ <description>A library with the code common to the agent and server plugins for Ant Bundles</description>
+
+ <scm>
+ <connection>scm:git:ssh://git.fedorahosted.org/git/rhq.git/modules/common/ant-bundle/</connection>
+ <developerConnection>scm:git:ssh://git.fedorahosted.org/git/rhq.git/modules/common/ant-bundle/</developerConnection>
+ </scm>
+
+ <properties>
+ <scm.module.path>modules/common/ant-bundle/</scm.module.path>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>1.6.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-launcher</artifactId>
+ <version>1.6.5</version>
+ </dependency>
+
+ <!-- include some optional ant tasks for users to be able to use -->
+ <dependency>
+ <groupId>ant-contrib</groupId>
+ <artifactId>ant-contrib</artifactId>
+ <version>1.0b3</version>
+ </dependency>
+
+ </dependencies>
+
+</project>
\ No newline at end of file
diff --git a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/AbstractBundleTask.java b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/AbstractBundleTask.java
new file mode 100644
index 0000000..d5db4cc
--- /dev/null
+++ b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/AbstractBundleTask.java
@@ -0,0 +1,27 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License 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.bundle.ant;
+
+import org.apache.tools.ant.Task;
+
+public abstract class AbstractBundleTask extends Task {
+ public BundleAntProject getBundleAntProject() {
+ return (BundleAntProject) getProject();
+ }
+}
\ No newline at end of file
diff --git a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/AntLauncher.java b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/AntLauncher.java
new file mode 100644
index 0000000..b184274
--- /dev/null
+++ b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/AntLauncher.java
@@ -0,0 +1,191 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.bundle.ant;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.helper.ProjectHelper2;
+
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
+import org.rhq.core.domain.configuration.definition.PropertySimpleType;
+
+public class AntLauncher {
+
+ // currently, the bundle plugins don't need custom ant tasks, but there is an ant task stubbed for future use here
+ private static final String ANT_TASKS = "bundle-ant-tasks.properties";
+
+ /**
+ * Launches ANT and parses the given build file and optionally executes it.
+ *
+ * @param buildFile the build file that ANT will run
+ * @param target the target to run, <code>null</code> will run the default target
+ * @param customTaskDefs the properties file found in classloader that contains all the taskdef definitions
+ * @param properties set of properties to set for the ANT task to access
+ * @param logFile where ANT messages will be logged
+ * @param logStdOut if <code>true</code>, log messages will be sent to stdout as well as the log file
+ * @param execute if <code>true</code> the ant script will be parsed and executed; otherwise, it will only be parsed
+ *
+ * @throws RuntimeException
+ */
+ public BundleAntProject startAnt(File buildFile, String target, String customTaskDefs, Properties properties,
+ File logFile, boolean logStdOut, boolean execute) {
+
+ PrintWriter logFileOutput = null;
+
+ try {
+ logFileOutput = new PrintWriter(new FileOutputStream(logFile, true));
+
+ ClassLoader classLoader = getClass().getClassLoader();
+
+ Properties taskDefs = new Properties();
+ if (customTaskDefs != null) {
+ InputStream taskDefsStream = classLoader.getResourceAsStream(customTaskDefs);
+ try {
+ taskDefs.load(taskDefsStream);
+ } finally {
+ taskDefsStream.close();
+ }
+ }
+
+ BundleAntProject project = new BundleAntProject();
+ project.setCoreLoader(classLoader);
+ project.init();
+ project.setBaseDir(buildFile.getParentFile());
+
+ if (properties != null) {
+ for (Map.Entry<Object, Object> property : properties.entrySet()) {
+ project.setProperty(property.getKey().toString(), property.getValue().toString());
+ }
+ }
+
+ // notice we are adding the listener after we set the properties - we do not want the
+ // the properties echoed out in the log (in case they contain sensitive passwords)
+ project.addBuildListener(new LoggerAntBuildListener(target, logFileOutput, Project.MSG_DEBUG));
+ if (logStdOut) {
+ PrintWriter stdout = new PrintWriter(System.out);
+ project.addBuildListener(new LoggerAntBuildListener(target, stdout, Project.MSG_INFO));
+ }
+
+ for (Map.Entry<Object, Object> taskDef : taskDefs.entrySet()) {
+ project.addTaskDefinition(taskDef.getKey().toString(), Class.forName(taskDef.getValue().toString(),
+ true, classLoader));
+ }
+
+ ProjectHelper2 helper = new ProjectHelper2();
+ helper.parse(project, buildFile);
+
+ parseBundleFiles(project);
+ parseBundleConfiguration(project);
+
+ if (execute) {
+ project.executeTarget((target == null) ? project.getDefaultTarget() : target);
+ }
+
+ return project;
+
+ } catch (Exception e) {
+ throw new RuntimeException("Cannot run ANT on script [" + buildFile + "]. Cause: " + e, e);
+ } finally {
+ if (logFileOutput != null) {
+ logFileOutput.close();
+ }
+ }
+ }
+
+ private void parseBundleFiles(BundleAntProject project) {
+ Map<String, ? extends Task> refs = project.getReferences();
+ for (Map.Entry<String, ? extends Task> entry : refs.entrySet()) {
+ String refId = entry.getKey();
+ if (refId.startsWith("_bundlefile.")) {
+ Hashtable attribs = entry.getValue().getRuntimeConfigurableWrapper().getAttributeMap();
+
+ if (!attribs.containsKey("name")) {
+ throw new BuildException("Property id=[" + refId + "] must specify the 'name' attribute");
+ }
+ String name = attribs.get("name").toString();
+
+ // allow the bundle author to specify the bundle file in one of the standard two ways
+ Object location = attribs.get("location");
+ Object value = attribs.get("value");
+
+ String bundleFilename;
+ if (location != null) {
+ bundleFilename = location.toString();
+ } else if (value != null) {
+ bundleFilename = value.toString();
+ } else {
+ throw new BuildException("Property id=[" + refId + "], name=[" + name
+ + "] must specify the bundle file name in an attribute named 'location' or 'value'");
+ }
+
+ project.addBundleFile(name, bundleFilename);
+ }
+ }
+ }
+
+ private void parseBundleConfiguration(BundleAntProject project) {
+ Map<String, ? extends Task> refs = project.getReferences();
+ for (Map.Entry<String, ? extends Task> entry : refs.entrySet()) {
+ String refId = entry.getKey();
+ if (refId.startsWith("_bundleconfig.")) {
+ Hashtable attribs = entry.getValue().getRuntimeConfigurableWrapper().getAttributeMap();
+
+ if (!attribs.containsKey("name")) {
+ throw new BuildException("Property id=[" + refId + "] must specify the 'name' attribute");
+ }
+ String name = attribs.get("name").toString();
+
+ // allow the bundle author to specify the bundle config prop in one of the standard two ways
+ Object location = attribs.get("location");
+ Object value = attribs.get("value");
+
+ String bundlePropValue;
+ if (location != null) {
+ bundlePropValue = location.toString();
+ } else if (value != null) {
+ bundlePropValue = value.toString();
+ } else {
+ throw new BuildException("Property id=[" + refId + "], name=[" + name
+ + "] must specify the bundle configuration name in an attribute named 'location' or 'value'");
+ }
+
+ PropertyDefinitionSimple prop = new PropertyDefinitionSimple(name, "Needed by bundle recipe.", false,
+ PropertySimpleType.STRING);
+ prop.setDisplayName(name);
+ prop.setDefaultValue(bundlePropValue);// TODO: I would like to set this-setDefaultValue is deprecated, how to do this?
+ ConfigurationDefinition configDef = project.getConfigurationDefinition();
+ configDef.put(prop);
+ }
+ }
+ }
+}
diff --git a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/BundleAntProject.java b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/BundleAntProject.java
new file mode 100644
index 0000000..0dd282c
--- /dev/null
+++ b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/BundleAntProject.java
@@ -0,0 +1,50 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.bundle.ant;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tools.ant.Project;
+
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+
+public class BundleAntProject extends Project {
+ private final Map<String, String> bundleFiles = new HashMap<String, String>();
+ private ConfigurationDefinition configDef;
+
+ public Map<String, String> getBundleFiles() {
+ return bundleFiles;
+ }
+
+ public void addBundleFile(String name, String filename) {
+ bundleFiles.put(name, filename);
+ }
+
+ public ConfigurationDefinition getConfigurationDefinition() {
+ if (configDef == null) {
+ configDef = new ConfigurationDefinition("antbundle", null);
+ }
+ return configDef;
+ }
+}
diff --git a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/BundleTask.java b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/BundleTask.java
new file mode 100644
index 0000000..a21ca6e
--- /dev/null
+++ b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/BundleTask.java
@@ -0,0 +1,29 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License 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.bundle.ant;
+
+import org.apache.tools.ant.BuildException;
+
+public class BundleTask extends AbstractBundleTask {
+ @Override
+ public void execute() throws BuildException {
+ // TODO this is a stub for a custom bundle task, in case we need one
+ return;
+ }
+}
\ No newline at end of file
diff --git a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/LoggerAntBuildListener.java b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/LoggerAntBuildListener.java
new file mode 100644
index 0000000..e7365e3
--- /dev/null
+++ b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/LoggerAntBuildListener.java
@@ -0,0 +1,115 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License 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.bundle.ant;
+
+import java.io.PrintWriter;
+import java.util.Date;
+
+import org.apache.tools.ant.BuildEvent;
+import org.apache.tools.ant.BuildListener;
+import org.apache.tools.ant.Target;
+import org.apache.tools.ant.Task;
+
+/**
+ * Listens for ANT build events and logs them to a log stream.
+ *
+ * @author John Mazzitelli
+ */
+public class LoggerAntBuildListener implements BuildListener {
+ private final String mainTarget;
+ private final PrintWriter output;
+ private final int priorityThreshold;
+
+ public LoggerAntBuildListener(String target, PrintWriter logFile, int priorityThreshold) {
+ this.mainTarget = (target != null) ? target : "(default)";
+ this.output = logFile;
+ this.priorityThreshold = priorityThreshold;
+
+ // start with the date this was started
+ this.output.println("======================================");
+ this.output.println("ANT target [" + this.mainTarget + "]");
+ this.output.println(new Date().toString());
+ this.output.println("======================================");
+ }
+
+ public void buildFinished(BuildEvent event) {
+ logEvent(event, "FINISHED! [" + this.mainTarget + ']');
+ }
+
+ public void buildStarted(BuildEvent event) {
+ logEvent(event, "STARTED! [" + this.mainTarget + ']');
+ }
+
+ public void messageLogged(BuildEvent event) {
+ logEvent(event, null);
+ }
+
+ public void targetFinished(BuildEvent event) {
+ logEvent(event, null);
+ }
+
+ public void targetStarted(BuildEvent event) {
+ logEvent(event, null);
+ }
+
+ public void taskFinished(BuildEvent event) {
+ logEvent(event, null);
+ }
+
+ public void taskStarted(BuildEvent event) {
+ logEvent(event, null);
+ }
+
+ private void logEvent(BuildEvent event, String additionalMessage) {
+ if (event.getPriority() > this.priorityThreshold) {
+ return;
+ }
+
+ String message = event.getMessage();
+ Throwable exception = event.getException();
+ Target target = event.getTarget();
+ Task task = event.getTask();
+
+ if (additionalMessage != null) {
+ output.println(additionalMessage);
+ }
+
+ if (target != null) {
+ output.print("[" + target.getName() + "] ");
+ }
+
+ if (task != null) {
+ output.print("[" + task.getTaskName() + "] ");
+ }
+
+ if (message != null) {
+ output.print(message);
+ }
+
+ if (exception != null) {
+ output.println();
+ exception.printStackTrace(output);
+ }
+
+ output.println();
+ output.flush();
+
+ return;
+ }
+}
\ No newline at end of file
diff --git a/modules/common/ant-bundle/src/main/resources/bundle-ant-tasks.properties b/modules/common/ant-bundle/src/main/resources/bundle-ant-tasks.properties
new file mode 100644
index 0000000..6f84e21
--- /dev/null
+++ b/modules/common/ant-bundle/src/main/resources/bundle-ant-tasks.properties
@@ -0,0 +1 @@
+bundle-task=org.rhq.bundle.ant.BundleTask
\ No newline at end of file
diff --git a/modules/common/ant-bundle/src/test/java/org/rhq/bundle/ant/AntLauncherTest.java b/modules/common/ant-bundle/src/test/java/org/rhq/bundle/ant/AntLauncherTest.java
new file mode 100644
index 0000000..01de89e
--- /dev/null
+++ b/modules/common/ant-bundle/src/test/java/org/rhq/bundle/ant/AntLauncherTest.java
@@ -0,0 +1,87 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package org.rhq.bundle.ant;
+
+import java.io.File;
+import java.util.Map;
+
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+
+@Test
+public class AntLauncherTest {
+ private File logFile;
+
+ @BeforeMethod
+ public void beforeMethod() {
+ logFile = new File("target/test-ant-log.txt");
+ if (logFile.exists()) {
+ if (!logFile.delete()) {
+ System.out.println("Failed to clean up test - log file did not delete");
+ }
+ }
+ return;
+ }
+
+ public void testSimpleParseTest() throws Exception {
+ AntLauncher ant = new AntLauncher();
+ BundleAntProject project = ant.startAnt(getBuildXml("simple-build.xml"), "unnecessary-target", null, null,
+ logFile, true, false);
+ assert project != null;
+ Map<String, String> bundleFiles = project.getBundleFiles();
+ assert bundleFiles != null;
+ assert bundleFiles.size() == 2 : bundleFiles;
+ assert bundleFiles.get("f").equals("file.txt") : bundleFiles;
+ assert bundleFiles.get("pkg").equals("package.zip") : bundleFiles;
+
+ ConfigurationDefinition configDef = project.getConfigurationDefinition();
+ assert configDef.getPropertyDefinitions().size() == 2;
+ assert configDef.getPropertyDefinitionSimple("custom.prop1") != null;
+ assert configDef.getPropertyDefinitionSimple("custom.prop2") != null;
+ }
+
+ public void testSimpleExecTest() throws Exception {
+ AntLauncher ant = new AntLauncher();
+ BundleAntProject project = ant.startAnt(getBuildXml("simple-build.xml"), "first-target", null, null, logFile,
+ true, true);
+ Map<String, String> bundleFiles = project.getBundleFiles();
+ assert bundleFiles != null;
+ assert bundleFiles.size() == 2 : bundleFiles;
+ assert bundleFiles.get("f").equals("file.txt") : bundleFiles;
+ assert bundleFiles.get("pkg").equals("package.zip") : bundleFiles;
+
+ ConfigurationDefinition configDef = project.getConfigurationDefinition();
+ assert configDef.getPropertyDefinitions().size() == 2;
+ assert configDef.getPropertyDefinitionSimple("custom.prop1") != null;
+ assert configDef.getPropertyDefinitionSimple("custom.prop2") != null;
+ }
+
+ private File getBuildXml(String name) throws Exception {
+ File file = new File("target/test-classes", name);
+ assert file.exists() : "the test ant build script doesn't exist: " + file.getAbsolutePath();
+ return file;
+ }
+}
diff --git a/modules/common/ant-bundle/src/test/resources/simple-build.xml b/modules/common/ant-bundle/src/test/resources/simple-build.xml
new file mode 100644
index 0000000..fecb376
--- /dev/null
+++ b/modules/common/ant-bundle/src/test/resources/simple-build.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<project name="simple-bundle-test">
+ <property id="_bundlefile.1" name="f" location="file.txt" />
+ <property id="_bundleconfig.1" name="custom.prop1" location="1" />
+
+ <target name="first-target">
+ <echo>Hello!!!!!!!!</echo>
+ <property id="_bundlefile.2" name="pkg" value="package.zip" />
+ <property id="_bundleconfig.2" name="custom.prop2" value="2" />
+ <echo>World!!!!!!!!</echo>
+ </target>
+</project>
\ No newline at end of file
diff --git a/modules/common/pom.xml b/modules/common/pom.xml
index 8abfe11..1e561b4 100644
--- a/modules/common/pom.xml
+++ b/modules/common/pom.xml
@@ -67,5 +67,6 @@
<modules>
<module>jboss-as</module>
<module>filetemplate-bundle</module>
+ <module>ant-bundle</module>
</modules>
</project>
\ No newline at end of file
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginService.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginService.java
index 07c49a8..0e83859 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginService.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginService.java
@@ -143,12 +143,12 @@ public class ServerPluginService implements ServerPluginServiceManagement {
File tmpDir = LookupUtil.getCoreServer().getJBossServerTempDir();
- // TODO: determine what things to hide from our war classloader
- //StringBuilder defaultRegex = new StringBuilder();
- //defaultRegex.append("(package\\.with\\.classes\\.to\\.hide\\..*)|");
+ // determine what things to hide from our war classloader
+ StringBuilder defaultRegex = new StringBuilder();
+ defaultRegex.append("(org\\.apache\\.tools\\..*)"); // ant.jar
MasterServerPluginContainerConfiguration config;
- config = new MasterServerPluginContainerConfiguration(pluginDir, dataDir, tmpDir, null);
+ config = new MasterServerPluginContainerConfiguration(pluginDir, dataDir, tmpDir, defaultRegex.toString());
pc.initialize(config);
return pc;
}
diff --git a/modules/enterprise/server/plugins/ant-bundle/pom.xml b/modules/enterprise/server/plugins/ant-bundle/pom.xml
new file mode 100644
index 0000000..b044ca3
--- /dev/null
+++ b/modules/enterprise/server/plugins/ant-bundle/pom.xml
@@ -0,0 +1,214 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-enterprise-server-plugins-parent</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-serverplugin-ant-bundle</artifactId>
+ <packaging>jar</packaging>
+
+ <name>RHQ Ant Bundle Server Plugin</name>
+ <description>Server side plugin that manages ant-scripted bundles</description>
+
+ <scm>
+ <connection>scm:git:ssh://git.fedorahosted.org/git/rhq.git/modules/enterprise/server/pl…</connection>
+ <developerConnection>scm:git:ssh://git.fedorahosted.org/git/rhq.git/modules/enterprise/server/pl…</developerConnection>
+ </scm>
+
+ <properties>
+ <scm.module.path>modules/enterprise/server/plugins/ant-bundle/</scm.module.path>
+ </properties>
+
+ <dependencies>
+
+ <!-- Internal Deps -->
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-domain</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-client-api</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-ant-bundle-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- 3rd Party Deps -->
+
+ <!-- TODO: This is a fix for the Javac bug requiring annotations to be
+ available when compiling dependent classes. It is fixed in JDK 6 -->
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss.jboss-embeddable-ejb3</groupId>
+ <artifactId>hibernate-all</artifactId>
+ <version>1.0.0.Alpha9</version>
+ <scope>provided</scope>
+ <!-- needed for referenced domain entities that use Hibernate annotations -->
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludedGroups>${rhq.testng.excludedGroups}</excludedGroups>
+ <!--
+ <argLine>-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y</argLine>
+ -->
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.0</version>
+ <executions>
+ <execution>
+ <id>copy-rhq-plugins</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-ant-bundle-common</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>1.6.5</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>ant</groupId>
+ <artifactId>ant-launcher</artifactId>
+ <version>1.6.5</version>
+ </artifactItem>
+
+ <!-- include some optional ant tasks for users to be able to use -->
+ <artifactItem>
+ <groupId>ant-contrib</groupId>
+ <artifactId>ant-contrib</artifactId>
+ <version>1.0b3</version>
+ </artifactItem>
+
+ </artifactItems>
+ <outputDirectory>${project.build.outputDirectory}/lib</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+
+ <profiles>
+
+ <profile>
+ <id>dev</id>
+
+ <properties>
+ <rhq.rootDir>../../../../..</rhq.rootDir>
+ <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir>
+ <rhq.deploymentDir>${rhq.containerDir}/jbossas/server/default/deploy/${rhq.earName}/rhq-serverplugins</rhq.deploymentDir>
+ </properties>
+
+ <build>
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.1</version>
+ <executions>
+
+ <execution>
+ <id>deploy</id>
+ <phase>compile</phase>
+ <configuration>
+ <tasks>
+ <mkdir dir="${rhq.deploymentDir}" />
+ <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
+ <echo>*** Updating ${deployment.file}...</echo>
+ <jar destfile="${deployment.file}" basedir="${project.build.outputDirectory}" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ <execution>
+ <id>undeploy</id>
+ <phase>clean</phase>
+ <configuration>
+ <tasks>
+ <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
+ <echo>*** Deleting ${deployment.file}...</echo>
+ <delete file="${deployment.file}" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ <execution>
+ <id>deploy-jar-meta-inf</id>
+ <phase>package</phase>
+ <configuration>
+ <tasks>
+ <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
+ <echo>*** Updating META-INF dir in ${deployment.file}...</echo>
+ <unjar src="${project.build.directory}/${project.build.finalName}.jar" dest="${project.build.outputDirectory}">
+ <patternset>
+ <include name="META-INF/**" />
+ </patternset>
+ </unjar>
+ <jar destfile="${deployment.file}" manifest="${project.build.outputDirectory}/META-INF/MANIFEST.MF"
+ update="true">
+ </jar>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+ </profile>
+
+ </profiles>
+
+</project>
\ No newline at end of file
diff --git a/modules/enterprise/server/plugins/ant-bundle/src/main/java/org/rhq/enterprise/server/plugins/ant/AntBundleServerPluginComponent.java b/modules/enterprise/server/plugins/ant-bundle/src/main/java/org/rhq/enterprise/server/plugins/ant/AntBundleServerPluginComponent.java
new file mode 100644
index 0000000..15e4ecb
--- /dev/null
+++ b/modules/enterprise/server/plugins/ant-bundle/src/main/java/org/rhq/enterprise/server/plugins/ant/AntBundleServerPluginComponent.java
@@ -0,0 +1,125 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.enterprise.server.plugins.ant;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.util.HashSet;
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.rhq.bundle.ant.AntLauncher;
+import org.rhq.bundle.ant.BundleAntProject;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.util.stream.StreamUtil;
+import org.rhq.enterprise.server.bundle.RecipeParseResults;
+import org.rhq.enterprise.server.plugin.pc.ServerPluginComponent;
+import org.rhq.enterprise.server.plugin.pc.ServerPluginContext;
+import org.rhq.enterprise.server.plugin.pc.bundle.BundleServerPluginFacet;
+
+/**
+ * A bundle server-side plugin component that the server uses to process ant-based bundles.
+ *
+ * @author John Mazzitelli
+ */
+public class AntBundleServerPluginComponent implements ServerPluginComponent, BundleServerPluginFacet {
+
+ private final Log log = LogFactory.getLog(AntBundleServerPluginComponent.class);
+
+ private ServerPluginContext context;
+ private File tmpDirectory;
+
+ public void initialize(ServerPluginContext context) throws Exception {
+ this.context = context;
+ this.tmpDirectory = new File(this.context.getTemporaryDirectory(), "ant-bundle-server-plugin");
+ this.tmpDirectory.mkdirs();
+ if (!this.tmpDirectory.exists() || !this.tmpDirectory.isDirectory()) {
+ throw new Exception("Failed to create tmp dir [" + this.tmpDirectory + "] - cannot process ant bundles");
+ }
+ log.debug("The ant bundle plugin has been initialized: " + this);
+ }
+
+ public void start() {
+ log.debug("The ant bundle plugin has started: " + this);
+ }
+
+ public void stop() {
+ log.debug("The ant bundle plugin has stopped: " + this);
+ }
+
+ public void shutdown() {
+ log.debug("The ant bundle plugin has been shut down: " + this);
+ }
+
+ public RecipeParseResults parseRecipe(String recipe) throws Exception {
+
+ Map<String, String> bundleFiles = null;
+ ConfigurationDefinition configDef = null;
+ RecipeParseResults results;
+
+ File recipeFile = File.createTempFile("ant-bundle-recipe", ".xml", this.tmpDirectory);
+ File logFile = File.createTempFile("ant-bundle-recipe", ".log", this.tmpDirectory);
+ try {
+ // store the recipe in the tmp recipe file
+ ByteArrayInputStream in = new ByteArrayInputStream(recipe.getBytes());
+ FileOutputStream out = new FileOutputStream(recipeFile);
+ StreamUtil.copy(in, out);
+
+ // parse, but do not execute, the ant script
+ AntLauncher antLauncher = new AntLauncher();
+ BundleAntProject project = antLauncher.startAnt(recipeFile, null, null, null, logFile, false, false);
+
+ // obtain the parse results
+ bundleFiles = project.getBundleFiles();
+ configDef = project.getConfigurationDefinition();
+ } catch (Throwable t) {
+ if (log.isDebugEnabled()) {
+ try {
+ log.debug(new String(StreamUtil.slurp(new FileInputStream(logFile))));
+ } catch (Exception e) {
+ }
+ }
+ throw new Exception("Failed to parse the bundle ANT script", t);
+ } finally {
+ recipeFile.delete();
+ logFile.delete();
+ }
+
+ results = new RecipeParseResults(configDef, new HashSet<String>(bundleFiles.values()));
+ return results;
+
+ }
+
+ @Override
+ public String toString() {
+ if (this.context == null) {
+ return "<no context>";
+ }
+
+ StringBuilder str = new StringBuilder();
+ str.append("plugin-key=").append(this.context.getPluginEnvironment().getPluginKey()).append(",");
+ str.append("plugin-url=").append(this.context.getPluginEnvironment().getPluginUrl());
+ return str.toString();
+ }
+}
diff --git a/modules/enterprise/server/plugins/ant-bundle/src/main/resources/META-INF/rhq-serverplugin.xml b/modules/enterprise/server/plugins/ant-bundle/src/main/resources/META-INF/rhq-serverplugin.xml
new file mode 100644
index 0000000..23208b7
--- /dev/null
+++ b/modules/enterprise/server/plugins/ant-bundle/src/main/resources/META-INF/rhq-serverplugin.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<bundle-plugin name="AntBundleServerPlugin"
+ displayName="Ant Bundle Processor"
+ description="Processes bundles whose recipes are Ant scripts"
+ package="org.rhq.enterprise.server.plugins.ant"
+ xmlns="urn:xmlns:rhq-serverplugin.bundle"
+ xmlns:serverplugin="urn:xmlns:rhq-serverplugin"
+ xmlns:c="urn:xmlns:rhq-configuration">
+
+ <serverplugin:help><![CDATA[
+ Processes Ant bundles on the server side.
+ ]]></serverplugin:help>
+
+ <serverplugin:plugin-component class="AntBundleServerPluginComponent">
+ </serverplugin:plugin-component>
+
+ <bundle type="Ant Bundle"/>
+
+</bundle-plugin>
diff --git a/modules/enterprise/server/plugins/pom.xml b/modules/enterprise/server/plugins/pom.xml
index b86cde2..06f91cf 100644
--- a/modules/enterprise/server/plugins/pom.xml
+++ b/modules/enterprise/server/plugins/pom.xml
@@ -84,6 +84,7 @@
<module>alert-subject</module>
<module>cobbler</module>
<module>filetemplate-bundle</module>
+ <module>ant-bundle</module>
<module>validate-all-serverplugins</module>
</modules>
diff --git a/modules/enterprise/server/plugins/validate-all-serverplugins/pom.xml b/modules/enterprise/server/plugins/validate-all-serverplugins/pom.xml
index 58e3d40..9c7cc74 100644
--- a/modules/enterprise/server/plugins/validate-all-serverplugins/pom.xml
+++ b/modules/enterprise/server/plugins/validate-all-serverplugins/pom.xml
@@ -54,6 +54,7 @@
<pathelement location="../alert-subject/target/alert-subject-${project.version}.jar" />
<pathelement location="../cobbler/target/cobbler-${project.version}.jar" />
<pathelement location="../filetemplate-bundle/target/rhq-serverplugin-filetemplate-bundle-${project.version}.jar" />
+ <pathelement location="../ant-bundle/target/rhq-serverplugin-ant-bundle-${project.version}.jar" />
<pathelement location="../perspectives/core/target/rhq-core-perspective-${project.version}.jar" />
</classpath>
<sysproperty key="org.apache.commons.logging.Log" value="org.apache.commons.logging.impl.SimpleLog" />
diff --git a/modules/plugins/ant-bundle/pom.xml b/modules/plugins/ant-bundle/pom.xml
new file mode 100644
index 0000000..3777af9
--- /dev/null
+++ b/modules/plugins/ant-bundle/pom.xml
@@ -0,0 +1,267 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-plugins-parent</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-ant-bundle-plugin</artifactId>
+ <packaging>jar</packaging>
+
+ <name>RHQ Ant Bundle Plugin</name>
+ <description>a plugin that processes ant-based bundles</description>
+
+ <scm>
+ <connection>scm:git:ssh://git.fedorahosted.org/git/rhq.git/modules/plugins/ant-bundle/</connection>
+ <developerConnection>scm:git:ssh://git.fedorahosted.org/git/rhq.git/modules/plugins/ant-bundle/</developerConnection>
+ </scm>
+
+ <properties>
+ <scm.module.path>modules/plugins/ant-bundle/</scm.module.path>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-ant-bundle-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.0</version>
+ <executions>
+ <execution>
+ <id>copy-rhq-plugins</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-ant-bundle-common</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>1.6.5</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>ant</groupId>
+ <artifactId>ant-launcher</artifactId>
+ <version>1.6.5</version>
+ </artifactItem>
+
+ <!-- include some optional ant tasks for users to be able to use -->
+ <artifactItem>
+ <groupId>ant-contrib</groupId>
+ <artifactId>ant-contrib</artifactId>
+ <version>1.0b3</version>
+ </artifactItem>
+
+ </artifactItems>
+ <outputDirectory>${project.build.outputDirectory}/lib</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>integration-tests</id>
+ <activation>
+ <property>
+ <name>maven.test.skip</name>
+ <value>!true</value>
+ </property>
+ </activation>
+
+ <build>
+ <plugins>
+ <!-- Integration testing voodoo to load and test this plugin with its plugin dependencies -->
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <echo>Setting up plugin dependencies for ${project.artifactId}-${project.version}.jar...</echo>
+ <property name="settings.localRepository" location="${user.home}/.m2/repository" />
+ <mkdir dir="target/itest" />
+ <mkdir dir="target/itest/plugins" />
+ <mkdir dir="target/itest/lib" />
+ <copy toDir="target/itest/plugins" flatten="true">
+ <fileset dir="${settings.localRepository}/">
+ <include name="org/rhq/rhq-platform-plugin/${project.version}/rhq-platform-plugin-${project.version}.jar" />
+ </fileset>
+ <fileset dir="${project.build.directory}">
+ <include name="${project.artifactId}-${project.version}.jar" />
+ </fileset>
+ </copy>
+ <unzip dest="target/itest/lib">
+ <fileset dir="${settings.localRepository}/org/hyperic/sigar-dist/${sigar.version}" includes="*.zip" />
+ <patternset>
+ <include name="**/lib/sigar.jar" />
+ <include name="**/lib/bcel*.jar" />
+ <include name="**/lib/*.so" />
+ <include name="**/lib/*.sl" />
+ <include name="**/lib/*.dll" />
+ <include name="**/lib/*.dylib" />
+ </patternset>
+ </unzip>
+ <move todir="target/itest/lib" flatten="true">
+ <fileset dir="target/itest/lib">
+ <include name="**/lib/*" />
+ </fileset>
+ </move>
+ <delete dir="target/itest/lib/hyperic-sigar-${sigar.version}" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ <executions>
+ <execution>
+ <id>surefire-it</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>${maven.test.skip}</skip>
+ <excludedGroups>${rhq.testng.excludedGroups}</excludedGroups>
+ <useSystemClassLoader>false</useSystemClassLoader>
+ <argLine>-Dorg.hyperic.sigar.path=${basedir}/target/itest/lib</argLine>
+ <!--
+ <argLine>-Dorg.hyperic.sigar.path=${basedir}/target/itest/lib -Xdebug -Xnoagent -Djava.compiler=NONE
+ -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y</argLine>
+ -->
+ <systemProperties>
+ <property>
+ <name>project.artifactId</name>
+ <value>${project.artifactId}</value>
+ </property>
+ <property>
+ <name>project.version</name>
+ <value>${project.version}</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+
+ </build>
+ </profile>
+
+ <profile>
+ <id>dev</id>
+
+ <properties>
+ <rhq.rootDir>../../..</rhq.rootDir>
+ <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir>
+ <rhq.deploymentDir>${rhq.containerDir}/jbossas/server/default/deploy/${rhq.earName}/rhq-downloads/rhq-plugins</rhq.deploymentDir>
+ </properties>
+
+ <build>
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.1</version>
+ <executions>
+
+ <execution>
+ <id>deploy</id>
+ <phase>compile</phase>
+ <configuration>
+ <tasks>
+ <mkdir dir="${rhq.deploymentDir}" />
+ <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
+ <echo>*** Updating ${deployment.file}...</echo>
+ <jar destfile="${deployment.file}" basedir="${project.build.outputDirectory}" update="true" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ <execution>
+ <id>deploy-jar-meta-inf</id>
+ <phase>package</phase>
+ <configuration>
+ <tasks>
+ <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
+ <echo>*** Updating META-INF dir in ${deployment.file}...</echo>
+ <unjar src="${project.build.directory}/${project.build.finalName}.jar" dest="${project.build.outputDirectory}">
+ <patternset>
+ <include name="META-INF/**" />
+ </patternset>
+ </unjar>
+ <jar destfile="${deployment.file}" manifest="${project.build.outputDirectory}/META-INF/MANIFEST.MF"
+ update="true">
+ </jar>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ <execution>
+ <id>undeploy</id>
+ <phase>clean</phase>
+ <configuration>
+ <tasks>
+ <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
+ <echo>*** Deleting ${deployment.file}...</echo>
+ <delete file="${deployment.file}" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+ </profile>
+
+ </profiles>
+
+</project>
diff --git a/modules/plugins/ant-bundle/src/main/java/org/rhq/plugins/ant/AntBundlePluginComponent.java b/modules/plugins/ant-bundle/src/main/java/org/rhq/plugins/ant/AntBundlePluginComponent.java
new file mode 100644
index 0000000..f523be1
--- /dev/null
+++ b/modules/plugins/ant-bundle/src/main/java/org/rhq/plugins/ant/AntBundlePluginComponent.java
@@ -0,0 +1,136 @@
+/*
+ * 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.plugins.ant;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.rhq.bundle.ant.AntLauncher;
+import org.rhq.bundle.ant.BundleAntProject;
+import org.rhq.core.domain.bundle.BundleDeployDefinition;
+import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.Property;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.pluginapi.bundle.BundleDeployRequest;
+import org.rhq.core.pluginapi.bundle.BundleDeployResult;
+import org.rhq.core.pluginapi.bundle.BundleFacet;
+import org.rhq.core.pluginapi.inventory.ResourceComponent;
+import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.core.system.SystemInfoFactory;
+import org.rhq.core.util.stream.StreamUtil;
+
+/**
+ * @author John Mazzitelli
+ */
+@SuppressWarnings("unchecked")
+public class AntBundlePluginComponent implements ResourceComponent, BundleFacet {
+
+ private final Log log = LogFactory.getLog(AntBundlePluginComponent.class);
+
+ private ResourceContext resourceContext;
+
+ private File tmpDirectory;
+
+ public void start(ResourceContext context) throws Exception {
+ resourceContext = context;
+ this.tmpDirectory = new File(context.getTemporaryDirectory(), "ant-bundle-plugin");
+ this.tmpDirectory.mkdirs();
+ if (!this.tmpDirectory.exists() || !this.tmpDirectory.isDirectory()) {
+ throw new Exception("Failed to create tmp dir [" + this.tmpDirectory + "] - cannot process ant bundles");
+ }
+ }
+
+ public void stop() {
+ }
+
+ public AvailabilityType getAvailability() {
+ return AvailabilityType.UP;
+ }
+
+ public BundleDeployResult deployBundle(BundleDeployRequest request) {
+ BundleDeployResult result = new BundleDeployResult();
+ try {
+ BundleDeployDefinition bundleDeployDef = request.getBundleDeployDefinition();
+ BundleVersion bundleVersion = bundleDeployDef.getBundleVersion();
+
+ String recipe = bundleVersion.getRecipe();
+ File recipeFile = File.createTempFile("ant-bundle-recipe", ".xml", request.getBundleFilesLocation());
+ File logFile = File.createTempFile("ant-bundle-recipe", ".log", this.tmpDirectory);
+ try {
+ // store the recipe in the tmp recipe file
+ ByteArrayInputStream in = new ByteArrayInputStream(recipe.getBytes());
+ FileOutputStream out = new FileOutputStream(recipeFile);
+ StreamUtil.copy(in, out);
+
+ // get the bundle's configuration values and the global system facts and
+ // add them as ant properties so the ant script can get their values
+ Configuration config = bundleDeployDef.getConfiguration();
+ Map<String, String> sysFacts = SystemInfoFactory.fetchTemplateEngine().getTokens();
+ Properties antProps = new Properties();
+ for (Map.Entry<String, String> fact : sysFacts.entrySet()) {
+ antProps.setProperty(fact.getKey(), fact.getValue());
+ }
+ if (config != null) {
+ Map<String, Property> allProperties = config.getAllProperties();
+ for (Map.Entry<String, Property> entry : allProperties.entrySet()) {
+ String name = entry.getKey();
+ Property prop = entry.getValue();
+ String value;
+ if (prop instanceof PropertySimple) {
+ value = ((PropertySimple) prop).getStringValue();
+ } else {
+ // for now, just skip all property lists and maps, just assume we are getting simples
+ continue;
+ }
+ antProps.setProperty(name, value);
+ }
+ }
+
+ // parse & execute, the ant script
+ AntLauncher antLauncher = new AntLauncher();
+ BundleAntProject project = antLauncher.startAnt(recipeFile, null, null, antProps, logFile, false, true);
+ } catch (Throwable t) {
+ if (log.isDebugEnabled()) {
+ try {
+ log.debug(new String(StreamUtil.slurp(new FileInputStream(logFile))));
+ } catch (Exception e) {
+ }
+ }
+ throw new Exception("Failed to parse the bundle ANT script", t);
+ } finally {
+ recipeFile.delete();
+ logFile.delete();
+ }
+
+ } catch (Throwable t) {
+ log.error("Failed to deploy bundle [" + request + "]", t);
+ result.setErrorMessage(t);
+ }
+ return result;
+ }
+}
diff --git a/modules/plugins/ant-bundle/src/main/java/org/rhq/plugins/ant/AntBundlePluginDiscoveryComponent.java b/modules/plugins/ant-bundle/src/main/java/org/rhq/plugins/ant/AntBundlePluginDiscoveryComponent.java
new file mode 100644
index 0000000..50a2f86
--- /dev/null
+++ b/modules/plugins/ant-bundle/src/main/java/org/rhq/plugins/ant/AntBundlePluginDiscoveryComponent.java
@@ -0,0 +1,51 @@
+/*
+ * 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.plugins.ant;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
+
+/**
+ * @author John Mazzitelli
+ */
+@SuppressWarnings("unchecked")
+public class AntBundlePluginDiscoveryComponent implements ResourceDiscoveryComponent {
+ //private final Log log = LogFactory.getLog(FileTemplateBundlePluginDiscoveryComponent.class);
+
+ public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext context) {
+
+ HashSet<DiscoveredResourceDetails> set = new HashSet<DiscoveredResourceDetails>();
+
+ String key = "ant-bundle";
+ String name = "Ant Bundle Handler";
+ String version = this.getClass().getPackage().getImplementationVersion();
+ String description = "Processes bundles whose recipes are Ant scripts";
+
+ DiscoveredResourceDetails resource = new DiscoveredResourceDetails(context.getResourceType(), key, name,
+ version, description, null, null);
+
+ set.add(resource);
+
+ return set;
+ }
+}
\ No newline at end of file
diff --git a/modules/plugins/ant-bundle/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/ant-bundle/src/main/resources/META-INF/rhq-plugin.xml
new file mode 100644
index 0000000..ce2b150
--- /dev/null
+++ b/modules/plugins/ant-bundle/src/main/resources/META-INF/rhq-plugin.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<plugin name="AntBundlePlugin"
+ displayName="Ant Bundle Plugin"
+ package="org.rhq.plugins.ant"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="urn:xmlns:rhq-plugin"
+ xmlns:c="urn:xmlns:rhq-configuration">
+
+
+ <server name="Ant Bundle Handler Server"
+ discovery="AntBundlePluginDiscoveryComponent"
+ class="AntBundlePluginComponent"
+ singleton="true"
+ description="This plugin is used to process Ant bundles">
+
+ <bundle type="Ant Bundle" />
+
+ </server>
+</plugin>
diff --git a/modules/plugins/ant-bundle/src/test/java/org/rhq/plugins/ant/AntBundlePluginComponentTest.java b/modules/plugins/ant-bundle/src/test/java/org/rhq/plugins/ant/AntBundlePluginComponentTest.java
new file mode 100644
index 0000000..4f2f28b
--- /dev/null
+++ b/modules/plugins/ant-bundle/src/test/java/org/rhq/plugins/ant/AntBundlePluginComponentTest.java
@@ -0,0 +1,158 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.plugins.ant;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.util.Properties;
+
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import org.rhq.core.domain.bundle.Bundle;
+import org.rhq.core.domain.bundle.BundleDeployDefinition;
+import org.rhq.core.domain.bundle.BundleType;
+import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceCategory;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.pluginapi.bundle.BundleDeployRequest;
+import org.rhq.core.pluginapi.bundle.BundleDeployResult;
+import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.core.system.SystemInfoFactory;
+import org.rhq.core.util.stream.StreamUtil;
+
+@Test
+public class AntBundlePluginComponentTest {
+
+ private AntBundlePluginComponent plugin;
+ private File tmpDir;
+
+ @BeforeMethod
+ public void beforeMethod() throws Exception {
+ tmpDir = new File("target/antbundletest");
+ tmpDir.mkdirs();
+ plugin = new AntBundlePluginComponent();
+ ResourceType type = new ResourceType("antBundleTestType", "antBundleTestPlugin", ResourceCategory.SERVER, null);
+ Resource resource = new Resource("antBundleTestKey", "antBundleTestName", type);
+ ResourceContext<?> context = new ResourceContext(resource, null, null,
+ SystemInfoFactory.createJavaSystemInfo(), tmpDir, null, "antBundleTestPC", null, null, null, null, null);
+ plugin.start(context);
+ }
+
+ @BeforeClass
+ @AfterMethod
+ public void cleanTmpDir() {
+ if (tmpDir != null) {
+ File[] files = tmpDir.listFiles();
+ if (files != null) {
+ for (File file : files) {
+ file.delete();
+ }
+ }
+ }
+ }
+
+ public void testSimpleBundle() throws Exception {
+ ResourceType resourceType = new ResourceType("testSimpleBundle", "plugin", ResourceCategory.SERVER, null);
+ BundleType bundleType = new BundleType("testSimpleBundle", resourceType);
+ Bundle bundle = new Bundle("testSimpleBundle", bundleType);
+ BundleVersion bundleVersion = new BundleVersion("testSimpleBundle", "1.0", bundle,
+ getRecipeFromFile("simple-build.xml"));
+
+ BundleDeployDefinition deployDef = new BundleDeployDefinition();
+ deployDef.setBundleVersion(bundleVersion);
+ deployDef.setConfiguration(null);
+
+ BundleDeployRequest request = new BundleDeployRequest();
+ request.setBundleFilesLocation(tmpDir);
+ request.setBundleDeployDefinition(deployDef);
+
+ BundleDeployResult results = plugin.deployBundle(request);
+
+ assertResultsSuccess(results);
+
+ // our ant script wrote some output that we should verify to make sure we ran it
+ File outputFile = new File(tmpDir, "output.1");
+ String output = new String(StreamUtil.slurp(new FileInputStream(outputFile)));
+ assert output.equals("HELLO WORLD") : output;
+
+ }
+
+ public void testAntBundle() throws Exception {
+ ResourceType resourceType = new ResourceType("testSimpleBundle", "plugin", ResourceCategory.SERVER, null);
+ BundleType bundleType = new BundleType("testSimpleBundle", resourceType);
+ Bundle bundle = new Bundle("testSimpleBundle", bundleType);
+ BundleVersion bundleVersion = new BundleVersion("testSimpleBundle", "1.0", bundle,
+ getRecipeFromFile("test-build.xml"));
+
+ Configuration config = new Configuration();
+ config.put(new PropertySimple("custom.prop1", "custom property 1"));
+ config.put(new PropertySimple("custom.prop2", "custom property 2"));
+
+ BundleDeployDefinition deployDef = new BundleDeployDefinition();
+ deployDef.setBundleVersion(bundleVersion);
+ deployDef.setConfiguration(config);
+
+ File file1 = new File(tmpDir, "file.txt");
+ File file2 = new File(tmpDir, "package.zip");
+ assert file1.createNewFile() : "could not create our mock bundle file";
+ assert file2.createNewFile() : "could not create our mock bundle file";
+
+ BundleDeployRequest request = new BundleDeployRequest();
+ request.setBundleFilesLocation(tmpDir);
+ request.setBundleDeployDefinition(deployDef);
+
+ BundleDeployResult results = plugin.deployBundle(request);
+
+ assertResultsSuccess(results);
+
+ // our ant script wrote some output that we should verify to make sure we ran it
+ File outputFile = new File(tmpDir, "output.2");
+ Properties props = new Properties();
+ props.load(new FileInputStream(outputFile));
+ assert props.getProperty("prop1").equals("custom property 1") : props;
+ assert props.getProperty("prop2").equals("custom property 2") : props;
+ assert props.getProperty("f.exists").equals("true") : props;
+ assert props.getProperty("pkg.exists").equals("true") : props;
+ assert props.getProperty("hostname").equals(SystemInfoFactory.createSystemInfo().getHostname()) : props;
+ assert props.getProperty("tmpdir").equals(System.getProperty("java.io.tmpdir")) : props;
+ }
+
+ private void assertResultsSuccess(BundleDeployResult results) {
+ if (results.getErrorMessage() != null) {
+ assert false : "Failed to process bundle: [" + results.getErrorMessage() + "]";
+ }
+ }
+
+ private String getRecipeFromFile(String filename) {
+ InputStream stream = getClass().getClassLoader().getResourceAsStream(filename);
+ byte[] contents = StreamUtil.slurp(stream);
+ return new String(contents);
+ }
+}
diff --git a/modules/plugins/ant-bundle/src/test/resources/log4j.xml b/modules/plugins/ant-bundle/src/test/resources/log4j.xml
new file mode 100644
index 0000000..181834e
--- /dev/null
+++ b/modules/plugins/ant-bundle/src/test/resources/log4j.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- tests configuration that only dumps WARN or higher messages due to appender threadhold -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Threshold" value="ERROR"/>
+ <param name="Target" value="System.out"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%t] (%c{5}) - %m%n"/>
+ </layout>
+ </appender>
+
+ <appender name="FILE" class="org.apache.log4j.FileAppender">
+ <param name="File" value="target/test.log"/>
+ <param name="Threshold" value="DEBUG"/>
+ <param name="Append" value="false"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%-5p %d{dd-MM HH:mm:ss,SSS} (%F:%M:%L) -%m%n"/>
+ </layout>
+ </appender>
+
+ <category name="org.rhq">
+ <priority value="DEBUG"/>
+ </category>
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ <appender-ref ref="FILE"/>
+ </root>
+
+</log4j:configuration>
diff --git a/modules/plugins/ant-bundle/src/test/resources/simple-build.xml b/modules/plugins/ant-bundle/src/test/resources/simple-build.xml
new file mode 100644
index 0000000..c1606dc
--- /dev/null
+++ b/modules/plugins/ant-bundle/src/test/resources/simple-build.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<project name="test" default="init">
+ <property name="outfile" value="${basedir}/output.1" />
+
+ <target name="init">
+ <echo file="${outfile}" message="HELLO WORLD"/>
+ </target>
+</project>
\ No newline at end of file
diff --git a/modules/plugins/ant-bundle/src/test/resources/test-build.xml b/modules/plugins/ant-bundle/src/test/resources/test-build.xml
new file mode 100644
index 0000000..4b0b778
--- /dev/null
+++ b/modules/plugins/ant-bundle/src/test/resources/test-build.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<project name="simple-build" default="first-target">
+ <property id="_bundlefile.1" name="f" location="file.txt" />
+ <property id="_bundleconfig.1" name="custom.prop1" location="1" />
+
+ <property name="outfile" value="${basedir}/output.2" />
+
+ <target name="first-target">
+ <property id="_bundlefile.2" name="pkg" value="${basedir}/package.zip" />
+ <property id="_bundleconfig.2" name="custom.prop2" value="2" />
+
+ <condition property="file.f.exists">
+ <available file="${f}" />
+ </condition>
+ <condition property="file.pkg.exists">
+ <available file="${pkg}" />
+ </condition>
+
+ <echo file="${outfile}">prop1=${custom.prop1}
+prop2=${custom.prop2}
+f.exists=${file.f.exists}
+pkg.exists=${file.pkg.exists}
+hostname=${rhq.system.hostname}
+tmpdir=${rhq.system.sysprop.java.io.tmpdir}
+ </echo>
+ </target>
+</project>
\ No newline at end of file
diff --git a/modules/plugins/pom.xml b/modules/plugins/pom.xml
index d41b7b1..76ee0ee 100644
--- a/modules/plugins/pom.xml
+++ b/modules/plugins/pom.xml
@@ -162,6 +162,7 @@
<!-- bundle plugins -->
<module>filetemplate-bundle</module>
+ <module>ant-bundle</module>
</modules>
</profile>
diff --git a/modules/plugins/validate-all-plugins/pom.xml b/modules/plugins/validate-all-plugins/pom.xml
index 01e2a34..b3d5e87 100644
--- a/modules/plugins/validate-all-plugins/pom.xml
+++ b/modules/plugins/validate-all-plugins/pom.xml
@@ -62,6 +62,7 @@
<pathelement location="../virt/target/rhq-virt-plugin-${project.version}.jar" />
<pathelement location="../kickstart/target/rhq-kickstart-plugin-${project.version}.jar" />
<pathelement location="../filetemplate-bundle/target/rhq-filetemplate-bundle-plugin-${project.version}.jar" />
+ <pathelement location="../ant-bundle/target/rhq-ant-bundle-plugin-${project.version}.jar" />
</classpath>
<sysproperty key="org.apache.commons.logging.Log" value="org.apache.commons.logging.impl.SimpleLog" />
<!--
commit d4e2842142ab368dee94fdee322f8168837956aa
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Mar 29 00:29:04 2010 -0400
force the filetemplate plugin to use its own gnu getopt just to isolate it from the servers's version (this probably isn't that important to do)
diff --git a/modules/enterprise/server/plugins/filetemplate-bundle/pom.xml b/modules/enterprise/server/plugins/filetemplate-bundle/pom.xml
index 4a3536e..44cdb03 100644
--- a/modules/enterprise/server/plugins/filetemplate-bundle/pom.xml
+++ b/modules/enterprise/server/plugins/filetemplate-bundle/pom.xml
@@ -101,6 +101,12 @@
<version>${project.version}</version>
</artifactItem>
+ <artifactItem>
+ <groupId>gnu-getopt</groupId>
+ <artifactId>getopt</artifactId>
+ <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
+ </artifactItem>
+
</artifactItems>
<outputDirectory>${project.build.outputDirectory}/lib</outputDirectory>
</configuration>
commit 5f33867f613ccc768ef2e30efb9ffc722d6b77fa
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Mar 29 00:27:49 2010 -0400
allow public API to obtain tokens from the template engine
diff --git a/modules/core/util/src/main/java/org/rhq/core/template/TemplateEngine.java b/modules/core/util/src/main/java/org/rhq/core/template/TemplateEngine.java
index d748463..79ad1ff 100644
--- a/modules/core/util/src/main/java/org/rhq/core/template/TemplateEngine.java
+++ b/modules/core/util/src/main/java/org/rhq/core/template/TemplateEngine.java
@@ -37,6 +37,10 @@ public class TemplateEngine implements Serializable {
this.tokens = tokens;
}
+ public Map<String, String> getTokens() {
+ return this.tokens;
+ }
+
public String replaceTokens(String input) {
StringBuffer buffer = new StringBuffer();
Matcher matcher = tokenPattern.matcher(input);
commit 0c03d1eb6b3b03cabe58a17dbb98bd43307ca127
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Mar 29 00:27:11 2010 -0400
make the parse call directly in the bundle PC so we can set context CL
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
index 7b41da0..61715df 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
@@ -79,7 +79,6 @@ import org.rhq.enterprise.server.authz.RequiredPermission;
import org.rhq.enterprise.server.content.ContentManagerLocal;
import org.rhq.enterprise.server.content.RepoManagerLocal;
import org.rhq.enterprise.server.core.AgentManagerLocal;
-import org.rhq.enterprise.server.plugin.pc.bundle.BundleServerPluginFacet;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
import org.rhq.enterprise.server.util.HibernateDetachUtility;
@@ -248,12 +247,11 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
// parse the recipe (validation occurs here) and get the config def and list of files
BundleType bundleType = bundle.getBundleType();
- BundleServerPluginFacet bp = BundleManagerHelper.getPluginContainer().getBundleServerPluginManager()
- .getBundleServerPluginFacet(bundleType.getName());
RecipeParseResults results;
try {
- results = bp.parseRecipe(recipe);
+ results = BundleManagerHelper.getPluginContainer().getBundleServerPluginManager().parseRecipe(
+ bundleType.getName(), recipe);
} catch (Exception e) {
// ensure that we throw a runtime exception to force a rollback
throw new RuntimeException("Failed to parse recipe", e);
@@ -574,9 +572,8 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
// parse the recipe (validation occurs here) and get the config def and list of files
BundleType bundleType = bundleVersion.getBundle().getBundleType();
- BundleServerPluginFacet bp = BundleManagerHelper.getPluginContainer().getBundleServerPluginManager()
- .getBundleServerPluginFacet(bundleType.getName());
- RecipeParseResults parseResults = bp.parseRecipe(bundleVersion.getRecipe());
+ RecipeParseResults parseResults = BundleManagerHelper.getPluginContainer().getBundleServerPluginManager()
+ .parseRecipe(bundleType.getName(), bundleVersion.getRecipe());
Set<String> result = parseResults.getBundleFileNames();
@@ -613,9 +610,8 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
// parse the recipe (validation occurs here) and get the config def and list of files
BundleType bundleType = bundleVersion.getBundle().getBundleType();
- BundleServerPluginFacet bp = BundleManagerHelper.getPluginContainer().getBundleServerPluginManager()
- .getBundleServerPluginFacet(bundleType.getName());
- RecipeParseResults parseResults = bp.parseRecipe(bundleVersion.getRecipe());
+ RecipeParseResults parseResults = BundleManagerHelper.getPluginContainer().getBundleServerPluginManager()
+ .parseRecipe(bundleType.getName(), bundleVersion.getRecipe());
Set<String> filenames = parseResults.getBundleFileNames();
Map<String, Boolean> result = new HashMap<String, Boolean>(filenames.size());
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/bundle/BundleServerPluginManager.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/bundle/BundleServerPluginManager.java
index 68f8a0f..7387f3a 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/bundle/BundleServerPluginManager.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/bundle/BundleServerPluginManager.java
@@ -18,6 +18,7 @@
*/
package org.rhq.enterprise.server.plugin.pc.bundle;
+import org.rhq.enterprise.server.bundle.RecipeParseResults;
import org.rhq.enterprise.server.plugin.pc.ServerPluginComponent;
import org.rhq.enterprise.server.plugin.pc.ServerPluginEnvironment;
import org.rhq.enterprise.server.plugin.pc.ServerPluginManager;
@@ -68,28 +69,51 @@ public class BundleServerPluginManager extends ServerPluginManager {
}
/**
- * Given the {@link BundleType#getName() name of a bundle type}, this will return the stateful plugin component
- * that manages bundles of that type.
+ * Given the {@link BundleType#getName() name of a bundle type}, this will parse the given recipe by asking the
+ * bundle plugin that can parse a recipe of that bundle type.
*
- * @param bundleTypeName
+ * @param bundleTypeName essentially identifies the kind of recipe that is to be parsed
+ * @param recipe the recipe to parse
*
- * @return the plugin component object that will manage bundles of the named bundle type; <code>null</code> if there is no plugin
- * that can support the given bundle type
+ * @return the results of the parse
+ *
+ * @throws Exception if the recipe could not be parsed successfully
*/
- public BundleServerPluginFacet getBundleServerPluginFacet(String bundleTypeName) {
+ public RecipeParseResults parseRecipe(String bundleTypeName, String recipe) throws Exception {
+
if (bundleTypeName == null) {
throw new IllegalArgumentException("bundleTypeName == null");
}
+ if (recipe == null) {
+ throw new IllegalArgumentException("recipe == null");
+ }
+ // find the plugin environment for the bundle plugin of the given type
+ ServerPluginEnvironment pluginEnv = null;
for (ServerPluginEnvironment env : getPluginEnvironments()) {
BundlePluginDescriptorType descriptor = (BundlePluginDescriptorType) env.getPluginDescriptor();
if (bundleTypeName.equals(descriptor.getBundle().getType())) {
- ServerPluginComponent component = getServerPluginComponent(env.getPluginKey().getPluginName());
- // we know this cast will work because our loadPlugin ensured that this component implements this interface
- return (BundleServerPluginFacet) component;
+ pluginEnv = env;
+ break;
}
}
- return null;
+ if (pluginEnv == null) {
+ throw new IllegalArgumentException("Bundle type [" + bundleTypeName + "] is not known to the system");
+ }
+
+ // get the facet and call the parse method in the appropriate classloader
+ String pluginName = pluginEnv.getPluginKey().getPluginName();
+ ServerPluginComponent component = getServerPluginComponent(pluginName);
+ BundleServerPluginFacet facet = (BundleServerPluginFacet) component; // we know this cast will work because our loadPlugin ensured so
+ getLog().debug("Bundle server plugin [" + pluginName + "] is parsing a bundle recipe");
+ ClassLoader originalContextClassLoader = Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(pluginEnv.getPluginClassLoader());
+ RecipeParseResults results = facet.parseRecipe(recipe);
+ return results;
+ } finally {
+ Thread.currentThread().setContextClassLoader(originalContextClassLoader);
+ }
}
}
\ No newline at end of file
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/TestBundleServerPluginService.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/TestBundleServerPluginService.java
index 90aab2f..20fa204 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/TestBundleServerPluginService.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/TestBundleServerPluginService.java
@@ -187,9 +187,8 @@ public class TestBundleServerPluginService extends ServerPluginService implement
}
@Override
- public BundleServerPluginFacet getBundleServerPluginFacet(String bundleTypeName) {
-
- return new TestBundlePluginComponent();
+ public RecipeParseResults parseRecipe(String bundleTypeName, String recipe) throws Exception {
+ return new TestBundlePluginComponent().parseRecipe(recipe);
}
}
commit ae88c7ce59839f71a1f5a58d713671c2d0aef03d
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Sun Mar 28 19:54:52 2010 -0400
see if setting an initial value fixes the single-value drop down issue.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleVersionStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleVersionStep.java
index 52f7c5b..700104f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleVersionStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleVersionStep.java
@@ -136,6 +136,7 @@ public class SelectBundleVersionStep implements WizardStep {
radioGroupItem.redraw();
selectVersionItem.setValueMap(selectVersionValues);
+ selectVersionItem.setValue(latestVersion.getVersion());
selectVersionItem.redraw();
form.markForRedraw();
commit 4575847ce04b52cfc2f1b5fe47a1fe0b562a600b
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Sun Mar 28 19:36:32 2010 -0400
re-enable single deployment test
diff --git a/modules/enterprise/remoting/scripts/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManager.js b/modules/enterprise/remoting/scripts/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManager.js
index 34986f1..bf1c901 100644
--- a/modules/enterprise/remoting/scripts/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManager.js
+++ b/modules/enterprise/remoting/scripts/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManager.js
@@ -26,7 +26,7 @@
* said platform.
*/
-var TestsEnabled = false;
+var TestsEnabled = true;
var bundleName = 'testScriptBundle';
@@ -83,9 +83,9 @@ function testDeployment() {
}
function testGroupDeployment() {
-// if ( !TestsEnabled ) {
-// return;
-// }
+ if ( !TestsEnabled ) {
+ return;
+ }
// delete the test bundle if it exists
cleanupTestBundle();
commit 25ca25ee29ce5c69678be92d60c72f2da6100e4c
Merge: 5ee5728... a13969c...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Sun Mar 28 15:56:19 2010 -0400
Merge branch 'gwt' into gwt-jay
commit 5ee572891e50172aeeee1619ea15814d1bea61e1
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Sun Mar 28 15:54:32 2010 -0400
Domain Model Change and Refactor
Change from a single PackageType for a BundleType to a PackageType per
Bundle.
The former approach originally worked with the idea that
Package.classification set to bundleName could be used to distinguish
between BundleFile packages with the same name but contained in different
bundles. But the fact that classification was never designed to
be used as part of the natural key for a package would have forced a large
refactor potentially conflicting with the current use of classification.
The alternatives were to add a Package.subType to package and make it part
of the natural key. This would have been specific to the needs of bundling
and again added changes to the underlying content domain model. Instead
it was deemed reasonable to have a devoted PackageType per Bundle. This
model does create a potentially large number of packageTypes
(one per bundle) on the BundleType's ResourceType. But it's not clear that
creates any problem. It has the advantage of leveraging the Package
design without introducing any more complexity. Also, Bundle deletion now
can cause cascade removals of the packages for its package type.
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml b/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
index 005bafb..90a71a7 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
@@ -501,6 +501,7 @@
<column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/>
<column name="BUNDLE_TYPE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_TYPE"/>
<column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/>
+ <column name="PACKAGE_TYPE_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_TYPE"/>
<!-- This index is for constraint, not performance -->
<index name="RHQ_BUNDLE_UNIQUE" unique="true">
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 326f3ba..2bb52d7 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -2852,6 +2852,7 @@
<schemaSpec version="2.78.1">
<schema-addColumn table="RHQ_BUNDLE" column="REPO_ID" columnType="INTEGER" />
+ <schema-alterColumn table="RHQ_BUNDLE" column="REPO_ID" nullable="FALSE" />
<schema-directSQL>
<statement desc="Creating RHQ_BUNDLE foreign key relation to RHQ_REPO">
ALTER TABLE RHQ_BUNDLE
@@ -2922,13 +2923,13 @@
<schema-directSQL>
<statement desc="Creating RHQ_BUNDLE_GROUP_DEPLOY foreign key relation to RHQ_RESOURCE_GROUP">
ALTER TABLE RHQ_BUNDLE_GROUP_DEPLOY
- ADD CONSTRAINT RHQ_RESOURCE_GROUP_FK
+ ADD CONSTRAINT RHQ_RESOURCE_GROUP_ID_FK
FOREIGN KEY (GROUP_ID)
REFERENCES RHQ_RESOURCE_GROUP (ID)
</statement>
<statement desc="Creating RHQ_BUNDLE_GROUP_DEPLOY foreign key relation to RHQ_BUNDLE_DEPLOY_DEF">
ALTER TABLE RHQ_BUNDLE_GROUP_DEPLOY
- ADD CONSTRAINT RHQ_BUNDLE_DEPLOY_DEF_FK
+ ADD CONSTRAINT RHQ_BUNDLE_DEPLOY_DEF_ID_FK
FOREIGN KEY (BUNDLE_DEPLOY_DEF_ID)
REFERENCES RHQ_BUNDLE_DEPLOY_DEF (ID)
</statement>
@@ -2938,7 +2939,7 @@
<schema-directSQL>
<statement desc="Creating RHQ_BUNDLE_DEPLOY foreign key relation to RHQ_BUNDLE_GROUP_DEPLOY">
ALTER TABLE RHQ_BUNDLE_DEPLOY
- ADD CONSTRAINT RHQ_BUNDLE_GROUP_DEPLOY_FK
+ ADD CONSTRAINT RHQ_BUNDLE_GROUP_DEPLOY_ID_FK
FOREIGN KEY (BUNDLE_GROUP_DEPLOY_ID)
REFERENCES RHQ_BUNDLE_GROUP_DEPLOY (ID)
</statement>
@@ -2950,6 +2951,19 @@
<schema-alterColumn table="RHQ_BUNDLE_DEPLOY" column="STATUS" nullable="FALSE" />
</schemaSpec>
+ <schemaSpec version="2.78.7">
+ <schema-addColumn table="RHQ_BUNDLE" column="PACKAGE_TYPE_ID" columnType="INTEGER" />
+ <schema-alterColumn table="RHQ_BUNDLE" column="PACKAGE_TYPE_ID" nullable="FALSE" />
+ <schema-directSQL>
+ <statement desc="Creating RHQ_BUNDLE foreign key relation to RHQ_PACKAGE_TYPE">
+ ALTER TABLE RHQ_BUNDLE
+ ADD CONSTRAINT RHQ_PACKAGE_TYPE_ID_FK
+ FOREIGN KEY (PACKAGE_TYPE_ID)
+ REFERENCES RHQ_PACKAGE_TYPE (ID)
+ </statement>
+ </schema-directSQL>
+ </schemaSpec>
+
<schemaSpec version="2.79">
<schema-directSQL>
<statement desc="Normalizing resource group descriptions">
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/Bundle.java b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/Bundle.java
index 1573d6d..261a54e 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/Bundle.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/Bundle.java
@@ -44,6 +44,7 @@ import javax.persistence.Table;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
+import org.rhq.core.domain.content.PackageType;
import org.rhq.core.domain.content.Repo;
/**
@@ -89,6 +90,10 @@ public class Bundle implements Serializable {
@OneToOne(fetch = FetchType.LAZY, optional = false)
private Repo repo;
+ @JoinColumn(name = "PACKAGE_TYPE_ID", referencedColumnName = "ID", nullable = false)
+ @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL, optional = false)
+ private PackageType packageType;
+
@OneToMany(mappedBy = "bundle", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
private List<BundleVersion> bundleVersions = new ArrayList<BundleVersion>();
@@ -138,6 +143,14 @@ public class Bundle implements Serializable {
this.bundleType = bundleType;
}
+ public PackageType getPackageType() {
+ return packageType;
+ }
+
+ public void setPackageType(PackageType packageType) {
+ this.packageType = packageType;
+ }
+
public Repo getRepo() {
return repo;
}
@@ -161,7 +174,7 @@ public class Bundle implements Serializable {
@Override
public String toString() {
- return "Bundle[id=" + id + ",name=" + name + ",bundleType=" + bundleType + "]";
+ return "Bundle[id=" + id + ",name=" + name + ",bundleType=" + bundleType + ",packageType=" + packageType + "]";
}
@Override
@@ -169,6 +182,7 @@ public class Bundle implements Serializable {
final int prime = 31;
int result = 1;
result = (prime * result) + ((name == null) ? 0 : name.hashCode());
+ result = (prime * result) + ((bundleType == null) ? 0 : bundleType.hashCode());
return result;
}
@@ -192,6 +206,14 @@ public class Bundle implements Serializable {
return false;
}
+ if (bundleType == null) {
+ if (other.bundleType != null) {
+ return false;
+ }
+ } else if (!bundleType.equals(other.bundleType)) {
+ return false;
+ }
+
return true;
}
}
\ No newline at end of file
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/content/PackageCategory.java b/modules/core/domain/src/main/java/org/rhq/core/domain/content/PackageCategory.java
index 9a7bce8..2b7017f 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/content/PackageCategory.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/content/PackageCategory.java
@@ -1,25 +1,25 @@
- /*
- * RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
package org.rhq.core.domain.content;
/**
@@ -53,7 +53,12 @@ public enum PackageCategory {
/**
* A log file
*/
- LOG("Log");
+ LOG("Log"),
+
+ /**
+ * A bundle file, deployable as part of a bundle deploy.
+ */
+ BUNDLE("Bundle");
// Attributes --------------------------------------------
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleCriteria.java
index a6b2292..9495b80 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleCriteria.java
@@ -36,11 +36,14 @@ public class BundleCriteria extends Criteria {
private Integer filterId;
private Integer filterBundleTypeId; // needs override
- private String filterBundleTypeName; // needs override
+ private String filterBundleTypeName; // needs override
private String filterDescription;
private String filterName;
+ private Integer filterPackageTypeId; // needs override
+ private String filterPackageTypeName; // needs override
private boolean fetchBundleVersions;
+ private boolean fetchPackageType;
private boolean fetchRepo;
private PageOrdering sortName;
@@ -49,6 +52,9 @@ public class BundleCriteria extends Criteria {
public BundleCriteria() {
filterOverrides.put("bundleTypeId", "bundleType.id = ?");
filterOverrides.put("bundleTypeName", "bundleType.name like ?");
+ filterOverrides.put("packageTypeId", "packageType.id = ?");
+ filterOverrides.put("packageTypeName", "packageType.name like ?");
+
}
@Override
@@ -76,10 +82,22 @@ public class BundleCriteria extends Criteria {
this.filterName = filterName;
}
+ public void addFilterPackageTypeId(Integer filterPackageTypeId) {
+ this.filterPackageTypeId = filterPackageTypeId;
+ }
+
+ public void addFilterPackageTypeName(String filterPackageTypeName) {
+ this.filterPackageTypeName = filterPackageTypeName;
+ }
+
public void fetchBundleVersions(boolean fetchBundleVersions) {
this.fetchBundleVersions = fetchBundleVersions;
}
+ public void fetchPackageType(boolean fetchPackageType) {
+ this.fetchPackageType = fetchPackageType;
+ }
+
public void fetchRepo(boolean fetchRepo) {
this.fetchRepo = fetchRepo;
}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeployDefinitionCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeployDefinitionCriteria.java
index 54b4930..96a8594 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeployDefinitionCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeployDefinitionCriteria.java
@@ -23,8 +23,6 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
-import org.rhq.core.domain.bundle.BundleDeployDefinition;
-
/**
* @author Jay Shaughnessy
*/
@@ -42,12 +40,13 @@ public class BundleDeployDefinitionCriteria extends Criteria {
private boolean fetchBundleVersion;
private boolean fetchConfiguration;
private boolean fetchDeployments;
+ private boolean fetchGroupDeployments;
public BundleDeployDefinitionCriteria() {
}
@Override
- public Class getPersistentClass() {
+ public Class<?> getPersistentClass() {
return BundleDeployDefinitionCriteria.class;
}
@@ -79,4 +78,8 @@ public class BundleDeployDefinitionCriteria extends Criteria {
this.fetchDeployments = fetchDeployments;
}
+ public void fetchGroupDeployments(boolean fetchGroupDeployments) {
+ this.fetchGroupDeployments = fetchGroupDeployments;
+ }
+
}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java
index 47f500c..7db3060 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java
@@ -23,6 +23,7 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import org.rhq.core.domain.bundle.BundleDeployment;
+import org.rhq.core.domain.bundle.BundleDeploymentStatus;
/**
* @author Jay Shaughnessy
@@ -38,6 +39,7 @@ public class BundleDeploymentCriteria extends Criteria {
private String filterBundleDeployDefinitionName; // requires override
private Integer filterResourceId; // requires override
private String filterResourceName; // requires override
+ private BundleDeploymentStatus filterStatus;
private boolean fetchBundleDeployDefinition;
private boolean fetchResource;
@@ -51,7 +53,7 @@ public class BundleDeploymentCriteria extends Criteria {
}
@Override
- public Class getPersistentClass() {
+ public Class<?> getPersistentClass() {
return BundleDeployment.class;
}
@@ -75,6 +77,10 @@ public class BundleDeploymentCriteria extends Criteria {
this.filterResourceName = filterResourceName;
}
+ public void addFilterStatus(BundleDeploymentStatus filterStatus) {
+ this.filterStatus = filterStatus;
+ }
+
public void fetchBundleDeployDefinition(boolean fetchBundleDeployDefinition) {
this.fetchBundleDeployDefinition = fetchBundleDeployDefinition;
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
index 7b41da0..05c8fb6 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
@@ -58,6 +58,7 @@ import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.content.Architecture;
import org.rhq.core.domain.content.Package;
+import org.rhq.core.domain.content.PackageCategory;
import org.rhq.core.domain.content.PackageType;
import org.rhq.core.domain.content.PackageVersion;
import org.rhq.core.domain.content.Repo;
@@ -143,7 +144,7 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
Bundle bundle = new Bundle(name, bundleType);
bundle.setDescription(description);
- // create and add the required Repo. the Repo is a detached object ehich helps in its eventual
+ // create and add the required Repo. the Repo is a detached object which helps in its eventual
// removal.
Repo repo = new Repo(name);
repo.setCandidate(false);
@@ -151,6 +152,13 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
repo = repoManager.createRepo(subject, repo);
bundle.setRepo(repo);
+ // add the required PackageType. the PackageType is an attached object which helps in cascade removal
+ // of packages in the bundle's repo.
+ ResourceType resourceType = entityManager.find(ResourceType.class, bundleType.getResourceType().getId());
+ PackageType packageType = new PackageType(name, resourceType);
+ packageType.setCategory(PackageCategory.BUNDLE);
+ bundle.setPackageType(packageType);
+
log.info("Creating bundle: " + bundle);
entityManager.persist(bundle);
@@ -349,7 +357,7 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
// Create the PackageVersion the BundleFile is tied to. This implicitly creates the
// Package for the PackageVersion.
Bundle bundle = bundleVersion.getBundle();
- PackageType packageType = getBundleTypePackageType(bundle.getBundleType());
+ PackageType packageType = bundle.getPackageType();
architecture = (null == architecture) ? contentManager.getNoArchitecture() : architecture;
if (architecture.getId() == 0) {
Query q = entityManager.createNamedQuery(Architecture.QUERY_FIND_BY_NAME);
@@ -424,15 +432,6 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
return bundleFile;
}
- private PackageType getBundleTypePackageType(BundleType bundleType) {
-
- Query packageTypeQuery = entityManager.createNamedQuery(PackageType.QUERY_FIND_BY_RESOURCE_TYPE_ID_AND_NAME);
- packageTypeQuery.setParameter("typeId", bundleType.getResourceType().getId());
- packageTypeQuery.setParameter("name", bundleType.getName());
-
- return (PackageType) packageTypeQuery.getSingleResult();
- }
-
public BundleDeployment scheduleBundleDeployment(Subject subject, int bundleDeployDefinitionId, int resourceId)
throws Exception {
BundleDeployDefinition deployDef = entityManager.find(BundleDeployDefinition.class, bundleDeployDefinitionId);
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
index a98d66e..427714b 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
@@ -134,13 +134,9 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
// clean up any tests that don't already clean up after themselves
- q = em.createQuery("SELECT bdh FROM BundleDeploymentHistory bdh ");//WHERE bdh.name LIKE '" + TEST_PREFIX + "%'");
- doomed = q.getResultList();
- for (Object removeMe : doomed) {
- em.remove(em.getReference(BundleDeploymentHistory.class, ((BundleDeploymentHistory) removeMe).getId()));
- }
-
- // remove bundleversions which cascade remove bundlefiles and bundledeploydefs
+ // remove bundleversions which cascade remove bundlefiles and bundledeploydefs
+ // bundledeploydefs cascade remove bundledeployments and bundlegroupdeployments
+ // bundledeployments cascade remove bundledeploymenthistory
q = em.createQuery("SELECT bv FROM BundleVersion bv WHERE bv.name LIKE '" + TEST_PREFIX + "%'");
doomed = q.getResultList();
for (Object removeMe : doomed) {
@@ -153,12 +149,11 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
for (Object removeMe : doomed) {
em.remove(em.getReference(BundleFile.class, ((BundleFile) removeMe).getId()));
}
- // remove any orphaned bgds
- q = em.createQuery("SELECT bgd FROM BundleGroupDeployment bgd WHERE bgd.bundleDeployDefinition.name LIKE '"
- + TEST_PREFIX + "%'");
+ // remove any orphaned deployment history
+ q = em.createQuery("SELECT bdh FROM BundleDeploymentHistory bdh ");//WHERE bdh.name LIKE '" + TEST_PREFIX + "%'");
doomed = q.getResultList();
for (Object removeMe : doomed) {
- em.remove(em.getReference(BundleGroupDeployment.class, ((BundleGroupDeployment) removeMe).getId()));
+ em.remove(em.getReference(BundleDeploymentHistory.class, ((BundleDeploymentHistory) removeMe).getId()));
}
// remove any orphaned bds
q = em.createQuery("SELECT bd FROM BundleDeployment bd WHERE bd.bundleDeployDefinition.name LIKE '"
@@ -167,17 +162,27 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
for (Object removeMe : doomed) {
em.remove(em.getReference(BundleDeployment.class, ((BundleDeployment) removeMe).getId()));
}
+ // remove any orphaned bgds
+ q = em.createQuery("SELECT bgd FROM BundleGroupDeployment bgd WHERE bgd.bundleDeployDefinition.name LIKE '"
+ + TEST_PREFIX + "%'");
+ doomed = q.getResultList();
+ for (Object removeMe : doomed) {
+ em.remove(em.getReference(BundleGroupDeployment.class, ((BundleGroupDeployment) removeMe).getId()));
+ }
// remove any orphaned bdds
q = em.createQuery("SELECT bdd FROM BundleDeployDefinition bdd WHERE bdd.name LIKE '" + TEST_PREFIX + "%'");
doomed = q.getResultList();
for (Object removeMe : doomed) {
em.remove(em.getReference(BundleDeployDefinition.class, ((BundleDeployDefinition) removeMe).getId()));
}
- // remove packages which cascade remove packageversions
- q = em.createQuery("SELECT p FROM Package p WHERE p.name LIKE '" + TEST_PREFIX + "%'");
+
+ // remove bundles which cascade remove repos and packageTypes
+ // packagetypes cascade remove packages
+ // package cascade remove packageversions
+ q = em.createQuery("SELECT b FROM Bundle b WHERE b.name LIKE '" + TEST_PREFIX + "%'");
doomed = q.getResultList();
for (Object removeMe : doomed) {
- em.remove(em.getReference(Package.class, ((Package) removeMe).getId()));
+ em.remove(em.getReference(Bundle.class, ((Bundle) removeMe).getId()));
}
em.flush();
// remove any orphaned pvs
@@ -187,20 +192,26 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
for (Object removeMe : doomed) {
em.remove(em.getReference(PackageVersion.class, ((PackageVersion) removeMe).getId()));
}
- // remove bundles which cascade remove repos
- q = em.createQuery("SELECT b FROM Bundle b WHERE b.name LIKE '" + TEST_PREFIX + "%'");
+ // remove any oprphaned packages
+ q = em.createQuery("SELECT p FROM Package p WHERE p.name LIKE '" + TEST_PREFIX + "%'");
doomed = q.getResultList();
for (Object removeMe : doomed) {
- em.remove(em.getReference(Bundle.class, ((Bundle) removeMe).getId()));
+ em.remove(em.getReference(Package.class, ((Package) removeMe).getId()));
+ }
+ // remove any orphaned packagetypes
+ q = em.createQuery("SELECT pt FROM PackageType pt WHERE pt.name LIKE '" + TEST_PREFIX + "%'");
+ doomed = q.getResultList();
+ for (Object removeMe : doomed) {
+ em.remove(em.getReference(PackageType.class, ((PackageType) removeMe).getId()));
}
- em.flush();
// remove any orphaned repos
q = em.createQuery("SELECT r FROM Repo r WHERE r.name LIKE '" + TEST_PREFIX + "%'");
doomed = q.getResultList();
for (Object removeMe : doomed) {
em.remove(em.getReference(Repo.class, ((Repo) removeMe).getId()));
}
- // remove ResourceTypes which cascade remove BundleTypes and PackageTypes
+
+ // remove ResourceTypes which cascade remove BundleTypes
q = em.createQuery("SELECT rt FROM ResourceType rt WHERE rt.name LIKE '" + TEST_PREFIX + "%'");
doomed = q.getResultList();
for (Object removeMe : doomed) {
@@ -213,12 +224,7 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
for (Object removeMe : doomed) {
em.remove(em.getReference(BundleType.class, ((BundleType) removeMe).getId()));
}
- // remove any orphaned packagetypes
- q = em.createQuery("SELECT pt FROM PackageType pt WHERE pt.name LIKE '" + TEST_PREFIX + "%'");
- doomed = q.getResultList();
- for (Object removeMe : doomed) {
- em.remove(em.getReference(PackageType.class, ((PackageType) removeMe).getId()));
- }
+
// remove Agents left over from test resources
q = em.createQuery("SELECT a FROM Agent a WHERE a.name LIKE '" + TEST_PREFIX + "%'");
doomed = q.getResultList();
@@ -526,7 +532,9 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
@Test(enabled = TESTS_ENABLED)
public void testAddBundleFilesToDifferentBundles() throws Exception {
- Bundle b1 = createBundle("one");
+ // create a bundle type to use for both bundles.
+ BundleType bt = createBundleType("one");
+ Bundle b1 = createBundle("one", bt);
assertNotNull(b1);
BundleVersion bv1 = createBundleVersion(b1.getName(), "1.0", b1);
assertNotNull(bv1);
@@ -534,7 +542,7 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
null, "Bundle #1 File # 1".getBytes(), false);
// create a second bundle but create file of the same name as above
- Bundle b2 = createBundle("two");
+ Bundle b2 = createBundle("two", bt);
assertNotNull(b2);
BundleVersion bv2 = createBundleVersion(b2.getName(), "1.0", b2);
assertNotNull(bv2);
@@ -743,7 +751,6 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
private BundleType createBundleType(String name) throws Exception {
final String fullName = TEST_PREFIX + "-type-" + name;
ResourceType rt = createResourceType(name);
- PackageType pt = createPackageType(name, rt);
BundleType bt = bundleManager.createBundleType(overlord, fullName, rt.getId());
assert bt.getId() > 0;
@@ -800,20 +807,6 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
return rt;
}
- private PackageType createPackageType(String name, ResourceType rt) throws Exception {
- // the package type is named the same as the bundle type
- final String fullName = TEST_PREFIX + "-type-" + name;
- PackageType pt = new PackageType(fullName, rt);
-
- TransactionManager txMgr = getTransactionManager();
- txMgr.begin();
- EntityManager em = getEntityManager();
- em.persist(pt);
- em.close();
- txMgr.commit();
- return pt;
- }
-
// lifted from ResourceManagerBeanTest
private Resource createTestResource() throws Exception {
getTransactionManager().begin();
commit a13969c550099c19bbeb3cbad76df38ec4391cb5
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Mar 26 15:32:17 2010 -0400
show bundle versions at the bottom right of the bundle view
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleVersionDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleVersionDataSource.java
new file mode 100644
index 0000000..9a576a6
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleVersionDataSource.java
@@ -0,0 +1,125 @@
+/*
+ * 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.bundle.list;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.data.fields.DataSourceIntegerField;
+import com.smartgwt.client.data.fields.DataSourceTextField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.core.domain.criteria.BundleVersionCriteria;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+
+/**
+ * @author John Mazzitelli
+ */
+public class BundleVersionDataSource extends RPCDataSource<BundleVersion> {
+
+ private BundleGWTServiceAsync bundleService = GWTServiceLookup.getBundleService();
+ private int bundleId;
+
+ public BundleVersionDataSource() {
+ DataSourceIntegerField idField = new DataSourceIntegerField("id", "ID");
+ idField.setPrimaryKey(true);
+ addField(idField);
+
+ DataSourceTextField nameField = new DataSourceTextField("name", "Name");
+ addField(nameField);
+
+ DataSourceTextField descriptionField = new DataSourceTextField("description", "Description");
+ addField(descriptionField);
+
+ DataSourceTextField latestVersionField = new DataSourceTextField("version", "Version");
+ addField(latestVersionField);
+
+ DataSourceIntegerField deploymentCountField = new DataSourceIntegerField("fileCount", "File Count");
+ addField(deploymentCountField);
+ }
+
+ public int getBundleId() {
+ return bundleId;
+ }
+
+ public void setBundleId(int bundleId) {
+ this.bundleId = bundleId;
+ }
+
+ @Override
+ protected void executeFetch(final DSRequest request, final DSResponse response) {
+
+ BundleVersionCriteria criteria = new BundleVersionCriteria();
+ criteria.addFilterBundleId(this.bundleId);
+ criteria.fetchBundleFiles(true);
+ criteria.setPageControl(getPageControl(request));
+
+ bundleService.findBundleVersionsByCriteria(criteria, new AsyncCallback<PageList<BundleVersion>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load bundle version data", caught);
+ response.setStatus(DSResponse.STATUS_FAILURE);
+ processResponse(request.getRequestId(), response);
+ }
+
+ public void onSuccess(PageList<BundleVersion> result) {
+ response.setData(buildRecords(result));
+ response.setTotalRows(result.getTotalSize());
+ processResponse(request.getRequestId(), response);
+ }
+ });
+
+ }
+
+ @Override
+ public BundleVersion copyValues(ListGridRecord from) {
+ // can't I just get the "object" attribute and return it???
+ Integer idAttrib = from.getAttributeAsInt("id");
+ String nameAttrib = from.getAttribute("name");
+ String descriptionAttrib = from.getAttribute("description");
+ String versionAttrib = from.getAttribute("version");
+
+ BundleVersion bv = new BundleVersion();
+ bv.setId(idAttrib.intValue());
+ bv.setName(nameAttrib);
+ bv.setDescription(descriptionAttrib);
+ bv.setVersion(versionAttrib);
+ return bv;
+ }
+
+ @Override
+ public ListGridRecord copyValues(BundleVersion from) {
+ ListGridRecord record = new ListGridRecord();
+
+ record.setAttribute("id", from.getId());
+ record.setAttribute("name", from.getName());
+ record.setAttribute("description", from.getDescription());
+ record.setAttribute("version", from.getVersion());
+ record.setAttribute("fileCount", Integer.valueOf(from.getBundleFiles().size()));
+
+ record.setAttribute("object", from);
+
+ return record;
+
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
index 4d7575e..be0e415 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
@@ -21,6 +21,8 @@ package org.rhq.enterprise.gui.coregui.client.bundle.list;
import com.smartgwt.client.data.Record;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.Overflow;
+import com.smartgwt.client.types.SelectionAppearance;
+import com.smartgwt.client.types.SelectionStyle;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.form.DynamicForm;
@@ -32,6 +34,7 @@ import com.smartgwt.client.widgets.tab.TabSet;
import org.rhq.core.domain.bundle.composite.BundleWithLatestVersionComposite;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.HeaderLabel;
+import org.rhq.enterprise.gui.coregui.client.components.table.Table;
public class BundleView extends VLayout {
@@ -41,6 +44,7 @@ public class BundleView extends VLayout {
private HeaderLabel headerLabel;
private StaticTextItem descriptionItem;
private StaticTextItem latestVersionItem;
+ private Table bundleVersionsTable;
public BundleView() {
super();
@@ -77,11 +81,30 @@ public class BundleView extends VLayout {
}
private Tab createDeploymentsTab() {
- return new Tab("Deployments");
+ Tab deploymentsTab = new Tab("Deployments");
+ return deploymentsTab;
}
private Tab createVersionsTab() {
- return new Tab("Versions");
+ Tab versionsTab = new Tab("Versions");
+
+ bundleVersionsTable = new Table();
+ bundleVersionsTable.setHeight100();
+
+ BundleVersionDataSource bundleVersionsDataSource = new BundleVersionDataSource();
+ bundleVersionsTable.setDataSource(bundleVersionsDataSource);
+
+ bundleVersionsTable.getListGrid().getField("id").setWidth("60");
+ bundleVersionsTable.getListGrid().getField("name").setWidth("25%");
+ bundleVersionsTable.getListGrid().getField("version").setWidth("10%");
+ bundleVersionsTable.getListGrid().getField("fileCount").setWidth("10%");
+ bundleVersionsTable.getListGrid().getField("description").setWidth("*");
+
+ bundleVersionsTable.getListGrid().setSelectionType(SelectionStyle.NONE);
+ bundleVersionsTable.getListGrid().setSelectionAppearance(SelectionAppearance.ROW_STYLE);
+
+ versionsTab.setPane(bundleVersionsTable);
+ return versionsTab;
}
private Tab createSummaryTab() {
@@ -109,21 +132,39 @@ public class BundleView extends VLayout {
}
public void viewRecord(Record record) {
- final BundleWithLatestVersionComposite object;
- object = (BundleWithLatestVersionComposite) record.getAttributeAsObject("object");
-
- if (bundleBeingViewed != object.getBundleId()) {
- headerLabel.setContents(object.getBundleName());
- latestVersionItem.setValue(object.getLatestVersion());
- descriptionItem.setValue(object.getBundleDescription());
- }
-
- try {
- message.hide();
- canvas.show();
- markForRedraw();
- } catch (Throwable t) {
- CoreGUI.getErrorHandler().handleError("Cannot view bundle record", t);
+ if (record == null) {
+ viewNone();
+ } else {
+ final BundleWithLatestVersionComposite object;
+ object = (BundleWithLatestVersionComposite) record.getAttributeAsObject("object");
+
+ if (object == null) {
+ viewNone();
+ } else {
+ if (bundleBeingViewed != object.getBundleId()) {
+ bundleBeingViewed = object.getBundleId();
+
+ // summary tab
+ headerLabel.setContents(object.getBundleName());
+ latestVersionItem.setValue(object.getLatestVersion());
+ descriptionItem.setValue(object.getBundleDescription());
+
+ // versions tab
+ BundleVersionDataSource bvDataSource;
+ bvDataSource = (BundleVersionDataSource) bundleVersionsTable.getDataSource();
+ bvDataSource.setBundleId(bundleBeingViewed);
+ bvDataSource.fetchData();
+ bundleVersionsTable.getListGrid().invalidateCache(); // TODO: is there a better way to refresh?
+ }
+
+ try {
+ message.hide();
+ canvas.show();
+ markForRedraw();
+ } catch (Throwable t) {
+ CoreGUI.getErrorHandler().handleError("Cannot view bundle record", t);
+ }
+ }
}
}
commit 8bfd48b11e356dab8b7621d615fa83916782257f
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Mar 26 15:31:55 2010 -0400
be able to go to next step when no files need to be uploaded
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
index e241771..7baec2f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
@@ -47,6 +47,7 @@ public class BundleUploadDataStep implements WizardStep {
private final AbstractBundleCreateWizard wizard;
private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
private ArrayList<BundleFileUploadForm> uploadForms;
+ private Boolean noFilesNeedToBeUploaded = null; // will be non-null when we know the answer
public BundleUploadDataStep(AbstractBundleCreateWizard bundleCreationWizard) {
this.wizard = bundleCreationWizard;
@@ -84,6 +85,10 @@ public class BundleUploadDataStep implements WizardStep {
}
private boolean isFinished() {
+ if (noFilesNeedToBeUploaded != null && noFilesNeedToBeUploaded.booleanValue()) {
+ return true;
+ }
+
if (wizard.getAllBundleFilesStatus() == null) {
return false;
}
@@ -114,9 +119,11 @@ public class BundleUploadDataStep implements WizardStep {
label.setWidth100();
mainLayout.addMember(label);
uploadForms = null;
+ noFilesNeedToBeUploaded = Boolean.TRUE;
return;
}
+ noFilesNeedToBeUploaded = Boolean.FALSE;
uploadForms = new ArrayList<BundleFileUploadForm>();
for (Map.Entry<String, Boolean> entry : allFilesStatus.entrySet()) {
commit 1ad47adb952bab44b66c973f535f638c447ac492
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Mar 26 15:19:44 2010 -0400
allow for a non-titled table
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 1c7c68c..e56c48f 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
@@ -83,6 +83,10 @@ public class Table extends VLayout {
private ArrayList<TableActionInfo> tableActions = new ArrayList<TableActionInfo>();
+ public Table() {
+ this(null, null, null, null, true);
+ }
+
public Table(String tableTitle) {
this(tableTitle, null, null, null, true);
}
@@ -100,10 +104,11 @@ public class Table extends VLayout {
}
public Table(String tableTitle, Criteria criteria, SortSpecifier[] sortSpecifiers, String[] excludedFieldNames) {
- this(tableTitle,criteria,sortSpecifiers,excludedFieldNames,true);
+ this(tableTitle, criteria, sortSpecifiers, excludedFieldNames, true);
}
+
public Table(String tableTitle, Criteria criteria, SortSpecifier[] sortSpecifiers, String[] excludedFieldNames,
- boolean autoFetchData) {
+ boolean autoFetchData) {
super();
setWidth100();
@@ -111,11 +116,7 @@ public class Table extends VLayout {
// Title
title = new HTMLFlow();
- title.setWidth100();
- title.setHeight(35);
- title.setContents(tableTitle);
- title.setPadding(4);
- title.setStyleName("HeaderLabel");
+ setTableTitle(tableTitle);
// Grid
listGrid = new ListGrid();
@@ -169,7 +170,8 @@ public class Table extends VLayout {
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) {
@@ -213,9 +215,8 @@ public class Table extends VLayout {
}
});
-
// TODO GH: This doesn't yet work as desired to force the fields to fit to the table when you resize one of them.
- if (false) { // If Force Fit
+ if (false) { // If Force Fit
listGrid.addDataArrivedHandler(new DataArrivedHandler() {
public void onDataArrived(DataArrivedEvent dataArrivedEvent) {
for (ListGridField f : listGrid.getFields()) {
@@ -273,14 +274,30 @@ public class Table extends VLayout {
private ArrayList<Integer> fieldSizes = new ArrayList<Integer>();
private boolean autoSizing = false;
-
public void refresh(Criteria criteria) {
this.listGrid.setCriteria(criteria);
this.listGrid.markForRedraw();
}
- public void setTableTitle(String title) {
- this.title.setContents(title);
+ public void setTableTitle(String titleString) {
+ if (titleString == null) {
+ titleString = "";
+ }
+ if (titleString.length() > 0) {
+ title.setWidth100();
+ title.setHeight(35);
+ title.setContents(titleString);
+ title.setPadding(4);
+ title.setStyleName("HeaderLabel");
+ } else {
+ title.setWidth100();
+ title.setHeight(0);
+ title.setContents(null);
+ title.setPadding(0);
+ title.setStyleName("normal");
+ }
+
+ title.markForRedraw();
}
public void setDataSource(RPCDataSource dataSource) {
@@ -299,7 +316,8 @@ public class Table extends VLayout {
this.addTableAction(title, null, null, tableAction);
}
- public void addTableAction(String title, SelectionEnablement enablement, String confirmation, TableAction tableAction) {
+ public void addTableAction(String title, SelectionEnablement enablement, String confirmation,
+ TableAction tableAction) {
if (enablement == null) {
enablement = DEFAULT_SELECTION_ENABLEMENT;
}
@@ -313,27 +331,26 @@ public class Table extends VLayout {
for (TableActionInfo tableAction : tableActions) {
boolean enabled;
switch (tableAction.enablement) {
- case ALWAYS:
- enabled = true;
- break;
- case ANY:
- enabled = (count >= 1);
- break;
- case SINGLE:
- enabled = (count == 1);
- break;
- case MULTIPLE:
- enabled = (count > 1);
- break;
- default:
- throw new IllegalStateException("Unhandled SelectionEnablement: " + tableAction.enablement.name());
+ case ALWAYS:
+ enabled = true;
+ break;
+ case ANY:
+ enabled = (count >= 1);
+ break;
+ case SINGLE:
+ enabled = (count == 1);
+ break;
+ case MULTIPLE:
+ enabled = (count > 1);
+ break;
+ default:
+ throw new IllegalStateException("Unhandled SelectionEnablement: " + tableAction.enablement.name());
}
tableAction.actionButton.setDisabled(!enabled);
}
this.tableInfo.setContents("Total: " + listGrid.getTotalRows() + " (" + count + " selected)");
}
-
// -------------- Inner utility class -------------
private static class TableActionInfo {
commit cf3888c51458c009411d1ccee4e4b3becfe336c3
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Mar 26 15:18:53 2010 -0400
put the summary data in the same location as the other steps (via margin)
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleSummaryStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleSummaryStep.java
index ffa143a..c010952 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleSummaryStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleSummaryStep.java
@@ -41,6 +41,7 @@ public class BundleSummaryStep implements WizardStep {
DynamicForm form = new DynamicForm();
form.setNumCols(2);
+ form.setMargin(20);
StaticTextItem bundleTypeLabel = new StaticTextItem("bundleType", "Type");
bundleTypeLabel.setTitleAlign(Alignment.LEFT);
commit 74202995ca16b2edf797d7bf721e09e7b706fe22
Merge: e09ae65... 994a9db...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Mar 26 14:48:35 2010 -0400
Merge branch 'gwt' into gwt-jay
commit e09ae659e017da3d4f32755e88685663680c782f
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Mar 26 14:47:48 2010 -0400
intermittent checkin
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundlDeploymentStatus.java b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundlDeploymentStatus.java
deleted file mode 100644
index 5c8cac5..0000000
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundlDeploymentStatus.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.rhq.core.domain.bundle;
-
-/**
- * Simple statuses for Bundle (Group) Deploy requests. When a request is first initiated, it will be considered in the
- * {@link #INPROGRESS} state. When the request has completed, it will have been either a {@link #SUCCESS} or
- * {@link #FAILURE}. For group deploy requests the status values are the same. Any individual failure will be
- * reflected as a group failure.
- *
- * @author Jay Shaughnessy
- */
-public enum BundlDeploymentStatus {
- INPROGRESS("In Progress"), //
- SUCCESS("Success"), //
- FAILURE("Failure"), //
- NOCHANGE("No Change");
-
- private String displayName;
-
- BundlDeploymentStatus(String displayName) {
- this.displayName = displayName;
- }
-
- public String toString() {
- return displayName;
- }
-}
\ No newline at end of file
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeployment.java b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeployment.java
index 28d5adc..f1bb4d1 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeployment.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeployment.java
@@ -88,7 +88,7 @@ public class BundleDeployment implements Serializable {
@Column(name = "STATUS", nullable = false)
@Enumerated(EnumType.STRING)
- protected BundlDeploymentStatus status;
+ protected BundleDeploymentStatus status;
@Column(name = "CTIME")
private Long ctime = -1L;
@@ -100,9 +100,7 @@ public class BundleDeployment implements Serializable {
}
public BundleDeployment(BundleDeployDefinition bundleDeploymentDef, Resource resource) {
- this.bundleDeployDefinition = bundleDeploymentDef;
- this.resource = resource;
- this.status = BundlDeploymentStatus.INPROGRESS;
+ this(bundleDeploymentDef, resource, null);
}
public BundleDeployment(BundleDeployDefinition bundleDeploymentDef, Resource resource,
@@ -110,6 +108,7 @@ public class BundleDeployment implements Serializable {
this.bundleDeployDefinition = bundleDeploymentDef;
this.resource = resource;
this.bundleGroupDeployment = bundleGroupDeployment;
+ this.status = BundleDeploymentStatus.INPROGRESS;
}
public BundleDeployDefinition getBundleDeployDefinition() {
@@ -172,11 +171,11 @@ public class BundleDeployment implements Serializable {
*
* @return the request status
*/
- public BundlDeploymentStatus getStatus() {
+ public BundleDeploymentStatus getStatus() {
return status;
}
- public void setStatus(BundlDeploymentStatus status) {
+ public void setStatus(BundleDeploymentStatus status) {
this.status = status;
}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeploymentStatus.java b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeploymentStatus.java
new file mode 100644
index 0000000..66f8f68
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeploymentStatus.java
@@ -0,0 +1,48 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.core.domain.bundle;
+
+/**
+ * Simple statuses for Bundle (Group) Deploy requests. When a request is first initiated, it will be considered in the
+ * {@link #INPROGRESS} state. When the request has completed, it will have been either a {@link #SUCCESS} or
+ * {@link #FAILURE}. For group deploy requests the status values are the same. Any individual failure will be
+ * reflected as a group failure.
+ *
+ * @author Jay Shaughnessy
+ */
+public enum BundleDeploymentStatus {
+ INPROGRESS("In Progress"), //
+ SUCCESS("Success"), //
+ FAILURE("Failure"), //
+ NOCHANGE("No Change");
+
+ private String displayName;
+
+ BundleDeploymentStatus(String displayName) {
+ this.displayName = displayName;
+ }
+
+ public String toString() {
+ return displayName;
+ }
+}
\ No newline at end of file
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleGroupDeployment.java b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleGroupDeployment.java
index 6f8364d..d1fbc24 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleGroupDeployment.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleGroupDeployment.java
@@ -66,7 +66,7 @@ public class BundleGroupDeployment implements Serializable {
@Column(name = "STATUS", nullable = false)
@Enumerated(EnumType.STRING)
- protected BundlDeploymentStatus status;
+ protected BundleDeploymentStatus status;
@Column(name = "ERROR_MESSAGE")
protected String errorMessage;
@@ -91,7 +91,7 @@ public class BundleGroupDeployment implements Serializable {
this.subjectName = subjectName;
this.bundleDeployDefinition = bundleDeployDefinition;
this.group = group;
- this.status = BundlDeploymentStatus.INPROGRESS;
+ this.status = BundleDeploymentStatus.INPROGRESS;
}
public int getId() {
@@ -108,11 +108,11 @@ public class BundleGroupDeployment implements Serializable {
*
* @return the request status
*/
- public BundlDeploymentStatus getStatus() {
+ public BundleDeploymentStatus getStatus() {
return status;
}
- public void setStatus(BundlDeploymentStatus status) {
+ public void setStatus(BundleDeploymentStatus status) {
this.status = status;
}
@@ -135,7 +135,7 @@ public class BundleGroupDeployment implements Serializable {
/**
* If not <code>null</code>, this is an error message (possibly a full stack trace) to indicate the overall error
* that occurred when the configuration update failed. This will normally be <code>null</code> unless the
- * {@link #getStatus() status} indicates a {@link BundlDeploymentStatus#FAILURE}.
+ * {@link #getStatus() status} indicates a {@link BundleDeploymentStatus#FAILURE}.
*
* @return overall error that occurred
*/
@@ -155,7 +155,7 @@ public class BundleGroupDeployment implements Serializable {
this.errorMessage = errorMessage;
if (this.errorMessage != null) {
- setStatus(BundlDeploymentStatus.FAILURE);
+ setStatus(BundleDeploymentStatus.FAILURE);
}
}
@@ -212,7 +212,7 @@ public class BundleGroupDeployment implements Serializable {
public long getDuration() {
long start = this.createdTime;
long end;
- if ((status == null) || (status == BundlDeploymentStatus.INPROGRESS)) {
+ if ((status == null) || (status == BundleDeploymentStatus.INPROGRESS)) {
end = System.currentTimeMillis();
} else {
end = this.modifiedTime;
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
index 5990e61..a98d66e 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
@@ -555,9 +555,9 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
assert b1f1.getId() != b2f1.getId() : "should have been different bundle files";
assert b1f1.getPackageVersion().getId() != b2f1.getPackageVersion().getId() : "should be different PV";
- assert b1f1.getPackageVersion().getGeneralPackage().getId() == b2f1.getPackageVersion().getGeneralPackage()
+ assert b1f1.getPackageVersion().getGeneralPackage().getId() != b2f1.getPackageVersion().getGeneralPackage()
.getId() : "package IDs should be different";
- assert b1f1.getPackageVersion().getGeneralPackage().equals(b2f1.getPackageVersion().getGeneralPackage()) : "should be different packages";
+ assert !b1f1.getPackageVersion().getGeneralPackage().equals(b2f1.getPackageVersion().getGeneralPackage()) : "should be different packages";
}
@Test(enabled = TESTS_ENABLED)
commit 994a9dbec2327a21f0a4886dbac1c25fafd0670d
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Mar 26 14:05:09 2010 -0400
i can't figure out how to redraw this icon without hiding then showing it again. prior to doing this, the new icon would not show up
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleFileUploadForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleFileUploadForm.java
index 1d67a73..b0617f0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleFileUploadForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleFileUploadForm.java
@@ -178,14 +178,16 @@ public class BundleFileUploadForm extends DynamicCallbackForm {
icon.setTooltip("Uploaded bundle file successfully");
CoreGUI.getMessageCenter().notify(
new Message("Uploaded bundle file successfully", results, Severity.Info));
- markForRedraw();
+ icon.hide();
+ icon.show();
} else {
uploadResults = Boolean.FALSE;
icon.setIcons(iconRed);
icon.setTooltip("Bundle file upload failed");
CoreGUI.getMessageCenter()
.notify(new Message("Bundle file upload failed", results, Severity.Error));
- markForRedraw();
+ icon.hide();
+ icon.show();
}
}
});
@@ -196,7 +198,8 @@ public class BundleFileUploadForm extends DynamicCallbackForm {
icon.setIcons(iconRed);
icon.setTooltip("Bundle file upload failed");
CoreGUI.getMessageCenter().notify(new Message("Bundle file upload request failed", Severity.Error));
- markForRedraw();
+ icon.hide();
+ icon.show();
}
});
}
commit 3c3f0cf8380fad1be4200a4a97e2cb26037178af
Merge: 771a00d... 7258569...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Mar 26 13:47:38 2010 -0400
Merge branch 'gwt' into gwt-jay
commit 771a00d5accc4234353bb257cd46994275b15912
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Mar 26 13:46:26 2010 -0400
Intermittent check-in for deployment status work
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml b/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
index f3bdf49..005bafb 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
@@ -586,6 +586,7 @@
<column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/>
<column name="BUNDLE_DEPLOY_DEF_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DEPLOY_DEF" />
<column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE" />
+ <column name="STATUS" type="VARCHAR2" required="true" size="16"/>
<column name="CTIME" type="LONG" required="true"/>
<column name="BUNDLE_GROUP_DEPLOY_ID" type="INTEGER" required="false" references="RHQ_BUNDLE_GROUP_DEPLOY"/>
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 18db292..326f3ba 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -2945,6 +2945,11 @@
</schema-directSQL>
</schemaSpec>
+ <schemaSpec version="2.78.6">
+ <schema-addColumn table="RHQ_BUNDLE_DEPLOY" column="STATUS" columnType="VARCHAR2" precision="16" />
+ <schema-alterColumn table="RHQ_BUNDLE_DEPLOY" column="STATUS" nullable="FALSE" />
+ </schemaSpec>
+
<schemaSpec version="2.79">
<schema-directSQL>
<statement desc="Normalizing resource group descriptions">
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundlDeploymentStatus.java b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundlDeploymentStatus.java
new file mode 100644
index 0000000..5c8cac5
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundlDeploymentStatus.java
@@ -0,0 +1,48 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.core.domain.bundle;
+
+/**
+ * Simple statuses for Bundle (Group) Deploy requests. When a request is first initiated, it will be considered in the
+ * {@link #INPROGRESS} state. When the request has completed, it will have been either a {@link #SUCCESS} or
+ * {@link #FAILURE}. For group deploy requests the status values are the same. Any individual failure will be
+ * reflected as a group failure.
+ *
+ * @author Jay Shaughnessy
+ */
+public enum BundlDeploymentStatus {
+ INPROGRESS("In Progress"), //
+ SUCCESS("Success"), //
+ FAILURE("Failure"), //
+ NOCHANGE("No Change");
+
+ private String displayName;
+
+ BundlDeploymentStatus(String displayName) {
+ this.displayName = displayName;
+ }
+
+ public String toString() {
+ return displayName;
+ }
+}
\ No newline at end of file
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeployment.java b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeployment.java
index 4bb964d..28d5adc 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeployment.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeployment.java
@@ -29,6 +29,8 @@ import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
@@ -84,6 +86,10 @@ public class BundleDeployment implements Serializable {
@ManyToOne
private BundleGroupDeployment bundleGroupDeployment;
+ @Column(name = "STATUS", nullable = false)
+ @Enumerated(EnumType.STRING)
+ protected BundlDeploymentStatus status;
+
@Column(name = "CTIME")
private Long ctime = -1L;
@@ -96,6 +102,7 @@ public class BundleDeployment implements Serializable {
public BundleDeployment(BundleDeployDefinition bundleDeploymentDef, Resource resource) {
this.bundleDeployDefinition = bundleDeploymentDef;
this.resource = resource;
+ this.status = BundlDeploymentStatus.INPROGRESS;
}
public BundleDeployment(BundleDeployDefinition bundleDeploymentDef, Resource resource,
@@ -159,6 +166,20 @@ public class BundleDeployment implements Serializable {
this.bundleGroupDeployment = bundleGroupDeployment;
}
+ /**
+ * The status of the request which indicates that the request is either still in progress, or it has completed and
+ * either succeeded or failed.
+ *
+ * @return the request status
+ */
+ public BundlDeploymentStatus getStatus() {
+ return status;
+ }
+
+ public void setStatus(BundlDeploymentStatus status) {
+ this.status = status;
+ }
+
@Override
public String toString() {
StringBuilder str = new StringBuilder("BundleDeployment: ");
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleGroupDeployment.java b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleGroupDeployment.java
index 8a0365f..6f8364d 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleGroupDeployment.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleGroupDeployment.java
@@ -66,7 +66,7 @@ public class BundleGroupDeployment implements Serializable {
@Column(name = "STATUS", nullable = false)
@Enumerated(EnumType.STRING)
- protected BundleGroupDeploymentStatus status;
+ protected BundlDeploymentStatus status;
@Column(name = "ERROR_MESSAGE")
protected String errorMessage;
@@ -91,7 +91,7 @@ public class BundleGroupDeployment implements Serializable {
this.subjectName = subjectName;
this.bundleDeployDefinition = bundleDeployDefinition;
this.group = group;
- this.status = BundleGroupDeploymentStatus.INPROGRESS;
+ this.status = BundlDeploymentStatus.INPROGRESS;
}
public int getId() {
@@ -108,11 +108,11 @@ public class BundleGroupDeployment implements Serializable {
*
* @return the request status
*/
- public BundleGroupDeploymentStatus getStatus() {
+ public BundlDeploymentStatus getStatus() {
return status;
}
- public void setStatus(BundleGroupDeploymentStatus status) {
+ public void setStatus(BundlDeploymentStatus status) {
this.status = status;
}
@@ -135,7 +135,7 @@ public class BundleGroupDeployment implements Serializable {
/**
* If not <code>null</code>, this is an error message (possibly a full stack trace) to indicate the overall error
* that occurred when the configuration update failed. This will normally be <code>null</code> unless the
- * {@link #getStatus() status} indicates a {@link BundleGroupDeploymentStatus#FAILURE}.
+ * {@link #getStatus() status} indicates a {@link BundlDeploymentStatus#FAILURE}.
*
* @return overall error that occurred
*/
@@ -155,7 +155,7 @@ public class BundleGroupDeployment implements Serializable {
this.errorMessage = errorMessage;
if (this.errorMessage != null) {
- setStatus(BundleGroupDeploymentStatus.FAILURE);
+ setStatus(BundlDeploymentStatus.FAILURE);
}
}
@@ -212,7 +212,7 @@ public class BundleGroupDeployment implements Serializable {
public long getDuration() {
long start = this.createdTime;
long end;
- if ((status == null) || (status == BundleGroupDeploymentStatus.INPROGRESS)) {
+ if ((status == null) || (status == BundlDeploymentStatus.INPROGRESS)) {
end = System.currentTimeMillis();
} else {
end = this.modifiedTime;
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleGroupDeploymentStatus.java b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleGroupDeploymentStatus.java
deleted file mode 100644
index 94f9113..0000000
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleGroupDeploymentStatus.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.rhq.core.domain.bundle;
-
-/**
- * Simple statuses for Bundle Group Deploy requests. When a request is first initiated, it will be considered in the
- * {@link #INPROGRESS} state. When the request has completed, it will have been either a {@link #SUCCESS} or
- * {@link #FAILURE}.
- *
- * @author Jay Shaughnessy
- */
-public enum BundleGroupDeploymentStatus {
- INPROGRESS("In Progress"), //
- SUCCESS("Success"), //
- FAILURE("Failure"), //
- NOCHANGE("No Change");
-
- private String displayName;
-
- BundleGroupDeploymentStatus(String displayName) {
- this.displayName = displayName;
- }
-
- public String toString() {
- return displayName;
- }
-}
\ No newline at end of file
commit 7258569515eaf7cfa3021a487faa49ae8ff8dd41
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Mar 26 13:42:53 2010 -0400
this new test breaks - it illustrates our problem with packages ignoring classification
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
index 163e9c6..5990e61 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
@@ -525,6 +525,42 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
}
@Test(enabled = TESTS_ENABLED)
+ public void testAddBundleFilesToDifferentBundles() throws Exception {
+ Bundle b1 = createBundle("one");
+ assertNotNull(b1);
+ BundleVersion bv1 = createBundleVersion(b1.getName(), "1.0", b1);
+ assertNotNull(bv1);
+ BundleFile b1f1 = bundleManager.addBundleFileViaByteArray(overlord, bv1.getId(), TEST_PREFIX + "-file1", "1.0",
+ null, "Bundle #1 File # 1".getBytes(), false);
+
+ // create a second bundle but create file of the same name as above
+ Bundle b2 = createBundle("two");
+ assertNotNull(b2);
+ BundleVersion bv2 = createBundleVersion(b2.getName(), "1.0", b2);
+ assertNotNull(bv2);
+ BundleFile b2f1 = bundleManager.addBundleFileViaByteArray(overlord, bv2.getId(), TEST_PREFIX + "-file1", "1.0",
+ null, "Bundle #2 File # 1".getBytes(), false);
+
+ BundleFileCriteria bfc = new BundleFileCriteria();
+ bfc.addFilterBundleVersionId(bv1.getId());
+ PageList<BundleFile> bundleFiles = bundleManager.findBundleFilesByCriteria(overlord, bfc);
+ assert bundleFiles.size() == 1 : bundleFiles;
+ assert bundleFiles.get(0).getId() == b1f1.getId() : bundleFiles;
+
+ bfc = new BundleFileCriteria();
+ bfc.addFilterBundleVersionId(bv2.getId());
+ bundleFiles = bundleManager.findBundleFilesByCriteria(overlord, bfc);
+ assert bundleFiles.size() == 1 : bundleFiles;
+ assert bundleFiles.get(0).getId() == b2f1.getId() : bundleFiles;
+
+ assert b1f1.getId() != b2f1.getId() : "should have been different bundle files";
+ assert b1f1.getPackageVersion().getId() != b2f1.getPackageVersion().getId() : "should be different PV";
+ assert b1f1.getPackageVersion().getGeneralPackage().getId() == b2f1.getPackageVersion().getGeneralPackage()
+ .getId() : "package IDs should be different";
+ assert b1f1.getPackageVersion().getGeneralPackage().equals(b2f1.getPackageVersion().getGeneralPackage()) : "should be different packages";
+ }
+
+ @Test(enabled = TESTS_ENABLED)
public void testCreateBundleDeploymentDef() throws Exception {
Bundle b1 = createBundle("one");
assertNotNull(b1);
commit 845c8f1b513eb481667fe6a0c3b7d9955bb931e9
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Mar 26 13:42:25 2010 -0400
simplify the upload step, the icon still isn't redrawing when it should though
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleFileUploadForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleFileUploadForm.java
index 6f18f04..1d67a73 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleFileUploadForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleFileUploadForm.java
@@ -27,8 +27,6 @@ import com.smartgwt.client.widgets.form.fields.FormItemIcon;
import com.smartgwt.client.widgets.form.fields.HiddenItem;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.form.fields.UploadItem;
-import com.smartgwt.client.widgets.form.fields.events.ChangeEvent;
-import com.smartgwt.client.widgets.form.fields.events.ChangeHandler;
import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
@@ -48,6 +46,10 @@ public class BundleFileUploadForm extends DynamicCallbackForm {
private final BundleVersion bundleVersion;
private final String name;
private final boolean showNameLabel;
+ private final FormItemIcon iconLoading;
+ private final FormItemIcon iconGreen;
+ private final FormItemIcon iconRed;
+ private final FormItemIcon iconGrey;
public BundleFileUploadForm(BundleVersion bundleVersion, String name, boolean showNameLabel,
Boolean isAlreadyUploaded) {
@@ -60,6 +62,26 @@ public class BundleFileUploadForm extends DynamicCallbackForm {
setEncoding(Encoding.MULTIPART);
setAction(GWT.getModuleBaseURL() + "/BundleFileUploadServlet");
+
+ iconLoading = new FormItemIcon();
+ iconLoading.setSrc("ajax-loader.gif");
+ iconLoading.setWidth(16);
+ iconLoading.setHeight(16);
+
+ iconGreen = new FormItemIcon();
+ iconGreen.setSrc("/images/icons/availability_green_16.png");
+ iconGreen.setWidth(16);
+ iconGreen.setHeight(16);
+
+ iconRed = new FormItemIcon();
+ iconRed.setSrc("/images/icons/availability_red_16.png");
+ iconRed.setWidth(16);
+ iconRed.setHeight(16);
+
+ iconGrey = new FormItemIcon();
+ iconGrey.setSrc("/images/icons/availability_grey_16.png");
+ iconGrey.setWidth(16);
+ iconGrey.setHeight(16);
}
public BundleVersion getBundleVersion() {
@@ -86,10 +108,15 @@ public class BundleFileUploadForm extends DynamicCallbackForm {
@Override
public void submitForm() {
- icon.setShowIcons(true);
- uploadButton.setDisabled(true);
- markForRedraw();
- super.submitForm();
+ Object value = bundleUploadItem.getValue();
+ if (value == null || value.toString().length() == 0) {
+ icon.setIcons(iconRed);
+ icon.setTooltip("Please select a file to upload");
+ } else {
+ icon.setIcons(iconLoading);
+ icon.setTooltip("Loading...");
+ super.submitForm();
+ }
}
@Override
@@ -117,7 +144,6 @@ public class BundleFileUploadForm extends DynamicCallbackForm {
uploadButton = new ButtonItem("Upload");
uploadButton.setStartRow(false);
uploadButton.setEndRow(false);
- uploadButton.setDisabled(true);
uploadButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
submitForm();
@@ -127,28 +153,19 @@ public class BundleFileUploadForm extends DynamicCallbackForm {
icon = new StaticTextItem("icon");
icon.setStartRow(false);
icon.setShowTitle(false);
-
- FormItemIcon loadingIcon = new FormItemIcon();
- loadingIcon.setSrc("ajax-loader.gif");
- loadingIcon.setWidth(16);
- loadingIcon.setHeight(16);
- icon.setIcons(loadingIcon);
- icon.setShowIcons(false);
-
- bundleUploadItem.addChangeHandler(new ChangeHandler() {
- public void onChange(ChangeEvent changeEvent) {
- if (uploadResults != null) {
- retrievalStatus(uploadResults.booleanValue());
- } else {
- uploadButton.setDisabled(false);
- icon.setShowIcons(false);
- }
- }
- });
-
if (uploadResults != null) {
- retrievalStatus(uploadResults.booleanValue());
+ if (uploadResults.booleanValue()) {
+ icon.setIcons(iconGreen);
+ icon.setTooltip("Bundle file has already been uploaded");
+ } else {
+ icon.setIcons(iconRed);
+ icon.setTooltip("Bundle file upload has previously failed");
+ }
+ } else {
+ icon.setIcons(iconGrey);
+ icon.setTooltip("Select a file to upload, then click the 'Upload' button or 'Next'");
}
+ icon.setShowIcons(true);
setItems(sessionIdField, bundleVersionIdField, nameField, versionField, bundleUploadItem, uploadButton, icon);
@@ -156,43 +173,31 @@ public class BundleFileUploadForm extends DynamicCallbackForm {
public void onSubmitComplete(DynamicFormSubmitCompleteEvent event) {
String results = event.getResults();
if (!results.contains("Failed to upload bundle file")) {
- CoreGUI.getMessageCenter().notify(new Message("Uploaded bundle file successfully", Severity.Info));
- retrievalStatus(true);
+ uploadResults = Boolean.TRUE;
+ icon.setIcons(iconGreen);
+ icon.setTooltip("Uploaded bundle file successfully");
+ CoreGUI.getMessageCenter().notify(
+ new Message("Uploaded bundle file successfully", results, Severity.Info));
+ markForRedraw();
} else {
- CoreGUI.getMessageCenter().notify(new Message("Bundle file upload failed", Severity.Error));
- retrievalStatus(false);
+ uploadResults = Boolean.FALSE;
+ icon.setIcons(iconRed);
+ icon.setTooltip("Bundle file upload failed");
+ CoreGUI.getMessageCenter()
+ .notify(new Message("Bundle file upload failed", results, Severity.Error));
+ markForRedraw();
}
}
});
addFormSubmitFailedHandler(new FormSubmitFailedHandler() {
public void onFormSubmitFailed(FormSubmitFailedEvent event) {
- CoreGUI.getMessageCenter().notify(new Message("Bundle file upload failed", Severity.Error));
- retrievalStatus(false);
+ uploadResults = Boolean.FALSE;
+ icon.setIcons(iconRed);
+ icon.setTooltip("Bundle file upload failed");
+ CoreGUI.getMessageCenter().notify(new Message("Bundle file upload request failed", Severity.Error));
+ markForRedraw();
}
});
}
-
- /**
- * Call this when the last file retrieval status is known. <code>true</code> means successful,
- * <code>false</code> means an error occurred.
- * @param ok status
- */
- private void retrievalStatus(boolean ok) {
- uploadResults = Boolean.valueOf(ok);
-
- if (uploadButton != null) {
- FormItemIcon loadedIcon = new FormItemIcon();
- if (ok) {
- loadedIcon.setSrc("/images/icons/availability_green_16.png");
- } else {
- loadedIcon.setSrc("/images/icons/availability_red_16.png");
- }
- loadedIcon.setWidth(16);
- loadedIcon.setHeight(16);
- icon.setIcons(loadedIcon);
- icon.setShowIcons(true);
- uploadButton.setDisabled(uploadResults);
- }
- }
}
commit b1c8bfca1422d74c48b50d69dd902507007b8d45
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Mar 26 13:41:55 2010 -0400
need to use the return obj from merge
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
index 8d19ad2..7b41da0 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
@@ -361,7 +361,7 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
// set the PackageVersion's filename to the bundleFile name, it's left null by default
packageVersion.setFileName(name);
- entityManager.merge(packageVersion);
+ packageVersion = entityManager.merge(packageVersion);
// Create the mapping between the Bundle's Repo and the BundleFile's PackageVersion
Repo repo = bundle.getRepo();
commit 9941c387a8863aefbe5e80906098c749336b7993
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Mar 26 10:50:56 2010 -0400
get the 'logged in as' message area formatted a bit better
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
index caf4ffb..e134f04 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
@@ -22,9 +22,11 @@ import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.ui.Hyperlink;
-import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.types.VerticalAlignment;
import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.Img;
+import com.smartgwt.client.widgets.Label;
+import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.LayoutSpacer;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.toolbar.ToolStrip;
@@ -39,7 +41,7 @@ public class MenuBarView extends VLayout {
private AboutModalWindow aboutModalWindow;
- public static final String[] SECTIONS = {"Dashboard", "Demo", "Inventory", "Bundles", "Administration"};
+ public static final String[] SECTIONS = { "Dashboard", "Demo", "Inventory", "Bundles", "Administration" };
private String selected = "Dashboard";
@@ -65,14 +67,12 @@ public class MenuBarView extends VLayout {
protected void onDraw() {
super.onDraw();
-
ToolStrip topStrip = new ToolStrip();
topStrip.setHeight(34);
topStrip.setWidth100();
topStrip.setBackgroundImage("header/header_bg.png");
topStrip.setMembersMargin(20);
-
this.aboutModalWindow = new AboutModalWindow();
Img logo = new Img("header/rhq_logo_28px.png", 80, 28);
logo.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
@@ -82,7 +82,6 @@ public class MenuBarView extends VLayout {
});
topStrip.addMember(logo);
-
linksPane = new HTMLFlow();
linksPane.setContents(setupLinks());
@@ -90,12 +89,15 @@ public class MenuBarView extends VLayout {
topStrip.addMember(new LayoutSpacer());
- topStrip.addMember(new HTMLFlow("Logged in as " + CoreGUI.getSessionSubject().getName()));
-
- topStrip.addMember(new Hyperlink("Help", "Help"));
- topStrip.addMember(new Hyperlink("Preferences", "Preferences"));
- topStrip.addMember(new Hyperlink("Log Out", "LogOut"));
-
+ HLayout helpLayout = new HLayout();
+ Label loggedInAs = new Label("Logged in as " + CoreGUI.getSessionSubject().getName());
+ loggedInAs.setValign(VerticalAlignment.CENTER);
+ helpLayout.addMember(loggedInAs);
+ helpLayout.addMember(new Hyperlink("Help", "Help"));
+ helpLayout.addMember(new Hyperlink("Preferences", "Preferences"));
+ helpLayout.addMember(new Hyperlink("Log Out", "LogOut"));
+ helpLayout.setLayoutAlign(VerticalAlignment.CENTER);
+ topStrip.addMember(helpLayout);
/* DynamicForm links = new DynamicForm();
links.setNumCols(SECTIONS.length * 2);
@@ -128,9 +130,9 @@ public class MenuBarView extends VLayout {
markForRedraw();
}
-
private String setupLinks() {
- StringBuilder headerString = new StringBuilder("<table style=\"height: 34px;\" cellpadding=\"0\" cellspacing=\"0\"><tr>");
+ StringBuilder headerString = new StringBuilder(
+ "<table style=\"height: 34px;\" cellpadding=\"0\" cellspacing=\"0\"><tr>");
boolean first = true;
for (String section : SECTIONS) {
@@ -144,7 +146,6 @@ public class MenuBarView extends VLayout {
styleClass += "Selected";
}
-
headerString.append("<td class=\"" + styleClass + "\" onclick=\"document.location='#" + section + "'\" >");
headerString.append(section);
headerString.append("</td>\n");
commit a4843f881ec94bdfe97a44f6284d6b12b0bb2b01
Merge: 3b74570... aac77c4...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Mar 26 09:27:00 2010 -0400
Merge branch 'gwt' into gwt-jay
commit aac77c4667585187cb1b24b769a36f628ec8cd1d
Merge: c319887... 7afbfa9...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Mar 26 09:26:26 2010 -0400
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
commit 3b745709e4be143524270f8f9825ab134228e4f6
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Mar 26 09:25:42 2010 -0400
Initial support for bundle group deployment. Needs more work around group
status tracking and possibly fault tolerance.
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml b/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
index 309c3cb..f3bdf49 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
@@ -570,6 +570,17 @@
</index>
</table>
+ <table name="RHQ_BUNDLE_GROUP_DEPLOY">
+ <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/>
+ <column name="GROUP_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_GROUP"/>
+ <column name="BUNDLE_DEPLOY_DEF_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DEPLOY_DEF" />
+ <column name="STATUS" type="VARCHAR2" required="true" size="16"/>
+ <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/>
+ <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="255"/>
+ <column name="CTIME" type="LONG" required="true"/>
+ <column name="MTIME" type="LONG" required="true"/>
+ </table>
+
<!-- Represents a bundle version that is deployed on a platform resource -->
<table name="RHQ_BUNDLE_DEPLOY">
<column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/>
@@ -584,17 +595,6 @@
</index>
</table>
- <table name="RHQ_BUNDLE_GROUP_DEPLOY">
- <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/>
- <column name="GROUP_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_GROUP"/>
- <column name="BUNDLE_DEPLOY_DEF_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DEPLOY_DEF" />
- <column name="STATUS" type="VARCHAR2" required="true" size="16"/>
- <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/>
- <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="255"/>
- <column name="CTIME" type="LONG" required="true"/>
- <column name="MTIME" type="LONG" required="true"/>
- </table>
-
<table name="RHQ_BUNDLE_DEPLOY_HIST">
<column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/>
<column name="BUNDLE_DEPLOY_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DEPLOY" />
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeployDefinition.java b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeployDefinition.java
index 5c11287..8f642ea 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeployDefinition.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeployDefinition.java
@@ -103,6 +103,9 @@ public class BundleDeployDefinition implements Serializable {
@OneToMany(mappedBy = "bundleDeployDefinition", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
private List<BundleDeployment> deployments = new ArrayList<BundleDeployment>();
+ @OneToMany(mappedBy = "bundleDeployDefinition", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
+ private List<BundleGroupDeployment> groupDeployments = new ArrayList<BundleGroupDeployment>();
+
public BundleDeployDefinition() {
// for JPA use
}
@@ -212,6 +215,19 @@ public class BundleDeployDefinition implements Serializable {
this.deployments = deployments;
}
+ public List<BundleGroupDeployment> getGroupDeployments() {
+ return groupDeployments;
+ }
+
+ public void addGroupDeployment(BundleGroupDeployment bundleGroupDeployment) {
+ this.groupDeployments.add(bundleGroupDeployment);
+ bundleGroupDeployment.setBundleDeployDefinition(this);
+ }
+
+ public void setGroupDeployments(List<BundleGroupDeployment> groupDeployments) {
+ this.groupDeployments = groupDeployments;
+ }
+
@Override
public String toString() {
return "BundleDeployDefinition[id=" + id + ", name=" + name + "]";
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleGroupDeployment.java b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleGroupDeployment.java
index 8f27723..8a0365f 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleGroupDeployment.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleGroupDeployment.java
@@ -26,7 +26,6 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
-import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
@@ -58,11 +57,11 @@ public class BundleGroupDeployment implements Serializable {
private int id;
@JoinColumn(name = "GROUP_ID", referencedColumnName = "ID")
- @ManyToOne(cascade = { CascadeType.REMOVE })
+ @ManyToOne
private ResourceGroup group;
@JoinColumn(name = "BUNDLE_DEPLOY_DEF_ID", referencedColumnName = "ID", nullable = false)
- @ManyToOne(cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)
+ @ManyToOne
protected BundleDeployDefinition bundleDeployDefinition;
@Column(name = "STATUS", nullable = false)
@@ -81,7 +80,7 @@ public class BundleGroupDeployment implements Serializable {
@Column(name = "MTIME", nullable = false)
protected long modifiedTime = System.currentTimeMillis();
- @OneToMany(mappedBy = "bundleGroupDeployment", fetch = FetchType.LAZY, cascade = { CascadeType.ALL })
+ @OneToMany(mappedBy = "bundleGroupDeployment", fetch = FetchType.LAZY)
private List<BundleDeployment> bundleDeployments = new ArrayList<BundleDeployment>();
// For JPA
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java
index 9eae8e6..3c8c5c5 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java
@@ -404,10 +404,10 @@ public class ResourceGroup extends Group {
// by primary key which will also put the configuration updates in chronological order
private List<AbstractGroupConfigurationUpdate> configurationUpdates = new ArrayList<AbstractGroupConfigurationUpdate>();
- @OneToMany(mappedBy = "group", cascade = { CascadeType.ALL })
+ @OneToMany(mappedBy = "group", cascade = { CascadeType.REMOVE })
@OrderBy
- // by primary key which will also put the operation histories in chronological order
- private List<BundleGroupDeployment> bundleDeployments = new ArrayList<BundleGroupDeployment>();
+ // by primary key which will also put the bundle deployments in chronological order
+ private List<BundleGroupDeployment> bundleGroupDeployments = new ArrayList<BundleGroupDeployment>();
@JoinColumn(name = "GROUP_DEFINITION_ID", referencedColumnName = "ID", nullable = true)
@ManyToOne
@@ -554,12 +554,12 @@ public class ResourceGroup extends Group {
this.configurationUpdates = configurationUpdates;
}
- public List<BundleGroupDeployment> getBundleDeployments() {
- return bundleDeployments;
+ public List<BundleGroupDeployment> getBundleGroupDeployments() {
+ return bundleGroupDeployments;
}
- public void setBundleDeployments(List<BundleGroupDeployment> bundleDeployments) {
- this.bundleDeployments = bundleDeployments;
+ public void setBundleGroupDeployments(List<BundleGroupDeployment> bundleGroupDeployments) {
+ this.bundleGroupDeployments = bundleGroupDeployments;
}
public GroupDefinition getGroupDefinition() {
diff --git a/modules/enterprise/remoting/scripts/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManager.js b/modules/enterprise/remoting/scripts/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManager.js
index 76e3f74..34986f1 100644
--- a/modules/enterprise/remoting/scripts/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManager.js
+++ b/modules/enterprise/remoting/scripts/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManager.js
@@ -26,7 +26,7 @@
* said platform.
*/
-var TestsEnabled = true;
+var TestsEnabled = false;
var bundleName = 'testScriptBundle';
@@ -82,6 +82,51 @@ function testDeployment() {
cleanupTestBundle();
}
+function testGroupDeployment() {
+// if ( !TestsEnabled ) {
+// return;
+// }
+
+ // delete the test bundle if it exists
+ cleanupTestBundle();
+
+ // create the test bundle
+ var testBundle = BundleManager.createBundle( bundleName, bundleName, getBundleType() );
+
+ // define the recipe for bundleVersion 1.0
+ var recipe = "file -s testBundle.war -d <%bundleTest.deployHome%>/group/testBundle.war"
+
+ // create bundleVersion 1.0
+ var testBundleVersion = BundleManager.createBundleVersion( testBundle.getId(), bundleName, bundleName, null, recipe);
+
+ // add the single bundleFile, the test war file
+ var fileBytes = scriptUtil.getFileBytes("./src/test/resources/testBundle.war");
+ var bundleFile = BundleManager.addBundleFileViaByteArray(testBundleVersion.getId(), "testBundle.war",
+ "1.0", null, fileBytes, false);
+
+ // create the config, setting the required properties from the recipe
+ var config = new Configuration();
+ var property = new PropertySimple("bundleTest.deployHome", "/tmp/bundle-test");
+ config.put( property );
+
+ // create a deploy def using the above config
+ var testDeployDef = BundleManager.createBundleDeployDefinition(testBundleVersion.getId(), "Deployment Test", "Deployment Test of testBundle WAR", config, false, -1, false);
+
+ // Find a target platform group
+ var rgc = new ResourceGroupCriteria();
+ rgc.addFilterName("platforms"); // wINdows, lINux
+ var groups = ResourceGroupManager.findResourceGroupsByCriteria(rgc);
+ Assert.assertTrue( groups.size() > 0 );
+ var groupId = groups.get(0).getId();
+
+ var bgd = BundleManager.scheduleBundleGroupDeployment(testDeployDef.getId(), groupId);
+ Assert.assertNotNull( bgd );
+
+ // delete the test bundle if it exists (after allowing agent audit messages to complete)
+ sleep( 5000 );
+ cleanupTestBundle();
+}
+
function getBundleType() {
var types = BundleManager.getAllBundleTypes();
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
index fe4cca4..8d19ad2 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
@@ -458,7 +458,7 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
// The BundleDeployment record must exist in the db before the agent request because the agent may try to
// add History to it during immediate deployments., so create and persist it (requires a new trans).
BundleDeployment deployment = bundleManager.createBundleDeployment(subject, deployDef.getId(), resourceId,
- bundleGroupDeployment.getId());
+ (null == bundleGroupDeployment) ? 0 : bundleGroupDeployment.getId());
// make sure the deployment contains the info required by the schedule service
BundleVersion bundleVersion = entityManager.find(BundleVersion.class, deployDef.getBundleVersion().getId());
@@ -516,10 +516,8 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
}
/*
- * we need to create and persist the group deployment entity in a new transaction before the rest of the
- * processing of this method; if we try to create and attach the deployment children
- * to the parent before this is persisted we'll get StaleStateExceptions
- * from Hibernate because of our use of flush/clear (we're trying to update it before it actually exists)
+ * we need to create the group deployment entity in a new transaction before the rest of the
+ * processing of this method; the individual deployments need to reference it.
*/
BundleGroupDeployment bundleGroupDeployment = new BundleGroupDeployment(subject.getName(), deployDef,
resourceGroup);
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
index c975d38..163e9c6 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
@@ -40,6 +40,7 @@ import org.rhq.core.domain.bundle.BundleDeployDefinition;
import org.rhq.core.domain.bundle.BundleDeployment;
import org.rhq.core.domain.bundle.BundleDeploymentHistory;
import org.rhq.core.domain.bundle.BundleFile;
+import org.rhq.core.domain.bundle.BundleGroupDeployment;
import org.rhq.core.domain.bundle.BundleType;
import org.rhq.core.domain.bundle.BundleVersion;
import org.rhq.core.domain.bundle.composite.BundleWithLatestVersionComposite;
@@ -152,6 +153,13 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
for (Object removeMe : doomed) {
em.remove(em.getReference(BundleFile.class, ((BundleFile) removeMe).getId()));
}
+ // remove any orphaned bgds
+ q = em.createQuery("SELECT bgd FROM BundleGroupDeployment bgd WHERE bgd.bundleDeployDefinition.name LIKE '"
+ + TEST_PREFIX + "%'");
+ doomed = q.getResultList();
+ for (Object removeMe : doomed) {
+ em.remove(em.getReference(BundleGroupDeployment.class, ((BundleGroupDeployment) removeMe).getId()));
+ }
// remove any orphaned bds
q = em.createQuery("SELECT bd FROM BundleDeployment bd WHERE bd.bundleDeployDefinition.name LIKE '"
+ TEST_PREFIX + "%'");
commit 7afbfa9b13b12e4d362c918571a35f88c118b9d9
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Mar 26 03:43:20 2010 -0400
bundle file upload step in wizard works and looks nicer now
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
index 793cd5a..e241771 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
@@ -18,21 +18,22 @@
*/
package org.rhq.enterprise.gui.coregui.client.bundle.create;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.types.VerticalAlignment;
import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.Img;
import com.smartgwt.client.widgets.Label;
-import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.events.FormSubmitFailedEvent;
import com.smartgwt.client.widgets.form.events.FormSubmitFailedHandler;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.components.HeaderLabel;
import org.rhq.enterprise.gui.coregui.client.components.upload.BundleFileUploadForm;
import org.rhq.enterprise.gui.coregui.client.components.upload.DynamicFormHandler;
import org.rhq.enterprise.gui.coregui.client.components.upload.DynamicFormSubmitCompleteEvent;
@@ -45,25 +46,24 @@ public class BundleUploadDataStep implements WizardStep {
private final AbstractBundleCreateWizard wizard;
private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
- private DynamicForm form;
+ private ArrayList<BundleFileUploadForm> uploadForms;
public BundleUploadDataStep(AbstractBundleCreateWizard bundleCreationWizard) {
this.wizard = bundleCreationWizard;
}
public Canvas getCanvas() {
- form = new DynamicForm();
-
- final VLayout layout = new VLayout();
- layout.setMargin(Integer.valueOf(20));
- layout.setAlign(Alignment.CENTER);
+ final VLayout mainLayout = new VLayout();
+ mainLayout.setMargin(Integer.valueOf(20));
+ mainLayout.setWidth100();
+ mainLayout.setHeight(10);
bundleServer.getAllBundleVersionFilenames(this.wizard.getBundleVersion().getId(),
new AsyncCallback<HashMap<String, Boolean>>() {
public void onSuccess(HashMap<String, Boolean> result) {
wizard.setAllBundleFilesStatus(result);
- prepareForm(layout);
+ prepareForm(mainLayout);
}
public void onFailure(Throwable caught) {
@@ -72,8 +72,7 @@ public class BundleUploadDataStep implements WizardStep {
}
});
- form.addChild(layout);
- return form;
+ return mainLayout;
}
public boolean nextPage() {
@@ -88,61 +87,82 @@ public class BundleUploadDataStep implements WizardStep {
if (wizard.getAllBundleFilesStatus() == null) {
return false;
}
+
+ boolean needToUpload = false;
+ for (BundleFileUploadForm uploadForm : this.uploadForms) {
+ if (uploadForm.getUploadResults() == null) {
+ uploadForm.submitForm();
+ needToUpload = true;
+ }
+ }
+ if (needToUpload) {
+ return false;
+ }
+
if (wizard.getAllBundleFilesStatus().containsValue(Boolean.FALSE)) {
return false;
}
return true;
}
- private void prepareForm(VLayout layout) {
+ private void prepareForm(VLayout mainLayout) {
// if there are no files to upload, immediately skip this step
final HashMap<String, Boolean> allFilesStatus = wizard.getAllBundleFilesStatus();
if (allFilesStatus != null && allFilesStatus.size() == 0) {
- // TODO: do something to tell the user they don't have to do anything for this step
+ HeaderLabel label = new HeaderLabel("No files need to be uploaded for this bundle");
+ label.setWidth100();
+ mainLayout.addMember(label);
+ uploadForms = null;
return;
}
- for (Map.Entry<String, Boolean> entry : allFilesStatus.entrySet()) {
- HLayout formLayout = new HLayout();
- layout.addMember(formLayout);
+ uploadForms = new ArrayList<BundleFileUploadForm>();
+ for (Map.Entry<String, Boolean> entry : allFilesStatus.entrySet()) {
String fileToBeUploaded = entry.getKey();
Boolean isAlreadyUploaded = entry.getValue();
- if (isAlreadyUploaded) {
- Label nameLabel = new Label(fileToBeUploaded + ": ");
- formLayout.addMember(nameLabel);
- Img img = new Img("/images/icons/availability_green_16.png", 16, 16);
- formLayout.addMember(img);
- } else {
- final BundleFileUploadForm uploadForm = new BundleFileUploadForm(this.wizard.getBundleVersion(),
- fileToBeUploaded);
- uploadForm.addFormHandler(new DynamicFormHandler() {
- public void onSubmitComplete(DynamicFormSubmitCompleteEvent event) {
- String results = event.getResults();
- if (!results.contains("Failed to upload bundle file")) {
- uploadForm.retrievalStatus(true);
- allFilesStatus.put(uploadForm.getName(), Boolean.TRUE);
- } else {
- uploadForm.retrievalStatus(false);
- allFilesStatus.put(uploadForm.getName(), Boolean.FALSE);
- CoreGUI.getMessageCenter().notify(
- new Message("Failed to upload bundle file", results, Message.Severity.Error));
- }
- }
- });
- uploadForm.addFormSubmitFailedHandler(new FormSubmitFailedHandler() {
- public void onFormSubmitFailed(FormSubmitFailedEvent event) {
- uploadForm.retrievalStatus(false);
+ HLayout indivLayout = new HLayout();
+ indivLayout.setWidth100();
+ indivLayout.setAutoHeight();
+
+ Label nameLabel = new Label(fileToBeUploaded + ": ");
+ nameLabel.setWidth("*");
+ nameLabel.setAlign(Alignment.RIGHT);
+ nameLabel.setLayoutAlign(VerticalAlignment.CENTER);
+ indivLayout.addMember(nameLabel);
+
+ final BundleFileUploadForm uploadForm = new BundleFileUploadForm(this.wizard.getBundleVersion(),
+ fileToBeUploaded, false, (isAlreadyUploaded) ? Boolean.TRUE : null);
+ uploadForm.setWidth("75%");
+ indivLayout.addMember(uploadForm);
+
+ uploadForm.addFormHandler(new DynamicFormHandler() {
+ public void onSubmitComplete(DynamicFormSubmitCompleteEvent event) {
+ String results = event.getResults();
+ if (!results.contains("Failed to upload bundle file")) {
+ allFilesStatus.put(uploadForm.getName(), Boolean.TRUE);
+ } else {
allFilesStatus.put(uploadForm.getName(), Boolean.FALSE);
CoreGUI.getMessageCenter().notify(
- new Message("Failed to upload file", null, Message.Severity.Error));
+ new Message("Failed to upload bundle file", results, Message.Severity.Error));
}
- });
+ }
+ });
+ uploadForm.addFormSubmitFailedHandler(new FormSubmitFailedHandler() {
+ public void onFormSubmitFailed(FormSubmitFailedEvent event) {
+ allFilesStatus.put(uploadForm.getName(), Boolean.FALSE);
+ CoreGUI.getMessageCenter().notify(
+ new Message("Failed to upload file", null, Message.Severity.Error));
+ }
+ });
- formLayout.addMember(uploadForm);
- }
+ uploadForms.add(uploadForm);
+
+ mainLayout.addMember(indivLayout);
}
+
+ return;
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleFileUploadForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleFileUploadForm.java
index a0c6add..6f18f04 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleFileUploadForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleFileUploadForm.java
@@ -20,9 +20,12 @@ package org.rhq.enterprise.gui.coregui.client.components.upload;
import com.google.gwt.core.client.GWT;
import com.smartgwt.client.types.Encoding;
+import com.smartgwt.client.widgets.form.events.FormSubmitFailedEvent;
+import com.smartgwt.client.widgets.form.events.FormSubmitFailedHandler;
import com.smartgwt.client.widgets.form.fields.ButtonItem;
import com.smartgwt.client.widgets.form.fields.FormItemIcon;
import com.smartgwt.client.widgets.form.fields.HiddenItem;
+import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.form.fields.UploadItem;
import com.smartgwt.client.widgets.form.fields.events.ChangeEvent;
import com.smartgwt.client.widgets.form.fields.events.ChangeHandler;
@@ -36,18 +39,25 @@ import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
public class BundleFileUploadForm extends DynamicCallbackForm {
- private ButtonItem uploadButton;
private UploadItem bundleUploadItem;
+ private ButtonItem uploadButton;
+ private StaticTextItem icon;
+
+ private Boolean uploadResults;
- private BundleVersion bundleVersion;
- private String name;
+ private final BundleVersion bundleVersion;
+ private final String name;
+ private final boolean showNameLabel;
+
+ public BundleFileUploadForm(BundleVersion bundleVersion, String name, boolean showNameLabel,
+ Boolean isAlreadyUploaded) {
- public BundleFileUploadForm(BundleVersion bundleVersion, String name) {
super(name);
this.bundleVersion = bundleVersion;
this.name = name;
+ this.showNameLabel = showNameLabel;
+ this.uploadResults = isAlreadyUploaded; // null if unknown, false if error during previous upload attempt, true if already uploaded before
- setNumCols(8);
setEncoding(Encoding.MULTIPART);
setAction(GWT.getModuleBaseURL() + "/BundleFileUploadServlet");
}
@@ -65,6 +75,23 @@ public class BundleFileUploadForm extends DynamicCallbackForm {
return name;
}
+ /**
+ * Returns true if the file was successfully uploaded, false if an error occurred.
+ * Returns null if this upload form has not be submitted yet (see {@link #submitForm()}).
+ * @return status of the upload request
+ */
+ public Boolean getUploadResults() {
+ return uploadResults;
+ }
+
+ @Override
+ public void submitForm() {
+ icon.setShowIcons(true);
+ uploadButton.setDisabled(true);
+ markForRedraw();
+ super.submitForm();
+ }
+
@Override
protected void onDraw() {
super.onDraw();
@@ -81,58 +108,91 @@ public class BundleFileUploadForm extends DynamicCallbackForm {
HiddenItem versionField = new HiddenItem("version");
versionField.setValue("1.0");
- setNumCols(4);
+ setNumCols(7);
- bundleUploadItem = new UploadItem("bundleFile", name);
+ bundleUploadItem = new UploadItem("bundleFileUploadItem", name);
bundleUploadItem.setEndRow(false);
+ bundleUploadItem.setShowTitle(showNameLabel);
uploadButton = new ButtonItem("Upload");
uploadButton.setStartRow(false);
+ uploadButton.setEndRow(false);
uploadButton.setDisabled(true);
-
- bundleUploadItem.addChangeHandler(new ChangeHandler() {
- public void onChange(ChangeEvent changeEvent) {
- uploadButton.setDisabled(false);
- }
- });
-
uploadButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
- uploadButton.setShowIcons(true);
- markForRedraw();
submitForm();
}
});
+ icon = new StaticTextItem("icon");
+ icon.setStartRow(false);
+ icon.setShowTitle(false);
+
FormItemIcon loadingIcon = new FormItemIcon();
loadingIcon.setSrc("ajax-loader.gif");
loadingIcon.setWidth(16);
loadingIcon.setHeight(16);
- uploadButton.setIcons(loadingIcon);
- uploadButton.setShowIcons(false);
+ icon.setIcons(loadingIcon);
+ icon.setShowIcons(false);
+
+ bundleUploadItem.addChangeHandler(new ChangeHandler() {
+ public void onChange(ChangeEvent changeEvent) {
+ if (uploadResults != null) {
+ retrievalStatus(uploadResults.booleanValue());
+ } else {
+ uploadButton.setDisabled(false);
+ icon.setShowIcons(false);
+ }
+ }
+ });
+
+ if (uploadResults != null) {
+ retrievalStatus(uploadResults.booleanValue());
+ }
- setItems(sessionIdField, bundleVersionIdField, nameField, versionField, bundleUploadItem, uploadButton);
+ setItems(sessionIdField, bundleVersionIdField, nameField, versionField, bundleUploadItem, uploadButton, icon);
+
+ addFormHandler(new DynamicFormHandler() {
+ public void onSubmitComplete(DynamicFormSubmitCompleteEvent event) {
+ String results = event.getResults();
+ if (!results.contains("Failed to upload bundle file")) {
+ CoreGUI.getMessageCenter().notify(new Message("Uploaded bundle file successfully", Severity.Info));
+ retrievalStatus(true);
+ } else {
+ CoreGUI.getMessageCenter().notify(new Message("Bundle file upload failed", Severity.Error));
+ retrievalStatus(false);
+ }
+ }
+ });
+
+ addFormSubmitFailedHandler(new FormSubmitFailedHandler() {
+ public void onFormSubmitFailed(FormSubmitFailedEvent event) {
+ CoreGUI.getMessageCenter().notify(new Message("Bundle file upload failed", Severity.Error));
+ retrievalStatus(false);
+ }
+ });
}
/**
- * Call this when the file retrieval finished. <code>true</code> means successful,
+ * Call this when the last file retrieval status is known. <code>true</code> means successful,
* <code>false</code> means an error occurred.
* @param ok status
*/
- public void retrievalStatus(boolean ok) {
+ private void retrievalStatus(boolean ok) {
+ uploadResults = Boolean.valueOf(ok);
+
if (uploadButton != null) {
FormItemIcon loadedIcon = new FormItemIcon();
if (ok) {
loadedIcon.setSrc("/images/icons/availability_green_16.png");
- CoreGUI.getMessageCenter().notify(new Message("Uploaded bundle file successfully", Severity.Info));
} else {
loadedIcon.setSrc("/images/icons/availability_red_16.png");
- CoreGUI.getMessageCenter().notify(new Message("Bundle file upload failed", Severity.Error));
}
loadedIcon.setWidth(16);
loadedIcon.setHeight(16);
- uploadButton.setIcons(loadedIcon);
- uploadButton.setShowIcons(true);
+ icon.setIcons(loadedIcon);
+ icon.setShowIcons(true);
+ uploadButton.setDisabled(uploadResults);
}
}
}
commit 22bafe51d32a5f7ccacb0d5523c30b7b5ac2516c
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Mar 25 17:05:43 2010 -0400
fix summary tab view
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
index 7a483e6..4d7575e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
@@ -23,8 +23,8 @@ import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.Label;
-import com.smartgwt.client.widgets.layout.HLayout;
-import com.smartgwt.client.widgets.layout.LayoutSpacer;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.tab.Tab;
import com.smartgwt.client.widgets.tab.TabSet;
@@ -39,8 +39,8 @@ public class BundleView extends VLayout {
private Label message = new Label("Select a bundle...");
private VLayout canvas;
private HeaderLabel headerLabel;
- private Label descriptionValue;
- private Label latestVersionValue;
+ private StaticTextItem descriptionItem;
+ private StaticTextItem latestVersionItem;
public BundleView() {
super();
@@ -87,42 +87,24 @@ public class BundleView extends VLayout {
private Tab createSummaryTab() {
Tab summaryTab = new Tab("Summary");
- VLayout top = new VLayout();
- top.setAutoHeight();
- top.setPadding(20);
- top.setWidth100();
-
- HLayout descriptionBox = new HLayout();
- descriptionBox.setWidth100();
- descriptionBox.setExtraSpace(10);
- Label descriptionLabel = new Label("Description:");
- descriptionLabel.setWidth("10%");
- descriptionLabel.setAlign(Alignment.LEFT);
- descriptionLabel.setWrap(false);
- descriptionValue = new Label("");
- descriptionValue.setWidth("90%");
- descriptionValue.setAlign(Alignment.LEFT);
- descriptionBox.addMember(descriptionLabel);
- descriptionBox.addMember(descriptionValue);
- top.addMember(descriptionBox);
- top.addMember(new LayoutSpacer());
-
- HLayout versionBox = new HLayout();
- versionBox.setWidth100();
- versionBox.setExtraSpace(10);
- Label versionLabel = new Label("Latest Version:");
- versionLabel.setWidth("10%");
- versionLabel.setAlign(Alignment.LEFT);
- versionLabel.setWrap(false);
- latestVersionValue = new Label("");
- latestVersionValue.setWidth("90%");
- latestVersionValue.setAlign(Alignment.LEFT);
- versionBox.addMember(versionLabel);
- versionBox.addMember(latestVersionValue);
- top.addMember(versionBox);
- top.addMember(new LayoutSpacer());
-
- summaryTab.setPane(top);
+ DynamicForm form = new DynamicForm();
+ form.setPadding(10);
+
+ descriptionItem = new StaticTextItem("description", "Description");
+ descriptionItem.setTitleAlign(Alignment.LEFT);
+ descriptionItem.setAlign(Alignment.LEFT);
+ descriptionItem.setWrap(false);
+ descriptionItem.setValue("");
+
+ latestVersionItem = new StaticTextItem("latestVersion", "Latest Version");
+ latestVersionItem.setTitleAlign(Alignment.LEFT);
+ latestVersionItem.setAlign(Alignment.LEFT);
+ latestVersionItem.setWrap(false);
+ latestVersionItem.setValue("");
+
+ form.setFields(descriptionItem, latestVersionItem);
+ summaryTab.setPane(form);
+
return summaryTab;
}
@@ -132,8 +114,8 @@ public class BundleView extends VLayout {
if (bundleBeingViewed != object.getBundleId()) {
headerLabel.setContents(object.getBundleName());
- latestVersionValue.setContents(object.getLatestVersion());
- descriptionValue.setContents(object.getBundleDescription());
+ latestVersionItem.setValue(object.getLatestVersion());
+ descriptionItem.setValue(object.getBundleDescription());
}
try {
commit b8614fbcfe231944e59e9d1be8dde1274ec879c3
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Mar 25 16:57:23 2010 -0400
i think i finally got the summary page to look like its supposed to now
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleSummaryStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleSummaryStep.java
index 3822718..ffa143a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleSummaryStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleSummaryStep.java
@@ -21,10 +21,8 @@ package org.rhq.enterprise.gui.coregui.client.bundle.create;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.VerticalAlignment;
import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.Label;
-import com.smartgwt.client.widgets.layout.HLayout;
-import com.smartgwt.client.widgets.layout.LayoutSpacer;
-import com.smartgwt.client.widgets.layout.VLayout;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
@@ -41,94 +39,48 @@ public class BundleSummaryStep implements WizardStep {
public Canvas getCanvas() {
- VLayout top = new VLayout();
- top.setAutoHeight();
- top.setPadding(20);
- top.setWidth100();
+ DynamicForm form = new DynamicForm();
+ form.setNumCols(2);
- HLayout bundleTypeBox = new HLayout();
- bundleTypeBox.setWidth100();
- bundleTypeBox.setExtraSpace(10);
- Label bundleTypeLabel = new Label("Type:");
- bundleTypeLabel.setWidth("10%");
+ StaticTextItem bundleTypeLabel = new StaticTextItem("bundleType", "Type");
+ bundleTypeLabel.setTitleAlign(Alignment.LEFT);
bundleTypeLabel.setAlign(Alignment.LEFT);
bundleTypeLabel.setWrap(false);
- Label bundleTypeValue = new Label(wizard.getBundleType().getName());
- bundleTypeValue.setWidth("90%");
- bundleTypeValue.setAlign(Alignment.LEFT);
- bundleTypeBox.addMember(bundleTypeLabel);
- bundleTypeBox.addMember(bundleTypeValue);
- top.addMember(bundleTypeBox);
-
- HLayout nameBox = new HLayout();
- nameBox.setWidth100();
- nameBox.setExtraSpace(10);
- Label nameLabel = new Label("Name:");
- nameLabel.setWidth("10%");
+ bundleTypeLabel.setValue(wizard.getBundleType().getName());
+
+ StaticTextItem nameLabel = new StaticTextItem("name", "Name");
+ nameLabel.setTitleAlign(Alignment.LEFT);
nameLabel.setAlign(Alignment.LEFT);
nameLabel.setWrap(false);
- Label nameValue = new Label(wizard.getBundleName());
- nameValue.setWidth("90%");
- nameValue.setAlign(Alignment.LEFT);
- nameBox.addMember(nameLabel);
- nameBox.addMember(nameValue);
- top.addMember(nameBox);
- top.addMember(new LayoutSpacer());
-
- HLayout versionBox = new HLayout();
- versionBox.setWidth100();
- versionBox.setExtraSpace(10);
- Label versionLabel = new Label("Version:");
- versionLabel.setWidth("10%");
+ nameLabel.setValue(wizard.getBundleName());
+
+ StaticTextItem versionLabel = new StaticTextItem("Version");
+ versionLabel.setTitleAlign(Alignment.LEFT);
+ versionLabel.setTitleAlign(Alignment.LEFT);
versionLabel.setAlign(Alignment.LEFT);
versionLabel.setWrap(false);
- Label versionValue = new Label(wizard.getBundleVersionString());
- versionValue.setWidth("90%");
- versionValue.setAlign(Alignment.LEFT);
- versionBox.addMember(versionLabel);
- versionBox.addMember(versionValue);
- top.addMember(versionBox);
- top.addMember(new LayoutSpacer());
-
- HLayout descriptionBox = new HLayout();
- descriptionBox.setWidth100();
- descriptionBox.setExtraSpace(10);
- Label descriptionLabel = new Label("Description:");
- descriptionLabel.setWidth("10%");
+ versionLabel.setValue(wizard.getBundleVersionString());
+
+ StaticTextItem descriptionLabel = new StaticTextItem("Description");
+ descriptionLabel.setTitleAlign(Alignment.LEFT);
descriptionLabel.setAlign(Alignment.LEFT);
descriptionLabel.setWrap(false);
- Label descriptionValue = new Label(wizard.getBundleDescription());
- descriptionValue.setWidth("90%");
- descriptionValue.setAlign(Alignment.LEFT);
- descriptionBox.addMember(descriptionLabel);
- descriptionBox.addMember(descriptionValue);
- top.addMember(descriptionBox);
- top.addMember(new LayoutSpacer());
-
- HLayout filesBox = new HLayout();
- filesBox.setWidth100();
- filesBox.setExtraSpace(10);
- Label filesLabel = new Label("Files:");
- filesLabel.setWidth("10%");
+ descriptionLabel.setValue(wizard.getBundleDescription());
+
+ StaticTextItem filesLabel = new StaticTextItem("Files");
+ filesLabel.setTitleVAlign(VerticalAlignment.TOP);
+ filesLabel.setTitleAlign(Alignment.LEFT);
filesLabel.setAlign(Alignment.LEFT);
- filesLabel.setValign(VerticalAlignment.TOP);
filesLabel.setWrap(false);
- VLayout filesValues = new VLayout();
- filesValues.setWidth("90%");
- filesValues.setAutoHeight();
+ StringBuilder filesValueStr = new StringBuilder();
for (String filename : wizard.getAllBundleFilesStatus().keySet()) {
- Label fileNameValue = new Label(filename);
- fileNameValue.setAlign(Alignment.LEFT);
- fileNameValue.setValign(VerticalAlignment.TOP);
- fileNameValue.setWrap(false);
- fileNameValue.setHeight(10);
- filesValues.addMember(fileNameValue);
+ filesValueStr.append(filename + "<br/>\n");
}
- filesBox.addMember(filesLabel);
- filesBox.addMember(filesValues);
- top.addMember(filesBox);
+ filesLabel.setValue(filesValueStr.toString());
+
+ form.setFields(bundleTypeLabel, nameLabel, versionLabel, descriptionLabel, filesLabel);
- return top;
+ return form;
}
public boolean nextPage() {
commit f68be0be9b6e91823b44ebd2b3bf84310592c21b
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Mar 25 16:04:17 2010 -0400
get the summary page's list of files to look right
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleSummaryStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleSummaryStep.java
index 45002c1..3822718 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleSummaryStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleSummaryStep.java
@@ -19,6 +19,7 @@
package org.rhq.enterprise.gui.coregui.client.bundle.create;
import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.types.VerticalAlignment;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.layout.HLayout;
@@ -110,6 +111,7 @@ public class BundleSummaryStep implements WizardStep {
Label filesLabel = new Label("Files:");
filesLabel.setWidth("10%");
filesLabel.setAlign(Alignment.LEFT);
+ filesLabel.setValign(VerticalAlignment.TOP);
filesLabel.setWrap(false);
VLayout filesValues = new VLayout();
filesValues.setWidth("90%");
@@ -117,7 +119,9 @@ public class BundleSummaryStep implements WizardStep {
for (String filename : wizard.getAllBundleFilesStatus().keySet()) {
Label fileNameValue = new Label(filename);
fileNameValue.setAlign(Alignment.LEFT);
+ fileNameValue.setValign(VerticalAlignment.TOP);
fileNameValue.setWrap(false);
+ fileNameValue.setHeight(10);
filesValues.addMember(fileNameValue);
}
filesBox.addMember(filesLabel);
commit 45b2d2862527df40a6480432d3f8c6ca4a21a45c
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Mar 25 12:32:38 2010 -0400
forgot to pass in the name in the log message
diff --git a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/PluginUpdate.java b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/PluginUpdate.java
index 5e812c2..bf2fef0 100644
--- a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/PluginUpdate.java
+++ b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/PluginUpdate.java
@@ -315,7 +315,7 @@ public class PluginUpdate {
}
}
}
- LOG.info(AgentI18NResourceKeys.DOWNLOADING_PLUGIN_COMPLETE, plugin.getPath());
+ LOG.info(AgentI18NResourceKeys.DOWNLOADING_PLUGIN_COMPLETE, plugin.getName(), plugin.getPath());
}
/**
commit f587e2c89652e7445eba5debeaba33f8a12d0900
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 24 17:35:40 2010 -0400
add start of the "bundle" view at the bottom of bundle list
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleSummaryStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleSummaryStep.java
index a0c565b..45002c1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleSummaryStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleSummaryStep.java
@@ -18,9 +18,9 @@
*/
package org.rhq.enterprise.gui.coregui.client.bundle.create;
-import com.google.gwt.user.client.ui.HasHorizontalAlignment;
-import com.google.gwt.user.client.ui.Label;
+import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.LayoutSpacer;
import com.smartgwt.client.widgets.layout.VLayout;
@@ -50,11 +50,11 @@ public class BundleSummaryStep implements WizardStep {
bundleTypeBox.setExtraSpace(10);
Label bundleTypeLabel = new Label("Type:");
bundleTypeLabel.setWidth("10%");
- bundleTypeLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
- bundleTypeLabel.setWordWrap(false);
+ bundleTypeLabel.setAlign(Alignment.LEFT);
+ bundleTypeLabel.setWrap(false);
Label bundleTypeValue = new Label(wizard.getBundleType().getName());
bundleTypeValue.setWidth("90%");
- bundleTypeValue.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
+ bundleTypeValue.setAlign(Alignment.LEFT);
bundleTypeBox.addMember(bundleTypeLabel);
bundleTypeBox.addMember(bundleTypeValue);
top.addMember(bundleTypeBox);
@@ -64,11 +64,11 @@ public class BundleSummaryStep implements WizardStep {
nameBox.setExtraSpace(10);
Label nameLabel = new Label("Name:");
nameLabel.setWidth("10%");
- nameLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
- nameLabel.setWordWrap(false);
+ nameLabel.setAlign(Alignment.LEFT);
+ nameLabel.setWrap(false);
Label nameValue = new Label(wizard.getBundleName());
nameValue.setWidth("90%");
- nameValue.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
+ nameValue.setAlign(Alignment.LEFT);
nameBox.addMember(nameLabel);
nameBox.addMember(nameValue);
top.addMember(nameBox);
@@ -79,11 +79,11 @@ public class BundleSummaryStep implements WizardStep {
versionBox.setExtraSpace(10);
Label versionLabel = new Label("Version:");
versionLabel.setWidth("10%");
- versionLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
- versionLabel.setWordWrap(false);
+ versionLabel.setAlign(Alignment.LEFT);
+ versionLabel.setWrap(false);
Label versionValue = new Label(wizard.getBundleVersionString());
versionValue.setWidth("90%");
- versionValue.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
+ versionValue.setAlign(Alignment.LEFT);
versionBox.addMember(versionLabel);
versionBox.addMember(versionValue);
top.addMember(versionBox);
@@ -94,11 +94,11 @@ public class BundleSummaryStep implements WizardStep {
descriptionBox.setExtraSpace(10);
Label descriptionLabel = new Label("Description:");
descriptionLabel.setWidth("10%");
- descriptionLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
- descriptionLabel.setWordWrap(false);
+ descriptionLabel.setAlign(Alignment.LEFT);
+ descriptionLabel.setWrap(false);
Label descriptionValue = new Label(wizard.getBundleDescription());
descriptionValue.setWidth("90%");
- descriptionValue.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
+ descriptionValue.setAlign(Alignment.LEFT);
descriptionBox.addMember(descriptionLabel);
descriptionBox.addMember(descriptionValue);
top.addMember(descriptionBox);
@@ -109,15 +109,15 @@ public class BundleSummaryStep implements WizardStep {
filesBox.setExtraSpace(10);
Label filesLabel = new Label("Files:");
filesLabel.setWidth("10%");
- filesLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
- filesLabel.setWordWrap(false);
+ filesLabel.setAlign(Alignment.LEFT);
+ filesLabel.setWrap(false);
VLayout filesValues = new VLayout();
filesValues.setWidth("90%");
filesValues.setAutoHeight();
for (String filename : wizard.getAllBundleFilesStatus().keySet()) {
Label fileNameValue = new Label(filename);
- fileNameValue.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
- fileNameValue.setWordWrap(false);
+ fileNameValue.setAlign(Alignment.LEFT);
+ fileNameValue.setWrap(false);
filesValues.addMember(fileNameValue);
}
filesBox.addMember(filesLabel);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
new file mode 100644
index 0000000..7a483e6
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
@@ -0,0 +1,153 @@
+/*
+ * 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.bundle.list;
+
+import com.smartgwt.client.data.Record;
+import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.types.Overflow;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.Label;
+import com.smartgwt.client.widgets.layout.HLayout;
+import com.smartgwt.client.widgets.layout.LayoutSpacer;
+import com.smartgwt.client.widgets.layout.VLayout;
+import com.smartgwt.client.widgets.tab.Tab;
+import com.smartgwt.client.widgets.tab.TabSet;
+
+import org.rhq.core.domain.bundle.composite.BundleWithLatestVersionComposite;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.components.HeaderLabel;
+
+public class BundleView extends VLayout {
+
+ private int bundleBeingViewed = 0;
+ private Label message = new Label("Select a bundle...");
+ private VLayout canvas;
+ private HeaderLabel headerLabel;
+ private Label descriptionValue;
+ private Label latestVersionValue;
+
+ public BundleView() {
+ super();
+ setPadding(10);
+ setOverflow(Overflow.AUTO);
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+ addMember(message);
+ addMember(buildCanvas());
+ canvas.hide();
+ }
+
+ private Canvas buildCanvas() {
+ canvas = new VLayout();
+
+ headerLabel = new HeaderLabel("<bundle name>");
+
+ TabSet tabs = new TabSet();
+ Tab summaryTab = createSummaryTab();
+ tabs.addTab(summaryTab);
+
+ Tab versionsTab = createVersionsTab();
+ tabs.addTab(versionsTab);
+
+ Tab deploymentsTab = createDeploymentsTab();
+ tabs.addTab(deploymentsTab);
+
+ canvas.addMember(headerLabel);
+ canvas.addMember(tabs);
+ return canvas;
+ }
+
+ private Tab createDeploymentsTab() {
+ return new Tab("Deployments");
+ }
+
+ private Tab createVersionsTab() {
+ return new Tab("Versions");
+ }
+
+ private Tab createSummaryTab() {
+ Tab summaryTab = new Tab("Summary");
+
+ VLayout top = new VLayout();
+ top.setAutoHeight();
+ top.setPadding(20);
+ top.setWidth100();
+
+ HLayout descriptionBox = new HLayout();
+ descriptionBox.setWidth100();
+ descriptionBox.setExtraSpace(10);
+ Label descriptionLabel = new Label("Description:");
+ descriptionLabel.setWidth("10%");
+ descriptionLabel.setAlign(Alignment.LEFT);
+ descriptionLabel.setWrap(false);
+ descriptionValue = new Label("");
+ descriptionValue.setWidth("90%");
+ descriptionValue.setAlign(Alignment.LEFT);
+ descriptionBox.addMember(descriptionLabel);
+ descriptionBox.addMember(descriptionValue);
+ top.addMember(descriptionBox);
+ top.addMember(new LayoutSpacer());
+
+ HLayout versionBox = new HLayout();
+ versionBox.setWidth100();
+ versionBox.setExtraSpace(10);
+ Label versionLabel = new Label("Latest Version:");
+ versionLabel.setWidth("10%");
+ versionLabel.setAlign(Alignment.LEFT);
+ versionLabel.setWrap(false);
+ latestVersionValue = new Label("");
+ latestVersionValue.setWidth("90%");
+ latestVersionValue.setAlign(Alignment.LEFT);
+ versionBox.addMember(versionLabel);
+ versionBox.addMember(latestVersionValue);
+ top.addMember(versionBox);
+ top.addMember(new LayoutSpacer());
+
+ summaryTab.setPane(top);
+ return summaryTab;
+ }
+
+ public void viewRecord(Record record) {
+ final BundleWithLatestVersionComposite object;
+ object = (BundleWithLatestVersionComposite) record.getAttributeAsObject("object");
+
+ if (bundleBeingViewed != object.getBundleId()) {
+ headerLabel.setContents(object.getBundleName());
+ latestVersionValue.setContents(object.getLatestVersion());
+ descriptionValue.setContents(object.getBundleDescription());
+ }
+
+ try {
+ message.hide();
+ canvas.show();
+ markForRedraw();
+ } catch (Throwable t) {
+ CoreGUI.getErrorHandler().handleError("Cannot view bundle record", t);
+ }
+ }
+
+ public void viewNone() {
+ message.show();
+ canvas.hide();
+ markForRedraw();
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
index e3c4c0f..21b04bf 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
@@ -19,9 +19,12 @@
package org.rhq.enterprise.gui.coregui.client.bundle.list;
import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.types.SelectionAppearance;
import com.smartgwt.client.types.SelectionStyle;
import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
+import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.bundle.Bundle;
@@ -51,6 +54,9 @@ public class BundlesListView extends VLayout {
super.onDraw();
final Table table = new Table("Bundles");
+ table.setHeight("50%");
+ table.setShowResizeBar(true);
+ table.setResizeBarTarget("next");
table.setDataSource(new BundlesWithLatestVersionDataSource());
@@ -147,5 +153,15 @@ public class BundlesListView extends VLayout {
});
addMember(table);
+
+ final BundleView bundleView = new BundleView();
+ bundleView.setOverflow(Overflow.AUTO);
+ addMember(bundleView);
+
+ table.getListGrid().addRecordClickHandler(new RecordClickHandler() {
+ public void onRecordClick(RecordClickEvent event) {
+ bundleView.viewRecord(event.getRecord());
+ }
+ });
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleFileUploadForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleFileUploadForm.java
index d67e38d..a0c6add 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleFileUploadForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleFileUploadForm.java
@@ -78,6 +78,9 @@ public class BundleFileUploadForm extends DynamicCallbackForm {
HiddenItem nameField = new HiddenItem("name");
nameField.setValue(this.name);
+ HiddenItem versionField = new HiddenItem("version");
+ versionField.setValue("1.0");
+
setNumCols(4);
bundleUploadItem = new UploadItem("bundleFile", name);
@@ -108,7 +111,7 @@ public class BundleFileUploadForm extends DynamicCallbackForm {
uploadButton.setIcons(loadingIcon);
uploadButton.setShowIcons(false);
- setItems(sessionIdField, bundleVersionIdField, nameField, bundleUploadItem, uploadButton);
+ setItems(sessionIdField, bundleVersionIdField, nameField, versionField, bundleUploadItem, uploadButton);
}
/**
commit 7ef0eb7296676fd02a713d327b16413f8be9cb3f
Merge: b58b413... c319887...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 24 16:30:37 2010 -0400
Merge branch 'gwt' into gwt-jay
commit c3198879d399d8edbb9e6a8879d84855d7c35780
Merge: d3e8405... 99ac8e8...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 24 16:30:08 2010 -0400
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
commit b58b413fbaa08657c3df2127e085aa3ee0f438f2
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 24 16:29:30 2010 -0400
Work on infra for bundle group deploy
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml b/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
index 178013b..309c3cb 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
@@ -576,8 +576,7 @@
<column name="BUNDLE_DEPLOY_DEF_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DEPLOY_DEF" />
<column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE" />
<column name="CTIME" type="LONG" required="true"/>
- <!-- for group history -->
- <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_RESOURCE_GROUP"/>
+ <column name="BUNDLE_GROUP_DEPLOY_ID" type="INTEGER" required="false" references="RHQ_BUNDLE_GROUP_DEPLOY"/>
<index name="RHQ_DEPLOY_DEF_RESOURCE_IDX" unique="true">
<field ref="BUNDLE_DEPLOY_DEF_ID"/>
@@ -585,6 +584,17 @@
</index>
</table>
+ <table name="RHQ_BUNDLE_GROUP_DEPLOY">
+ <column name="ID" type="INTEGER" required="true" default="sequence-only" initial="10001" primarykey="true"/>
+ <column name="GROUP_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_GROUP"/>
+ <column name="BUNDLE_DEPLOY_DEF_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DEPLOY_DEF" />
+ <column name="STATUS" type="VARCHAR2" required="true" size="16"/>
+ <column name="ERROR_MESSAGE" type="LONGVARCHAR" required="false"/>
+ <column name="SUBJECT_NAME" type="VARCHAR2" required="true" size="255"/>
+ <column name="CTIME" type="LONG" required="true"/>
+ <column name="MTIME" type="LONG" required="true"/>
+ </table>
+
<table name="RHQ_BUNDLE_DEPLOY_HIST">
<column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/>
<column name="BUNDLE_DEPLOY_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DEPLOY" />
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 da47976..18db292 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -2819,7 +2819,7 @@
<!-- RHQ_BUNDLE_DEPLOY_HIST -->
<schema-directSQL>
<statement desc="Creating table RHQ_BUNDLE_DEPLOY_HIST">
- CREATE TABLE RHQ_BUNDLE_DEPLOY_HIST ( ID INTEGER )
+ CREATE TABLE RHQ_BUNDLE_DEPLOY_HIST ( ID INTEGER PRIMARY KEY )
</statement>
</schema-directSQL>
<schema-alterColumn table="RHQ_BUNDLE_DEPLOY_HIST" column="ID" nullable="FALSE" />
@@ -2899,7 +2899,50 @@
</schemaSpec>
<schemaSpec version="2.78.5">
- <schema-addColumn table="RHQ_BUNDLE_DEPLOY" column="RESOURCE_GROUP_ID" columnType="INTEGER" />
+ <!-- RHQ_BUNDLE_GROUP_DEPLOY -->
+ <schema-directSQL>
+ <statement desc="Creating table RHQ_BUNDLE_GROUP_DEPLOY">
+ CREATE TABLE RHQ_BUNDLE_GROUP_DEPLOY ( ID INTEGER PRIMARY KEY )
+ </statement>
+ </schema-directSQL>
+ <schema-alterColumn table="RHQ_BUNDLE_GROUP_DEPLOY" column="ID" nullable="FALSE" />
+ <schema-addColumn table="RHQ_BUNDLE_GROUP_DEPLOY" column="GROUP_ID" columnType="INTEGER" />
+ <schema-alterColumn table="RHQ_BUNDLE_GROUP_DEPLOY" column="GROUP_ID" nullable="FALSE" />
+ <schema-addColumn table="RHQ_BUNDLE_GROUP_DEPLOY" column="BUNDLE_DEPLOY_DEF_ID" columnType="INTEGER" />
+ <schema-alterColumn table="RHQ_BUNDLE_GROUP_DEPLOY" column="BUNDLE_DEPLOY_DEF_ID" nullable="FALSE" />
+ <schema-addColumn table="RHQ_BUNDLE_GROUP_DEPLOY" column="STATUS" columnType="VARCHAR2" precision="16" />
+ <schema-alterColumn table="RHQ_BUNDLE_GROUP_DEPLOY" column="STATUS" nullable="FALSE" />
+ <schema-addColumn table="RHQ_BUNDLE_GROUP_DEPLOY" column="ERROR_MESSAGE" columnType="LONGVARCHAR" />
+ <schema-addColumn table="RHQ_BUNDLE_GROUP_DEPLOY" column="SUBJECT_NAME" columnType="VARCHAR2" precision="255" />
+ <schema-alterColumn table="RHQ_BUNDLE_GROUP_DEPLOY" column="SUBJECT_NAME" nullable="FALSE" />
+ <schema-addColumn table="RHQ_BUNDLE_GROUP_DEPLOY" column="CTIME" columnType="LONG" />
+ <schema-alterColumn table="RHQ_BUNDLE_GROUP_DEPLOY" column="CTIME" nullable="FALSE" />
+ <schema-addColumn table="RHQ_BUNDLE_GROUP_DEPLOY" column="MTIME" columnType="LONG" />
+ <schema-alterColumn table="RHQ_BUNDLE_GROUP_DEPLOY" column="MTIME" nullable="FALSE" />
+ <schema-directSQL>
+ <statement desc="Creating RHQ_BUNDLE_GROUP_DEPLOY foreign key relation to RHQ_RESOURCE_GROUP">
+ ALTER TABLE RHQ_BUNDLE_GROUP_DEPLOY
+ ADD CONSTRAINT RHQ_RESOURCE_GROUP_FK
+ FOREIGN KEY (GROUP_ID)
+ REFERENCES RHQ_RESOURCE_GROUP (ID)
+ </statement>
+ <statement desc="Creating RHQ_BUNDLE_GROUP_DEPLOY foreign key relation to RHQ_BUNDLE_DEPLOY_DEF">
+ ALTER TABLE RHQ_BUNDLE_GROUP_DEPLOY
+ ADD CONSTRAINT RHQ_BUNDLE_DEPLOY_DEF_FK
+ FOREIGN KEY (BUNDLE_DEPLOY_DEF_ID)
+ REFERENCES RHQ_BUNDLE_DEPLOY_DEF (ID)
+ </statement>
+ </schema-directSQL>
+
+ <schema-addColumn table="RHQ_BUNDLE_DEPLOY" column="BUNDLE_GROUP_DEPLOY_ID" columnType="INTEGER" />
+ <schema-directSQL>
+ <statement desc="Creating RHQ_BUNDLE_DEPLOY foreign key relation to RHQ_BUNDLE_GROUP_DEPLOY">
+ ALTER TABLE RHQ_BUNDLE_DEPLOY
+ ADD CONSTRAINT RHQ_BUNDLE_GROUP_DEPLOY_FK
+ FOREIGN KEY (BUNDLE_GROUP_DEPLOY_ID)
+ REFERENCES RHQ_BUNDLE_GROUP_DEPLOY (ID)
+ </statement>
+ </schema-directSQL>
</schemaSpec>
<schemaSpec version="2.79">
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeployment.java b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeployment.java
index 45389af..4bb964d 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeployment.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeployment.java
@@ -80,6 +80,10 @@ public class BundleDeployment implements Serializable {
@ManyToOne(fetch = FetchType.LAZY)
private Resource resource;
+ @JoinColumn(name = "BUNDLE_GROUP_DEPLOY_ID", referencedColumnName = "ID", nullable = true)
+ @ManyToOne
+ private BundleGroupDeployment bundleGroupDeployment;
+
@Column(name = "CTIME")
private Long ctime = -1L;
@@ -94,6 +98,13 @@ public class BundleDeployment implements Serializable {
this.resource = resource;
}
+ public BundleDeployment(BundleDeployDefinition bundleDeploymentDef, Resource resource,
+ BundleGroupDeployment bundleGroupDeployment) {
+ this.bundleDeployDefinition = bundleDeploymentDef;
+ this.resource = resource;
+ this.bundleGroupDeployment = bundleGroupDeployment;
+ }
+
public BundleDeployDefinition getBundleDeployDefinition() {
return bundleDeployDefinition;
}
@@ -140,6 +151,14 @@ public class BundleDeployment implements Serializable {
this.histories.add(history);
}
+ public BundleGroupDeployment getBundleGroupDeployment() {
+ return bundleGroupDeployment;
+ }
+
+ public void setBundleGroupDeployment(BundleGroupDeployment bundleGroupDeployment) {
+ this.bundleGroupDeployment = bundleGroupDeployment;
+ }
+
@Override
public String toString() {
StringBuilder str = new StringBuilder("BundleDeployment: ");
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleGroupDeployment.java b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleGroupDeployment.java
new file mode 100644
index 0000000..8f27723
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleGroupDeployment.java
@@ -0,0 +1,292 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.core.domain.bundle;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.SequenceGenerator;
+import javax.persistence.Table;
+
+import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
+import org.rhq.core.domain.resource.group.ResourceGroup;
+
+@Entity
+@SequenceGenerator(name = "SEQ", sequenceName = "RHQ_BUNDLE_GROUP_DEPLOY_ID_SEQ")
+@Table(name = "RHQ_BUNDLE_GROUP_DEPLOY")
+public class BundleGroupDeployment implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @GeneratedValue(generator = "SEQ", strategy = GenerationType.AUTO)
+ @Id
+ private int id;
+
+ @JoinColumn(name = "GROUP_ID", referencedColumnName = "ID")
+ @ManyToOne(cascade = { CascadeType.REMOVE })
+ private ResourceGroup group;
+
+ @JoinColumn(name = "BUNDLE_DEPLOY_DEF_ID", referencedColumnName = "ID", nullable = false)
+ @ManyToOne(cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)
+ protected BundleDeployDefinition bundleDeployDefinition;
+
+ @Column(name = "STATUS", nullable = false)
+ @Enumerated(EnumType.STRING)
+ protected BundleGroupDeploymentStatus status;
+
+ @Column(name = "ERROR_MESSAGE")
+ protected String errorMessage;
+
+ @Column(name = "SUBJECT_NAME")
+ protected String subjectName;
+
+ @Column(name = "CTIME", nullable = false)
+ protected long createdTime = System.currentTimeMillis();
+
+ @Column(name = "MTIME", nullable = false)
+ protected long modifiedTime = System.currentTimeMillis();
+
+ @OneToMany(mappedBy = "bundleGroupDeployment", fetch = FetchType.LAZY, cascade = { CascadeType.ALL })
+ private List<BundleDeployment> bundleDeployments = new ArrayList<BundleDeployment>();
+
+ // For JPA
+ public BundleGroupDeployment() {
+ }
+
+ public BundleGroupDeployment(String subjectName, BundleDeployDefinition bundleDeployDefinition, ResourceGroup group) {
+ this.subjectName = subjectName;
+ this.bundleDeployDefinition = bundleDeployDefinition;
+ this.group = group;
+ this.status = BundleGroupDeploymentStatus.INPROGRESS;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ /**
+ * The status of the request which indicates that the request is either still in progress, or it has completed and
+ * either succeeded or failed.
+ *
+ * @return the request status
+ */
+ public BundleGroupDeploymentStatus getStatus() {
+ return status;
+ }
+
+ public void setStatus(BundleGroupDeploymentStatus status) {
+ this.status = status;
+ }
+
+ public ResourceGroup getGroup() {
+ return group;
+ }
+
+ public void setGroup(ResourceGroup group) {
+ this.group = group;
+ }
+
+ public BundleDeployDefinition getBundleDeployDefinition() {
+ return bundleDeployDefinition;
+ }
+
+ public void setBundleDeployDefinition(BundleDeployDefinition bundleDeployDefinition) {
+ this.bundleDeployDefinition = bundleDeployDefinition;
+ }
+
+ /**
+ * If not <code>null</code>, this is an error message (possibly a full stack trace) to indicate the overall error
+ * that occurred when the configuration update failed. This will normally be <code>null</code> unless the
+ * {@link #getStatus() status} indicates a {@link BundleGroupDeploymentStatus#FAILURE}.
+ *
+ * @return overall error that occurred
+ */
+ public String getErrorMessage() {
+ return errorMessage;
+ }
+
+ /**
+ * Calling this method with a non-<code>null</code> error message implies that the request's status is
+ * {@link ConfigurationUpdateStatus#FAILURE}. The inverse is <i>not</i> true - that is, if you set the error message
+ * to <code>null</code>, the status is left as-is; it will not assume that a <code>null</code> error message means
+ * the status is successful.
+ *
+ * @param errorMessage
+ */
+ public void setErrorMessage(String errorMessage) {
+ this.errorMessage = errorMessage;
+
+ if (this.errorMessage != null) {
+ setStatus(BundleGroupDeploymentStatus.FAILURE);
+ }
+ }
+
+ /**
+ * For auditing purposes, this method tells you the username of the person that created the request. This is not a
+ * relationship to an actual Subject because we want to maintain the audit trail, even if a Subject has been deleted
+ * from the database.
+ *
+ * @return the actual name string of the submitter of the request
+ */
+ public String getSubjectName() {
+ return subjectName;
+ }
+
+ /**
+ * The time this entity was originally created; in other words, when the request was originally made.
+ *
+ * @return creation time
+ */
+ public long getCreatedTime() {
+ return this.createdTime;
+ }
+
+ /**
+ * The time this entity was last modified. This is the last time the status was updated. If the status has never
+ * been updated, this will be the {@link #getCreatedTime() created time}.
+ *
+ * @return last modified time
+ */
+ public long getModifiedTime() {
+ return this.modifiedTime;
+ }
+
+ public List<BundleDeployment> getBundleDeployments() {
+ return bundleDeployments;
+ }
+
+ public void setBundleDeployments(List<BundleDeployment> bundleDeployments) {
+ this.bundleDeployments = bundleDeployments;
+ }
+
+ public void addBundleDeployment(BundleDeployment bundleDeployment) {
+ bundleDeployment.setBundleGroupDeployment(this);
+ this.bundleDeployments.add(bundleDeployment);
+ }
+
+ /**
+ * The duration of the configuration update request which simply is the difference between the
+ * {@link #getCreatedTime()} and the {@link #getModifiedTime()}. If the request hasn't completed yet, this will be
+ * the difference between the current time and the created time.
+ *
+ * @return the duration of time that the request took or is taking to complete
+ */
+ public long getDuration() {
+ long start = this.createdTime;
+ long end;
+ if ((status == null) || (status == BundleGroupDeploymentStatus.INPROGRESS)) {
+ end = System.currentTimeMillis();
+ } else {
+ end = this.modifiedTime;
+ }
+
+ return end - start;
+ }
+
+ @Override
+ public int hashCode() {
+ final int PRIME = 31;
+ int result = 1;
+ result = (PRIME * result) + (int) (createdTime ^ (createdTime >>> 32));
+ result = (PRIME * result) + ((subjectName == null) ? 0 : subjectName.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+
+ if ((obj == null) || !(obj instanceof BundleGroupDeployment)) {
+ return false;
+ }
+
+ final BundleGroupDeployment other = (BundleGroupDeployment) obj;
+
+ if (this.createdTime != other.createdTime) {
+ return false;
+ }
+
+ if (this.subjectName == null) {
+ if (other.subjectName != null) {
+ return false;
+ }
+ } else if (!this.subjectName.equals(other.subjectName)) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @PrePersist
+ void onPersist() {
+ // don't set createdTime - we use it in equals/hashCode - it is already set at instantiation time
+ this.modifiedTime = System.currentTimeMillis();
+ }
+
+ @PreUpdate
+ void onUpdate() {
+ this.modifiedTime = System.currentTimeMillis();
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder str = new StringBuilder("BundleGroupDeployment [");
+ str.append("id=").append(this.id);
+ str.append(", status=").append(this.status);
+ str.append(", resourceGroup=").append(this.group);
+ str.append(", deployDef=").append(this.getBundleDeployDefinition());
+ str.append(", subjectName=").append(this.subjectName);
+ str.append(", createdTime=").append(this.createdTime);
+ str.append(", modifiedTime=").append(this.modifiedTime);
+
+ String err = this.errorMessage;
+ if ((err != null) && (err.indexOf('\n') > -1)) {
+ err = err.substring(0, err.indexOf('\n')) + "...";
+ }
+ str.append(", errorMessage=").append(err);
+ str.append(']');
+
+ return str.toString();
+ }
+}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleGroupDeploymentStatus.java b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleGroupDeploymentStatus.java
new file mode 100644
index 0000000..94f9113
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleGroupDeploymentStatus.java
@@ -0,0 +1,47 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.core.domain.bundle;
+
+/**
+ * Simple statuses for Bundle Group Deploy requests. When a request is first initiated, it will be considered in the
+ * {@link #INPROGRESS} state. When the request has completed, it will have been either a {@link #SUCCESS} or
+ * {@link #FAILURE}.
+ *
+ * @author Jay Shaughnessy
+ */
+public enum BundleGroupDeploymentStatus {
+ INPROGRESS("In Progress"), //
+ SUCCESS("Success"), //
+ FAILURE("Failure"), //
+ NOCHANGE("No Change");
+
+ private String displayName;
+
+ BundleGroupDeploymentStatus(String displayName) {
+ this.displayName = displayName;
+ }
+
+ public String toString() {
+ return displayName;
+ }
+}
\ No newline at end of file
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/GroupBundleDeployment.java b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/GroupBundleDeployment.java
deleted file mode 100644
index 67ad13f..0000000
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/GroupBundleDeployment.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.rhq.core.domain.bundle;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.persistence.CascadeType;
-import javax.persistence.DiscriminatorValue;
-import javax.persistence.Entity;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.OneToMany;
-
-import org.rhq.core.domain.resource.group.ResourceGroup;
-
-@DiscriminatorValue("group")
-@Entity
-public class GroupBundleDeployment extends BundleDeployment {
-
- private static final long serialVersionUID = 1L;
-
- @JoinColumn(name = "GROUP_ID", referencedColumnName = "ID")
- @ManyToOne
- private ResourceGroup group;
-
- @OneToMany(mappedBy = "groupBundleHistory", cascade = { CascadeType.PERSIST, CascadeType.REMOVE })
- private List<BundleDeployment> bundleDeployments = new ArrayList<BundleDeployment>();
-
- protected GroupBundleDeployment() {
- }
-
- public ResourceGroup getGroup() {
- return group;
- }
-
- public void setGroup(ResourceGroup group) {
- this.group = group;
- }
-
- public List<BundleDeployment> getBundleDeployments() {
- return bundleDeployments;
- }
-
- public void setBundleDeployments(List<BundleDeployment> bundleDeployments) {
- this.bundleDeployments = bundleDeployments;
- }
-
- public void addBundleDeployments(BundleDeployment bundleDeployment) {
- this.bundleDeployments.add(bundleDeployment);
- }
-
-}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java
index 7a10422..9eae8e6 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java
@@ -55,7 +55,7 @@ import org.jetbrains.annotations.NotNull;
import org.rhq.core.domain.alert.AlertDefinition;
import org.rhq.core.domain.authz.Role;
-import org.rhq.core.domain.bundle.GroupBundleDeployment;
+import org.rhq.core.domain.bundle.BundleGroupDeployment;
import org.rhq.core.domain.configuration.group.AbstractGroupConfigurationUpdate;
import org.rhq.core.domain.operation.GroupOperationHistory;
import org.rhq.core.domain.resource.Resource;
@@ -407,7 +407,7 @@ public class ResourceGroup extends Group {
@OneToMany(mappedBy = "group", cascade = { CascadeType.ALL })
@OrderBy
// by primary key which will also put the operation histories in chronological order
- private List<GroupBundleDeployment> bundleDeployments = new ArrayList<GroupBundleDeployment>();
+ private List<BundleGroupDeployment> bundleDeployments = new ArrayList<BundleGroupDeployment>();
@JoinColumn(name = "GROUP_DEFINITION_ID", referencedColumnName = "ID", nullable = true)
@ManyToOne
@@ -554,11 +554,11 @@ public class ResourceGroup extends Group {
this.configurationUpdates = configurationUpdates;
}
- public List<GroupBundleDeployment> getBundleDeployments() {
+ public List<BundleGroupDeployment> getBundleDeployments() {
return bundleDeployments;
}
- public void setBundleDeployments(List<GroupBundleDeployment> bundleDeployments) {
+ public void setBundleDeployments(List<BundleGroupDeployment> bundleDeployments) {
this.bundleDeployments = bundleDeployments;
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
index bab247a..8e6e479 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
@@ -50,6 +50,7 @@ import org.rhq.core.domain.bundle.BundleDeployment;
import org.rhq.core.domain.bundle.BundleDeploymentAction;
import org.rhq.core.domain.bundle.BundleDeploymentHistory;
import org.rhq.core.domain.bundle.BundleFile;
+import org.rhq.core.domain.bundle.BundleGroupDeployment;
import org.rhq.core.domain.bundle.BundleType;
import org.rhq.core.domain.bundle.BundleVersion;
import org.rhq.core.domain.bundle.composite.BundleWithLatestVersionComposite;
@@ -67,6 +68,7 @@ import org.rhq.core.domain.criteria.BundleFileCriteria;
import org.rhq.core.domain.criteria.BundleVersionCriteria;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.util.NumberUtil;
import org.rhq.enterprise.server.RHQConstants;
@@ -431,25 +433,32 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
return (PackageType) packageTypeQuery.getSingleResult();
}
- @RequiredPermission(Permission.MANAGE_INVENTORY)
public BundleDeployment scheduleBundleDeployment(Subject subject, int bundleDeployDefinitionId, int resourceId)
throws Exception {
-
BundleDeployDefinition deployDef = entityManager.find(BundleDeployDefinition.class, bundleDeployDefinitionId);
if (null == deployDef) {
throw new IllegalArgumentException("Invalid bundleDeployDefinitionId: " + bundleDeployDefinitionId);
}
+
Resource resource = (Resource) entityManager.find(Resource.class, resourceId);
if (null == resource) {
throw new IllegalArgumentException("Invalid resourceId (Resource does not exist): " + resourceId);
}
+ return scheduleBundleDeployment(subject, deployDef, resource, null);
+ }
+
+ private BundleDeployment scheduleBundleDeployment(Subject subject, BundleDeployDefinition deployDef,
+ Resource resource, BundleGroupDeployment bundleGroupDeployment) throws Exception {
+
+ int resourceId = resource.getId();
AgentClient agentClient = agentManager.getAgentClient(resourceId);
BundleAgentService bundleAgentService = agentClient.getBundleAgentService();
// The BundleDeployment record must exist in the db before the agent request because the agent may try to
// add History to it during immediate deployments., so create and persist it (requires a new trans).
- BundleDeployment deployment = bundleManager.createBundleDeployment(subject, deployDef.getId(), resourceId);
+ BundleDeployment deployment = bundleManager.createBundleDeployment(subject, deployDef.getId(), resourceId,
+ bundleGroupDeployment.getId());
// make sure the deployment contains the info required by the schedule service
BundleVersion bundleVersion = entityManager.find(BundleVersion.class, deployDef.getBundleVersion().getId());
@@ -492,10 +501,44 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
return deployment;
}
+ @RequiredPermission(Permission.MANAGE_INVENTORY)
+ public BundleGroupDeployment scheduleBundleGroupDeployment(Subject subject, int bundleDeployDefinitionId,
+ int resourceGroupId) throws Exception {
+
+ BundleDeployDefinition deployDef = entityManager.find(BundleDeployDefinition.class, bundleDeployDefinitionId);
+ if (null == deployDef) {
+ throw new IllegalArgumentException("Invalid bundleDeployDefinitionId: " + bundleDeployDefinitionId);
+ }
+ ResourceGroup resourceGroup = (ResourceGroup) entityManager.find(ResourceGroup.class, resourceGroupId);
+ if (null == resourceGroup) {
+ throw new IllegalArgumentException("Invalid resourceGroupId (ResourceGroup does not exist): "
+ + resourceGroupId);
+ }
+
+ /*
+ * we need to create and persist the group deployment entity in a new transaction before the rest of the
+ * processing of this method; if we try to create and attach the deployment children
+ * to the parent before this is persisted we'll get StaleStateExceptions
+ * from Hibernate because of our use of flush/clear (we're trying to update it before it actually exists)
+ */
+ BundleGroupDeployment bundleGroupDeployment = new BundleGroupDeployment(subject.getName(), deployDef,
+ resourceGroup);
+ bundleGroupDeployment = bundleManager.createBundleGroupDeployment(bundleGroupDeployment);
+
+ // Create and persist updates for each of the group members.
+ for (Resource resource : resourceGroup.getExplicitResources()) {
+ BundleDeployment bundleDeployment = scheduleBundleDeployment(subject, deployDef, resource,
+ bundleGroupDeployment);
+ bundleGroupDeployment.addBundleDeployment(bundleDeployment);
+ }
+
+ return bundleGroupDeployment;
+ }
+
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
@RequiredPermission(Permission.MANAGE_INVENTORY)
- public BundleDeployment createBundleDeployment(Subject subject, int bundleDeployDefinitionId, int resourceId)
- throws Exception {
+ public BundleDeployment createBundleDeployment(Subject subject, int bundleDeployDefinitionId, int resourceId,
+ int bundleGroupDeploymentId) throws Exception {
BundleDeployDefinition deployDef = entityManager.find(BundleDeployDefinition.class, bundleDeployDefinitionId);
if (null == deployDef) {
@@ -506,12 +549,22 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
throw new IllegalArgumentException("Invalid resourceId (Resource does not exist): " + resourceId);
}
- BundleDeployment deployment = new BundleDeployment(deployDef, resource);
+ BundleGroupDeployment bundleGroupDeployment = (BundleGroupDeployment) entityManager.find(
+ BundleGroupDeployment.class, bundleGroupDeploymentId);
+
+ BundleDeployment deployment = new BundleDeployment(deployDef, resource, bundleGroupDeployment);
entityManager.persist(deployment);
return deployment;
}
+ @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
+ public BundleGroupDeployment createBundleGroupDeployment(BundleGroupDeployment bundleGroupDeployment)
+ throws Exception {
+ entityManager.persist(bundleGroupDeployment);
+ return bundleGroupDeployment;
+ }
+
@RequiredPermission(Permission.MANAGE_INVENTORY)
public Set<String> getBundleVersionFilenames(Subject subject, int bundleVersionId, boolean withoutBundleFileOnly)
throws Exception {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerLocal.java
index fc4d224..b265f0e 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerLocal.java
@@ -25,6 +25,7 @@ import javax.ejb.Local;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.bundle.BundleDeployment;
import org.rhq.core.domain.bundle.BundleDeploymentHistory;
+import org.rhq.core.domain.bundle.BundleGroupDeployment;
import org.rhq.core.domain.bundle.BundleType;
/**
@@ -65,11 +66,17 @@ public interface BundleManagerLocal extends BundleManagerRemote {
BundleType createBundleType(Subject subject, String name, int resourceTypeId) throws Exception;
/**
- * This is typically not called directly, typically deployBundle() is called externally. This executes
- * in a New Transaction and supports deployBundle.
+ * This is typically not called directly, typically scheduleBundleDeployment() is called externally. This executes
+ * in a New Transaction and supports scheduleBundleDeployment.
*/
- BundleDeployment createBundleDeployment(Subject subject, int bundleDeployDefinitionId, int resourceId)
- throws Exception;
+ BundleDeployment createBundleDeployment(Subject subject, int bundleDeployDefinitionId, int resourceId,
+ int bundleGroupDeploymentId) throws Exception;
+
+ /**
+ * This is typically not called directly, typically scheduleBundleGroupDeployment() is called externally.
+ * This executes in a New Transaction and supports scheduleBundleGroupDeployment.
+ */
+ BundleGroupDeployment createBundleGroupDeployment(BundleGroupDeployment bundleGroupDeployment) throws Exception;
// added here because the same method in @Remote was commented out to bypass a WSProvide issue
Map<String, Boolean> getAllBundleVersionFilenames(Subject subject, int bundleVersionId) throws Exception;
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java
index b3a84ff..6184a6c 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java
@@ -33,6 +33,7 @@ import org.rhq.core.domain.bundle.Bundle;
import org.rhq.core.domain.bundle.BundleDeployDefinition;
import org.rhq.core.domain.bundle.BundleDeployment;
import org.rhq.core.domain.bundle.BundleFile;
+import org.rhq.core.domain.bundle.BundleGroupDeployment;
import org.rhq.core.domain.bundle.BundleType;
import org.rhq.core.domain.bundle.BundleVersion;
import org.rhq.core.domain.bundle.composite.BundleWithLatestVersionComposite;
@@ -296,4 +297,23 @@ public interface BundleManagerRemote {
@WebParam(name = "bundleDeployDefinitionId") int bundleDeployDefinitionId, //
@WebParam(name = "resourceId") int resourceId) throws Exception;
+ /**
+ * Deploy the bundle as described in the provided deploy definition to all of the resources in the
+ * specified resource group.
+ * Deployment is asynchronous so return of this method does not indicate deployments are complete. The
+ * returned BundleGroupDeployment can be used to track the history of the deployments.
+ *
+ * TODO: Add the scheduling capability, currently it's Immediate.
+ *
+ * @param subject must be InventoryManager
+ * @param bundleDeployDefinitionId the BundleDeployDefinition being used to guide the deployments
+ * @param resourceGroupId the target resourceGroup (must exist), typically platforms, for the deployments
+ * @return the BundleGroupDeployment created to track the deployments.
+ * @throws Exception
+ */
+ @WebMethod
+ BundleGroupDeployment scheduleBundleGroupDeployment( //
+ @WebParam(name = "subject") Subject subject, //
+ @WebParam(name = "bundleDeployDefinitionId") int bundleDeployDefinitionId, //
+ @WebParam(name = "resourceGroupId") int resourceGroupId) throws Exception;
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
index 6521e5b..06b59c6 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
@@ -42,6 +42,7 @@ import org.rhq.core.domain.bundle.Bundle;
import org.rhq.core.domain.bundle.BundleDeployDefinition;
import org.rhq.core.domain.bundle.BundleDeployment;
import org.rhq.core.domain.bundle.BundleFile;
+import org.rhq.core.domain.bundle.BundleGroupDeployment;
import org.rhq.core.domain.bundle.BundleType;
import org.rhq.core.domain.bundle.BundleVersion;
import org.rhq.core.domain.bundle.composite.BundleWithLatestVersionComposite;
@@ -425,7 +426,12 @@ public class WebservicesManagerBean implements WebservicesRemote {
return bundleManager.scheduleBundleDeployment(subject, bundleDeployDefinitionId, resourceId);
}
- //BUNDLEMANAGER: END ----------------------------------
+ public BundleGroupDeployment scheduleBundleGroupDeployment(Subject subject, int bundleDeployDefinitionId,
+ int resourceGroupId) throws Exception {
+ return bundleManager.scheduleBundleGroupDeployment(subject, bundleDeployDefinitionId, resourceGroupId);
+ }
+
+ //BUNDLEMANAGER: END ----------------------------------
//CALLTIMEDATAMANAGER: BEGIN ----------------------------------
public PageList<CallTimeDataComposite> findCallTimeDataForResource(Subject subject, int scheduleId, long beginTime,
commit 99ac8e813983478838882e54621b77adc2b17c3c
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 24 16:21:48 2010 -0400
better button labels
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
index cf0d561..e3c4c0f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
@@ -63,7 +63,7 @@ public class BundlesListView extends VLayout {
table.getListGrid().setSelectionType(SelectionStyle.SIMPLE);
table.getListGrid().setSelectionAppearance(SelectionAppearance.CHECKBOX);
- table.addTableAction("Create New Bundle", Table.SelectionEnablement.ALWAYS, null, new TableAction() {
+ table.addTableAction("New", Table.SelectionEnablement.ALWAYS, null, new TableAction() {
public void executeAction(ListGridRecord[] selection) {
new BundleCreateWizard().startBundleWizard();
@@ -91,7 +91,7 @@ public class BundlesListView extends VLayout {
}
});
- table.addTableAction("Create New Version", Table.SelectionEnablement.SINGLE, null, new TableAction() {
+ table.addTableAction("New Version", Table.SelectionEnablement.SINGLE, null, new TableAction() {
public void executeAction(ListGridRecord[] selection) {
BundlesWithLatestVersionDataSource ds = (BundlesWithLatestVersionDataSource) table.getDataSource();
final BundleWithLatestVersionComposite object = ds.copyValues(selection[0]);
commit b599b8bf8c37f25c60b80ec409a441a6e1578e05
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Wed Mar 24 15:44:03 2010 -0400
icons for the new resource and type views
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/types/Platform_down_16.png b/modules/enterprise/gui/coregui/src/main/webapp/images/types/Platform_down_16.png
new file mode 100644
index 0000000..af73da1
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/types/Platform_down_16.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/types/Platform_down_24.png b/modules/enterprise/gui/coregui/src/main/webapp/images/types/Platform_down_24.png
new file mode 100644
index 0000000..66627f8
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/types/Platform_down_24.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/types/Platform_up_16.png b/modules/enterprise/gui/coregui/src/main/webapp/images/types/Platform_up_16.png
new file mode 100644
index 0000000..223b0b3
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/types/Platform_up_16.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/types/Platform_up_24.png b/modules/enterprise/gui/coregui/src/main/webapp/images/types/Platform_up_24.png
new file mode 100644
index 0000000..fb50a9d
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/types/Platform_up_24.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/types/Server_down_16.png b/modules/enterprise/gui/coregui/src/main/webapp/images/types/Server_down_16.png
new file mode 100644
index 0000000..69a4d9f
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/types/Server_down_16.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/types/Server_down_24.png b/modules/enterprise/gui/coregui/src/main/webapp/images/types/Server_down_24.png
new file mode 100644
index 0000000..660e4b8
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/types/Server_down_24.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/types/Server_up_16.png b/modules/enterprise/gui/coregui/src/main/webapp/images/types/Server_up_16.png
new file mode 100644
index 0000000..132e4ce
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/types/Server_up_16.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/types/Server_up_24.png b/modules/enterprise/gui/coregui/src/main/webapp/images/types/Server_up_24.png
new file mode 100644
index 0000000..83da6ad
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/types/Server_up_24.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/types/Service_down_16.png b/modules/enterprise/gui/coregui/src/main/webapp/images/types/Service_down_16.png
new file mode 100644
index 0000000..d09143b
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/types/Service_down_16.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/types/Service_down_24.png b/modules/enterprise/gui/coregui/src/main/webapp/images/types/Service_down_24.png
new file mode 100644
index 0000000..24b1d98
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/types/Service_down_24.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/types/Service_up_16.png b/modules/enterprise/gui/coregui/src/main/webapp/images/types/Service_up_16.png
new file mode 100644
index 0000000..bbebc5c
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/types/Service_up_16.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/types/Service_up_24.png b/modules/enterprise/gui/coregui/src/main/webapp/images/types/Service_up_24.png
new file mode 100644
index 0000000..7df5599
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/types/Service_up_24.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/types/plugin_16.png b/modules/enterprise/gui/coregui/src/main/webapp/images/types/plugin_16.png
new file mode 100644
index 0000000..35bbd70
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/types/plugin_16.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/types/plugin_24.png b/modules/enterprise/gui/coregui/src/main/webapp/images/types/plugin_24.png
new file mode 100644
index 0000000..0dd5e93
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/types/plugin_24.png differ
commit fd07e05ac93f368163b45ae95e26f9faed1c80b4
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Wed Mar 24 15:40:09 2010 -0400
Fixed some bugs in but enablement
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java
index 77952a0..a309ce1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java
@@ -66,6 +66,11 @@ public class ResourceSelector extends HLayout {
private ListGrid availableGrid;
private ListGrid assignedGrid;
+ private TransferImgButton addButton;
+ private TransferImgButton removeButton;
+ private TransferImgButton addAllButton;
+ private TransferImgButton removeAllButton;
+
private Criteria latestCriteria;
public ResourceSelector() {
@@ -82,16 +87,15 @@ public class ResourceSelector extends HLayout {
availableFilterForm.setNumCols(6);
final TextItem search = new TextItem("search", "Search");
- IPickTreeItem typeSelectItem = new IPickTreeItem("type","Type");
+ IPickTreeItem typeSelectItem = new IPickTreeItem("type", "Type");
typeSelectItem.setDataSource(new ResourceTypeTreeDataSource());
typeSelectItem.setValueField("id");
typeSelectItem.setCanSelectParentItems(true);
typeSelectItem.setLoadDataOnDemand(false);
-
- SelectItem categorySelect = new SelectItem("category","Category");
- categorySelect.setValueMap("Platform","Server","Service");
+ SelectItem categorySelect = new SelectItem("category", "Category");
+ categorySelect.setValueMap("Platform", "Server", "Service");
categorySelect.setAllowEmptyValue(true);
availableFilterForm.setItems(search, typeSelectItem, categorySelect);
@@ -117,13 +121,12 @@ public class ResourceSelector extends HLayout {
addMember(availableLayout);
-
availableFilterForm.addItemChangedHandler(new ItemChangedHandler() {
public void onItemChanged(ItemChangedEvent itemChangedEvent) {
latestCriteria = new Criteria();
- latestCriteria.setAttribute("name",availableFilterForm.getValue("search"));
- latestCriteria.setAttribute("type",availableFilterForm.getValue("type"));
- latestCriteria.setAttribute("category",availableFilterForm.getValue("category"));
+ latestCriteria.setAttribute("name", availableFilterForm.getValue("search"));
+ latestCriteria.setAttribute("type", availableFilterForm.getValue("type"));
+ latestCriteria.setAttribute("category", availableFilterForm.getValue("category"));
Timer t = new Timer() {
@Override
@@ -140,20 +143,17 @@ public class ResourceSelector extends HLayout {
});
-
-
-
-
VStack moveButtonStack = new VStack(6);
moveButtonStack.setAlign(VerticalAlignment.CENTER);
moveButtonStack.setWidth(40);
- final TransferImgButton addButton = new TransferImgButton(TransferImgButton.RIGHT);
+ addButton = new TransferImgButton(TransferImgButton.RIGHT);
addButton.setDisabled(true);
- final TransferImgButton removeButton = new TransferImgButton(TransferImgButton.LEFT);
+ removeButton = new TransferImgButton(TransferImgButton.LEFT);
removeButton.setDisabled(true);
- TransferImgButton addAllButton = new TransferImgButton(TransferImgButton.RIGHT_ALL);
- TransferImgButton removeAllButton = new TransferImgButton(TransferImgButton.LEFT_ALL);
+ addAllButton = new TransferImgButton(TransferImgButton.RIGHT_ALL);
+ removeAllButton = new TransferImgButton(TransferImgButton.LEFT_ALL);
+ removeAllButton.setDisabled(true);
moveButtonStack.addMember(addButton);
moveButtonStack.addMember(removeButton);
@@ -163,7 +163,6 @@ public class ResourceSelector extends HLayout {
addMember(moveButtonStack);
-
VLayout assignedLayout = new VLayout();
assignedLayout.addMember(new LayoutSpacer());
@@ -181,16 +180,19 @@ public class ResourceSelector extends HLayout {
addMember(assignedLayout);
+
addButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
assignedGrid.transferSelectedData(availableGrid);
select(assignedGrid.getSelection());
+ updateButtons();
}
});
removeButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
deselect(assignedGrid.getSelection());
assignedGrid.removeSelectedData();
+ updateButtons();
}
});
addAllButton.addClickHandler(new ClickHandler() {
@@ -198,6 +200,7 @@ public class ResourceSelector extends HLayout {
availableGrid.selectAllRecords();
assignedGrid.transferSelectedData(availableGrid);
select(availableGrid.getSelection());
+ updateButtons();
}
});
removeAllButton.addClickHandler(new ClickHandler() {
@@ -205,18 +208,19 @@ public class ResourceSelector extends HLayout {
assignedGrid.selectAllRecords();
deselect(assignedGrid.getSelection());
assignedGrid.removeSelectedData();
+ updateButtons();
}
});
availableGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
public void onSelectionChanged(SelectionEvent selectionEvent) {
- addButton.setDisabled(!availableGrid.anySelected());
+ updateButtons();
}
});
assignedGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
public void onSelectionChanged(SelectionEvent selectionEvent) {
- removeButton.setDisabled(!assignedGrid.anySelected());
+ updateButtons();
}
});
@@ -237,6 +241,13 @@ public class ResourceSelector extends HLayout {
});
}
+ private void updateButtons() {
+ addButton.setDisabled(!availableGrid.anySelected() || availableGrid.getTotalRows() == 0);
+ removeButton.setDisabled(!assignedGrid.anySelected() || assignedGrid.getTotalRows() == 0);
+ addAllButton.setDisabled(availableGrid.getTotalRows() == 0);
+ removeAllButton.setDisabled(assignedGrid.getTotalRows() == 0);
+ }
+
private void select(ListGridRecord[] records) {
availableGrid.deselectAllRecords();
for (ListGridRecord record : records) {
commit f19b182733dff62648fe8b332c5be0dda6927a02
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Wed Mar 24 12:16:14 2010 -0400
New resource selection component (left-right boxes, drag-n-drop, search and filter, selection indicator)
Resource selector demo'ed on the Demo canvas
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/DemoCanvas.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/DemoCanvas.java
index 9b4539a..f192c58 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/DemoCanvas.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/DemoCanvas.java
@@ -20,6 +20,8 @@ package org.rhq.enterprise.gui.coregui.client;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSearchView;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.selection.ResourceSelector;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeTreeView;
import com.smartgwt.client.types.Side;
import com.smartgwt.client.types.TabBarControls;
@@ -50,22 +52,27 @@ public class DemoCanvas extends Canvas {
// topTabSet.setTop(50);
- Tab tableTab = new Tab("Resource Search Table");
+ Tab selectorTab = new Tab("Selector");
+ Tab typeTree = new Tab("Type Tree");
Tab treeTab = new Tab("Resource Tree");
final Tab configTab = new Tab("Configuration Editor");
//Tab alertHistoryTab = new Tab("Alert History");
+
+ selectorTab.setPane(new ResourceSelector());
+
// Agent: resource (10005) type (10060)
// Raw: 10003 / 10023
// both: 10002 / 10022
//configTab.setPane(new ConfigurationEditor(10005, 10060, ConfigurationEditor.ConfigType.plugin));
//treeTab.setPane(new ResourceTreeView(new Resource(10001)));
- tableTab.setPane(new ResourceSearchView());
+ typeTree.setPane(new ResourceTypeTreeView());
//alertHistoryTab.setPane(new AbstractAlertsView());
+ topTabSet.addTab(selectorTab);
+ topTabSet.addTab(typeTree);
topTabSet.addTab(configTab);
- topTabSet.addTab(tableTab);
topTabSet.addTab(treeTab);
//topTabSet.addTab(alertHistoryTab);
//topTabSet.selectTab(alertHistoryTab);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java
new file mode 100644
index 0000000..77952a0
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java
@@ -0,0 +1,280 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.selection;
+
+import java.util.HashSet;
+
+import com.google.gwt.user.client.Timer;
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.data.Record;
+import com.smartgwt.client.types.DragDataAction;
+import com.smartgwt.client.types.DragTrackerMode;
+import com.smartgwt.client.types.ListGridFieldType;
+import com.smartgwt.client.types.VerticalAlignment;
+import com.smartgwt.client.widgets.ImgProperties;
+import com.smartgwt.client.widgets.TransferImgButton;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.events.KeyPressEvent;
+import com.smartgwt.client.widgets.events.KeyPressHandler;
+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.IPickTreeItem;
+import com.smartgwt.client.widgets.form.fields.SelectItem;
+import com.smartgwt.client.widgets.form.fields.TextItem;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.grid.events.RecordDropEvent;
+import com.smartgwt.client.widgets.grid.events.RecordDropHandler;
+import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
+import com.smartgwt.client.widgets.grid.events.SelectionEvent;
+import com.smartgwt.client.widgets.layout.HLayout;
+import com.smartgwt.client.widgets.layout.LayoutSpacer;
+import com.smartgwt.client.widgets.layout.VLayout;
+import com.smartgwt.client.widgets.layout.VStack;
+
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDatasource;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeTreeDataSource;
+
+/**
+ * @author Greg Hinkle
+ */
+public class ResourceSelector extends HLayout {
+
+ private HashSet<Integer> selection = new HashSet<Integer>();
+
+ private ListGrid availableGrid;
+ private ListGrid assignedGrid;
+
+ private Criteria latestCriteria;
+
+ public ResourceSelector() {
+ setAlign(VerticalAlignment.BOTTOM);
+ setHeight(380);
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+
+ final DynamicForm availableFilterForm = new DynamicForm();
+ availableFilterForm.setNumCols(6);
+ final TextItem search = new TextItem("search", "Search");
+
+ IPickTreeItem typeSelectItem = new IPickTreeItem("type","Type");
+ typeSelectItem.setDataSource(new ResourceTypeTreeDataSource());
+ typeSelectItem.setValueField("id");
+ typeSelectItem.setCanSelectParentItems(true);
+ typeSelectItem.setLoadDataOnDemand(false);
+
+
+
+ SelectItem categorySelect = new SelectItem("category","Category");
+ categorySelect.setValueMap("Platform","Server","Service");
+ categorySelect.setAllowEmptyValue(true);
+ availableFilterForm.setItems(search, typeSelectItem, categorySelect);
+
+ VLayout availableLayout = new VLayout();
+ availableLayout.addMember(new LayoutSpacer());
+
+ availableLayout.addMember(availableFilterForm);
+
+ availableGrid = new ListGrid();
+ availableGrid.setHeight(350);
+ availableGrid.setCanDragRecordsOut(true);
+ availableGrid.setDragTrackerMode(DragTrackerMode.ICON);
+ availableGrid.setTrackerImage(new ImgProperties("types/Service_up_16.png", 16, 16));
+ availableGrid.setDragDataAction(DragDataAction.COPY);
+ availableGrid.setDataSource(new SelectedResourceDataSource());
+ availableGrid.setFetchDelay(700);
+
+ availableGrid.setAutoFetchData(true);
+ availableGrid.setFields(new ListGridField("icon", 50), new ListGridField("name"));
+
+ availableLayout.addMember(availableGrid);
+
+ addMember(availableLayout);
+
+
+
+ availableFilterForm.addItemChangedHandler(new ItemChangedHandler() {
+ public void onItemChanged(ItemChangedEvent itemChangedEvent) {
+ latestCriteria = new Criteria();
+ latestCriteria.setAttribute("name",availableFilterForm.getValue("search"));
+ latestCriteria.setAttribute("type",availableFilterForm.getValue("type"));
+ latestCriteria.setAttribute("category",availableFilterForm.getValue("category"));
+
+ Timer t = new Timer() {
+ @Override
+ public void run() {
+ if (latestCriteria != null) {
+ Criteria c = latestCriteria;
+ latestCriteria = null;
+ availableGrid.fetchData(c);
+ }
+ }
+ };
+ t.schedule(500);
+ }
+ });
+
+
+
+
+
+
+ VStack moveButtonStack = new VStack(6);
+ moveButtonStack.setAlign(VerticalAlignment.CENTER);
+ moveButtonStack.setWidth(40);
+
+ final TransferImgButton addButton = new TransferImgButton(TransferImgButton.RIGHT);
+ addButton.setDisabled(true);
+ final TransferImgButton removeButton = new TransferImgButton(TransferImgButton.LEFT);
+ removeButton.setDisabled(true);
+ TransferImgButton addAllButton = new TransferImgButton(TransferImgButton.RIGHT_ALL);
+ TransferImgButton removeAllButton = new TransferImgButton(TransferImgButton.LEFT_ALL);
+
+ moveButtonStack.addMember(addButton);
+ moveButtonStack.addMember(removeButton);
+ moveButtonStack.addMember(addAllButton);
+ moveButtonStack.addMember(removeAllButton);
+
+ addMember(moveButtonStack);
+
+
+
+ VLayout assignedLayout = new VLayout();
+ assignedLayout.addMember(new LayoutSpacer());
+
+ assignedGrid = new ListGrid();
+ assignedGrid.setHeight(350);
+ assignedGrid.setCanReorderRecords(true);
+ assignedGrid.setCanDragRecordsOut(true);
+
+ assignedGrid.setCanAcceptDroppedRecords(true);
+ ListGridField iconField = new ListGridField("icon", 50);
+ iconField.setType(ListGridFieldType.ICON);
+ assignedGrid.setFields(iconField, new ListGridField("name"));
+
+ assignedLayout.addMember(assignedGrid);
+ addMember(assignedLayout);
+
+
+ addButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ assignedGrid.transferSelectedData(availableGrid);
+ select(assignedGrid.getSelection());
+ }
+ });
+ removeButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ deselect(assignedGrid.getSelection());
+ assignedGrid.removeSelectedData();
+ }
+ });
+ addAllButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ availableGrid.selectAllRecords();
+ assignedGrid.transferSelectedData(availableGrid);
+ select(availableGrid.getSelection());
+ }
+ });
+ removeAllButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ assignedGrid.selectAllRecords();
+ deselect(assignedGrid.getSelection());
+ assignedGrid.removeSelectedData();
+ }
+ });
+
+ availableGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
+ public void onSelectionChanged(SelectionEvent selectionEvent) {
+ addButton.setDisabled(!availableGrid.anySelected());
+ }
+ });
+
+ assignedGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
+ public void onSelectionChanged(SelectionEvent selectionEvent) {
+ removeButton.setDisabled(!assignedGrid.anySelected());
+ }
+ });
+
+ assignedGrid.addKeyPressHandler(new KeyPressHandler() {
+ public void onKeyPress(KeyPressEvent event) {
+ if ("Delete".equals(event.getKeyName())) {
+ deselect(assignedGrid.getSelection());
+ assignedGrid.removeSelectedData();
+ }
+ }
+ });
+
+
+ assignedGrid.addRecordDropHandler(new RecordDropHandler() {
+ public void onRecordDrop(RecordDropEvent recordDropEvent) {
+ select(recordDropEvent.getDropRecords());
+ }
+ });
+ }
+
+ private void select(ListGridRecord[] records) {
+ availableGrid.deselectAllRecords();
+ for (ListGridRecord record : records) {
+ record.setEnabled(false);
+ selection.add(record.getAttributeAsInt("id"));
+ }
+ }
+
+ private void deselect(ListGridRecord[] records) {
+ HashSet<Integer> toRemove = new HashSet<Integer>();
+ for (ListGridRecord record : records) {
+ toRemove.add(record.getAttributeAsInt("id"));
+ }
+ selection.removeAll(toRemove);
+
+
+ for (Integer id : toRemove) {
+ Record r = availableGrid.getDataAsRecordList().find("id", id);
+ if (r != null) {
+ ((ListGridRecord) r).setEnabled(true);
+ }
+ }
+ availableGrid.markForRedraw();
+ }
+
+
+ private class SelectedResourceDataSource extends ResourceDatasource {
+
+
+ @Override
+ public ListGridRecord[] buildRecords(PageList<Resource> resources) {
+ ListGridRecord[] records = super.buildRecords(resources);
+ for (ListGridRecord record : records) {
+ if (selection.contains(record.getAttributeAsInt("id"))) {
+ record.setEnabled(false);
+ }
+ }
+ return records;
+ }
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/SelectedResourceDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/SelectedResourceDataSource.java
new file mode 100644
index 0000000..742a83f
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/SelectedResourceDataSource.java
@@ -0,0 +1,73 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.selection;
+
+import java.util.ArrayList;
+
+import com.smartgwt.client.widgets.events.DropEvent;
+import com.smartgwt.client.widgets.events.DropHandler;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.grid.events.RecordDropEvent;
+import com.smartgwt.client.widgets.grid.events.RecordDropHandler;
+
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDatasource;
+
+/**
+ * @author Greg Hinkle
+ */
+public class SelectedResourceDataSource extends ResourceDatasource {
+
+ private ArrayList<Integer> selection;
+
+
+ ListGrid availableGrid;
+ ListGrid assignedGrid;
+
+
+ public SelectedResourceDataSource(ArrayList<Integer> selection, ListGrid availableGrid, ListGrid assignedGrid) {
+ this.selection = selection;
+ if (this.selection == null) {
+ selection = new ArrayList<Integer>();
+ }
+ this.availableGrid = availableGrid;
+ this.assignedGrid = assignedGrid;
+
+
+ assignedGrid.addRecordDropHandler(new RecordDropHandler() {
+ public void onRecordDrop(RecordDropEvent recordDropEvent) {
+ for (ListGridRecord record : recordDropEvent.getDropRecords()) {
+
+ record.setCanDrag(false);
+ record.setEnabled(false);
+
+ SelectedResourceDataSource.this.selection.add(record.getAttributeAsInt("id"));
+ }
+ }
+ });
+ }
+
+
+
+
+
+
+
+
+}
commit baac2f3668e15df88893f1e426f2c7198beb9265
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Wed Mar 24 12:15:13 2010 -0400
avoid npe for mismatched component depths
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 66772ea..3be0f48 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
@@ -190,7 +190,7 @@ public class CoreGUI implements EntryPoint {
}
}
int startIndex;
- View parentView;
+ View parentView = null;
if (commonBasePathSize > 0) {
// The requested path shares a common base path with the current view, so skip rendering of
// views corresponding to this common base path. For example, if the current view is
@@ -198,7 +198,10 @@ public class CoreGUI implements EntryPoint {
// only on for the Monitor and Graphs components of the path.
startIndex = commonBasePathSize;
int subViewsToRenderPathSize = viewIdNames.size() - commonBasePathSize;
- parentView = CoreGUI.this.currentView;
+ View view = CoreGUI.this.currentView;
+ if (view != null) {
+ parentView = view;
+ }
for (int i = 0; i < subViewsToRenderPathSize; i++) {
parentView = parentView.getParent();
}
commit 84f4742ec27a15d37912207db9d4cbb1a1ad91ea
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Wed Mar 24 12:14:53 2010 -0400
Plugin and Type tree (for type pick list)
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeTreeDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeTreeDataSource.java
new file mode 100644
index 0000000..dc1cbe9
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeTreeDataSource.java
@@ -0,0 +1,260 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.type;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.data.DataSource;
+import com.smartgwt.client.data.fields.DataSourceTextField;
+import com.smartgwt.client.types.DSDataFormat;
+import com.smartgwt.client.types.DSProtocol;
+import com.smartgwt.client.widgets.tree.TreeNode;
+
+import org.rhq.core.domain.criteria.ResourceTypeCriteria;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.util.PageControl;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.core.domain.util.PageOrdering;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.gwt.ResourceTypeGWTServiceAsync;
+
+/**
+ * @author Greg Hinkle
+ */
+public class ResourceTypeTreeDataSource extends DataSource {
+
+
+ private ResourceTypeGWTServiceAsync resourceTypeService = GWTServiceLookup.getResourceTypeGWTService();
+
+ public ResourceTypeTreeDataSource() {
+
+ setClientOnly(false);
+ setDataProtocol(DSProtocol.CLIENTCUSTOM);
+ setDataFormat(DSDataFormat.CUSTOM);
+
+
+ DataSourceTextField idField = new DataSourceTextField("id", "ID");
+ idField.setPrimaryKey(true);
+
+ DataSourceTextField parentIdField = new DataSourceTextField("parentId", "Parent ID");
+ parentIdField.setForeignKey("id");
+
+ DataSourceTextField resourceNameField = new DataSourceTextField("name", "Name");
+
+ DataSourceTextField resourceKeyField = new DataSourceTextField("plugin", "Plugin");
+
+ DataSourceTextField resourceTypeField = new DataSourceTextField("category", "Category");
+
+
+ setFields(idField, parentIdField, resourceNameField, resourceKeyField, resourceTypeField);
+ }
+
+ protected Object transformRequest(DSRequest request) {
+ DSResponse response = new DSResponse();
+ response.setAttribute("clientContext", request.getAttributeAsObject("clientContext"));
+ // Asume success
+ response.setStatus(0);
+ switch (request.getOperationType()) {
+ case FETCH:
+ executeFetch(request, response);
+ break;
+ default:
+ break;
+ }
+
+ return request.getData();
+ }
+
+
+ protected void executeFetch(final DSRequest request, final DSResponse response) {
+
+ String parentIdString = request.getCriteria().getAttributeAsString("parentId");
+ if (parentIdString != null) {
+ processResponse(request.getRequestId(), response);
+ } else {
+
+
+ ResourceTypeCriteria criteria = new ResourceTypeCriteria();
+ criteria.fetchParentResourceTypes(true);
+ criteria.setPageControl(PageControl.getUnlimitedInstance());
+
+ resourceTypeService.findResourceTypesByCriteria(criteria,
+ new AsyncCallback<PageList<ResourceType>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load resource type tree data", caught);
+ }
+
+ public void onSuccess(PageList<ResourceType> result) {
+ response.setData(buildNodes(result));
+ processResponse(request.getRequestId(), response);
+ }
+ });
+ }
+ }
+
+
+ public static TreeNode[] buildNodes(PageList<ResourceType> result) {
+
+ HashMap<String, PluginTreeNode> pluginNodes = new HashMap<String, PluginTreeNode>();
+
+ HashSet<TreeNode> nodes = new HashSet<TreeNode>();
+ for (ResourceType type : result) {
+
+ PluginTreeNode pluginNode = pluginNodes.get(type.getPlugin());
+ if (pluginNode == null) {
+ pluginNode = new PluginTreeNode(type.getPlugin());
+ pluginNodes.put(type.getPlugin(), pluginNode);
+ nodes.add(pluginNode);
+ }
+
+
+ if (type.getParentResourceTypes() == null || type.getParentResourceTypes().isEmpty()) {
+ nodes.add(new ResourceTypeTreeNode(type, type.getPlugin()));
+ } else {
+ for (ResourceType parent : type.getParentResourceTypes()) {
+ nodes.add(new ResourceTypeTreeNode(type, String.valueOf(parent.getId())));
+ }
+ }
+ }
+
+ TreeNode[] treeNodes = nodes.toArray(new TreeNode[nodes.size()]);
+ return treeNodes;
+ }
+
+
+ /**
+ * Returns a prepopulated PageControl based on the provided DSRequest. This will set sort fields,
+ * pagination, but *not* filter fields.
+ *
+ * @param request the request to turn into a page control
+ * @return the page control for passing to criteria and other queries
+ */
+ protected PageControl getPageControl(DSRequest request) {
+ // Initialize paging.
+ PageControl pageControl;
+ if (request.getStartRow() == null || request.getEndRow() == null) {
+ pageControl = new PageControl();
+ } else {
+ pageControl = PageControl.getExplicitPageControl(request.getStartRow(), request.getEndRow() - request.getStartRow());
+ }
+
+ // Initialize sorting.
+ String sortBy = request.getAttribute("sortBy");
+ if (sortBy != null) {
+ String[] sorts = sortBy.split(",");
+ for (String sort : sorts) {
+ PageOrdering ordering = (sort.startsWith("-")) ? PageOrdering.DESC : PageOrdering.ASC;
+ String columnName = (ordering == PageOrdering.DESC) ? sort.substring(1) : sort;
+ pageControl.addDefaultOrderingField(columnName, ordering);
+ }
+ }
+
+ return pageControl;
+ }
+
+
+ public static class PluginTreeNode extends TreeNode {
+
+ String id;
+
+ PluginTreeNode(String pluginName) {
+
+ setID(pluginName);
+ this.id = pluginName;
+ setParentID(null);
+
+ setAttribute("name", pluginName);
+// setAttribute("plugin",pluginName);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ PluginTreeNode that = (PluginTreeNode) o;
+
+ if (!id.equals(that.id)) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return id.hashCode();
+ }
+ }
+
+ public static class ResourceTypeTreeNode extends TreeNode {
+
+ private ResourceType resourceType;
+ String id;
+ String parentId;
+
+ private ResourceTypeTreeNode(ResourceType resourceType, String parentId) {
+ this.resourceType = resourceType;
+
+ String id = String.valueOf(resourceType.getId());
+
+ setID(id);
+ this.id = id;
+ setParentID(parentId);
+ this.parentId = parentId;
+
+ setAttribute("id", id);
+ setAttribute("parentId", parentId);
+ setAttribute("name", resourceType.getName());
+ setAttribute("plugin", resourceType.getPlugin());
+ setAttribute("category", resourceType.getCategory().getDisplayName());
+
+ setIsFolder(true);
+ }
+
+
+ public ResourceType getResourceType() {
+ return resourceType;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ ResourceTypeTreeNode that = (ResourceTypeTreeNode) o;
+
+ if (!id.equals(that.id)) return false;
+ if (parentId != null ? !parentId.equals(that.parentId) : that.parentId != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = id.hashCode();
+ result = 31 * result + (parentId != null ? parentId.hashCode() : 0);
+ return result;
+ }
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeTreeView.java
new file mode 100644
index 0000000..5a78a23
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeTreeView.java
@@ -0,0 +1,115 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.type;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.Record;
+import com.smartgwt.client.widgets.layout.VLayout;
+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.ResourceType;
+import org.rhq.core.domain.util.PageControl;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.gwt.ResourceTypeGWTServiceAsync;
+
+/**
+ * @author Greg Hinkle
+ */
+public class ResourceTypeTreeView extends VLayout {
+
+ private ResourceTypeGWTServiceAsync resourceTypeService = GWTServiceLookup.getResourceTypeGWTService();
+
+ public ResourceTypeTreeView() {
+ setWidth100();
+ setHeight100();
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+
+ final TreeGrid treeGrid = new CustomResourceTypeTreeGrid();
+
+ treeGrid.setHeight100();
+
+ treeGrid.setTitle("Resource Types");
+ treeGrid.setAnimateFolders(false);
+ treeGrid.setResizeFieldsInRealTime(true);
+
+
+ final TreeGridField name, plugin, category;
+ name = new TreeGridField("name");
+ plugin = new TreeGridField("plugin");
+ category = new TreeGridField("category");
+
+ treeGrid.setFields(name, plugin, category);
+
+ addMember(treeGrid);
+
+ ResourceTypeCriteria criteria = new ResourceTypeCriteria();
+ criteria.fetchParentResourceTypes(true);
+ criteria.setPageControl(PageControl.getUnlimitedInstance());
+
+ resourceTypeService.findResourceTypesByCriteria(criteria,
+ new AsyncCallback<PageList<ResourceType>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load inventory discovery queue", caught);
+ }
+
+ public void onSuccess(PageList<ResourceType> result) {
+
+ treeGrid.getTree().linkNodes(ResourceTypeTreeDataSource.buildNodes(result));
+
+ }
+ });
+ }
+
+
+ public static class CustomResourceTypeTreeGrid extends TreeGrid {
+ @Override
+ protected String getIcon(Record record, boolean defaultState) {
+
+ if (record instanceof TreeNode) {
+ boolean open = getTree().isOpen((TreeNode) record);
+
+ if (record instanceof ResourceTypeTreeDataSource.ResourceTypeTreeNode) {
+ ResourceType resourceType = ((ResourceTypeTreeDataSource.ResourceTypeTreeNode) record).getResourceType();
+
+ switch (resourceType.getCategory()) {
+ case PLATFORM:
+ return "types/Platform_up_16.png";
+ case SERVER:
+ return "types/Server_up_16.png";
+ case SERVICE:
+ return "types/Service_up_16.png";
+ }
+ } else if (record instanceof ResourceTypeTreeDataSource.PluginTreeNode) {
+ return "types/plugin_16.png";
+ }
+ }
+ return null;
+ }
+ }
+}
commit 2b960960767a03e8f7cbe7c31a6dc7a22d22e7a9
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Wed Mar 24 12:14:14 2010 -0400
Summary traits on overview as per jeremy's updated design
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index 47a7ab8..f6c31da 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -45,6 +45,7 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configura
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.GraphListView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.calltime.CallTimeView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.OperationHistoryView;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.overview.ResourceOverviewView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
import com.google.gwt.user.client.History;
@@ -67,9 +68,6 @@ public class ResourceDetailView extends VLayout implements ViewRenderer, Resourc
private ResourcePermission permissions;
private ResourceType type;
- private SimpleCollapsiblePanel summaryPanel;
- private ResourceSummaryView summaryView;
-
private TwoLevelTab summaryTab;
private TwoLevelTab monitoringTab;
private TwoLevelTab inventoryTab;
@@ -97,9 +95,6 @@ public class ResourceDetailView extends VLayout implements ViewRenderer, Resourc
setWidth100();
setHeight100();
- // The header section
- summaryView = new ResourceSummaryView();
- summaryPanel = new SimpleCollapsiblePanel("Summary", summaryView);
// The Tabs section
@@ -142,8 +137,6 @@ public class ResourceDetailView extends VLayout implements ViewRenderer, Resourc
titleBar = new ResourceTitleBar();
addMember(titleBar);
- addMember(summaryPanel);
-
addMember(topTabSet);
// CoreGUI.addBreadCrumb(getPlace());
@@ -153,16 +146,13 @@ public class ResourceDetailView extends VLayout implements ViewRenderer, Resourc
this.resource = resource;
- this.summaryView.onResourceSelected(resource);
-
titleBar.setResource(resource);
int selectedTab = topTabSet.getSelectedTabNumber();
- FullHTMLPane summaryPane = new FullHTMLPane("/rhq/resource/summary/overview-plain.xhtml?id=" + resource.getId());
FullHTMLPane timelinePane = new FullHTMLPane("/rhq/resource/summary/timeline-plain.xhtml?id=" + resource.getId());
- summaryTab.updateSubTab("Overview", summaryPane);
+ summaryTab.updateSubTab("Overview", new ResourceOverviewView(resource));
summaryTab.updateSubTab("Timeline", timelinePane);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceSummaryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceSummaryView.java
deleted file mode 100644
index 58d0d08..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceSummaryView.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail;
-
-import org.rhq.core.domain.measurement.DataType;
-import org.rhq.core.domain.measurement.DisplayType;
-import org.rhq.core.domain.measurement.MeasurementDataTrait;
-import org.rhq.core.domain.measurement.MeasurementDefinition;
-import org.rhq.core.domain.resource.Resource;
-import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
-
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.util.SC;
-import com.smartgwt.client.widgets.form.DynamicForm;
-import com.smartgwt.client.widgets.form.fields.FormItem;
-import com.smartgwt.client.widgets.form.fields.SpacerItem;
-import com.smartgwt.client.widgets.form.fields.StaticTextItem;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.EnumSet;
-import java.util.List;
-
-/**
- * @author Greg Hinkle
- */
-public class ResourceSummaryView extends DynamicForm implements ResourceSelectListener {
-
- private Resource resource;
-
- @Override
- protected void onDraw() {
- super.onDraw();
-
- setNumCols(4);
- setWrapItemTitles(false);
- setLeft("10%");
- setWidth("80%");
- }
-
-
- public void onResourceSelected(Resource resource) {
-
- this.resource = resource;
-
- ResourceTypeRepository.Cache.getInstance().getResourceTypes(resource.getResourceType().getId(),
- EnumSet.of(ResourceTypeRepository.MetadataType.measurements),
- new ResourceTypeRepository.TypeLoadedCallback() {
- public void onTypesLoaded(ResourceType type) {
- try {
- buildForm(type);
- loadValues();
- } catch (Exception e) {
- SC.say("Form load failure");
- e.printStackTrace();
- }
- }
- });
-
-
- markForRedraw();
- }
-
- private void loadValues() {
- GWTServiceLookup.getMeasurementDataService().findCurrentTraitsForResource(
- resource.getId(),
- DisplayType.SUMMARY,
- new AsyncCallback<List<MeasurementDataTrait>>() {
- public void onFailure(Throwable caught) {
- SC.say("Failed to load traits");
- CoreGUI.getErrorHandler().handleError("Failed to load traits information for resource",caught);
- }
-
- public void onSuccess(List<MeasurementDataTrait> result) {
- // TODO: Implement this method.
- for (MeasurementDataTrait trait : result) {
- String formId = trait.getName().replaceAll("\\.", "_").replaceAll(" ", "__");
- FormItem item = getItem(formId);
-
- if (item != null) {
- setValue(formId, trait.getValue());
- }
- }
- markForRedraw();
- }
- }
- );
-
- }
-
- private void buildForm(ResourceType type) {
- ArrayList<MeasurementDefinition> traits = new ArrayList<MeasurementDefinition>();
-
- for (MeasurementDefinition measurement : type.getMetricDefinitions()) {
- if (measurement.getDataType() == DataType.TRAIT && measurement.getDisplayType() == DisplayType.SUMMARY) {
- traits.add(measurement);
- }
- }
-
- Collections.sort(traits, new Comparator<MeasurementDefinition>() {
- public int compare(MeasurementDefinition o1, MeasurementDefinition o2) {
- return new Integer(o1.getDisplayOrder()).compareTo(o2.getDisplayOrder());
- }
- });
-
-
- ArrayList<FormItem> formItems = new ArrayList<FormItem>();
- ArrayList<String> itemIds = new ArrayList<String>();
-
-
- StaticTextItem typeItem = new StaticTextItem("typeItem", "Type");
- typeItem.setTooltip("Plugin: " + type.getPlugin() + "\n<br>" + "Type: " + type.getName());
- typeItem.setValue(type.getName() + " (" + type.getPlugin() + ")");
- formItems.add(typeItem);
- itemIds.add(typeItem.getName());
-
- StaticTextItem descriptionItem = new StaticTextItem("descriptionItem", "Description");
- descriptionItem.setValue(resource.getDescription());
- formItems.add(descriptionItem);
- itemIds.add(descriptionItem.getName());
-
-
- StaticTextItem versionItem = new StaticTextItem("versionItem", "Version");
- formItems.add(versionItem);
- itemIds.add(versionItem.getName());
-
-
- StaticTextItem parentItem = new StaticTextItem("parentItem", "Parent");
- formItems.add(parentItem);
- itemIds.add(parentItem.getName());
-
-
- for (MeasurementDefinition trait : traits) {
-
- String id = trait.getDisplayName().replaceAll("\\.", "_").replaceAll(" ", "__");
- itemIds.add(id);
-
- StaticTextItem item = new StaticTextItem(id, trait.getDisplayName());
- item.setTooltip(trait.getDescription());
- formItems.add(item);
-// item.setValue("?");
- }
-
-// SectionItem section = new SectionItem("Summary", "Summary");
-// section.setTitle("Summary");
-// section.setDefaultValue("Summary");
-// section.setCanCollapse(true);
-// section.setCellStyle("HidablePlainSectionHeader");
-// section.setItemIds(itemIds.toArray(new String[itemIds.size()]));
-// formItems.add(0, section);
-
- formItems.add(new SpacerItem());
- setItems(formItems.toArray(new FormItem[formItems.size()]));
-
-
- setValue("typeItem", type.getName() + " (" + type.getPlugin() + ")");
- setValue("descriptionItem", resource.getDescription());
- setValue("versionItem", resource.getVersion());
- setValue("parentItem", resource.getParentResource() == null ? null :
- ("<a href=\"#Resource/" + resource.getParentResource().getId() + "\">" +
- resource.getParentResource().getName() + "</a>"));
-
-
- }
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/overview/ResourceOverviewView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/overview/ResourceOverviewView.java
new file mode 100644
index 0000000..3f5cf5f
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/overview/ResourceOverviewView.java
@@ -0,0 +1,57 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.overview;
+
+import com.smartgwt.client.widgets.layout.VLayout;
+
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
+import org.rhq.enterprise.gui.coregui.client.components.SimpleCollapsiblePanel;
+
+/**
+ * @author Greg Hinkle
+ */
+public class ResourceOverviewView extends VLayout {
+
+ private Resource resource;
+
+
+ public ResourceOverviewView(Resource resource) {
+ this.resource = resource;
+ }
+
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+ ResourceSummaryView summaryView = new ResourceSummaryView();
+ summaryView.onResourceSelected(resource);
+ SimpleCollapsiblePanel summaryPanel = new SimpleCollapsiblePanel("Summary", summaryView);
+
+
+ addMember(summaryPanel);
+
+
+ FullHTMLPane summaryPane = new FullHTMLPane("/rhq/resource/summary/overview-plain.xhtml?id=" + resource.getId());
+ addMember(summaryPane);
+
+
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/overview/ResourceSummaryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/overview/ResourceSummaryView.java
new file mode 100644
index 0000000..c2c2560
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/overview/ResourceSummaryView.java
@@ -0,0 +1,186 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.overview;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.EnumSet;
+import java.util.List;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.util.SC;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.FormItem;
+import com.smartgwt.client.widgets.form.fields.SpacerItem;
+import com.smartgwt.client.widgets.form.fields.StaticTextItem;
+
+import org.rhq.core.domain.measurement.DataType;
+import org.rhq.core.domain.measurement.DisplayType;
+import org.rhq.core.domain.measurement.MeasurementDataTrait;
+import org.rhq.core.domain.measurement.MeasurementDefinition;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+
+/**
+ * @author Greg Hinkle
+ */
+public class ResourceSummaryView extends DynamicForm implements ResourceSelectListener {
+
+ private Resource resource;
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+ setNumCols(4);
+ setWrapItemTitles(false);
+ setLeft("10%");
+ setWidth("80%");
+ }
+
+
+ public void onResourceSelected(Resource resource) {
+
+ this.resource = resource;
+
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(resource.getResourceType().getId(),
+ EnumSet.of(ResourceTypeRepository.MetadataType.measurements),
+ new ResourceTypeRepository.TypeLoadedCallback() {
+ public void onTypesLoaded(ResourceType type) {
+ try {
+ buildForm(type);
+ loadValues();
+ } catch (Exception e) {
+ SC.say("Form load failure");
+ e.printStackTrace();
+ }
+ }
+ });
+
+
+ markForRedraw();
+ }
+
+ private void loadValues() {
+ GWTServiceLookup.getMeasurementDataService().findCurrentTraitsForResource(
+ resource.getId(),
+ DisplayType.SUMMARY,
+ new AsyncCallback<List<MeasurementDataTrait>>() {
+ public void onFailure(Throwable caught) {
+ SC.say("Failed to load traits");
+ CoreGUI.getErrorHandler().handleError("Failed to load traits information for resource",caught);
+ }
+
+ public void onSuccess(List<MeasurementDataTrait> result) {
+ // TODO: Implement this method.
+ for (MeasurementDataTrait trait : result) {
+ String formId = trait.getName().replaceAll("\\.", "_").replaceAll(" ", "__");
+ FormItem item = getItem(formId);
+
+ if (item != null) {
+ setValue(formId, trait.getValue());
+ }
+ }
+ markForRedraw();
+ }
+ }
+ );
+
+ }
+
+ private void buildForm(ResourceType type) {
+ ArrayList<MeasurementDefinition> traits = new ArrayList<MeasurementDefinition>();
+
+ for (MeasurementDefinition measurement : type.getMetricDefinitions()) {
+ if (measurement.getDataType() == DataType.TRAIT && measurement.getDisplayType() == DisplayType.SUMMARY) {
+ traits.add(measurement);
+ }
+ }
+
+ Collections.sort(traits, new Comparator<MeasurementDefinition>() {
+ public int compare(MeasurementDefinition o1, MeasurementDefinition o2) {
+ return new Integer(o1.getDisplayOrder()).compareTo(o2.getDisplayOrder());
+ }
+ });
+
+
+ ArrayList<FormItem> formItems = new ArrayList<FormItem>();
+ ArrayList<String> itemIds = new ArrayList<String>();
+
+
+ StaticTextItem typeItem = new StaticTextItem("typeItem", "Type");
+ typeItem.setTooltip("Plugin: " + type.getPlugin() + "\n<br>" + "Type: " + type.getName());
+ typeItem.setValue(type.getName() + " (" + type.getPlugin() + ")");
+ formItems.add(typeItem);
+ itemIds.add(typeItem.getName());
+
+ StaticTextItem descriptionItem = new StaticTextItem("descriptionItem", "Description");
+ descriptionItem.setValue(resource.getDescription());
+ formItems.add(descriptionItem);
+ itemIds.add(descriptionItem.getName());
+
+
+ StaticTextItem versionItem = new StaticTextItem("versionItem", "Version");
+ formItems.add(versionItem);
+ itemIds.add(versionItem.getName());
+
+
+ StaticTextItem parentItem = new StaticTextItem("parentItem", "Parent");
+ formItems.add(parentItem);
+ itemIds.add(parentItem.getName());
+
+
+ for (MeasurementDefinition trait : traits) {
+
+ String id = trait.getDisplayName().replaceAll("\\.", "_").replaceAll(" ", "__");
+ itemIds.add(id);
+
+ StaticTextItem item = new StaticTextItem(id, trait.getDisplayName());
+ item.setTooltip(trait.getDescription());
+ formItems.add(item);
+// item.setValue("?");
+ }
+
+// SectionItem section = new SectionItem("Summary", "Summary");
+// section.setTitle("Summary");
+// section.setDefaultValue("Summary");
+// section.setCanCollapse(true);
+// section.setCellStyle("HidablePlainSectionHeader");
+// section.setItemIds(itemIds.toArray(new String[itemIds.size()]));
+// formItems.add(0, section);
+
+ formItems.add(new SpacerItem());
+ setItems(formItems.toArray(new FormItem[formItems.size()]));
+
+
+ setValue("typeItem", type.getName() + " (" + type.getPlugin() + ")");
+ setValue("descriptionItem", resource.getDescription());
+ setValue("versionItem", resource.getVersion());
+ setValue("parentItem", resource.getParentResource() == null ? null :
+ ("<a href=\"#Resource/" + resource.getParentResource().getId() + "\">" +
+ resource.getParentResource().getName() + "</a>"));
+
+
+ }
+}
commit 380b61e9546f636950bd8e4458e50055cd8fd9fd
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Wed Mar 24 12:13:42 2010 -0400
Dashboard demo work. summary and discovery queue added
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
index 560935b..35c75be 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
@@ -29,21 +29,25 @@ import com.smartgwt.client.widgets.form.fields.ButtonItem;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.layout.LayoutSpacer;
import com.smartgwt.client.widgets.layout.VLayout;
+
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.RecentlyAddedView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.SmallGraphView;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.discovery.AutodiscoveryQueueDataSource;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.discovery.ResourceAutodiscoveryView;
+import org.rhq.enterprise.gui.coregui.client.inventory.summary.SummaryCountsView;
/**
* @author Greg Hinkle
*/
public class DashboardView extends VLayout {
- private static String[] colors = new String[]{
- "FF6600", "808000", "008000", "008080", "0000FF", "666699",
- "FF0000", "FF9900", "99CC00", "339966", "33CCCC", "3366FF",
- "800080", "969696", "FF00FF", "FFCC00", "FFFF00", "00FF00",
- "00FFFF", "00CCFF", "993366", "C0C0C0", "FF99CC", "FFCC99",
- "FFFF99", "CCFFCC", "CCFFFF", "99CCFF", "CC99FF", "FFFFFF"
- };
+ private static String[] colors = new String[]{
+ "FF6600", "808000", "008000", "008080", "0000FF", "666699",
+ "FF0000", "FF9900", "99CC00", "339966", "33CCCC", "3366FF",
+ "800080", "969696", "FF00FF", "FFCC00", "FFFF00", "00FF00",
+ "00FFFF", "00CCFF", "993366", "C0C0C0", "FF99CC", "FFCC99",
+ "FFFF99", "CCFFCC", "CCFFFF", "99CCFF", "CC99FF", "FFFFFF"
+ };
public DashboardView() {
setOverflow(Overflow.AUTO);
@@ -55,10 +59,25 @@ public class DashboardView extends VLayout {
setHeight100();
- final PortalLayout portalLayout = new PortalLayout(3);
+ final PortalLayout portalLayout = new PortalLayout(2);
portalLayout.setWidth100();
portalLayout.setHeight100();
+
+ Portlet summaryPortlet = new Portlet();
+ summaryPortlet.setTitle("Inventory Summary");
+ summaryPortlet.addItem(new SummaryCountsView());
+ summaryPortlet.setHeight(300);
+ portalLayout.addPortlet(summaryPortlet);
+
+
+ Portlet adPortlet = new Portlet();
+ adPortlet.setTitle("Auto Discovery Queue");
+ adPortlet.addItem(new ResourceAutodiscoveryView(true));
+ adPortlet.setHeight(250);
+ portalLayout.addPortlet(adPortlet);
+
+
// create portlets...
for (int i = 1; i <= 2; i++) {
Portlet portlet = new Portlet();
@@ -69,7 +88,7 @@ public class DashboardView extends VLayout {
// label.setLayoutAlign(VerticalAlignment.CENTER);
// label.setContents("Portlet contents");
// label.setBackgroundColor(colors[Random.nextInt(colors.length - 1)]);
-
+
portlet.addItem(new SmallGraphView());
portlet.setHeight(400);
portalLayout.addPortlet(portlet);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalLayout.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalLayout.java
index a1932b8..1720962 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalLayout.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortalLayout.java
@@ -27,7 +27,11 @@ public class PortalLayout extends HLayout {
public PortalLayout(int numColumns) {
setMembersMargin(6);
for (int i = 0; i < numColumns; i++) {
- addMember(new PortalColumn());
+ PortalColumn column = new PortalColumn();
+ if (i == 0) {
+ column.setWidth("30%");
+ }
+ addMember(column);
}
}
commit 8026166c76593ca6f5a6bc83e59d6766b338ad0c
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Wed Mar 24 12:13:17 2010 -0400
Autodiscovery queue. tree view. import, ignore, unignore buttons
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java
index 5a5e0d4..9fcb5cc 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java
@@ -21,13 +21,18 @@ package org.rhq.enterprise.gui.coregui.client.gwt;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.criteria.ResourceCriteria;
+import org.rhq.core.domain.resource.InventoryStatus;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.composite.RecentlyAddedResourceComposite;
+import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import com.google.gwt.user.client.rpc.RemoteService;
+import java.util.EnumSet;
+import java.util.HashSet;
import java.util.List;
+import java.util.Map;
/**
* @author Greg Hinkle
@@ -48,4 +53,11 @@ public interface ResourceGWTService extends RemoteService {
void createResource(int parentResourceId, int newResourceTypeId, String newResourceName, Configuration newResourceConfiguration);
+ Map<Resource, List<Resource>> getQueuedPlatformsAndServers(HashSet<InventoryStatus> statuses, PageControl pc);
+
+ void importResources(Integer[] resourceIds);
+
+ void ignoreResources(Integer[] resourceIds);
+
+ void unignoreResources(Integer[] resourceIds);
}
\ No newline at end of file
commit 5691f3427c38620b78172f20d6381db5324429eb
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Wed Mar 24 12:12:50 2010 -0400
Autodiscovery queue. tree view. import, ignore, unignore buttons
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 bf580ed..ff6f3ee 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
@@ -27,6 +27,7 @@ import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.admin.roles.RolesView;
import org.rhq.enterprise.gui.coregui.client.admin.users.UsersView;
import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.discovery.ResourceAutodiscoveryView;
import com.smartgwt.client.types.VisibilityMode;
import com.smartgwt.client.widgets.Canvas;
@@ -112,11 +113,11 @@ public class AdministrationView extends HLayout implements ViewRenderer {
Tree tree = new Tree();
final TreeNode manageUsersNode = new TreeNode("Manage Users");
final TreeNode manageRolesNode = new TreeNode("Manage Roles");
- final TreeNode manageGroups = new TreeNode("Resource Groups");
+ final TreeNode discoveryQueue = new TreeNode("Auto Discovery Queue");
tree.setRoot(new TreeNode("security",
manageUsersNode,
manageRolesNode,
- manageGroups));
+ discoveryQueue));
securityTreeGrid.setData(tree);
@@ -128,8 +129,8 @@ public class AdministrationView extends HLayout implements ViewRenderer {
content = new UsersView();
} else if (selectionEvent.getRecord() == manageRolesNode) {
content = new RolesView();
- } else if (selectionEvent.getRecord() == manageGroups) {
- content = new RolesView();
+ } else if (selectionEvent.getRecord() == discoveryQueue) {
+ content = new ResourceAutodiscoveryView();
} else {
throw new IllegalStateException("Unknown record selected: " + selectionEvent.getRecord());
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/AutodiscoveryQueueDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/AutodiscoveryQueueDataSource.java
new file mode 100644
index 0000000..01a5ad3
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/AutodiscoveryQueueDataSource.java
@@ -0,0 +1,221 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.discovery;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.EnumSet;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.data.DataSource;
+import com.smartgwt.client.data.fields.DataSourceTextField;
+import com.smartgwt.client.types.DSDataFormat;
+import com.smartgwt.client.types.DSProtocol;
+import com.smartgwt.client.widgets.tree.TreeNode;
+
+import org.rhq.core.domain.resource.InventoryStatus;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.util.PageControl;
+import org.rhq.core.domain.util.PageOrdering;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
+
+/**
+ * @author Greg Hinkle
+ */
+public class AutodiscoveryQueueDataSource extends DataSource {
+
+
+ private ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();
+
+ public AutodiscoveryQueueDataSource() {
+ setClientOnly(false);
+ setDataProtocol(DSProtocol.CLIENTCUSTOM);
+ setDataFormat(DSDataFormat.CUSTOM);
+
+
+ DataSourceTextField idField = new DataSourceTextField("id", "ID");
+ idField.setPrimaryKey(true);
+
+ DataSourceTextField parentIdField = new DataSourceTextField("parentId", "Parent ID");
+ parentIdField.setForeignKey("id");
+
+ DataSourceTextField resourceNameField = new DataSourceTextField("name", "Resource Name");
+
+ DataSourceTextField resourceKeyField = new DataSourceTextField("resourceKey", "Resource Key");
+
+ DataSourceTextField resourceTypeField = new DataSourceTextField("typeName", "Type");
+
+ DataSourceTextField descriptionField = new DataSourceTextField("description", "Description");
+
+ DataSourceTextField timestampField = new DataSourceTextField("ctime", "Discovery Time");
+
+ DataSourceTextField statusField = new DataSourceTextField("status", "Inventory Status");
+
+ setFields(idField, parentIdField, resourceNameField, resourceKeyField, resourceTypeField, descriptionField, statusField, timestampField);
+ }
+
+ protected Object transformRequest(DSRequest request) {
+ DSResponse response = new DSResponse();
+ response.setAttribute("clientContext", request.getAttributeAsObject("clientContext"));
+ // Asume success
+ response.setStatus(0);
+ switch (request.getOperationType()) {
+ case FETCH:
+ executeFetch(request, response);
+ break;
+ default:
+ break;
+ }
+
+ return request.getData();
+ }
+
+
+ protected void executeFetch(final DSRequest request, final DSResponse response) {
+ PageControl pc = getPageControl(request);
+
+ HashSet<InventoryStatus> statuses = new HashSet<InventoryStatus>();
+
+ String statusesString = request.getCriteria().getAttributeAsString("statuses");
+ if (statusesString != null) {
+ if ("New".equals(statusesString)) {
+ statuses.add(InventoryStatus.NEW);
+ } else if ("Ignored".equals(statusesString)) {
+ statuses.add(InventoryStatus.IGNORED);
+ } else {
+ statuses.add(InventoryStatus.NEW);
+ statuses.add(InventoryStatus.IGNORED);
+ }
+ } else {
+ statuses.add(InventoryStatus.NEW);
+ }
+
+
+ resourceService.getQueuedPlatformsAndServers(statuses, pc,
+ new AsyncCallback<Map<Resource, List<Resource>>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load inventory discovery queue", caught);
+ }
+
+ public void onSuccess(Map<Resource, List<Resource>> result) {
+ response.setData(buildNodes(result));
+ processResponse(request.getRequestId(), response);
+ }
+ });
+ }
+
+
+ private TreeNode[] buildNodes(Map<Resource, List<Resource>> result) {
+
+ ArrayList<ResourceTreeNode> nodes = new ArrayList<ResourceTreeNode>();
+ for (Resource platform : result.keySet()) {
+ nodes.add(new ResourceTreeNode(platform));
+
+ for (Resource child : result.get(platform)) {
+ ResourceTreeNode childNode = new ResourceTreeNode(child);
+ childNode.setIsFolder(false);
+ nodes.add(childNode);
+ }
+ }
+
+ TreeNode[] treeNodes = nodes.toArray(new TreeNode[nodes.size()]);
+ return treeNodes;
+ }
+
+
+ /**
+ * Returns a prepopulated PageControl based on the provided DSRequest. This will set sort fields,
+ * pagination, but *not* filter fields.
+ *
+ * @param request the request to turn into a page control
+ * @return the page control for passing to criteria and other queries
+ */
+ protected PageControl getPageControl(DSRequest request) {
+ // Initialize paging.
+ PageControl pageControl;
+ if (request.getStartRow() == null || request.getEndRow() == null) {
+ pageControl = new PageControl();
+ } else {
+ pageControl = PageControl.getExplicitPageControl(request.getStartRow(), request.getEndRow() - request.getStartRow());
+ }
+
+ // Initialize sorting.
+ String sortBy = request.getAttribute("sortBy");
+ if (sortBy != null) {
+ String[] sorts = sortBy.split(",");
+ for (String sort : sorts) {
+ PageOrdering ordering = (sort.startsWith("-")) ? PageOrdering.DESC : PageOrdering.ASC;
+ String columnName = (ordering == PageOrdering.DESC) ? sort.substring(1) : sort;
+ pageControl.addDefaultOrderingField(columnName, ordering);
+ }
+ }
+
+ return pageControl;
+ }
+
+
+ public static class ResourceTreeNode extends TreeNode {
+
+ private Resource resource;
+
+ private ResourceTreeNode(Resource resource) {
+ this.resource = resource;
+
+ String id = String.valueOf(resource.getId());
+ String parentId = resource.getParentResource() == null ? null
+ : String.valueOf((resource.getParentResource().getId()));
+
+ setID(id);
+ setParentID(parentId);
+
+ setAttribute("id", id);
+ setAttribute("parentId", parentId);
+ setAttribute("name", resource.getName());
+ setAttribute("typeName", resource.getResourceType().getName());
+ setAttribute("resourceKey", resource.getResourceKey());
+ setAttribute("description", resource.getDescription());
+ setAttribute("ctime", new Date(resource.getCtime()));
+ setAttribute("status", resource.getInventoryStatus().name());
+ }
+
+ public Resource getResource() {
+ return resource;
+ }
+
+ public void setResource(Resource resource) {
+ this.resource = resource;
+ }
+
+ public ResourceType getResourceType() {
+ return resource.getResourceType();
+ }
+
+ public String getParentId() {
+ return getAttribute("parentId");
+ }
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
new file mode 100644
index 0000000..6ef0606
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
@@ -0,0 +1,229 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.discovery;
+
+import java.util.ArrayList;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.types.SelectionAppearance;
+import com.smartgwt.client.widgets.HTMLFlow;
+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.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.SelectItem;
+import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
+import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
+import com.smartgwt.client.widgets.grid.events.SelectionEvent;
+import com.smartgwt.client.widgets.layout.HLayout;
+import com.smartgwt.client.widgets.layout.VLayout;
+import com.smartgwt.client.widgets.toolbar.ToolStrip;
+import com.smartgwt.client.widgets.tree.TreeGrid;
+import com.smartgwt.client.widgets.tree.TreeGridField;
+
+import org.rhq.core.domain.resource.InventoryStatus;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+
+/**
+ * @author Greg Hinkle
+ */
+public class ResourceAutodiscoveryView extends VLayout {
+
+ private boolean simple = false;
+ private TreeGrid treeGrid;
+ private ToolStrip footer;
+
+ private ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();
+
+
+ public ResourceAutodiscoveryView() {
+ setWidth100();
+ setHeight100();
+ }
+
+ public ResourceAutodiscoveryView(boolean simple) {
+ this();
+ this.simple = simple;
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+
+ HLayout titleLayout = new HLayout(150);
+
+ HTMLFlow title = new HTMLFlow();
+ title.setWidth100();
+ title.setHeight(35);
+ title.setContents("Auto Discovery Queue");
+ title.setPadding(4);
+ title.setStyleName("HeaderLabel");
+ titleLayout.addMember(title);
+
+
+ DynamicForm form = new DynamicForm();
+ final SelectItem statusSelectItem = new SelectItem("statuses", "Displayed Statuses");
+ statusSelectItem.setValueMap("New", "Ignored", "New and Ignored");
+ statusSelectItem.setValue("New");
+ form.setItems(statusSelectItem);
+ if (!simple)
+ titleLayout.addMember(form);
+
+
+ addMember(titleLayout);
+
+ treeGrid = new TreeGrid();
+
+ treeGrid.setHeight100();
+
+ treeGrid.setDataSource(new AutodiscoveryQueueDataSource());
+ treeGrid.setAutoFetchData(true);
+ treeGrid.setTitle("Auto Discovery Queue");
+ treeGrid.setResizeFieldsInRealTime(true);
+
+ final TreeGridField name, key, type, description, status, ctime;
+ name = new TreeGridField("name");
+ key = new TreeGridField("resourceKey");
+ type = new TreeGridField("typeName");
+ description = new TreeGridField("description");
+ status = new TreeGridField("status");
+ ctime = new TreeGridField("ctime");
+
+ if (!simple) {
+ treeGrid.setFields(name, key, type, description, status, ctime);
+ } else {
+ treeGrid.setFields(name, key, type, status);
+ }
+
+ treeGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
+ treeGrid.setShowSelectedStyle(false);
+ treeGrid.setShowPartialSelection(true);
+ treeGrid.setCascadeSelection(true);
+
+
+ addMember(treeGrid);
+
+ footer = new ToolStrip();
+ footer.setPadding(5);
+ footer.setWidth100();
+ footer.setMembersMargin(15);
+
+ addMember(footer);
+
+
+ final IButton importButton = new IButton("Import");
+ final IButton ignoreButton = new IButton("Ignore");
+ final IButton unignoreButton = new IButton("Unignore");
+
+
+ footer.addMember(importButton);
+ footer.addMember(ignoreButton);
+ footer.addMember(unignoreButton);
+
+
+ importButton.setDisabled(true);
+ ignoreButton.setDisabled(true);
+ unignoreButton.setDisabled(true);
+
+ treeGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
+ public void onSelectionChanged(SelectionEvent selectionEvent) {
+ boolean noneSelected = treeGrid.getSelection().length == 0;
+ importButton.setDisabled(noneSelected);
+ ignoreButton.setDisabled(noneSelected);
+ unignoreButton.setDisabled(noneSelected);
+ }
+ });
+
+
+ importButton.addClickHandler(
+ new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ resourceService.importResources(getSelectedIds(), new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to import resources", caught);
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(new Message("Successfully imported the selected resources", Message.Severity.Info));
+ treeGrid.invalidateCache();
+ }
+ });
+ }
+ }
+ );
+
+
+ ignoreButton.addClickHandler(
+ new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ resourceService.ignoreResources(getSelectedIds(), new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to ignore resources", caught);
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(new Message("Successfully ignored the selected resources", Message.Severity.Info));
+ treeGrid.invalidateCache();
+ }
+ });
+ }
+ }
+ );
+
+ unignoreButton.addClickHandler(
+ new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ resourceService.unignoreResources(getSelectedIds(), new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to unignore resources", caught);
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(new Message("Successfully unignored the selected resources", Message.Severity.Info));
+ treeGrid.invalidateCache();
+ }
+ });
+ }
+ }
+ );
+
+ statusSelectItem.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent changedEvent) {
+ treeGrid.fetchData(new Criteria("statuses", (String) statusSelectItem.getValue()));
+ }
+ });
+ }
+
+ private Integer[] getSelectedIds() {
+ ArrayList<Integer> selected = new ArrayList<Integer>();
+ for (ListGridRecord node : treeGrid.getSelection()) {
+ if (!InventoryStatus.COMMITTED.name().equals(node.getAttributeAsString("status"))) {
+ selected.add(Integer.parseInt(node.getAttributeAsString("id")));
+ }
+ }
+ return selected.toArray(new Integer[selected.size()]);
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
index 484b434..3434a67 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
@@ -18,16 +18,20 @@
*/
package org.rhq.enterprise.gui.coregui.server.gwt;
+import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.RawConfiguration;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.configuration.definition.ConfigurationTemplate;
import org.rhq.core.domain.criteria.ResourceCriteria;
+import org.rhq.core.domain.resource.InventoryStatus;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.composite.RecentlyAddedResourceComposite;
+import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTService;
import org.rhq.enterprise.gui.coregui.server.util.SerialUtility;
+import org.rhq.enterprise.server.discovery.DiscoveryBossLocal;
import org.rhq.enterprise.server.resource.ResourceFactoryManagerLocal;
import org.rhq.enterprise.server.resource.ResourceManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
@@ -37,8 +41,10 @@ import javax.servlet.ServletException;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.EnumSet;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Set;
/**
@@ -48,7 +54,7 @@ public class ResourceGWTServiceImpl extends AbstractGWTServiceImpl implements Re
private ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();
private ResourceFactoryManagerLocal resourceFactoryManager = LookupUtil.getResourceFactoryManager();
-
+ private DiscoveryBossLocal discoveryBoss = LookupUtil.getDiscoveryBoss();
private static String[] importantFields = {
"serialVersionUID",
@@ -178,4 +184,27 @@ public class ResourceGWTServiceImpl extends AbstractGWTServiceImpl implements Re
}
+
+ public Map<Resource, List<Resource>> getQueuedPlatformsAndServers(HashSet<InventoryStatus> statuses, PageControl pc) {
+ return SerialUtility.prepare(
+ discoveryBoss.getQueuedPlatformsAndServers(
+ getSessionSubject(),
+ EnumSet.copyOf(statuses),
+ pc),
+ "ResoruceService.getQueuedPlatformsAndServers");
+ }
+
+ public void importResources(Integer[] resourceIds) {
+ discoveryBoss.importResources(getSessionSubject(), resourceIds);
+ }
+
+ public void ignoreResources(Integer[] resourceIds) {
+ discoveryBoss.ignoreResources(getSessionSubject(), resourceIds);
+ }
+
+ public void unignoreResources(Integer[] resourceIds) {
+ discoveryBoss.unignoreResources(getSessionSubject(), resourceIds);
+ }
+
+
}
\ No newline at end of file
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
index 0597c7a..8864505 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
@@ -164,28 +164,31 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot
return syncInfo;
}
+
@RequiredPermission(Permission.MANAGE_INVENTORY)
public Map<Resource, List<Resource>> getQueuedPlatformsAndServers(Subject user, PageControl pc) {
+ return getQueuedPlatformsAndServers(user, EnumSet.of(InventoryStatus.NEW), pc);
+ }
+
+ @RequiredPermission(Permission.MANAGE_INVENTORY)
+ public Map<Resource, List<Resource>> getQueuedPlatformsAndServers(Subject user, EnumSet<InventoryStatus> statuses, PageControl pc) {
// pc.initDefaultOrderingField("res.ctime", PageOrdering.DESC); // this is set in getQueuedPlatforms,
// maps a platform to a list of child servers
Map<Resource, List<Resource>> queuedResources = new HashMap<Resource, List<Resource>>();
- List<Resource> queuedPlatforms = getQueuedPlatforms(user, EnumSet.of(InventoryStatus.NEW), pc);
+ List<Resource> queuedPlatforms = getQueuedPlatforms(user, statuses, pc);
for (Resource platform : queuedPlatforms) {
- List<Resource> queuedServers = getQueuedPlatformChildServers(user, InventoryStatus.NEW, platform);
-
- ArrayList<Resource> servers = new ArrayList<Resource>();
- for (Resource server : queuedServers) {
- servers.add(server);
+ List<Resource> queuedServers = new ArrayList<Resource>();
+ for (InventoryStatus status : statuses) {
+ queuedServers.addAll(getQueuedPlatformChildServers(user, status, platform));
}
-
- queuedResources.put(platform, servers);
+ queuedResources.put(platform, queuedServers);
}
-
return queuedResources;
}
+
@RequiredPermission(Permission.MANAGE_INVENTORY)
@SuppressWarnings("unchecked")
public PageList<Resource> getQueuedPlatforms(Subject user, EnumSet<InventoryStatus> statuses, PageControl pc) {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossLocal.java
index ad85062..c29833f 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossLocal.java
@@ -71,6 +71,16 @@ public interface DiscoveryBossLocal {
*/
Map<Resource, List<Resource>> getQueuedPlatformsAndServers(Subject user, PageControl pc);
+
+ /**
+ * Like the above method, but can find ignored, commited or both
+ * @param user
+ * @param statuses
+ * @param pc
+ * @return
+ */
+ Map<Resource, List<Resource>> getQueuedPlatformsAndServers(Subject user, EnumSet<InventoryStatus> statuses, PageControl pc);
+
/**
* This returns all platform resources that either have the given status themselves or one or more of their child
* servers have that status. Use this to find those platforms that need to be shown in the auto-discovery pages
commit 7bd4d3a695ec940ec69d7c363573249f0d890f56
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Wed Mar 24 12:11:42 2010 -0400
Support for filtering resource list by resourceTypeId
Fixed bug in criteria resourceTypeId should be int, not string
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
index e5534dc..69be135 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
@@ -50,7 +50,7 @@ public class ResourceCriteria extends Criteria {
private InventoryStatus filterInventoryStatus = InventoryStatus.COMMITTED; // default
private String filterVersion;
private String filterDescription;
- private String filterResourceTypeId; // needs overrides
+ private Integer filterResourceTypeId; // needs overrides
private String filterResourceTypeName; // needs overrides
private ResourceCategory filterResourceCategory; // needs overrides
private String filterPluginName; // needs overrides
@@ -146,7 +146,7 @@ public class ResourceCriteria extends Criteria {
this.filterDescription = filterDescription;
}
- public void addFilterResourceTypeId(String filterResourceTypeId) {
+ public void addFilterResourceTypeId(Integer filterResourceTypeId) {
this.filterResourceTypeId = filterResourceTypeId;
}
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 89bee8b..d465cb8 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
@@ -53,6 +53,10 @@ public class ResourceDatasource extends RPCDataSource<Resource> {
DataSourceField idDataField = new DataSourceIntegerField("id", "ID", 20);
idDataField.setPrimaryKey(true);
+
+ DataSourceImageField iconField = new DataSourceImageField("icon");
+ iconField.setImageURLPrefix("types/");
+
DataSourceTextField nameDataField = new DataSourceTextField("name", "Name", 200);
nameDataField.setCanEdit(false);
@@ -67,7 +71,7 @@ public class ResourceDatasource extends RPCDataSource<Resource> {
availabilityDataField.setCanEdit(false);
- setFields(idDataField, nameDataField, descriptionDataField, typeNameDataField, pluginNameDataField,
+ setFields(idDataField, iconField, nameDataField, descriptionDataField, typeNameDataField, pluginNameDataField,
categoryDataField, availabilityDataField);
}
@@ -104,6 +108,10 @@ public class ResourceDatasource extends RPCDataSource<Resource> {
.get("availability")).toUpperCase()));
}
+ if (request.getCriteria().getValues().get("type") != null) {
+ criteria.addFilterResourceTypeId(Integer.parseInt(((String)request.getCriteria().getValues().get("type"))));
+ }
+
resourceService.findResourcesByCriteria(criteria, new AsyncCallback<PageList<Resource>>() {
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError("Failed to fetch resource data", caught);
@@ -138,6 +146,9 @@ public class ResourceDatasource extends RPCDataSource<Resource> {
record.setAttribute("typeName", from.getResourceType().getName());
record.setAttribute("pluginName", from.getResourceType().getPlugin());
record.setAttribute("category", from.getResourceType().getCategory().getDisplayName());
+ record.setAttribute("icon", from.getResourceType().getCategory().getDisplayName() + "_" +
+ (from.getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP ? "up" : "down") + "_16.png");
+
record
.setAttribute(
commit 5eef84472eb5d226fd99af92f48ed38240b51ed2
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Mon Mar 22 16:17:14 2010 -0400
Cleanup experiment with embedding gwt in jsf
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/discovery/queue.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/discovery/queue.xhtml
index c283940..0025417 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/discovery/queue.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/discovery/queue.xhtml
@@ -28,10 +28,6 @@
</ui:define>
<ui:define name="body">
-
-
- <iframe src="/coregui/CoreGUI.html"></iframe>
-
<script language="JavaScript" type="text/javascript">
commit 71e1218efc9e0c4d0928a01a526650125853811f
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Sat Mar 20 18:38:57 2010 -0400
cleanup menu more
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
index 0990111..caf4ffb 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
@@ -43,7 +43,7 @@ public class MenuBarView extends VLayout {
private String selected = "Dashboard";
- HTMLFlow linksPane;
+ private HTMLFlow linksPane;
public MenuBarView() {
super(5);
@@ -135,23 +135,21 @@ public class MenuBarView extends VLayout {
boolean first = true;
for (String section : SECTIONS) {
if (first) {
- headerString.append("<td style=\"width: 1px;\"><img src=\"http://localhost:7080/coregui/images/header/header_bg_line.png\"/></td>");
+ headerString.append("<td style=\"width: 1px;\"><img src=\"images/header/header_bg_line.png\"/></td>");
}
first = false;
- String bg = "";
String styleClass = "TopSectionLink";
if (section.equals(selected)) {
- bg = " background-image: url('http://localhost:7080/coregui/images/header/header_bg_selected.png');";
styleClass += "Selected";
}
- headerString.append("<td style=\"vertical-align: bottom; padding:5px; padding-left: 15px; padding-right: 15px;" + bg + "\"onclick=\"document.location='#" + section + "'\" >");
- headerString.append("<a class=\"" + styleClass + "\" href=\"#" + section + "\">" + section + "</a>");
+ headerString.append("<td class=\"" + styleClass + "\" onclick=\"document.location='#" + section + "'\" >");
+ headerString.append(section);
headerString.append("</td>\n");
- headerString.append("<td style=\"width: 1px;\"><img src=\"http://localhost:7080/coregui/images/header/header_bg_line.png\"/></td>");
+ headerString.append("<td style=\"width: 1px;\"><img src=\"images/header/header_bg_line.png\"/></td>");
}
headerString.append("</tr></table>");
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css
index dcd511f..63c2089 100644
--- a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css
+++ b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css
@@ -96,17 +96,21 @@ a:hover {
}
-A.TopSectionLink {
+.TopSectionLink, .topsectionlinkselected {
+ vertical-align: bottom;
+ padding:5px;
+ padding-left: 15px;
+ padding-right: 15px;
+
+ cursor: pointer;
font-size: 10pt;
font-weight: bold;
text-decoration: none;
- color: black;
+ color: #4A5D75;
}
-A.TopSectionLinkSelected {
- font-size: 10pt;
- font-weight: bold;
- text-decoration: none;
+.TopSectionLinkSelected {
+ background-image: url('images/header/header_bg_selected.png');
color: white;
}
commit e6979c22719a31de9a7792ea57802f44800b21ca
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 24 13:42:05 2010 -0400
get the finish button to close the wizard; remove isNext/Previous methods - they are obsolete/no longer needed
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployDefinitionInfoStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployDefinitionInfoStep.java
index ceda488..ef3afb6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployDefinitionInfoStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployDefinitionInfoStep.java
@@ -82,8 +82,4 @@ public class BundleDeployDefinitionInfoStep implements WizardStep {
public boolean nextPage() {
return form.validate();
}
-
- public boolean isPreviousEnabled() {
- return false;
- }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/CreateConfigStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/CreateConfigStep.java
index 8b8f46e..7456625 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/CreateConfigStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/CreateConfigStep.java
@@ -54,12 +54,4 @@ public class CreateConfigStep implements WizardStep {
wizard.setConfig(editor.getConfiguration());
return true;
}
-
- public boolean isPreviousEnabled() {
- return true;
- }
-
- public boolean isNextEnabled() {
- return true;
- }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployNowStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployNowStep.java
index 55d1a7f..aacf46f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployNowStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployNowStep.java
@@ -73,8 +73,4 @@ public class DeployNowStep implements WizardStep {
public boolean nextPage() {
return form.validate();
}
-
- public boolean isPreviousEnabled() {
- return true;
- }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java
index f06e278..bf3b8b1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java
@@ -116,15 +116,7 @@ public class DeployStep implements WizardStep {
return canvas;
}
- public boolean isNextEnabled() {
- return false;
- }
-
- public boolean isPreviousEnabled() {
- return true;
- }
-
public boolean nextPage() {
- return false;
+ return true;
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleVersionStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleVersionStep.java
index 0b71de1..52f7c5b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleVersionStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleVersionStep.java
@@ -148,14 +148,6 @@ public class SelectBundleVersionStep implements WizardStep {
}
public boolean nextPage() {
- return form.validate();
- }
-
- public boolean isNextEnabled() {
- return (null != this.wizard.getBundleVersion());
- }
-
- public boolean isPreviousEnabled() {
- return false;
+ return form.validate() && (null != this.wizard.getBundleVersion());
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectPlatformsStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectPlatformsStep.java
index 94a4707..1e38fab 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectPlatformsStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectPlatformsStep.java
@@ -68,8 +68,4 @@ public class SelectPlatformsStep implements WizardStep {
public boolean nextPage() {
return form.validate();
}
-
- public boolean isPreviousEnabled() {
- return true;
- }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectTemplateStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectTemplateStep.java
index ffc6adc..64efeaa 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectTemplateStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectTemplateStep.java
@@ -86,8 +86,4 @@ public class SelectTemplateStep implements WizardStep {
public boolean nextPage() {
return form.validate();
}
-
- public boolean isPreviousEnabled() {
- return true;
- }
}
commit 5fc81509e8651a7fd52c1883f57d6af990c5eaba
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 24 03:03:16 2010 -0400
finishing up create bundle wizard. the summary page is almost done - can't get the vlayout of the file list to look right, need to fix that
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleSummaryStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleSummaryStep.java
index bddf61b..a0c565b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleSummaryStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleSummaryStep.java
@@ -18,12 +18,12 @@
*/
package org.rhq.enterprise.gui.coregui.client.bundle.create;
-import com.smartgwt.client.types.Alignment;
-import com.smartgwt.client.types.TitleOrientation;
+import com.google.gwt.user.client.ui.HasHorizontalAlignment;
+import com.google.gwt.user.client.ui.Label;
import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.form.DynamicForm;
-import com.smartgwt.client.widgets.form.fields.TextAreaItem;
-import com.smartgwt.client.widgets.form.fields.TextItem;
+import com.smartgwt.client.widgets.layout.HLayout;
+import com.smartgwt.client.widgets.layout.LayoutSpacer;
+import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
@@ -32,7 +32,6 @@ import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
*/
public class BundleSummaryStep implements WizardStep {
- private DynamicForm form;
private final AbstractBundleCreateWizard wizard;
public BundleSummaryStep(AbstractBundleCreateWizard bundleCreationWizard) {
@@ -40,41 +39,92 @@ public class BundleSummaryStep implements WizardStep {
}
public Canvas getCanvas() {
- TextItem nameTextItem;
- TextItem versionTextItem;
- TextAreaItem descriptionTextAreaItem;
- TextItem bundleTypeTextItem;
- form = new DynamicForm();
- form.setPadding(20);
- form.setWidth100();
- form.setNumCols(2);
+ VLayout top = new VLayout();
+ top.setAutoHeight();
+ top.setPadding(20);
+ top.setWidth100();
- bundleTypeTextItem = new TextItem("bundleTypeItem", "Bundle Type");
- bundleTypeTextItem.setValue(wizard.getBundleType().getName());
- bundleTypeTextItem.setDisabled(true);
- bundleTypeTextItem.setTitleAlign(Alignment.LEFT);
+ HLayout bundleTypeBox = new HLayout();
+ bundleTypeBox.setWidth100();
+ bundleTypeBox.setExtraSpace(10);
+ Label bundleTypeLabel = new Label("Type:");
+ bundleTypeLabel.setWidth("10%");
+ bundleTypeLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
+ bundleTypeLabel.setWordWrap(false);
+ Label bundleTypeValue = new Label(wizard.getBundleType().getName());
+ bundleTypeValue.setWidth("90%");
+ bundleTypeValue.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
+ bundleTypeBox.addMember(bundleTypeLabel);
+ bundleTypeBox.addMember(bundleTypeValue);
+ top.addMember(bundleTypeBox);
- nameTextItem = new TextItem("name", "Name");
- nameTextItem.setValue(wizard.getBundleName());
- nameTextItem.setDisabled(true);
- nameTextItem.setTitleAlign(Alignment.LEFT);
+ HLayout nameBox = new HLayout();
+ nameBox.setWidth100();
+ nameBox.setExtraSpace(10);
+ Label nameLabel = new Label("Name:");
+ nameLabel.setWidth("10%");
+ nameLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
+ nameLabel.setWordWrap(false);
+ Label nameValue = new Label(wizard.getBundleName());
+ nameValue.setWidth("90%");
+ nameValue.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
+ nameBox.addMember(nameLabel);
+ nameBox.addMember(nameValue);
+ top.addMember(nameBox);
+ top.addMember(new LayoutSpacer());
- versionTextItem = new TextItem("version", "Version");
- versionTextItem.setValue(wizard.getBundleVersionString());
- versionTextItem.setDisabled(true);
- versionTextItem.setTitleAlign(Alignment.LEFT);
+ HLayout versionBox = new HLayout();
+ versionBox.setWidth100();
+ versionBox.setExtraSpace(10);
+ Label versionLabel = new Label("Version:");
+ versionLabel.setWidth("10%");
+ versionLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
+ versionLabel.setWordWrap(false);
+ Label versionValue = new Label(wizard.getBundleVersionString());
+ versionValue.setWidth("90%");
+ versionValue.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
+ versionBox.addMember(versionLabel);
+ versionBox.addMember(versionValue);
+ top.addMember(versionBox);
+ top.addMember(new LayoutSpacer());
- descriptionTextAreaItem = new TextAreaItem("description", "Description");
- descriptionTextAreaItem.setValue(wizard.getBundleDescription());
- descriptionTextAreaItem.setDisabled(true);
- descriptionTextAreaItem.setTitleOrientation(TitleOrientation.TOP);
- descriptionTextAreaItem.setColSpan(2);
- descriptionTextAreaItem.setWidth(300);
+ HLayout descriptionBox = new HLayout();
+ descriptionBox.setWidth100();
+ descriptionBox.setExtraSpace(10);
+ Label descriptionLabel = new Label("Description:");
+ descriptionLabel.setWidth("10%");
+ descriptionLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
+ descriptionLabel.setWordWrap(false);
+ Label descriptionValue = new Label(wizard.getBundleDescription());
+ descriptionValue.setWidth("90%");
+ descriptionValue.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
+ descriptionBox.addMember(descriptionLabel);
+ descriptionBox.addMember(descriptionValue);
+ top.addMember(descriptionBox);
+ top.addMember(new LayoutSpacer());
- form.setItems(bundleTypeTextItem, nameTextItem, versionTextItem, descriptionTextAreaItem);
+ HLayout filesBox = new HLayout();
+ filesBox.setWidth100();
+ filesBox.setExtraSpace(10);
+ Label filesLabel = new Label("Files:");
+ filesLabel.setWidth("10%");
+ filesLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
+ filesLabel.setWordWrap(false);
+ VLayout filesValues = new VLayout();
+ filesValues.setWidth("90%");
+ filesValues.setAutoHeight();
+ for (String filename : wizard.getAllBundleFilesStatus().keySet()) {
+ Label fileNameValue = new Label(filename);
+ fileNameValue.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
+ fileNameValue.setWordWrap(false);
+ filesValues.addMember(fileNameValue);
+ }
+ filesBox.addMember(filesLabel);
+ filesBox.addMember(filesValues);
+ top.addMember(filesBox);
- return form;
+ return top;
}
public boolean nextPage() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
index d702b9b..cf0d561 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
@@ -25,7 +25,11 @@ import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.bundle.Bundle;
+import org.rhq.core.domain.bundle.BundleVersion;
import org.rhq.core.domain.bundle.composite.BundleWithLatestVersionComposite;
+import org.rhq.core.domain.criteria.BundleCriteria;
+import org.rhq.core.domain.criteria.BundleVersionCriteria;
+import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.bundle.create.BundleCreateWizard;
import org.rhq.enterprise.gui.coregui.client.bundle.create.BundleUpdateWizard;
@@ -59,14 +63,14 @@ public class BundlesListView extends VLayout {
table.getListGrid().setSelectionType(SelectionStyle.SIMPLE);
table.getListGrid().setSelectionAppearance(SelectionAppearance.CHECKBOX);
- table.addTableAction("Create Bundle", Table.SelectionEnablement.ALWAYS, null, new TableAction() {
+ table.addTableAction("Create New Bundle", Table.SelectionEnablement.ALWAYS, null, new TableAction() {
public void executeAction(ListGridRecord[] selection) {
new BundleCreateWizard().startBundleWizard();
}
});
- table.addTableAction("Delete Bundle", Table.SelectionEnablement.ANY, "Are You Sure?", new TableAction() {
+ table.addTableAction("Delete", Table.SelectionEnablement.ANY, "Are You Sure?", new TableAction() {
public void executeAction(ListGridRecord[] selections) {
BundlesWithLatestVersionDataSource ds = (BundlesWithLatestVersionDataSource) table.getDataSource();
for (ListGridRecord selection : selections) {
@@ -87,17 +91,58 @@ public class BundlesListView extends VLayout {
}
});
- table.addTableAction("Update Bundle", Table.SelectionEnablement.SINGLE, null, new TableAction() {
+ table.addTableAction("Create New Version", Table.SelectionEnablement.SINGLE, null, new TableAction() {
public void executeAction(ListGridRecord[] selection) {
- Bundle bundle = (Bundle) selection[0].getAttributeAsObject("entity");
- BundleUpdateWizard bundleUpdateWizard = new BundleUpdateWizard(null);
- bundleUpdateWizard.startBundleWizard();
+ BundlesWithLatestVersionDataSource ds = (BundlesWithLatestVersionDataSource) table.getDataSource();
+ final BundleWithLatestVersionComposite object = ds.copyValues(selection[0]);
+ BundleVersionCriteria bvc = new BundleVersionCriteria();
+ bvc.addFilterBundleId(object.getBundleId());
+ bvc.addFilterVersion(object.getLatestVersion());
+ BundleGWTServiceAsync bundleManager = GWTServiceLookup.getBundleService();
+ bundleManager.findBundleVersionsByCriteria(bvc, new AsyncCallback<PageList<BundleVersion>>() {
+ public void onSuccess(PageList<BundleVersion> result) {
+ if (result == null || result.size() != 1) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("Failed to get last bundle version [" + object.getLatestVersion() + "]",
+ Severity.Error));
+ return;
+ }
+
+ BundleUpdateWizard bundleUpdateWizard = new BundleUpdateWizard(result.get(0));
+ bundleUpdateWizard.startBundleWizard();
+ }
+
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+ "Failed to load last bundle version [" + object.getLatestVersion() + "]", caught);
+ }
+ });
}
});
- table.addTableAction("Deploy Selected Bundle", Table.SelectionEnablement.SINGLE, null, new TableAction() {
+ table.addTableAction("Deploy", Table.SelectionEnablement.SINGLE, null, new TableAction() {
public void executeAction(ListGridRecord[] selection) {
- new BundleDeployWizard((Bundle) selection[0].getAttributeAsObject("object")).startBundleWizard();
+ BundlesWithLatestVersionDataSource ds = (BundlesWithLatestVersionDataSource) table.getDataSource();
+ final BundleWithLatestVersionComposite object = ds.copyValues(selection[0]);
+ BundleCriteria bc = new BundleCriteria();
+ bc.addFilterId(object.getBundleId());
+ BundleGWTServiceAsync bundleManager = GWTServiceLookup.getBundleService();
+ bundleManager.findBundlesByCriteria(bc, new AsyncCallback<PageList<Bundle>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+ "Failed to load bundle to deploy [" + object.getBundleName() + "]", caught);
+ }
+
+ public void onSuccess(PageList<Bundle> result) {
+ if (result == null || result.size() != 1) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("Failed to get bundle to deploy [" + object.getBundleName() + "]",
+ Severity.Error));
+ return;
+ }
+ new BundleDeployWizard(result.get(0)).startBundleWizard();
+ }
+ });
}
});
commit ea7f26cca66aa0849c5613fad2ec73144f72b0a2
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 24 03:02:22 2010 -0400
was seeing erroneous behavior when deleting bundles - changing impl and added unit test
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleVersion.java b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleVersion.java
index 3c74dfe..e3b7520 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleVersion.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleVersion.java
@@ -70,7 +70,8 @@ import org.rhq.core.domain.content.Distribution;
+ " WHERE bv.bundle.id = :bundleId " //
+ " ORDER BY bv.versionOrder DESC "), //
@NamedQuery(name = BundleVersion.QUERY_FIND_ALL, query = "SELECT bv FROM BundleVersion bv "), //
- @NamedQuery(name = BundleVersion.QUERY_FIND_BY_NAME, query = "SELECT bv FROM BundleVersion bv WHERE bv.name = :name ") //
+ @NamedQuery(name = BundleVersion.QUERY_FIND_BY_NAME, query = "SELECT bv FROM BundleVersion bv WHERE bv.name = :name "), //
+ @NamedQuery(name = BundleVersion.QUERY_FIND_BY_BUNDLE_ID, query = "SELECT bv FROM BundleVersion bv WHERE bv.bundle.id = :bundleId ") //
})
@SequenceGenerator(name = "SEQ", sequenceName = "RHQ_BUNDLE_VERSION_ID_SEQ")
@Table(name = "RHQ_BUNDLE_VERSION")
@@ -83,6 +84,7 @@ public class BundleVersion implements Serializable {
public static final String QUERY_FIND_VERSION_INFO_BY_BUNDLE_ID = "BundleVersion.findVersionsByBundleId";
public static final String QUERY_FIND_ALL = "BundleVersion.findAll";
public static final String QUERY_FIND_BY_NAME = "BundleVersion.findByName";
+ public static final String QUERY_FIND_BY_BUNDLE_ID = "BundleVersion.findByBundleId";
@Column(name = "ID", nullable = false)
@GeneratedValue(strategy = GenerationType.AUTO, generator = "SEQ")
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
index e52e3b6..a6be5ca 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
@@ -673,7 +673,10 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
return;
}
- for (BundleVersion bv : bundle.getBundleVersions()) {
+ Query q = entityManager.createNamedQuery(BundleVersion.QUERY_FIND_BY_BUNDLE_ID);
+ q.setParameter("bundleId", bundleId);
+ List<BundleVersion> bvs = q.getResultList();
+ for (BundleVersion bv : bvs) {
bundleManager.deleteBundleVersion(subject, bv.getId(), false);
}
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
index 0d99b17..c975d38 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
@@ -271,6 +271,35 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
}
@Test(enabled = TESTS_ENABLED)
+ public void testDeleteBundle() throws Exception {
+ Bundle b1 = createBundle("one");
+ assertNotNull(b1);
+ BundleVersion bv1 = createBundleVersion(b1.getName() + "-1", null, b1);
+ assertNotNull(bv1);
+ assertEquals("1.0", bv1.getVersion());
+ BundleVersion bv2 = createBundleVersion(b1.getName() + "-2", null, b1);
+ assertNotNull(bv2);
+ assertEquals("1.1", bv2.getVersion());
+
+ // let's add a bundle file so we can ensure our deletion will also delete the file too
+ bundleManager.addBundleFileViaByteArray(overlord, bv2.getId(), "testDeleteBundle", "1.0", new Architecture(
+ "noarch"), "content".getBytes(), false);
+ BundleFileCriteria bfCriteria = new BundleFileCriteria();
+ bfCriteria.addFilterBundleVersionId(bv2.getId());
+ bfCriteria.fetchPackageVersion(true);
+ PageList<BundleFile> files = bundleManager.findBundleFilesByCriteria(overlord, bfCriteria);
+ assert files.size() == 1 : files;
+ assert files.get(0).getPackageVersion().getGeneralPackage().getName().equals("testDeleteBundle") : files;
+
+ bundleManager.deleteBundle(overlord, b1.getId());
+
+ BundleCriteria bCriteria = new BundleCriteria();
+ bCriteria.addFilterId(b1.getId());
+ PageList<Bundle> bResults = bundleManager.findBundlesByCriteria(overlord, bCriteria);
+ assert bResults.size() == 0;
+ }
+
+ @Test(enabled = TESTS_ENABLED)
public void testDeleteBundleVersion() throws Exception {
Bundle b1 = createBundle("one");
assertNotNull(b1);
@@ -282,14 +311,14 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
assertEquals("1.1", bv2.getVersion());
// let's add a bundle file so we can ensure our deletion will also delete the file too
- bundleManager.addBundleFileViaByteArray(overlord, bv2.getId(), "testfile", "1.0", new Architecture("noarch"),
- "content".getBytes(), false);
+ bundleManager.addBundleFileViaByteArray(overlord, bv2.getId(), "testDeleteBundleVersion", "1.0",
+ new Architecture("noarch"), "content".getBytes(), false);
BundleFileCriteria bfCriteria = new BundleFileCriteria();
bfCriteria.addFilterBundleVersionId(bv2.getId());
bfCriteria.fetchPackageVersion(true);
PageList<BundleFile> files = bundleManager.findBundleFilesByCriteria(overlord, bfCriteria);
assert files.size() == 1 : files;
- assert files.get(0).getPackageVersion().getGeneralPackage().getName().equals("testfile") : files;
+ assert files.get(0).getPackageVersion().getGeneralPackage().getName().equals("testDeleteBundleVersion") : files;
BundleVersionCriteria bvCriteria = new BundleVersionCriteria();
BundleCriteria bCriteria = new BundleCriteria();
commit 96029cb050daaa619cf97053191df67aefc91955
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 24 01:19:18 2010 -0400
don't refresh title if the view hasn't been rendered yet
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/AbstractBundleWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/AbstractBundleWizard.java
index afd1f47..7bacb3b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/AbstractBundleWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/AbstractBundleWizard.java
@@ -58,7 +58,9 @@ public abstract class AbstractBundleWizard implements Wizard {
public void setSubtitle(String subtitle) {
this.subtitle = subtitle;
- this.view.refreshTitleLabelContents();
+ if (this.view != null) {
+ this.view.refreshTitleLabelContents();
+ }
}
public List<WizardStep> getSteps() {
commit f799588e682c83802916a9cd8f117265402837d4
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 24 00:49:05 2010 -0400
get end-to-end bundle create wizard to work. still need to pretty up the upload file step, but this commit has end-to-end working with the ability to cancel at any point in the wizard
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/AbstractBundleCreateWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/AbstractBundleCreateWizard.java
index 01e2598..c33e4d5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/AbstractBundleCreateWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/AbstractBundleCreateWizard.java
@@ -18,6 +18,8 @@
*/
package org.rhq.enterprise.gui.coregui.client.bundle.create;
+import java.util.HashMap;
+
import com.google.gwt.user.client.rpc.AsyncCallback;
import org.rhq.core.domain.bundle.BundleType;
@@ -38,6 +40,7 @@ public abstract class AbstractBundleCreateWizard extends AbstractBundleWizard {
private String bundleDescription;
private String recipe;
private BundleVersion bundleVersion;
+ private HashMap<String, Boolean> allBundleFilesStatus; // bundle file names with their upload status (true=they were uploaded)
public BundleType getBundleType() {
return bundleType;
@@ -87,12 +90,20 @@ public abstract class AbstractBundleCreateWizard extends AbstractBundleWizard {
this.bundleVersion = bv;
}
+ public HashMap<String, Boolean> getAllBundleFilesStatus() {
+ return allBundleFilesStatus;
+ }
+
+ public void setAllBundleFilesStatus(HashMap<String, Boolean> allBundleFilesStatus) {
+ this.allBundleFilesStatus = allBundleFilesStatus;
+ }
+
public void cancel() {
final BundleVersion bv = getBundleVersion();
if (bv != null) {
// the user must have created it already after verification step, delete it
BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
- bundleServer.deleteBundleVersion(bv.getId(), new AsyncCallback<Void>() {
+ bundleServer.deleteBundleVersion(bv.getId(), true, new AsyncCallback<Void>() {
public void onSuccess(Void result) {
CoreGUI.getMessageCenter().notify(
new Message("Canceled bundle [" + bv.getName() + "] version [" + bv.getVersion() + "]",
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreateWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreateWizard.java
index e76dc7f..43f7407 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreateWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreateWizard.java
@@ -32,6 +32,7 @@ public class BundleCreateWizard extends AbstractBundleCreateWizard {
steps.add(new BundleInfoStep(this));
steps.add(new BundleUploadRecipeStep(this));
steps.add(new BundleUploadDataStep(this));
+ steps.add(new BundleSummaryStep(this));
setSteps(steps);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
index 2bfc93d..58c4e66 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
@@ -38,6 +38,8 @@ import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
/**
* @author John Mazzitelli
@@ -128,6 +130,13 @@ public class BundleInfoStep implements WizardStep {
if (wizard.getBundleType() == null) {
bundleServer.getAllBundleTypes(new AsyncCallback<ArrayList<BundleType>>() {
public void onSuccess(ArrayList<BundleType> result) {
+ if (result == null || result.size() == 0) {
+ wizard.setBundleType(null);
+ CoreGUI.getMessageCenter().notify(
+ new Message("No bundle types are supported", Severity.Error));
+ return;
+ }
+
for (BundleType bundleType : result) {
knownBundleTypes.put(bundleType.getName(), bundleType);
if (wizard.getBundleType() == null) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleSummaryStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleSummaryStep.java
new file mode 100644
index 0000000..bddf61b
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleSummaryStep.java
@@ -0,0 +1,87 @@
+/*
+ * 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.bundle.create;
+
+import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.types.TitleOrientation;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.TextAreaItem;
+import com.smartgwt.client.widgets.form.fields.TextItem;
+
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+
+/**
+ * @author John Mazzitelli
+ */
+public class BundleSummaryStep implements WizardStep {
+
+ private DynamicForm form;
+ private final AbstractBundleCreateWizard wizard;
+
+ public BundleSummaryStep(AbstractBundleCreateWizard bundleCreationWizard) {
+ this.wizard = bundleCreationWizard;
+ }
+
+ public Canvas getCanvas() {
+ TextItem nameTextItem;
+ TextItem versionTextItem;
+ TextAreaItem descriptionTextAreaItem;
+ TextItem bundleTypeTextItem;
+
+ form = new DynamicForm();
+ form.setPadding(20);
+ form.setWidth100();
+ form.setNumCols(2);
+
+ bundleTypeTextItem = new TextItem("bundleTypeItem", "Bundle Type");
+ bundleTypeTextItem.setValue(wizard.getBundleType().getName());
+ bundleTypeTextItem.setDisabled(true);
+ bundleTypeTextItem.setTitleAlign(Alignment.LEFT);
+
+ nameTextItem = new TextItem("name", "Name");
+ nameTextItem.setValue(wizard.getBundleName());
+ nameTextItem.setDisabled(true);
+ nameTextItem.setTitleAlign(Alignment.LEFT);
+
+ versionTextItem = new TextItem("version", "Version");
+ versionTextItem.setValue(wizard.getBundleVersionString());
+ versionTextItem.setDisabled(true);
+ versionTextItem.setTitleAlign(Alignment.LEFT);
+
+ descriptionTextAreaItem = new TextAreaItem("description", "Description");
+ descriptionTextAreaItem.setValue(wizard.getBundleDescription());
+ descriptionTextAreaItem.setDisabled(true);
+ descriptionTextAreaItem.setTitleOrientation(TitleOrientation.TOP);
+ descriptionTextAreaItem.setColSpan(2);
+ descriptionTextAreaItem.setWidth(300);
+
+ form.setItems(bundleTypeTextItem, nameTextItem, versionTextItem, descriptionTextAreaItem);
+
+ return form;
+ }
+
+ public boolean nextPage() {
+ return true; // this is the last page, we are done
+ }
+
+ public String getName() {
+ return "Summary";
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
index 2a6a7c5..793cd5a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
@@ -46,7 +46,6 @@ public class BundleUploadDataStep implements WizardStep {
private final AbstractBundleCreateWizard wizard;
private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
private DynamicForm form;
- private Map<String, Boolean> allFilesStatus;
public BundleUploadDataStep(AbstractBundleCreateWizard bundleCreationWizard) {
this.wizard = bundleCreationWizard;
@@ -63,14 +62,12 @@ public class BundleUploadDataStep implements WizardStep {
new AsyncCallback<HashMap<String, Boolean>>() {
public void onSuccess(HashMap<String, Boolean> result) {
- allFilesStatus = result;
+ wizard.setAllBundleFilesStatus(result);
prepareForm(layout);
- enableNextButtonWhenAppropriate();
}
public void onFailure(Throwable caught) {
- allFilesStatus = null;
- enableNextButtonWhenAppropriate();
+ wizard.setAllBundleFilesStatus(null);
CoreGUI.getErrorHandler().handleError("Cannot obtain bundle file information from server", caught);
}
});
@@ -80,33 +77,33 @@ public class BundleUploadDataStep implements WizardStep {
}
public boolean nextPage() {
- return true; // TODO: Implement this method.
+ return isFinished();
}
public String getName() {
return "Upload Bundle Files";
}
- public boolean isNextEnabled() {
- if (this.allFilesStatus == null) {
+ private boolean isFinished() {
+ if (wizard.getAllBundleFilesStatus() == null) {
return false;
}
- if (this.allFilesStatus.containsValue(Boolean.FALSE)) {
+ if (wizard.getAllBundleFilesStatus().containsValue(Boolean.FALSE)) {
return false;
}
return true;
}
- public boolean isPreviousEnabled() {
- return true;
- }
+ private void prepareForm(VLayout layout) {
+ // if there are no files to upload, immediately skip this step
+ final HashMap<String, Boolean> allFilesStatus = wizard.getAllBundleFilesStatus();
- private void enableNextButtonWhenAppropriate() {
- this.wizard.getView().getNextButton().setDisabled(!isNextEnabled());
- }
+ if (allFilesStatus != null && allFilesStatus.size() == 0) {
+ // TODO: do something to tell the user they don't have to do anything for this step
+ return;
+ }
- private void prepareForm(VLayout layout) {
- for (Map.Entry<String, Boolean> entry : this.allFilesStatus.entrySet()) {
+ for (Map.Entry<String, Boolean> entry : allFilesStatus.entrySet()) {
HLayout formLayout = new HLayout();
layout.addMember(formLayout);
@@ -133,7 +130,6 @@ public class BundleUploadDataStep implements WizardStep {
CoreGUI.getMessageCenter().notify(
new Message("Failed to upload bundle file", results, Message.Severity.Error));
}
- enableNextButtonWhenAppropriate();
}
});
uploadForm.addFormSubmitFailedHandler(new FormSubmitFailedHandler() {
@@ -142,7 +138,6 @@ public class BundleUploadDataStep implements WizardStep {
allFilesStatus.put(uploadForm.getName(), Boolean.FALSE);
CoreGUI.getMessageCenter().notify(
new Message("Failed to upload file", null, Message.Severity.Error));
- enableNextButtonWhenAppropriate();
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java
index c257909..5743653 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java
@@ -47,9 +47,9 @@ public interface BundleGWTService extends RemoteService {
BundleVersion createBundleVersion(int bundleId, String name, String version, String recipe) throws Exception;
- void deleteBundle(int bundleId);
+ void deleteBundle(int bundleId) throws Exception;
- void deleteBundleVersion(int bundleVersionId);
+ void deleteBundleVersion(int bundleVersionId, boolean deleteBundleIfEmpty) throws Exception;
PageList<Bundle> findBundlesByCriteria(BundleCriteria criteria) throws Exception;
@@ -60,7 +60,7 @@ public interface BundleGWTService extends RemoteService {
HashMap<String, Boolean> getAllBundleVersionFilenames(int bundleVersionId) throws Exception;
- ArrayList<BundleType> getAllBundleTypes();
+ ArrayList<BundleType> getAllBundleTypes() throws Exception;
BundleDeployment scheduleBundleDeployment(int bundleDeployDefinitionId, int resourceId) throws Exception;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
index 25eba1c..5473a94 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
@@ -89,7 +89,7 @@ public class BundleGWTServiceImpl extends AbstractGWTServiceImpl implements Bund
return SerialUtility.prepare(results, "createBundleVersion");
}
- public void deleteBundle(int bundleId) {
+ public void deleteBundle(int bundleId) throws Exception {
try {
bundleManager.deleteBundle(getSessionSubject(), bundleId);
} catch (Exception e) {
@@ -97,15 +97,15 @@ public class BundleGWTServiceImpl extends AbstractGWTServiceImpl implements Bund
}
}
- public void deleteBundleVersion(int bundleVersionId) {
+ public void deleteBundleVersion(int bundleVersionId, boolean deleteBundleIfEmpty) throws Exception {
try {
- bundleManager.deleteBundleVersion(getSessionSubject(), bundleVersionId);
+ bundleManager.deleteBundleVersion(getSessionSubject(), bundleVersionId, deleteBundleIfEmpty);
} catch (Exception e) {
throw new RuntimeException(ThrowableUtil.getAllMessages(e));
}
}
- public PageList<Bundle> findBundlesByCriteria(BundleCriteria criteria) {
+ public PageList<Bundle> findBundlesByCriteria(BundleCriteria criteria) throws Exception {
try {
PageList<Bundle> results = bundleManager.findBundlesByCriteria(getSessionSubject(), criteria);
return SerialUtility.prepare(results, "findBundlesByCriteria");
@@ -114,7 +114,7 @@ public class BundleGWTServiceImpl extends AbstractGWTServiceImpl implements Bund
}
}
- public PageList<BundleVersion> findBundleVersionsByCriteria(BundleVersionCriteria criteria) {
+ public PageList<BundleVersion> findBundleVersionsByCriteria(BundleVersionCriteria criteria) throws Exception {
try {
PageList<BundleVersion> results = bundleManager.findBundleVersionsByCriteria(getSessionSubject(), criteria);
return SerialUtility.prepare(results, "findBundleVersionsByCriteria");
@@ -124,7 +124,7 @@ public class BundleGWTServiceImpl extends AbstractGWTServiceImpl implements Bund
}
public PageList<BundleWithLatestVersionComposite> findBundlesWithLastestVersionCompositesByCriteria(
- BundleCriteria criteria) {
+ BundleCriteria criteria) throws Exception {
try {
PageList<BundleWithLatestVersionComposite> results;
results = bundleManager.findBundlesWithLastestVersionCompositesByCriteria(getSessionSubject(), criteria);
@@ -134,7 +134,7 @@ public class BundleGWTServiceImpl extends AbstractGWTServiceImpl implements Bund
}
}
- public ArrayList<BundleType> getAllBundleTypes() {
+ public ArrayList<BundleType> getAllBundleTypes() throws Exception {
try {
ArrayList<BundleType> bundleTypes = new ArrayList<BundleType>();
bundleTypes.addAll(bundleManager.getAllBundleTypes(getSessionSubject()));
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
index 440eee6..e52e3b6 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
@@ -674,7 +674,7 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
}
for (BundleVersion bv : bundle.getBundleVersions()) {
- bundleManager.deleteBundleVersion(subject, bv.getId());
+ bundleManager.deleteBundleVersion(subject, bv.getId(), false);
}
// we need to whack the Repo once the Bundle no longer refers to it
@@ -687,23 +687,28 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
}
@RequiredPermission(Permission.MANAGE_INVENTORY)
- public void deleteBundleVersion(Subject subject, int bundleVersionId) throws Exception {
+ public void deleteBundleVersion(Subject subject, int bundleVersionId, boolean deleteBundleIfEmpty) throws Exception {
BundleVersion bundleVersion = this.entityManager.find(BundleVersion.class, bundleVersionId);
if (null == bundleVersion) {
return;
}
- int bundleId = bundleVersion.getBundle().getId();
+ int bundleId = 0;
+ if (deleteBundleIfEmpty) {
+ bundleId = bundleVersion.getBundle().getId(); // note that we lazy load this if we never plan to delete the bundle
+ }
// remove the bundle version - cascade remove the deploy defs which will cascade remove the deployments.
this.entityManager.remove(bundleVersion);
- this.entityManager.flush();
- Query q = entityManager.createNamedQuery(BundleVersion.QUERY_FIND_VERSION_INFO_BY_BUNDLE_ID);
- q.setParameter("bundleId", bundleId);
- if (q.getResultList().size() == 0) {
- // there are no more bundle versions left, blow away the bundle and all repo/bundle files associated with it
- deleteBundle(subject, bundleId);
+ if (deleteBundleIfEmpty) {
+ this.entityManager.flush();
+ Query q = entityManager.createNamedQuery(BundleVersion.QUERY_FIND_VERSION_INFO_BY_BUNDLE_ID);
+ q.setParameter("bundleId", bundleId);
+ if (q.getResultList().size() == 0) {
+ // there are no more bundle versions left, blow away the bundle and all repo/bundle files associated with it
+ deleteBundle(subject, bundleId);
+ }
}
return;
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java
index b3a84ff..efde215 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java
@@ -204,12 +204,15 @@ public interface BundleManagerRemote {
*
* @param subject
* @param bundleVersionId
+ * @param deleteBundleIfEmpty if <code>true</code> and if this method deletes the last bundle version for its
+ * bundle, then that bundle entity itself will be completely purged
* @throws Exception if any part of the removal fails.
*/
@WebMethod
void deleteBundleVersion( //
@WebParam(name = "subject") Subject subject, //
- @WebParam(name = "bundleVersionId") int bundleVersionId) throws Exception;
+ @WebParam(name = "bundleVersionId") int bundleVersionId, //
+ @WebParam(name = "deleteBundleIfEmpty") boolean deleteBundleIfEmpty) throws Exception;
@WebMethod
PageList<Bundle> findBundlesByCriteria( //
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
index 6521e5b..17d3c96 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
@@ -375,8 +375,8 @@ public class WebservicesManagerBean implements WebservicesRemote {
bundleManager.deleteBundle(subject, bundleId);
}
- public void deleteBundleVersion(Subject subject, int bundleVersionId) throws Exception {
- bundleManager.deleteBundleVersion(subject, bundleVersionId);
+ public void deleteBundleVersion(Subject subject, int bundleVersionId, boolean deleteBundleIfEmpty) throws Exception {
+ bundleManager.deleteBundleVersion(subject, bundleVersionId, deleteBundleIfEmpty);
}
public PageList<BundleDeployDefinition> findBundleDeployDefinitionsByCriteria(Subject subject,
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
index 833d844..0d99b17 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
@@ -295,7 +295,7 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
BundleCriteria bCriteria = new BundleCriteria();
// delete the first one - this deletes the BV but the bundle should remain intact
- bundleManager.deleteBundleVersion(overlord, bv2.getId());
+ bundleManager.deleteBundleVersion(overlord, bv2.getId(), true);
bvCriteria.addFilterId(bv2.getId());
PageList<BundleVersion> bvResults = bundleManager.findBundleVersionsByCriteria(overlord, bvCriteria);
assert bvResults.size() == 0;
@@ -304,7 +304,7 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
assert bResults.size() == 1 : "Should not have deleted bundle yet, 1 version still exists";
// delete the second one - this deletes last BV thus the bundle should also get deleted
- bundleManager.deleteBundleVersion(overlord, bv1.getId());
+ bundleManager.deleteBundleVersion(overlord, bv1.getId(), true);
bvCriteria.addFilterId(bv1.getId());
bvResults = bundleManager.findBundleVersionsByCriteria(overlord, bvCriteria);
assert bvResults.size() == 0;
commit 0b503904be650eae0418dd646a617b4fed1c9e9e
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 24 00:48:19 2010 -0400
get the wizard framework to know when the wizard is finished and to close the dialog when it is
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
index b30e6a7..e0f3f92 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
@@ -125,24 +125,23 @@ public class WizardView extends VLayout {
cancelButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
wizard.cancel();
- wizardWindow.destroy();
+ closeDialog();
}
});
previousButton = new IButton("Previous");
previousButton.setDisabled(true);
previousButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
- setStep(currentStep - 1);
+ decrementStep();
}
});
nextButton = new IButton("Next");
- nextButton.setDisabled(true);
nextButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
WizardStep step = wizard.getSteps().get(currentStep);
if (step.nextPage()) {
- setStep(currentStep + 1);
+ incrementStep();
}
}
});
@@ -154,18 +153,31 @@ public class WizardView extends VLayout {
}
- public void setStep(int stepIndex) {
+ private void setStep(int stepIndex) {
currentStep = stepIndex;
- stepLabel.setContents("Step " + (stepIndex + 1) + " of " + wizard.getSteps().size());
- WizardStep step = wizard.getSteps().get(currentStep);
+ List<WizardStep> wizardSteps = wizard.getSteps();
+
+ // determine if we are "finished" - that is, going past our last step
+ if (currentStep >= wizardSteps.size()) {
+ closeDialog();
+ return;
+ }
+
+ stepLabel.setContents("Step " + (stepIndex + 1) + " of " + wizardSteps.size());
+
+ WizardStep step = wizardSteps.get(currentStep);
stepTitleLabel.setContents(step.getName());
previousButton.setDisabled(stepIndex == 0);
- boolean last = (stepIndex == (wizard.getSteps().size() - 1));
- nextButton.setDisabled(last);
+ boolean last = (stepIndex == (wizardSteps.size() - 1));
+ if (last) {
+ nextButton.setTitle("Finish");
+ } else {
+ nextButton.setTitle("Next");
+ }
for (IButton button : customButtons) {
buttonBar.removeMember(button);
@@ -182,7 +194,7 @@ public class WizardView extends VLayout {
if (currentCanvas != null) {
contentLayout.removeMember(currentCanvas);
}
- currentCanvas = wizard.getSteps().get(currentStep).getCanvas();
+ currentCanvas = wizardSteps.get(currentStep).getCanvas();
contentLayout.addMember(currentCanvas);
markForRedraw();
@@ -201,7 +213,7 @@ public class WizardView extends VLayout {
wizardWindow.addCloseClickHandler(new CloseClickHandler() {
public void onCloseClick(CloseClientEvent closeClientEvent) {
wizard.cancel();
- wizardWindow.destroy();
+ closeDialog();
}
});
wizardWindow.addItem(this);
@@ -232,4 +244,8 @@ public class WizardView extends VLayout {
public void incrementStep() {
setStep(currentStep + 1);
}
+
+ public void decrementStep() {
+ setStep(currentStep - 1);
+ }
}
commit b39be42983f7a27932ff270c7ee5021e2ef38338
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Mar 23 23:48:39 2010 -0400
remove the obsolete/unused isNext/PreviousEnabled methods from the steps classes
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationParametersStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationParametersStep.java
index 6ae3921..42de0a4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationParametersStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationParametersStep.java
@@ -67,12 +67,4 @@ public class OperationParametersStep implements WizardStep {
public Configuration getParameterConfiguration() {
return configurationEditor != null ? configurationEditor.getConfiguration() : null;
}
-
- public boolean isNextEnabled() {
- return true;
- }
-
- public boolean isPreviousEnabled() {
- return true;
- }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java
index e923b08..c1546a8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java
@@ -42,7 +42,7 @@ import com.smartgwt.client.widgets.form.fields.SpacerItem;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.form.fields.TimeItem;
import com.smartgwt.client.widgets.form.validator.CustomValidator;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
/**
@@ -66,12 +66,12 @@ public class OperationSchedulingStep implements WizardStep, ItemChangedHandler {
form.setWidth100();
form.setPadding(10);
form.setNumCols(3);
-// form.setColWidths("15%", "35%", "15%", "*");
+ // form.setColWidths("15%", "35%", "15%", "*");
form.setValidateOnChange(true);
final RadioGroupItem start = new RadioGroupItem("start", "Start");
start.setColSpan(3);
- start.setValueMap(enumValueMap(ExecutionSchedule.Start.class)); // "Immediately", "Future"
+ start.setValueMap(enumValueMap(ExecutionSchedule.Start.class)); // "Immediately", "Future"
start.setRedrawOnChange(true);
start.setValue("Immediately");
@@ -84,7 +84,7 @@ public class OperationSchedulingStep implements WizardStep, ItemChangedHandler {
});
RadioGroupItem recurr = new RadioGroupItem("recurr", "Recurrence");
- recurr.setValueMap(enumValueMap(ExecutionSchedule.Recurr.class)); // "Once", "EveryNMinutes", "Hourly", "Daily", "Weekly", "Monthly");
+ recurr.setValueMap(enumValueMap(ExecutionSchedule.Recurr.class)); // "Once", "EveryNMinutes", "Hourly", "Daily", "Weekly", "Monthly");
recurr.setRedrawOnChange(true);
recurr.setValue("Once");
recurr.setShowIfCondition(new FormItemIfFunction() {
@@ -93,26 +93,23 @@ public class OperationSchedulingStep implements WizardStep, ItemChangedHandler {
}
});
-
-
CanvasItem onceForm = new CanvasItem("once", "Run At");
onceForm.setShowTitle(false);
onceForm.setCanvas(getOnceForm());
onceForm.setShowIfCondition(new FormItemIfFunction() {
public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !"Immediately".equals(form.getValueAsString("start")) &&
- ExecutionSchedule.Recurr.Once.name().equals(form.getValueAsString("recurr"));
+ return !"Immediately".equals(form.getValueAsString("start"))
+ && ExecutionSchedule.Recurr.Once.name().equals(form.getValueAsString("recurr"));
}
});
-
CanvasItem everyNMinuteForm = new CanvasItem("everyNMinutesForm", "NMinutes");
everyNMinuteForm.setShowTitle(false);
everyNMinuteForm.setCanvas(getEveryNMinutesForm());
everyNMinuteForm.setShowIfCondition(new FormItemIfFunction() {
public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !"Immediately".equals(form.getValueAsString("start")) &&
- ExecutionSchedule.Recurr.EveryNMinutes.name().equals(form.getValueAsString("recurr"));
+ return !"Immediately".equals(form.getValueAsString("start"))
+ && ExecutionSchedule.Recurr.EveryNMinutes.name().equals(form.getValueAsString("recurr"));
}
});
@@ -121,8 +118,8 @@ public class OperationSchedulingStep implements WizardStep, ItemChangedHandler {
hourlyForm.setCanvas(getHourlyForm());
hourlyForm.setShowIfCondition(new FormItemIfFunction() {
public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !"Immediately".equals(form.getValueAsString("start")) &&
- ExecutionSchedule.Recurr.Hourly.name().equals(form.getValueAsString("recurr"));
+ return !"Immediately".equals(form.getValueAsString("start"))
+ && ExecutionSchedule.Recurr.Hourly.name().equals(form.getValueAsString("recurr"));
}
});
@@ -136,7 +133,6 @@ public class OperationSchedulingStep implements WizardStep, ItemChangedHandler {
}
});
-
CanvasItem weeklyForm = new CanvasItem("weekly", "Weekly");
weeklyForm.setShowTitle(false);
weeklyForm.setCanvas(getWeeklyForm());
@@ -212,12 +208,8 @@ public class OperationSchedulingStep implements WizardStep, ItemChangedHandler {
messageItem.setShowTitle(false);
messageItem.setCellStyle("HeaderLabel");
- form.setItems(start, scheduleHeader, recurr,
- onceForm, everyNMinuteForm, hourlyForm, dailyForm, weeklyForm, monthlyForm,
- rangeHeader, startDate, end, endDate,
- new SpacerItem(), messageItem);
-
-
+ form.setItems(start, scheduleHeader, recurr, onceForm, everyNMinuteForm, hourlyForm, dailyForm, weeklyForm,
+ monthlyForm, rangeHeader, startDate, end, endDate, new SpacerItem(), messageItem);
form.addItemChangedHandler(this);
}
@@ -255,7 +247,6 @@ public class OperationSchedulingStep implements WizardStep, ItemChangedHandler {
form.setGroupTitle("Every N Minutes");
form.addItemChangedHandler(this);
-
form.setWrapItemTitles(false);
form.setNumCols(2);
@@ -276,7 +267,6 @@ public class OperationSchedulingStep implements WizardStep, ItemChangedHandler {
form.setGroupTitle("Hourly At");
form.addItemChangedHandler(this);
-
form.setWrapItemTitles(false);
form.setNumCols(2);
@@ -289,7 +279,6 @@ public class OperationSchedulingStep implements WizardStep, ItemChangedHandler {
return form;
}
-
private DynamicForm getDailyForm() {
DynamicForm form = new DynamicForm();
form.setValuesManager(valuesManager);
@@ -308,7 +297,6 @@ public class OperationSchedulingStep implements WizardStep, ItemChangedHandler {
return form;
}
-
private DynamicForm getWeeklyForm() {
DynamicForm form = new DynamicForm();
form.setValuesManager(valuesManager);
@@ -317,7 +305,6 @@ public class OperationSchedulingStep implements WizardStep, ItemChangedHandler {
form.setGroupTitle("Weekly On");
form.addItemChangedHandler(this);
-
form.setWrapItemTitles(false);
TimeItem timeOfDay = new TimeItem("timeOfDay", "Time Of Day");
@@ -347,7 +334,6 @@ public class OperationSchedulingStep implements WizardStep, ItemChangedHandler {
form.setGroupTitle("Monthly On");
form.addItemChangedHandler(this);
-
IntegerItem dayItem = new IntegerItem();
dayItem.setName("dayOfMonth");
dayItem.setTitle("Day of Month");
@@ -370,21 +356,11 @@ public class OperationSchedulingStep implements WizardStep, ItemChangedHandler {
return "Schedule";
}
- public boolean isNextEnabled() {
- return true;
- }
-
- public boolean isPreviousEnabled() {
- return true;
- }
-
public void onItemChanged(ItemChangedEvent itemChangeEvent) {
-
executionSchedule.setStart(ExecutionSchedule.Start.valueOf(valuesManager.getValueAsString("start")));
executionSchedule.setRecurr(ExecutionSchedule.Recurr.valueOf(valuesManager.getValueAsString("recurr")));
-
Date onceDate = (Date) valuesManager.getValues().get("onceStartDate");
executionSchedule.setOnceDateTime(onceDate);
@@ -394,7 +370,6 @@ public class OperationSchedulingStep implements WizardStep, ItemChangedHandler {
executionSchedule.setTimeOfDay((Date) valuesManager.getValues().get("timeOfDay"));
-
HashSet<ExecutionSchedule.DayOfWeek> selectedDays = new HashSet<ExecutionSchedule.DayOfWeek>(); //.noneOf(ExecutionSchedule.DayOfWeek.class);
for (ExecutionSchedule.DayOfWeek d : EnumSet.allOf(ExecutionSchedule.DayOfWeek.class)) {
if (valuesManager.getValues().containsKey(d.name())) {
@@ -403,29 +378,24 @@ public class OperationSchedulingStep implements WizardStep, ItemChangedHandler {
}
executionSchedule.setDaysOfWeek(selectedDays);
-
-
executionSchedule.setDayOfMonth(Integer.parseInt(valuesManager.getValueAsString("dayOfMonth")));
-
-
- executionSchedule.setStartDate((Date)valuesManager.getValues().get("startDate"));
+ executionSchedule.setStartDate((Date) valuesManager.getValues().get("startDate"));
if ("Never".equals(valuesManager.getValues().get("endType"))) {
executionSchedule.setEndDate(null);
} else {
- executionSchedule.setEndDate((Date)valuesManager.getValues().get("endDate"));
+ executionSchedule.setEndDate((Date) valuesManager.getValues().get("endDate"));
}
- form.setValue("message",executionSchedule.getMessage());
+ form.setValue("message", executionSchedule.getMessage());
}
-
- private LinkedHashMap<String,String> enumValueMap(Class<? extends Enum> e) {
- LinkedHashMap<String,String> map = new LinkedHashMap<String, String>();
+ private LinkedHashMap<String, String> enumValueMap(Class<? extends Enum> e) {
+ LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
for (Object o : EnumSet.allOf(e)) {
Enum v = (Enum) o;
- map.put(v.name(),v.name()); // localize
+ map.put(v.name(), v.name()); // localize
}
return map;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ConfigurationStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ConfigurationStep.java
index 33ddebe..0d466d3 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ConfigurationStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ConfigurationStep.java
@@ -18,15 +18,10 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.factory;
-import java.util.Map;
-
import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.form.DynamicForm;
-import com.smartgwt.client.widgets.form.fields.SelectItem;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
-import org.rhq.core.domain.configuration.definition.ConfigurationTemplate;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
@@ -61,14 +56,6 @@ public class ConfigurationStep implements WizardStep {
return "Edit Configuration";
}
- public boolean isPreviousEnabled() {
- return true;
- }
-
- public boolean isNextEnabled() {
- return false;
- }
-
public Configuration getConfiguration() {
return editor.getConfiguration();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ConfigurationTemplateStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ConfigurationTemplateStep.java
index eee603a..a9182ee 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ConfigurationTemplateStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ConfigurationTemplateStep.java
@@ -51,7 +51,7 @@ public class ConfigurationTemplateStep implements WizardStep {
TextItem nameItem = new TextItem("resourceName", "Resource Name");
nameItem.setRequired(true);
- SelectItem templateSelect = new SelectItem("template","Template");
+ SelectItem templateSelect = new SelectItem("template", "Template");
ConfigurationDefinition definition = wizard.getConfigurationDefinition();
@@ -77,14 +77,6 @@ public class ConfigurationTemplateStep implements WizardStep {
return "Select a Template";
}
- public boolean isPreviousEnabled() {
- return false;
- }
-
- public boolean isNextEnabled() {
- return true;
- }
-
public Configuration getConfiguration() {
return templates.get(form.getValueAsString("template")).createConfiguration();
}
commit 24b38a17ceca586ad9df9bf5b2e6209e2c64a4af
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Mar 23 23:28:24 2010 -0400
delete the bundle if, when deleting a BV it turns out there are no more bundle versions for that bundle
this includes a unit test to make sure deleting BVs work
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
index bab247a..440eee6 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
@@ -677,7 +677,7 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
bundleManager.deleteBundleVersion(subject, bv.getId());
}
- // we need to whack the Repo once the Bundle no longe refers to it
+ // we need to whack the Repo once the Bundle no longer refers to it
Repo bundleRepo = bundle.getRepo();
this.entityManager.remove(bundle);
@@ -686,14 +686,26 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
repoManager.deleteRepo(subject, bundleRepo.getId());
}
- public void deleteBundleVersion(Subject subject, int bundleVersionId) {
+ @RequiredPermission(Permission.MANAGE_INVENTORY)
+ public void deleteBundleVersion(Subject subject, int bundleVersionId) throws Exception {
BundleVersion bundleVersion = this.entityManager.find(BundleVersion.class, bundleVersionId);
if (null == bundleVersion) {
return;
}
- // remove the bundle version, this will cascade remove the deploy defs which will cascade remove
- // the deployments.
+ int bundleId = bundleVersion.getBundle().getId();
+
+ // remove the bundle version - cascade remove the deploy defs which will cascade remove the deployments.
this.entityManager.remove(bundleVersion);
+ this.entityManager.flush();
+
+ Query q = entityManager.createNamedQuery(BundleVersion.QUERY_FIND_VERSION_INFO_BY_BUNDLE_ID);
+ q.setParameter("bundleId", bundleId);
+ if (q.getResultList().size() == 0) {
+ // there are no more bundle versions left, blow away the bundle and all repo/bundle files associated with it
+ deleteBundle(subject, bundleId);
+ }
+
+ return;
}
}
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
index c2284d9..833d844 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
@@ -45,11 +45,13 @@ import org.rhq.core.domain.bundle.BundleVersion;
import org.rhq.core.domain.bundle.composite.BundleWithLatestVersionComposite;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.content.Architecture;
import org.rhq.core.domain.content.Package;
import org.rhq.core.domain.content.PackageType;
import org.rhq.core.domain.content.PackageVersion;
import org.rhq.core.domain.content.Repo;
import org.rhq.core.domain.criteria.BundleCriteria;
+import org.rhq.core.domain.criteria.BundleFileCriteria;
import org.rhq.core.domain.criteria.BundleVersionCriteria;
import org.rhq.core.domain.resource.Agent;
import org.rhq.core.domain.resource.InventoryStatus;
@@ -269,6 +271,49 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
}
@Test(enabled = TESTS_ENABLED)
+ public void testDeleteBundleVersion() throws Exception {
+ Bundle b1 = createBundle("one");
+ assertNotNull(b1);
+ BundleVersion bv1 = createBundleVersion(b1.getName() + "-1", null, b1);
+ assertNotNull(bv1);
+ assertEquals("1.0", bv1.getVersion());
+ BundleVersion bv2 = createBundleVersion(b1.getName() + "-2", null, b1);
+ assertNotNull(bv2);
+ assertEquals("1.1", bv2.getVersion());
+
+ // let's add a bundle file so we can ensure our deletion will also delete the file too
+ bundleManager.addBundleFileViaByteArray(overlord, bv2.getId(), "testfile", "1.0", new Architecture("noarch"),
+ "content".getBytes(), false);
+ BundleFileCriteria bfCriteria = new BundleFileCriteria();
+ bfCriteria.addFilterBundleVersionId(bv2.getId());
+ bfCriteria.fetchPackageVersion(true);
+ PageList<BundleFile> files = bundleManager.findBundleFilesByCriteria(overlord, bfCriteria);
+ assert files.size() == 1 : files;
+ assert files.get(0).getPackageVersion().getGeneralPackage().getName().equals("testfile") : files;
+
+ BundleVersionCriteria bvCriteria = new BundleVersionCriteria();
+ BundleCriteria bCriteria = new BundleCriteria();
+
+ // delete the first one - this deletes the BV but the bundle should remain intact
+ bundleManager.deleteBundleVersion(overlord, bv2.getId());
+ bvCriteria.addFilterId(bv2.getId());
+ PageList<BundleVersion> bvResults = bundleManager.findBundleVersionsByCriteria(overlord, bvCriteria);
+ assert bvResults.size() == 0;
+ bCriteria.addFilterId(b1.getId());
+ PageList<Bundle> bResults = bundleManager.findBundlesByCriteria(overlord, bCriteria);
+ assert bResults.size() == 1 : "Should not have deleted bundle yet, 1 version still exists";
+
+ // delete the second one - this deletes last BV thus the bundle should also get deleted
+ bundleManager.deleteBundleVersion(overlord, bv1.getId());
+ bvCriteria.addFilterId(bv1.getId());
+ bvResults = bundleManager.findBundleVersionsByCriteria(overlord, bvCriteria);
+ assert bvResults.size() == 0;
+ bCriteria.addFilterId(b1.getId());
+ bResults = bundleManager.findBundlesByCriteria(overlord, bCriteria);
+ assert bResults.size() == 0 : "Should have deleted bundle since no versions exists anymore";
+ }
+
+ @Test(enabled = TESTS_ENABLED)
public void testCreateBundleVersionOrdering() throws Exception {
Bundle b1 = createBundle("one");
assertNotNull(b1);
commit 1531142b056f293af50fddc51352cda5a4132869
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Mar 23 23:27:44 2010 -0400
fix bundle file criteria - name of field should be "general"Package
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleFileCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleFileCriteria.java
index 8341922..8abe728 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleFileCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleFileCriteria.java
@@ -41,7 +41,7 @@ public class BundleFileCriteria extends Criteria {
private boolean fetchBundleVersion;
private boolean fetchPackageVersion;
- private boolean fetchPackage;
+ private boolean fetchGeneralPackage;
public BundleFileCriteria() {
super();
@@ -76,8 +76,8 @@ public class BundleFileCriteria extends Criteria {
this.fetchBundleVersion = fetchBundleVersion;
}
- public void fetchPackage(boolean fetchPackage) {
- this.fetchPackage = fetchPackage;
+ public void fetchPackage(boolean fetchGeneralPackage) {
+ this.fetchGeneralPackage = fetchGeneralPackage;
}
public void fetchPackageVersion(boolean fetchPackageVersion) {
commit d3e840578d34c8de89352e6502aa7227cfa58165
Merge: 0212483... 89d3004...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Mar 23 17:03:54 2010 -0400
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
commit 02124836fdb9776037c4c184262493553694200b
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Mar 23 17:02:07 2010 -0400
Some stuff for group bundle deploy
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml b/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
index 75675ef..178013b 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
@@ -575,7 +575,9 @@
<column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/>
<column name="BUNDLE_DEPLOY_DEF_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_DEPLOY_DEF" />
<column name="RESOURCE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE" />
- <column name="CTIME" type="LONG" required="true"/>
+ <column name="CTIME" type="LONG" required="true"/>
+ <!-- for group history -->
+ <column name="GROUP_ID" type="INTEGER" required="false" references="RHQ_RESOURCE_GROUP"/>
<index name="RHQ_DEPLOY_DEF_RESOURCE_IDX" unique="true">
<field ref="BUNDLE_DEPLOY_DEF_ID"/>
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 2b8848f..da47976 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -2898,7 +2898,11 @@
<schema-alterColumn table="RHQ_BUNDLE_VERSION" column="VERSION_ORDER" nullable="FALSE" />
</schemaSpec>
- <schemaSpec version="2.79">
+ <schemaSpec version="2.78.5">
+ <schema-addColumn table="RHQ_BUNDLE_DEPLOY" column="RESOURCE_GROUP_ID" columnType="INTEGER" />
+ </schemaSpec>
+
+ <schemaSpec version="2.79">
<schema-directSQL>
<statement desc="Normalizing resource group descriptions">
UPDATE RHQ_RESOURCE_GROUP SET DESCRIPTION = NULL WHERE DESCRIPTION = ''
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/GroupBundleDeployment.java b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/GroupBundleDeployment.java
new file mode 100644
index 0000000..67ad13f
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/GroupBundleDeployment.java
@@ -0,0 +1,73 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.core.domain.bundle;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.CascadeType;
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
+
+import org.rhq.core.domain.resource.group.ResourceGroup;
+
+@DiscriminatorValue("group")
+@Entity
+public class GroupBundleDeployment extends BundleDeployment {
+
+ private static final long serialVersionUID = 1L;
+
+ @JoinColumn(name = "GROUP_ID", referencedColumnName = "ID")
+ @ManyToOne
+ private ResourceGroup group;
+
+ @OneToMany(mappedBy = "groupBundleHistory", cascade = { CascadeType.PERSIST, CascadeType.REMOVE })
+ private List<BundleDeployment> bundleDeployments = new ArrayList<BundleDeployment>();
+
+ protected GroupBundleDeployment() {
+ }
+
+ public ResourceGroup getGroup() {
+ return group;
+ }
+
+ public void setGroup(ResourceGroup group) {
+ this.group = group;
+ }
+
+ public List<BundleDeployment> getBundleDeployments() {
+ return bundleDeployments;
+ }
+
+ public void setBundleDeployments(List<BundleDeployment> bundleDeployments) {
+ this.bundleDeployments = bundleDeployments;
+ }
+
+ public void addBundleDeployments(BundleDeployment bundleDeployment) {
+ this.bundleDeployments.add(bundleDeployment);
+ }
+
+}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java
index 63f229c..7a10422 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java
@@ -55,6 +55,7 @@ import org.jetbrains.annotations.NotNull;
import org.rhq.core.domain.alert.AlertDefinition;
import org.rhq.core.domain.authz.Role;
+import org.rhq.core.domain.bundle.GroupBundleDeployment;
import org.rhq.core.domain.configuration.group.AbstractGroupConfigurationUpdate;
import org.rhq.core.domain.operation.GroupOperationHistory;
import org.rhq.core.domain.resource.Resource;
@@ -403,6 +404,11 @@ public class ResourceGroup extends Group {
// by primary key which will also put the configuration updates in chronological order
private List<AbstractGroupConfigurationUpdate> configurationUpdates = new ArrayList<AbstractGroupConfigurationUpdate>();
+ @OneToMany(mappedBy = "group", cascade = { CascadeType.ALL })
+ @OrderBy
+ // by primary key which will also put the operation histories in chronological order
+ private List<GroupBundleDeployment> bundleDeployments = new ArrayList<GroupBundleDeployment>();
+
@JoinColumn(name = "GROUP_DEFINITION_ID", referencedColumnName = "ID", nullable = true)
@ManyToOne
private GroupDefinition groupDefinition;
@@ -548,6 +554,14 @@ public class ResourceGroup extends Group {
this.configurationUpdates = configurationUpdates;
}
+ public List<GroupBundleDeployment> getBundleDeployments() {
+ return bundleDeployments;
+ }
+
+ public void setBundleDeployments(List<GroupBundleDeployment> bundleDeployments) {
+ this.bundleDeployments = bundleDeployments;
+ }
+
public GroupDefinition getGroupDefinition() {
return groupDefinition;
}
commit 89d3004322b490efcccdd2a107b3dcddd7dad37b
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Mar 23 15:02:49 2010 -0400
get the wizard to cancel when you click the X
get the bundle types to show in selection
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/AbstractBundleCreateWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/AbstractBundleCreateWizard.java
index 81d13ca..01e2598 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/AbstractBundleCreateWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/AbstractBundleCreateWizard.java
@@ -18,9 +18,16 @@
*/
package org.rhq.enterprise.gui.coregui.client.bundle.create;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+
import org.rhq.core.domain.bundle.BundleType;
import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.bundle.AbstractBundleWizard;
+import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
public abstract class AbstractBundleCreateWizard extends AbstractBundleWizard {
@@ -79,4 +86,24 @@ public abstract class AbstractBundleCreateWizard extends AbstractBundleWizard {
public void setBundleVersion(BundleVersion bv) {
this.bundleVersion = bv;
}
+
+ public void cancel() {
+ final BundleVersion bv = getBundleVersion();
+ if (bv != null) {
+ // the user must have created it already after verification step, delete it
+ BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
+ bundleServer.deleteBundleVersion(bv.getId(), new AsyncCallback<Void>() {
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("Canceled bundle [" + bv.getName() + "] version [" + bv.getVersion() + "]",
+ Severity.Info));
+ }
+
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+ "Failed to fully cancel - bundle may still exist in the database", caught);
+ }
+ });
+ }
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreateWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreateWizard.java
index e2fe45f..e76dc7f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreateWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreateWizard.java
@@ -20,18 +20,7 @@ package org.rhq.enterprise.gui.coregui.client.bundle.create;
import java.util.ArrayList;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.widgets.IButton;
-import com.smartgwt.client.widgets.events.ClickEvent;
-import com.smartgwt.client.widgets.events.ClickHandler;
-
-import org.rhq.core.domain.bundle.BundleVersion;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
-import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
public class BundleCreateWizard extends AbstractBundleCreateWizard {
@@ -42,35 +31,7 @@ public class BundleCreateWizard extends AbstractBundleCreateWizard {
ArrayList<WizardStep> steps = new ArrayList<WizardStep>();
steps.add(new BundleInfoStep(this));
steps.add(new BundleUploadRecipeStep(this));
-// steps.add(new BundleVerificationStep(this));
steps.add(new BundleUploadDataStep(this));
setSteps(steps);
}
-
- @Override
- public void startBundleWizard() {
- super.startBundleWizard();
- IButton cancelButton = getView().getCancelButton();
- cancelButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- final BundleVersion bv = getBundleVersion();
- if (bv != null) {
- // the user must have created it already after verification step, delete it
- BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
- bundleServer.deleteBundleVersion(bv.getId(), new AsyncCallback<Void>() {
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(
- new Message("Canceled bundle [" + bv.getName() + "] version [" + bv.getVersion() + "]",
- Severity.Info));
- }
-
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(
- "Failed to fully cancel - bundle may still exist in the database", caught);
- }
- });
- }
- }
- });
- }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
index e5e2653..2bfc93d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
@@ -19,12 +19,14 @@
package org.rhq.enterprise.gui.coregui.client.bundle.create;
import java.util.ArrayList;
+import java.util.HashMap;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.TitleOrientation;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.SelectItem;
import com.smartgwt.client.widgets.form.fields.TextAreaItem;
import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
@@ -46,9 +48,12 @@ public class BundleInfoStep implements WizardStep {
private final AbstractBundleCreateWizard wizard;
private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
+ private final HashMap<String, BundleType> knownBundleTypes = new HashMap<String, BundleType>();
+
private TextItem nameTextItem;
private TextItem versionTextItem;
private TextAreaItem descriptionTextAreaItem;
+ private SelectItem bundleTypeDropDownMenu;
public BundleInfoStep(AbstractBundleCreateWizard bundleCreationWizard) {
this.wizard = bundleCreationWizard;
@@ -61,6 +66,19 @@ public class BundleInfoStep implements WizardStep {
form.setWidth100();
form.setNumCols(2);
+ bundleTypeDropDownMenu = new SelectItem("bundleTypeDropDownMenu", "Bundle Type");
+ bundleTypeDropDownMenu.setVisible(false);
+ bundleTypeDropDownMenu.setDisabled(true);
+ bundleTypeDropDownMenu.setTitleAlign(Alignment.LEFT);
+ bundleTypeDropDownMenu.setAllowEmptyValue(false);
+ bundleTypeDropDownMenu.setMultiple(false);
+ bundleTypeDropDownMenu.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent event) {
+ BundleType bundleType = knownBundleTypes.get(event.getValue());
+ wizard.setBundleType(bundleType);
+ }
+ });
+
nameTextItem = new TextItem("name", "Name");
nameTextItem.setRequired(true);
nameTextItem.setTitleAlign(Alignment.LEFT);
@@ -83,7 +101,8 @@ public class BundleInfoStep implements WizardStep {
descriptionTextAreaItem.setColSpan(2);
descriptionTextAreaItem.setWidth(300);
- form.setItems(nameTextItem, previousVersionTextItem, versionTextItem, descriptionTextAreaItem);
+ form.setItems(bundleTypeDropDownMenu, nameTextItem, previousVersionTextItem, versionTextItem,
+ descriptionTextAreaItem);
BundleVersion initialBundleVersion = wizard.getBundleVersion();
if (initialBundleVersion != null) {
@@ -107,11 +126,23 @@ public class BundleInfoStep implements WizardStep {
}
if (wizard.getBundleType() == null) {
- // TODO: we should get all bundle types in a drop down menu and let the user pick
- // for now assume we always get one (the filetemplate one) and use it
bundleServer.getAllBundleTypes(new AsyncCallback<ArrayList<BundleType>>() {
public void onSuccess(ArrayList<BundleType> result) {
- wizard.setBundleType(result.get(0));
+ for (BundleType bundleType : result) {
+ knownBundleTypes.put(bundleType.getName(), bundleType);
+ if (wizard.getBundleType() == null) {
+ wizard.setBundleType(bundleType);
+ bundleTypeDropDownMenu.setDefaultValue(bundleType.getName());
+ bundleTypeDropDownMenu.setValue(bundleType.getName());
+ }
+ }
+ bundleTypeDropDownMenu.setValueMap(knownBundleTypes.keySet().toArray(new String[0]));
+ bundleTypeDropDownMenu.setDisabled(false);
+ // don't bother showing the menu if there is only one item
+ if (knownBundleTypes.size() > 1) {
+ bundleTypeDropDownMenu.setVisible(true);
+ bundleTypeDropDownMenu.show(); // in case we've already been rendered
+ }
}
public void onFailure(Throwable caught) {
@@ -123,9 +154,10 @@ public class BundleInfoStep implements WizardStep {
} else {
if (wizard.getBundleVersion() != null) {
// we are traversing back to this step - don't allow changes if we've already created the bundle version
- nameTextItem.setDisabled(Boolean.TRUE);
- versionTextItem.setDisabled(Boolean.TRUE);
- descriptionTextAreaItem.setDisabled(Boolean.TRUE);
+ bundleTypeDropDownMenu.setDisabled(true);
+ nameTextItem.setDisabled(true);
+ versionTextItem.setDisabled(true);
+ descriptionTextAreaItem.setDisabled(true);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUpdateWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUpdateWizard.java
index dfb8c15..95152bc 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUpdateWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUpdateWizard.java
@@ -20,18 +20,8 @@ package org.rhq.enterprise.gui.coregui.client.bundle.create;
import java.util.ArrayList;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.widgets.IButton;
-import com.smartgwt.client.widgets.events.ClickEvent;
-import com.smartgwt.client.widgets.events.ClickHandler;
-
import org.rhq.core.domain.bundle.BundleVersion;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
-import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
public class BundleUpdateWizard extends AbstractBundleCreateWizard {
@@ -47,31 +37,4 @@ public class BundleUpdateWizard extends AbstractBundleCreateWizard {
steps.add(new BundleUploadDataStep(this));
setSteps(steps);
}
-
- @Override
- public void startBundleWizard() {
- super.startBundleWizard();
- IButton cancelButton = getView().getCancelButton();
- cancelButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- final BundleVersion bv = getBundleVersion();
- if (bv != null) {
- // the user must have created it already after verification step, delete it
- BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
- bundleServer.deleteBundleVersion(bv.getId(), new AsyncCallback<Void>() {
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(
- new Message("Canceled bundle [" + bv.getName() + "] version [" + bv.getVersion() + "]",
- Severity.Info));
- }
-
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(
- "Failed to fully cancel - bundle may still exist in the database", caught);
- }
- });
- }
- }
- });
- }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployWizard.java
index 1d0749e..284d94c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployWizard.java
@@ -21,10 +21,6 @@ package org.rhq.enterprise.gui.coregui.client.bundle.deploy;
import java.util.ArrayList;
import java.util.List;
-import com.smartgwt.client.widgets.IButton;
-import com.smartgwt.client.widgets.events.ClickEvent;
-import com.smartgwt.client.widgets.events.ClickHandler;
-
import org.rhq.core.domain.bundle.Bundle;
import org.rhq.core.domain.bundle.BundleDeployDefinition;
import org.rhq.core.domain.bundle.BundleVersion;
@@ -81,18 +77,12 @@ public class BundleDeployWizard extends AbstractBundleDeployWizard {
return steps;
}
- @Override
- public void startBundleWizard() {
- super.startBundleWizard();
- IButton cancelButton = getView().getCancelButton();
- cancelButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- BundleDeployDefinition bdd = getBundleDeployDefinition();
- if (bdd != null && isNewDefinition()) {
- // the user must have created it already after verification step, delete it
- }
- }
- });
+ public void cancel() {
+ BundleDeployDefinition bdd = getBundleDeployDefinition();
+ if (bdd != null && isNewDefinition()) {
+ // the user must have created it already after verification step, delete it
+ // TODO
+ }
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/Wizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/Wizard.java
index e57b4f9..b82ebd4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/Wizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/Wizard.java
@@ -37,4 +37,8 @@ public interface Wizard {
List<IButton> getCustomButtons(int step);
+ /**
+ * This is called when the cancel button or the wizard window's "X" close button is clicked.
+ */
+ void cancel();
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
index c92c0f2..b30e6a7 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
@@ -18,8 +18,8 @@
*/
package org.rhq.enterprise.gui.coregui.client.components.wizard;
-import java.util.List;
import java.util.ArrayList;
+import java.util.List;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
@@ -116,7 +116,7 @@ public class WizardView extends VLayout {
*/
public void refreshTitleLabelContents() {
this.titleLabel.setContents("<span class=\"HeaderLabel\">" + wizard.getTitle() + "</span><br/>"
- + (wizard.getSubtitle() != null ? wizard.getSubtitle() : ""));
+ + (wizard.getSubtitle() != null ? wizard.getSubtitle() : ""));
}
private void setupButtons() {
@@ -124,6 +124,7 @@ public class WizardView extends VLayout {
cancelButton.setDisabled(false);
cancelButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
+ wizard.cancel();
wizardWindow.destroy();
}
});
@@ -199,6 +200,7 @@ public class WizardView extends VLayout {
wizardWindow.centerInPage();
wizardWindow.addCloseClickHandler(new CloseClickHandler() {
public void onCloseClick(CloseClientEvent closeClientEvent) {
+ wizard.cancel();
wizardWindow.destroy();
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationCreateWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationCreateWizard.java
index fb17747..d273596 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationCreateWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationCreateWizard.java
@@ -123,29 +123,26 @@ public class OperationCreateWizard implements Wizard {
Configuration parameters = parametersStep.getParameterConfiguration();
final ExecutionSchedule schedule = schedulingStep.getExecutionSchedule();
- GWTServiceLookup.getOperationService().scheduleResourceOperation(
- resource.getId(),
- operationDefinition.getName(),
- parameters,
- schedule,
- " testing ",
- 0,
- new AsyncCallback<Void>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to schedule operation execution",caught);
- }
-
- public void onSuccess(Void result) {
-
- String message = "Schedule operation [" + operationDefinition.getName()
- + "] on resource [" + resource.getId() + "] with cron string [" + schedule.getCronString() + "]";
-
- CoreGUI.getMessageCenter().notify(new Message(message, Message.Severity.Info));
- }
+ GWTServiceLookup.getOperationService().scheduleResourceOperation(resource.getId(),
+ operationDefinition.getName(), parameters, schedule, " testing ", 0, new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to schedule operation execution", caught);
}
- );
+ public void onSuccess(Void result) {
+
+ String message = "Schedule operation [" + operationDefinition.getName() + "] on resource ["
+ + resource.getId() + "] with cron string [" + schedule.getCronString() + "]";
+
+ CoreGUI.getMessageCenter().notify(new Message(message, Message.Severity.Info));
+ }
+ });
view.closeDialog();
}
+
+ @Override
+ public void cancel() {
+ // TODO: revert back to original state
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryCreateWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryCreateWizard.java
index 363bb3e..b84a44e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryCreateWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryCreateWizard.java
@@ -165,4 +165,8 @@ public class ResourceFactoryCreateWizard implements Wizard {
public ResourceType getCreateType() {
return createType;
}
+
+ public void cancel() {
+ // TODO: revert back to original state
+ }
}
commit ab83afe6697b693ecf22ce16e3c05ed3f6ac694f
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Mar 23 12:17:17 2010 -0400
explicitly support some standard java sysprops
diff --git a/modules/common/filetemplate-bundle/src/test/java/org/rhq/bundle/filetemplate/recipe/RecipeParserTest.java b/modules/common/filetemplate-bundle/src/test/java/org/rhq/bundle/filetemplate/recipe/RecipeParserTest.java
index c997d57..6ec0dd9 100644
--- a/modules/common/filetemplate-bundle/src/test/java/org/rhq/bundle/filetemplate/recipe/RecipeParserTest.java
+++ b/modules/common/filetemplate-bundle/src/test/java/org/rhq/bundle/filetemplate/recipe/RecipeParserTest.java
@@ -129,29 +129,51 @@ public class RecipeParserTest {
}
public void testSimpleRecipeReplaceJavaSystemPropertyReplacementVariables() throws Exception {
- addRecipeCommand("deploy -f jboss1.tar -d <%java.io.tmpdir%>");
- addRecipeCommand("deploy -f jboss2.tar -d <%custom.sysprop%>");
+ /*
+ java.util.Properties sysprops = System.getProperties();
+ for (Map.Entry<Object, Object> sysprop : sysprops.entrySet()) {
+ if (sysprop.getValue().toString().length() < 60) {
+ System.out.println("==>" + sysprop.getKey() + "=" + sysprop.getValue());
+ }
+ }
+ */
+
+ addRecipeCommand("deploy -f jboss1.tar -d <%rhq.system.sysprop.java.io.tmpdir%>");
+ addRecipeCommand("deploy -f jboss2.tar -d <%rhq.system.sysprop.file.separator%>");
+ //addRecipeCommand("deploy -f jboss3.tar -d <%rhq.system.sysprop.line.separator%>"); // can't test this here
+ addRecipeCommand("deploy -f jboss4.tar -d <%rhq.system.sysprop.path.separator%>");
+ addRecipeCommand("deploy -f jboss5.tar -d <%rhq.system.sysprop.java.home%>");
+ addRecipeCommand("deploy -f jboss6.tar -d <%rhq.system.sysprop.java.version%>");
+ //addRecipeCommand("deploy -f jboss7.tar -d <%rhq.system.sysprop.user.timezone%>"); // sometimes this is empty
+ //addRecipeCommand("deploy -f jboss8.tar -d <%rhq.system.sysprop.user.region%>"); // sometimes this doesn't exist
+ addRecipeCommand("deploy -f jboss9.tar -d <%rhq.system.sysprop.user.country%>");
+ addRecipeCommand("deploy -f jboss10.tar -d <%rhq.system.sysprop.user.language%>");
+ addRecipeCommand("deploy -f jboss11.tar -d <%rhq.system.sysprop.custom.sysprop%>"); // non-standard sysprop
RecipeParser parser = new RecipeParser();
parser.setReplaceReplacementVariables(true);
RecipeContext context = new RecipeContext(getRecipe());
parser.parseRecipe(context);
Map<String, String> files = context.getDeployFiles();
- assert files.containsKey("jboss1.tar") : files;
assert files.get("jboss1.tar").equals(System.getProperty("java.io.tmpdir")) : files;
- assert files.containsKey("jboss2.tar") : files;
- assert files.get("jboss2.tar").equals("<%custom.sysprop%>") : files;
+ assert files.get("jboss2.tar").equals(System.getProperty("file.separator")) : files;
+ //assert files.get("jboss3.tar").equals(System.getProperty("line.separator")) : files;
+ assert files.get("jboss4.tar").equals(System.getProperty("path.separator")) : files;
+ assert files.get("jboss5.tar").equals(System.getProperty("java.home")) : files;
+ assert files.get("jboss6.tar").equals(System.getProperty("java.version")) : files;
+ //assert files.get("jboss7.tar").equals(System.getProperty("user.timezone")) : files;
+ //assert files.get("jboss8.tar").equals(System.getProperty("user.region")) : files;
+ assert files.get("jboss9.tar").equals(System.getProperty("user.country")) : files;
+ assert files.get("jboss10.tar").equals(System.getProperty("user.language")) : files;
+ assert files.get("jboss11.tar").equals("<%rhq.system.sysprop.custom.sysprop%>") : files;
- // now set our custom system property and see that it gets replaced properly
+ // now set a custom system property and see that it does NOT get replaced - we ignore custom sysprops!
System.setProperty("custom.sysprop", "MY/CUSTOM/PROPERTY/HERE");
parser = new RecipeParser();
parser.setReplaceReplacementVariables(true);
context = new RecipeContext(getRecipe());
parser.parseRecipe(context);
files = context.getDeployFiles();
- assert files.containsKey("jboss1.tar") : files;
- assert files.get("jboss1.tar").equals(System.getProperty("java.io.tmpdir")) : files;
- assert files.containsKey("jboss2.tar") : files;
- assert files.get("jboss2.tar").equals("MY/CUSTOM/PROPERTY/HERE") : files;
+ assert files.get("jboss11.tar").equals("<%rhq.system.sysprop.custom.sysprop%>") : files;
}
public void testSimpleRecipe() throws Exception {
diff --git a/modules/core/native-system/src/main/java/org/rhq/core/system/SystemInfoFactory.java b/modules/core/native-system/src/main/java/org/rhq/core/system/SystemInfoFactory.java
index 3783495..8d9e05d 100644
--- a/modules/core/native-system/src/main/java/org/rhq/core/system/SystemInfoFactory.java
+++ b/modules/core/native-system/src/main/java/org/rhq/core/system/SystemInfoFactory.java
@@ -365,8 +365,16 @@ public class SystemInfoFactory {
SystemInfo systemInfo = createSystemInfo();
Map<String, String> tokens = new HashMap<String, String>();
- tokens.put(TOKEN_PREFIX + "hostname", systemInfo.getHostname());
+ // support several standard Java system properties
+ String[] syspropsToSupport = new String[] { "java.io.tmpdir", "file.separator", "line.separator",
+ "path.separator", "java.home", "java.version", "user.timezone", "user.region", "user.country",
+ "user.language" };
+ for (String sysprop : syspropsToSupport) {
+ tokens.put(TOKEN_PREFIX + "sysprop." + sysprop, System.getProperty(sysprop, sysprop)); // default is the name itself, just to show it wasn't there
+ }
+
+ tokens.put(TOKEN_PREFIX + "hostname", systemInfo.getHostname());
tokens.put(TOKEN_PREFIX + "os.name", systemInfo.getOperatingSystemName());
tokens.put(TOKEN_PREFIX + "os.version", systemInfo.getOperatingSystemVersion());
tokens.put(TOKEN_PREFIX + "os.type", systemInfo.getOperatingSystemType().toString());
commit 35b93622b191bbc8a8014f35f83aea6e47df60d7
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Mar 23 12:16:45 2010 -0400
never mind, don't support sysprop fallback
diff --git a/modules/core/util/src/main/java/org/rhq/core/template/TemplateEngine.java b/modules/core/util/src/main/java/org/rhq/core/template/TemplateEngine.java
index 6f2a3e0..d748463 100644
--- a/modules/core/util/src/main/java/org/rhq/core/template/TemplateEngine.java
+++ b/modules/core/util/src/main/java/org/rhq/core/template/TemplateEngine.java
@@ -48,12 +48,6 @@ public class TemplateEngine implements Serializable {
String value = tokens.get(key);
if (value != null) {
next = value;
- } else {
- // fallback is to see if the replacement key represents a Java system prop
- value = System.getProperty(key);
- if (value != null) {
- next = value;
- }
}
}
//If we didn't find a replacement for the key
commit cdfc55d9f42b1bc43ca5b6afae39f75eabce343d
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Mar 23 09:35:18 2010 -0400
test the different gnu getop ways to specify the args
diff --git a/modules/common/filetemplate-bundle/src/test/java/org/rhq/bundle/filetemplate/recipe/RecipeParserTest.java b/modules/common/filetemplate-bundle/src/test/java/org/rhq/bundle/filetemplate/recipe/RecipeParserTest.java
index d36831b..c997d57 100644
--- a/modules/common/filetemplate-bundle/src/test/java/org/rhq/bundle/filetemplate/recipe/RecipeParserTest.java
+++ b/modules/common/filetemplate-bundle/src/test/java/org/rhq/bundle/filetemplate/recipe/RecipeParserTest.java
@@ -41,23 +41,27 @@ public class RecipeParserTest {
}
public void testConfigDefRecipe() throws Exception {
+ addRecipeCommand("configdef --name=my.first.property");
addRecipeCommand("configdef -n custom.prop");
RecipeParser parser = new RecipeParser();
RecipeContext context = new RecipeContext(getRecipe());
parser.parseRecipe(context);
Set<String> vars = context.getReplacementVariables();
- assert vars.size() == 1 : vars;
+ assert vars.size() == 2 : vars;
+ assert vars.contains("my.first.property");
assert vars.contains("custom.prop");
}
public void testRealizeRecipe() throws Exception {
addRecipeCommand("realize --file=<%opt.dir%>/config.ini");
+ addRecipeCommand("realize -f <%opt2.dir%>/config2.ini");
RecipeParser parser = new RecipeParser();
RecipeContext context = new RecipeContext(getRecipe());
parser.parseRecipe(context);
Set<String> files = context.getRealizedFiles();
- assert files.size() == 1 : files;
+ assert files.size() == 2 : files;
assert files.contains("<%opt.dir%>/config.ini") : files;
+ assert files.contains("<%opt2.dir%>/config2.ini") : files;
}
public void testFileRecipe() throws Exception {
commit 716420b870b9eb6ce9a6b39cd6973cafbf0267e1
Merge: 0eb9524... 9b6a941...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Mar 23 09:20:21 2010 -0400
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
commit 0eb9524ead03b9323a27aa6dc3c18f8fe49526b4
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Mar 23 09:19:40 2010 -0400
add new configdef recipe command so we can specify a replacement variable that may exist in bundle files that are to be realized
diff --git a/modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/ConfigDefRecipeCommand.java b/modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/ConfigDefRecipeCommand.java
new file mode 100644
index 0000000..54f297c
--- /dev/null
+++ b/modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/ConfigDefRecipeCommand.java
@@ -0,0 +1,81 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package org.rhq.bundle.filetemplate.recipe;
+
+import gnu.getopt.Getopt;
+import gnu.getopt.LongOpt;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class ConfigDefRecipeCommand implements RecipeCommand {
+
+ public String getName() {
+ return "configdef";
+ }
+
+ public void parse(RecipeParser parser, RecipeContext context, String[] args) {
+ String sopts = ":n:";
+ LongOpt[] lopts = { new LongOpt("name", LongOpt.REQUIRED_ARGUMENT, null, 'n') };
+
+ String replacementVariableName = null;
+
+ Getopt getopt = new Getopt(getName(), args, sopts, lopts);
+ int code;
+
+ while ((code = getopt.getopt()) != -1) {
+ switch (code) {
+ case ':':
+ case '?': {
+ throw new IllegalArgumentException("Bad recipe command.");
+ }
+
+ case 1: {
+ throw new IllegalArgumentException("Bad recipe command!");
+ }
+
+ case 'n': {
+ replacementVariableName = getopt.getOptarg();
+ break;
+ }
+
+ default: {
+ throw new IllegalArgumentException("Unexpected error in recipe command");
+ }
+
+ }
+ }
+
+ if (replacementVariableName == null) {
+ throw new IllegalArgumentException(
+ "Did not specify the name of the configuration definition replacement variable");
+ }
+
+ Set<String> replacementVariableNames = new HashSet<String>(1);
+ replacementVariableNames.add(replacementVariableName);
+ context.addReplacementVariables(replacementVariableNames);
+
+ return;
+ }
+}
diff --git a/modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/RecipeParser.java b/modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/RecipeParser.java
index d48c3ba..ea9464d 100644
--- a/modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/RecipeParser.java
+++ b/modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/RecipeParser.java
@@ -129,6 +129,7 @@ public class RecipeParser {
HashMap<String, RecipeCommand> commands = new HashMap<String, RecipeCommand>();
RecipeCommand[] knownCommands = new RecipeCommand[] { new ScriptRecipeCommand(), //
+ new ConfigDefRecipeCommand(), //
new CommandRecipeCommand(), //
new FileRecipeCommand(), //
new RealizeRecipeCommand(), //
diff --git a/modules/common/filetemplate-bundle/src/test/java/org/rhq/bundle/filetemplate/recipe/RecipeParserTest.java b/modules/common/filetemplate-bundle/src/test/java/org/rhq/bundle/filetemplate/recipe/RecipeParserTest.java
index bfa58e6..d36831b 100644
--- a/modules/common/filetemplate-bundle/src/test/java/org/rhq/bundle/filetemplate/recipe/RecipeParserTest.java
+++ b/modules/common/filetemplate-bundle/src/test/java/org/rhq/bundle/filetemplate/recipe/RecipeParserTest.java
@@ -40,6 +40,16 @@ public class RecipeParserTest {
cleanRecipe();
}
+ public void testConfigDefRecipe() throws Exception {
+ addRecipeCommand("configdef -n custom.prop");
+ RecipeParser parser = new RecipeParser();
+ RecipeContext context = new RecipeContext(getRecipe());
+ parser.parseRecipe(context);
+ Set<String> vars = context.getReplacementVariables();
+ assert vars.size() == 1 : vars;
+ assert vars.contains("custom.prop");
+ }
+
public void testRealizeRecipe() throws Exception {
addRecipeCommand("realize --file=<%opt.dir%>/config.ini");
RecipeParser parser = new RecipeParser();
@@ -114,6 +124,32 @@ public class RecipeParserTest {
assert files.get("jboss3.tar").equals(SystemInfoFactory.createSystemInfo().getHostname() + "/jboss") : files;
}
+ public void testSimpleRecipeReplaceJavaSystemPropertyReplacementVariables() throws Exception {
+ addRecipeCommand("deploy -f jboss1.tar -d <%java.io.tmpdir%>");
+ addRecipeCommand("deploy -f jboss2.tar -d <%custom.sysprop%>");
+ RecipeParser parser = new RecipeParser();
+ parser.setReplaceReplacementVariables(true);
+ RecipeContext context = new RecipeContext(getRecipe());
+ parser.parseRecipe(context);
+ Map<String, String> files = context.getDeployFiles();
+ assert files.containsKey("jboss1.tar") : files;
+ assert files.get("jboss1.tar").equals(System.getProperty("java.io.tmpdir")) : files;
+ assert files.containsKey("jboss2.tar") : files;
+ assert files.get("jboss2.tar").equals("<%custom.sysprop%>") : files;
+
+ // now set our custom system property and see that it gets replaced properly
+ System.setProperty("custom.sysprop", "MY/CUSTOM/PROPERTY/HERE");
+ parser = new RecipeParser();
+ parser.setReplaceReplacementVariables(true);
+ context = new RecipeContext(getRecipe());
+ parser.parseRecipe(context);
+ files = context.getDeployFiles();
+ assert files.containsKey("jboss1.tar") : files;
+ assert files.get("jboss1.tar").equals(System.getProperty("java.io.tmpdir")) : files;
+ assert files.containsKey("jboss2.tar") : files;
+ assert files.get("jboss2.tar").equals("MY/CUSTOM/PROPERTY/HERE") : files;
+ }
+
public void testSimpleRecipe() throws Exception {
addRecipeCommand("deploy -f jboss.tar -d /opt/jboss");
addRecipeCommand("deploy -f tomcat.tar -d /opt/tomcat");
commit c165b0103c5171b004700db50363d9bc56632931
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Mar 23 09:18:44 2010 -0400
all for recipe replacement variables to represent Java system properties
diff --git a/modules/core/util/src/main/java/org/rhq/core/template/TemplateEngine.java b/modules/core/util/src/main/java/org/rhq/core/template/TemplateEngine.java
index 113771d..6f2a3e0 100644
--- a/modules/core/util/src/main/java/org/rhq/core/template/TemplateEngine.java
+++ b/modules/core/util/src/main/java/org/rhq/core/template/TemplateEngine.java
@@ -5,7 +5,7 @@ import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-public class TemplateEngine implements Serializable{
+public class TemplateEngine implements Serializable {
/**
*
*/
@@ -48,6 +48,12 @@ public class TemplateEngine implements Serializable{
String value = tokens.get(key);
if (value != null) {
next = value;
+ } else {
+ // fallback is to see if the replacement key represents a Java system prop
+ value = System.getProperty(key);
+ if (value != null) {
+ next = value;
+ }
}
}
//If we didn't find a replacement for the key
commit 9b6a9419e52a21fce453ac6f638541298f9e3a94
Merge: 5ca5f89... 986f0d2...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Mar 22 21:25:08 2010 -0400
Merge branch 'gwt' into gwt-jay
commit 5ca5f894d2473a61d93c8bee15ab40bd41468683
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Mar 22 21:22:22 2010 -0400
First version of deploy wizard that actually deploys something!
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployNowStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployNowStep.java
index e3bc504..55d1a7f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployNowStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployNowStep.java
@@ -27,15 +27,14 @@ import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
-import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
public class DeployNowStep implements WizardStep {
- private DynamicForm form;
- private final BundleDeployWizard wizard;
+ static private final String DEPLOY_LATER = "later";
+ static private final String DEPLOY_NOW = "now";
- private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
+ private final BundleDeployWizard wizard;
+ private DynamicForm form;
public DeployNowStep(BundleDeployWizard bundleCreationWizard) {
this.wizard = bundleCreationWizard;
@@ -52,16 +51,17 @@ public class DeployNowStep implements WizardStep {
form.setNumCols(2);
form.setColWidths("50%", "*");
- LinkedHashMap<String, Boolean> values = new LinkedHashMap<String, Boolean>();
- values.put("Deploy Now", Boolean.TRUE);
- values.put("Save Definition and Deploy Later", Boolean.FALSE);
- final RadioGroupItem radioGroupItem = new RadioGroupItem("options", "Deploy Options");
+ RadioGroupItem radioGroupItem = new RadioGroupItem("deployTime", "Deployment Time");
+ LinkedHashMap<String, String> radioGroupValues = new LinkedHashMap<String, String>();
+ radioGroupValues.put(DEPLOY_NOW, "Deploy Now");
+ radioGroupValues.put(DEPLOY_LATER, "Save Definition and Deploy Later");
radioGroupItem.setRequired(true);
- radioGroupItem.setValueMap(values);
+ radioGroupItem.setValueMap(radioGroupValues);
+ radioGroupItem.setValue(DEPLOY_NOW);
+ wizard.setDeployNow(true);
radioGroupItem.addChangedHandler(new ChangedHandler() {
public void onChanged(ChangedEvent event) {
- wizard.setDeployNow((Boolean) event.getValue());
- enableNextButtonWhenAppropriate();
+ wizard.setDeployNow(DEPLOY_NOW.equals(event.getValue()));
}
});
@@ -74,19 +74,7 @@ public class DeployNowStep implements WizardStep {
return form.validate();
}
- public boolean isNextEnabled() {
- return (null != this.wizard.getDeployNow());
- }
-
public boolean isPreviousEnabled() {
return true;
}
-
- private void enableNextButtonWhenAppropriate() {
- this.wizard.getView().getNextButton().setDisabled(!isNextEnabled());
- }
-
- private boolean isNotEmpty(String s) {
- return (s != null && s.trim().length() > 0);
- }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java
index bbf30bf..f06e278 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java
@@ -46,6 +46,10 @@ public class DeployStep implements WizardStep {
this.wizard = bundleCreationWizard;
}
+ public String getName() {
+ return "Deploy Bundle to Target Platforms";
+ }
+
public Canvas getCanvas() {
if (canvas == null) {
canvas = new VLayout();
@@ -66,7 +70,7 @@ public class DeployStep implements WizardStep {
if (wizard.isNewDefinition()) {
bundleServer.createBundleDeployDefinition(wizard.getBundleVersion().getId(), wizard.getName(), wizard
- .getDescription(), wizard.getConfig(), false, -1, false,
+ .getDescription(), wizard.getConfig(), false, -1, false, //
new AsyncCallback<BundleDeployDefinition>() {
public void onSuccess(BundleDeployDefinition result) {
deployingImage.setSrc("/images/status_complete.gif");
@@ -75,62 +79,52 @@ public class DeployStep implements WizardStep {
new Message("Created deploy definition [" + result.getName() + "] description ["
+ result.getDescription(), Severity.Info));
wizard.setBundleDeployDefinition(result);
- enableNextButtonWhenAppropriate();
+
+ bundleServer.scheduleBundleDeployment(wizard.getBundleDeployDefinition().getId(), wizard
+ .getPlatformId(), //
+ new AsyncCallback<BundleDeployment>() {
+ public void onSuccess(BundleDeployment result) {
+ deployingImage.setSrc("/images/status_complete.gif");
+ deployingMessage.setText("Bundle Deployment Scheduled!");
+ CoreGUI.getMessageCenter().notify(
+ new Message("Schedule bundle deployment ["
+ + wizard.getBundleDeployDefinition().getName() + "] resource ["
+ + result.getResource() + "]", Severity.Info));
+ wizard.setBundleDeployment(result);
+ }
+
+ public void onFailure(Throwable caught) {
+ deployingImage.setSrc("/images/status_error.gif");
+ deployingMessage.setText("Failed to Schedule Deployment!");
+ CoreGUI.getErrorHandler().handleError(
+ "Failed to schedule deployment: " + caught.getMessage(), caught);
+ wizard.setBundleDeployment(null);
+ }
+ });
}
public void onFailure(Throwable caught) {
deployingImage.setSrc("/images/status_error.gif");
- deployingMessage.setText("Failed to create deply definition!");
+ deployingMessage.setText("Failed to create deploy definition!");
CoreGUI.getErrorHandler().handleError(
"Failed to create deploy definition: " + caught.getMessage(), caught);
- enableNextButtonWhenAppropriate();
}
});
}
-
- bundleServer.scheduleBundleDeployment(wizard.getBundleDeployDefinition().getId(), wizard.getPlatformId(),
- new AsyncCallback<BundleDeployment>() {
- public void onSuccess(BundleDeployment result) {
- deployingImage.setSrc("/images/status_complete.gif");
- deployingMessage.setText("Bundle Deployment Scheduled!");
- CoreGUI.getMessageCenter().notify(
- new Message("Schedule bundle deployment [" + wizard.getBundleDeployDefinition().getName()
- + "] resource [" + result.getResource() + "]", Severity.Info));
- wizard.setBundleDeployment(result);
- enableNextButtonWhenAppropriate();
- }
-
- public void onFailure(Throwable caught) {
- deployingImage.setSrc("/images/status_error.gif");
- deployingMessage.setText("Failed to Schedule Deployment!");
- CoreGUI.getErrorHandler().handleError("Failed to schedule deployment: " + caught.getMessage(),
- caught);
- wizard.setBundleDeployment(null);
- enableNextButtonWhenAppropriate();
- }
- });
}
return canvas;
}
- public boolean nextPage() {
- return this.wizard.getBundleVersion() != null;
- }
-
- public String getName() {
- return "Deploy Bundle to Target Platforms";
- }
-
public boolean isNextEnabled() {
- return this.wizard.getBundleDeployment() != null;
+ return false;
}
public boolean isPreviousEnabled() {
return true;
}
- private void enableNextButtonWhenAppropriate() {
- this.wizard.getView().getNextButton().setDisabled(!isNextEnabled());
+ public boolean nextPage() {
+ return false;
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectPlatformsStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectPlatformsStep.java
index d523fbe..94a4707 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectPlatformsStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectPlatformsStep.java
@@ -25,20 +25,20 @@ import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
-import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
public class SelectPlatformsStep implements WizardStep {
- private DynamicForm form;
private final BundleDeployWizard wizard;
-
- private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
+ private DynamicForm form;
public SelectPlatformsStep(BundleDeployWizard bundleCreationWizard) {
this.wizard = bundleCreationWizard;
}
+ public String getName() {
+ return "Select Target Platforms";
+ }
+
public Canvas getCanvas() {
if (form == null) {
form = new DynamicForm();
@@ -55,9 +55,7 @@ public class SelectPlatformsStep implements WizardStep {
if (value == null) {
value = "";
}
- wizard.setSubtitle(value.toString());
wizard.setPlatformId(Integer.valueOf(value.toString()));
- enableNextButtonWhenAppropriate();
}
});
@@ -71,19 +69,7 @@ public class SelectPlatformsStep implements WizardStep {
return form.validate();
}
- public String getName() {
- return "Select Target Platforms";
- }
-
- public boolean isNextEnabled() {
- return (null != this.wizard.getPlatformId());
- }
-
public boolean isPreviousEnabled() {
return true;
}
-
- private void enableNextButtonWhenAppropriate() {
- this.wizard.getView().getNextButton().setDisabled(!isNextEnabled());
- }
}
commit 2717080092cbcd4c08f5c0ac7940e284401bc11c
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Mar 22 21:21:46 2010 -0400
Make sure display name is set for recipe config items, otherwise the
ConfigurationEditor will display nulls.
diff --git a/modules/enterprise/server/plugins/filetemplate-bundle/src/main/java/org/rhq/enterprise/server/plugins/filetemplate/BundleServerPluginComponent.java b/modules/enterprise/server/plugins/filetemplate-bundle/src/main/java/org/rhq/enterprise/server/plugins/filetemplate/BundleServerPluginComponent.java
index 342b5b1..a4d7bc9 100644
--- a/modules/enterprise/server/plugins/filetemplate-bundle/src/main/java/org/rhq/enterprise/server/plugins/filetemplate/BundleServerPluginComponent.java
+++ b/modules/enterprise/server/plugins/filetemplate-bundle/src/main/java/org/rhq/enterprise/server/plugins/filetemplate/BundleServerPluginComponent.java
@@ -85,8 +85,9 @@ public class BundleServerPluginComponent implements ServerPluginComponent, Bundl
if (recipeContext.getReplacementVariables() != null) {
configDef = new ConfigurationDefinition("replacementVariables", null);
for (String replacementVar : recipeContext.getReplacementVariables()) {
- PropertyDefinitionSimple prop = new PropertyDefinitionSimple(replacementVar, null, false,
- PropertySimpleType.STRING);
+ PropertyDefinitionSimple prop = new PropertyDefinitionSimple(replacementVar,
+ "Needed by bundle recipe.", false, PropertySimpleType.STRING);
+ prop.setDisplayName(replacementVar);
configDef.put(prop);
}
}
commit 2c7d193fcb8a1e92e6171af2a151ff1208ab0df0
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Mar 22 21:20:27 2010 -0400
make sure the replacement string is escaped such that regex characters are
taken as literals (to handle, for example, windows paths)
diff --git a/modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/RecipeParser.java b/modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/RecipeParser.java
index d48c3ba..ae6c0a5 100644
--- a/modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/RecipeParser.java
+++ b/modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/RecipeParser.java
@@ -188,7 +188,7 @@ public class RecipeParser {
}
// If we didn't find a replacement for the key then leave the original value unchanged
- matcher.appendReplacement(buffer, next);
+ matcher.appendReplacement(buffer, Matcher.quoteReplacement(next));
}
matcher.appendTail(buffer);
return buffer.toString();
commit 986f0d22343472822ed6d86f812ba3504e14df10
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Mar 22 17:06:00 2010 -0400
get gwt to use the new criteria and show things like the latest version
also get the delete button to work - you can delete a bundle
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/composite/BundleWithLatestVersionComposite.java b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/composite/BundleWithLatestVersionComposite.java
index 40ca18d..cc16d2d 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/composite/BundleWithLatestVersionComposite.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/composite/BundleWithLatestVersionComposite.java
@@ -31,16 +31,20 @@ public class BundleWithLatestVersionComposite implements Serializable {
private String bundleName;
private String bundleDescription;
private String latestVersion;
- private Long deploymentCount;
+ private Long versionsCount;
+
+ public BundleWithLatestVersionComposite() {
+ // GWT needs this
+ }
public BundleWithLatestVersionComposite(Integer bundleId, String bundleName, String bundleDescription,
- String latestVersion, Long deploymentCount) {
+ String latestVersion, Long versionsCount) {
this.bundleId = bundleId;
this.bundleName = bundleName;
this.bundleDescription = bundleDescription;
this.latestVersion = latestVersion;
- this.deploymentCount = deploymentCount;
+ this.versionsCount = versionsCount;
}
public Integer getBundleId() {
@@ -75,12 +79,12 @@ public class BundleWithLatestVersionComposite implements Serializable {
this.latestVersion = latestVersion;
}
- public Long getDeploymentCount() {
- return deploymentCount;
+ public Long getVersionsCount() {
+ return versionsCount;
}
- public void setDeploymentCount(Long deploymentCount) {
- this.deploymentCount = deploymentCount;
+ public void setVersionsCount(Long versionsCount) {
+ this.versionsCount = versionsCount;
}
public String toString() {
@@ -89,7 +93,7 @@ public class BundleWithLatestVersionComposite implements Serializable {
builder.append(", bundleName=").append(bundleName);
builder.append(", bundleDescription=").append(bundleDescription);
builder.append(", latestVersion=").append(latestVersion);
- builder.append(", deploymentCount=").append(deploymentCount);
+ builder.append(", versionsCount=").append(versionsCount);
builder.append("]");
return builder.toString();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java
deleted file mode 100644
index 4bdc68b..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java
+++ /dev/null
@@ -1,93 +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.bundle.create;
-
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.ui.HasHorizontalAlignment;
-import com.google.gwt.user.client.ui.Label;
-import com.smartgwt.client.types.Alignment;
-import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.Img;
-import com.smartgwt.client.widgets.layout.VLayout;
-
-import org.rhq.core.domain.bundle.BundleVersion;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
-import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
-
-public class BundleVerificationStep implements WizardStep {
-
- private final BundleCreateWizard wizard;
-
- private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
- private VLayout canvas;
-
- public BundleVerificationStep(BundleCreateWizard bundleCreationWizard) {
- this.wizard = bundleCreationWizard;
- }
-
- public Canvas getCanvas() {
- if (canvas != null && wizard.getBundleVersion() != null) {
- // if we've already got a persisted bundle version, don't verify it again or try to create it again
- return canvas;
- }
-
- canvas = new VLayout();
- canvas.setWidth100();
- canvas.setHeight100();
- canvas.setAlign(Alignment.CENTER);
-
- final Img verifyingImage = new Img("/images/status-bar.gif");
- verifyingImage.setLayoutAlign(Alignment.CENTER);
- verifyingImage.setWidth(50);
- verifyingImage.setHeight(15);
-
- final Label verifiedMessage = new Label("Verifying...");
- verifiedMessage.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
-
- canvas.addMember(verifyingImage);
- canvas.addMember(verifiedMessage);
-
-
- return canvas;
- }
-
- public boolean nextPage() {
- return this.wizard.getBundleVersion() != null;
- }
-
- public String getName() {
- return "Verify Recipe";
- }
-
- public boolean isNextEnabled() {
- return this.wizard.getBundleVersion() != null;
- }
-
- public boolean isPreviousEnabled() {
- return true;
- }
-
- private void enableNextButtonWhenAppropriate() {
- this.wizard.getView().getNextButton().setDisabled(!isNextEnabled());
- }
-}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
index 155dcdd..d702b9b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
@@ -18,17 +18,24 @@
*/
package org.rhq.enterprise.gui.coregui.client.bundle.list;
+import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.SelectionAppearance;
import com.smartgwt.client.types.SelectionStyle;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.bundle.Bundle;
+import org.rhq.core.domain.bundle.composite.BundleWithLatestVersionComposite;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.bundle.create.BundleCreateWizard;
-import org.rhq.enterprise.gui.coregui.client.bundle.deploy.BundleDeployWizard;
import org.rhq.enterprise.gui.coregui.client.bundle.create.BundleUpdateWizard;
+import org.rhq.enterprise.gui.coregui.client.bundle.deploy.BundleDeployWizard;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
+import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
/**
* @author Greg Hinkle
@@ -39,13 +46,15 @@ public class BundlesListView extends VLayout {
protected void onDraw() {
super.onDraw();
- Table table = new Table("Bundles");
+ final Table table = new Table("Bundles");
- table.setDataSource(new BundlesDataSource());
+ table.setDataSource(new BundlesWithLatestVersionDataSource());
table.getListGrid().getField("id").setWidth("60");
table.getListGrid().getField("name").setWidth("25%");
- table.getListGrid().getField("description").setWidth("*");
+ table.getListGrid().getField("description").setWidth("25%");
+ table.getListGrid().getField("latestVersion").setWidth("25%");
+ table.getListGrid().getField("versionsCount").setWidth("*");
table.getListGrid().setSelectionType(SelectionStyle.SIMPLE);
table.getListGrid().setSelectionAppearance(SelectionAppearance.CHECKBOX);
@@ -57,6 +66,27 @@ public class BundlesListView extends VLayout {
}
});
+ table.addTableAction("Delete Bundle", Table.SelectionEnablement.ANY, "Are You Sure?", new TableAction() {
+ public void executeAction(ListGridRecord[] selections) {
+ BundlesWithLatestVersionDataSource ds = (BundlesWithLatestVersionDataSource) table.getDataSource();
+ for (ListGridRecord selection : selections) {
+ BundleGWTServiceAsync bundleManager = GWTServiceLookup.getBundleService();
+ final BundleWithLatestVersionComposite object = ds.copyValues(selection);
+ bundleManager.deleteBundle(object.getBundleId(), new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+ "Failed to delete bundle [" + object.getBundleName() + "]", caught);
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("Deleted bundle [" + object.getBundleName() + "]", Severity.Info));
+ }
+ });
+ }
+ }
+ });
+
table.addTableAction("Update Bundle", Table.SelectionEnablement.SINGLE, null, new TableAction() {
public void executeAction(ListGridRecord[] selection) {
Bundle bundle = (Bundle) selection[0].getAttributeAsObject("entity");
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesWithLatestVersionDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesWithLatestVersionDataSource.java
new file mode 100644
index 0000000..9f8b106
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesWithLatestVersionDataSource.java
@@ -0,0 +1,112 @@
+/*
+ * 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.bundle.list;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.data.fields.DataSourceIntegerField;
+import com.smartgwt.client.data.fields.DataSourceTextField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+import org.rhq.core.domain.bundle.composite.BundleWithLatestVersionComposite;
+import org.rhq.core.domain.criteria.BundleCriteria;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+
+/**
+ * @author John Mazzitelli
+ */
+public class BundlesWithLatestVersionDataSource extends RPCDataSource<BundleWithLatestVersionComposite> {
+
+ private BundleGWTServiceAsync bundleService = GWTServiceLookup.getBundleService();
+
+ public BundlesWithLatestVersionDataSource() {
+
+ DataSourceIntegerField idField = new DataSourceIntegerField("id", "ID");
+ idField.setPrimaryKey(true);
+ addField(idField);
+
+ DataSourceTextField nameField = new DataSourceTextField("name", "Name");
+ addField(nameField);
+
+ DataSourceTextField descriptionField = new DataSourceTextField("description", "Description");
+ addField(descriptionField);
+
+ DataSourceTextField latestVersionField = new DataSourceTextField("latestVersion", "Latest Version");
+ addField(latestVersionField);
+
+ DataSourceIntegerField deploymentCountField = new DataSourceIntegerField("versionsCount", "Versions Count");
+ addField(deploymentCountField);
+ }
+
+ @Override
+ protected void executeFetch(final DSRequest request, final DSResponse response) {
+
+ BundleCriteria criteria = new BundleCriteria();
+ criteria.setPageControl(getPageControl(request));
+
+ bundleService.findBundlesWithLastestVersionCompositesByCriteria(criteria,
+ new AsyncCallback<PageList<BundleWithLatestVersionComposite>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load bundle-with-latest-version data", caught);
+ response.setStatus(DSResponse.STATUS_FAILURE);
+ processResponse(request.getRequestId(), response);
+ }
+
+ public void onSuccess(PageList<BundleWithLatestVersionComposite> result) {
+ response.setData(buildRecords(result));
+ response.setTotalRows(result.getTotalSize());
+ processResponse(request.getRequestId(), response);
+ }
+ });
+
+ }
+
+ @Override
+ public BundleWithLatestVersionComposite copyValues(ListGridRecord from) {
+ Integer idAttrib = from.getAttributeAsInt("id");
+ String nameAttrib = from.getAttribute("name");
+ String descriptionAttrib = from.getAttribute("description");
+ String latestVersionAttrib = from.getAttribute("latestVersion");
+ Integer versionsCountAttrib = from.getAttributeAsInt("versionsCount");
+
+ return new BundleWithLatestVersionComposite(idAttrib, nameAttrib, descriptionAttrib, latestVersionAttrib,
+ versionsCountAttrib.longValue());
+ }
+
+ @Override
+ public ListGridRecord copyValues(BundleWithLatestVersionComposite from) {
+ ListGridRecord record = new ListGridRecord();
+
+ record.setAttribute("id", from.getBundleId());
+ record.setAttribute("name", from.getBundleName());
+ record.setAttribute("description", from.getBundleDescription());
+ record.setAttribute("latestVersion", from.getLatestVersion());
+ record.setAttribute("versionsCount", Integer.valueOf(from.getVersionsCount().intValue())); // want int, not long
+
+ record.setAttribute("object", from);
+
+ return record;
+
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java
index 82d6166..c257909 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java
@@ -28,6 +28,7 @@ import org.rhq.core.domain.bundle.BundleDeployDefinition;
import org.rhq.core.domain.bundle.BundleDeployment;
import org.rhq.core.domain.bundle.BundleType;
import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.core.domain.bundle.composite.BundleWithLatestVersionComposite;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.criteria.BundleCriteria;
import org.rhq.core.domain.criteria.BundleVersionCriteria;
@@ -46,12 +47,17 @@ public interface BundleGWTService extends RemoteService {
BundleVersion createBundleVersion(int bundleId, String name, String version, String recipe) throws Exception;
+ void deleteBundle(int bundleId);
+
void deleteBundleVersion(int bundleVersionId);
PageList<Bundle> findBundlesByCriteria(BundleCriteria criteria) throws Exception;
PageList<BundleVersion> findBundleVersionsByCriteria(BundleVersionCriteria criteria) throws Exception;
+ PageList<BundleWithLatestVersionComposite> findBundlesWithLastestVersionCompositesByCriteria(BundleCriteria criteria)
+ throws Exception;
+
HashMap<String, Boolean> getAllBundleVersionFilenames(int bundleVersionId) throws Exception;
ArrayList<BundleType> getAllBundleTypes();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
index 4cc3293..25eba1c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
@@ -26,6 +26,7 @@ import org.rhq.core.domain.bundle.BundleDeployDefinition;
import org.rhq.core.domain.bundle.BundleDeployment;
import org.rhq.core.domain.bundle.BundleType;
import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.core.domain.bundle.composite.BundleWithLatestVersionComposite;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.criteria.BundleCriteria;
import org.rhq.core.domain.criteria.BundleVersionCriteria;
@@ -88,6 +89,14 @@ public class BundleGWTServiceImpl extends AbstractGWTServiceImpl implements Bund
return SerialUtility.prepare(results, "createBundleVersion");
}
+ public void deleteBundle(int bundleId) {
+ try {
+ bundleManager.deleteBundle(getSessionSubject(), bundleId);
+ } catch (Exception e) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ }
+ }
+
public void deleteBundleVersion(int bundleVersionId) {
try {
bundleManager.deleteBundleVersion(getSessionSubject(), bundleVersionId);
@@ -114,6 +123,17 @@ public class BundleGWTServiceImpl extends AbstractGWTServiceImpl implements Bund
}
}
+ public PageList<BundleWithLatestVersionComposite> findBundlesWithLastestVersionCompositesByCriteria(
+ BundleCriteria criteria) {
+ try {
+ PageList<BundleWithLatestVersionComposite> results;
+ results = bundleManager.findBundlesWithLastestVersionCompositesByCriteria(getSessionSubject(), criteria);
+ return SerialUtility.prepare(results, "findBundlesWithLastestVersionCompositesByCriteria");
+ } catch (Exception e) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ }
+ }
+
public ArrayList<BundleType> getAllBundleTypes() {
try {
ArrayList<BundleType> bundleTypes = new ArrayList<BundleType>();
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
index e0190e6..c2284d9 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
@@ -282,7 +282,7 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
assert results.get(0).getBundleName().equals(b1.getName());
assert results.get(0).getBundleDescription().equals(b1.getDescription());
assert results.get(0).getLatestVersion() == null;
- assert results.get(0).getDeploymentCount().longValue() == 0L;
+ assert results.get(0).getVersionsCount().longValue() == 0L;
BundleVersion bv1 = createBundleVersion(b1.getName() + "-1", "1.0", b1);
assertNotNull(bv1);
@@ -293,7 +293,7 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
assert results.get(0).getBundleName().equals(b1.getName());
assert results.get(0).getBundleDescription().equals(b1.getDescription());
assert results.get(0).getLatestVersion().equals("1.0");
- assert results.get(0).getDeploymentCount().longValue() == 1L;
+ assert results.get(0).getVersionsCount().longValue() == 1L;
BundleVersion bv2 = createBundleVersion(b1.getName() + "-2", "2.0", b1);
assertNotNull(bv2);
@@ -304,7 +304,7 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
assert results.get(0).getBundleName().equals(b1.getName());
assert results.get(0).getBundleDescription().equals(b1.getDescription());
assert results.get(0).getLatestVersion().equals("2.0");
- assert results.get(0).getDeploymentCount().longValue() == 2L;
+ assert results.get(0).getVersionsCount().longValue() == 2L;
BundleVersion bv3 = createBundleVersion(b1.getName() + "-3", "1.5", b1);
assertNotNull(bv3);
@@ -315,7 +315,7 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
assert results.get(0).getBundleName().equals(b1.getName());
assert results.get(0).getBundleDescription().equals(b1.getDescription());
assert results.get(0).getLatestVersion().equals("2.0");
- assert results.get(0).getDeploymentCount().longValue() == 3L;
+ assert results.get(0).getVersionsCount().longValue() == 3L;
BundleVersionCriteria c = new BundleVersionCriteria();
PageList<BundleVersion> bvs = null;
@@ -376,12 +376,12 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
assert results.get(0).getBundleName().equals(b1.getName());
assert results.get(0).getBundleDescription().equals(b1.getDescription());
assert results.get(0).getLatestVersion().equals("2.0");
- assert results.get(0).getDeploymentCount().longValue() == 4L;
+ assert results.get(0).getVersionsCount().longValue() == 4L;
assert results.get(1).getBundleId().equals(b2.getId());
assert results.get(1).getBundleName().equals(b2.getName());
assert results.get(1).getBundleDescription().equals(b2.getDescription());
assert results.get(1).getLatestVersion() == null;
- assert results.get(1).getDeploymentCount().longValue() == 0L;
+ assert results.get(1).getVersionsCount().longValue() == 0L;
BundleVersion b2_bv1 = createBundleVersion(b2.getName() + "-5", "9.1", b2);
assertNotNull(b2_bv1);
@@ -393,12 +393,12 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
assert results.get(0).getBundleName().equals(b1.getName());
assert results.get(0).getBundleDescription().equals(b1.getDescription());
assert results.get(0).getLatestVersion().equals("2.0");
- assert results.get(0).getDeploymentCount().longValue() == 4L;
+ assert results.get(0).getVersionsCount().longValue() == 4L;
assert results.get(1).getBundleId().equals(b2.getId());
assert results.get(1).getBundleName().equals(b2.getName());
assert results.get(1).getBundleDescription().equals(b2.getDescription());
assert results.get(1).getLatestVersion().equals("9.1");
- assert results.get(1).getDeploymentCount().longValue() == 1L;
+ assert results.get(1).getVersionsCount().longValue() == 1L;
// test sorting of the BundleWithLastestVersionComposite
criteria.addSortName(PageOrdering.DESC);
@@ -408,12 +408,12 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
assert results.get(1).getBundleName().equals(b1.getName());
assert results.get(1).getBundleDescription().equals(b1.getDescription());
assert results.get(1).getLatestVersion().equals("2.0");
- assert results.get(1).getDeploymentCount().longValue() == 4L;
+ assert results.get(1).getVersionsCount().longValue() == 4L;
assert results.get(0).getBundleId().equals(b2.getId());
assert results.get(0).getBundleName().equals(b2.getName());
assert results.get(0).getBundleDescription().equals(b2.getDescription());
assert results.get(0).getLatestVersion().equals("9.1");
- assert results.get(0).getDeploymentCount().longValue() == 1L;
+ assert results.get(0).getVersionsCount().longValue() == 1L;
criteria.addSortName(PageOrdering.ASC);
results = bundleManager.findBundlesWithLastestVersionCompositesByCriteria(overlord, criteria);
@@ -422,12 +422,12 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
assert results.get(0).getBundleName().equals(b1.getName());
assert results.get(0).getBundleDescription().equals(b1.getDescription());
assert results.get(0).getLatestVersion().equals("2.0");
- assert results.get(0).getDeploymentCount().longValue() == 4L;
+ assert results.get(0).getVersionsCount().longValue() == 4L;
assert results.get(1).getBundleId().equals(b2.getId());
assert results.get(1).getBundleName().equals(b2.getName());
assert results.get(1).getBundleDescription().equals(b2.getDescription());
assert results.get(1).getLatestVersion().equals("9.1");
- assert results.get(1).getDeploymentCount().longValue() == 1L;
+ assert results.get(1).getVersionsCount().longValue() == 1L;
}
@Test(enabled = TESTS_ENABLED)
commit 4d79a6360bbe0ee959fb8cb3841e64db5dd1eb19
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Mar 22 15:53:19 2010 -0400
add bundle id to the bundle-last-ver composite query
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/composite/BundleWithLatestVersionComposite.java b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/composite/BundleWithLatestVersionComposite.java
index 9f6304d..40ca18d 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/composite/BundleWithLatestVersionComposite.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/composite/BundleWithLatestVersionComposite.java
@@ -27,20 +27,30 @@ import java.io.Serializable;
public class BundleWithLatestVersionComposite implements Serializable {
private static final long serialVersionUID = 1L;
+ private Integer bundleId;
private String bundleName;
private String bundleDescription;
private String latestVersion;
private Long deploymentCount;
- public BundleWithLatestVersionComposite(String bundleName, String bundleDescription, String latestVersion,
- Long deploymentCount) {
+ public BundleWithLatestVersionComposite(Integer bundleId, String bundleName, String bundleDescription,
+ String latestVersion, Long deploymentCount) {
+ this.bundleId = bundleId;
this.bundleName = bundleName;
this.bundleDescription = bundleDescription;
this.latestVersion = latestVersion;
this.deploymentCount = deploymentCount;
}
+ public Integer getBundleId() {
+ return bundleId;
+ }
+
+ public void setBundleId(Integer bundleId) {
+ this.bundleId = bundleId;
+ }
+
public String getBundleName() {
return bundleName;
}
@@ -75,7 +85,8 @@ public class BundleWithLatestVersionComposite implements Serializable {
public String toString() {
StringBuilder builder = new StringBuilder();
- builder.append("BundleWithLatestVersionComposite [bundleName=").append(bundleName);
+ builder.append("BundleWithLatestVersionComposite [bundleId=").append(bundleId);
+ builder.append(", bundleName=").append(bundleName);
builder.append(", bundleDescription=").append(bundleDescription);
builder.append(", latestVersion=").append(latestVersion);
builder.append(", deploymentCount=").append(deploymentCount);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
index 1ef2d13..bab247a 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
@@ -652,6 +652,7 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
CriteriaQueryGenerator generator = new CriteriaQueryGenerator(criteria);
String replacementSelectList = ""
+ " new org.rhq.core.domain.bundle.composite.BundleWithLatestVersionComposite( "
+ + " bundle.id,"
+ " bundle.name,"
+ " bundle.description,"
+ " ( SELECT bv1.version FROM bundle.bundleVersions bv1 WHERE bv1.versionOrder = (SELECT MAX(bv2.versionOrder) FROM BundleVersion bv2 WHERE bv2.bundle.id = bundle.id) ) AS latestVersion,"
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
index 09a3a14..e0190e6 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
@@ -278,6 +278,7 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
// verify there are no bundle versions yet
results = bundleManager.findBundlesWithLastestVersionCompositesByCriteria(overlord, criteria);
+ assert results.get(0).getBundleId().equals(b1.getId());
assert results.get(0).getBundleName().equals(b1.getName());
assert results.get(0).getBundleDescription().equals(b1.getDescription());
assert results.get(0).getLatestVersion() == null;
@@ -288,6 +289,7 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
assertEquals("1.0", bv1.getVersion());
assert 0 == bv1.getVersionOrder();
results = bundleManager.findBundlesWithLastestVersionCompositesByCriteria(overlord, criteria);
+ assert results.get(0).getBundleId().equals(b1.getId());
assert results.get(0).getBundleName().equals(b1.getName());
assert results.get(0).getBundleDescription().equals(b1.getDescription());
assert results.get(0).getLatestVersion().equals("1.0");
@@ -298,6 +300,7 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
assertEquals("2.0", bv2.getVersion());
assert 1 == bv2.getVersionOrder();
results = bundleManager.findBundlesWithLastestVersionCompositesByCriteria(overlord, criteria);
+ assert results.get(0).getBundleId().equals(b1.getId());
assert results.get(0).getBundleName().equals(b1.getName());
assert results.get(0).getBundleDescription().equals(b1.getDescription());
assert results.get(0).getLatestVersion().equals("2.0");
@@ -308,6 +311,7 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
assertEquals("1.5", bv3.getVersion());
assert 1 == bv3.getVersionOrder();
results = bundleManager.findBundlesWithLastestVersionCompositesByCriteria(overlord, criteria);
+ assert results.get(0).getBundleId().equals(b1.getId());
assert results.get(0).getBundleName().equals(b1.getName());
assert results.get(0).getBundleDescription().equals(b1.getDescription());
assert results.get(0).getLatestVersion().equals("2.0");
@@ -368,10 +372,12 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
assertNotNull(b2);
results = bundleManager.findBundlesWithLastestVersionCompositesByCriteria(overlord, criteria);
assert results.size() == 2 : results;
+ assert results.get(0).getBundleId().equals(b1.getId());
assert results.get(0).getBundleName().equals(b1.getName());
assert results.get(0).getBundleDescription().equals(b1.getDescription());
assert results.get(0).getLatestVersion().equals("2.0");
assert results.get(0).getDeploymentCount().longValue() == 4L;
+ assert results.get(1).getBundleId().equals(b2.getId());
assert results.get(1).getBundleName().equals(b2.getName());
assert results.get(1).getBundleDescription().equals(b2.getDescription());
assert results.get(1).getLatestVersion() == null;
@@ -383,10 +389,12 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
results = bundleManager.findBundlesWithLastestVersionCompositesByCriteria(overlord, criteria);
assert results.size() == 2 : results;
+ assert results.get(0).getBundleId().equals(b1.getId());
assert results.get(0).getBundleName().equals(b1.getName());
assert results.get(0).getBundleDescription().equals(b1.getDescription());
assert results.get(0).getLatestVersion().equals("2.0");
assert results.get(0).getDeploymentCount().longValue() == 4L;
+ assert results.get(1).getBundleId().equals(b2.getId());
assert results.get(1).getBundleName().equals(b2.getName());
assert results.get(1).getBundleDescription().equals(b2.getDescription());
assert results.get(1).getLatestVersion().equals("9.1");
@@ -396,10 +404,12 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
criteria.addSortName(PageOrdering.DESC);
results = bundleManager.findBundlesWithLastestVersionCompositesByCriteria(overlord, criteria);
assert results.size() == 2 : results;
+ assert results.get(1).getBundleId().equals(b1.getId());
assert results.get(1).getBundleName().equals(b1.getName());
assert results.get(1).getBundleDescription().equals(b1.getDescription());
assert results.get(1).getLatestVersion().equals("2.0");
assert results.get(1).getDeploymentCount().longValue() == 4L;
+ assert results.get(0).getBundleId().equals(b2.getId());
assert results.get(0).getBundleName().equals(b2.getName());
assert results.get(0).getBundleDescription().equals(b2.getDescription());
assert results.get(0).getLatestVersion().equals("9.1");
@@ -408,10 +418,12 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
criteria.addSortName(PageOrdering.ASC);
results = bundleManager.findBundlesWithLastestVersionCompositesByCriteria(overlord, criteria);
assert results.size() == 2 : results;
+ assert results.get(0).getBundleId().equals(b1.getId());
assert results.get(0).getBundleName().equals(b1.getName());
assert results.get(0).getBundleDescription().equals(b1.getDescription());
assert results.get(0).getLatestVersion().equals("2.0");
assert results.get(0).getDeploymentCount().longValue() == 4L;
+ assert results.get(1).getBundleId().equals(b2.getId());
assert results.get(1).getBundleName().equals(b2.getName());
assert results.get(1).getBundleDescription().equals(b2.getDescription());
assert results.get(1).getLatestVersion().equals("9.1");
commit 3e0ec702441d9d4895d5f903eff28072bd52a684
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Mar 22 15:32:55 2010 -0400
allow bundle criteria to sort by name or description
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleCriteria.java
index f4336da..a6b2292 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleCriteria.java
@@ -23,6 +23,7 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import org.rhq.core.domain.bundle.Bundle;
+import org.rhq.core.domain.util.PageOrdering;
/**
* @author Jay Shaughnessy
@@ -42,6 +43,9 @@ public class BundleCriteria extends Criteria {
private boolean fetchBundleVersions;
private boolean fetchRepo;
+ private PageOrdering sortName;
+ private PageOrdering sortDescription;
+
public BundleCriteria() {
filterOverrides.put("bundleTypeId", "bundleType.id = ?");
filterOverrides.put("bundleTypeName", "bundleType.name like ?");
@@ -80,4 +84,13 @@ public class BundleCriteria extends Criteria {
this.fetchRepo = fetchRepo;
}
+ public void addSortName(PageOrdering sortName) {
+ addSortField("name");
+ this.sortName = sortName;
+ }
+
+ public void addSortDescription(PageOrdering sortDescription) {
+ addSortField("description");
+ this.sortDescription = sortDescription;
+ }
}
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
index 8d67758..09a3a14 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
@@ -57,6 +57,7 @@ import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.util.PageList;
+import org.rhq.core.domain.util.PageOrdering;
import org.rhq.enterprise.server.plugin.pc.MasterServerPluginContainer;
import org.rhq.enterprise.server.resource.ResourceManagerLocal;
import org.rhq.enterprise.server.resource.metadata.test.UpdateSubsytemTestBase;
@@ -390,6 +391,31 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
assert results.get(1).getBundleDescription().equals(b2.getDescription());
assert results.get(1).getLatestVersion().equals("9.1");
assert results.get(1).getDeploymentCount().longValue() == 1L;
+
+ // test sorting of the BundleWithLastestVersionComposite
+ criteria.addSortName(PageOrdering.DESC);
+ results = bundleManager.findBundlesWithLastestVersionCompositesByCriteria(overlord, criteria);
+ assert results.size() == 2 : results;
+ assert results.get(1).getBundleName().equals(b1.getName());
+ assert results.get(1).getBundleDescription().equals(b1.getDescription());
+ assert results.get(1).getLatestVersion().equals("2.0");
+ assert results.get(1).getDeploymentCount().longValue() == 4L;
+ assert results.get(0).getBundleName().equals(b2.getName());
+ assert results.get(0).getBundleDescription().equals(b2.getDescription());
+ assert results.get(0).getLatestVersion().equals("9.1");
+ assert results.get(0).getDeploymentCount().longValue() == 1L;
+
+ criteria.addSortName(PageOrdering.ASC);
+ results = bundleManager.findBundlesWithLastestVersionCompositesByCriteria(overlord, criteria);
+ assert results.size() == 2 : results;
+ assert results.get(0).getBundleName().equals(b1.getName());
+ assert results.get(0).getBundleDescription().equals(b1.getDescription());
+ assert results.get(0).getLatestVersion().equals("2.0");
+ assert results.get(0).getDeploymentCount().longValue() == 4L;
+ assert results.get(1).getBundleName().equals(b2.getName());
+ assert results.get(1).getBundleDescription().equals(b2.getDescription());
+ assert results.get(1).getLatestVersion().equals("9.1");
+ assert results.get(1).getDeploymentCount().longValue() == 1L;
}
@Test(enabled = TESTS_ENABLED)
commit 682d8e19c2ad0af2abd6e858f9a651f272153a3b
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Mar 22 15:10:12 2010 -0400
start of the bundle-with-latest-version composite query and SLSB finder
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/composite/BundleWithLatestVersionComposite.java b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/composite/BundleWithLatestVersionComposite.java
new file mode 100644
index 0000000..9f6304d
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/composite/BundleWithLatestVersionComposite.java
@@ -0,0 +1,86 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.core.domain.bundle.composite;
+
+import java.io.Serializable;
+
+public class BundleWithLatestVersionComposite implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private String bundleName;
+ private String bundleDescription;
+ private String latestVersion;
+ private Long deploymentCount;
+
+ public BundleWithLatestVersionComposite(String bundleName, String bundleDescription, String latestVersion,
+ Long deploymentCount) {
+
+ this.bundleName = bundleName;
+ this.bundleDescription = bundleDescription;
+ this.latestVersion = latestVersion;
+ this.deploymentCount = deploymentCount;
+ }
+
+ public String getBundleName() {
+ return bundleName;
+ }
+
+ public void setBundleName(String bundleName) {
+ this.bundleName = bundleName;
+ }
+
+ public String getBundleDescription() {
+ return bundleDescription;
+ }
+
+ public void setBundleDescription(String bundleDescription) {
+ this.bundleDescription = bundleDescription;
+ }
+
+ public String getLatestVersion() {
+ return latestVersion;
+ }
+
+ public void setLatestVersion(String latestVersion) {
+ this.latestVersion = latestVersion;
+ }
+
+ public Long getDeploymentCount() {
+ return deploymentCount;
+ }
+
+ public void setDeploymentCount(Long deploymentCount) {
+ this.deploymentCount = deploymentCount;
+ }
+
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("BundleWithLatestVersionComposite [bundleName=").append(bundleName);
+ builder.append(", bundleDescription=").append(bundleDescription);
+ builder.append(", latestVersion=").append(latestVersion);
+ builder.append(", deploymentCount=").append(deploymentCount);
+ builder.append("]");
+ return builder.toString();
+ }
+
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
index da167f0..1ef2d13 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
@@ -52,6 +52,7 @@ import org.rhq.core.domain.bundle.BundleDeploymentHistory;
import org.rhq.core.domain.bundle.BundleFile;
import org.rhq.core.domain.bundle.BundleType;
import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.core.domain.bundle.composite.BundleWithLatestVersionComposite;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.content.Architecture;
@@ -645,6 +646,24 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
return queryRunner.execute();
}
+ public PageList<BundleWithLatestVersionComposite> findBundlesWithLastestVersionCompositesByCriteria(
+ Subject subject, BundleCriteria criteria) {
+
+ CriteriaQueryGenerator generator = new CriteriaQueryGenerator(criteria);
+ String replacementSelectList = ""
+ + " new org.rhq.core.domain.bundle.composite.BundleWithLatestVersionComposite( "
+ + " bundle.name,"
+ + " bundle.description,"
+ + " ( SELECT bv1.version FROM bundle.bundleVersions bv1 WHERE bv1.versionOrder = (SELECT MAX(bv2.versionOrder) FROM BundleVersion bv2 WHERE bv2.bundle.id = bundle.id) ) AS latestVersion,"
+ + " ( SELECT COUNT(bv3) FROM bundle.bundleVersions bv3 WHERE bv3.bundle.id = bundle.id) AS deploymentCount ) ";
+ generator.alterProjection(replacementSelectList);
+
+ CriteriaQueryRunner<BundleWithLatestVersionComposite> queryRunner = new CriteriaQueryRunner<BundleWithLatestVersionComposite>(
+ criteria, generator, entityManager);
+ PageList<BundleWithLatestVersionComposite> results = queryRunner.execute();
+ return results;
+ }
+
// TODO This is not adequate!!!
@RequiredPermission(Permission.MANAGE_INVENTORY)
public void deleteBundle(Subject subject, int bundleId) throws Exception {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java
index 61a9032..b3a84ff 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java
@@ -35,6 +35,7 @@ import org.rhq.core.domain.bundle.BundleDeployment;
import org.rhq.core.domain.bundle.BundleFile;
import org.rhq.core.domain.bundle.BundleType;
import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.core.domain.bundle.composite.BundleWithLatestVersionComposite;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.content.Architecture;
import org.rhq.core.domain.criteria.BundleCriteria;
@@ -236,6 +237,11 @@ public interface BundleManagerRemote {
@WebParam(name = "criteria") BundleVersionCriteria criteria);
@WebMethod
+ PageList<BundleWithLatestVersionComposite> findBundlesWithLastestVersionCompositesByCriteria( //
+ @WebParam(name = "subject") Subject subject, //
+ @WebParam(name = "criteria") BundleCriteria criteria);
+
+ @WebMethod
List<BundleType> getAllBundleTypes( //
@WebParam(name = "subject") Subject subject);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
index 3eff81a..6521e5b 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
@@ -44,6 +44,7 @@ import org.rhq.core.domain.bundle.BundleDeployment;
import org.rhq.core.domain.bundle.BundleFile;
import org.rhq.core.domain.bundle.BundleType;
import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.core.domain.bundle.composite.BundleWithLatestVersionComposite;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PluginConfigurationUpdate;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
@@ -399,6 +400,11 @@ public class WebservicesManagerBean implements WebservicesRemote {
return bundleManager.findBundleVersionsByCriteria(subject, criteria);
}
+ public PageList<BundleWithLatestVersionComposite> findBundlesWithLastestVersionCompositesByCriteria(
+ Subject subject, BundleCriteria criteria) {
+ return bundleManager.findBundlesWithLastestVersionCompositesByCriteria(subject, criteria);
+ }
+
public List<BundleType> getAllBundleTypes(Subject subject) {
return bundleManager.getAllBundleTypes(subject);
}
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
index 24f4a50..8d67758 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
@@ -42,6 +42,7 @@ import org.rhq.core.domain.bundle.BundleDeploymentHistory;
import org.rhq.core.domain.bundle.BundleFile;
import org.rhq.core.domain.bundle.BundleType;
import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.core.domain.bundle.composite.BundleWithLatestVersionComposite;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.content.Package;
@@ -270,18 +271,46 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
public void testCreateBundleVersionOrdering() throws Exception {
Bundle b1 = createBundle("one");
assertNotNull(b1);
+
+ BundleCriteria criteria = new BundleCriteria();
+ PageList<BundleWithLatestVersionComposite> results;
+
+ // verify there are no bundle versions yet
+ results = bundleManager.findBundlesWithLastestVersionCompositesByCriteria(overlord, criteria);
+ assert results.get(0).getBundleName().equals(b1.getName());
+ assert results.get(0).getBundleDescription().equals(b1.getDescription());
+ assert results.get(0).getLatestVersion() == null;
+ assert results.get(0).getDeploymentCount().longValue() == 0L;
+
BundleVersion bv1 = createBundleVersion(b1.getName() + "-1", "1.0", b1);
assertNotNull(bv1);
assertEquals("1.0", bv1.getVersion());
assert 0 == bv1.getVersionOrder();
+ results = bundleManager.findBundlesWithLastestVersionCompositesByCriteria(overlord, criteria);
+ assert results.get(0).getBundleName().equals(b1.getName());
+ assert results.get(0).getBundleDescription().equals(b1.getDescription());
+ assert results.get(0).getLatestVersion().equals("1.0");
+ assert results.get(0).getDeploymentCount().longValue() == 1L;
+
BundleVersion bv2 = createBundleVersion(b1.getName() + "-2", "2.0", b1);
assertNotNull(bv2);
assertEquals("2.0", bv2.getVersion());
assert 1 == bv2.getVersionOrder();
+ results = bundleManager.findBundlesWithLastestVersionCompositesByCriteria(overlord, criteria);
+ assert results.get(0).getBundleName().equals(b1.getName());
+ assert results.get(0).getBundleDescription().equals(b1.getDescription());
+ assert results.get(0).getLatestVersion().equals("2.0");
+ assert results.get(0).getDeploymentCount().longValue() == 2L;
+
BundleVersion bv3 = createBundleVersion(b1.getName() + "-3", "1.5", b1);
assertNotNull(bv3);
assertEquals("1.5", bv3.getVersion());
assert 1 == bv3.getVersionOrder();
+ results = bundleManager.findBundlesWithLastestVersionCompositesByCriteria(overlord, criteria);
+ assert results.get(0).getBundleName().equals(b1.getName());
+ assert results.get(0).getBundleDescription().equals(b1.getDescription());
+ assert results.get(0).getLatestVersion().equals("2.0");
+ assert results.get(0).getDeploymentCount().longValue() == 3L;
BundleVersionCriteria c = new BundleVersionCriteria();
PageList<BundleVersion> bvs = null;
@@ -332,6 +361,35 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
assertNotNull(bvs);
assertEquals(1, bvs.size());
assert bvs.get(0).getVersionOrder() == 3; // 4th is the 2.0 version
+
+ // verify our composite criteria query can return more than one item
+ Bundle b2 = createBundle("two");
+ assertNotNull(b2);
+ results = bundleManager.findBundlesWithLastestVersionCompositesByCriteria(overlord, criteria);
+ assert results.size() == 2 : results;
+ assert results.get(0).getBundleName().equals(b1.getName());
+ assert results.get(0).getBundleDescription().equals(b1.getDescription());
+ assert results.get(0).getLatestVersion().equals("2.0");
+ assert results.get(0).getDeploymentCount().longValue() == 4L;
+ assert results.get(1).getBundleName().equals(b2.getName());
+ assert results.get(1).getBundleDescription().equals(b2.getDescription());
+ assert results.get(1).getLatestVersion() == null;
+ assert results.get(1).getDeploymentCount().longValue() == 0L;
+
+ BundleVersion b2_bv1 = createBundleVersion(b2.getName() + "-5", "9.1", b2);
+ assertNotNull(b2_bv1);
+ assertEquals("9.1", b2_bv1.getVersion());
+
+ results = bundleManager.findBundlesWithLastestVersionCompositesByCriteria(overlord, criteria);
+ assert results.size() == 2 : results;
+ assert results.get(0).getBundleName().equals(b1.getName());
+ assert results.get(0).getBundleDescription().equals(b1.getDescription());
+ assert results.get(0).getLatestVersion().equals("2.0");
+ assert results.get(0).getDeploymentCount().longValue() == 4L;
+ assert results.get(1).getBundleName().equals(b2.getName());
+ assert results.get(1).getBundleDescription().equals(b2.getDescription());
+ assert results.get(1).getLatestVersion().equals("9.1");
+ assert results.get(1).getDeploymentCount().longValue() == 1L;
}
@Test(enabled = TESTS_ENABLED)
commit c28e866f468e5d77ca136b9b06873e5da9c9a088
Merge: 9a012b3... 0076e58...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Mar 22 14:04:23 2010 -0400
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
commit 9a012b3232e0610bcd6ce7f283f6700235fcc5d6
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Mar 22 14:04:14 2010 -0400
joe says this is broke - rg. should be resourcegroup. now
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java
index dd2d4d3..922f72d 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java
@@ -967,10 +967,10 @@ public class ResourceGroupManagerBean implements ResourceGroupManagerLocal, Reso
CriteriaQueryGenerator generator = new CriteriaQueryGenerator(criteria);
String replacementSelectList = ""
+ " new org.rhq.core.domain.resource.group.composite.ResourceGroupComposite( "
- + " ( SELECT COUNT(avail) FROM rg.explicitResources res JOIN res.currentAvailability avail ) AS explicitCount,"
- + " ( SELECT AVG(avail.availabilityType) FROM rg.explicitResources res JOIN res.currentAvailability avail ) AS explicitAvail,"
- + " ( SELECT COUNT(avail) FROM rg.implicitResources res JOIN res.currentAvailability avail ) AS implicitCount,"
- + " ( SELECT AVG(avail.availabilityType) FROM rg.implicitResources res JOIN res.currentAvailability avail ) AS implicitAvail,"
+ + " ( SELECT COUNT(avail) FROM resourcegroup.explicitResources res JOIN res.currentAvailability avail ) AS explicitCount,"
+ + " ( SELECT AVG(avail.availabilityType) FROM resourcegroup.explicitResources res JOIN res.currentAvailability avail ) AS explicitAvail,"
+ + " ( SELECT COUNT(avail) FROM resourcegroup.implicitResources res JOIN res.currentAvailability avail ) AS implicitCount,"
+ + " ( SELECT AVG(avail.availabilityType) FROM resourcegroup.implicitResources res JOIN res.currentAvailability avail ) AS implicitAvail,"
+ " rg ) ";
generator.alterProjection(replacementSelectList);
commit 0076e58ee346e1c0cf767e70ac1b1e6f93442b96
Merge: 1f627e8... 21875c7...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Mar 22 13:53:11 2010 -0400
Merge branch 'gwt' into gwt-jay
commit 1f627e8f17ae4a3467a56898d19d3777b7c73640
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Mar 22 13:52:00 2010 -0400
Updates to Bundle Deployment Wizard - work in progress
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployDefinitionInfoStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployDefinitionInfoStep.java
index a6edbfe..ceda488 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployDefinitionInfoStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployDefinitionInfoStep.java
@@ -59,7 +59,6 @@ public class BundleDeployDefinitionInfoStep implements WizardStep {
}
wizard.setSubtitle(value.toString());
wizard.setName(value.toString());
- enableNextButtonWhenAppropriate();
}
});
@@ -71,7 +70,6 @@ public class BundleDeployDefinitionInfoStep implements WizardStep {
value = "";
}
wizard.setDescription(value.toString());
- enableNextButtonWhenAppropriate();
}
});
@@ -85,19 +83,7 @@ public class BundleDeployDefinitionInfoStep implements WizardStep {
return form.validate();
}
- public boolean isNextEnabled() {
- return isNotEmpty(this.wizard.getName());
- }
-
public boolean isPreviousEnabled() {
return false;
}
-
- private void enableNextButtonWhenAppropriate() {
- this.wizard.getView().getNextButton().setDisabled(!isNextEnabled());
- }
-
- private boolean isNotEmpty(String s) {
- return (s != null && s.trim().length() > 0);
- }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployWizard.java
index eaa29d2..1d0749e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployWizard.java
@@ -32,19 +32,6 @@ import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
public class BundleDeployWizard extends AbstractBundleDeployWizard {
- public BundleDeployWizard() {
- List<WizardStep> steps = init();
-
- steps.add(new SelectBundleStep(this));
- steps.add(new SelectBundleVersionStep(this));
- steps.add(new BundleDeployDefinitionInfoStep(this));
- steps.add(new SelectTemplateStep(this));
- steps.add(new CreateConfigStep(this));
- steps.add(new DeployNowStep(this));
- steps.add(new SelectPlatformsStep(this));
- steps.add(new DeployStep(this));
- }
-
public BundleDeployWizard(Bundle bundle) {
List<WizardStep> steps = init();
setBundle(bundle);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/CreateConfigStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/CreateConfigStep.java
index c388953..8b8f46e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/CreateConfigStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/CreateConfigStep.java
@@ -28,7 +28,6 @@ import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
public class CreateConfigStep implements WizardStep {
private final BundleDeployWizard wizard;
- // private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
private ConfigurationEditor editor;
public CreateConfigStep(BundleDeployWizard bundleCreationWizard) {
@@ -40,12 +39,10 @@ public class CreateConfigStep implements WizardStep {
}
public Canvas getCanvas() {
- if (editor == null) {
+ if (null == editor) {
ConfigurationDefinition configDef = wizard.getBundleVersion().getConfigurationDefinition();
- Configuration startingConfig = null;
- if (null != wizard.getTemplate()) {
- startingConfig = wizard.getTemplate().getConfiguration();
- }
+ Configuration startingConfig = (null != wizard.getTemplate()) ? wizard.getTemplate().getConfiguration()
+ : new Configuration();
editor = new ConfigurationEditor(configDef, startingConfig);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleStep.java
deleted file mode 100644
index 1404567..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleStep.java
+++ /dev/null
@@ -1,112 +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.bundle.deploy;
-
-import java.util.LinkedHashMap;
-
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.form.DynamicForm;
-import com.smartgwt.client.widgets.form.fields.SelectItem;
-import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
-import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
-
-import org.rhq.core.domain.bundle.Bundle;
-import org.rhq.core.domain.criteria.BundleCriteria;
-import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
-import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-
-/** Temporary step pending creation of Bundle navigatin screen */
-
-public class SelectBundleStep implements WizardStep {
-
- private DynamicForm form;
- private final BundleDeployWizard wizard;
- private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
-
- public SelectBundleStep(BundleDeployWizard bundleDeployWizard) {
- this.wizard = bundleDeployWizard;
- }
-
- public String getName() {
- return "Select Bundle to Deploy";
- }
-
- public Canvas getCanvas() {
- if (form == null) {
- form = new DynamicForm();
- form.setWidth100();
- form.setNumCols(2);
- form.setColWidths("50%", "*");
-
- // for now, get all the bundles
- final BundleCriteria criteria = new BundleCriteria();
- final LinkedHashMap<String, Bundle> bundleNames = new LinkedHashMap<String, Bundle>();
-
- bundleServer.findBundlesByCriteria(criteria, new AsyncCallback<PageList<Bundle>>() {
- public void onSuccess(PageList<Bundle> result) {
- if (result.isEmpty()) {
- onFailure(new IllegalArgumentException("No bundles defined."));
- }
- for (Bundle bundle : result) {
- bundleNames.put(bundle.getName(), bundle);
- }
- }
-
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to find defined bundles.", caught);
- }
- });
-
- final SelectItem selectBundle = new SelectItem("selectBundle", "Deployment Bundle");
- selectBundle.setRequired(true);
- selectBundle.setWidth(150);
- selectBundle.setValueMap(bundleNames);
- selectBundle.addChangedHandler(new ChangedHandler() {
- public void onChanged(ChangedEvent event) {
- wizard.setBundle((Bundle) event.getValue());
- enableNextButtonWhenAppropriate();
- }
- });
-
- form.setItems(selectBundle);
- }
-
- return form;
- }
-
- public boolean nextPage() {
- return form.validate();
- }
-
- public boolean isNextEnabled() {
- return (null != this.wizard.getBundle());
- }
-
- public boolean isPreviousEnabled() {
- return false;
- }
-
- private void enableNextButtonWhenAppropriate() {
- this.wizard.getView().getNextButton().setDisabled(!isNextEnabled());
- }
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleVersionStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleVersionStep.java
index 9f6af9c..0b71de1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleVersionStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleVersionStep.java
@@ -23,6 +23,7 @@ import java.util.LinkedHashMap;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.RadioGroupItem;
import com.smartgwt.client.widgets.form.fields.SelectItem;
import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
@@ -39,19 +40,26 @@ import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
public class SelectBundleVersionStep implements WizardStep {
+ static private final String LATEST_VERSION = "latest";
+ static private final String SELECT_VERSION = "select";
+
private final BundleDeployWizard wizard;
private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
private DynamicForm form;
+
+ private RadioGroupItem radioGroupItem = new RadioGroupItem("options", "Deploy Options");
+ private SelectItem selectVersionItem = new SelectItem("selectVersion", "Deployment Version");
+ private LinkedHashMap<String, String> radioGroupValues = new LinkedHashMap<String, String>();
+ private LinkedHashMap<String, String> selectVersionValues = new LinkedHashMap<String, String>();
private PageList<BundleVersion> bundleVersions = null;
- private SelectItem selectVersion = new SelectItem("selectVersion", "Deployment Version");
- private LinkedHashMap<String, Object> selectVersionValues = new LinkedHashMap<String, Object>();;
+ private BundleVersion latestVersion;
public SelectBundleVersionStep(BundleDeployWizard bundleDeployWizard) {
this.wizard = bundleDeployWizard;
}
public String getName() {
- return "Select Version 1";
+ return "Select Bundle Version";
}
public Canvas getCanvas() {
@@ -61,10 +69,25 @@ public class SelectBundleVersionStep implements WizardStep {
form.setNumCols(2);
form.setColWidths("50%", "*");
- // for now, get all the bundle versions for the bundle
- selectVersion.setRequired(true);
- //selectVersion.setWidth(150);
- selectVersion.addChangedHandler(new ChangedHandler() {
+ setItemValues();
+
+ radioGroupItem.setRequired(true);
+ radioGroupItem.setDisabled(true);
+ radioGroupItem.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent event) {
+ boolean isLatestVersion = LATEST_VERSION.equals(event.getValue());
+ if (isLatestVersion) {
+ wizard.setBundleVersion(latestVersion);
+ }
+ selectVersionItem.setDisabled(isLatestVersion);
+ selectVersionItem.setRequired(!isLatestVersion);
+ selectVersionItem.redraw();
+ form.markForRedraw();
+ }
+ });
+
+ selectVersionItem.setDisabled(true);
+ selectVersionItem.addChangedHandler(new ChangedHandler() {
public void onChanged(ChangedEvent event) {
for (BundleVersion bundleVersion : bundleVersions) {
if (bundleVersion.getVersion().equals(event.getValue())) {
@@ -72,24 +95,49 @@ public class SelectBundleVersionStep implements WizardStep {
break;
}
}
- enableNextButtonWhenAppropriate();
}
});
- final BundleVersionCriteria criteria = new BundleVersionCriteria();
- criteria.addFilterBundleId(wizard.getBundle().getId());
- criteria.fetchConfigurationDefinition(true);
- bundleServer.findBundleVersionsByCriteria(criteria, new AsyncCallback<PageList<BundleVersion>>() {
+ form.setItems(radioGroupItem, selectVersionItem);
+ }
+
+ return form;
+ }
+
+ private void setItemValues() {
+ BundleVersionCriteria criteria = new BundleVersionCriteria();
+ criteria.addFilterBundleId(wizard.getBundle().getId());
+ criteria.fetchConfigurationDefinition(true);
+ bundleServer.findBundleVersionsByCriteria(criteria, //
+ new AsyncCallback<PageList<BundleVersion>>() {
+
public void onSuccess(PageList<BundleVersion> result) {
bundleVersions = result;
if (bundleVersions.isEmpty()) {
onFailure(new IllegalArgumentException("No bundle versions defined for bundle."));
}
+
+ int highVersionOrder = -1;
for (BundleVersion bundleVersion : result) {
+ int versionOrder = bundleVersion.getVersionOrder();
+ if (versionOrder > highVersionOrder) {
+ highVersionOrder = versionOrder;
+ latestVersion = bundleVersion;
+ }
selectVersionValues.put(bundleVersion.getVersion(), bundleVersion.getVersion());
}
- selectVersion.setValueMap(selectVersionValues);
- selectVersion.redraw();
+
+ radioGroupValues.put(LATEST_VERSION, "Latest Version [ " + latestVersion.getVersion() + " ]");
+ radioGroupValues.put(SELECT_VERSION, "Select Version");
+ radioGroupItem.setValueMap(radioGroupValues);
+ radioGroupItem.setValue(LATEST_VERSION);
+ wizard.setBundleVersion(latestVersion);
+ radioGroupItem.setDisabled(false);
+ radioGroupItem.redraw();
+
+ selectVersionItem.setValueMap(selectVersionValues);
+ selectVersionItem.redraw();
+
form.markForRedraw();
}
@@ -97,11 +145,6 @@ public class SelectBundleVersionStep implements WizardStep {
CoreGUI.getErrorHandler().handleError("Failed to find defined bundles.", caught);
}
});
-
- form.setItems(selectVersion);
- }
-
- return form;
}
public boolean nextPage() {
@@ -109,14 +152,10 @@ public class SelectBundleVersionStep implements WizardStep {
}
public boolean isNextEnabled() {
- return (null != this.wizard.getBundle());
+ return (null != this.wizard.getBundleVersion());
}
public boolean isPreviousEnabled() {
- return true;
- }
-
- private void enableNextButtonWhenAppropriate() {
- this.wizard.getView().getNextButton().setDisabled(!isNextEnabled());
+ return false;
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectTemplateStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectTemplateStep.java
index 982eb90..ffc6adc 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectTemplateStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectTemplateStep.java
@@ -18,6 +18,7 @@
*/
package org.rhq.enterprise.gui.coregui.client.bundle.deploy;
+import java.util.LinkedHashMap;
import java.util.Map;
import com.smartgwt.client.widgets.Canvas;
@@ -32,17 +33,20 @@ import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
public class SelectTemplateStep implements WizardStep {
- private DynamicForm form;
private final BundleDeployWizard wizard;
+ private DynamicForm form;
- //private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
+ private SelectItem selectTemplateItem = null;
+ private LinkedHashMap<String, String> selectTemplateValues = new LinkedHashMap<String, String>();
+ private ConfigurationDefinition definition = null;
+ private Map<String, ConfigurationTemplate> templates = null;
public SelectTemplateStep(BundleDeployWizard bundleDeployWizard) {
this.wizard = bundleDeployWizard;
}
public String getName() {
- return "Select a Configuration Template";
+ return "Select Configuration Template";
}
public Canvas getCanvas() {
@@ -52,23 +56,27 @@ public class SelectTemplateStep implements WizardStep {
form.setNumCols(2);
form.setColWidths("50%", "*");
- SelectItem selectTemplate = new SelectItem("template", "Template");
- selectTemplate.addChangedHandler(new ChangedHandler() {
- public void onChanged(ChangedEvent event) {
- wizard.setTemplate((ConfigurationTemplate) event.getValue());
- }
- });
-
- ConfigurationDefinition definition = wizard.getBundleVersion().getConfigurationDefinition();
- Map<String, ConfigurationTemplate> templates = definition.getTemplates();
+ definition = wizard.getBundleVersion().getConfigurationDefinition();
+ templates = definition.getTemplates();
if (templates != null && !templates.isEmpty()) {
- selectTemplate.setValueMap(templates.keySet().toArray(new String[templates.size()]));
+ for (String templateName : templates.keySet()) {
+ selectTemplateValues.put(templateName, templateName);
+ }
+
+ selectTemplateItem = new SelectItem("selectTemplate", "Configuration Template");
+ selectTemplateItem.setValueMap(selectTemplateValues);
+ selectTemplateItem.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent event) {
+ wizard.setTemplate((ConfigurationTemplate) templates.get(event.getValue()));
+ }
+ });
} else {
- selectTemplate.setDisabled(true);
+ selectTemplateItem = new SelectItem("selectTemplate", "No Configuration Templates Defined");
+ selectTemplateItem.setDisabled(true);
}
- form.setItems(selectTemplate);
+ form.setItems(selectTemplateItem);
}
this.wizard.getView().getNextButton().setDisabled(false);
@@ -80,10 +88,6 @@ public class SelectTemplateStep implements WizardStep {
}
public boolean isPreviousEnabled() {
- return false;
- }
-
- public boolean isNextEnabled() {
return true;
}
}
commit 21875c7964ca0cf093341cc9bdb1ee6c9b400e0f
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Mar 22 11:56:48 2010 -0400
can't rely on the toString to format the value - explicitly have the util method format the value
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/image/chart/PerformanceChart.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/image/chart/PerformanceChart.java
index 44f9e44..baeeb0f 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/image/chart/PerformanceChart.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/image/chart/PerformanceChart.java
@@ -22,8 +22,9 @@ import java.awt.Color;
import java.awt.Point;
import java.awt.Rectangle;
import java.util.Iterator;
+
import org.rhq.core.domain.measurement.MeasurementUnits;
-import org.rhq.core.domain.measurement.composite.MeasurementNumericValueAndUnits;
+import org.rhq.core.server.MeasurementConverter;
import org.rhq.enterprise.gui.image.data.IDataPoint;
import org.rhq.enterprise.gui.image.data.IStackedDataPoint;
@@ -79,7 +80,7 @@ public class PerformanceChart extends HorizontalChart {
String[] result = new String[m_adRangeMarks.length];
for (int i = 0; i < m_adRangeMarks.length; i++) {
- result[i] = new MeasurementNumericValueAndUnits(m_adRangeMarks[i], m_fmtUnits).toString();
+ result[i] = MeasurementConverter.format(m_adRangeMarks[i], m_fmtUnits, true);
}
return result;
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/util/MonitorUtils.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/util/MonitorUtils.java
index 38e45bd..a0da2d2 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/util/MonitorUtils.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/util/MonitorUtils.java
@@ -101,7 +101,10 @@ public class MonitorUtils {
throw new IllegalStateException("Formatting metrics failed.");
}
for (int i = 0; i < keys.length; i++) {
- metricDisplaySummary.getMetric(keys[i]).setValueFmt(formattedValues[i].toString());
+ MeasurementValueAndUnits valueAndUnits = formattedValues[i];
+ String formatted = MeasurementConverter.format(((Double) valueAndUnits.getValue()), valueAndUnits
+ .getUnits(), true);
+ metricDisplaySummary.getMetric(keys[i]).setValueFmt(formatted);
}
}
} catch (IllegalArgumentException e) { // catch and rethrow for debug/logging only
commit 8dabf96e752ce822717bd9a68707b081118aefcb
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Mar 22 10:49:51 2010 -0400
make sure uuid is the proper length for the column type CHAR - mainly for tests
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
index f669571..c81d1b8 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
@@ -22,7 +22,7 @@
*/
package org.rhq.core.domain.resource;
-import java.io.*;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedHashSet;
@@ -51,7 +51,6 @@ import javax.persistence.PrePersist;
import javax.persistence.QueryHint;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
-import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
@@ -852,6 +851,8 @@ public class Resource implements Comparable<Resource>, Serializable {
private static final String NAME_CONCAT_SEPARATOR = "~!@#)))";
+ private static final int UUID_LENGTH = 36;
+
/**
* Helper for {@link #NATIVE_QUERY_FIND_DISAMBIGUATION_LEVEL}.
* We need to guard against concatenation with a NULL value which
@@ -940,7 +941,8 @@ public class Resource implements Comparable<Resource>, Serializable {
@Summary(index = 0)
private int id;
- @Column(name = "UUID")
+ @Column(name = "UUID", length = UUID_LENGTH)
+ // db type is CHAR, this string will thus always be of this length
private String uuid;
@Column(name = "RESOURCE_KEY")
@@ -981,7 +983,8 @@ public class Resource implements Comparable<Resource>, Serializable {
private String location;
@JoinColumn(name = "RESOURCE_TYPE_ID", referencedColumnName = "ID", nullable = false)
- @ManyToOne // TODO GH: It would be prefferable for this to be lazy, but will need cleanup throughout the app (fetch = FetchType.LAZY)
+ @ManyToOne
+ // TODO GH: It would be prefferable for this to be lazy, but will need cleanup throughout the app (fetch = FetchType.LAZY)
@Summary(index = 4)
private ResourceType resourceType;
@@ -1138,6 +1141,17 @@ public class Resource implements Comparable<Resource>, Serializable {
}
public void setUuid(String uuid) {
+ if (uuid != null && uuid.length() != UUID_LENGTH) {
+ if (uuid.length() > UUID_LENGTH) {
+ throw new IllegalArgumentException("UUIDs must not be longer than [" + UUID_LENGTH + "]");
+ } else {
+ // must be less than UUID_LENGTH, pad it with spaces - usually this only happens in tests
+ int spacesNeeded = UUID_LENGTH - uuid.length();
+ for (int i = 0; i < spacesNeeded; i++) {
+ uuid = uuid + ' ';
+ }
+ }
+ }
this.uuid = uuid;
}
@@ -1714,169 +1728,169 @@ public class Resource implements Comparable<Resource>, Serializable {
return buffer.toString();
}
- /* public void writeExternal(ObjectOutput out) throws IOException {
- ExternalizableStrategy.Subsystem strategy = ExternalizableStrategy.getStrategy();
- out.writeChar(strategy.id());
-
- if (ExternalizableStrategy.Subsystem.REMOTEAPI == strategy) {
- writeExternalRemote(out);
- } else if (ExternalizableStrategy.Subsystem.REFLECTIVE_SERIALIZATION == strategy) {
- EntitySerializer.writeExternalRemote(this, out);
- } else {
- writeExternalAgent(out);
- }
- }
-
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- char c = in.readChar();
- if (ExternalizableStrategy.Subsystem.REMOTEAPI.id() == c) {
- readExternalRemote(in);
- } else if (ExternalizableStrategy.Subsystem.REFLECTIVE_SERIALIZATION.id() == c) {
- EntitySerializer.readExternalRemote(this, in);
- } else {
- readExternalAgent(in);
- }
- }
-
- public void writeExternalAgent(ObjectOutput out) throws IOException {
- // Note that a Resource may have been constructed with id only. Check for uninitialized fields.
- out.writeInt(id);
- out.writeUTF(uuid);
- out.writeUTF((null == resourceKey) ? "" : resourceKey);
- out.writeUTF((null == name) ? "" : name);
- out.writeInt(inventoryStatus.ordinal());
- out.writeUTF((null == version) ? "" : version);
- out.writeUTF((null == description) ? "" : description);
- out.writeLong(ctime);
- out.writeLong(mtime);
- out.writeLong(itime);
-
- //Subject modifiedBy;
- //Subject owner;
- //String location;
- out.writeObject(parentResource);
-
- if (null == resourceType) {
- out.writeUTF("");
- out.writeUTF("");
- out.writeObject(null);
- } else {
- out.writeUTF(resourceType.getName());
- out.writeUTF(resourceType.getPlugin());
- out.writeObject(resourceType.getCategory());
- }
-
- // We make a copy of the childResources Set for two reasons: 1) to avoid calling writeObject() on the Set if it
- // happens to be a Hibernate proxy (which would only ever be true on the Server side), and 2) to reduce the
- // chances of a ConcurrentModificationException occurring in some other thread that is iterating the original Set.
- out.writeObject((null == childResources) ? null : new LinkedHashSet<Resource>(childResources));
-
- // Don't write plugin configs out if they are a lazy proxy
- if (pluginConfiguration != null && pluginConfiguration.getClass().getName().contains("hibernate")) {
- out.writeObject(null);
- } else {
- out.writeObject(pluginConfiguration);
- }
-
- //Set<MeasurementSchedule> schedules = new LinkedHashSet<MeasurementSchedule>();
- //Agent agent;
- //Set<ResourceGroup> resourceGroups = new HashSet<ResourceGroup>();
- }
-
- @SuppressWarnings("unchecked")
- public void readExternalAgent(ObjectInput in) throws IOException, ClassNotFoundException {
- id = in.readInt();
- uuid = in.readUTF();
- resourceKey = in.readUTF();
- name = in.readUTF();
- inventoryStatus = InventoryStatus.values()[in.readInt()];
- version = in.readUTF();
- description = in.readUTF();
- ctime = in.readLong();
- mtime = in.readLong();
- itime = in.readLong();
-
- //Subject modifiedBy;
- //Subject owner;
- //String location;
- parentResource = (Resource) in.readObject();
- resourceType = new ResourceType(in.readUTF(), in.readUTF(), (ResourceCategory) in.readObject(),
- (parentResource != null) ? parentResource.getResourceType() : null);
- childResources = (Set<Resource>) in.readObject();
-
- pluginConfiguration = (Configuration) in.readObject();
- }
-
- // It is assumed that the object is clean of Hibernate proxies (i.e. HibernateDetachUtility has been run if necessary)
- public void writeExternalRemote(ObjectOutput out) throws IOException {
- // Note that a Resource may have been constructed with id only. Check for uninitialized fields.
- out.writeInt(id);
- out.writeUTF(uuid);
- out.writeUTF(resourceKey);
- out.writeUTF(name);
- out.writeInt(inventoryStatus.ordinal());
- out.writeUTF((null == version) ? "" : version);
- out.writeUTF((null == description) ? "" : description);
- out.writeLong(ctime);
- out.writeLong(mtime);
- out.writeLong(itime);
- // not supplied by remote: modifiedBy
- out.writeUTF((null == location) ? "" : location);
- out.writeObject(resourceType);
- // making a copy reduces chances of ConcurrentModificationException in a thread iterating the original
- out.writeObject((null == childResources) ? null : new LinkedHashSet<Resource>(childResources));
- out.writeObject(parentResource);
- out.writeObject(resourceConfiguration);
- out.writeObject(pluginConfiguration);
- out.writeObject(agent);
- // not supplied by remote: alertDefinitions
- // not supplied by remote: resourceConfigurationUpdates
- // not supplied by remote: pluginConfigurationUpdates
- // making a copy reduces chances of ConcurrentModificationException in a thread iterating the original
- out.writeObject((null == implicitGroups) ? null : new LinkedHashSet<ResourceGroup>(implicitGroups));
- // making a copy reduces chances of ConcurrentModificationException in a thread iterating the original
- out.writeObject((null == explicitGroups) ? null : new LinkedHashSet<ResourceGroup>(explicitGroups));
- // not supplied by remote: contentServiceRequests
- // not supplied by remote: createChildResourceRequests
- // not supplied by remote: deleteResourceRequests
- // not supplied by remote: operationHistories
- // not supplied by remote: installedPackages
- // not supplied by remote: installedPackageHistory
- // not supplied by remote: resourceRepos
- // not supplied by remote: schedules
- out.writeObject(availability);
- out.writeObject(currentAvailability);
- out.writeObject(resourceErrors);
- // not supplied by remote: eventSources
- out.writeObject(productVersion);
- }
-
- @SuppressWarnings("unchecked")
- public void readExternalRemote(ObjectInput in) throws IOException, ClassNotFoundException {
- id = in.readInt();
- uuid = in.readUTF();
- resourceKey = in.readUTF();
- name = in.readUTF();
- inventoryStatus = InventoryStatus.values()[in.readInt()];
- version = in.readUTF();
- description = in.readUTF();
- ctime = in.readLong();
- mtime = in.readLong();
- itime = in.readLong();
- location = in.readUTF();
- resourceType = (ResourceType) in.readObject();
- childResources = (Set<Resource>) in.readObject();
- parentResource = (Resource) in.readObject();
- resourceConfiguration = (Configuration) in.readObject();
- pluginConfiguration = (Configuration) in.readObject();
- agent = (Agent) in.readObject();
- implicitGroups = (Set<ResourceGroup>) in.readObject();
- explicitGroups = (Set<ResourceGroup>) in.readObject();
- availability = (List<Availability>) in.readObject();
- currentAvailability = (ResourceAvailability) in.readObject();
- resourceErrors = (List<ResourceError>) in.readObject();
- productVersion = (ProductVersion) in.readObject();
- }*/
+ /* public void writeExternal(ObjectOutput out) throws IOException {
+ ExternalizableStrategy.Subsystem strategy = ExternalizableStrategy.getStrategy();
+ out.writeChar(strategy.id());
+
+ if (ExternalizableStrategy.Subsystem.REMOTEAPI == strategy) {
+ writeExternalRemote(out);
+ } else if (ExternalizableStrategy.Subsystem.REFLECTIVE_SERIALIZATION == strategy) {
+ EntitySerializer.writeExternalRemote(this, out);
+ } else {
+ writeExternalAgent(out);
+ }
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ char c = in.readChar();
+ if (ExternalizableStrategy.Subsystem.REMOTEAPI.id() == c) {
+ readExternalRemote(in);
+ } else if (ExternalizableStrategy.Subsystem.REFLECTIVE_SERIALIZATION.id() == c) {
+ EntitySerializer.readExternalRemote(this, in);
+ } else {
+ readExternalAgent(in);
+ }
+ }
+
+ public void writeExternalAgent(ObjectOutput out) throws IOException {
+ // Note that a Resource may have been constructed with id only. Check for uninitialized fields.
+ out.writeInt(id);
+ out.writeUTF(uuid);
+ out.writeUTF((null == resourceKey) ? "" : resourceKey);
+ out.writeUTF((null == name) ? "" : name);
+ out.writeInt(inventoryStatus.ordinal());
+ out.writeUTF((null == version) ? "" : version);
+ out.writeUTF((null == description) ? "" : description);
+ out.writeLong(ctime);
+ out.writeLong(mtime);
+ out.writeLong(itime);
+
+ //Subject modifiedBy;
+ //Subject owner;
+ //String location;
+ out.writeObject(parentResource);
+
+ if (null == resourceType) {
+ out.writeUTF("");
+ out.writeUTF("");
+ out.writeObject(null);
+ } else {
+ out.writeUTF(resourceType.getName());
+ out.writeUTF(resourceType.getPlugin());
+ out.writeObject(resourceType.getCategory());
+ }
+
+ // We make a copy of the childResources Set for two reasons: 1) to avoid calling writeObject() on the Set if it
+ // happens to be a Hibernate proxy (which would only ever be true on the Server side), and 2) to reduce the
+ // chances of a ConcurrentModificationException occurring in some other thread that is iterating the original Set.
+ out.writeObject((null == childResources) ? null : new LinkedHashSet<Resource>(childResources));
+
+ // Don't write plugin configs out if they are a lazy proxy
+ if (pluginConfiguration != null && pluginConfiguration.getClass().getName().contains("hibernate")) {
+ out.writeObject(null);
+ } else {
+ out.writeObject(pluginConfiguration);
+ }
+
+ //Set<MeasurementSchedule> schedules = new LinkedHashSet<MeasurementSchedule>();
+ //Agent agent;
+ //Set<ResourceGroup> resourceGroups = new HashSet<ResourceGroup>();
+ }
+
+ @SuppressWarnings("unchecked")
+ public void readExternalAgent(ObjectInput in) throws IOException, ClassNotFoundException {
+ id = in.readInt();
+ uuid = in.readUTF();
+ resourceKey = in.readUTF();
+ name = in.readUTF();
+ inventoryStatus = InventoryStatus.values()[in.readInt()];
+ version = in.readUTF();
+ description = in.readUTF();
+ ctime = in.readLong();
+ mtime = in.readLong();
+ itime = in.readLong();
+
+ //Subject modifiedBy;
+ //Subject owner;
+ //String location;
+ parentResource = (Resource) in.readObject();
+ resourceType = new ResourceType(in.readUTF(), in.readUTF(), (ResourceCategory) in.readObject(),
+ (parentResource != null) ? parentResource.getResourceType() : null);
+ childResources = (Set<Resource>) in.readObject();
+
+ pluginConfiguration = (Configuration) in.readObject();
+ }
+
+ // It is assumed that the object is clean of Hibernate proxies (i.e. HibernateDetachUtility has been run if necessary)
+ public void writeExternalRemote(ObjectOutput out) throws IOException {
+ // Note that a Resource may have been constructed with id only. Check for uninitialized fields.
+ out.writeInt(id);
+ out.writeUTF(uuid);
+ out.writeUTF(resourceKey);
+ out.writeUTF(name);
+ out.writeInt(inventoryStatus.ordinal());
+ out.writeUTF((null == version) ? "" : version);
+ out.writeUTF((null == description) ? "" : description);
+ out.writeLong(ctime);
+ out.writeLong(mtime);
+ out.writeLong(itime);
+ // not supplied by remote: modifiedBy
+ out.writeUTF((null == location) ? "" : location);
+ out.writeObject(resourceType);
+ // making a copy reduces chances of ConcurrentModificationException in a thread iterating the original
+ out.writeObject((null == childResources) ? null : new LinkedHashSet<Resource>(childResources));
+ out.writeObject(parentResource);
+ out.writeObject(resourceConfiguration);
+ out.writeObject(pluginConfiguration);
+ out.writeObject(agent);
+ // not supplied by remote: alertDefinitions
+ // not supplied by remote: resourceConfigurationUpdates
+ // not supplied by remote: pluginConfigurationUpdates
+ // making a copy reduces chances of ConcurrentModificationException in a thread iterating the original
+ out.writeObject((null == implicitGroups) ? null : new LinkedHashSet<ResourceGroup>(implicitGroups));
+ // making a copy reduces chances of ConcurrentModificationException in a thread iterating the original
+ out.writeObject((null == explicitGroups) ? null : new LinkedHashSet<ResourceGroup>(explicitGroups));
+ // not supplied by remote: contentServiceRequests
+ // not supplied by remote: createChildResourceRequests
+ // not supplied by remote: deleteResourceRequests
+ // not supplied by remote: operationHistories
+ // not supplied by remote: installedPackages
+ // not supplied by remote: installedPackageHistory
+ // not supplied by remote: resourceRepos
+ // not supplied by remote: schedules
+ out.writeObject(availability);
+ out.writeObject(currentAvailability);
+ out.writeObject(resourceErrors);
+ // not supplied by remote: eventSources
+ out.writeObject(productVersion);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void readExternalRemote(ObjectInput in) throws IOException, ClassNotFoundException {
+ id = in.readInt();
+ uuid = in.readUTF();
+ resourceKey = in.readUTF();
+ name = in.readUTF();
+ inventoryStatus = InventoryStatus.values()[in.readInt()];
+ version = in.readUTF();
+ description = in.readUTF();
+ ctime = in.readLong();
+ mtime = in.readLong();
+ itime = in.readLong();
+ location = in.readUTF();
+ resourceType = (ResourceType) in.readObject();
+ childResources = (Set<Resource>) in.readObject();
+ parentResource = (Resource) in.readObject();
+ resourceConfiguration = (Configuration) in.readObject();
+ pluginConfiguration = (Configuration) in.readObject();
+ agent = (Agent) in.readObject();
+ implicitGroups = (Set<ResourceGroup>) in.readObject();
+ explicitGroups = (Set<ResourceGroup>) in.readObject();
+ availability = (List<Availability>) in.readObject();
+ currentAvailability = (ResourceAvailability) in.readObject();
+ resourceErrors = (List<ResourceError>) in.readObject();
+ productVersion = (ProductVersion) in.readObject();
+ }*/
public void afterUnmarshal(Object u, Object parent) {
this.parentResource = (Resource) parent;
commit 871f470b77dd8e4d1148a741e21a17b99734c462
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Mar 22 10:34:03 2010 -0400
dont use getSimpleName - GWT can't handle it
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
index 6288b5c..c08aa5d 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
@@ -202,7 +202,9 @@ public abstract class Criteria implements Serializable {
public String getAlias() {
if (this.alias == null) {
// Base alias on persistent class's name: org.rhq.core.domain.ResourceType -> "resourcetype"
- String classSimpleName = getPersistentClass().getSimpleName();
+ // don't use getSimpleName - not available to GWT
+ String className = getPersistentClass().getName();
+ String classSimpleName = className.substring(className.lastIndexOf(".") + 1);
this.alias = classSimpleName.toLowerCase();
}
return this.alias;
commit 90d18c80edae411413ec7a3fd7c071a4becd0394
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Mar 22 10:09:52 2010 -0400
fix the package version criteria so it uses the proper alias.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/client/GwtClientUtility.java b/modules/core/domain/src/main/java/org/rhq/core/client/GwtClientUtility.java
deleted file mode 100644
index 0a227e0..0000000
--- a/modules/core/domain/src/main/java/org/rhq/core/client/GwtClientUtility.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.rhq.core.client;
-
-/**
- * @author Ian Springer
- */
-public class GwtClientUtility {
- public static String getSimpleName(Class clazz) {
- String className = clazz.getName();
- // TODO: Cache the simple names in a static Map<Class, String>.
- return className.substring(className.lastIndexOf(".") + 1);
- }
-
- private GwtClientUtility() {
- }
-}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
index 4caf4ab..6288b5c 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
@@ -32,7 +32,6 @@ import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
-import org.rhq.core.client.GwtClientUtility;
import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.util.PageControl;
@@ -203,7 +202,7 @@ public abstract class Criteria implements Serializable {
public String getAlias() {
if (this.alias == null) {
// Base alias on persistent class's name: org.rhq.core.domain.ResourceType -> "resourcetype"
- String classSimpleName = GwtClientUtility.getSimpleName(getPersistentClass());
+ String classSimpleName = getPersistentClass().getSimpleName();
this.alias = classSimpleName.toLowerCase();
}
return this.alias;
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/PackageVersionCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/PackageVersionCriteria.java
index 5e0d2f8..3e304b6 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/PackageVersionCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/PackageVersionCriteria.java
@@ -35,9 +35,10 @@ public class PackageVersionCriteria extends Criteria {
private PageOrdering sortDisplayName;
public PackageVersionCriteria() {
+ String alias = getAlias();
filterOverrides.put("repoId", "id IN " //
+ "( SELECT cpv.packageVersion.id" //
- + " FROM pv.repoPackageVersions cpv " //
+ + " FROM " + alias + ".repoPackageVersions cpv " //
+ " WHERE cpv.repo.id = ? )");
filterOverrides.put("fileSizeMinimum", "fileSize >= ?");
filterOverrides.put("fileSizeMaximum", "fileSize <= ?");
@@ -45,7 +46,7 @@ public class PackageVersionCriteria extends Criteria {
filterOverrides.put("packageTypeId", "generalPackage.packageType.id = ? ");
filterOverrides.put("resourceId", "id IN " //
+ "( SELECT ip.packageVersion.id" //
- + " FROM pv.installedPackages ip " //
+ + " FROM " + alias + ".installedPackages ip " //
+ " WHERE ip.resource.id = ? )");
}
commit c98e7cfd64d7a906607b35382167beb387576552
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Mar 22 01:43:35 2010 -0400
all domain tests now pass and all but 3 server/jar tests pass.
mainly fixed the requirement that you now have to explicitly set the uuid before persisting resource entities (tests need to do this now).
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/Property.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/Property.java
index 0cb4a5d..d995571 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/Property.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/Property.java
@@ -22,8 +22,7 @@
*/
package org.rhq.core.domain.configuration;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
+import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
@@ -45,7 +44,8 @@ import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlTransient;
-import java.io.Serializable;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
/**
* The abstract base class for all {@link Configuration} value property types. A property is associated with a specific
@@ -247,14 +247,11 @@ public class Property implements Serializable, DeepCopyable<Property> {
* @param t throwable whose message and stack trace will make up the error message (may be <code>null</code>)
*/
public void setErrorMessageFromThrowable(Throwable t) {
- /* TODO: GWT
if (t != null) {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- t.printStackTrace(new PrintStream(baos));
- setErrorMessage(baos.toString());
+ setErrorMessage(t.toString()); // TODO: would like this to be the full stack, but GWT doesn't make it easy so just set this to the throwable msg
} else {
setErrorMessage(null);
- }*/
+ }
}
@Override
@@ -284,80 +281,76 @@ public class Property implements Serializable, DeepCopyable<Property> {
return null;
}
- /* // It's not clear to me why this class implements Externalizable. It seems to write out every field
- // using standard serialization. Also, it's sub-classes seem to write out every field. To be safe I'm leaving
- // it as is and also applying the new strategy logic, in case there are (future) differences between agent and
- // remoteAPI serialization.
- public void writeExternal(ObjectOutput out) throws IOException {
- ExternalizableStrategy.Subsystem strategy = ExternalizableStrategy.getStrategy();
- out.writeChar(strategy.id());
-
- if (ExternalizableStrategy.Subsystem.REMOTEAPI == strategy) {
- writeExternalRemote(out);
- } else if (ExternalizableStrategy.Subsystem.REFLECTIVE_SERIALIZATION == strategy) {
- EntitySerializer.writeExternalRemote(this, out);
- } else {
- writeExternalAgent(out);
- }
- }
-
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- char c = in.readChar();
- if (ExternalizableStrategy.Subsystem.REMOTEAPI.id() == c) {
- readExternalRemote(in);
- } else if (ExternalizableStrategy.Subsystem.REFLECTIVE_SERIALIZATION.id() == c) {
- EntitySerializer.readExternalRemote(this, in);
- } else {
- readExternalAgent(in);
- }
- }
+ /*
+ // It's not clear to me why this class implements Externalizable. It seems to write out every field
+ // using standard serialization. Also, it's sub-classes seem to write out every field. To be safe I'm leaving
+ // it as is and also applying the new strategy logic, in case there are (future) differences between agent and
+ // remoteAPI serialization.
+ public void writeExternal(ObjectOutput out) throws IOException {
+ ExternalizableStrategy.Subsystem strategy = ExternalizableStrategy.getStrategy();
+ out.writeChar(strategy.id());
+
+ if (ExternalizableStrategy.Subsystem.REMOTEAPI == strategy) {
+ writeExternalRemote(out);
+ } else if (ExternalizableStrategy.Subsystem.REFLECTIVE_SERIALIZATION == strategy) {
+ EntitySerializer.writeExternalRemote(this, out);
+ } else {
+ writeExternalAgent(out);
+ }
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ char c = in.readChar();
+ if (ExternalizableStrategy.Subsystem.REMOTEAPI.id() == c) {
+ readExternalRemote(in);
+ } else if (ExternalizableStrategy.Subsystem.REFLECTIVE_SERIALIZATION.id() == c) {
+ EntitySerializer.readExternalRemote(this, in);
+ } else {
+ readExternalAgent(in);
+ }
+ }
- *//**
- * @see java.io.Externalizable#writeExternal(java.io.ObjectOutput)
- *//*
public void writeExternalAgent(ObjectOutput out) throws IOException {
- out.writeInt(id);
- out.writeObject(configuration);
- out.writeUTF(name);
- out.writeObject(parentList);
- out.writeObject(parentMap);
- out.writeObject(errorMessage);
+ out.writeInt(id);
+ out.writeObject(configuration);
+ out.writeUTF(name);
+ out.writeObject(parentList);
+ out.writeObject(parentMap);
+ out.writeObject(errorMessage);
}
- *//**
- * @see java.io.Externalizable#readExternal(java.io.ObjectInput)
- *//*
public void readExternalAgent(ObjectInput in) throws IOException, ClassNotFoundException {
- id = in.readInt();
- configuration = (Configuration) in.readObject();
- name = in.readUTF();
- parentList = (PropertyList) in.readObject();
- parentMap = (PropertyMap) in.readObject();
- errorMessage = (String) in.readObject();
+ id = in.readInt();
+ configuration = (Configuration) in.readObject();
+ name = in.readUTF();
+ parentList = (PropertyList) in.readObject();
+ parentMap = (PropertyMap) in.readObject();
+ errorMessage = (String) in.readObject();
}
// It is assumed that the object is clean of Hibernate proxies (i.e. HibernateDetachUtility has been run if necessary)
public void writeExternalRemote(ObjectOutput out) throws IOException {
- out.writeInt(id);
- out.writeObject(configuration);
- out.writeUTF(name);
- out.writeObject(errorMessage);
- out.writeObject(parentList);
- out.writeObject(parentMap);
+ out.writeInt(id);
+ out.writeObject(configuration);
+ out.writeUTF(name);
+ out.writeObject(errorMessage);
+ out.writeObject(parentList);
+ out.writeObject(parentMap);
}
public void readExternalRemote(ObjectInput in) throws IOException, ClassNotFoundException {
- id = in.readInt();
- configuration = (Configuration) in.readObject();
- name = in.readUTF();
- errorMessage = (String) in.readObject();
- parentList = (PropertyList) in.readObject();
- parentMap = (PropertyMap) in.readObject();
+ id = in.readInt();
+ configuration = (Configuration) in.readObject();
+ name = in.readUTF();
+ errorMessage = (String) in.readObject();
+ parentList = (PropertyList) in.readObject();
+ parentMap = (PropertyMap) in.readObject();
}*/
@Override
public String toString() {
- StringBuilder str = new StringBuilder(this.getClass().getName().substring(this.getClass().getName().lastIndexOf(".")+1));
+ StringBuilder str = new StringBuilder(this.getClass().getName().substring(
+ this.getClass().getName().lastIndexOf(".") + 1));
str.append("[id=").append(getId());
str.append(", name=").append(getName());
appendToStringInternals(str); // ask subclasses if they have anything else to add
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java
index 42b2a88..9a16d69 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java
@@ -23,9 +23,8 @@
package org.rhq.core.domain.configuration;
-import org.rhq.core.util.MessageDigestGenerator;
+import java.io.Serializable;
-import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
@@ -40,8 +39,6 @@ import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;
-import java.io.Serializable;
-
/**
* Resources support structured configuration as well as raw configuration which is represented by this class. A raw
* configuration is typically in the form of a file on the file system. This could be httpd.conf in the case of apache.
@@ -86,9 +83,8 @@ public class RawConfiguration implements Serializable, DeepCopyable<RawConfigura
@JoinColumn(name = "CONFIG_ID", nullable = false)
private Configuration configuration;
-
public RawConfiguration() {
-
+
}
/**
@@ -98,7 +94,7 @@ public class RawConfiguration implements Serializable, DeepCopyable<RawConfigura
*/
@Transient
public String errorMessage;
-
+
/** @return The database identifier or primary key */
public int getId() {
return id;
@@ -128,10 +124,12 @@ public class RawConfiguration implements Serializable, DeepCopyable<RawConfigura
* updated as well.
*
* @param contents The new contents
+ * @param sha256 the digest string representing the sha256 hash of the given contents
*/
- public void setContents(String contents) {
+ public void setContents(String contents, String sha256) {
this.contents = contents;
this.errorMessage = null;
+ setSha256(sha256);
}
/**
@@ -146,7 +144,6 @@ public class RawConfiguration implements Serializable, DeepCopyable<RawConfigura
this.sha256 = digestString;
}
-
/** @return A timestamp of when this object was created */
public long getCtime() {
return ctime;
@@ -167,7 +164,6 @@ public class RawConfiguration implements Serializable, DeepCopyable<RawConfigura
this.configuration = configuration;
}
-
@PrePersist
void onPersist() {
mtime = System.currentTimeMillis();
@@ -208,7 +204,7 @@ public class RawConfiguration implements Serializable, DeepCopyable<RawConfigura
if (this.path == null && that.path == null) {
return true;
}
- if ((this.path !=null && that.path != null) && this.path.equals(that.path)) {
+ if ((this.path != null && that.path != null) && this.path.equals(that.path)) {
return true;
}
}
@@ -241,14 +237,10 @@ public class RawConfiguration implements Serializable, DeepCopyable<RawConfigura
*/
@Override
public String toString() {
- return new StringBuilder()
- .append(this.getClass().getName().substring(this.getClass().getName().lastIndexOf(".")+1))
- .append("[id=").append(id)
- .append(", path=").append(path)
- .append(", sha256=").append(sha256)
- .append(", configuration=").append(configuration)
- .append("]")
- .toString();
+ return new StringBuilder().append(
+ this.getClass().getName().substring(this.getClass().getName().lastIndexOf(".") + 1)).append("[id=").append(
+ id).append(", path=").append(path).append(", sha256=").append(sha256).append(", configuration=").append(
+ configuration).append("]").toString();
}
/**
@@ -265,16 +257,14 @@ public class RawConfiguration implements Serializable, DeepCopyable<RawConfigura
}
copy.path = this.path;
-
+
if (this.contents != null) {
- copy.setContents(this.getContents());
+ copy.setContents(this.getContents(), this.getSha256());
}
copy.errorMessage = this.errorMessage;
-
+
return copy;
}
-
}
-
diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/ConfigurationTest.java b/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/ConfigurationTest.java
index 1d47d3b..32d0efb 100644
--- a/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/ConfigurationTest.java
+++ b/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/ConfigurationTest.java
@@ -23,14 +23,20 @@
package org.rhq.core.domain.configuration;
-import static org.testng.Assert.*;
-
-import org.testng.annotations.Test;
-import org.rhq.core.server.ExternalizableStrategy;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotSame;
+import static org.testng.Assert.assertSame;
+import static org.testng.Assert.assertTrue;
import java.util.Random;
import java.util.Set;
+import org.testng.annotations.Test;
+
+import org.rhq.core.server.ExternalizableStrategy;
+import org.rhq.core.util.MessageDigestGenerator;
+
/**
* This class has tests for Configuration just like org.rhq.core.domain.configuration.test.ConfigurationTest. These
* tests however are just plain, vanilla unit tests whereas the tests in org.rhq.core.domain.configuration.test.ConfigurationTest
@@ -43,7 +49,8 @@ public class ConfigurationTest {
Configuration original = createConfiguration();
Configuration copy = original.deepCopy(true);
- assertNotSame(copy, original, "Expected a reference to a new Configuration object, not the original object being copied");
+ assertNotSame(copy, original,
+ "Expected a reference to a new Configuration object, not the original object being copied");
}
@Test
@@ -51,7 +58,8 @@ public class ConfigurationTest {
Configuration original = createConfiguration();
Configuration copy = original.deepCopy(false);
- assertNotSame(copy, original, "Expected a reference to a new Configuration object, not the original object being copied");
+ assertNotSame(copy, original,
+ "Expected a reference to a new Configuration object, not the original object being copied");
}
@Test
@@ -81,8 +89,10 @@ public class ConfigurationTest {
Configuration copy = original.deepCopy(true);
- assertNotSame(copy.getProperties(), original.getProperties(), "The properties property should not refer to the properties in the original object");
- assertEquals(copy.getProperties(), original.getProperties(), "Failed to copy the contents of the properties collection");
+ assertNotSame(copy.getProperties(), original.getProperties(),
+ "The properties property should not refer to the properties in the original object");
+ assertEquals(copy.getProperties(), original.getProperties(),
+ "Failed to copy the contents of the properties collection");
}
@Test
@@ -92,8 +102,10 @@ public class ConfigurationTest {
Configuration copy = original.deepCopy(false);
- assertNotSame(copy.getProperties(), original.getProperties(), "The properties property should not refer to the properties in the original object");
- assertEquals(copy.getProperties(), original.getProperties(), "Failed to copy the contents of the properties collection");
+ assertNotSame(copy.getProperties(), original.getProperties(),
+ "The properties property should not refer to the properties in the original object");
+ assertEquals(copy.getProperties(), original.getProperties(),
+ "Failed to copy the contents of the properties collection");
}
@Test
@@ -104,7 +116,8 @@ public class ConfigurationTest {
Configuration copy = original.deepCopy(true);
- assertNotSame(copy.get(propertyName), original.get(propertyName), "Expected a refernce to a new property, not the original property being copied");
+ assertNotSame(copy.get(propertyName), original.get(propertyName),
+ "Expected a refernce to a new property, not the original property being copied");
}
@Test
@@ -115,7 +128,8 @@ public class ConfigurationTest {
Configuration copy = original.deepCopy(false);
- assertNotSame(copy.get(propertyName), original.get(propertyName), "Expected a refernce to a new property, not the original property being copied");
+ assertNotSame(copy.get(propertyName), original.get(propertyName),
+ "Expected a refernce to a new property, not the original property being copied");
}
@Test
@@ -129,8 +143,7 @@ public class ConfigurationTest {
assertSame(
copy.get(propertyName).getConfiguration(),
copy,
- "The reference to the parent configuration should point to the newly copied configuration, not the original configuration"
- );
+ "The reference to the parent configuration should point to the newly copied configuration, not the original configuration");
}
@Test
@@ -144,8 +157,7 @@ public class ConfigurationTest {
assertSame(
copy.get(propertyName).getConfiguration(),
copy,
- "The reference to the parent configuration should point to the newly copied configuration, not the original configuration"
- );
+ "The reference to the parent configuration should point to the newly copied configuration, not the original configuration");
}
@Test
@@ -155,13 +167,11 @@ public class ConfigurationTest {
Configuration copy = original.deepCopy(true);
- assertNotSame(
- copy.getRawConfigurations(),
- original.getRawConfigurations(),
- "The rawConfigurations property should not refer to the original rawConfigurations of the copied object."
- );
+ assertNotSame(copy.getRawConfigurations(), original.getRawConfigurations(),
+ "The rawConfigurations property should not refer to the original rawConfigurations of the copied object.");
- assertRawConfigurationsEquals(copy.getRawConfigurations(), original.getRawConfigurations(), "Failed to copy rawConfigurations property.");
+ assertRawConfigurationsEquals(copy.getRawConfigurations(), original.getRawConfigurations(),
+ "Failed to copy rawConfigurations property.");
}
@Test
@@ -171,17 +181,16 @@ public class ConfigurationTest {
Configuration copy = original.deepCopy(false);
- assertNotSame(
- copy.getRawConfigurations(),
- original.getRawConfigurations(),
- "The rawConfigurations property should not refer to the original rawConfigurations of the copied object."
- );
+ assertNotSame(copy.getRawConfigurations(), original.getRawConfigurations(),
+ "The rawConfigurations property should not refer to the original rawConfigurations of the copied object.");
- assertRawConfigurationsEquals(copy.getRawConfigurations(), original.getRawConfigurations(), "Failed to copy rawConfigurations property.");
+ assertRawConfigurationsEquals(copy.getRawConfigurations(), original.getRawConfigurations(),
+ "Failed to copy rawConfigurations property.");
}
void assertRawConfigurationsEquals(Set<RawConfiguration> actual, Set<RawConfiguration> expected, String msg) {
- assertEquals(actual.size(), expected.size(), msg + " -- The rawConfigurations set has the wrong number of elements.");
+ assertEquals(actual.size(), expected.size(), msg
+ + " -- The rawConfigurations set has the wrong number of elements.");
for (RawConfiguration rawConfig : expected) {
assertTrue(actual.contains(rawConfig), msg + " -- Failed to find " + rawConfig);
}
@@ -198,8 +207,7 @@ public class ConfigurationTest {
assertSame(
copiedRawConfig.getConfiguration(),
copy,
- "The reference to the parent configuration should point to the newly copied configuration, not the original configuration."
- );
+ "The reference to the parent configuration should point to the newly copied configuration, not the original configuration.");
}
@Test
@@ -213,8 +221,7 @@ public class ConfigurationTest {
assertSame(
copiedRawConfig.getConfiguration(),
copy,
- "The reference to the parent configuration should point to the newly copied configuration, not the original configuration."
- );
+ "The reference to the parent configuration should point to the newly copied configuration, not the original configuration.");
}
private RawConfiguration getCopiedRawConfiguration(Configuration config) {
@@ -235,7 +242,8 @@ public class ConfigurationTest {
public void equalsShouldBeFalseWhenArgumentIsNotAConfiguration() {
Configuration config = new Configuration();
- assertFalse(config.equals(new Object()), "equals should return false when argument is not a " + Configuration.class.getSimpleName());
+ assertFalse(config.equals(new Object()), "equals should return false when argument is not a "
+ + Configuration.class.getSimpleName());
}
@Test
@@ -262,10 +270,8 @@ public class ConfigurationTest {
Configuration c2 = new Configuration();
c2.put(new PropertySimple("foo", "bar"));
- assertTrue(
- c1.equals(c2) && c2.equals(c1),
- "equals() should be true and symmetric when structured configs are equal and there are no raw configs."
- );
+ assertTrue(c1.equals(c2) && c2.equals(c1),
+ "equals() should be true and symmetric when structured configs are equal and there are no raw configs.");
assertEquals(c1.hashCode(), c2.hashCode());
}
@@ -279,10 +285,8 @@ public class ConfigurationTest {
Configuration c2 = new Configuration();
c2.addRawConfiguration(createCopyOfRawConfiguration(rawConfig));
- assertTrue(
- c1.equals(c2) && c2.equals(c1),
- "equals() should be true and symmetric when raw configs are equal and there are no structured configs."
- );
+ assertTrue(c1.equals(c2) && c2.equals(c1),
+ "equals() should be true and symmetric when raw configs are equal and there are no structured configs.");
assertEquals(c1.hashCode(), c2.hashCode());
}
@@ -309,7 +313,8 @@ public class ConfigurationTest {
Configuration c3 = new Configuration();
c3.put(new PropertySimple("foo", "bar"));
- assertTrue(c1.equals(c2) && c2.equals(c3), "equals() should be true when structured configs are equal and there are no raw configs.");
+ assertTrue(c1.equals(c2) && c2.equals(c3),
+ "equals() should be true when structured configs are equal and there are no raw configs.");
assertTrue(c1.equals(c3), "equals should be transitive.");
assertEquals(c1.hashCode(), c3.hashCode(), "hashCodes should be the same when equals() returns true.");
@@ -328,7 +333,8 @@ public class ConfigurationTest {
Configuration c3 = new Configuration();
c3.addRawConfiguration(createCopyOfRawConfiguration(rawConfig));
- assertTrue(c1.equals(c2) && c2.equals(c3), "equals() should be true when raw configs are equal and there are no structured configs.");
+ assertTrue(c1.equals(c2) && c2.equals(c3),
+ "equals() should be true when raw configs are equal and there are no structured configs.");
assertTrue(c1.equals(c3), "equals should be transitive.");
assertEquals(c1.hashCode(), c3.hashCode(), "hashCodes should be the same when equals() returns true.");
@@ -420,7 +426,9 @@ public class ConfigurationTest {
RawConfiguration rawConfig = new RawConfiguration();
rawConfig.setPath(path);
- rawConfig.setContents(new String(bytes));
+ String contents = new String(bytes);
+ String sha256 = new MessageDigestGenerator(MessageDigestGenerator.SHA_256).calcDigestString(contents);
+ rawConfig.setContents(contents, sha256);
return rawConfig;
}
@@ -428,7 +436,9 @@ public class ConfigurationTest {
private RawConfiguration createCopyOfRawConfiguration(RawConfiguration rawConfig) {
RawConfiguration copy = new RawConfiguration();
copy.setPath(rawConfig.getPath());
- copy.setContents(rawConfig.getContents());
+ String contents = rawConfig.getContents();
+ String sha256 = new MessageDigestGenerator(MessageDigestGenerator.SHA_256).calcDigestString(contents);
+ copy.setContents(contents, sha256);
copy.setConfiguration(rawConfig.getConfiguration());
return copy;
@@ -495,11 +505,8 @@ public class ConfigurationTest {
assertEquals(serializedConfig.getMap(), config.getMap(), "Failed to property serialize the map property");
for (Property property : serializedConfig.getProperties()) {
- assertEquals(
- property.getConfiguration(),
- serializedConfig,
- "Failed to update parent reference of property during serialization"
- );
+ assertEquals(property.getConfiguration(), serializedConfig,
+ "Failed to update parent reference of property during serialization");
}
}
@@ -561,11 +568,8 @@ public class ConfigurationTest {
Configuration serializedConfig = TestUtil.serializeAndDeserialize(config);
- assertEquals(
- serializedConfig.getVersion(),
- config.getVersion(),
- "Failed to properly serialize the version property"
- );
+ assertEquals(serializedConfig.getVersion(), config.getVersion(),
+ "Failed to properly serialize the version property");
}
@Test
@@ -595,12 +599,8 @@ public class ConfigurationTest {
Configuration serializedConfig = TestUtil.serializeAndDeserialize(config);
-
- assertEquals(
- serializedConfig.getModifiedTime(),
- config.getModifiedTime(),
- "Failed to properly serialize the modifiedTime property"
- );
+ assertEquals(serializedConfig.getModifiedTime(), config.getModifiedTime(),
+ "Failed to properly serialize the modifiedTime property");
}
@Test
@@ -630,11 +630,8 @@ public class ConfigurationTest {
Configuration serializedConfig = TestUtil.serializeAndDeserialize(config);
- assertEquals(
- serializedConfig.getCreatedTime(),
- config.getCreatedTime(),
- "Failed to properly serialize the createdTime property"
- );
+ assertEquals(serializedConfig.getCreatedTime(), config.getCreatedTime(),
+ "Failed to properly serialize the createdTime property");
}
@Test
@@ -665,17 +662,11 @@ public class ConfigurationTest {
Configuration serializedConfig = TestUtil.serializeAndDeserialize(config);
- assertRawConfigurationsEquals(
- serializedConfig.getRawConfigurations(),
- config.getRawConfigurations(),
- "Failed to properly serialize rawConfigurations property"
- );
+ assertRawConfigurationsEquals(serializedConfig.getRawConfigurations(), config.getRawConfigurations(),
+ "Failed to properly serialize rawConfigurations property");
for (RawConfiguration rawConfig : serializedConfig.getRawConfigurations()) {
- assertEquals(
- rawConfig.getConfiguration(),
- serializedConfig,
- "Failed to update parent reference of raw config during serialization"
- );
+ assertEquals(rawConfig.getConfiguration(), serializedConfig,
+ "Failed to update parent reference of raw config during serialization");
}
}
diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/RawConfigurationIntegrationTest.java b/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/RawConfigurationIntegrationTest.java
index 65a0773..763a3cf 100644
--- a/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/RawConfigurationIntegrationTest.java
+++ b/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/RawConfigurationIntegrationTest.java
@@ -23,10 +23,12 @@
package org.rhq.core.domain.configuration;
-import org.rhq.core.domain.test.AbstractEJB3Test;
+import javax.persistence.EntityManager;
+
import org.testng.annotations.Test;
-import javax.persistence.EntityManager;
+import org.rhq.core.domain.test.AbstractEJB3Test;
+import org.rhq.core.util.MessageDigestGenerator;
public class RawConfigurationIntegrationTest extends AbstractEJB3Test {
@@ -40,7 +42,9 @@ public class RawConfigurationIntegrationTest extends AbstractEJB3Test {
RawConfiguration rawConfig = new RawConfiguration();
rawConfig.setConfiguration(config);
- rawConfig.setContents("contents");
+ String contents = "contents";
+ String sha256 = new MessageDigestGenerator(MessageDigestGenerator.SHA_256).calcDigestString(contents);
+ rawConfig.setContents(contents, sha256);
rawConfig.setPath("/tmp/foo.txt");
entityMgr.persist(rawConfig);
@@ -48,9 +52,8 @@ public class RawConfigurationIntegrationTest extends AbstractEJB3Test {
RawConfiguration savedRawConfig = entityMgr.find(RawConfiguration.class, rawConfig.getId());
assertNotNull("Failed to find " + RawConfiguration.class.getSimpleName() + " by id.", savedRawConfig);
- }
- finally {
- getTransactionManager().rollback();
+ } finally {
+ getTransactionManager().rollback();
}
}
diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/RawConfigurationTest.java b/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/RawConfigurationTest.java
index 12e7ed0..7f02390 100644
--- a/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/RawConfigurationTest.java
+++ b/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/RawConfigurationTest.java
@@ -23,25 +23,22 @@
package org.rhq.core.domain.configuration;
-import static org.testng.Assert.*;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.digest.DigestUtils;
import org.testng.annotations.Test;
-import org.rhq.core.util.MessageDigestGenerator;
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectOutputStream;
-import java.io.ByteArrayInputStream;
-import java.io.ObjectInputStream;
-import java.io.IOException;
+import org.rhq.core.util.MessageDigestGenerator;
public class RawConfigurationTest {
@Test
public void sha256ShouldChangeWhenContentsChange() throws Exception {
RawConfiguration rawConfig = new RawConfiguration();
- rawConfig.setContents("contents");
+ setContentsAndSha256(rawConfig, "contents");
String actualSha256 = rawConfig.getSha256();
@@ -50,7 +47,7 @@ public class RawConfigurationTest {
assertEquals(actualSha256, expectedSha256, "Failed to calculate the SHA-256 correctly.");
String newContents = "new contents";
- rawConfig.setContents(newContents);
+ setContentsAndSha256(rawConfig, newContents);
actualSha256 = rawConfig.getSha256();
@@ -74,8 +71,8 @@ public class RawConfigurationTest {
public void verifyEqualsWhenObjectIsNotARawConfiguration() {
RawConfiguration rawConfig = new RawConfiguration();
- assertFalse(rawConfig.equals(new Object()), "equals() should return false when incoming object is not a " +
- RawConfiguration.class.getSimpleName());
+ assertFalse(rawConfig.equals(new Object()), "equals() should return false when incoming object is not a "
+ + RawConfiguration.class.getSimpleName());
}
@Test
@@ -89,7 +86,7 @@ public class RawConfigurationTest {
@Test
public void verifyEqualsWhenRawConfigurationArgHasNullContents() {
RawConfiguration r1 = new RawConfiguration();
- r1.setContents("contents");
+ setContentsAndSha256(r1, "contents");
RawConfiguration r2 = new RawConfiguration();
@@ -99,13 +96,14 @@ public class RawConfigurationTest {
@Test
public void verifyEqualsWhenRawConfigurationArgHasNullPath() {
RawConfiguration r1 = new RawConfiguration();
- r1.setContents("contents");
+ setContentsAndSha256(r1, "contents");
r1.setPath("/tmp/foo");
RawConfiguration r2 = new RawConfiguration();
- r2.setContents("contents");
+ setContentsAndSha256(r2, "contents");
- assertFalse(r1.equals(r2), "equals() should return false when one of the raw configs does not have its paths set");
+ assertFalse(r1.equals(r2),
+ "equals() should return false when one of the raw configs does not have its paths set");
}
@Test
@@ -118,10 +116,10 @@ public class RawConfigurationTest {
@Test
public void verifyEqualsAndHashCodeAreSymmetricWhenPathIsNull() {
RawConfiguration r1 = new RawConfiguration();
- r1.setContents("contents");
+ setContentsAndSha256(r1, "contents");
RawConfiguration r2 = new RawConfiguration();
- r2.setContents("contents");
+ setContentsAndSha256(r2, "contents");
assertTrue(r1.equals(r2), "equals() should be true when contents are the same and path is null for both.");
assertTrue(r2.equals(r1), "equals() should be symmetric.");
@@ -132,11 +130,11 @@ public class RawConfigurationTest {
@Test
public void verifyEqualsAndHashCodeAreSymmetricWhenPathIsNotNull() {
RawConfiguration r1 = new RawConfiguration();
- r1.setContents("contents");
+ setContentsAndSha256(r1, "contents");
r1.setPath("/tmp/foo");
RawConfiguration r2 = new RawConfiguration();
- r2.setContents("contents");
+ setContentsAndSha256(r2, "contents");
r2.setPath("/tmp/foo");
assertTrue(r1.equals(r2), "equals() should be true when contents and paths are the same.");
@@ -150,15 +148,16 @@ public class RawConfigurationTest {
String contents = "contents";
RawConfiguration r1 = new RawConfiguration();
- r1.setContents(contents);
+ setContentsAndSha256(r1, contents);
RawConfiguration r2 = new RawConfiguration();
- r2.setContents(contents);
+ setContentsAndSha256(r2, contents);
RawConfiguration r3 = new RawConfiguration();
- r3.setContents(contents);
+ setContentsAndSha256(r3, contents);
- assertTrue(r1.equals(r2) && r2.equals(r3), "equals() should be true when contents are the same and paths are null.");
+ assertTrue(r1.equals(r2) && r2.equals(r3),
+ "equals() should be true when contents are the same and paths are null.");
assertTrue(r1.equals(r3), "equals() should be transitive when contents are the same and paths are null.");
assertEquals(r1.hashCode(), r3.hashCode(), "hashCode() should be the same for r1 and r3 via transitivity.");
@@ -169,15 +168,15 @@ public class RawConfigurationTest {
String contents = "contents";
RawConfiguration r1 = new RawConfiguration();
- r1.setContents(contents);
+ setContentsAndSha256(r1, contents);
r1.setPath("/tmp/foo");
RawConfiguration r2 = new RawConfiguration();
- r2.setContents(contents);
+ setContentsAndSha256(r2, contents);
r2.setPath("/tmp/foo");
RawConfiguration r3 = new RawConfiguration();
- r3.setContents(contents);
+ setContentsAndSha256(r3, contents);
r3.setPath("/tmp/foo");
assertTrue(r1.equals(r2) && r2.equals(r3), "equals() should be true when contents and paths are the same.");
@@ -213,7 +212,7 @@ public class RawConfigurationTest {
@Test
public void deepCopyShouldCopyContentsWhenCopyingId() {
RawConfiguration original = new RawConfiguration();
- original.setContents("contents");
+ setContentsAndSha256(original, "contents");
RawConfiguration copy = original.deepCopy(true);
@@ -224,7 +223,7 @@ public class RawConfigurationTest {
@Test
public void deepCopyShouldCopyContentsWhenNotCopyingId() {
RawConfiguration original = new RawConfiguration();
- original.setContents("contents");
+ setContentsAndSha256(original, "contents");
RawConfiguration copy = original.deepCopy(false);
@@ -232,4 +231,8 @@ public class RawConfigurationTest {
assertEquals(copy.getContents(), original.getContents(), "Failed to copy contents property.");
}
+ private void setContentsAndSha256(RawConfiguration rc, String contents) {
+ String sha256 = new MessageDigestGenerator(MessageDigestGenerator.SHA_256).calcDigestString(contents);
+ rc.setContents(contents, sha256);
+ }
}
diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/test/ConfigurationTest.java b/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/test/ConfigurationTest.java
index dda0435..c581ff8 100644
--- a/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/test/ConfigurationTest.java
+++ b/modules/core/domain/src/test/java/org/rhq/core/domain/configuration/test/ConfigurationTest.java
@@ -40,12 +40,13 @@ 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.ResourceConfigurationUpdate;
import org.rhq.core.domain.configuration.RawConfiguration;
+import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.test.AbstractEJB3Test;
+import org.rhq.core.util.MessageDigestGenerator;
import org.rhq.core.util.exception.ThrowableUtil;
public class ConfigurationTest extends AbstractEJB3Test {
@@ -61,7 +62,8 @@ public class ConfigurationTest extends AbstractEJB3Test {
Configuration c = new Configuration();
PropertySimple p1 = new PropertySimple("first", "firstValue");
- p1.setErrorMessageFromThrowable(new Exception("This should be a boolean value - true or false"));
+ p1.setErrorMessage(ThrowableUtil.getStackAsString(new Exception(
+ "This should be a boolean value - true or false")));
c.put(p1);
em.persist(c);
@@ -102,7 +104,8 @@ public class ConfigurationTest extends AbstractEJB3Test {
try {
Configuration c = new Configuration();
PropertySimple p1 = new PropertySimple("first", "firstValue");
- p1.setErrorMessageFromThrowable(new Exception("This should be a boolean value - true or false"));
+ p1.setErrorMessage(ThrowableUtil.getStackAsString(new Exception(
+ "This should be a boolean value - true or false")));
c.put(p1);
em.persist(c);
Configuration copy = em.find(Configuration.class, c.getId());
@@ -218,8 +221,7 @@ public class ConfigurationTest extends AbstractEJB3Test {
entityMgr.persist(config);
assertTrue("Failed to cascade save to " + RawConfiguration.class.getSimpleName(), rawConfig.getId() != 0);
- }
- finally {
+ } finally {
getTransactionManager().rollback();
}
}
@@ -244,19 +246,18 @@ public class ConfigurationTest extends AbstractEJB3Test {
entityMgr.flush();
entityMgr.clear();
- assertNull(
- "Failed to remove the orphaned " + RawConfiguration.class.getSimpleName() + " from the persistence context.",
- entityMgr.find(RawConfiguration.class, rawConfiguration.getId())
- );
- }
- finally {
+ assertNull("Failed to remove the orphaned " + RawConfiguration.class.getSimpleName()
+ + " from the persistence context.", entityMgr.find(RawConfiguration.class, rawConfiguration.getId()));
+ } finally {
getTransactionManager().rollback();
}
}
RawConfiguration createRawConfiguration() {
RawConfiguration rawConfig = new RawConfiguration();
- rawConfig.setContents("contents");
+ String contents = "contents";
+ String sha256 = new MessageDigestGenerator(MessageDigestGenerator.SHA_256).calcDigestString(contents);
+ rawConfig.setContents(contents, sha256);
rawConfig.setPath("/tmp/foo");
return rawConfig;
diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/content/test/ContentSourceSyncResultsTest.java b/modules/core/domain/src/test/java/org/rhq/core/domain/content/test/ContentSourceSyncResultsTest.java
index eed6b3f..deb5fc3 100644
--- a/modules/core/domain/src/test/java/org/rhq/core/domain/content/test/ContentSourceSyncResultsTest.java
+++ b/modules/core/domain/src/test/java/org/rhq/core/domain/content/test/ContentSourceSyncResultsTest.java
@@ -31,8 +31,8 @@ import org.testng.annotations.Test;
import org.rhq.core.domain.content.Architecture;
import org.rhq.core.domain.content.ContentSource;
import org.rhq.core.domain.content.ContentSourceSyncResults;
-import org.rhq.core.domain.content.ContentSyncStatus;
import org.rhq.core.domain.content.ContentSourceType;
+import org.rhq.core.domain.content.ContentSyncStatus;
import org.rhq.core.domain.content.Package;
import org.rhq.core.domain.content.PackageType;
import org.rhq.core.domain.content.PackageVersion;
@@ -49,16 +49,17 @@ public class ContentSourceSyncResultsTest extends AbstractEJB3Test {
try {
EntityManager em = getEntityManager();
- ResourceType rt = new ResourceType("testPVCSResourceType", "testPlugin", ResourceCategory.PLATFORM, null);
- Resource resource = new Resource("testPVCSResource", "testPVCSResource", rt);
- Architecture arch = new Architecture("testPVCSInsertArch");
- PackageType pt = new PackageType("testPVCSInsertPT", resource.getResourceType());
- Package pkg = new Package("testPVCSInsertPackage", pt);
+ ResourceType rt = new ResourceType("testCSSRResourceType", "testPlugin", ResourceCategory.PLATFORM, null);
+ Resource resource = new Resource("testCSSRResource", "testCSSRResource", rt);
+ resource.setUuid("uuid");
+ Architecture arch = new Architecture("testCSSRInsertArch");
+ PackageType pt = new PackageType("testCSSRInsertPT", resource.getResourceType());
+ Package pkg = new Package("testCSSRInsertPackage", pt);
PackageVersion pv = new PackageVersion(pkg, "version", arch);
- ContentSourceType cst = new ContentSourceType("testPVCSContentSourceType");
- ContentSource cs = new ContentSource("testPVCSContentSource", cst);
+ ContentSourceType cst = new ContentSourceType("testCSSRContentSourceType");
+ ContentSource cs = new ContentSource("testCSSRContentSource", cst);
ContentSourceSyncResults results = new ContentSourceSyncResults(cs);
- Repo repo = new Repo("testPVCSRepo");
+ Repo repo = new Repo("testCSSRRepo");
repo.addContentSource(cs);
em.persist(rt);
@@ -107,6 +108,9 @@ public class ContentSourceSyncResultsTest extends AbstractEJB3Test {
syncResults = cs.getSyncResults();
assert syncResults != null;
assert syncResults.size() == 2;
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw e;
} finally {
getTransactionManager().rollback();
}
diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/content/test/ContentSourceTest.java b/modules/core/domain/src/test/java/org/rhq/core/domain/content/test/ContentSourceTest.java
index f9a1475..3f89351 100644
--- a/modules/core/domain/src/test/java/org/rhq/core/domain/content/test/ContentSourceTest.java
+++ b/modules/core/domain/src/test/java/org/rhq/core/domain/content/test/ContentSourceTest.java
@@ -1,29 +1,33 @@
- /*
- * RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
package org.rhq.core.domain.content.test;
+import java.util.Random;
+
import javax.persistence.EntityManager;
+
import org.testng.annotations.Test;
+
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.content.Architecture;
@@ -46,6 +50,7 @@ public class ContentSourceTest extends AbstractEJB3Test {
ResourceType rt = new ResourceType("testCSResourceType", "testPlugin", ResourceCategory.PLATFORM, null);
Resource resource = new Resource("testCSResource", "testCSResource", rt);
+ resource.setUuid("" + new Random().nextInt());
Architecture arch = new Architecture("testCSInsertArch");
PackageType pt = new PackageType("testCSInsertPT", resource.getResourceType());
Package pkg = new Package("testCSInsertPackage", pt);
@@ -92,6 +97,7 @@ public class ContentSourceTest extends AbstractEJB3Test {
ResourceType rt = new ResourceType("testCSResourceType", "testPlugin", ResourceCategory.PLATFORM, null);
Resource resource = new Resource("testCSResource", "testCSResource", rt);
+ resource.setUuid("" + new Random().nextInt());
Architecture arch = new Architecture("testCSInsertArch");
PackageType pt = new PackageType("testCSInsertPT", resource.getResourceType());
Package pkg = new Package("testCSInsertPackage", pt);
@@ -141,6 +147,7 @@ public class ContentSourceTest extends AbstractEJB3Test {
ResourceType rt = new ResourceType("testCSResourceType", "testPlugin", ResourceCategory.PLATFORM, null);
Resource resource = new Resource("testCSResource", "testCSResource", rt);
+ resource.setUuid("" + new Random().nextInt());
Architecture arch = new Architecture("testCSInsertArch");
PackageType pt = new PackageType("testCSInsertPT", resource.getResourceType());
Package pkg = new Package("testCSInsertPackage", pt);
diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/content/test/PackageVersionContentSourceTest.java b/modules/core/domain/src/test/java/org/rhq/core/domain/content/test/PackageVersionContentSourceTest.java
index b921cce..59cc693 100644
--- a/modules/core/domain/src/test/java/org/rhq/core/domain/content/test/PackageVersionContentSourceTest.java
+++ b/modules/core/domain/src/test/java/org/rhq/core/domain/content/test/PackageVersionContentSourceTest.java
@@ -23,6 +23,7 @@
package org.rhq.core.domain.content.test;
import java.util.List;
+import java.util.Random;
import javax.persistence.EntityManager;
import javax.persistence.Query;
@@ -64,6 +65,7 @@ public class PackageVersionContentSourceTest extends AbstractEJB3Test {
ResourceType rt = new ResourceType("testPVCSResourceType", "testPlugin", ResourceCategory.PLATFORM, null);
Resource resource = new Resource("testPVCSResource", "testPVCSResource", rt);
+ resource.setUuid("" + new Random().nextInt());
Architecture arch = new Architecture("testPVCSInsertArch");
PackageType pt = new PackageType("testPVCSInsertPT", resource.getResourceType());
Package pkg = new Package("testPVCSInsertPackage", pt);
@@ -178,6 +180,7 @@ public class PackageVersionContentSourceTest extends AbstractEJB3Test {
ResourceType rt = new ResourceType("testPVCSResourceType", "testPlugin", ResourceCategory.PLATFORM, null);
Resource resource = new Resource("testPVCSResource", "testPVCSResource", rt);
+ resource.setUuid("" + new Random().nextInt());
Architecture arch = new Architecture("testPVCSInsertArch");
PackageType pt = new PackageType("testPVCSInsertPT", resource.getResourceType());
Package pkg = new Package("testPVCSInsertPackage", pt);
@@ -233,6 +236,7 @@ public class PackageVersionContentSourceTest extends AbstractEJB3Test {
ResourceType rt = new ResourceType("testPVCSResourceType", "testPlugin", ResourceCategory.PLATFORM, null);
Resource resource = new Resource("testPVCSResource", "testPVCSResource", rt);
+ resource.setUuid("" + new Random().nextInt());
Architecture arch = new Architecture("testPVCSInsertArch");
PackageType pt = new PackageType("testPVCSInsertPT", resource.getResourceType());
Package pkg = new Package("testPVCSInsertPackage", pt);
diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/content/test/RepoGroupTest.java b/modules/core/domain/src/test/java/org/rhq/core/domain/content/test/RepoGroupTest.java
index 073395d..58ad823 100644
--- a/modules/core/domain/src/test/java/org/rhq/core/domain/content/test/RepoGroupTest.java
+++ b/modules/core/domain/src/test/java/org/rhq/core/domain/content/test/RepoGroupTest.java
@@ -1,29 +1,33 @@
- /*
- * RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
package org.rhq.core.domain.content.test;
+import java.util.Random;
+
import javax.persistence.EntityManager;
+
import org.testng.annotations.Test;
+
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.content.Architecture;
@@ -35,8 +39,6 @@ import org.rhq.core.domain.content.PackageVersion;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.domain.content.RepoGroup;
-
import org.rhq.core.domain.test.AbstractEJB3Test;
@Test
@@ -48,6 +50,7 @@ public class RepoGroupTest extends AbstractEJB3Test {
ResourceType rt = new ResourceType("testCSResourceType", "testPlugin", ResourceCategory.PLATFORM, null);
Resource resource = new Resource("testCSResource", "testCSResource", rt);
+ resource.setUuid("" + new Random().nextInt());
Architecture arch = new Architecture("testCSInsertArch");
PackageType pt = new PackageType("testCSInsertPT", resource.getResourceType());
Package pkg = new Package("testCSInsertPackage", pt);
@@ -94,6 +97,7 @@ public class RepoGroupTest extends AbstractEJB3Test {
ResourceType rt = new ResourceType("testCSResourceType", "testPlugin", ResourceCategory.PLATFORM, null);
Resource resource = new Resource("testCSResource", "testCSResource", rt);
+ resource.setUuid("" + new Random().nextInt());
Architecture arch = new Architecture("testCSInsertArch");
PackageType pt = new PackageType("testCSInsertPT", resource.getResourceType());
Package pkg = new Package("testCSInsertPackage", pt);
@@ -143,6 +147,7 @@ public class RepoGroupTest extends AbstractEJB3Test {
ResourceType rt = new ResourceType("testCSResourceType", "testPlugin", ResourceCategory.PLATFORM, null);
Resource resource = new Resource("testCSResource", "testCSResource", rt);
+ resource.setUuid("" + new Random().nextInt());
Architecture arch = new Architecture("testCSInsertArch");
PackageType pt = new PackageType("testCSInsertPT", resource.getResourceType());
Package pkg = new Package("testCSInsertPackage", pt);
diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/measurement/test/CompositeLoadingTest.java b/modules/core/domain/src/test/java/org/rhq/core/domain/measurement/test/CompositeLoadingTest.java
index 1bf29f8..c5adab3 100644
--- a/modules/core/domain/src/test/java/org/rhq/core/domain/measurement/test/CompositeLoadingTest.java
+++ b/modules/core/domain/src/test/java/org/rhq/core/domain/measurement/test/CompositeLoadingTest.java
@@ -1,31 +1,32 @@
- /*
- * RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
package org.rhq.core.domain.measurement.test;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
+import java.util.Random;
import javax.persistence.EntityManager;
import javax.persistence.Query;
@@ -99,14 +100,17 @@ public class CompositeLoadingTest extends AbstractEJB3Test {
ResourceType resourceType = new ResourceType("fake platform", "fake plugin", ResourceCategory.PLATFORM, null);
em.persist(resourceType);
Resource platform = new Resource("org.jboss.on.TestPlatfor", "Fake Platform", resourceType);
+ platform.setUuid("" + new Random().nextInt());
em.persist(platform);
Availability a = new Availability(platform, date, AvailabilityType.UP);
ids.add(platform.getId());
Resource platform2 = new Resource("org.jboss.on.TestPlatform2", "Fake Platform2", resourceType);
+ platform2.setUuid("" + new Random().nextInt());
em.persist(platform2);
Availability a2 = new Availability(platform2, date, AvailabilityType.UP);
ids.add(platform2.getId());
Resource platform3 = new Resource("org.jboss.on.TestPlatform3", "Fake Platform3", resourceType);
+ platform3.setUuid("" + new Random().nextInt());
em.persist(platform3);
Availability a3 = new Availability(platform3, date, AvailabilityType.UP);
ids.add(platform3.getId());
diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/measurement/test/MeasurementTest.java b/modules/core/domain/src/test/java/org/rhq/core/domain/measurement/test/MeasurementTest.java
index be727a1..67e886a 100644
--- a/modules/core/domain/src/test/java/org/rhq/core/domain/measurement/test/MeasurementTest.java
+++ b/modules/core/domain/src/test/java/org/rhq/core/domain/measurement/test/MeasurementTest.java
@@ -28,6 +28,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
+import java.util.Random;
import javax.persistence.EntityManager;
import javax.persistence.Query;
@@ -347,8 +348,10 @@ public class MeasurementTest extends AbstractEJB3Test {
ResourceType resourceType = new ResourceType("fake platform", "fake plugin", ResourceCategory.PLATFORM, null);
em.persist(resourceType);
Resource platform = new Resource("org.jboss.on.TestPlatfor", "Fake Platform", resourceType);
+ platform.setUuid("" + new Random().nextInt());
em.persist(platform);
Resource platform2 = new Resource("org.jboss.on.TestPlatform2", "Fake Platform2", resourceType);
+ platform2.setUuid("" + new Random().nextInt());
em.persist(platform2);
MeasurementDefinition md = new MeasurementDefinition(resourceType, "Heiko");
diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/operation/OperationHistoryTest.java b/modules/core/domain/src/test/java/org/rhq/core/domain/operation/OperationHistoryTest.java
index bd2dff3..df93193 100644
--- a/modules/core/domain/src/test/java/org/rhq/core/domain/operation/OperationHistoryTest.java
+++ b/modules/core/domain/src/test/java/org/rhq/core/domain/operation/OperationHistoryTest.java
@@ -1,27 +1,29 @@
- /*
- * RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
package org.rhq.core.domain.operation;
+import java.util.Random;
+
import javax.persistence.EntityManager;
import javax.persistence.EntityNotFoundException;
import javax.persistence.Query;
@@ -316,6 +318,7 @@ public class OperationHistoryTest extends AbstractEJB3Test {
em.persist(resourceType);
resource = new Resource("key" + System.currentTimeMillis(), "name", resourceType);
+ resource.setUuid("" + new Random().nextInt());
em.persist(resource);
ResourceGroup group = new ResourceGroup("testgroup" + System.currentTimeMillis(), resourceType);
diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/ProblemResourceTest.java b/modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/ProblemResourceTest.java
index 8c75b8d..55f8552 100644
--- a/modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/ProblemResourceTest.java
+++ b/modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/ProblemResourceTest.java
@@ -23,6 +23,7 @@
package org.rhq.core.domain.resource.test;
import java.util.List;
+import java.util.Random;
import javax.persistence.EntityManager;
import javax.persistence.Query;
@@ -210,9 +211,11 @@ public class ProblemResourceTest extends AbstractEJB3Test {
platformType = new ResourceType("testplatPR", "p", ResourceCategory.PLATFORM, null);
em.persist(platformType);
platform = new Resource("platform1", "testProblemResources Platform One", platformType);
+ platform.setUuid("" + new Random().nextInt());
platform.setInventoryStatus(InventoryStatus.COMMITTED);
em.persist(platform);
platform2 = new Resource("platform2", "testProblemResources Platform Two", platformType);
+ platform2.setUuid("" + new Random().nextInt());
platform2.setInventoryStatus(InventoryStatus.COMMITTED);
em.persist(platform2);
diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/ResourceErrorTest.java b/modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/ResourceErrorTest.java
index 12f6455..8fdc2f7 100644
--- a/modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/ResourceErrorTest.java
+++ b/modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/ResourceErrorTest.java
@@ -1,28 +1,29 @@
- /*
- * RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
package org.rhq.core.domain.resource.test;
import java.util.List;
+import java.util.Random;
import javax.persistence.EntityManager;
import javax.persistence.Query;
@@ -157,6 +158,7 @@ public class ResourceErrorTest extends AbstractEJB3Test {
ResourceCategory.PLATFORM, null);
em.persist(resourceType);
resource = new Resource("key" + System.currentTimeMillis(), "name", resourceType);
+ resource.setUuid("" + new Random().nextInt());
em.persist(resource);
System.out.println("Created resource with id " + resource.getId());
} catch (Exception e) {
diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/ResourceGroupTest.java b/modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/ResourceGroupTest.java
index 4ccc21e..4ab3f4a 100644
--- a/modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/ResourceGroupTest.java
+++ b/modules/core/domain/src/test/java/org/rhq/core/domain/resource/test/ResourceGroupTest.java
@@ -1,31 +1,35 @@
- /*
- * RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
package org.rhq.core.domain.resource.test;
+import java.util.Random;
+
import javax.persistence.EntityManager;
+
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.ResourceType;
@@ -71,6 +75,7 @@ public class ResourceGroupTest extends AbstractEJB3Test {
em.persist(resourceType);
resource = new Resource("key" + System.currentTimeMillis(), "name", resourceType);
+ resource.setUuid("" + new Random().nextInt());
em.persist(resource);
ResourceGroup group = new ResourceGroup("testgroup" + System.currentTimeMillis(), resourceType);
diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/util/units/test/MeasurementConverterTest.java b/modules/core/domain/src/test/java/org/rhq/core/domain/util/units/test/MeasurementConverterTest.java
index 4f6a28f..0688c79 100644
--- a/modules/core/domain/src/test/java/org/rhq/core/domain/util/units/test/MeasurementConverterTest.java
+++ b/modules/core/domain/src/test/java/org/rhq/core/domain/util/units/test/MeasurementConverterTest.java
@@ -1,43 +1,45 @@
- /*
- * RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
package org.rhq.core.domain.util.units.test;
- import org.rhq.core.domain.measurement.MeasurementConverterClient;
- import org.rhq.core.domain.measurement.MeasurementUnits;
- import org.rhq.core.domain.measurement.composite.MeasurementNumericValueAndUnits;
- import org.rhq.core.domain.measurement.util.MeasurementConversionException;
- import org.rhq.core.domain.test.AbstractEJB3Test;
- import org.rhq.core.server.MeasurementParser;
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
- import org.testng.annotations.Test;
+import org.testng.annotations.Test;
- import java.text.DecimalFormat;
- import java.text.NumberFormat;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.Locale;
+import org.rhq.core.domain.measurement.MeasurementConverterClient;
+import org.rhq.core.domain.measurement.MeasurementUnits;
+import org.rhq.core.domain.measurement.composite.MeasurementNumericValueAndUnits;
+import org.rhq.core.domain.measurement.util.MeasurementConversionException;
+import org.rhq.core.domain.test.AbstractEJB3Test;
+import org.rhq.core.server.MeasurementParser;
- public class MeasurementConverterTest extends AbstractEJB3Test {
+// TODO two tests in here need to be re-enables once the GWT client issues are resolved
+@Test
+public class MeasurementConverterTest extends AbstractEJB3Test {
private final double POSITIVE = 300;
private final double NEGATIVE = -42;
@@ -57,7 +59,8 @@ package org.rhq.core.domain.util.units.test;
precisionScalingTestCount.set(precisionScalingTestCount.get() + 1);
}
- @Test(groups = "integration.ejb3")
+ @Test(groups = "integration.ejb3", enabled = false)
+ // TODO fix me
public void testPrecisionScaling() throws Exception {
// if all values are equal, it will format to the max precision
@@ -114,7 +117,8 @@ package org.rhq.core.domain.util.units.test;
}
}
- @Test(groups = "integration.ejb3")
+ @Test(groups = "integration.ejb3", enabled = false)
+ // TODO fix me
public void testConversionSuccess() throws Exception {
// test the straight-forward, non-whitespace cases
for (MeasurementUnits units : MeasurementUnits.values()) {
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/bundle/BundleManager.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/bundle/BundleManager.java
index 3bd4c8b..04b29a8 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/bundle/BundleManager.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/bundle/BundleManager.java
@@ -226,7 +226,7 @@ public class BundleManager extends AgentService implements BundleAgentService, B
}
if (packageVersion.getMD5() != null) {
- String realMD5 = MessageDigestGenerator.getDigestString(packageFile);
+ String realMD5 = new MessageDigestGenerator(MessageDigestGenerator.MD5).calcDigestString(packageFile);
if (!packageVersion.getMD5().equals(realMD5)) {
throw new Exception("Package version [" + packageVersion + "] failed MD5 check. expected=["
+ packageVersion.getMD5() + "], actual=[" + realMD5 + "]");
@@ -234,9 +234,7 @@ public class BundleManager extends AgentService implements BundleAgentService, B
} else if (packageVersion.getSHA256() != null) {
FileInputStream is = new FileInputStream(packageFile);
try {
- MessageDigestGenerator gen = new MessageDigestGenerator("SHA256");
- gen.add(is);
- String realSHA256 = gen.getDigestString();
+ String realSHA256 = new MessageDigestGenerator(MessageDigestGenerator.SHA_256).calcDigestString(is);
if (!packageVersion.getSHA256().equals(realSHA256)) {
throw new Exception("Package version [" + packageVersion + "] failed SHA256 check. expected=["
+ packageVersion.getSHA256() + "], actual=[" + realSHA256 + "]");
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
index b73cc65..b237969 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
@@ -53,9 +53,7 @@ import org.rhq.core.pc.util.FacetLockType;
import org.rhq.core.pc.util.LoggingThreadFactory;
import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
import org.rhq.core.pluginapi.configuration.ResourceConfigurationFacet;
-import org.rhq.core.system.SystemInfoFactory;
-
-import org.rhq.core.util.exception.WrappedRemotingException;
+import org.rhq.core.util.MessageDigestGenerator;
/**
* Manages configuration of all resources across all plugins.
@@ -191,7 +189,8 @@ public class ConfigurationManager extends AgentService implements ContainerServi
for (RawConfiguration rawConfig : configuration.getRawConfigurations()) {
String contents = rawConfig.getContents();
- rawConfig.setContents(contents);
+ String sha256 = new MessageDigestGenerator(MessageDigestGenerator.SHA_256).calcDigestString(contents);
+ rawConfig.setContents(contents, sha256);
structuredConfig.addRawConfiguration(rawConfig);
facet.mergeStructuredConfiguration(rawConfig, configuration);
}
@@ -221,7 +220,9 @@ public class ConfigurationManager extends AgentService implements ContainerServi
RawConfiguration mergedRaw = facet.mergeRawConfiguration(configuration, originalRaw);
if (mergedRaw != null) {
//TODO bypass validation of structured config for template values
- mergedRaw.setContents(mergedRaw.getContents());
+ String contents = mergedRaw.getContents();
+ String sha256 = new MessageDigestGenerator(MessageDigestGenerator.SHA_256).calcDigestString(contents);
+ mergedRaw.setContents(contents, sha256);
updateRawConfig(configuration, originalRaw, mergedRaw);
}
}
@@ -358,6 +359,6 @@ public class ConfigurationManager extends AgentService implements ContainerServi
}
}
}
- return success ? null: configuration;
+ return success ? null : configuration;
}
}
diff --git a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigManagementTest.java b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigManagementTest.java
index f55ca5a..f6bd049 100644
--- a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigManagementTest.java
+++ b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigManagementTest.java
@@ -23,6 +23,16 @@
package org.rhq.core.pc.configuration;
+import static org.rhq.test.AssertUtils.assertCollectionEqualsNoOrder;
+import static org.rhq.test.AssertUtils.assertPropertiesMatch;
+import static org.testng.Assert.assertEquals;
+
+import java.util.HashSet;
+import java.util.Random;
+import java.util.Set;
+
+import org.testng.annotations.BeforeMethod;
+
import org.rhq.core.clientapi.server.configuration.ConfigurationUpdateResponse;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
@@ -31,16 +41,8 @@ import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.pc.util.ComponentService;
import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
+import org.rhq.core.util.MessageDigestGenerator;
import org.rhq.test.JMockTest;
-import org.testng.annotations.BeforeMethod;
-
-import java.util.HashSet;
-import java.util.Random;
-import java.util.Set;
-
-import static org.rhq.test.AssertUtils.assertCollectionEqualsNoOrder;
-import static org.rhq.test.AssertUtils.assertPropertiesMatch;
-import static org.testng.Assert.assertEquals;
public class ConfigManagementTest extends JMockTest {
@@ -77,7 +79,9 @@ public class ConfigManagementTest extends JMockTest {
RawConfiguration createRawConfiguration(String path) {
RawConfiguration rawConfig = new RawConfiguration();
- rawConfig.setContents(new String(randomBytes()));
+ String contents = new String(randomBytes());
+ String sha256 = new MessageDigestGenerator(MessageDigestGenerator.SHA_256).calcDigestString(contents);
+ rawConfig.setContents(contents, sha256);
rawConfig.setPath(path);
return rawConfig;
@@ -98,25 +102,20 @@ public class ConfigManagementTest extends JMockTest {
}
void assertRawsLoaded(Set<RawConfiguration> expectedRaws, Configuration actualConfig) {
- assertCollectionEqualsNoOrder(
- expectedRaws,
- actualConfig.getRawConfigurations(),
- "The raw configs were not loaded correctly."
- );
+ assertCollectionEqualsNoOrder(expectedRaws, actualConfig.getRawConfigurations(),
+ "The raw configs were not loaded correctly.");
}
void assertStructuredLoaded(Configuration expectedConfig, Configuration actualConfig) {
- assertCollectionEqualsNoOrder(
- expectedConfig.getProperties(),
- actualConfig.getProperties(),
- "The structured configuration was not loaded correctly."
- );
+ assertCollectionEqualsNoOrder(expectedConfig.getProperties(), actualConfig.getProperties(),
+ "The structured configuration was not loaded correctly.");
}
void assertNotesSetToDefault(Configuration loadedConfig) {
String expectedNotes = "Resource config for " + resourceType.getName() + " Resource w/ id " + resourceId;
- assertEquals(loadedConfig.getNotes(), expectedNotes, "The notes property should be set to a default when it is not already initialized.");
+ assertEquals(loadedConfig.getNotes(), expectedNotes,
+ "The notes property should be set to a default when it is not already initialized.");
}
void assertConfigurationUpdateResponseMatches(ConfigurationUpdateResponse expected,
diff --git a/modules/core/util/src/main/java/org/rhq/core/util/MessageDigestGenerator.java b/modules/core/util/src/main/java/org/rhq/core/util/MessageDigestGenerator.java
index 794878f..a22eed3 100644
--- a/modules/core/util/src/main/java/org/rhq/core/util/MessageDigestGenerator.java
+++ b/modules/core/util/src/main/java/org/rhq/core/util/MessageDigestGenerator.java
@@ -1,25 +1,25 @@
- /*
- * RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
package org.rhq.core.util;
import java.io.BufferedInputStream;
@@ -35,8 +35,17 @@ import java.security.NoSuchAlgorithmException;
* An object that generates a message digest or hash for algorithms such as MD5 or SHA. This class is basically a
* wrapper around {@link java.security.MessageDigest} and provides convenience methods making it easier to generate
* hashes.
+ *
+ * There are static methods in here that use MD5 as the default algorithm. If you want to use another
+ * algorithm, instantiate an instance of this object and use its instance methods.
*/
public class MessageDigestGenerator {
+ /** you can pass this to the constructor to indicate you want to generate MD5 message digests */
+ public static final String MD5 = "MD5";
+
+ /** you can pass this to the constructor to indicate you want to generate SHA 256 message digests */
+ public static final String SHA_256 = "SHA-256";
+
private final MessageDigest messageDigest;
/**
@@ -48,7 +57,7 @@ public class MessageDigestGenerator {
* @throws IllegalStateException if the MD5 algorithm cannot be computed by the VM
*/
public MessageDigestGenerator() {
- this("MD5");
+ this(MD5);
}
/**
@@ -61,8 +70,7 @@ public class MessageDigestGenerator {
public MessageDigestGenerator(String algorithm) {
try {
messageDigest = MessageDigest.getInstance(algorithm);
- }
- catch (NoSuchAlgorithmException e) {
+ } catch (NoSuchAlgorithmException e) {
throw new IllegalStateException(algorithm + " is not a supported algorithm");
}
}
@@ -142,9 +150,13 @@ public class MessageDigestGenerator {
* @throws IOException if failed to read the stream for some reason
*/
public static byte[] getDigest(InputStream is) throws IOException {
- MessageDigestGenerator md5 = new MessageDigestGenerator();
- md5.add(is);
- return md5.getDigest();
+ MessageDigestGenerator md5 = new MessageDigestGenerator(MD5);
+ return md5.calcDigest(is);
+ }
+
+ public byte[] calcDigest(InputStream is) throws IOException {
+ add(is);
+ return getDigest();
}
/**
@@ -157,9 +169,13 @@ public class MessageDigestGenerator {
* @throws IOException if failed to read the stream for some reason
*/
public static String getDigestString(InputStream is) throws IOException {
- MessageDigestGenerator md5 = new MessageDigestGenerator();
- md5.add(is);
- return md5.getDigestString();
+ MessageDigestGenerator md5 = new MessageDigestGenerator(MD5);
+ return md5.calcDigestString(is);
+ }
+
+ public String calcDigestString(InputStream is) throws IOException {
+ add(is);
+ return getDigestString();
}
/**
@@ -172,9 +188,14 @@ public class MessageDigestGenerator {
* @throws RuntimeException if a system error occurred - should never really happen
*/
public static byte[] getDigest(String source_str) {
+ MessageDigestGenerator md5 = new MessageDigestGenerator(MD5);
+ return md5.calcDigest(source_str);
+ }
+
+ public byte[] calcDigest(String source_str) {
try {
ByteArrayInputStream bs = new ByteArrayInputStream(source_str.getBytes());
- return getDigest(bs);
+ return calcDigest(bs);
} catch (IOException e) {
throw new RuntimeException("IOException reading a byte array input stream, this should never happen", e);
}
@@ -188,7 +209,12 @@ public class MessageDigestGenerator {
* @return the string's digest or hash as a String
*/
public static String getDigestString(String source_str) {
- return calculateDigestStringFromBytes(getDigest(source_str));
+ MessageDigestGenerator md5 = new MessageDigestGenerator(MD5);
+ return md5.calcDigestString(source_str);
+ }
+
+ public String calcDigestString(String source_str) {
+ return calculateDigestStringFromBytes(calcDigest(source_str));
}
/**
@@ -201,11 +227,16 @@ public class MessageDigestGenerator {
* @throws IOException if the file could not be read or accessed
*/
public static byte[] getDigest(File file) throws IOException {
+ MessageDigestGenerator md5 = new MessageDigestGenerator(MD5);
+ return md5.calcDigest(file);
+ }
+
+ public byte[] calcDigest(File file) throws IOException {
FileInputStream is = null;
try {
is = new FileInputStream(file);
- return getDigest(new BufferedInputStream(is, 1024 * 32));
+ return calcDigest(new BufferedInputStream(is, 1024 * 32));
} finally {
if (is != null) {
is.close();
@@ -223,7 +254,12 @@ public class MessageDigestGenerator {
* @throws IOException if the file could not be read or accessed
*/
public static String getDigestString(File file) throws IOException {
- return calculateDigestStringFromBytes(getDigest(file));
+ MessageDigestGenerator md5 = new MessageDigestGenerator(MD5);
+ return md5.calcDigestString(file);
+ }
+
+ public String calcDigestString(File file) throws IOException {
+ return calculateDigestStringFromBytes(calcDigest(file));
}
/**
@@ -257,5 +293,7 @@ public class MessageDigestGenerator {
String file = args[0];
String digest = MessageDigestGenerator.getDigestString(new File(file));
System.out.println("MD5=" + digest);
+ digest = new MessageDigestGenerator(SHA_256).calcDigestString(new File(file));
+ System.out.println("SHA-256=" + digest);
}
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java
index b5d9c14..0be2147 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java
@@ -18,14 +18,28 @@
*/
package org.rhq.enterprise.gui.configuration.resource;
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.TreeMap;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.event.ValueChangeEvent;
+import javax.servlet.http.HttpServletResponse;
+
import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.seam.annotations.Create;
-import org.jboss.seam.annotations.Out;
import org.jetbrains.annotations.Nullable;
+import org.richfaces.model.UploadItem;
+
+import org.jboss.seam.annotations.Create;
-import org.rhq.core.clientapi.agent.configuration.ConfigurationValidationException;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.configuration.AbstractResourceConfigurationUpdate;
import org.rhq.core.domain.configuration.Configuration;
@@ -35,26 +49,12 @@ import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.configuration.definition.ConfigurationFormat;
import org.rhq.core.gui.configuration.ConfigurationMaskingUtility;
import org.rhq.core.gui.util.FacesContextUtility;
+import org.rhq.core.util.MessageDigestGenerator;
import org.rhq.enterprise.gui.common.upload.FileUploadUIBean;
import org.rhq.enterprise.gui.configuration.AbstractConfigurationUIBean;
import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
-import org.richfaces.model.UploadItem;
-
-import javax.ejb.EJBException;
-import javax.faces.application.FacesMessage;
-import javax.faces.event.ValueChangeEvent;
-import javax.servlet.http.HttpServletResponse;
-import java.io.File;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.TreeMap;
// This class is temporarily decleared in components.xml since it is declared under two names - ViewUIBean and
// UIBean. This class is undergoing some refactoring and part of that will include declaring the @Name and @Scope
@@ -73,7 +73,7 @@ public class ExistingResourceConfigurationUIBean extends AbstractConfigurationUI
// @Out
private Collection<RawConfigDirectory> rawConfigDirectories;
-// @Out
+ // @Out
private FileUploadUIBean fileUploader = new FileUploadUIBean();
private String modalEditorContents;
@@ -208,7 +208,7 @@ public class ExistingResourceConfigurationUIBean extends AbstractConfigurationUI
Configuration mergedConfiguration = null;
ConfigurationMaskingUtility.unmaskConfiguration(getConfiguration(), getConfigurationDefinition());
int resourceId = EnterpriseFacesContextUtility.getResource().getId();
-
+
mergedConfiguration = getMergedConfiguration();
AbstractResourceConfigurationUpdate updateRequest = this.configurationManager
.updateStructuredOrRawConfiguration(EnterpriseFacesContextUtility.getSubject(), resourceId,
@@ -357,7 +357,8 @@ public class ExistingResourceConfigurationUIBean extends AbstractConfigurationUI
} else {
current = new RawConfiguration();
current.setPath("/dev/null");
- current.setContents("");
+ String sha256 = new MessageDigestGenerator(MessageDigestGenerator.SHA_256).calcDigestString("");
+ current.setContents("", sha256);
}
}
return current;
@@ -493,7 +494,8 @@ public class ExistingResourceConfigurationUIBean extends AbstractConfigurationUI
String original = new String(getCurrent().getContents());
if (!updated.equals(original)) {
current = current.deepCopy(false);
- current.setContents(updated);
+ String sha256 = new MessageDigestGenerator(MessageDigestGenerator.SHA_256).calcDigestString(updated);
+ current.setContents(updated, sha256);
markCurrentRawConfigUIBeanModified();
getModified().put(current.getPath(), current);
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
index 68a7887..3f1532c 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
@@ -23,12 +23,13 @@
package org.rhq.enterprise.gui.configuration.resource;
+import java.io.File;
+
import org.jboss.seam.core.Events;
+
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.RawConfiguration;
-
-import javax.faces.component.NamingContainer;
-import java.io.File;
+import org.rhq.core.util.MessageDigestGenerator;
public class RawConfigUIBean {
@@ -58,7 +59,8 @@ public class RawConfigUIBean {
public void setContents(String contents) {
Configuration configuration = rawConfiguration.getConfiguration();
configuration.removeRawConfiguration(rawConfiguration);
- rawConfiguration.setContents(contents);
+ String sha256 = new MessageDigestGenerator(MessageDigestGenerator.SHA_256).calcDigestString(contents);
+ rawConfiguration.setContents(contents, sha256);
configuration.addRawConfiguration(rawConfiguration);
fireRawConfigUpdateEvent();
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index 6f177c7..732f4a3 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -383,13 +383,12 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
if (liveConfig.getRawConfigurations() != null) {
for (RawConfiguration raw : liveConfig.getRawConfigurations()) {
- MessageDigestGenerator sha256Generator = new MessageDigestGenerator("SHA-256");
+ MessageDigestGenerator sha256Generator = new MessageDigestGenerator(MessageDigestGenerator.SHA_256);
sha256Generator.add(raw.getContents().getBytes());
raw.setSha256(sha256Generator.getDigestString());
}
}
-
/*
* NOTE: We pass the overlord, since this is a system side-effect. here, the system
* and *not* the user, is choosing to persist the most recent configuration because it was different
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/alert/test/AlertManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/alert/test/AlertManagerBeanTest.java
index 965cbb9..3d6ab03 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/alert/test/AlertManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/alert/test/AlertManagerBeanTest.java
@@ -18,6 +18,8 @@
*/
package org.rhq.enterprise.server.alert.test;
+import java.util.Random;
+
import javax.persistence.EntityManager;
import org.testng.annotations.AfterMethod;
@@ -90,6 +92,7 @@ public class AlertManagerBeanTest extends AbstractEJB3Test {
resource = new Resource("reskey" + now, "resname", resourceType);
resource.setAgent(agent);
+ resource.setUuid("" + new Random().nextInt());
em.persist(resource);
AlertDefinition ad = new AlertDefinition();
@@ -112,7 +115,7 @@ public class AlertManagerBeanTest extends AbstractEJB3Test {
Alert a = new Alert(ad, now);
em.persist(a);
- AlertNotificationLog anl = new AlertNotificationLog(a,"dummy");
+ AlertNotificationLog anl = new AlertNotificationLog(a, "dummy");
em.persist(anl);
} catch (Exception e) {
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java
index ed6f88d..84a7bc1 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java
@@ -23,7 +23,6 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Collection;
import javax.persistence.EntityManager;
@@ -39,6 +38,7 @@ import org.rhq.core.clientapi.agent.configuration.ConfigurationUpdateRequest;
import org.rhq.core.clientapi.agent.discovery.DiscoveryAgentService;
import org.rhq.core.clientapi.agent.discovery.InvalidPluginConfigurationClientException;
import org.rhq.core.clientapi.server.configuration.ConfigurationUpdateResponse;
+import org.rhq.core.clientapi.server.discovery.InventoryReport;
import org.rhq.core.communications.command.annotation.Asynchronous;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.configuration.Configuration;
@@ -46,10 +46,8 @@ import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
import org.rhq.core.domain.configuration.PluginConfigurationUpdate;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
-import org.rhq.core.domain.configuration.RawConfiguration;
import org.rhq.core.domain.configuration.group.GroupPluginConfigurationUpdate;
import org.rhq.core.domain.discovery.AvailabilityReport;
-import org.rhq.core.clientapi.server.discovery.InventoryReport;
import org.rhq.core.domain.discovery.MergeResourceResponse;
import org.rhq.core.domain.discovery.ResourceSyncInfo;
import org.rhq.core.domain.measurement.Availability;
@@ -59,6 +57,7 @@ import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageOrdering;
+import org.rhq.core.util.exception.ThrowableUtil;
import org.rhq.enterprise.server.authz.PermissionException;
import org.rhq.enterprise.server.resource.ResourceManagerLocal;
import org.rhq.enterprise.server.test.AbstractEJB3Test;
@@ -942,7 +941,7 @@ public class ConfigurationManagerBeanTest extends AbstractEJB3Test {
void delete(Configuration configuration) {
EntityManager entityMgr = getEntityManager();
Configuration managedConfig = entityMgr.find(Configuration.class, configuration.getId());
- entityMgr.remove(managedConfig);
+ entityMgr.remove(managedConfig);
}
private class TestServices implements ConfigurationAgentService, DiscoveryAgentService {
@@ -989,7 +988,8 @@ public class ConfigurationManagerBeanTest extends AbstractEJB3Test {
response = new ConfigurationUpdateResponse(request.getConfigurationUpdateId(), null,
ConfigurationUpdateStatus.SUCCESS, null);
} else {
- mybool.setErrorMessageFromThrowable(new IllegalArgumentException("Not a valid boolean"));
+ mybool.setErrorMessage(ThrowableUtil.getStackAsString(new IllegalArgumentException(
+ "Not a valid boolean")));
response = new ConfigurationUpdateResponse(request.getConfigurationUpdateId(), request
.getConfiguration(), new NullPointerException("This simulates a failed update"));
}
@@ -1087,9 +1087,10 @@ public class ConfigurationManagerBeanTest extends AbstractEJB3Test {
@Asynchronous(guaranteedDelivery = true)
public void synchronizeInventory(ResourceSyncInfo syncInfo) {
}
- public Configuration validate(Configuration configuration, int resourceId, boolean isStructured)
+
+ public Configuration validate(Configuration configuration, int resourceId, boolean isStructured)
throws PluginContainerException {
- return null;
+ return null;
}
}
}
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/content/test/ContentManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/content/test/ContentManagerBeanTest.java
index a8e021c..6f75197 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/content/test/ContentManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/content/test/ContentManagerBeanTest.java
@@ -22,6 +22,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
+import java.util.Random;
import java.util.Set;
import javax.persistence.EntityManager;
@@ -35,10 +36,10 @@ import org.testng.annotations.Test;
import org.rhq.core.clientapi.agent.PluginContainerException;
import org.rhq.core.clientapi.agent.content.ContentAgentService;
-import org.rhq.core.domain.content.transfer.ContentResponseResult;
-import org.rhq.core.domain.content.transfer.DeployIndividualPackageResponse;
-import org.rhq.core.domain.content.transfer.RemoveIndividualPackageResponse;
-import org.rhq.core.domain.content.transfer.RemovePackagesResponse;
+import org.rhq.core.clientapi.server.content.ContentDiscoveryReport;
+import org.rhq.core.clientapi.server.content.DeletePackagesRequest;
+import org.rhq.core.clientapi.server.content.DeployPackagesRequest;
+import org.rhq.core.clientapi.server.content.RetrievePackageBitsRequest;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
@@ -55,13 +56,13 @@ import org.rhq.core.domain.content.PackageDetailsKey;
import org.rhq.core.domain.content.PackageInstallationStep;
import org.rhq.core.domain.content.PackageType;
import org.rhq.core.domain.content.PackageVersion;
-import org.rhq.core.clientapi.server.content.ContentDiscoveryReport;
-import org.rhq.core.clientapi.server.content.DeletePackagesRequest;
+import org.rhq.core.domain.content.transfer.ContentResponseResult;
+import org.rhq.core.domain.content.transfer.DeployIndividualPackageResponse;
import org.rhq.core.domain.content.transfer.DeployPackageStep;
-import org.rhq.core.clientapi.server.content.DeployPackagesRequest;
import org.rhq.core.domain.content.transfer.DeployPackagesResponse;
+import org.rhq.core.domain.content.transfer.RemoveIndividualPackageResponse;
+import org.rhq.core.domain.content.transfer.RemovePackagesResponse;
import org.rhq.core.domain.content.transfer.ResourcePackageDetails;
-import org.rhq.core.clientapi.server.content.RetrievePackageBitsRequest;
import org.rhq.core.domain.criteria.PackageVersionCriteria;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceCategory;
@@ -638,8 +639,7 @@ public class ContentManagerBeanTest extends AbstractEJB3Test {
// Add a few tests for the new Criteria Search feature
PackageVersionCriteria criteria = new PackageVersionCriteria();
criteria.addFilterResourceId(resource1.getId());
- PageList<PackageVersion> pageList = contentManager.findPackageVersionsByCriteria(overlord,
- criteria);
+ PageList<PackageVersion> pageList = contentManager.findPackageVersionsByCriteria(overlord, criteria);
assertNotNull(pageList);
ArrayList<PackageVersion> pvs = pageList.getValues();
assertEquals(2, pvs.size());
@@ -1480,6 +1480,7 @@ public class ContentManagerBeanTest extends AbstractEJB3Test {
// Create resource against which we'll merge the discovery report
resource1 = new Resource("parent" + System.currentTimeMillis(), "name", resourceType1);
+ resource1.setUuid("" + new Random().nextInt());
em.persist(resource1);
// Install packages on the resource
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/content/test/ContentSourceManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/content/test/ContentSourceManagerBeanTest.java
index ef435fc..626a259 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/content/test/ContentSourceManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/content/test/ContentSourceManagerBeanTest.java
@@ -23,6 +23,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Random;
import java.util.Set;
import javax.persistence.EntityManager;
@@ -1034,6 +1035,7 @@ public class ContentSourceManagerBeanTest extends AbstractEJB3Test {
// Create resource against which we'll merge the discovery report
resource1 = new Resource("parent" + System.currentTimeMillis(), "name", resourceType1);
+ resource1.setUuid("" + new Random().nextInt());
em.persist(resource1);
// Install packages on the resource
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/content/test/ContentUIManagerBeanEligiblePackagesTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/content/test/ContentUIManagerBeanEligiblePackagesTest.java
index 3c205f4..c74ea86 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/content/test/ContentUIManagerBeanEligiblePackagesTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/content/test/ContentUIManagerBeanEligiblePackagesTest.java
@@ -18,6 +18,8 @@
*/
package org.rhq.enterprise.server.content.test;
+import java.util.Random;
+
import javax.persistence.EntityManager;
import javax.persistence.Query;
@@ -153,6 +155,7 @@ public class ContentUIManagerBeanEligiblePackagesTest extends AbstractEJB3Test {
// Create resource against which we'll be retrieving packages
resource = new Resource("parent" + System.currentTimeMillis(), "name", resourceType);
+ resource.setUuid("" + new Random().nextInt());
resource.setVersion("1.0");
em.persist(resource);
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/discovery/test/DiscoveryBossBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/discovery/test/DiscoveryBossBeanTest.java
index 3c55c36..930ec84 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/discovery/test/DiscoveryBossBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/discovery/test/DiscoveryBossBeanTest.java
@@ -22,12 +22,16 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+import java.util.Random;
+
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
import javax.persistence.EntityManager;
+
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
+
import org.jboss.mx.util.MBeanServerLocator;
import org.rhq.core.clientapi.server.discovery.InventoryReport;
@@ -91,6 +95,11 @@ public class DiscoveryBossBeanTest extends AbstractEJB3Test {
server.addChildResource(service1);
server.addChildResource(service2);
+ platform.setUuid("" + new Random().nextInt());
+ server.setUuid("" + new Random().nextInt());
+ service1.setUuid("" + new Random().nextInt());
+ service2.setUuid("" + new Random().nextInt());
+
inventoryReport.addAddedRoot(platform);
ResourceSyncInfo syncInfo = discoveryBoss.mergeInventoryReport(serialize(inventoryReport));
@@ -112,6 +121,7 @@ public class DiscoveryBossBeanTest extends AbstractEJB3Test {
// First just submit the platform
InventoryReport inventoryReport = new InventoryReport(agent);
Resource platform = new Resource("alpha", "platform", platformType);
+ platform.setUuid("" + new Random().nextInt());
inventoryReport.addAddedRoot(platform);
ResourceSyncInfo syncInfo = discoveryBoss.mergeInventoryReport(serialize(inventoryReport));
assert syncInfo != null;
@@ -127,6 +137,10 @@ public class DiscoveryBossBeanTest extends AbstractEJB3Test {
server.addChildResource(service1);
server.addChildResource(service2);
+ server.setUuid("" + new Random().nextInt());
+ service1.setUuid("" + new Random().nextInt());
+ service2.setUuid("" + new Random().nextInt());
+
inventoryReport.addAddedRoot(server);
syncInfo = discoveryBoss.mergeInventoryReport(serialize(inventoryReport));
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/event/test/EventManagerTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/event/test/EventManagerTest.java
index 7f98751..c96ff3d 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/event/test/EventManagerTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/event/test/EventManagerTest.java
@@ -22,6 +22,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Random;
import java.util.Set;
import javax.persistence.EntityManager;
@@ -176,6 +177,7 @@ public class EventManagerTest extends AbstractEJB3Test {
ResourceType resourceType = new ResourceType("fake platform", "fake plugin", ResourceCategory.PLATFORM, null);
em.persist(resourceType);
Resource platform = new Resource("org.jboss.on.TestPlatform", "Fake Platform", resourceType);
+ platform.setUuid("" + new Random().nextInt());
em.persist(platform);
em.flush();
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java
index 01a0abb..1628b5f 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java
@@ -22,6 +22,7 @@ import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
+import java.util.Random;
import javax.persistence.EntityManager;
import javax.persistence.Query;
@@ -1058,6 +1059,7 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
em.persist(theResourceType);
theResource = new Resource("test-platform-key", "test-platform-name", theResourceType);
+ theResource.setUuid("" + new Random().nextInt());
theResource.setAgent(theAgent);
em.persist(theResource);
@@ -1079,6 +1081,7 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
newResource = new Resource("test-platform-key-" + uniqueNumber, "test-platform-name-" + uniqueNumber,
theResourceType);
+ newResource.setUuid("" + new Random().nextInt());
newResource.setAgent(theAgent);
parentResource.addChildResource(newResource);
em.persist(newResource);
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementBaselineManagerTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementBaselineManagerTest.java
index c1723cb..3bbb457 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementBaselineManagerTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementBaselineManagerTest.java
@@ -21,6 +21,7 @@ package org.rhq.enterprise.server.measurement.test;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
+import java.util.Random;
import javax.persistence.EntityManager;
import javax.persistence.Query;
@@ -403,10 +404,12 @@ public class MeasurementBaselineManagerTest extends AbstractEJB3Test {
em.persist(platformType);
platform = new Resource("platform1", "testAutoBaseline Platform One", platformType);
+ platform.setUuid("" + new Random().nextInt());
em.persist(platform);
platform.setAgent(agent);
platform2 = new Resource("platform2", "testAutoBaseline Platform Two", platformType);
+ platform2.setUuid("" + new Random().nextInt());
// deleteResource removes the agent, so we can't have two direct platforms for it, make one a child of the other
platform.addChildResource(platform2);
em.persist(platform2);
@@ -498,6 +501,7 @@ public class MeasurementBaselineManagerTest extends AbstractEJB3Test {
Resource root = null;
for (int r = 0; r < resourceCount; r++) {
Resource resource = new Resource(String.valueOf(r), "testAutoBaselineResource" + r, platformType);
+ resource.setUuid("" + new Random().nextInt());
if (root == null) {
root = resource;
} else {
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementViewManagerTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementViewManagerTest.java
index 480b889..bb7b9a2 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementViewManagerTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/MeasurementViewManagerTest.java
@@ -9,6 +9,7 @@ import javax.persistence.Query;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.measurement.MeasurementDefinition;
@@ -35,6 +36,7 @@ public class MeasurementViewManagerTest extends AbstractEJB3Test {
private Subject overlord;
+ @Test
public void testAll() {
// TODO: jmarques - write unit tests for MeasurementViewManager
}
@@ -61,6 +63,7 @@ public class MeasurementViewManagerTest extends AbstractEJB3Test {
resources = new ArrayList<Resource>();
for (int i = 0; i < SIZE; i++) {
Resource resource = new Resource(prefix + "key " + i, prefix + "key " + i, type);
+ resource.setUuid(resource.getResourceKey());
resources.add(resource);
em.persist(resource);
}
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/operation/OperationManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/operation/OperationManagerBeanTest.java
index 44e4c4f..d7c97ed 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/operation/OperationManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/operation/OperationManagerBeanTest.java
@@ -20,6 +20,7 @@ package org.rhq.enterprise.server.operation;
import java.util.Date;
import java.util.List;
+import java.util.Random;
import javax.ejb.EJBException;
import javax.persistence.EntityManager;
@@ -1598,6 +1599,7 @@ public class OperationManagerBeanTest extends AbstractEJB3Test {
em.flush();
resource = new Resource("reskey" + System.currentTimeMillis(), "resname", resourceType);
+ resource.setUuid("" + new Random().nextInt());
resource.setAgent(agent);
em.persist(resource);
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/group/test/RecursiveResourceGroupTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/group/test/RecursiveResourceGroupTest.java
index d2829cd..e4d60e4 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/group/test/RecursiveResourceGroupTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/group/test/RecursiveResourceGroupTest.java
@@ -21,6 +21,7 @@ package org.rhq.enterprise.server.resource.group.test;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import java.util.Random;
import javax.persistence.EntityManager;
@@ -94,6 +95,7 @@ public class RecursiveResourceGroupTest extends AbstractEJB3Test {
// test update implicit resources
Resource newChildOfNodeA = new Resource("new nodeOne child", "new nodeOne child", nodeA.getResourceType());
+ newChildOfNodeA.setUuid("" + new Random().nextInt());
resourceManager.createResource(subject, newChildOfNodeA, nodeA.getId()); // sets up implicit relationships
@@ -140,6 +142,7 @@ public class RecursiveResourceGroupTest extends AbstractEJB3Test {
// test update implicit resources
Resource gen5 = new Resource("g5", "g5", gen4.getResourceType());
+ gen5.setUuid("" + new Random().nextInt());
resourceManager.createResource(subject, gen5, gen4.getId()); // sets up implicit relationships
// confirm results
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdateEventsSubsystemTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdateEventsSubsystemTest.java
index c53c95f..550fd11 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdateEventsSubsystemTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdateEventsSubsystemTest.java
@@ -22,6 +22,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
+import java.util.Random;
import java.util.Set;
import javax.persistence.EntityManager;
@@ -152,6 +153,7 @@ public class UpdateEventsSubsystemTest extends UpdateSubsytemTestBase {
platform = getResourceType("events");
testResource = new Resource("-test-", "-test resource", platform);
+ testResource.setUuid("" + new Random().nextInt());
entityManager.persist(testResource);
setUpAgent(entityManager, testResource);
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdateMeasurementSubsystemTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdateMeasurementSubsystemTest.java
index 035968c..43d33fe 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdateMeasurementSubsystemTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdateMeasurementSubsystemTest.java
@@ -20,6 +20,7 @@ package org.rhq.enterprise.server.resource.metadata.test;
import java.util.Iterator;
import java.util.List;
+import java.util.Random;
import java.util.Set;
import javax.persistence.EntityManager;
@@ -185,6 +186,7 @@ public class UpdateMeasurementSubsystemTest extends UpdateSubsytemTestBase {
* Create a Fake Resource and a MeasurementSchedule
*/
Resource testResource = new Resource("-test-", "-test resource", server);
+ testResource.setUuid("" + new Random().nextInt());
entityManager.persist(testResource);
MeasurementSchedule sched = new MeasurementSchedule(definitions1.iterator().next(), testResource);
@@ -295,6 +297,7 @@ public class UpdateMeasurementSubsystemTest extends UpdateSubsytemTestBase {
* Create a Fake Resource and a MeasurementSchedule
*/
Resource testResource = new Resource("-test-", "-test resource", platform);
+ testResource.setUuid("" + new Random().nextInt());
entityManager.persist(testResource);
setUpAgent(entityManager, testResource);
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/test/ResourceFactoryManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/test/ResourceFactoryManagerBeanTest.java
index f2967fc..a93f3ca 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/test/ResourceFactoryManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/test/ResourceFactoryManagerBeanTest.java
@@ -21,6 +21,7 @@ package org.rhq.enterprise.server.resource.test;
import java.io.InputStream;
import java.net.URL;
import java.util.List;
+import java.util.Random;
import java.util.Set;
import javax.persistence.EntityManager;
@@ -449,6 +450,7 @@ public class ResourceFactoryManagerBeanTest extends AbstractEJB3Test {
// Create parent resource off of which to hang created resources
parentResource = new Resource("parent" + System.currentTimeMillis(), "name", parentResourceType);
+ parentResource.setUuid("" + new Random().nextInt());
em.persist(parentResource);
} catch (Exception e) {
System.out.println(e);
@@ -512,6 +514,7 @@ public class ResourceFactoryManagerBeanTest extends AbstractEJB3Test {
try {
try {
resource = new Resource("child" + System.currentTimeMillis(), "name", parentResourceType);
+ resource.setUuid("" + new Random().nextInt());
resource.setParentResource(parentResource);
resource.setInventoryStatus(InventoryStatus.COMMITTED);
em.persist(resource);
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/test/ResourceManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/test/ResourceManagerBeanTest.java
index f4a49d0..7400a9b 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/test/ResourceManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/test/ResourceManagerBeanTest.java
@@ -19,6 +19,7 @@
package org.rhq.enterprise.server.resource.test;
import java.util.List;
+import java.util.Random;
import javax.persistence.EntityManager;
@@ -139,6 +140,7 @@ public class ResourceManagerBeanTest extends UpdateSubsytemTestBase {
em.flush();
resource = new Resource("reskey" + System.currentTimeMillis(), "resname", resourceType);
+ resource.setUuid("" + new Random().nextInt());
resource.setAgent(agent);
em.persist(resource);
} catch (Exception e) {
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/scheduler/jobs/DataPurgeJobTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/scheduler/jobs/DataPurgeJobTest.java
index 54aed90..3de6865 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/scheduler/jobs/DataPurgeJobTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/scheduler/jobs/DataPurgeJobTest.java
@@ -24,6 +24,7 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Random;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -423,7 +424,7 @@ public class DataPurgeJobTest extends AbstractEJB3Test {
Alert a = new Alert(ad, timestamp);
em.persist(a);
- AlertNotificationLog anl = new AlertNotificationLog(a,"dummy");
+ AlertNotificationLog anl = new AlertNotificationLog(a, "dummy");
em.persist(anl);
AlertCondition ac = ad.getConditions().iterator().next();
@@ -454,6 +455,7 @@ public class DataPurgeJobTest extends AbstractEJB3Test {
em.flush();
resource = new Resource("reskey" + now, "resname", resourceType);
+ resource.setUuid("" + new Random().nextInt());
resource.setAgent(agent);
em.persist(resource);
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/ResourceTreeHelper.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/ResourceTreeHelper.java
index 91420e1..49a514b 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/ResourceTreeHelper.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/ResourceTreeHelper.java
@@ -23,6 +23,7 @@ import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import java.util.Random;
import javax.persistence.EntityManager;
@@ -95,6 +96,7 @@ public class ResourceTreeHelper {
parentResource = resources.get(parent);
} else {
parentResource = new Resource(parent, parent, fakeType);
+ parentResource.setUuid("" + new Random().nextInt());
resources.put(parent, parentResource);
}
@@ -107,6 +109,7 @@ public class ResourceTreeHelper {
childResource = resources.get(child);
} else {
childResource = new Resource(child, child, fakeType);
+ childResource.setUuid("" + new Random().nextInt());
resources.put(child, childResource);
}
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/SessionTestHelper.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/SessionTestHelper.java
index 61b012f..45412c4 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/SessionTestHelper.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/SessionTestHelper.java
@@ -21,6 +21,7 @@ package org.rhq.enterprise.server.util;
import java.util.ArrayList;
import java.util.Collection;
import java.util.EnumSet;
+import java.util.Random;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
@@ -173,6 +174,7 @@ public class SessionTestHelper {
resourceName = preprocess(resourceName);
Resource resource = new Resource(resourceName, resourceName, type);
+ resource.setUuid("" + new Random().nextInt());
group.addExplicitResource(resource);
resource.getExplicitGroups().add(group);
@@ -207,6 +209,7 @@ public class SessionTestHelper {
resourceName = preprocess(resourceName);
ResourceType type = new ResourceType(preprocess("testType"), "testPlugin", ResourceCategory.PLATFORM, null);
Resource resource = new Resource(resourceName, resourceName, type);
+ resource.setUuid("" + new Random().nextInt());
em.persist(type);
em.persist(resource);
diff --git a/modules/plugins/apache/src/test/java/org/rhq/plugins/apache/ApachePluginTest.java b/modules/plugins/apache/src/test/java/org/rhq/plugins/apache/ApachePluginTest.java
index 0d1b7be..a1a42c1 100644
--- a/modules/plugins/apache/src/test/java/org/rhq/plugins/apache/ApachePluginTest.java
+++ b/modules/plugins/apache/src/test/java/org/rhq/plugins/apache/ApachePluginTest.java
@@ -24,6 +24,7 @@ import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.Test;
@@ -114,7 +115,8 @@ public class ApachePluginTest {
}
}
- @Test(dependsOnMethods = "testServiceDiscovery")
+ @Test(dependsOnMethods = "testServiceDiscovery", enabled = false)
+ // TODO: this is not a unit test - it requires an apache server to be running with snmp enabled
public void testMeasurementComponent() throws Exception {
Resource platform = PluginContainer.getInstance().getInventoryManager().getPlatform();
for (Resource server : platform.getChildResources()) {
diff --git a/modules/plugins/augeas/src/main/java/org/rhq/plugins/augeas/helper/AugeasRawConfigHelper.java b/modules/plugins/augeas/src/main/java/org/rhq/plugins/augeas/helper/AugeasRawConfigHelper.java
index dd900cf..4d42e0d 100644
--- a/modules/plugins/augeas/src/main/java/org/rhq/plugins/augeas/helper/AugeasRawConfigHelper.java
+++ b/modules/plugins/augeas/src/main/java/org/rhq/plugins/augeas/helper/AugeasRawConfigHelper.java
@@ -33,6 +33,7 @@ import org.apache.commons.io.FileUtils;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.Property;
import org.rhq.core.domain.configuration.RawConfiguration;
+import org.rhq.core.util.MessageDigestGenerator;
/**
* @author paji
@@ -82,7 +83,9 @@ public class AugeasRawConfigHelper {
aug.save();
toUpdate.setPath(existingConfig.getPath());
- toUpdate.setContents(FileUtils.readFileToString(new File(file)));
+ String contents = FileUtils.readFileToString(new File(file));
+ String sha256 = new MessageDigestGenerator(MessageDigestGenerator.SHA_256).calcDigestString(contents);
+ toUpdate.setContents(contents, sha256);
} finally {
if (aug != null) {
aug.close();
diff --git a/modules/plugins/cobbler/src/main/java/org/rhq/plugins/cobbler/CobblerComponent.java b/modules/plugins/cobbler/src/main/java/org/rhq/plugins/cobbler/CobblerComponent.java
index 3e80c01..97f52cb 100644
--- a/modules/plugins/cobbler/src/main/java/org/rhq/plugins/cobbler/CobblerComponent.java
+++ b/modules/plugins/cobbler/src/main/java/org/rhq/plugins/cobbler/CobblerComponent.java
@@ -37,6 +37,7 @@ import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.pluginapi.configuration.ResourceConfigurationFacet;
import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.core.util.MessageDigestGenerator;
import org.rhq.plugins.augeas.AugeasConfigurationComponent;
import org.rhq.plugins.augeas.helper.AugeasNode;
import org.rhq.plugins.augeas.helper.AugeasRawConfigHelper;
@@ -123,12 +124,16 @@ public class CobblerComponent extends AugeasConfigurationComponent implements Au
Set<RawConfiguration> configs = new HashSet<RawConfiguration>();
RawConfiguration modules = new RawConfiguration();
modules.setPath(MODULES_PATH);
- modules.setContents(FileUtils.readFileToString(new File(MODULES_PATH)));
+ String contents = FileUtils.readFileToString(new File(MODULES_PATH));
+ String sha256 = new MessageDigestGenerator(MessageDigestGenerator.SHA_256).calcDigestString(contents);
+ modules.setContents(contents, sha256);
configs.add(modules);
RawConfiguration settings = new RawConfiguration();
settings.setPath(SETTINGS_PATH);
- settings.setContents(FileUtils.readFileToString(new File(SETTINGS_PATH)));
+ contents = FileUtils.readFileToString(new File(SETTINGS_PATH));
+ sha256 = new MessageDigestGenerator(MessageDigestGenerator.SHA_256).calcDigestString(contents);
+ settings.setContents(contents, sha256);
configs.add(settings);
return configs;
} catch (Exception e) {
diff --git a/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/MBeanResourceComponent.java b/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/MBeanResourceComponent.java
index 0e93097..33a64db 100644
--- a/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/MBeanResourceComponent.java
+++ b/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/MBeanResourceComponent.java
@@ -65,6 +65,7 @@ import org.rhq.core.pluginapi.inventory.ResourceContext;
import org.rhq.core.pluginapi.measurement.MeasurementFacet;
import org.rhq.core.pluginapi.operation.OperationFacet;
import org.rhq.core.pluginapi.operation.OperationResult;
+import org.rhq.core.util.exception.ThrowableUtil;
/**
* A generic JMX MBean resource component that can be used to manage a JMX MBean. The resource's plugin configuration
@@ -493,7 +494,7 @@ public class MBeanResourceComponent<T extends JMXComponent> implements Measureme
}
}
} catch (Exception e) {
- property.setErrorMessageFromThrowable(e);
+ property.setErrorMessage(ThrowableUtil.getStackAsString(e));
report
.setErrorMessage("Failed setting resource configuration - see property error messages for details");
log.info("Failure setting MBean Resource configuration value", e);
diff --git a/modules/plugins/nss/src/main/java/org/rhq/plugin/nss/NameServiceSwitchComponent.java b/modules/plugins/nss/src/main/java/org/rhq/plugin/nss/NameServiceSwitchComponent.java
index b1dbcc6..830c648 100644
--- a/modules/plugins/nss/src/main/java/org/rhq/plugin/nss/NameServiceSwitchComponent.java
+++ b/modules/plugins/nss/src/main/java/org/rhq/plugin/nss/NameServiceSwitchComponent.java
@@ -43,6 +43,7 @@ import org.rhq.core.pluginapi.inventory.ResourceComponent;
import org.rhq.core.pluginapi.inventory.ResourceContext;
import org.rhq.core.pluginapi.operation.OperationFacet;
import org.rhq.core.pluginapi.operation.OperationResult;
+import org.rhq.core.util.MessageDigestGenerator;
/**
* Allows the RHQ server to manage the Name Server Switch Configuration for a Linux Platform
@@ -180,7 +181,9 @@ public class NameServiceSwitchComponent implements ResourceComponent<NameService
raw.setPath(ETC_NSSWITCH_CONF);
- raw.setContents(getContents(new File(raw.getPath())));
+ String contents = getContents(new File(raw.getPath()));
+ String sha256 = new MessageDigestGenerator(MessageDigestGenerator.SHA_256).calcDigestString(contents);
+ raw.setContents(contents, sha256);
raws.add(raw);
return raws;
diff --git a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatGroupComponent.java b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatGroupComponent.java
index 1d70f43..89b2ce2 100644
--- a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatGroupComponent.java
+++ b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatGroupComponent.java
@@ -28,12 +28,14 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.mc4j.ems.connection.bean.attribute.EmsAttribute;
+
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
import org.rhq.core.pluginapi.inventory.DeleteResourceFacet;
import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.core.util.exception.ThrowableUtil;
import org.rhq.plugins.jmx.MBeanResourceComponent;
/**
@@ -41,7 +43,8 @@ import org.rhq.plugins.jmx.MBeanResourceComponent;
*
* @author Jay Shaughnessy
*/
-public class TomcatGroupComponent extends MBeanResourceComponent<TomcatUserDatabaseComponent> implements DeleteResourceFacet {
+public class TomcatGroupComponent extends MBeanResourceComponent<TomcatUserDatabaseComponent> implements
+ DeleteResourceFacet {
public static final String CONFIG_DESCRIPTION = "description";
public static final String CONFIG_GROUP_NAME = "groupname";
@@ -116,7 +119,7 @@ public class TomcatGroupComponent extends MBeanResourceComponent<TomcatUserDatab
try {
consolidateSettings(newRoles, currentRoles, "addRole", "removeRole", "role");
} catch (Exception e) {
- newRoles.setErrorMessageFromThrowable(e);
+ newRoles.setErrorMessage(ThrowableUtil.getStackAsString(e));
report.setErrorMessage("Failed setting resource configuration - see property error messages for details");
log.info("Failure setting Tomcat User Roles configuration value", e);
return;
@@ -131,7 +134,8 @@ public class TomcatGroupComponent extends MBeanResourceComponent<TomcatUserDatab
}
}
- private void consolidateSettings(PropertySimple newVals, PropertySimple currentVals, String addOp, String removeOp, String arg) throws Exception {
+ private void consolidateSettings(PropertySimple newVals, PropertySimple currentVals, String addOp, String removeOp,
+ String arg) throws Exception {
// add new values not in the current settings
String currentValsLongString = currentVals.getStringValue();
@@ -149,7 +153,8 @@ public class TomcatGroupComponent extends MBeanResourceComponent<TomcatUserDatab
try {
invokeOperation(addOp, opConfig);
} catch (Exception e) {
- throw new IllegalArgumentException("Could not add " + arg + "=" + newVal + ". Please check spelling/existence.");
+ throw new IllegalArgumentException("Could not add " + arg + "=" + newVal
+ + ". Please check spelling/existence.");
}
}
}
@@ -164,7 +169,8 @@ public class TomcatGroupComponent extends MBeanResourceComponent<TomcatUserDatab
try {
invokeOperation(removeOp, opConfig);
} catch (Exception e) {
- throw new IllegalArgumentException("Could not remove " + arg + "=" + currentVal + ". Please check spelling/existence.");
+ throw new IllegalArgumentException("Could not remove " + arg + "=" + currentVal
+ + ". Please check spelling/existence.");
}
}
}
diff --git a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatUserComponent.java b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatUserComponent.java
index a57b388..52efaac 100644
--- a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatUserComponent.java
+++ b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatUserComponent.java
@@ -28,12 +28,14 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.mc4j.ems.connection.bean.attribute.EmsAttribute;
+
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
import org.rhq.core.pluginapi.inventory.DeleteResourceFacet;
import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.core.util.exception.ThrowableUtil;
import org.rhq.plugins.jmx.MBeanResourceComponent;
/**
@@ -41,7 +43,8 @@ import org.rhq.plugins.jmx.MBeanResourceComponent;
*
* @author Jay Shaughnessy
*/
-public class TomcatUserComponent extends MBeanResourceComponent<TomcatUserDatabaseComponent> implements DeleteResourceFacet {
+public class TomcatUserComponent extends MBeanResourceComponent<TomcatUserDatabaseComponent> implements
+ DeleteResourceFacet {
public static final String CONFIG_FULL_NAME = "fullName";
public static final String CONFIG_GROUPS = "groups";
@@ -51,7 +54,8 @@ public class TomcatUserComponent extends MBeanResourceComponent<TomcatUserDataba
public static final String PLUGIN_CONFIG_NAME = "name";
public static final String RESOURCE_TYPE_NAME = "Tomcat User";
- private static final Pattern PATTERN_GROUP_NAME = Pattern.compile(TomcatGroupComponent.CONFIG_GROUP_NAME + "=\"(.*)\"");
+ private static final Pattern PATTERN_GROUP_NAME = Pattern.compile(TomcatGroupComponent.CONFIG_GROUP_NAME
+ + "=\"(.*)\"");
private static final Pattern PATTERN_ROLE_NAME = Pattern.compile(TomcatRoleComponent.CONFIG_ROLE_NAME + "=(.*),");
/**
@@ -123,9 +127,10 @@ public class TomcatUserComponent extends MBeanResourceComponent<TomcatUserDataba
// try updating the group settings
try {
- consolidateSettings(newGroups, currentGroups, "addGroup", "removeGroup", TomcatGroupComponent.CONFIG_GROUP_NAME);
+ consolidateSettings(newGroups, currentGroups, "addGroup", "removeGroup",
+ TomcatGroupComponent.CONFIG_GROUP_NAME);
} catch (Exception e) {
- newGroups.setErrorMessageFromThrowable(e);
+ newGroups.setErrorMessage(ThrowableUtil.getStackAsString(e));
report.setErrorMessage("Failed setting resource configuration - see property error messages for details");
log.info("Failure setting Tomcat User Groups configuration value", e);
return;
@@ -135,7 +140,7 @@ public class TomcatUserComponent extends MBeanResourceComponent<TomcatUserDataba
try {
consolidateSettings(newRoles, currentRoles, "addRole", "removeRole", "role");
} catch (Exception e) {
- newRoles.setErrorMessageFromThrowable(e);
+ newRoles.setErrorMessage(ThrowableUtil.getStackAsString(e));
report.setErrorMessage("Failed setting resource configuration - see property error messages for details");
log.info("Failure setting Tomcat User Roles configuration value", e);
return;
@@ -150,7 +155,8 @@ public class TomcatUserComponent extends MBeanResourceComponent<TomcatUserDataba
}
}
- private void consolidateSettings(PropertySimple newVals, PropertySimple currentVals, String addOp, String removeOp, String arg) throws Exception {
+ private void consolidateSettings(PropertySimple newVals, PropertySimple currentVals, String addOp, String removeOp,
+ String arg) throws Exception {
// add new values not in the current settings
String currentValsLongString = currentVals.getStringValue();
@@ -168,7 +174,8 @@ public class TomcatUserComponent extends MBeanResourceComponent<TomcatUserDataba
try {
invokeOperation(addOp, opConfig);
} catch (Exception e) {
- throw new IllegalArgumentException("Could not add " + arg + "=" + newVal + ". Please check spelling/existence.");
+ throw new IllegalArgumentException("Could not add " + arg + "=" + newVal
+ + ". Please check spelling/existence.");
}
}
}
@@ -183,7 +190,8 @@ public class TomcatUserComponent extends MBeanResourceComponent<TomcatUserDataba
try {
invokeOperation(removeOp, opConfig);
} catch (Exception e) {
- throw new IllegalArgumentException("Could not remove " + arg + "=" + currentVal + ". Please check spelling/existence.");
+ throw new IllegalArgumentException("Could not remove " + arg + "=" + currentVal
+ + ". Please check spelling/existence.");
}
}
}
diff --git a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatVHostComponent.java b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatVHostComponent.java
index 74ccb7d..e8d6e8b 100644
--- a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatVHostComponent.java
+++ b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatVHostComponent.java
@@ -54,6 +54,7 @@ import org.rhq.core.pluginapi.content.ContentServices;
import org.rhq.core.pluginapi.inventory.ApplicationServerComponent;
import org.rhq.core.pluginapi.inventory.CreateChildResourceFacet;
import org.rhq.core.pluginapi.inventory.CreateResourceReport;
+import org.rhq.core.util.exception.ThrowableUtil;
import org.rhq.plugins.jmx.MBeanResourceComponent;
/**
@@ -132,7 +133,7 @@ public class TomcatVHostComponent extends MBeanResourceComponent<TomcatServerCom
try {
consolidateSettings(newAliases, currentAliases, "addAlias", "removeAlias", "alias");
} catch (Exception e) {
- newAliases.setErrorMessageFromThrowable(e);
+ newAliases.setErrorMessage(ThrowableUtil.getStackAsString(e));
report.setErrorMessage("Failed setting resource configuration - see property error messages for details");
log.info("Failure setting Tomcat VHost aliases configuration value", e);
}
commit 6c4b785259bdd080d9cf46e20cd4bbae3f407b61
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Sun Mar 21 21:52:17 2010 -0400
fix this so the test passes again, this was a legit test failure
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/composite/FailoverListComposite.java b/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/composite/FailoverListComposite.java
index 46bc7c9..fe4510e 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/composite/FailoverListComposite.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/composite/FailoverListComposite.java
@@ -152,10 +152,11 @@ public class FailoverListComposite implements Iterator<FailoverListComposite.Ser
}
public void remove() {
- throw new UnsupportedOperationException(this.getClass().getName().substring(this.getClass().getName().lastIndexOf(".")+1) + " are immutable lists, removal is disallowed");
+ throw new UnsupportedOperationException(this.getClass().getName().substring(
+ this.getClass().getName().lastIndexOf(".") + 1)
+ + " are immutable lists, removal is disallowed");
}
-
/**
* Used to "serialize" this list in a human-readable form (useful for storing the list
* in a text file that humans can read and potentially edit).
@@ -182,13 +183,9 @@ public class FailoverListComposite implements Iterator<FailoverListComposite.Ser
public static FailoverListComposite readAsText(String text) {
List<ServerEntry> servers = new ArrayList<ServerEntry>();
- String[] failoverListArray = text.split(".");
- // TODO: GWT (Check to make sure this works)
- //StringTokenizer rowTokenizer = new StringTokenizer(text, "\n");
- //while (rowTokenizer.hasMoreTokens()) {
+ String[] failoverListArray = text.split("\n");
for (String row : failoverListArray) {
try {
- //String row = rowTokenizer.nextToken();
String[] addressPorts = row.split(":");
String[] ports = addressPorts[1].split("/");
servers.add(new ServerEntry(addressPorts[0], Integer.parseInt(ports[0]), Integer.parseInt(ports[1])));
@@ -199,34 +196,34 @@ public class FailoverListComposite implements Iterator<FailoverListComposite.Ser
return new FailoverListComposite(servers);
}
- /* TODO: GWT
- private void writeObject(ObjectOutputStream out) throws IOException {
- out.writeInt(size());
- for (ServerEntry entry : servers) {
- out.writeUTF(entry.address);
- out.writeInt(entry.port);
- out.writeInt(entry.securePort);
- }
- }
-
- private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
- int size = in.readInt();
-
- List<ServerEntry> entries = new ArrayList<ServerEntry>();
- for (int i = 0; i < size; i++) {
- String address = in.readUTF();
- int port = in.readInt();
- int securePort = in.readInt();
- entries.add(new ServerEntry(address, port, securePort));
- }
+ /* TODO: GWT
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.writeInt(size());
+ for (ServerEntry entry : servers) {
+ out.writeUTF(entry.address);
+ out.writeInt(entry.port);
+ out.writeInt(entry.securePort);
+ }
+ }
+
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ int size = in.readInt();
+
+ List<ServerEntry> entries = new ArrayList<ServerEntry>();
+ for (int i = 0; i < size; i++) {
+ String address = in.readUTF();
+ int port = in.readInt();
+ int securePort = in.readInt();
+ entries.add(new ServerEntry(address, port, securePort));
+ }
- *//*
- * no need to wrap 'entries' in a new list before putting them into the immutable wrapper;
- * as long as the 'entries' reference does not escape this method, we can be assured that
- * 'servers' is correctly immutable.
*//*
- servers = Collections.unmodifiableList(entries);
- }*/
+ * no need to wrap 'entries' in a new list before putting them into the immutable wrapper;
+ * as long as the 'entries' reference does not escape this method, we can be assured that
+ * 'servers' is correctly immutable.
+ *//*
+ servers = Collections.unmodifiableList(entries);
+ }*/
@Override
public String toString() {
commit 9ec7d86384c56c7e04a5e2df8834b01fb7c415bb
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Sun Mar 21 08:48:32 2010 -0400
use the new versionOrder column so we can create bundle versions in the proper ordering. this way we can determine which is the latest version of a bundle
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleVersion.java b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleVersion.java
index a3b01f4..3c74dfe 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleVersion.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleVersion.java
@@ -53,17 +53,21 @@ import org.rhq.core.domain.content.Distribution;
*/
@Entity
@NamedQueries( {
- @NamedQuery(name = BundleVersion.UPDATE_VERSION_ORDER, query = "UPDATE BundleVersion bv SET bv.versionOrder = (bv.versionOrder+1) WHERE bv.name = :name AND bv.versionOrder >= :versionOrder"), //
- @NamedQuery(name = BundleVersion.QUERY_FIND_LATEST_BY_NAME, query = "" //
+ @NamedQuery(name = BundleVersion.UPDATE_VERSION_ORDER_BY_BUNDLE_ID, query = "" //
+ + "UPDATE BundleVersion bv "//
+ + " SET bv.versionOrder = (bv.versionOrder+1) " //
+ + " WHERE bv.bundle.id = :bundleId " //
+ + " AND bv.versionOrder >= :versionOrder"), //
+ @NamedQuery(name = BundleVersion.QUERY_FIND_LATEST_BY_BUNDLE_ID, query = "" //
+ "SELECT bv " //
+ " FROM BundleVersion bv " //
- + " WHERE bv.name = :name " //
- + " AND bv.versionOrder = (SELECT MAX(bv2.versionOrder) FROM BundleVersion bv2 WHERE bv2.name = :name) "), //
+ + " WHERE bv.bundle.id = :bundleId " //
+ + " AND bv.versionOrder = (SELECT MAX(bv2.versionOrder) FROM BundleVersion bv2 WHERE bv2.bundle.id = :bundleId) "), //
// this returns a desc ordered list of a 2-D array - first element in array is the version string, second is its associated version order
- @NamedQuery(name = BundleVersion.QUERY_FIND_VERSIONS_BY_NAME, query = "" //
+ @NamedQuery(name = BundleVersion.QUERY_FIND_VERSION_INFO_BY_BUNDLE_ID, query = "" //
+ "SELECT bv.version, bv.versionOrder " //
+ " FROM BundleVersion bv " //
- + " WHERE bv.name = :name " //
+ + " WHERE bv.bundle.id = :bundleId " //
+ " ORDER BY bv.versionOrder DESC "), //
@NamedQuery(name = BundleVersion.QUERY_FIND_ALL, query = "SELECT bv FROM BundleVersion bv "), //
@NamedQuery(name = BundleVersion.QUERY_FIND_BY_NAME, query = "SELECT bv FROM BundleVersion bv WHERE bv.name = :name ") //
@@ -74,9 +78,9 @@ import org.rhq.core.domain.content.Distribution;
public class BundleVersion implements Serializable {
private static final long serialVersionUID = 1L;
- public static final String UPDATE_VERSION_ORDER = "BundleVersion.updateVersionOrder";
- public static final String QUERY_FIND_LATEST_BY_NAME = "BundleVersion.findLatestByName";
- public static final String QUERY_FIND_VERSIONS_BY_NAME = "BundleVersion.findVersionsByName";
+ public static final String UPDATE_VERSION_ORDER_BY_BUNDLE_ID = "BundleVersion.updateVersionOrderByBundleId";
+ public static final String QUERY_FIND_LATEST_BY_BUNDLE_ID = "BundleVersion.findLatestByBundleId";
+ public static final String QUERY_FIND_VERSION_INFO_BY_BUNDLE_ID = "BundleVersion.findVersionsByBundleId";
public static final String QUERY_FIND_ALL = "BundleVersion.findAll";
public static final String QUERY_FIND_BY_NAME = "BundleVersion.findByName";
diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/bundle/test/BundleTest.java b/modules/core/domain/src/test/java/org/rhq/core/domain/bundle/test/BundleTest.java
index 42ed4ab..2004766 100644
--- a/modules/core/domain/src/test/java/org/rhq/core/domain/bundle/test/BundleTest.java
+++ b/modules/core/domain/src/test/java/org/rhq/core/domain/bundle/test/BundleTest.java
@@ -243,9 +243,21 @@ public class BundleTest extends AbstractEJB3Test {
assert id > 0;
assert bundle.getBundleType().getId() != 0 : "bundleType should have been cascade persisted too";
+ // make sure these queries can return empty lists
+ Query q = em.createNamedQuery(BundleVersion.QUERY_FIND_LATEST_BY_BUNDLE_ID);
+ q.setParameter("bundleId", bundle.getId());
+ assert q.getResultList().size() == 0;
+ q = em.createNamedQuery(BundleVersion.QUERY_FIND_VERSION_INFO_BY_BUNDLE_ID);
+ q.setParameter("bundleId", bundle.getId());
+ assert q.getResultList().size() == 0;
+ q = em.createNamedQuery(BundleVersion.UPDATE_VERSION_ORDER_BY_BUNDLE_ID);
+ q.setParameter("bundleId", bundle.getId());
+ q.setParameter("versionOrder", 0);
+ assert q.executeUpdate() == 0 : "should not have updated anything";
+
BundleVersion bv = new BundleVersion(name, "1.0", bundle, recipe);
bv.setVersionOrder(0);
- Query q = em.createNamedQuery(BundleVersion.QUERY_FIND_BY_NAME);
+ q = em.createNamedQuery(BundleVersion.QUERY_FIND_BY_NAME);
q.setParameter("name", name);
assert q.getResultList().size() == 0; // not in the db yet
em.persist(bv);
@@ -261,12 +273,12 @@ public class BundleTest extends AbstractEJB3Test {
id = bv2.getId();
assert id > 0;
- q = em.createNamedQuery(BundleVersion.QUERY_FIND_LATEST_BY_NAME);
- q.setParameter("name", name);
+ q = em.createNamedQuery(BundleVersion.QUERY_FIND_LATEST_BY_BUNDLE_ID);
+ q.setParameter("bundleId", bundle.getId());
assert q.getResultList().size() == 1;
assert ((BundleVersion) q.getSingleResult()).getVersion().equals(bv2.getVersion());
- q = em.createNamedQuery(BundleVersion.QUERY_FIND_VERSIONS_BY_NAME);
- q.setParameter("name", name);
+ q = em.createNamedQuery(BundleVersion.QUERY_FIND_VERSION_INFO_BY_BUNDLE_ID);
+ q.setParameter("bundleId", bundle.getId());
List<Object[]> versionsArrays = q.getResultList(); // returns in DESC sort order!
assert versionsArrays.size() == 2;
assert ((String) versionsArrays.get(0)[0]).equals(bv2.getVersion());
@@ -275,8 +287,8 @@ public class BundleTest extends AbstractEJB3Test {
assert ((Number) versionsArrays.get(1)[1]).intValue() == bv.getVersionOrder();
// increment all version orders, starting at order #1
- q = em.createNamedQuery(BundleVersion.UPDATE_VERSION_ORDER);
- q.setParameter("name", name);
+ q = em.createNamedQuery(BundleVersion.UPDATE_VERSION_ORDER_BY_BUNDLE_ID);
+ q.setParameter("bundleId", bundle.getId());
q.setParameter("versionOrder", 1);
assert q.executeUpdate() == 1 : "should have auto-incremented version order in one row";
em.flush();
@@ -295,12 +307,12 @@ public class BundleTest extends AbstractEJB3Test {
id = bv3.getId();
assert id > 0;
- q = em.createNamedQuery(BundleVersion.QUERY_FIND_LATEST_BY_NAME);
- q.setParameter("name", name);
+ q = em.createNamedQuery(BundleVersion.QUERY_FIND_LATEST_BY_BUNDLE_ID);
+ q.setParameter("bundleId", bundle.getId());
assert q.getResultList().size() == 1;
assert ((BundleVersion) q.getSingleResult()).getVersion().equals(bv2.getVersion());
- q = em.createNamedQuery(BundleVersion.QUERY_FIND_VERSIONS_BY_NAME);
- q.setParameter("name", name);
+ q = em.createNamedQuery(BundleVersion.QUERY_FIND_VERSION_INFO_BY_BUNDLE_ID);
+ q.setParameter("bundleId", bundle.getId());
versionsArrays = q.getResultList(); // returns in DESC sort order!
assert versionsArrays.size() == 3;
assert ((String) versionsArrays.get(0)[0]).equals(bv2.getVersion()); // 2.0
@@ -311,8 +323,8 @@ public class BundleTest extends AbstractEJB3Test {
assert ((Number) versionsArrays.get(2)[1]).intValue() == bv.getVersionOrder();
// increment all version orders, starting at order #0 - makes sure we can update >1 rows
- q = em.createNamedQuery(BundleVersion.UPDATE_VERSION_ORDER);
- q.setParameter("name", name);
+ q = em.createNamedQuery(BundleVersion.UPDATE_VERSION_ORDER_BY_BUNDLE_ID);
+ q.setParameter("bundleId", bundle.getId());
q.setParameter("versionOrder", 0);
assert q.executeUpdate() == 3 : "should have auto-incremented version orders";
em.flush();
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
index abc3637..da167f0 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
@@ -36,6 +36,7 @@ import javax.persistence.Query;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.maven.artifact.versioning.ComparableVersion;
import org.rhq.core.clientapi.agent.bundle.BundleAgentService;
import org.rhq.core.clientapi.agent.bundle.BundleScheduleRequest;
@@ -257,8 +258,42 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
// ensure we have a version
version = getVersion(version, bundle);
+ ComparableVersion comparableVersion = new ComparableVersion(version);
+
+ Query q = entityManager.createNamedQuery(BundleVersion.QUERY_FIND_VERSION_INFO_BY_BUNDLE_ID);
+ q.setParameter("bundleId", bundle.getId());
+ List<Object[]> list = q.getResultList();
+ int versionOrder = list.size();
+ boolean needToUpdateOrder = false;
+ // find out where in the order of versions this new version should be placed (e.g. 2.0 is after 1.0).
+ // the query returns a list of arrays - first element in array is version; second is versionOrder
+ // the query returns list in desc order - since the normal case is we are creating the latest, highest version,
+ // starting at the current highest version is the most efficient (we'll break the for loop after 1 iteration).
+ for (Object[] bv : list) {
+ ComparableVersion bvv = new ComparableVersion(bv[0].toString());
+ int comparision = comparableVersion.compareTo(bvv);
+ if (comparision == 0) {
+ throw new RuntimeException("Cannot create bundle with version [" + version + "], it already exists");
+ } else if (comparision < 0) {
+ versionOrder = ((Number) bv[1]).intValue();
+ needToUpdateOrder = true;
+ } else {
+ break; // comparision > 0, means our new version is higher than what's in the DB, because we DESC ordered, we can stop
+ }
+ }
+
+ if (needToUpdateOrder) {
+ entityManager.flush();
+ q = entityManager.createNamedQuery(BundleVersion.UPDATE_VERSION_ORDER_BY_BUNDLE_ID);
+ q.setParameter("bundleId", bundle.getId());
+ q.setParameter("versionOrder", versionOrder);
+ q.executeUpdate();
+ entityManager.flush();
+ entityManager.clear();
+ }
BundleVersion bundleVersion = new BundleVersion(name, version, bundle, recipe);
+ bundleVersion.setVersionOrder(versionOrder);
bundleVersion.setDescription(description);
bundleVersion.setConfigurationDefinition(results.getConfigDef());
@@ -267,20 +302,26 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
}
private String getVersion(String version, Bundle bundle) {
- if (!(null == version || "".equals(version.trim()))) {
+ if (null != version && version.trim().length() > 0) {
return version;
}
- BundleVersion currentBundleVersion = null;
- for (BundleVersion bundleVersion : bundle.getBundleVersions()) {
- if ((null == currentBundleVersion) || (bundleVersion.getId() > currentBundleVersion.getId())) {
- currentBundleVersion = bundleVersion;
+ BundleVersion latestBundleVersion = null;
+ Query q = entityManager.createNamedQuery(BundleVersion.QUERY_FIND_LATEST_BY_BUNDLE_ID);
+ q.setParameter("bundleId", bundle.getId());
+ List<BundleVersion> list = q.getResultList();
+ if (list.size() > 0) {
+ if (list.size() == 1) {
+ latestBundleVersion = list.get(0);
+ } else {
+ throw new RuntimeException("Bundle [" + bundle.getName() + "] (id=" + bundle.getId()
+ + ") has more than 1 'latest' version. This should not happen - aborting");
}
}
// note - this is the same algo used by ResourceClientProxy in updatebackingContent (for a resource)
- String oldVersion = (null == currentBundleVersion) ? null : currentBundleVersion.getVersion();
- String newVersion = NumberUtil.autoIncrementVersion(oldVersion);
+ String latestVersion = latestBundleVersion != null ? latestBundleVersion.getVersion() : null;
+ String newVersion = NumberUtil.autoIncrementVersion(latestVersion);
return newVersion;
}
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
index 6cdabc7..24f4a50 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
@@ -259,9 +259,79 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
BundleVersion bv1 = createBundleVersion(b1.getName() + "-1", null, b1);
assertNotNull(bv1);
assertEquals("1.0", bv1.getVersion());
+ assert 0 == bv1.getVersionOrder();
BundleVersion bv2 = createBundleVersion(b1.getName() + "-2", null, b1);
assertNotNull(bv2);
assertEquals("1.1", bv2.getVersion());
+ assert 1 == bv2.getVersionOrder();
+ }
+
+ @Test(enabled = TESTS_ENABLED)
+ public void testCreateBundleVersionOrdering() throws Exception {
+ Bundle b1 = createBundle("one");
+ assertNotNull(b1);
+ BundleVersion bv1 = createBundleVersion(b1.getName() + "-1", "1.0", b1);
+ assertNotNull(bv1);
+ assertEquals("1.0", bv1.getVersion());
+ assert 0 == bv1.getVersionOrder();
+ BundleVersion bv2 = createBundleVersion(b1.getName() + "-2", "2.0", b1);
+ assertNotNull(bv2);
+ assertEquals("2.0", bv2.getVersion());
+ assert 1 == bv2.getVersionOrder();
+ BundleVersion bv3 = createBundleVersion(b1.getName() + "-3", "1.5", b1);
+ assertNotNull(bv3);
+ assertEquals("1.5", bv3.getVersion());
+ assert 1 == bv3.getVersionOrder();
+
+ BundleVersionCriteria c = new BundleVersionCriteria();
+ PageList<BundleVersion> bvs = null;
+
+ c.addFilterId(bv1.getId()); // 1.0
+ bvs = bundleManager.findBundleVersionsByCriteria(overlord, c);
+ assertNotNull(bvs);
+ assertEquals(1, bvs.size());
+ assert bvs.get(0).getVersionOrder() == 0; // 1st is the 1.0 version
+
+ c.addFilterId(bv2.getId()); // 2.0
+ bvs = bundleManager.findBundleVersionsByCriteria(overlord, c);
+ assertNotNull(bvs);
+ assertEquals(1, bvs.size());
+ assert bvs.get(0).getVersionOrder() == 2; // 3rd is the 2.0 version
+
+ c.addFilterId(bv3.getId()); // 1.5
+ bvs = bundleManager.findBundleVersionsByCriteria(overlord, c);
+ assertNotNull(bvs);
+ assertEquals(1, bvs.size());
+ assert bvs.get(0).getVersionOrder() == 1; // 2nd is the 1.5 version
+
+ // see that we can create a really old bundle and versionOrder gets updated properly
+ BundleVersion bv4 = createBundleVersion(b1.getName() + "-4", "0.5", b1);
+ assertNotNull(bv4);
+ assertEquals("0.5", bv4.getVersion());
+
+ c.addFilterId(bv4.getId()); //0.5
+ bvs = bundleManager.findBundleVersionsByCriteria(overlord, c);
+ assertNotNull(bvs);
+ assertEquals(1, bvs.size());
+ assert bvs.get(0).getVersionOrder() == 0; // 1st is the 0.5 version
+
+ c.addFilterId(bv1.getId()); // 1.0
+ bvs = bundleManager.findBundleVersionsByCriteria(overlord, c);
+ assertNotNull(bvs);
+ assertEquals(1, bvs.size());
+ assert bvs.get(0).getVersionOrder() == 1; // 2nd is the 1.0 version
+
+ c.addFilterId(bv3.getId()); // 1.5
+ bvs = bundleManager.findBundleVersionsByCriteria(overlord, c);
+ assertNotNull(bvs);
+ assertEquals(1, bvs.size());
+ assert bvs.get(0).getVersionOrder() == 2; // 3nd is the 1.5 version
+
+ c.addFilterId(bv2.getId()); // 2.0
+ bvs = bundleManager.findBundleVersionsByCriteria(overlord, c);
+ assertNotNull(bvs);
+ assertEquals(1, bvs.size());
+ assert bvs.get(0).getVersionOrder() == 3; // 4th is the 2.0 version
}
@Test(enabled = TESTS_ENABLED)
commit 060fb37e49978a66aa2c1b5b94013f2ff9f9e10c
Merge: 5de5881... 68dc7f6...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Sat Mar 20 01:56:42 2010 -0400
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
Conflicts:
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
index 7d2db45,74532ae..e5e2653
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
@@@ -43,14 -45,14 +43,14 @@@ import org.rhq.enterprise.gui.coregui.c
public class BundleInfoStep implements WizardStep {
private DynamicForm form;
- private final AbstractBundleWizard wizard;
- private final BundleCreateWizard wizard;
++ private final AbstractBundleCreateWizard wizard;
private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
private TextItem nameTextItem;
private TextItem versionTextItem;
private TextAreaItem descriptionTextAreaItem;
- public BundleInfoStep(AbstractBundleWizard bundleCreationWizard) {
- public BundleInfoStep(BundleCreateWizard bundleCreationWizard) {
++ public BundleInfoStep(AbstractBundleCreateWizard bundleCreationWizard) {
this.wizard = bundleCreationWizard;
}
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUpdateWizard.java
index ba64752,0000000..dfb8c15
mode 100644,000000..100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUpdateWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUpdateWizard.java
@@@ -1,77 -1,0 +1,77 @@@
+/*
+ * 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.bundle.create;
+
+import java.util.ArrayList;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.widgets.IButton;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+
+import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
+
- public class BundleUpdateWizard extends AbstractBundleWizard {
++public class BundleUpdateWizard extends AbstractBundleCreateWizard {
+
+ public BundleUpdateWizard(BundleVersion bv) {
+ setWindowTitle("Bundle Update Wizard");
+ setTitle("Update a Bundle");
+ setSubtitle(bv.getName());
+ setBundleVersion(bv);
+
+ ArrayList<WizardStep> steps = new ArrayList<WizardStep>();
+ steps.add(new BundleInfoStep(this));
+ steps.add(new BundleUploadRecipeStep(this));
+ steps.add(new BundleUploadDataStep(this));
+ setSteps(steps);
+ }
+
+ @Override
+ public void startBundleWizard() {
+ super.startBundleWizard();
+ IButton cancelButton = getView().getCancelButton();
+ cancelButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ final BundleVersion bv = getBundleVersion();
+ if (bv != null) {
+ // the user must have created it already after verification step, delete it
+ BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
+ bundleServer.deleteBundleVersion(bv.getId(), new AsyncCallback<Void>() {
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("Canceled bundle [" + bv.getName() + "] version [" + bv.getVersion() + "]",
+ Severity.Info));
+ }
+
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+ "Failed to fully cancel - bundle may still exist in the database", caught);
+ }
+ });
+ }
+ }
+ });
+ }
+}
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
index e4deff3,d952500..2a6a7c5
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
@@@ -43,12 -43,12 +43,12 @@@ import org.rhq.enterprise.gui.coregui.c
public class BundleUploadDataStep implements WizardStep {
- private final AbstractBundleWizard wizard;
- private final BundleCreateWizard wizard;
++ private final AbstractBundleCreateWizard wizard;
private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
private DynamicForm form;
private Map<String, Boolean> allFilesStatus;
- public BundleUploadDataStep(AbstractBundleWizard bundleCreationWizard) {
- public BundleUploadDataStep(BundleCreateWizard bundleCreationWizard) {
++ public BundleUploadDataStep(AbstractBundleCreateWizard bundleCreationWizard) {
this.wizard = bundleCreationWizard;
}
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
index 30bb2ac,49dba20..e729d25
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
@@@ -43,11 -43,10 +43,11 @@@ import org.rhq.enterprise.gui.coregui.c
public class BundleUploadRecipeStep implements WizardStep {
private DynamicCallbackForm form;
- private final AbstractBundleWizard wizard;
- private final BundleCreateWizard wizard;
++ private final AbstractBundleCreateWizard wizard;
private TextAreaItem recipe;
+ private CanvasItem validatingItem;
- public BundleUploadRecipeStep(AbstractBundleWizard bundleCreationWizard) {
- public BundleUploadRecipeStep(BundleCreateWizard bundleCreationWizard) {
++ public BundleUploadRecipeStep(AbstractBundleCreateWizard bundleCreationWizard) {
this.wizard = bundleCreationWizard;
}
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
index 9b94cf5,ac0133b..155dcdd
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
@@@ -24,8 -24,8 +24,9 @@@ import com.smartgwt.client.widgets.grid
import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.bundle.Bundle;
- import org.rhq.enterprise.gui.coregui.client.bundle.create.BundleCreationWizard;
+ import org.rhq.enterprise.gui.coregui.client.bundle.create.BundleCreateWizard;
+ import org.rhq.enterprise.gui.coregui.client.bundle.deploy.BundleDeployWizard;
+import org.rhq.enterprise.gui.coregui.client.bundle.create.BundleUpdateWizard;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
@@@ -55,17 -56,9 +57,17 @@@ public class BundlesListView extends VL
}
});
+ table.addTableAction("Update Bundle", Table.SelectionEnablement.SINGLE, null, new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ Bundle bundle = (Bundle) selection[0].getAttributeAsObject("entity");
+ BundleUpdateWizard bundleUpdateWizard = new BundleUpdateWizard(null);
+ bundleUpdateWizard.startBundleWizard();
+ }
+ });
+
- table.addTableAction("Deploy", Table.SelectionEnablement.SINGLE, null, new TableAction() {
+ table.addTableAction("Deploy Selected Bundle", Table.SelectionEnablement.SINGLE, null, new TableAction() {
public void executeAction(ListGridRecord[] selection) {
- // TODO: Implement this method.
+ new BundleDeployWizard((Bundle) selection[0].getAttributeAsObject("object")).startBundleWizard();
}
});
commit 5de58818a9b5477f385a47995e9d24918e582674
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Sat Mar 20 01:34:34 2010 -0400
more bundle wizard stuff
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
index 95791a3..7d2db45 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
@@ -25,8 +25,6 @@ import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.TitleOrientation;
import com.smartgwt.client.widgets.Canvas;
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.TextAreaItem;
import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
@@ -45,14 +43,14 @@ import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
public class BundleInfoStep implements WizardStep {
private DynamicForm form;
- private final BundleCreationWizard wizard;
+ private final AbstractBundleWizard wizard;
private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
private TextItem nameTextItem;
private TextItem versionTextItem;
private TextAreaItem descriptionTextAreaItem;
- public BundleInfoStep(BundleCreationWizard bundleCreationWizard) {
+ public BundleInfoStep(AbstractBundleWizard bundleCreationWizard) {
this.wizard = bundleCreationWizard;
}
@@ -68,17 +66,16 @@ public class BundleInfoStep implements WizardStep {
nameTextItem.setTitleAlign(Alignment.LEFT);
nameTextItem.addChangedHandler(new ChangedHandler() {
public void onChanged(ChangedEvent event) {
- String value = form.getValueAsString("name");
+ String value = getValueAsString(event.getValue());
wizard.setSubtitle(value);
}
});
-
final TextItem previousVersionTextItem = new TextItem("previousVersion", "Previous Version");
previousVersionTextItem.setTitleAlign(Alignment.LEFT);
versionTextItem = new TextItem("version");
-
+ versionTextItem.setRequired(true);
versionTextItem.setTitleAlign(Alignment.LEFT);
descriptionTextAreaItem = new TextAreaItem("description", "Description");
@@ -88,25 +85,25 @@ public class BundleInfoStep implements WizardStep {
form.setItems(nameTextItem, previousVersionTextItem, versionTextItem, descriptionTextAreaItem);
-
BundleVersion initialBundleVersion = wizard.getBundleVersion();
if (initialBundleVersion != null) {
- form.setValue("name", initialBundleVersion.getName());
+ nameTextItem.setValue(initialBundleVersion.getName());
nameTextItem.setDisabled(true);
+ wizard.setSubtitle(initialBundleVersion.getName());
- form.setValue("previousVersion", initialBundleVersion.getVersion());
+ previousVersionTextItem.setValue(initialBundleVersion.getVersion());
previousVersionTextItem.setDisabled(true);
versionTextItem.setTitle("New Version");
String versionSuggestion = autoIncrementVersion(initialBundleVersion.getVersion());
- form.setValue("version", versionSuggestion);
+ versionTextItem.setValue(versionSuggestion);
- form.setValue("description", initialBundleVersion.getDescription());
+ descriptionTextAreaItem.setValue(initialBundleVersion.getDescription());
} else {
previousVersionTextItem.setVisible(Boolean.FALSE);
versionTextItem.setTitle("Initial Version");
- form.setValue("version", "1.0");
+ versionTextItem.setValue("1.0");
}
if (wizard.getBundleType() == null) {
@@ -132,22 +129,14 @@ public class BundleInfoStep implements WizardStep {
}
}
-
- form.addItemChangedHandler(new ItemChangedHandler() {
- public void onItemChanged(ItemChangedEvent itemChangedEvent) {
- enableNextButtonWhenAppropriate();
- }
- });
-
return form;
}
public boolean nextPage() {
- if (form.validate()) {
- wizard.setBundleName(form.getValueAsString("name"));
- wizard.setBundleVersionString(form.getValueAsString("version"));
- wizard.setBundleDescription(form.getValueAsString("description"));
-
+ if (form.validate() && this.wizard.getBundleType() != null) {
+ wizard.setBundleName(getValueAsString(nameTextItem.getValue()));
+ wizard.setBundleVersionString(getValueAsString(versionTextItem.getValue()));
+ wizard.setBundleDescription(getValueAsString(descriptionTextAreaItem.getValue()));
return true;
}
return false;
@@ -157,12 +146,6 @@ public class BundleInfoStep implements WizardStep {
return "Provide Bundle Information";
}
-
- private void enableNextButtonWhenAppropriate() {
- this.wizard.getView().getNextButton().setDisabled(!(form.validate() && this.wizard.getBundleType() != null));
- }
-
-
private String autoIncrementVersion(String oldVersion) {
String newVersion = "1.0";
if (oldVersion != null && oldVersion.length() != 0) {
@@ -177,4 +160,8 @@ public class BundleInfoStep implements WizardStep {
}
return newVersion;
}
+
+ private String getValueAsString(Object obj) {
+ return (obj != null) ? obj.toString() : "";
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUpdateWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUpdateWizard.java
new file mode 100644
index 0000000..ba64752
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUpdateWizard.java
@@ -0,0 +1,77 @@
+/*
+ * 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.bundle.create;
+
+import java.util.ArrayList;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.widgets.IButton;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+
+import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
+
+public class BundleUpdateWizard extends AbstractBundleWizard {
+
+ public BundleUpdateWizard(BundleVersion bv) {
+ setWindowTitle("Bundle Update Wizard");
+ setTitle("Update a Bundle");
+ setSubtitle(bv.getName());
+ setBundleVersion(bv);
+
+ ArrayList<WizardStep> steps = new ArrayList<WizardStep>();
+ steps.add(new BundleInfoStep(this));
+ steps.add(new BundleUploadRecipeStep(this));
+ steps.add(new BundleUploadDataStep(this));
+ setSteps(steps);
+ }
+
+ @Override
+ public void startBundleWizard() {
+ super.startBundleWizard();
+ IButton cancelButton = getView().getCancelButton();
+ cancelButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ final BundleVersion bv = getBundleVersion();
+ if (bv != null) {
+ // the user must have created it already after verification step, delete it
+ BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
+ bundleServer.deleteBundleVersion(bv.getId(), new AsyncCallback<Void>() {
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("Canceled bundle [" + bv.getName() + "] version [" + bv.getVersion() + "]",
+ Severity.Info));
+ }
+
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+ "Failed to fully cancel - bundle may still exist in the database", caught);
+ }
+ });
+ }
+ }
+ });
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
index 8bb2498..e4deff3 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
@@ -43,12 +43,12 @@ import org.rhq.enterprise.gui.coregui.client.util.message.Message;
public class BundleUploadDataStep implements WizardStep {
- private final BundleCreationWizard wizard;
+ private final AbstractBundleWizard wizard;
private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
private DynamicForm form;
private Map<String, Boolean> allFilesStatus;
- public BundleUploadDataStep(BundleCreationWizard bundleCreationWizard) {
+ public BundleUploadDataStep(AbstractBundleWizard bundleCreationWizard) {
this.wizard = bundleCreationWizard;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
index 84a2a09..30bb2ac 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
@@ -43,10 +43,11 @@ import org.rhq.enterprise.gui.coregui.client.util.message.Message;
public class BundleUploadRecipeStep implements WizardStep {
private DynamicCallbackForm form;
- private final BundleCreationWizard wizard;
+ private final AbstractBundleWizard wizard;
private TextAreaItem recipe;
+ private CanvasItem validatingItem;
- public BundleUploadRecipeStep(BundleCreationWizard bundleCreationWizard) {
+ public BundleUploadRecipeStep(AbstractBundleWizard bundleCreationWizard) {
this.wizard = bundleCreationWizard;
}
@@ -57,21 +58,21 @@ public class BundleUploadRecipeStep implements WizardStep {
form.setMargin(Integer.valueOf(20));
form.setShowInlineErrors(false);
-
final LinkItem showUpload = new LinkItem("showUpload");
showUpload.setValue("Click To Upload A Recipe File");
showUpload.setShowTitle(false);
final CanvasItem upload = new CanvasItem("upload");
upload.setShowTitle(false);
+ upload.setVisible(false);
final TextFileRetrieverForm textFileRetrieverForm = new TextFileRetrieverForm();
upload.setCanvas(textFileRetrieverForm);
showUpload.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
- form.hideItem("showUpload");
- form.showItem("upload");
+ form.hideItem(showUpload.getName());
+ form.showItem(upload.getName());
}
});
@@ -82,24 +83,21 @@ public class BundleUploadRecipeStep implements WizardStep {
recipe.setWidth("*");
recipe.setHeight(220);
-
textFileRetrieverForm.addFormHandler(new DynamicFormHandler() {
public void onSubmitComplete(DynamicFormSubmitCompleteEvent event) {
wizard.setRecipe(event.getResults());
recipe.setValue(event.getResults());
textFileRetrieverForm.retrievalStatus(true);
- form.showItem("showUpload");
- form.hideItem("upload");
-// enableNextButtonWhenAppropriate();
+ form.showItem(showUpload.getName());
+ form.hideItem(upload.getName());
}
});
- CanvasItem validating = new CanvasItem("validating", "Validating");
- validating.setCanvas(new Img("ajax-loader.gif", 16, 16));
- validating.setVisible(false);
+ validatingItem = new CanvasItem("validating", "Validating");
+ validatingItem.setCanvas(new Img("ajax-loader.gif", 16, 16));
+ validatingItem.setVisible(false);
- form.setItems(showUpload, upload, recipe, validating);
- form.hideItem("upload");
+ form.setItems(showUpload, upload, recipe, validatingItem);
} else {
// we are traversing back to this step - don't allow the recipe to change if we've already created the bundle version
if (wizard.getBundleVersion() != null) {
@@ -118,7 +116,7 @@ public class BundleUploadRecipeStep implements WizardStep {
return true;
} else {
if (form.validate()) {
- validateAndCreateRecipe();
+ validateAndCreateRecipe(); // this will move to the next step for us
}
return false;
}
@@ -129,43 +127,44 @@ public class BundleUploadRecipeStep implements WizardStep {
return "Provide Bundle Recipe";
}
-
private void validateAndCreateRecipe() {
- form.showItem("validating");
-
- wizard.setRecipe(form.getValueAsString("recipe"));
+ form.showItem(validatingItem.getName());
+ setButtonsDisableMode(true);
+ wizard.setRecipe(recipe.getValue().toString());
BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
- bundleServer.createBundleAndBundleVersion(
- this.wizard.getBundleName(),
- this.wizard.getBundleType().getId(),
- this.wizard.getBundleName(),
- this.wizard.getBundleVersionString(),
- this.wizard.getBundleDescription(),
- this.wizard.getRecipe(),
- new AsyncCallback<BundleVersion>() {
- public void onSuccess(BundleVersion result) {
- form.hideItem("validating");
-
- CoreGUI.getMessageCenter().notify(
- new Message("Created bundle [" + result.getName() + "] version [" + result.getVersion() + "]",
- Message.Severity.Info));
- wizard.setBundleVersion(result);
- wizard.getView().incrementStep();
- }
-
- public void onFailure(Throwable caught) {
- form.hideItem("validating");
-
- HashMap<String, String> errors = new HashMap<String, String>();
- errors.put("recipe", "Invalid Recipe: " + caught.getMessage());
- form.setErrors(errors, true);
- CoreGUI.getErrorHandler().handleError("Failed to create bundle: " + caught.getMessage(), caught);
- wizard.setBundleVersion(null);
-// enableNextButtonWhenAppropriate();
- }
- });
+ bundleServer.createBundleAndBundleVersion(this.wizard.getBundleName(), this.wizard.getBundleType().getId(),
+ this.wizard.getBundleName(), this.wizard.getBundleVersionString(), this.wizard.getBundleDescription(),
+ this.wizard.getRecipe(), new AsyncCallback<BundleVersion>() {
+ public void onSuccess(BundleVersion result) {
+ form.hideItem(validatingItem.getName());
+
+ CoreGUI.getMessageCenter().notify(
+ new Message("Created bundle [" + result.getName() + "] version [" + result.getVersion() + "]",
+ Message.Severity.Info));
+ wizard.setBundleVersion(result);
+ wizard.getView().incrementStep();
+ setButtonsDisableMode(false);
+ }
+
+ public void onFailure(Throwable caught) {
+ form.hideItem(validatingItem.getName());
+
+ HashMap<String, String> errors = new HashMap<String, String>();
+ errors.put(recipe.getName(), "Invalid Recipe: " + caught.getMessage());
+ form.setErrors(errors, true);
+ CoreGUI.getErrorHandler().handleError("Failed to create bundle", caught);
+ wizard.setBundleVersion(null);
+ wizard.setRecipe("");
+ setButtonsDisableMode(false);
+ }
+ });
}
+ private void setButtonsDisableMode(boolean disabled) {
+ wizard.getView().getCancelButton().setDisabled(disabled);
+ wizard.getView().getNextButton().setDisabled(disabled);
+ wizard.getView().getPreviousButton().setDisabled(disabled);
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
index 6963019..9b94cf5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
@@ -25,6 +25,7 @@ import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.bundle.Bundle;
import org.rhq.enterprise.gui.coregui.client.bundle.create.BundleCreationWizard;
+import org.rhq.enterprise.gui.coregui.client.bundle.create.BundleUpdateWizard;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
@@ -33,12 +34,10 @@ import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
*/
public class BundlesListView extends VLayout {
-
@Override
protected void onDraw() {
super.onDraw();
-
Table table = new Table("Bundles");
table.setDataSource(new BundlesDataSource());
@@ -49,37 +48,38 @@ public class BundlesListView extends VLayout {
table.getListGrid().setSelectionType(SelectionStyle.SIMPLE);
table.getListGrid().setSelectionAppearance(SelectionAppearance.CHECKBOX);
-
- table.addTableAction("Create Bundle", Table.SelectionEnablement.ALWAYS, null,
- new TableAction() {
- public void executeAction(ListGridRecord[] selection) {
- new BundleCreationWizard().startBundleWizard();
-
- }
- });
-
- table.addTableAction("Deploy", Table.SelectionEnablement.SINGLE, null,
- new TableAction() {
- public void executeAction(ListGridRecord[] selection) {
- // TODO: Implement this method.
- }
- });
+ table.addTableAction("Create New Bundle", Table.SelectionEnablement.ALWAYS, null, new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ new BundleCreationWizard().startBundleWizard();
+ }
+ });
+
+ table.addTableAction("Update Bundle", Table.SelectionEnablement.SINGLE, null, new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ Bundle bundle = (Bundle) selection[0].getAttributeAsObject("entity");
+ BundleUpdateWizard bundleUpdateWizard = new BundleUpdateWizard(null);
+ bundleUpdateWizard.startBundleWizard();
+ }
+ });
+
+ table.addTableAction("Deploy", Table.SelectionEnablement.SINGLE, null, new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ // TODO: Implement this method.
+ }
+ });
table.addTableAction("Delete", Table.SelectionEnablement.ANY, "Are you sure you want to delete # bundles?",
- new TableAction() {
- public void executeAction(ListGridRecord[] selection) {
- // TODO: Implement this method.
- Bundle bundle = (Bundle) selection[0].getAttributeAsObject("entity");
- bundle.getId();
-
- }
- });
+ new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ // TODO: Implement this method.
+ Bundle bundle = (Bundle) selection[0].getAttributeAsObject("entity");
+ bundle.getId();
+ }
+ });
addMember(table);
-
-
}
}
commit ddf0fd0058ae7abf984297c5f36fbddec0576e47
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Sat Mar 20 01:34:24 2010 -0400
fix test - need to explicitly set uuid now
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
index f05d8f9..6cdabc7 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
@@ -542,7 +542,6 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
// with the bundle resource type
ResourceType resourceType = new ResourceType(TEST_PREFIX + "-platform-" + System.currentTimeMillis(),
"test", ResourceCategory.PLATFORM, null);
-
em.persist(resourceType);
Agent agent = new Agent(TEST_PREFIX + "-testagent", "testaddress", 1, "", "testtoken");
@@ -550,6 +549,7 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
em.flush();
resource = new Resource("reskey" + System.currentTimeMillis(), TEST_PREFIX + "-resname", resourceType);
+ resource.setUuid("" + System.currentTimeMillis());
resource.setInventoryStatus(InventoryStatus.COMMITTED);
resource.setAgent(agent);
em.persist(resource);
commit 2b86c8c0164fd835323c56ee6c2288a71ea76ece
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Sat Mar 20 01:34:06 2010 -0400
add version order column
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml b/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
index 683c991..75675ef 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
@@ -515,6 +515,7 @@
<column name="NAME" size="200" type="VARCHAR2" required="true"/>
<column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/>
<column name="VERSION" size="500" type="VARCHAR2" required="true"/>
+ <column name="VERSION_ORDER" type="INTEGER" required="true"/>
<column name="ACTION" type="CLOB" required="true"/>
<column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF" />
<column name="BUNDLE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE"/>
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 23f1fbd..2b8848f 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -2893,6 +2893,11 @@
</schema-directSQL>
</schemaSpec>
+ <schemaSpec version="2.78.4">
+ <schema-addColumn table="RHQ_BUNDLE_VERSION" column="VERSION_ORDER" columnType="INTEGER" />
+ <schema-alterColumn table="RHQ_BUNDLE_VERSION" column="VERSION_ORDER" nullable="FALSE" />
+ </schemaSpec>
+
<schemaSpec version="2.79">
<schema-directSQL>
<statement desc="Normalizing resource group descriptions">
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleVersion.java b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleVersion.java
index 00eb979..a3b01f4 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleVersion.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleVersion.java
@@ -53,8 +53,20 @@ import org.rhq.core.domain.content.Distribution;
*/
@Entity
@NamedQueries( {
- @NamedQuery(name = BundleVersion.QUERY_FIND_ALL, query = "SELECT bv FROM BundleVersion bv"), //
- @NamedQuery(name = BundleVersion.QUERY_FIND_BY_NAME, query = "SELECT bv FROM BundleVersion bv WHERE bv.name = :name") //
+ @NamedQuery(name = BundleVersion.UPDATE_VERSION_ORDER, query = "UPDATE BundleVersion bv SET bv.versionOrder = (bv.versionOrder+1) WHERE bv.name = :name AND bv.versionOrder >= :versionOrder"), //
+ @NamedQuery(name = BundleVersion.QUERY_FIND_LATEST_BY_NAME, query = "" //
+ + "SELECT bv " //
+ + " FROM BundleVersion bv " //
+ + " WHERE bv.name = :name " //
+ + " AND bv.versionOrder = (SELECT MAX(bv2.versionOrder) FROM BundleVersion bv2 WHERE bv2.name = :name) "), //
+ // this returns a desc ordered list of a 2-D array - first element in array is the version string, second is its associated version order
+ @NamedQuery(name = BundleVersion.QUERY_FIND_VERSIONS_BY_NAME, query = "" //
+ + "SELECT bv.version, bv.versionOrder " //
+ + " FROM BundleVersion bv " //
+ + " WHERE bv.name = :name " //
+ + " ORDER BY bv.versionOrder DESC "), //
+ @NamedQuery(name = BundleVersion.QUERY_FIND_ALL, query = "SELECT bv FROM BundleVersion bv "), //
+ @NamedQuery(name = BundleVersion.QUERY_FIND_BY_NAME, query = "SELECT bv FROM BundleVersion bv WHERE bv.name = :name ") //
})
@SequenceGenerator(name = "SEQ", sequenceName = "RHQ_BUNDLE_VERSION_ID_SEQ")
@Table(name = "RHQ_BUNDLE_VERSION")
@@ -62,6 +74,9 @@ import org.rhq.core.domain.content.Distribution;
public class BundleVersion implements Serializable {
private static final long serialVersionUID = 1L;
+ public static final String UPDATE_VERSION_ORDER = "BundleVersion.updateVersionOrder";
+ public static final String QUERY_FIND_LATEST_BY_NAME = "BundleVersion.findLatestByName";
+ public static final String QUERY_FIND_VERSIONS_BY_NAME = "BundleVersion.findVersionsByName";
public static final String QUERY_FIND_ALL = "BundleVersion.findAll";
public static final String QUERY_FIND_BY_NAME = "BundleVersion.findByName";
@@ -79,6 +94,9 @@ public class BundleVersion implements Serializable {
@Column(name = "VERSION", nullable = false)
private String version;
+ @Column(name = "VERSION_ORDER", nullable = false)
+ private int versionOrder;
+
@Column(name = "ACTION", nullable = false)
private String recipe;
@@ -143,6 +161,14 @@ public class BundleVersion implements Serializable {
this.version = version;
}
+ public int getVersionOrder() {
+ return versionOrder;
+ }
+
+ public void setVersionOrder(int versionOrder) {
+ this.versionOrder = versionOrder;
+ }
+
public String getRecipe() {
return recipe;
}
diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/bundle/test/BundleTest.java b/modules/core/domain/src/test/java/org/rhq/core/domain/bundle/test/BundleTest.java
index 9da25eb..42ed4ab 100644
--- a/modules/core/domain/src/test/java/org/rhq/core/domain/bundle/test/BundleTest.java
+++ b/modules/core/domain/src/test/java/org/rhq/core/domain/bundle/test/BundleTest.java
@@ -74,6 +74,7 @@ public class BundleTest extends AbstractEJB3Test {
bundle.setRepo(bundleRepo);
em.persist(bundle);
BundleVersion bundleVersion = new BundleVersion(name, "1.0.0.BETA", bundle, recipe);
+ bundleVersion.setVersionOrder(0);
em.persist(bundleVersion);
id = bundleVersion.getId();
assert id > 0;
@@ -124,7 +125,6 @@ public class BundleTest extends AbstractEJB3Test {
}
public void testBundleVersion() throws Throwable {
- boolean done = false;
getTransactionManager().begin();
EntityManager em = getEntityManager();
try {
@@ -145,6 +145,7 @@ public class BundleTest extends AbstractEJB3Test {
assert bundle.getBundleType().getId() != 0 : "bundleType should have been cascade persisted too";
BundleVersion bv = new BundleVersion(name, "1.0.0.BETA", bundle, recipe);
+ bv.setVersionOrder(777);
Query q = em.createNamedQuery(BundleVersion.QUERY_FIND_BY_NAME);
q.setParameter("name", bv.getName());
assert q.getResultList().size() == 0; // not in the db yet
@@ -155,7 +156,6 @@ public class BundleTest extends AbstractEJB3Test {
q = em.createNamedQuery(BundleVersion.QUERY_FIND_BY_NAME);
q.setParameter("name", bv.getName());
- q.setParameter("name", bv.getName());
assert q.getResultList().size() == 1;
assert ((BundleVersion) q.getSingleResult()).getName().equals(bv.getName());
@@ -164,6 +164,7 @@ public class BundleTest extends AbstractEJB3Test {
assert bvFind.getId() == bv.getId();
assert bvFind.getName().equals(bv.getName());
assert bvFind.getVersion().equals(bv.getVersion());
+ assert bvFind.getVersionOrder() == bv.getVersionOrder();
assert bvFind.getRecipe().equals(bv.getRecipe());
assert bvFind.getBundle().equals(bv.getBundle());
assert bvFind.equals(bv);
@@ -222,8 +223,116 @@ public class BundleTest extends AbstractEJB3Test {
}
}
+ public void testMultipleBundleVersions() throws Throwable {
+ getTransactionManager().begin();
+ EntityManager em = getEntityManager();
+ try {
+ int id;
+
+ String name = "BundleTest-testMultipleBundleVersions";
+ String recipe = "action/script/recipe is here";
+
+ Repo repo1 = new Repo(name + "-Repo1");
+ em.persist(repo1);
+
+ BundleType bundleType = createBundleType(em, name + "-Type", createResourceType(em));
+ Bundle bundle = new Bundle(name + "-Bundle", bundleType);
+ bundle.setRepo(repo1);
+ em.persist(bundle);
+ id = bundle.getId();
+ assert id > 0;
+ assert bundle.getBundleType().getId() != 0 : "bundleType should have been cascade persisted too";
+
+ BundleVersion bv = new BundleVersion(name, "1.0", bundle, recipe);
+ bv.setVersionOrder(0);
+ Query q = em.createNamedQuery(BundleVersion.QUERY_FIND_BY_NAME);
+ q.setParameter("name", name);
+ assert q.getResultList().size() == 0; // not in the db yet
+ em.persist(bv);
+ id = bv.getId();
+ assert id > 0;
+
+ BundleVersion bv2 = new BundleVersion(name, "2.0", bundle, recipe);
+ bv2.setVersionOrder(1);
+ q = em.createNamedQuery(BundleVersion.QUERY_FIND_BY_NAME);
+ q.setParameter("name", name);
+ assert q.getResultList().size() == 1;
+ em.persist(bv2);
+ id = bv2.getId();
+ assert id > 0;
+
+ q = em.createNamedQuery(BundleVersion.QUERY_FIND_LATEST_BY_NAME);
+ q.setParameter("name", name);
+ assert q.getResultList().size() == 1;
+ assert ((BundleVersion) q.getSingleResult()).getVersion().equals(bv2.getVersion());
+ q = em.createNamedQuery(BundleVersion.QUERY_FIND_VERSIONS_BY_NAME);
+ q.setParameter("name", name);
+ List<Object[]> versionsArrays = q.getResultList(); // returns in DESC sort order!
+ assert versionsArrays.size() == 2;
+ assert ((String) versionsArrays.get(0)[0]).equals(bv2.getVersion());
+ assert ((Number) versionsArrays.get(0)[1]).intValue() == bv2.getVersionOrder();
+ assert ((String) versionsArrays.get(1)[0]).equals(bv.getVersion());
+ assert ((Number) versionsArrays.get(1)[1]).intValue() == bv.getVersionOrder();
+
+ // increment all version orders, starting at order #1
+ q = em.createNamedQuery(BundleVersion.UPDATE_VERSION_ORDER);
+ q.setParameter("name", name);
+ q.setParameter("versionOrder", 1);
+ assert q.executeUpdate() == 1 : "should have auto-incremented version order in one row";
+ em.flush();
+ em.clear();
+ bv = em.find(BundleVersion.class, bv.getId());
+ assert bv.getVersionOrder() == 0 : "should not have incremented version order";
+ bv2 = em.find(BundleVersion.class, bv2.getId());
+ assert bv2.getVersionOrder() == 2 : "didn't increment version order";
+
+ BundleVersion bv3 = new BundleVersion(name, "1.5", bundle, recipe);
+ bv3.setVersionOrder(1);
+ q = em.createNamedQuery(BundleVersion.QUERY_FIND_BY_NAME);
+ q.setParameter("name", name);
+ assert q.getResultList().size() == 2;
+ em.persist(bv3);
+ id = bv3.getId();
+ assert id > 0;
+
+ q = em.createNamedQuery(BundleVersion.QUERY_FIND_LATEST_BY_NAME);
+ q.setParameter("name", name);
+ assert q.getResultList().size() == 1;
+ assert ((BundleVersion) q.getSingleResult()).getVersion().equals(bv2.getVersion());
+ q = em.createNamedQuery(BundleVersion.QUERY_FIND_VERSIONS_BY_NAME);
+ q.setParameter("name", name);
+ versionsArrays = q.getResultList(); // returns in DESC sort order!
+ assert versionsArrays.size() == 3;
+ assert ((String) versionsArrays.get(0)[0]).equals(bv2.getVersion()); // 2.0
+ assert ((Number) versionsArrays.get(0)[1]).intValue() == bv2.getVersionOrder();
+ assert ((String) versionsArrays.get(1)[0]).equals(bv3.getVersion()); // 1.5
+ assert ((Number) versionsArrays.get(1)[1]).intValue() == bv3.getVersionOrder();
+ assert ((String) versionsArrays.get(2)[0]).equals(bv.getVersion()); // 1.0
+ assert ((Number) versionsArrays.get(2)[1]).intValue() == bv.getVersionOrder();
+
+ // increment all version orders, starting at order #0 - makes sure we can update >1 rows
+ q = em.createNamedQuery(BundleVersion.UPDATE_VERSION_ORDER);
+ q.setParameter("name", name);
+ q.setParameter("versionOrder", 0);
+ assert q.executeUpdate() == 3 : "should have auto-incremented version orders";
+ em.flush();
+ em.clear();
+ bv = em.find(BundleVersion.class, bv.getId());
+ assert bv.getVersionOrder() == 1 : "didn't increment version order: " + bv.getVersionOrder();
+ bv2 = em.find(BundleVersion.class, bv2.getId());
+ assert bv2.getVersionOrder() == 3 : "didn't increment version order: " + bv2.getVersionOrder();
+ bv3 = em.find(BundleVersion.class, bv3.getId());
+ assert bv3.getVersionOrder() == 2 : "didn't increment version order: " + bv3.getVersionOrder();
+
+ } catch (Throwable t) {
+ t.printStackTrace();
+ throw t;
+ } finally {
+ getTransactionManager().rollback();
+ }
+ }
+
public void testBundle() throws Throwable {
- boolean done = false;
getTransactionManager().begin();
EntityManager em = getEntityManager();
try {
@@ -301,7 +410,6 @@ public class BundleTest extends AbstractEJB3Test {
}
public void testBundleType() throws Throwable {
- boolean done = false;
getTransactionManager().begin();
EntityManager em = getEntityManager();
try {
commit 68dc7f64a9884352e3b410a335514f8ccf27f8e0
Merge: 094ec91... 2068333...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Mar 19 17:46:55 2010 -0400
Merge branch 'gwt' into gwt-jay
Conflicts:
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesDataSource.java
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
commit 094ec91da66ec51545bf54036f0a394873111b82
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Mar 19 17:42:11 2010 -0400
Just getting in some initial stuff for deploy wizard. not working yet
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
index 852e765..131cb92 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
@@ -19,14 +19,10 @@
package org.rhq.enterprise.gui.coregui.client.bundle;
import com.smartgwt.client.types.VisibilityMode;
-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.HLayout;
import com.smartgwt.client.widgets.layout.SectionStack;
import com.smartgwt.client.widgets.layout.SectionStackSection;
-import org.rhq.enterprise.gui.coregui.client.bundle.create.BundleCreationWizard;
import org.rhq.enterprise.gui.coregui.client.bundle.list.BundlesListView;
/**
@@ -34,7 +30,6 @@ import org.rhq.enterprise.gui.coregui.client.bundle.list.BundlesListView;
*/
public class BundleTopView extends HLayout {
-
public BundleTopView() {
setWidth100();
setHeight100();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/AbstractBundleCreateWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/AbstractBundleCreateWizard.java
new file mode 100644
index 0000000..81d13ca
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/AbstractBundleCreateWizard.java
@@ -0,0 +1,82 @@
+/*
+ * 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.bundle.create;
+
+import org.rhq.core.domain.bundle.BundleType;
+import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.enterprise.gui.coregui.client.bundle.AbstractBundleWizard;
+
+public abstract class AbstractBundleCreateWizard extends AbstractBundleWizard {
+
+ // the things we build up in the wizard
+ private BundleType bundleType;
+ private String bundleName;
+ private String bundleVersionString;
+ private String bundleDescription;
+ private String recipe;
+ private BundleVersion bundleVersion;
+
+ public BundleType getBundleType() {
+ return bundleType;
+ }
+
+ public void setBundleType(BundleType bundleType) {
+ this.bundleType = bundleType;
+ }
+
+ public String getBundleName() {
+ return bundleName;
+ }
+
+ public void setBundleName(String bundleName) {
+ this.bundleName = bundleName;
+ }
+
+ public String getBundleVersionString() {
+ return bundleVersionString;
+ }
+
+ public void setBundleVersionString(String bundleVersionString) {
+ this.bundleVersionString = bundleVersionString;
+ }
+
+ public String getBundleDescription() {
+ return bundleDescription;
+ }
+
+ public void setBundleDescription(String desc) {
+ this.bundleDescription = desc;
+ }
+
+ public String getRecipe() {
+ return recipe;
+ }
+
+ public void setRecipe(String recipe) {
+ this.recipe = recipe;
+ }
+
+ public BundleVersion getBundleVersion() {
+ return bundleVersion;
+ }
+
+ public void setBundleVersion(BundleVersion bv) {
+ this.bundleVersion = bv;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/AbstractBundleCreationWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/AbstractBundleCreationWizard.java
deleted file mode 100644
index 1edb719..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/AbstractBundleCreationWizard.java
+++ /dev/null
@@ -1,82 +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.bundle.create;
-
-import org.rhq.core.domain.bundle.BundleType;
-import org.rhq.core.domain.bundle.BundleVersion;
-import org.rhq.enterprise.gui.coregui.client.bundle.AbstractBundleWizard;
-
-public abstract class AbstractBundleCreationWizard extends AbstractBundleWizard {
-
- // the things we build up in the wizard
- private BundleType bundleType;
- private String bundleName;
- private String bundleVersionString;
- private String bundleDescription;
- private String recipe;
- private BundleVersion bundleVersion;
-
- public BundleType getBundleType() {
- return bundleType;
- }
-
- public void setBundleType(BundleType bundleType) {
- this.bundleType = bundleType;
- }
-
- public String getBundleName() {
- return bundleName;
- }
-
- public void setBundleName(String bundleName) {
- this.bundleName = bundleName;
- }
-
- public String getBundleVersionString() {
- return bundleVersionString;
- }
-
- public void setBundleVersionString(String bundleVersionString) {
- this.bundleVersionString = bundleVersionString;
- }
-
- public String getBundleDescription() {
- return bundleDescription;
- }
-
- public void setBundleDescription(String desc) {
- this.bundleDescription = desc;
- }
-
- public String getRecipe() {
- return recipe;
- }
-
- public void setRecipe(String recipe) {
- this.recipe = recipe;
- }
-
- public BundleVersion getBundleVersion() {
- return bundleVersion;
- }
-
- public void setBundleVersion(BundleVersion bv) {
- this.bundleVersion = bv;
- }
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreateWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreateWizard.java
index 99b1125..e2fe45f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreateWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreateWizard.java
@@ -33,7 +33,7 @@ import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
-public class BundleCreateWizard extends AbstractBundleCreationWizard {
+public class BundleCreateWizard extends AbstractBundleCreateWizard {
public BundleCreateWizard() {
setWindowTitle("Bundle Creation Wizard");
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
index 84a2a09..49dba20 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
@@ -43,10 +43,10 @@ import org.rhq.enterprise.gui.coregui.client.util.message.Message;
public class BundleUploadRecipeStep implements WizardStep {
private DynamicCallbackForm form;
- private final BundleCreationWizard wizard;
+ private final BundleCreateWizard wizard;
private TextAreaItem recipe;
- public BundleUploadRecipeStep(BundleCreationWizard bundleCreationWizard) {
+ public BundleUploadRecipeStep(BundleCreateWizard bundleCreationWizard) {
this.wizard = bundleCreationWizard;
}
@@ -57,7 +57,6 @@ public class BundleUploadRecipeStep implements WizardStep {
form.setMargin(Integer.valueOf(20));
form.setShowInlineErrors(false);
-
final LinkItem showUpload = new LinkItem("showUpload");
showUpload.setValue("Click To Upload A Recipe File");
showUpload.setShowTitle(false);
@@ -82,7 +81,6 @@ public class BundleUploadRecipeStep implements WizardStep {
recipe.setWidth("*");
recipe.setHeight(220);
-
textFileRetrieverForm.addFormHandler(new DynamicFormHandler() {
public void onSubmitComplete(DynamicFormSubmitCompleteEvent event) {
wizard.setRecipe(event.getResults());
@@ -90,7 +88,7 @@ public class BundleUploadRecipeStep implements WizardStep {
textFileRetrieverForm.retrievalStatus(true);
form.showItem("showUpload");
form.hideItem("upload");
-// enableNextButtonWhenAppropriate();
+ // enableNextButtonWhenAppropriate();
}
});
@@ -129,43 +127,36 @@ public class BundleUploadRecipeStep implements WizardStep {
return "Provide Bundle Recipe";
}
-
private void validateAndCreateRecipe() {
form.showItem("validating");
wizard.setRecipe(form.getValueAsString("recipe"));
-
BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
- bundleServer.createBundleAndBundleVersion(
- this.wizard.getBundleName(),
- this.wizard.getBundleType().getId(),
- this.wizard.getBundleName(),
- this.wizard.getBundleVersionString(),
- this.wizard.getBundleDescription(),
- this.wizard.getRecipe(),
- new AsyncCallback<BundleVersion>() {
- public void onSuccess(BundleVersion result) {
- form.hideItem("validating");
-
- CoreGUI.getMessageCenter().notify(
- new Message("Created bundle [" + result.getName() + "] version [" + result.getVersion() + "]",
- Message.Severity.Info));
- wizard.setBundleVersion(result);
- wizard.getView().incrementStep();
- }
-
- public void onFailure(Throwable caught) {
- form.hideItem("validating");
-
- HashMap<String, String> errors = new HashMap<String, String>();
- errors.put("recipe", "Invalid Recipe: " + caught.getMessage());
- form.setErrors(errors, true);
- CoreGUI.getErrorHandler().handleError("Failed to create bundle: " + caught.getMessage(), caught);
- wizard.setBundleVersion(null);
-// enableNextButtonWhenAppropriate();
- }
- });
+ bundleServer.createBundleAndBundleVersion(this.wizard.getBundleName(), this.wizard.getBundleType().getId(),
+ this.wizard.getBundleName(), this.wizard.getBundleVersionString(), this.wizard.getBundleDescription(),
+ this.wizard.getRecipe(), new AsyncCallback<BundleVersion>() {
+ public void onSuccess(BundleVersion result) {
+ form.hideItem("validating");
+
+ CoreGUI.getMessageCenter().notify(
+ new Message("Created bundle [" + result.getName() + "] version [" + result.getVersion() + "]",
+ Message.Severity.Info));
+ wizard.setBundleVersion(result);
+ wizard.getView().incrementStep();
+ }
+
+ public void onFailure(Throwable caught) {
+ form.hideItem("validating");
+
+ HashMap<String, String> errors = new HashMap<String, String>();
+ errors.put("recipe", "Invalid Recipe: " + caught.getMessage());
+ form.setErrors(errors, true);
+ CoreGUI.getErrorHandler().handleError("Failed to create bundle: " + caught.getMessage(), caught);
+ wizard.setBundleVersion(null);
+ // enableNextButtonWhenAppropriate();
+ }
+ });
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/CreateConfigStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/CreateConfigStep.java
index cd99e44..c388953 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/CreateConfigStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/CreateConfigStep.java
@@ -18,12 +18,8 @@
*/
package org.rhq.enterprise.gui.coregui.client.bundle.deploy;
-import java.util.List;
-
import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.form.DynamicForm;
-import org.rhq.core.clientapi.agent.configuration.ConfigurationUtility;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
@@ -31,7 +27,6 @@ import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
public class CreateConfigStep implements WizardStep {
- private DynamicForm form;
private final BundleDeployWizard wizard;
// private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
private ConfigurationEditor editor;
@@ -59,7 +54,8 @@ public class CreateConfigStep implements WizardStep {
}
public boolean nextPage() {
- return form.validate();
+ wizard.setConfig(editor.getConfiguration());
+ return true;
}
public boolean isPreviousEnabled() {
@@ -67,13 +63,6 @@ public class CreateConfigStep implements WizardStep {
}
public boolean isNextEnabled() {
- wizard.setConfig(editor.getConfiguration());
- List<String> messages = ConfigurationUtility.validateConfiguration(wizard.getConfig(), wizard
- .getBundleVersion().getConfigurationDefinition());
- return messages.isEmpty();
- }
-
- public Configuration getConfiguration() {
- return editor.getConfiguration();
+ return true;
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleVersionStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleVersionStep.java
index a34f34e..9f6af9c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleVersionStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleVersionStep.java
@@ -39,17 +39,19 @@ import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
public class SelectBundleVersionStep implements WizardStep {
- private DynamicForm form;
private final BundleDeployWizard wizard;
-
private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
+ private DynamicForm form;
+ private PageList<BundleVersion> bundleVersions = null;
+ private SelectItem selectVersion = new SelectItem("selectVersion", "Deployment Version");
+ private LinkedHashMap<String, Object> selectVersionValues = new LinkedHashMap<String, Object>();;
public SelectBundleVersionStep(BundleDeployWizard bundleDeployWizard) {
this.wizard = bundleDeployWizard;
}
public String getName() {
- return "Select Version of Bundle to Deploy";
+ return "Select Version 1";
}
public Canvas getCanvas() {
@@ -59,20 +61,36 @@ public class SelectBundleVersionStep implements WizardStep {
form.setNumCols(2);
form.setColWidths("50%", "*");
- // for now, get all the bundle versions for the bundle
+ // for now, get all the bundle versions for the bundle
+ selectVersion.setRequired(true);
+ //selectVersion.setWidth(150);
+ selectVersion.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent event) {
+ for (BundleVersion bundleVersion : bundleVersions) {
+ if (bundleVersion.getVersion().equals(event.getValue())) {
+ wizard.setBundleVersion(bundleVersion);
+ break;
+ }
+ }
+ enableNextButtonWhenAppropriate();
+ }
+ });
+
final BundleVersionCriteria criteria = new BundleVersionCriteria();
criteria.addFilterBundleId(wizard.getBundle().getId());
criteria.fetchConfigurationDefinition(true);
- final LinkedHashMap<String, BundleVersion> bundleVersions = new LinkedHashMap<String, BundleVersion>();
-
bundleServer.findBundleVersionsByCriteria(criteria, new AsyncCallback<PageList<BundleVersion>>() {
public void onSuccess(PageList<BundleVersion> result) {
- if (result.isEmpty()) {
+ bundleVersions = result;
+ if (bundleVersions.isEmpty()) {
onFailure(new IllegalArgumentException("No bundle versions defined for bundle."));
}
for (BundleVersion bundleVersion : result) {
- bundleVersions.put(bundleVersion.getVersion(), bundleVersion);
+ selectVersionValues.put(bundleVersion.getVersion(), bundleVersion.getVersion());
}
+ selectVersion.setValueMap(selectVersionValues);
+ selectVersion.redraw();
+ form.markForRedraw();
}
public void onFailure(Throwable caught) {
@@ -80,18 +98,7 @@ public class SelectBundleVersionStep implements WizardStep {
}
});
- final SelectItem selectBundle = new SelectItem("selectBundle", "Deployment Bundle");
- selectBundle.setRequired(true);
- selectBundle.setWidth(150);
- selectBundle.setValueMap(bundleVersions);
- selectBundle.addChangedHandler(new ChangedHandler() {
- public void onChanged(ChangedEvent event) {
- wizard.setBundleVersion((BundleVersion) event.getValue());
- enableNextButtonWhenAppropriate();
- }
- });
-
- form.setItems(selectBundle);
+ form.setItems(selectVersion);
}
return form;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesDataSource.java
index 50e6214..c24bf0c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesDataSource.java
@@ -42,15 +42,14 @@ public class BundlesDataSource extends RPCDataSource<Bundle> {
public BundlesDataSource() {
- DataSourceIntegerField idField = new DataSourceIntegerField("id","ID");
+ DataSourceIntegerField idField = new DataSourceIntegerField("id", "ID");
idField.setPrimaryKey(true);
addField(idField);
-
- DataSourceTextField nameField = new DataSourceTextField("name","Name");
+ DataSourceTextField nameField = new DataSourceTextField("name", "Name");
addField(nameField);
- DataSourceTextField descriptionField = new DataSourceTextField("description","Description");
+ DataSourceTextField descriptionField = new DataSourceTextField("description", "Description");
addField(descriptionField);
}
@@ -63,9 +62,9 @@ public class BundlesDataSource extends RPCDataSource<Bundle> {
bundleService.findBundlesByCriteria(criteria, new AsyncCallback<PageList<Bundle>>() {
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load bundle data",caught);
+ CoreGUI.getErrorHandler().handleError("Failed to load bundle data", caught);
response.setStatus(DSResponse.STATUS_FAILURE);
- processResponse(request.getRequestId(),response);
+ processResponse(request.getRequestId(), response);
}
public void onSuccess(PageList<Bundle> result) {
@@ -79,18 +78,20 @@ public class BundlesDataSource extends RPCDataSource<Bundle> {
@Override
public Bundle copyValues(ListGridRecord from) {
- return null; // TODO: Implement this method.
+ return null; // TODO: Implement this method.
}
@Override
public ListGridRecord copyValues(Bundle from) {
ListGridRecord record = new ListGridRecord();
- record.setAttribute("id",from.getId());
- record.setAttribute("name",from.getName());
- record.setAttribute("description",from.getDescription());
- record.setAttribute("bundleType",from.getBundleType());
- record.setAttribute("repos",from.getRepo());
+ record.setAttribute("id", from.getId());
+ record.setAttribute("name", from.getName());
+ record.setAttribute("description", from.getDescription());
+ record.setAttribute("bundleType", from.getBundleType());
+ record.setAttribute("repos", from.getRepo());
+
+ record.setAttribute("object", from);
return record;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
index 89b69fa..ac0133b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
@@ -23,7 +23,9 @@ import com.smartgwt.client.types.SelectionStyle;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.layout.VLayout;
-import org.rhq.enterprise.gui.coregui.client.bundle.create.BundleCreationWizard;
+import org.rhq.core.domain.bundle.Bundle;
+import org.rhq.enterprise.gui.coregui.client.bundle.create.BundleCreateWizard;
+import org.rhq.enterprise.gui.coregui.client.bundle.deploy.BundleDeployWizard;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
@@ -32,12 +34,10 @@ import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
*/
public class BundlesListView extends VLayout {
-
@Override
protected void onDraw() {
super.onDraw();
-
Table table = new Table("Bundles");
table.setDataSource(new BundlesDataSource());
@@ -48,17 +48,19 @@ public class BundlesListView extends VLayout {
table.getListGrid().setSelectionType(SelectionStyle.SIMPLE);
table.getListGrid().setSelectionAppearance(SelectionAppearance.CHECKBOX);
-
- table.addTableAction("Create Bundle", Table.SelectionEnablement.ALWAYS, null,
- new TableAction() {
- public void executeAction(ListGridRecord[] selection) {
- new BundleCreationWizard().startBundleWizard();
-
- }
- });
+ table.addTableAction("Create Bundle", Table.SelectionEnablement.ALWAYS, null, new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ new BundleCreateWizard().startBundleWizard();
+ }
+ });
+ table.addTableAction("Deploy Selected Bundle", Table.SelectionEnablement.SINGLE, null, new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ new BundleDeployWizard((Bundle) selection[0].getAttributeAsObject("object")).startBundleWizard();
+ }
+ });
addMember(table);
}
commit ba593b00698f588c4b9ec1f27f26cce4bcd5a775
Merge: 376eb68... fc2db3f...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Mar 19 11:57:06 2010 -0400
Merge branch 'gwt' into gwt-jay
Conflicts:
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreateWizard.java
index a84b1bf,0000000..99b1125
mode 100644,000000..100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreateWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreateWizard.java
@@@ -1,57 -1,0 +1,76 @@@
+/*
+ * 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.bundle.create;
+
+import java.util.ArrayList;
+
++import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.widgets.IButton;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+
+import org.rhq.core.domain.bundle.BundleVersion;
++import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
++import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
++import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
++import org.rhq.enterprise.gui.coregui.client.util.message.Message;
++import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
+
+public class BundleCreateWizard extends AbstractBundleCreationWizard {
+
+ public BundleCreateWizard() {
+ setWindowTitle("Bundle Creation Wizard");
+ setTitle("Create Bundle");
+
+ ArrayList<WizardStep> steps = new ArrayList<WizardStep>();
+ steps.add(new BundleInfoStep(this));
+ steps.add(new BundleUploadRecipeStep(this));
- steps.add(new BundleVerificationStep(this));
++// steps.add(new BundleVerificationStep(this));
+ steps.add(new BundleUploadDataStep(this));
+ setSteps(steps);
+ }
+
+ @Override
+ public void startBundleWizard() {
+ super.startBundleWizard();
+ IButton cancelButton = getView().getCancelButton();
+ cancelButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
- BundleVersion bv = getBundleVersion();
++ final BundleVersion bv = getBundleVersion();
+ if (bv != null) {
+ // the user must have created it already after verification step, delete it
++ BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
++ bundleServer.deleteBundleVersion(bv.getId(), new AsyncCallback<Void>() {
++ public void onSuccess(Void result) {
++ CoreGUI.getMessageCenter().notify(
++ new Message("Canceled bundle [" + bv.getName() + "] version [" + bv.getVersion() + "]",
++ Severity.Info));
++ }
++
++ public void onFailure(Throwable caught) {
++ CoreGUI.getErrorHandler().handleError(
++ "Failed to fully cancel - bundle may still exist in the database", caught);
++ }
++ });
+ }
+ }
+ });
+ }
+}
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
index 84d8dea,95791a3..74532ae
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
@@@ -37,11 -45,14 +45,14 @@@ import org.rhq.enterprise.gui.coregui.c
public class BundleInfoStep implements WizardStep {
private DynamicForm form;
- private final BundleCreationWizard wizard;
+ private final BundleCreateWizard wizard;
private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
+ private TextItem nameTextItem;
+ private TextItem versionTextItem;
+ private TextAreaItem descriptionTextAreaItem;
- public BundleInfoStep(BundleCreationWizard bundleCreationWizard) {
+ public BundleInfoStep(BundleCreateWizard bundleCreationWizard) {
this.wizard = bundleCreationWizard;
}
commit 2068333bb0e3990c805b2eaba88a86ef46896b51
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Fri Mar 19 11:43:15 2010 -0400
BundleListView changes
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
index 852e765..4f6111e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
@@ -51,6 +51,8 @@ public class BundleTopView extends HLayout {
sectionStack.setHeight100();
sectionStack.addSection(new SectionStackSection("Bundles"));
+ sectionStack.addSection(new SectionStackSection("Repositories"));
+ sectionStack.addSection(new SectionStackSection("Providers"));
addMember(sectionStack);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesDataSource.java
index 50e6214..b35c07b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesDataSource.java
@@ -46,7 +46,6 @@ public class BundlesDataSource extends RPCDataSource<Bundle> {
idField.setPrimaryKey(true);
addField(idField);
-
DataSourceTextField nameField = new DataSourceTextField("name","Name");
addField(nameField);
@@ -92,6 +91,8 @@ public class BundlesDataSource extends RPCDataSource<Bundle> {
record.setAttribute("bundleType",from.getBundleType());
record.setAttribute("repos",from.getRepo());
+ record.setAttribute("entity", from);
+
return record;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
index 89b69fa..6963019 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
@@ -23,6 +23,7 @@ import com.smartgwt.client.types.SelectionStyle;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.layout.VLayout;
+import org.rhq.core.domain.bundle.Bundle;
import org.rhq.enterprise.gui.coregui.client.bundle.create.BundleCreationWizard;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
@@ -58,8 +59,27 @@ public class BundlesListView extends VLayout {
}
});
+ table.addTableAction("Deploy", Table.SelectionEnablement.SINGLE, null,
+ new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ // TODO: Implement this method.
+ }
+ });
+
+ table.addTableAction("Delete", Table.SelectionEnablement.ANY, "Are you sure you want to delete # bundles?",
+ new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ // TODO: Implement this method.
+ Bundle bundle = (Bundle) selection[0].getAttributeAsObject("entity");
+ bundle.getId();
+
+ }
+ });
addMember(table);
+
+
+
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
index 8362754..0990111 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
@@ -147,7 +147,7 @@ public class MenuBarView extends VLayout {
}
- headerString.append("<td style=\"vertical-align: bottom; padding:5px; padding-left: 15px; padding-right: 15px;" + bg + "\">");
+ headerString.append("<td style=\"vertical-align: bottom; padding:5px; padding-left: 15px; padding-right: 15px;" + bg + "\"onclick=\"document.location='#" + section + "'\" >");
headerString.append("<a class=\"" + styleClass + "\" href=\"#" + section + "\">" + section + "</a>");
headerString.append("</td>\n");
commit 376eb685b3de886e3ff1f2a887c292dbd86b85e4
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Mar 19 10:50:46 2010 -0400
Initial impl of bundle deploy wizard - still in progress
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleVersionCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleVersionCriteria.java
index 2aab01c..0880b27 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleVersionCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleVersionCriteria.java
@@ -38,6 +38,7 @@ public class BundleVersionCriteria extends Criteria {
private String filterDescription;
private String filterName;
private String filterVersion;
+ private Integer filterBundleId; // needs override
private String filterBundleName; // needs override
private boolean fetchBundle;
@@ -47,6 +48,7 @@ public class BundleVersionCriteria extends Criteria {
private boolean fetchConfigurationDefinition;
public BundleVersionCriteria() {
+ filterOverrides.put("bundleId", "bundle.id = ?");
filterOverrides.put("bundleName", "bundle.name like ?");
}
@@ -67,6 +69,10 @@ public class BundleVersionCriteria extends Criteria {
this.filterName = filterName;
}
+ public void addFilterBundleId(Integer filterBundleId) {
+ this.filterBundleId = filterBundleId;
+ }
+
public void addFilterBundleName(String filterBundleName) {
this.filterBundleName = filterBundleName;
}
@@ -87,6 +93,10 @@ public class BundleVersionCriteria extends Criteria {
this.fetchBundleFiles = fetchBundleFiles;
}
+ public void fetchConfigurationDefinition(boolean fetchConfigurationDefinition) {
+ this.fetchConfigurationDefinition = fetchConfigurationDefinition;
+ }
+
public void fetchDistribution(boolean fetchDistribution) {
this.fetchDistribution = fetchDistribution;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/AbstractBundleWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/AbstractBundleWizard.java
new file mode 100644
index 0000000..afd1f47
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/AbstractBundleWizard.java
@@ -0,0 +1,85 @@
+/*
+ * 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.bundle;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import com.smartgwt.client.widgets.IButton;
+
+import org.rhq.enterprise.gui.coregui.client.components.wizard.Wizard;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardView;
+
+public abstract class AbstractBundleWizard implements Wizard {
+
+ private ArrayList<WizardStep> steps;
+ private WizardView view;
+ private String windowTitle = "";
+ private String title = "";
+ private String subtitle = "";
+
+ public String getWindowTitle() {
+ return windowTitle;
+ }
+
+ public void setWindowTitle(String windowTitle) {
+ this.windowTitle = windowTitle;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public String getSubtitle() {
+ return subtitle;
+ }
+
+ public void setSubtitle(String subtitle) {
+ this.subtitle = subtitle;
+ this.view.refreshTitleLabelContents();
+ }
+
+ public List<WizardStep> getSteps() {
+ return steps;
+ }
+
+ public void setSteps(ArrayList<WizardStep> steps) {
+ this.steps = steps;
+ }
+
+ public List<IButton> getCustomButtons(int step) {
+ return Collections.emptyList();
+ }
+
+ public void startBundleWizard() {
+ view = new WizardView(this);
+ view.displayDialog();
+ }
+
+ public WizardView getView() {
+ return view;
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
index 8839c76..dfb3ec5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
@@ -23,7 +23,6 @@ import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.layout.HLayout;
-import org.rhq.enterprise.gui.coregui.client.bundle.create.BundleCreationWizard;
import org.rhq.enterprise.gui.coregui.client.bundle.deploy.BundleDeployWizard;
/**
@@ -38,18 +37,18 @@ public class BundleTopView extends HLayout {
IButton addBundleButton = new IButton("New Bundle");
addBundleButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
- new BundleCreationWizard().startBundleWizard();
+ new BundleDeployWizard().startBundleWizard();
}
});
- IButton addDefinitionButton = new IButton("New Deployment");
- addDefinitionButton.addClickHandler(new ClickHandler() {
+ IButton addDeploymentButton = new IButton("New Deployment");
+ addDeploymentButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
new BundleDeployWizard().startBundleWizard();
}
});
addMember(addBundleButton);
- addMember(addDefinitionButton);
+ addMember(addDeploymentButton);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/AbstractBundleCreationWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/AbstractBundleCreationWizard.java
index 2994948..1edb719 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/AbstractBundleCreationWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/AbstractBundleCreationWizard.java
@@ -20,6 +20,7 @@ package org.rhq.enterprise.gui.coregui.client.bundle.create;
import org.rhq.core.domain.bundle.BundleType;
import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.enterprise.gui.coregui.client.bundle.AbstractBundleWizard;
public abstract class AbstractBundleCreationWizard extends AbstractBundleWizard {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/AbstractBundleWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/AbstractBundleWizard.java
deleted file mode 100644
index 0937655..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/AbstractBundleWizard.java
+++ /dev/null
@@ -1,142 +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.bundle.create;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import com.smartgwt.client.widgets.IButton;
-
-import org.rhq.core.domain.bundle.BundleType;
-import org.rhq.core.domain.bundle.BundleVersion;
-import org.rhq.enterprise.gui.coregui.client.components.wizard.Wizard;
-import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
-import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardView;
-
-public abstract class AbstractBundleWizard implements Wizard {
-
- private ArrayList<WizardStep> steps;
- private WizardView view;
- private String windowTitle = "";
- private String title = "";
- private String subtitle = "";
-
- // the things we build up in the wizard
- private BundleType bundleType;
- private String bundleName;
- private String bundleVersionString;
- private String bundleDescription;
- private String recipe;
- private BundleVersion bundleVersion;
-
- public String getWindowTitle() {
- return windowTitle;
- }
-
- public void setWindowTitle(String windowTitle) {
- this.windowTitle = windowTitle;
- }
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public String getSubtitle() {
- return subtitle;
- }
-
- public void setSubtitle(String subtitle) {
- this.subtitle = subtitle;
- this.view.refreshTitleLabelContents();
- }
-
- public List<WizardStep> getSteps() {
- return steps;
- }
-
- public void setSteps(ArrayList<WizardStep> steps) {
- this.steps = steps;
- }
-
- public List<IButton> getCustomButtons(int step) {
- return Collections.emptyList();
- }
-
- public void startBundleWizard() {
- view = new WizardView(this);
- view.displayDialog();
- }
-
- public WizardView getView() {
- return view;
- }
-
- public BundleType getBundleType() {
- return bundleType;
- }
-
- public void setBundleType(BundleType bundleType) {
- this.bundleType = bundleType;
- }
-
- public String getBundleName() {
- return bundleName;
- }
-
- public void setBundleName(String bundleName) {
- this.bundleName = bundleName;
- }
-
- public String getBundleVersionString() {
- return bundleVersionString;
- }
-
- public void setBundleVersionString(String bundleVersionString) {
- this.bundleVersionString = bundleVersionString;
- }
-
- public String getBundleDescription() {
- return bundleDescription;
- }
-
- public void setBundleDescription(String desc) {
- this.bundleDescription = desc;
- }
-
- public String getRecipe() {
- return recipe;
- }
-
- public void setRecipe(String recipe) {
- this.recipe = recipe;
- }
-
- public BundleVersion getBundleVersion() {
- return bundleVersion;
- }
-
- public void setBundleVersion(BundleVersion bv) {
- this.bundleVersion = bv;
- }
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreateWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreateWizard.java
new file mode 100644
index 0000000..a84b1bf
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreateWizard.java
@@ -0,0 +1,57 @@
+/*
+ * 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.bundle.create;
+
+import java.util.ArrayList;
+
+import com.smartgwt.client.widgets.IButton;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+
+import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+
+public class BundleCreateWizard extends AbstractBundleCreationWizard {
+
+ public BundleCreateWizard() {
+ setWindowTitle("Bundle Creation Wizard");
+ setTitle("Create Bundle");
+
+ ArrayList<WizardStep> steps = new ArrayList<WizardStep>();
+ steps.add(new BundleInfoStep(this));
+ steps.add(new BundleUploadRecipeStep(this));
+ steps.add(new BundleVerificationStep(this));
+ steps.add(new BundleUploadDataStep(this));
+ setSteps(steps);
+ }
+
+ @Override
+ public void startBundleWizard() {
+ super.startBundleWizard();
+ IButton cancelButton = getView().getCancelButton();
+ cancelButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ BundleVersion bv = getBundleVersion();
+ if (bv != null) {
+ // the user must have created it already after verification step, delete it
+ }
+ }
+ });
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java
deleted file mode 100644
index c75610a..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.bundle.create;
-
-import java.util.ArrayList;
-
-import com.smartgwt.client.widgets.IButton;
-import com.smartgwt.client.widgets.events.ClickEvent;
-import com.smartgwt.client.widgets.events.ClickHandler;
-
-import org.rhq.core.domain.bundle.BundleVersion;
-import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
-
-public class BundleCreationWizard extends AbstractBundleWizard {
-
- public BundleCreationWizard() {
- setWindowTitle("Bundle Creation Wizard");
- setTitle("Create Bundle");
-
- ArrayList<WizardStep> steps = new ArrayList<WizardStep>();
- steps.add(new BundleInfoStep(this));
- steps.add(new BundleUploadRecipeStep(this));
- steps.add(new BundleVerificationStep(this));
- steps.add(new BundleUploadDataStep(this));
- setSteps(steps);
- }
-
- @Override
- public void startBundleWizard() {
- super.startBundleWizard();
- IButton cancelButton = getView().getCancelButton();
- cancelButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- BundleVersion bv = getBundleVersion();
- if (bv != null) {
- // the user must have created it already after verification step, delete it
- }
- }
- });
- }
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
index 0b6d176..84d8dea 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
@@ -37,11 +37,11 @@ import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
public class BundleInfoStep implements WizardStep {
private DynamicForm form;
- private final BundleCreationWizard wizard;
+ private final BundleCreateWizard wizard;
private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
- public BundleInfoStep(BundleCreationWizard bundleCreationWizard) {
+ public BundleInfoStep(BundleCreateWizard bundleCreationWizard) {
this.wizard = bundleCreationWizard;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
index 0a0a5c2..ad87a42 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
@@ -42,12 +42,12 @@ import org.rhq.enterprise.gui.coregui.client.util.message.Message;
public class BundleUploadDataStep implements WizardStep {
- private final BundleCreationWizard wizard;
+ private final BundleCreateWizard wizard;
private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
private DynamicForm form;
private Map<String, Boolean> allFilesStatus;
- public BundleUploadDataStep(BundleCreationWizard bundleCreationWizard) {
+ public BundleUploadDataStep(BundleCreateWizard bundleCreationWizard) {
this.wizard = bundleCreationWizard;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
index 34e410e..8324934 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
@@ -37,9 +37,9 @@ import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
public class BundleUploadRecipeStep implements WizardStep {
private DynamicCallbackForm form;
- private final BundleCreationWizard wizard;
+ private final BundleCreateWizard wizard;
- public BundleUploadRecipeStep(BundleCreationWizard bundleCreationWizard) {
+ public BundleUploadRecipeStep(BundleCreateWizard bundleCreationWizard) {
this.wizard = bundleCreationWizard;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java
index 40fd9f9..5dc7fb1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java
@@ -36,12 +36,12 @@ import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
public class BundleVerificationStep implements WizardStep {
- private final BundleCreationWizard wizard;
+ private final BundleCreateWizard wizard;
private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
private VLayout canvas;
- public BundleVerificationStep(BundleCreationWizard bundleCreationWizard) {
+ public BundleVerificationStep(BundleCreateWizard bundleCreationWizard) {
this.wizard = bundleCreationWizard;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/AbstractBundleDeployWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/AbstractBundleDeployWizard.java
index 91b198a..5b11249 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/AbstractBundleDeployWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/AbstractBundleDeployWizard.java
@@ -19,17 +19,131 @@
package org.rhq.enterprise.gui.coregui.client.bundle.deploy;
import org.rhq.core.domain.bundle.Bundle;
+import org.rhq.core.domain.bundle.BundleDeployDefinition;
+import org.rhq.core.domain.bundle.BundleDeployment;
import org.rhq.core.domain.bundle.BundleVersion;
import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.enterprise.gui.coregui.client.bundle.create.AbstractBundleWizard;
+import org.rhq.core.domain.configuration.definition.ConfigurationTemplate;
+import org.rhq.enterprise.gui.coregui.client.bundle.AbstractBundleWizard;
public abstract class AbstractBundleDeployWizard extends AbstractBundleWizard {
// the things we build up in the wizard
private Bundle bundle;
private BundleVersion bundleVersion;
+ private BundleDeployDefinition bundleDeployDefinition;
+ private BundleDeployment bundleDeployment;
private String name;
private String description;
+ private ConfigurationTemplate template;
private Configuration config;
+ private Integer platformGroupId;
+ private Integer platformId;
+ private Boolean newDefinition = Boolean.TRUE;
+ private Boolean deployNow = null;
+
+ public Bundle getBundle() {
+ return bundle;
+ }
+
+ public void setBundle(Bundle bundle) {
+ this.bundle = bundle;
+ }
+
+ public BundleVersion getBundleVersion() {
+ return bundleVersion;
+ }
+
+ public void setBundleVersion(BundleVersion bundleVersion) {
+ this.bundleVersion = bundleVersion;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Configuration getConfig() {
+ return config;
+ }
+
+ public ConfigurationTemplate getTemplate() {
+ return template;
+ }
+
+ public void setTemplate(ConfigurationTemplate template) {
+ this.template = template;
+ }
+
+ public void setConfig(Configuration config) {
+ this.config = config;
+ }
+
+ public BundleDeployDefinition getBundleDeployDefinition() {
+ return bundleDeployDefinition;
+ }
+
+ public void setBundleDeployDefinition(BundleDeployDefinition bundleDeployDefinition) {
+ this.bundleDeployDefinition = bundleDeployDefinition;
+ }
+
+ public boolean isNewDefinition() {
+ return Boolean.TRUE.equals(newDefinition);
+ }
+
+ public Boolean getNewDefinition() {
+ return newDefinition;
+ }
+
+ public void setNewDefinition(Boolean newDefinition) {
+ this.newDefinition = newDefinition;
+ }
+
+ public boolean isDeployNow() {
+ return Boolean.TRUE.equals(deployNow);
+ }
+
+ public Boolean getDeployNow() {
+ return deployNow;
+ }
+
+ public void setDeployNow(Boolean deployNow) {
+ this.deployNow = deployNow;
+ }
+
+ public Integer getPlatformGroupId() {
+ return platformGroupId;
+ }
+
+ public void setPlatformGroupId(Integer platformGroupId) {
+ this.platformGroupId = platformGroupId;
+ }
+
+ public Integer getPlatformId() {
+ return platformId;
+ }
+
+ public void setPlatformId(Integer platformId) {
+ this.platformId = platformId;
+ }
+
+ public BundleDeployment getBundleDeployment() {
+ return bundleDeployment;
+ }
+
+ public void setBundleDeployment(BundleDeployment bundleDeployment) {
+ this.bundleDeployment = bundleDeployment;
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployDefinitionInfoStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployDefinitionInfoStep.java
new file mode 100644
index 0000000..a6edbfe
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployDefinitionInfoStep.java
@@ -0,0 +1,103 @@
+/*
+ * 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.bundle.deploy;
+
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.TextAreaItem;
+import com.smartgwt.client.widgets.form.fields.TextItem;
+import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
+import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
+
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+
+public class BundleDeployDefinitionInfoStep implements WizardStep {
+
+ private DynamicForm form;
+ private final BundleDeployWizard wizard;
+
+ // private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
+
+ public BundleDeployDefinitionInfoStep(BundleDeployWizard bundleDeployWizard) {
+ this.wizard = bundleDeployWizard;
+ }
+
+ public String getName() {
+ return "Provide Deploy Information";
+ }
+
+ public Canvas getCanvas() {
+ if (form == null) {
+ form = new DynamicForm();
+ form.setWidth100();
+ form.setNumCols(2);
+ form.setColWidths("50%", "*");
+
+ final TextItem nameTextItem = new TextItem("name", "Name");
+ nameTextItem.setRequired(true);
+ nameTextItem.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent event) {
+ Object value = event.getValue();
+ if (value == null) {
+ value = "";
+ }
+ wizard.setSubtitle(value.toString());
+ wizard.setName(value.toString());
+ enableNextButtonWhenAppropriate();
+ }
+ });
+
+ final TextAreaItem descriptionTextAreaItem = new TextAreaItem("description", "Description");
+ descriptionTextAreaItem.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent event) {
+ Object value = event.getValue();
+ if (value == null) {
+ value = "";
+ }
+ wizard.setDescription(value.toString());
+ enableNextButtonWhenAppropriate();
+ }
+ });
+
+ form.setItems(nameTextItem, descriptionTextAreaItem);
+ }
+
+ return form;
+ }
+
+ public boolean nextPage() {
+ return form.validate();
+ }
+
+ public boolean isNextEnabled() {
+ return isNotEmpty(this.wizard.getName());
+ }
+
+ public boolean isPreviousEnabled() {
+ return false;
+ }
+
+ private void enableNextButtonWhenAppropriate() {
+ this.wizard.getView().getNextButton().setDisabled(!isNextEnabled());
+ }
+
+ private boolean isNotEmpty(String s) {
+ return (s != null && s.trim().length() > 0);
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployWizard.java
index 3a71dea..eaa29d2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployWizard.java
@@ -19,41 +19,93 @@
package org.rhq.enterprise.gui.coregui.client.bundle.deploy;
import java.util.ArrayList;
+import java.util.List;
+
+import com.smartgwt.client.widgets.IButton;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
import org.rhq.core.domain.bundle.Bundle;
+import org.rhq.core.domain.bundle.BundleDeployDefinition;
import org.rhq.core.domain.bundle.BundleVersion;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
public class BundleDeployWizard extends AbstractBundleDeployWizard {
public BundleDeployWizard() {
- setWindowTitle("Bundle Deployment Wizard");
- setTitle("Bundle Deployment");
+ List<WizardStep> steps = init();
- ArrayList<WizardStep> steps = new ArrayList<WizardStep>();
- /*
steps.add(new SelectBundleStep(this));
- steps.add(new BundleUploadRecipeStep(this));
- steps.add(new BundleVerificationStep(this));
- steps.add(new BundleUploadDataStep(this));
- */
- setSteps(steps);
+ steps.add(new SelectBundleVersionStep(this));
+ steps.add(new BundleDeployDefinitionInfoStep(this));
+ steps.add(new SelectTemplateStep(this));
+ steps.add(new CreateConfigStep(this));
+ steps.add(new DeployNowStep(this));
+ steps.add(new SelectPlatformsStep(this));
+ steps.add(new DeployStep(this));
}
public BundleDeployWizard(Bundle bundle) {
- setWindowTitle("Bundle Deployment Wizard");
- setTitle("Bundle Deployment");
+ List<WizardStep> steps = init();
+ setBundle(bundle);
- ArrayList<WizardStep> steps = new ArrayList<WizardStep>();
- setSteps(steps);
+ steps.add(new SelectBundleVersionStep(this));
+ steps.add(new BundleDeployDefinitionInfoStep(this));
+ steps.add(new SelectTemplateStep(this));
+ steps.add(new CreateConfigStep(this));
+ steps.add(new DeployNowStep(this));
+ steps.add(new SelectPlatformsStep(this));
+ steps.add(new DeployStep(this));
}
- public BundleDeployWizard(BundleVersion bundleVersion) {
+ public BundleDeployWizard(Bundle bundle, BundleVersion bundleVersion) {
+ List<WizardStep> steps = init();
+ setBundle(bundle);
+ setBundleVersion(bundleVersion);
+
+ steps.add(new BundleDeployDefinitionInfoStep(this));
+ steps.add(new SelectTemplateStep(this));
+ steps.add(new CreateConfigStep(this));
+ steps.add(new DeployNowStep(this));
+ steps.add(new SelectPlatformsStep(this));
+ steps.add(new DeployStep(this));
+ }
+
+ public BundleDeployWizard(Bundle bundle, BundleVersion bundleVersion, BundleDeployDefinition bundleDeployDefinition) {
+ List<WizardStep> steps = init();
+ setBundle(bundle);
+ setBundleVersion(bundleVersion);
+ setBundleDeployDefinition(bundleDeployDefinition);
+ setNewDefinition(Boolean.FALSE);
+
+ steps.add(new SelectTemplateStep(this));
+ steps.add(new CreateConfigStep(this));
+ steps.add(new DeployNowStep(this));
+ steps.add(new SelectPlatformsStep(this));
+ steps.add(new DeployStep(this));
+ }
+
+ private List<WizardStep> init() {
setWindowTitle("Bundle Deployment Wizard");
setTitle("Bundle Deployment");
ArrayList<WizardStep> steps = new ArrayList<WizardStep>();
setSteps(steps);
+ return steps;
+ }
+
+ @Override
+ public void startBundleWizard() {
+ super.startBundleWizard();
+ IButton cancelButton = getView().getCancelButton();
+ cancelButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ BundleDeployDefinition bdd = getBundleDeployDefinition();
+ if (bdd != null && isNewDefinition()) {
+ // the user must have created it already after verification step, delete it
+ }
+ }
+ });
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/CreateConfigStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/CreateConfigStep.java
new file mode 100644
index 0000000..cd99e44
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/CreateConfigStep.java
@@ -0,0 +1,79 @@
+/*
+ * 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.bundle.deploy;
+
+import java.util.List;
+
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.form.DynamicForm;
+
+import org.rhq.core.clientapi.agent.configuration.ConfigurationUtility;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+
+public class CreateConfigStep implements WizardStep {
+
+ private DynamicForm form;
+ private final BundleDeployWizard wizard;
+ // private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
+ private ConfigurationEditor editor;
+
+ public CreateConfigStep(BundleDeployWizard bundleCreationWizard) {
+ this.wizard = bundleCreationWizard;
+ }
+
+ public String getName() {
+ return "Set Deployment Configuration";
+ }
+
+ public Canvas getCanvas() {
+ if (editor == null) {
+ ConfigurationDefinition configDef = wizard.getBundleVersion().getConfigurationDefinition();
+ Configuration startingConfig = null;
+ if (null != wizard.getTemplate()) {
+ startingConfig = wizard.getTemplate().getConfiguration();
+ }
+
+ editor = new ConfigurationEditor(configDef, startingConfig);
+ }
+
+ return editor;
+ }
+
+ public boolean nextPage() {
+ return form.validate();
+ }
+
+ public boolean isPreviousEnabled() {
+ return true;
+ }
+
+ public boolean isNextEnabled() {
+ wizard.setConfig(editor.getConfiguration());
+ List<String> messages = ConfigurationUtility.validateConfiguration(wizard.getConfig(), wizard
+ .getBundleVersion().getConfigurationDefinition());
+ return messages.isEmpty();
+ }
+
+ public Configuration getConfiguration() {
+ return editor.getConfiguration();
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployNowStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployNowStep.java
new file mode 100644
index 0000000..e3bc504
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployNowStep.java
@@ -0,0 +1,92 @@
+/*
+ * 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.bundle.deploy;
+
+import java.util.LinkedHashMap;
+
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.RadioGroupItem;
+import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
+import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
+
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+
+public class DeployNowStep implements WizardStep {
+
+ private DynamicForm form;
+ private final BundleDeployWizard wizard;
+
+ private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
+
+ public DeployNowStep(BundleDeployWizard bundleCreationWizard) {
+ this.wizard = bundleCreationWizard;
+ }
+
+ public String getName() {
+ return "Deploy Now or Later";
+ }
+
+ public Canvas getCanvas() {
+ if (form == null) {
+ form = new DynamicForm();
+ form.setWidth100();
+ form.setNumCols(2);
+ form.setColWidths("50%", "*");
+
+ LinkedHashMap<String, Boolean> values = new LinkedHashMap<String, Boolean>();
+ values.put("Deploy Now", Boolean.TRUE);
+ values.put("Save Definition and Deploy Later", Boolean.FALSE);
+ final RadioGroupItem radioGroupItem = new RadioGroupItem("options", "Deploy Options");
+ radioGroupItem.setRequired(true);
+ radioGroupItem.setValueMap(values);
+ radioGroupItem.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent event) {
+ wizard.setDeployNow((Boolean) event.getValue());
+ enableNextButtonWhenAppropriate();
+ }
+ });
+
+ form.setItems(radioGroupItem);
+ }
+ return form;
+ }
+
+ public boolean nextPage() {
+ return form.validate();
+ }
+
+ public boolean isNextEnabled() {
+ return (null != this.wizard.getDeployNow());
+ }
+
+ public boolean isPreviousEnabled() {
+ return true;
+ }
+
+ private void enableNextButtonWhenAppropriate() {
+ this.wizard.getView().getNextButton().setDisabled(!isNextEnabled());
+ }
+
+ private boolean isNotEmpty(String s) {
+ return (s != null && s.trim().length() > 0);
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java
new file mode 100644
index 0000000..bbf30bf
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java
@@ -0,0 +1,136 @@
+/*
+ * 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.bundle.deploy;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.ui.HasHorizontalAlignment;
+import com.google.gwt.user.client.ui.Label;
+import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.Img;
+import com.smartgwt.client.widgets.layout.VLayout;
+
+import org.rhq.core.domain.bundle.BundleDeployDefinition;
+import org.rhq.core.domain.bundle.BundleDeployment;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
+
+public class DeployStep implements WizardStep {
+
+ private VLayout canvas;
+ private final BundleDeployWizard wizard;
+
+ private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
+
+ public DeployStep(BundleDeployWizard bundleCreationWizard) {
+ this.wizard = bundleCreationWizard;
+ }
+
+ public Canvas getCanvas() {
+ if (canvas == null) {
+ canvas = new VLayout();
+ canvas.setWidth100();
+ canvas.setHeight100();
+ canvas.setAlign(Alignment.CENTER);
+
+ final Img deployingImage = new Img("/images/status-bar.gif");
+ deployingImage.setLayoutAlign(Alignment.CENTER);
+ deployingImage.setWidth(50);
+ deployingImage.setHeight(15);
+
+ final Label deployingMessage = new Label("Deploying...");
+ deployingMessage.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
+
+ canvas.addMember(deployingImage);
+ canvas.addMember(deployingMessage);
+
+ if (wizard.isNewDefinition()) {
+ bundleServer.createBundleDeployDefinition(wizard.getBundleVersion().getId(), wizard.getName(), wizard
+ .getDescription(), wizard.getConfig(), false, -1, false,
+ new AsyncCallback<BundleDeployDefinition>() {
+ public void onSuccess(BundleDeployDefinition result) {
+ deployingImage.setSrc("/images/status_complete.gif");
+ deployingMessage.setText("Created Deploy Definition...");
+ CoreGUI.getMessageCenter().notify(
+ new Message("Created deploy definition [" + result.getName() + "] description ["
+ + result.getDescription(), Severity.Info));
+ wizard.setBundleDeployDefinition(result);
+ enableNextButtonWhenAppropriate();
+ }
+
+ public void onFailure(Throwable caught) {
+ deployingImage.setSrc("/images/status_error.gif");
+ deployingMessage.setText("Failed to create deply definition!");
+ CoreGUI.getErrorHandler().handleError(
+ "Failed to create deploy definition: " + caught.getMessage(), caught);
+ enableNextButtonWhenAppropriate();
+ }
+ });
+ }
+
+ bundleServer.scheduleBundleDeployment(wizard.getBundleDeployDefinition().getId(), wizard.getPlatformId(),
+ new AsyncCallback<BundleDeployment>() {
+ public void onSuccess(BundleDeployment result) {
+ deployingImage.setSrc("/images/status_complete.gif");
+ deployingMessage.setText("Bundle Deployment Scheduled!");
+ CoreGUI.getMessageCenter().notify(
+ new Message("Schedule bundle deployment [" + wizard.getBundleDeployDefinition().getName()
+ + "] resource [" + result.getResource() + "]", Severity.Info));
+ wizard.setBundleDeployment(result);
+ enableNextButtonWhenAppropriate();
+ }
+
+ public void onFailure(Throwable caught) {
+ deployingImage.setSrc("/images/status_error.gif");
+ deployingMessage.setText("Failed to Schedule Deployment!");
+ CoreGUI.getErrorHandler().handleError("Failed to schedule deployment: " + caught.getMessage(),
+ caught);
+ wizard.setBundleDeployment(null);
+ enableNextButtonWhenAppropriate();
+ }
+ });
+ }
+
+ return canvas;
+ }
+
+ public boolean nextPage() {
+ return this.wizard.getBundleVersion() != null;
+ }
+
+ public String getName() {
+ return "Deploy Bundle to Target Platforms";
+ }
+
+ public boolean isNextEnabled() {
+ return this.wizard.getBundleDeployment() != null;
+ }
+
+ public boolean isPreviousEnabled() {
+ return true;
+ }
+
+ private void enableNextButtonWhenAppropriate() {
+ this.wizard.getView().getNextButton().setDisabled(!isNextEnabled());
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleStep.java
new file mode 100644
index 0000000..1404567
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleStep.java
@@ -0,0 +1,112 @@
+/*
+ * 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.bundle.deploy;
+
+import java.util.LinkedHashMap;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.SelectItem;
+import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
+import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
+
+import org.rhq.core.domain.bundle.Bundle;
+import org.rhq.core.domain.criteria.BundleCriteria;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+
+/** Temporary step pending creation of Bundle navigatin screen */
+
+public class SelectBundleStep implements WizardStep {
+
+ private DynamicForm form;
+ private final BundleDeployWizard wizard;
+ private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
+
+ public SelectBundleStep(BundleDeployWizard bundleDeployWizard) {
+ this.wizard = bundleDeployWizard;
+ }
+
+ public String getName() {
+ return "Select Bundle to Deploy";
+ }
+
+ public Canvas getCanvas() {
+ if (form == null) {
+ form = new DynamicForm();
+ form.setWidth100();
+ form.setNumCols(2);
+ form.setColWidths("50%", "*");
+
+ // for now, get all the bundles
+ final BundleCriteria criteria = new BundleCriteria();
+ final LinkedHashMap<String, Bundle> bundleNames = new LinkedHashMap<String, Bundle>();
+
+ bundleServer.findBundlesByCriteria(criteria, new AsyncCallback<PageList<Bundle>>() {
+ public void onSuccess(PageList<Bundle> result) {
+ if (result.isEmpty()) {
+ onFailure(new IllegalArgumentException("No bundles defined."));
+ }
+ for (Bundle bundle : result) {
+ bundleNames.put(bundle.getName(), bundle);
+ }
+ }
+
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to find defined bundles.", caught);
+ }
+ });
+
+ final SelectItem selectBundle = new SelectItem("selectBundle", "Deployment Bundle");
+ selectBundle.setRequired(true);
+ selectBundle.setWidth(150);
+ selectBundle.setValueMap(bundleNames);
+ selectBundle.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent event) {
+ wizard.setBundle((Bundle) event.getValue());
+ enableNextButtonWhenAppropriate();
+ }
+ });
+
+ form.setItems(selectBundle);
+ }
+
+ return form;
+ }
+
+ public boolean nextPage() {
+ return form.validate();
+ }
+
+ public boolean isNextEnabled() {
+ return (null != this.wizard.getBundle());
+ }
+
+ public boolean isPreviousEnabled() {
+ return false;
+ }
+
+ private void enableNextButtonWhenAppropriate() {
+ this.wizard.getView().getNextButton().setDisabled(!isNextEnabled());
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleVersionStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleVersionStep.java
new file mode 100644
index 0000000..a34f34e
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleVersionStep.java
@@ -0,0 +1,115 @@
+/*
+ * 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.bundle.deploy;
+
+import java.util.LinkedHashMap;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.SelectItem;
+import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
+import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
+
+import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.core.domain.criteria.BundleVersionCriteria;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+
+/** Temporary step pending creation of BundleVersion navigation screen */
+
+public class SelectBundleVersionStep implements WizardStep {
+
+ private DynamicForm form;
+ private final BundleDeployWizard wizard;
+
+ private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
+
+ public SelectBundleVersionStep(BundleDeployWizard bundleDeployWizard) {
+ this.wizard = bundleDeployWizard;
+ }
+
+ public String getName() {
+ return "Select Version of Bundle to Deploy";
+ }
+
+ public Canvas getCanvas() {
+ if (form == null) {
+ form = new DynamicForm();
+ form.setWidth100();
+ form.setNumCols(2);
+ form.setColWidths("50%", "*");
+
+ // for now, get all the bundle versions for the bundle
+ final BundleVersionCriteria criteria = new BundleVersionCriteria();
+ criteria.addFilterBundleId(wizard.getBundle().getId());
+ criteria.fetchConfigurationDefinition(true);
+ final LinkedHashMap<String, BundleVersion> bundleVersions = new LinkedHashMap<String, BundleVersion>();
+
+ bundleServer.findBundleVersionsByCriteria(criteria, new AsyncCallback<PageList<BundleVersion>>() {
+ public void onSuccess(PageList<BundleVersion> result) {
+ if (result.isEmpty()) {
+ onFailure(new IllegalArgumentException("No bundle versions defined for bundle."));
+ }
+ for (BundleVersion bundleVersion : result) {
+ bundleVersions.put(bundleVersion.getVersion(), bundleVersion);
+ }
+ }
+
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to find defined bundles.", caught);
+ }
+ });
+
+ final SelectItem selectBundle = new SelectItem("selectBundle", "Deployment Bundle");
+ selectBundle.setRequired(true);
+ selectBundle.setWidth(150);
+ selectBundle.setValueMap(bundleVersions);
+ selectBundle.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent event) {
+ wizard.setBundleVersion((BundleVersion) event.getValue());
+ enableNextButtonWhenAppropriate();
+ }
+ });
+
+ form.setItems(selectBundle);
+ }
+
+ return form;
+ }
+
+ public boolean nextPage() {
+ return form.validate();
+ }
+
+ public boolean isNextEnabled() {
+ return (null != this.wizard.getBundle());
+ }
+
+ public boolean isPreviousEnabled() {
+ return true;
+ }
+
+ private void enableNextButtonWhenAppropriate() {
+ this.wizard.getView().getNextButton().setDisabled(!isNextEnabled());
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectPlatformsStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectPlatformsStep.java
new file mode 100644
index 0000000..d523fbe
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectPlatformsStep.java
@@ -0,0 +1,89 @@
+/*
+ * 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.bundle.deploy;
+
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.TextItem;
+import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
+import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
+
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+
+public class SelectPlatformsStep implements WizardStep {
+
+ private DynamicForm form;
+ private final BundleDeployWizard wizard;
+
+ private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
+
+ public SelectPlatformsStep(BundleDeployWizard bundleCreationWizard) {
+ this.wizard = bundleCreationWizard;
+ }
+
+ public Canvas getCanvas() {
+ if (form == null) {
+ form = new DynamicForm();
+ form.setWidth100();
+ form.setNumCols(2);
+ form.setColWidths("50%", "*");
+
+ // TODO: this is temporary until we have a resource selection step
+ final TextItem platformIdTextItem = new TextItem("platformId", "Platform Resource Id");
+ platformIdTextItem.setRequired(true);
+ platformIdTextItem.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent event) {
+ Object value = event.getValue();
+ if (value == null) {
+ value = "";
+ }
+ wizard.setSubtitle(value.toString());
+ wizard.setPlatformId(Integer.valueOf(value.toString()));
+ enableNextButtonWhenAppropriate();
+ }
+ });
+
+ form.setItems(platformIdTextItem);
+ }
+
+ return form;
+ }
+
+ public boolean nextPage() {
+ return form.validate();
+ }
+
+ public String getName() {
+ return "Select Target Platforms";
+ }
+
+ public boolean isNextEnabled() {
+ return (null != this.wizard.getPlatformId());
+ }
+
+ public boolean isPreviousEnabled() {
+ return true;
+ }
+
+ private void enableNextButtonWhenAppropriate() {
+ this.wizard.getView().getNextButton().setDisabled(!isNextEnabled());
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectTemplateStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectTemplateStep.java
new file mode 100644
index 0000000..982eb90
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectTemplateStep.java
@@ -0,0 +1,89 @@
+/*
+ * 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.bundle.deploy;
+
+import java.util.Map;
+
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.SelectItem;
+import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
+import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
+
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.configuration.definition.ConfigurationTemplate;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+
+public class SelectTemplateStep implements WizardStep {
+
+ private DynamicForm form;
+ private final BundleDeployWizard wizard;
+
+ //private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
+
+ public SelectTemplateStep(BundleDeployWizard bundleDeployWizard) {
+ this.wizard = bundleDeployWizard;
+ }
+
+ public String getName() {
+ return "Select a Configuration Template";
+ }
+
+ public Canvas getCanvas() {
+ if (form == null) {
+ form = new DynamicForm();
+ form.setWidth100();
+ form.setNumCols(2);
+ form.setColWidths("50%", "*");
+
+ SelectItem selectTemplate = new SelectItem("template", "Template");
+ selectTemplate.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent event) {
+ wizard.setTemplate((ConfigurationTemplate) event.getValue());
+ }
+ });
+
+ ConfigurationDefinition definition = wizard.getBundleVersion().getConfigurationDefinition();
+ Map<String, ConfigurationTemplate> templates = definition.getTemplates();
+
+ if (templates != null && !templates.isEmpty()) {
+ selectTemplate.setValueMap(templates.keySet().toArray(new String[templates.size()]));
+ } else {
+ selectTemplate.setDisabled(true);
+ }
+
+ form.setItems(selectTemplate);
+ }
+
+ this.wizard.getView().getNextButton().setDisabled(false);
+ return form;
+ }
+
+ public boolean nextPage() {
+ return form.validate();
+ }
+
+ public boolean isPreviousEnabled() {
+ return false;
+ }
+
+ public boolean isNextEnabled() {
+ return true;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java
index 1b0f296..82d6166 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java
@@ -24,24 +24,37 @@ import java.util.HashMap;
import com.google.gwt.user.client.rpc.RemoteService;
import org.rhq.core.domain.bundle.Bundle;
+import org.rhq.core.domain.bundle.BundleDeployDefinition;
+import org.rhq.core.domain.bundle.BundleDeployment;
import org.rhq.core.domain.bundle.BundleType;
import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.criteria.BundleCriteria;
+import org.rhq.core.domain.criteria.BundleVersionCriteria;
import org.rhq.core.domain.util.PageList;
public interface BundleGWTService extends RemoteService {
- ArrayList<BundleType> getAllBundleTypes();
-
- PageList<Bundle> findBundlesByCriteria(BundleCriteria criteria) throws Exception;
Bundle createBundle(String name, int bundleTypeId) throws Exception;
- BundleVersion createBundleVersion(int bundleId, String name, String version, String recipe) throws Exception;
-
BundleVersion createBundleAndBundleVersion(String bundleName, int bundleTypeId, String name, String version,
String description, String recipe) throws Exception;
- HashMap<String, Boolean> getAllBundleVersionFilenames(int bundleVersionId) throws Exception;
+ BundleDeployDefinition createBundleDeployDefinition(int bundleVersionId, String name, String description,
+ Configuration configuration, boolean enforcePolicy, int enforcementInterval, boolean pinToBundle)
+ throws Exception;
+
+ BundleVersion createBundleVersion(int bundleId, String name, String version, String recipe) throws Exception;
void deleteBundleVersion(int bundleVersionId);
+
+ PageList<Bundle> findBundlesByCriteria(BundleCriteria criteria) throws Exception;
+
+ PageList<BundleVersion> findBundleVersionsByCriteria(BundleVersionCriteria criteria) throws Exception;
+
+ HashMap<String, Boolean> getAllBundleVersionFilenames(int bundleVersionId) throws Exception;
+
+ ArrayList<BundleType> getAllBundleTypes();
+
+ BundleDeployment scheduleBundleDeployment(int bundleDeployDefinitionId, int resourceId) throws Exception;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
index a4de053..4cc3293 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
@@ -22,8 +22,11 @@ import java.util.ArrayList;
import java.util.HashMap;
import org.rhq.core.domain.bundle.Bundle;
+import org.rhq.core.domain.bundle.BundleDeployDefinition;
+import org.rhq.core.domain.bundle.BundleDeployment;
import org.rhq.core.domain.bundle.BundleType;
import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.criteria.BundleCriteria;
import org.rhq.core.domain.criteria.BundleVersionCriteria;
import org.rhq.core.domain.util.PageList;
@@ -38,73 +41,87 @@ public class BundleGWTServiceImpl extends AbstractGWTServiceImpl implements Bund
private BundleManagerLocal bundleManager = LookupUtil.getBundleManager();
- public void deleteBundleVersion(int bundleVersionId) {
+ public Bundle createBundle(String name, int bundleTypeId) throws Exception {
+ Bundle results;
try {
- bundleManager.deleteBundleVersion(getSessionSubject(), bundleVersionId);
+ results = bundleManager.createBundle(getSessionSubject(), name, null, bundleTypeId);
} catch (Exception e) {
- throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ throw new Exception(ThrowableUtil.getAllMessages(e));
}
+ return SerialUtility.prepare(results, "createBundle");
}
- public ArrayList<BundleType> getAllBundleTypes() {
+ public BundleVersion createBundleAndBundleVersion(String bundleName, int bundleTypeId, String name, String version,
+ String description, String recipe) throws Exception {
+
+ BundleVersion results;
try {
- ArrayList<BundleType> bundleTypes = new ArrayList<BundleType>();
- bundleTypes.addAll(bundleManager.getAllBundleTypes(getSessionSubject()));
- return SerialUtility.prepare(bundleTypes, "getBundleTypes");
+ results = bundleManager.createBundleAndBundleVersion(getSessionSubject(), bundleName, description,
+ bundleTypeId, name, null, version, recipe);
} catch (Exception e) {
throw new RuntimeException(ThrowableUtil.getAllMessages(e));
}
+ return SerialUtility.prepare(results, "createBundleAndBundleVersion");
}
- public PageList<Bundle> findBundlesByCriteria(BundleCriteria criteria) {
+ public BundleDeployDefinition createBundleDeployDefinition(int bundleVersionId, String name, String description,
+ Configuration configuration, boolean enforcePolicy, int enforcementInterval, boolean pinToBundle)
+ throws Exception {
+
try {
- PageList<Bundle> results = bundleManager.findBundlesByCriteria(getSessionSubject(), criteria);
- return SerialUtility.prepare(results, "findBundlesByCriteria");
+ BundleDeployDefinition result = bundleManager.createBundleDeployDefinition(getSessionSubject(),
+ bundleVersionId, name, description, configuration, enforcePolicy, enforcementInterval, pinToBundle);
+
+ return SerialUtility.prepare(result, "createBundleDeployDefinition");
} catch (Exception e) {
- throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ throw new Exception(ThrowableUtil.getAllMessages(e));
}
}
- public PageList<BundleVersion> findBundleVersionsByCriteria(BundleVersionCriteria criteria) {
+ public BundleVersion createBundleVersion(int bundleId, String name, String version, String recipe) throws Exception {
+ BundleVersion results;
try {
- PageList<BundleVersion> results = bundleManager.findBundleVersionsByCriteria(getSessionSubject(), criteria);
- return SerialUtility.prepare(results, "findBundleVersionsByCriteria");
+ results = bundleManager.createBundleVersion(getSessionSubject(), bundleId, name, null, version, recipe);
} catch (Exception e) {
- throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ throw new Exception(ThrowableUtil.getAllMessages(e));
}
+ return SerialUtility.prepare(results, "createBundleVersion");
}
- public Bundle createBundle(String name, int bundleTypeId) throws Exception {
- Bundle results;
+ public void deleteBundleVersion(int bundleVersionId) {
try {
- results = bundleManager.createBundle(getSessionSubject(), name, null, bundleTypeId);
+ bundleManager.deleteBundleVersion(getSessionSubject(), bundleVersionId);
} catch (Exception e) {
- throw new Exception(ThrowableUtil.getAllMessages(e));
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
}
- return SerialUtility.prepare(results, "createBundle");
}
- public BundleVersion createBundleVersion(int bundleId, String name, String version, String recipe) throws Exception {
- BundleVersion results;
+ public PageList<Bundle> findBundlesByCriteria(BundleCriteria criteria) {
try {
- results = bundleManager.createBundleVersion(getSessionSubject(), bundleId, name, null, version, recipe);
+ PageList<Bundle> results = bundleManager.findBundlesByCriteria(getSessionSubject(), criteria);
+ return SerialUtility.prepare(results, "findBundlesByCriteria");
} catch (Exception e) {
- throw new Exception(ThrowableUtil.getAllMessages(e));
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
}
- return SerialUtility.prepare(results, "createBundleVersion");
}
- public BundleVersion createBundleAndBundleVersion(String bundleName, int bundleTypeId, String name, String version,
- String description, String recipe) throws Exception {
+ public PageList<BundleVersion> findBundleVersionsByCriteria(BundleVersionCriteria criteria) {
+ try {
+ PageList<BundleVersion> results = bundleManager.findBundleVersionsByCriteria(getSessionSubject(), criteria);
+ return SerialUtility.prepare(results, "findBundleVersionsByCriteria");
+ } catch (Exception e) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ }
+ }
- BundleVersion results;
+ public ArrayList<BundleType> getAllBundleTypes() {
try {
- results = bundleManager.createBundleAndBundleVersion(getSessionSubject(), bundleName, description,
- bundleTypeId, name, null, version, recipe);
+ ArrayList<BundleType> bundleTypes = new ArrayList<BundleType>();
+ bundleTypes.addAll(bundleManager.getAllBundleTypes(getSessionSubject()));
+ return SerialUtility.prepare(bundleTypes, "getBundleTypes");
} catch (Exception e) {
throw new RuntimeException(ThrowableUtil.getAllMessages(e));
}
- return SerialUtility.prepare(results, "createBundleAndBundleVersion");
}
public HashMap<String, Boolean> getAllBundleVersionFilenames(int bundleVersionId) throws Exception {
@@ -117,4 +134,13 @@ public class BundleGWTServiceImpl extends AbstractGWTServiceImpl implements Bund
return SerialUtility.prepare(results, "getAllBundleVersionFilenames");
}
+ public BundleDeployment scheduleBundleDeployment(int bundleDeployDefinitionId, int resourceId) throws Exception {
+ try {
+ BundleDeployment result = bundleManager.scheduleBundleDeployment(getSessionSubject(),
+ bundleDeployDefinitionId, resourceId);
+ return SerialUtility.prepare(result, "scheduleBundleDeployment");
+ } catch (Exception e) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ }
+ }
}
\ No newline at end of file
commit fc2db3fbf1bc16dcedb1bf5f3e20e5e627252eb4
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Fri Mar 19 10:32:23 2010 -0400
BundleWizard improvements
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
index 46bee74..852e765 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
@@ -18,29 +18,42 @@
*/
package org.rhq.enterprise.gui.coregui.client.bundle;
+import com.smartgwt.client.types.VisibilityMode;
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.HLayout;
+import com.smartgwt.client.widgets.layout.SectionStack;
+import com.smartgwt.client.widgets.layout.SectionStackSection;
import org.rhq.enterprise.gui.coregui.client.bundle.create.BundleCreationWizard;
+import org.rhq.enterprise.gui.coregui.client.bundle.list.BundlesListView;
/**
* @author Greg Hinkle
*/
public class BundleTopView extends HLayout {
+
+ public BundleTopView() {
+ setWidth100();
+ setHeight100();
+ }
+
@Override
protected void onDraw() {
super.onDraw();
- IButton addButton = new IButton("New Bundle");
- addButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- new BundleCreationWizard().startBundleWizard();
- }
- });
+ SectionStack sectionStack = new SectionStack();
+ sectionStack.setShowResizeBar(true);
+ sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE);
+ sectionStack.setWidth(250);
+ sectionStack.setHeight100();
+
+ sectionStack.addSection(new SectionStackSection("Bundles"));
+
+ addMember(sectionStack);
- addMember(addButton);
+ addMember(new BundlesListView());
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java
index 00a26a3..933c70e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java
@@ -42,7 +42,7 @@ public class BundleCreationWizard extends AbstractBundleWizard {
ArrayList<WizardStep> steps = new ArrayList<WizardStep>();
steps.add(new BundleInfoStep(this));
steps.add(new BundleUploadRecipeStep(this));
- steps.add(new BundleVerificationStep(this));
+// steps.add(new BundleVerificationStep(this));
steps.add(new BundleUploadDataStep(this));
setSteps(steps);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
index 0397a48..95791a3 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
@@ -21,8 +21,12 @@ package org.rhq.enterprise.gui.coregui.client.bundle.create;
import java.util.ArrayList;
import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.types.TitleOrientation;
import com.smartgwt.client.widgets.Canvas;
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.TextAreaItem;
import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
@@ -35,6 +39,9 @@ import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+/**
+ * @author John Mazzitelli
+ */
public class BundleInfoStep implements WizardStep {
private DynamicForm form;
@@ -52,81 +59,55 @@ public class BundleInfoStep implements WizardStep {
public Canvas getCanvas() {
if (form == null) {
form = new DynamicForm();
+ form.setPadding(20);
form.setWidth100();
form.setNumCols(2);
- form.setColWidths("50%", "*");
-
- BundleVersion initialBundleVersion = wizard.getBundleVersion();
nameTextItem = new TextItem("name", "Name");
nameTextItem.setRequired(true);
- if (initialBundleVersion == null) {
- nameTextItem.setValue("");
- nameTextItem.addChangedHandler(new ChangedHandler() {
- public void onChanged(ChangedEvent event) {
- Object value = event.getValue();
- if (value == null) {
- value = "";
- }
- wizard.setSubtitle(value.toString());
- wizard.setBundleName(value.toString());
- enableNextButtonWhenAppropriate();
- }
- });
- } else {
- nameTextItem.setValue(initialBundleVersion.getName());
- nameTextItem.setDisabled(true);
- }
+ nameTextItem.setTitleAlign(Alignment.LEFT);
+ nameTextItem.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent event) {
+ String value = form.getValueAsString("name");
+ wizard.setSubtitle(value);
+ }
+ });
+
final TextItem previousVersionTextItem = new TextItem("previousVersion", "Previous Version");
- if (initialBundleVersion == null) {
- previousVersionTextItem.setVisible(Boolean.FALSE);
- } else {
- previousVersionTextItem.setValue(initialBundleVersion.getVersion());
- previousVersionTextItem.setDisabled(true);
- }
+ previousVersionTextItem.setTitleAlign(Alignment.LEFT);
versionTextItem = new TextItem("version");
- if (initialBundleVersion == null) {
- versionTextItem.setTitle("Initial Version");
- String versionSuggestion = "1.0";
- versionTextItem.setValue(versionSuggestion);
- wizard.setBundleVersionString(versionSuggestion);
- } else {
+
+ versionTextItem.setTitleAlign(Alignment.LEFT);
+
+ descriptionTextAreaItem = new TextAreaItem("description", "Description");
+ descriptionTextAreaItem.setTitleOrientation(TitleOrientation.TOP);
+ descriptionTextAreaItem.setColSpan(2);
+ descriptionTextAreaItem.setWidth(300);
+
+ form.setItems(nameTextItem, previousVersionTextItem, versionTextItem, descriptionTextAreaItem);
+
+
+ BundleVersion initialBundleVersion = wizard.getBundleVersion();
+ if (initialBundleVersion != null) {
+ form.setValue("name", initialBundleVersion.getName());
+ nameTextItem.setDisabled(true);
+
+ form.setValue("previousVersion", initialBundleVersion.getVersion());
+ previousVersionTextItem.setDisabled(true);
+
versionTextItem.setTitle("New Version");
String versionSuggestion = autoIncrementVersion(initialBundleVersion.getVersion());
- versionTextItem.setValue(versionSuggestion);
- wizard.setBundleVersionString(versionSuggestion);
- }
- versionTextItem.addChangedHandler(new ChangedHandler() {
- public void onChanged(ChangedEvent event) {
- Object value = event.getValue();
- if (value == null) {
- value = "";
- }
- wizard.setBundleVersionString(value.toString());
- enableNextButtonWhenAppropriate();
- }
- });
+ form.setValue("version", versionSuggestion);
+
+ form.setValue("description", initialBundleVersion.getDescription());
- descriptionTextAreaItem = new TextAreaItem("description", "Description");
- if (initialBundleVersion == null) {
- descriptionTextAreaItem.setValue("");
} else {
- descriptionTextAreaItem.setValue(initialBundleVersion.getDescription());
+ previousVersionTextItem.setVisible(Boolean.FALSE);
+ versionTextItem.setTitle("Initial Version");
+ form.setValue("version", "1.0");
}
- descriptionTextAreaItem.addChangedHandler(new ChangedHandler() {
- public void onChanged(ChangedEvent event) {
- Object value = event.getValue();
- if (value == null) {
- value = "";
- }
- wizard.setBundleDescription(value.toString());
- enableNextButtonWhenAppropriate();
- }
- });
-
- form.setItems(nameTextItem, previousVersionTextItem, versionTextItem, descriptionTextAreaItem);
if (wizard.getBundleType() == null) {
// TODO: we should get all bundle types in a drop down menu and let the user pick
@@ -134,7 +115,6 @@ public class BundleInfoStep implements WizardStep {
bundleServer.getAllBundleTypes(new AsyncCallback<ArrayList<BundleType>>() {
public void onSuccess(ArrayList<BundleType> result) {
wizard.setBundleType(result.get(0));
- enableNextButtonWhenAppropriate();
}
public void onFailure(Throwable caught) {
@@ -143,7 +123,6 @@ public class BundleInfoStep implements WizardStep {
});
}
- enableNextButtonWhenAppropriate();
} else {
if (wizard.getBundleVersion() != null) {
// we are traversing back to this step - don't allow changes if we've already created the bundle version
@@ -152,34 +131,37 @@ public class BundleInfoStep implements WizardStep {
descriptionTextAreaItem.setDisabled(Boolean.TRUE);
}
}
+
+
+ form.addItemChangedHandler(new ItemChangedHandler() {
+ public void onItemChanged(ItemChangedEvent itemChangedEvent) {
+ enableNextButtonWhenAppropriate();
+ }
+ });
+
return form;
}
public boolean nextPage() {
- boolean ok = form.validate();
- return ok;
+ if (form.validate()) {
+ wizard.setBundleName(form.getValueAsString("name"));
+ wizard.setBundleVersionString(form.getValueAsString("version"));
+ wizard.setBundleDescription(form.getValueAsString("description"));
+
+ return true;
+ }
+ return false;
}
public String getName() {
return "Provide Bundle Information";
}
- public boolean isNextEnabled() {
- return isNotEmpty(this.wizard.getBundleName()) && isNotEmpty(this.wizard.getBundleVersionString())
- && this.wizard.getBundleType() != null;
- }
-
- public boolean isPreviousEnabled() {
- return false;
- }
private void enableNextButtonWhenAppropriate() {
- this.wizard.getView().getNextButton().setDisabled(!isNextEnabled());
+ this.wizard.getView().getNextButton().setDisabled(!(form.validate() && this.wizard.getBundleType() != null));
}
- private boolean isNotEmpty(String s) {
- return (s != null && s.trim().length() > 0);
- }
private String autoIncrementVersion(String oldVersion) {
String newVersion = "1.0";
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
index d7aefbe..84a2a09 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
@@ -18,20 +18,27 @@
*/
package org.rhq.enterprise.gui.coregui.client.bundle.create;
+import java.util.HashMap;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.Img;
import com.smartgwt.client.widgets.form.fields.CanvasItem;
import com.smartgwt.client.widgets.form.fields.LinkItem;
import com.smartgwt.client.widgets.form.fields.TextAreaItem;
-import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
-import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
+import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.upload.DynamicCallbackForm;
import org.rhq.enterprise.gui.coregui.client.components.upload.DynamicFormHandler;
import org.rhq.enterprise.gui.coregui.client.components.upload.DynamicFormSubmitCompleteEvent;
import org.rhq.enterprise.gui.coregui.client.components.upload.TextFileRetrieverForm;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
public class BundleUploadRecipeStep implements WizardStep {
@@ -47,8 +54,9 @@ public class BundleUploadRecipeStep implements WizardStep {
if (form == null) {
form = new DynamicCallbackForm("uploadRecipeStepForm");
form.setWidth100();
- form.setNumCols(1);
form.setMargin(Integer.valueOf(20));
+ form.setShowInlineErrors(false);
+
final LinkItem showUpload = new LinkItem("showUpload");
showUpload.setValue("Click To Upload A Recipe File");
@@ -70,18 +78,10 @@ public class BundleUploadRecipeStep implements WizardStep {
recipe = new TextAreaItem("recipe");
recipe.setShowTitle(false);
recipe.setRequired(true);
+ recipe.setColSpan(2);
recipe.setWidth("*");
- recipe.setHeight("*");
- recipe.addChangedHandler(new ChangedHandler() {
- public void onChanged(ChangedEvent event) {
- Object value = event.getValue();
- if (value == null) {
- value = "";
- }
- wizard.setRecipe(value.toString());
- enableNextButtonWhenAppropriate();
- }
- });
+ recipe.setHeight(220);
+
textFileRetrieverForm.addFormHandler(new DynamicFormHandler() {
public void onSubmitComplete(DynamicFormSubmitCompleteEvent event) {
@@ -90,11 +90,15 @@ public class BundleUploadRecipeStep implements WizardStep {
textFileRetrieverForm.retrievalStatus(true);
form.showItem("showUpload");
form.hideItem("upload");
- enableNextButtonWhenAppropriate();
+// enableNextButtonWhenAppropriate();
}
});
- form.setItems(showUpload, upload, recipe);
+ CanvasItem validating = new CanvasItem("validating", "Validating");
+ validating.setCanvas(new Img("ajax-loader.gif", 16, 16));
+ validating.setVisible(false);
+
+ form.setItems(showUpload, upload, recipe, validating);
form.hideItem("upload");
} else {
// we are traversing back to this step - don't allow the recipe to change if we've already created the bundle version
@@ -109,22 +113,59 @@ public class BundleUploadRecipeStep implements WizardStep {
}
public boolean nextPage() {
- return form.validate();
+
+ if (wizard.getBundleVersion() != null) {
+ return true;
+ } else {
+ if (form.validate()) {
+ validateAndCreateRecipe();
+ }
+ return false;
+ }
+
}
public String getName() {
return "Provide Bundle Recipe";
}
- public boolean isNextEnabled() {
- return this.wizard.getRecipe() != null && this.wizard.getRecipe().trim().length() > 0;
- }
- public boolean isPreviousEnabled() {
- return true;
- }
+ private void validateAndCreateRecipe() {
+ form.showItem("validating");
+
+ wizard.setRecipe(form.getValueAsString("recipe"));
+
+
+ BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
+ bundleServer.createBundleAndBundleVersion(
+ this.wizard.getBundleName(),
+ this.wizard.getBundleType().getId(),
+ this.wizard.getBundleName(),
+ this.wizard.getBundleVersionString(),
+ this.wizard.getBundleDescription(),
+ this.wizard.getRecipe(),
+ new AsyncCallback<BundleVersion>() {
+ public void onSuccess(BundleVersion result) {
+ form.hideItem("validating");
- private void enableNextButtonWhenAppropriate() {
- this.wizard.getView().getNextButton().setDisabled(!isNextEnabled());
+ CoreGUI.getMessageCenter().notify(
+ new Message("Created bundle [" + result.getName() + "] version [" + result.getVersion() + "]",
+ Message.Severity.Info));
+ wizard.setBundleVersion(result);
+ wizard.getView().incrementStep();
+ }
+
+ public void onFailure(Throwable caught) {
+ form.hideItem("validating");
+
+ HashMap<String, String> errors = new HashMap<String, String>();
+ errors.put("recipe", "Invalid Recipe: " + caught.getMessage());
+ form.setErrors(errors, true);
+ CoreGUI.getErrorHandler().handleError("Failed to create bundle: " + caught.getMessage(), caught);
+ wizard.setBundleVersion(null);
+// enableNextButtonWhenAppropriate();
+ }
+ });
}
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java
index 46fe479..b418d98 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java
@@ -67,27 +67,6 @@ public class BundleVerificationStep implements WizardStep {
canvas.addMember(verifyingImage);
canvas.addMember(verifiedMessage);
- bundleServer.createBundleAndBundleVersion(this.wizard.getBundleName(), this.wizard.getBundleType().getId(),
- this.wizard.getBundleName(), this.wizard.getBundleVersionString(), this.wizard.getBundleDescription(),
- this.wizard.getRecipe(), new AsyncCallback<BundleVersion>() {
- public void onSuccess(BundleVersion result) {
- verifyingImage.setSrc("/images/status_complete.gif");
- verifiedMessage.setText("Verified!");
- CoreGUI.getMessageCenter().notify(
- new Message("Created bundle [" + result.getName() + "] version [" + result.getVersion() + "]",
- Severity.Info));
- wizard.setBundleVersion(result);
- enableNextButtonWhenAppropriate();
- }
-
- public void onFailure(Throwable caught) {
- verifyingImage.setSrc("/images/status_error.gif");
- verifiedMessage.setText("Failed!");
- CoreGUI.getErrorHandler().handleError("Failed to create bundle: " + caught.getMessage(), caught);
- wizard.setBundleVersion(null);
- enableNextButtonWhenAppropriate();
- }
- });
return canvas;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesDataSource.java
new file mode 100644
index 0000000..50e6214
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesDataSource.java
@@ -0,0 +1,98 @@
+/*
+ * 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.bundle.list;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.data.fields.DataSourceIntegerField;
+import com.smartgwt.client.data.fields.DataSourceTextField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+import org.rhq.core.domain.bundle.Bundle;
+import org.rhq.core.domain.criteria.BundleCriteria;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+
+/**
+ * @author Greg Hinkle
+ */
+public class BundlesDataSource extends RPCDataSource<Bundle> {
+
+ private BundleGWTServiceAsync bundleService = GWTServiceLookup.getBundleService();
+
+ public BundlesDataSource() {
+
+ DataSourceIntegerField idField = new DataSourceIntegerField("id","ID");
+ idField.setPrimaryKey(true);
+ addField(idField);
+
+
+ DataSourceTextField nameField = new DataSourceTextField("name","Name");
+ addField(nameField);
+
+ DataSourceTextField descriptionField = new DataSourceTextField("description","Description");
+ addField(descriptionField);
+
+ }
+
+ @Override
+ protected void executeFetch(final DSRequest request, final DSResponse response) {
+
+ BundleCriteria criteria = new BundleCriteria();
+ criteria.setPageControl(getPageControl(request));
+
+ bundleService.findBundlesByCriteria(criteria, new AsyncCallback<PageList<Bundle>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load bundle data",caught);
+ response.setStatus(DSResponse.STATUS_FAILURE);
+ processResponse(request.getRequestId(),response);
+ }
+
+ public void onSuccess(PageList<Bundle> result) {
+ response.setData(buildRecords(result));
+ response.setTotalRows(result.getTotalSize());
+ processResponse(request.getRequestId(), response);
+ }
+ });
+
+ }
+
+ @Override
+ public Bundle copyValues(ListGridRecord from) {
+ return null; // TODO: Implement this method.
+ }
+
+ @Override
+ public ListGridRecord copyValues(Bundle from) {
+ ListGridRecord record = new ListGridRecord();
+
+ record.setAttribute("id",from.getId());
+ record.setAttribute("name",from.getName());
+ record.setAttribute("description",from.getDescription());
+ record.setAttribute("bundleType",from.getBundleType());
+ record.setAttribute("repos",from.getRepo());
+
+ return record;
+
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
new file mode 100644
index 0000000..89b69fa
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
@@ -0,0 +1,65 @@
+/*
+ * 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.bundle.list;
+
+import com.smartgwt.client.types.SelectionAppearance;
+import com.smartgwt.client.types.SelectionStyle;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.layout.VLayout;
+
+import org.rhq.enterprise.gui.coregui.client.bundle.create.BundleCreationWizard;
+import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
+
+/**
+ * @author Greg Hinkle
+ */
+public class BundlesListView extends VLayout {
+
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+
+ Table table = new Table("Bundles");
+
+ table.setDataSource(new BundlesDataSource());
+
+ table.getListGrid().getField("id").setWidth("60");
+ table.getListGrid().getField("name").setWidth("25%");
+ table.getListGrid().getField("description").setWidth("*");
+
+ table.getListGrid().setSelectionType(SelectionStyle.SIMPLE);
+ table.getListGrid().setSelectionAppearance(SelectionAppearance.CHECKBOX);
+
+
+ table.addTableAction("Create Bundle", Table.SelectionEnablement.ALWAYS, null,
+ new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ new BundleCreationWizard().startBundleWizard();
+
+ }
+ });
+
+
+
+ addMember(table);
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardStep.java
index c3655f8..f9fe66b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardStep.java
@@ -30,8 +30,4 @@ public interface WizardStep {
boolean nextPage();
String getName();
-
- boolean isPreviousEnabled();
-
- boolean isNextEnabled();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
index 07025a9..c92c0f2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
@@ -70,6 +70,7 @@ public class WizardView extends VLayout {
titleBar = new HLayout(30);
titleBar.setHeight(50);
+ titleBar.setPadding(10);
titleBar.setBackgroundColor("#F0F0F0");
titleLabel = new HTMLFlow();
refreshTitleLabelContents();
@@ -85,6 +86,7 @@ public class WizardView extends VLayout {
stepTitleLabel = new Label();
stepTitleLabel.setWidth100();
stepTitleLabel.setHeight(40);
+ stepTitleLabel.setPadding(20);
stepTitleLabel.setStyleName("HeaderLabel");
addMember(stepTitleLabel);
@@ -92,6 +94,7 @@ public class WizardView extends VLayout {
contentLayout = new HLayout();
contentLayout.setHeight("*");
contentLayout.setWidth100();
+ contentLayout.setPadding(10);
addMember(contentLayout);
@@ -113,7 +116,7 @@ public class WizardView extends VLayout {
*/
public void refreshTitleLabelContents() {
this.titleLabel.setContents("<span class=\"HeaderLabel\">" + wizard.getTitle() + "</span><br/>"
- + (wizard.getSubtitle() != null ? wizard.getSubtitle() : ""));
+ + (wizard.getSubtitle() != null ? wizard.getSubtitle() : ""));
}
private void setupButtons() {
@@ -158,18 +161,10 @@ public class WizardView extends VLayout {
stepTitleLabel.setContents(step.getName());
- if (stepIndex == 0) {
- previousButton.setDisabled(true);
- } else {
- previousButton.setDisabled(!step.isPreviousEnabled());
- }
+ previousButton.setDisabled(stepIndex == 0);
boolean last = (stepIndex == (wizard.getSteps().size() - 1));
- if (last) {
- nextButton.setDisabled(true);
- } else {
- nextButton.setDisabled(!step.isNextEnabled());
- }
+ nextButton.setDisabled(last);
for (IButton button : customButtons) {
buttonBar.removeMember(button);
@@ -231,4 +226,8 @@ public class WizardView extends VLayout {
public ArrayList<IButton> getCustomButtons() {
return customButtons;
}
+
+ public void incrementStep() {
+ setStep(currentStep + 1);
+ }
}
commit 520ab6ca9cea24192dfbe7cd2d22ffe46bdd9841
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Fri Mar 19 10:31:52 2010 -0400
L&F improvements
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java
index a52f987..faf5121 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java
@@ -122,6 +122,7 @@ public class MessageCenterView extends HLayout implements MessageCenter.MessageL
StaticTextItem detail = new StaticTextItem("detail","Detail");
detail.setTitleOrientation(TitleOrientation.TOP);
detail.setValue(message.detail);
+ detail.setColSpan(2);
ButtonItem okButton = new ButtonItem("Ok","Ok");
okButton.setColSpan(2);
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/header/header_bg.png b/modules/enterprise/gui/coregui/src/main/webapp/images/header/header_bg.png
new file mode 100644
index 0000000..9b4b298
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/header/header_bg.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/header/header_bg_line.png b/modules/enterprise/gui/coregui/src/main/webapp/images/header/header_bg_line.png
new file mode 100644
index 0000000..5a33211
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/header/header_bg_line.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/header/header_bg_selected.png b/modules/enterprise/gui/coregui/src/main/webapp/images/header/header_bg_selected.png
new file mode 100644
index 0000000..896d805
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/header/header_bg_selected.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/header/rhq_logo_28px.png b/modules/enterprise/gui/coregui/src/main/webapp/images/header/rhq_logo_28px.png
new file mode 100644
index 0000000..6d95fda
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/header/rhq_logo_28px.png differ
commit e4c7b9dbe2623b61d2b6e8f38d487da6f94f9293
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Thu Mar 18 16:16:28 2010 -0400
Prettier menubar
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/measurement/MeasurementRangeEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/measurement/MeasurementRangeEditor.java
index e9417bc..fed0fd9 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/measurement/MeasurementRangeEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/measurement/MeasurementRangeEditor.java
@@ -59,6 +59,8 @@ public class MeasurementRangeEditor extends DynamicForm {
public MeasurementRangeEditor() {
setNumCols(10);
setHeight(40);
+ setWrapItemTitles(false);
+ setWidth(250);
}
@Override
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/GraphListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/GraphListView.java
index 4cfc2da..71be91d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/GraphListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/GraphListView.java
@@ -25,6 +25,7 @@ import org.rhq.core.domain.measurement.composite.MeasurementDataNumericHighLowCo
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.components.measurement.MeasurementRangeEditor;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
@@ -68,6 +69,8 @@ public class GraphListView extends VLayout implements ResourceSelectListener {
addMember(loadingLabel);
+ addMember(new MeasurementRangeEditor());
+
if (resource != null) {
buildGraphs();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
index 9328e5b..8362754 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
@@ -18,108 +18,144 @@
*/
package org.rhq.enterprise.gui.coregui.client.menu;
-import java.util.LinkedHashMap;
-
+import com.google.gwt.event.logical.shared.ValueChangeEvent;
+import com.google.gwt.event.logical.shared.ValueChangeHandler;
+import com.google.gwt.user.client.History;
import com.google.gwt.user.client.ui.Hyperlink;
-import com.smartgwt.client.types.Alignment;
-import com.smartgwt.client.types.VerticalAlignment;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.Img;
-import com.smartgwt.client.widgets.layout.HLayout;
+import com.smartgwt.client.widgets.layout.LayoutSpacer;
import com.smartgwt.client.widgets.layout.VLayout;
-import com.smartgwt.client.widgets.menu.Menu;
-import com.smartgwt.client.widgets.menu.MenuBar;
+import com.smartgwt.client.widgets.toolbar.ToolStrip;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.AboutModalWindow;
/**
* @author Greg Hinkle
*/
-public class MenuBarView extends HLayout {
+public class MenuBarView extends VLayout {
+
+ private AboutModalWindow aboutModalWindow;
- MenuBar menuBar;
+ public static final String[] SECTIONS = {"Dashboard", "Demo", "Inventory", "Bundles", "Administration"};
- LinkedHashMap<String, Menu> menus = new LinkedHashMap<String, Menu>();
+ private String selected = "Dashboard";
- private AboutModalWindow aboutModalWindow;
+ HTMLFlow linksPane;
public MenuBarView() {
- setHeight(30);
- setAlign(VerticalAlignment.BOTTOM);
- setAlign(Alignment.LEFT);
- /*
- menuBar = new MenuBar();
- menuBar.setBackgroundColor("gray");
-
-
- Menu icon = new Menu();
- icon.setTitle("iManage");
- icon.addItem(new MenuItem("Dashboard"));
- menuBar.addMenus(new Menu[]{icon},0);
-
- Menu overview = new Menu();
- overview.setTitle("Applications");
- overview.addItem(new MenuItem("Content Configuration"));
- overview.addItem(new MenuItem("Monitoring"));
- overview.addItem(new MenuItem("Administration"));
- menuBar.addMenus(new Menu[]{overview},1);
-
- Menu views = new Menu();
- views.setTitle("Views");
- views.addItem(new MenuItem("Problems"));
- views.addItem(new MenuItem("Configuration Changes"));
- views.addItem(new MenuItem("Content Changes"));
- views.addItem(new MenuItem("Recent Administration"));
- menuBar.addMenus(new Menu[]{views},2);
-
- menuBar.setWidth100();
-
- addChild(menuBar);
- setWidth100();*/
+ super(5);
+ setHeight(50);
+ setWidth100();
+
+ History.addValueChangeHandler(new ValueChangeHandler<String>() {
+ public void onValueChange(ValueChangeEvent<String> stringValueChangeEvent) {
+ String first = stringValueChangeEvent.getValue().split("/")[0];
+
+ selected = first;
+ linksPane.setContents(setupLinks());
+ linksPane.markForRedraw();
+ }
+ });
}
@Override
- protected void onInit() {
- super.onInit();
+ protected void onDraw() {
+ super.onDraw();
+
+
+ ToolStrip topStrip = new ToolStrip();
+ topStrip.setHeight(34);
+ topStrip.setWidth100();
+ topStrip.setBackgroundImage("header/header_bg.png");
+ topStrip.setMembersMargin(20);
- setMembersMargin(20);
this.aboutModalWindow = new AboutModalWindow();
- Img logo = new Img("RHQ.png", 100, 35);
+ Img logo = new Img("header/rhq_logo_28px.png", 80, 28);
logo.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
MenuBarView.this.aboutModalWindow.show();
}
});
- addMember(logo);
+ topStrip.addMember(logo);
+
+
+ linksPane = new HTMLFlow();
+ linksPane.setContents(setupLinks());
+
+ topStrip.addMember(linksPane);
- VLayout right = new VLayout();
+ topStrip.addMember(new LayoutSpacer());
- HLayout links = new HLayout(25);
+ topStrip.addMember(new HTMLFlow("Logged in as " + CoreGUI.getSessionSubject().getName()));
- Hyperlink dashboardLink = new Hyperlink("Dashboard", "Dashboard");
- dashboardLink.setStylePrimaryName("TopSectionLink");
- dashboardLink.setStyleName("TopSectionLink");
- links.addMember(dashboardLink);
+ topStrip.addMember(new Hyperlink("Help", "Help"));
+ topStrip.addMember(new Hyperlink("Preferences", "Preferences"));
+ topStrip.addMember(new Hyperlink("Log Out", "LogOut"));
- Hyperlink demoLink = new Hyperlink("Demo", "Demo");
- demoLink.setStylePrimaryName("TopSectionLink");
- links.addMember(demoLink);
- Hyperlink resourcesLink = new Hyperlink("Inventory", "Inventory");
- resourcesLink.setStylePrimaryName("TopSectionLink");
- links.addMember(resourcesLink);
+ /* DynamicForm links = new DynamicForm();
+ links.setNumCols(SECTIONS.length * 2);
+ links.setHeight100();
+
+ int i = 0;
+ FormItem[] linkItems = new FormItem[SECTIONS.length];
+ for (String section : SECTIONS) {
+ LinkItem sectionLink = new LinkItem();
+ sectionLink.setTitle(section);
+ sectionLink.setValue("#" + section);
+ sectionLink.setShowTitle(false);
+
+ if (section.equals("Demo")) {
+ sectionLink.setCellStyle("TopSectionLinkSelected");
+ // sectionLink.("header/header_bg_selected.png");
+ } else {
+ sectionLink.setCellStyle("TopSectionLink");
+ // widgetCanvas.setStyleName("TopSectionLink");
+ }
+ linkItems[i++] = sectionLink;
+ }
+ links.setItems(linkItems);
+
+ topStrip.addMember(links);
+ */
+ addMember(topStrip);
+ addMember(new SearchBarPane());
+
+ markForRedraw();
+ }
+
+
+ private String setupLinks() {
+ StringBuilder headerString = new StringBuilder("<table style=\"height: 34px;\" cellpadding=\"0\" cellspacing=\"0\"><tr>");
+
+ boolean first = true;
+ for (String section : SECTIONS) {
+ if (first) {
+ headerString.append("<td style=\"width: 1px;\"><img src=\"http://localhost:7080/coregui/images/header/header_bg_line.png\"/></td>");
+ }
+ first = false;
+
+ String bg = "";
+ String styleClass = "TopSectionLink";
+ if (section.equals(selected)) {
+ bg = " background-image: url('http://localhost:7080/coregui/images/header/header_bg_selected.png');";
+ styleClass += "Selected";
+ }
+
- Hyperlink bundlesLink = new Hyperlink("Bundles", "Bundles");
- bundlesLink.setStylePrimaryName("TopSectionLink");
- links.addMember(bundlesLink);
+ headerString.append("<td style=\"vertical-align: bottom; padding:5px; padding-left: 15px; padding-right: 15px;" + bg + "\">");
+ headerString.append("<a class=\"" + styleClass + "\" href=\"#" + section + "\">" + section + "</a>");
+ headerString.append("</td>\n");
- Hyperlink adminLink = new Hyperlink("Administration", "Administration");
- adminLink.setStylePrimaryName("TopSectionLink");
- links.addMember(adminLink);
+ headerString.append("<td style=\"width: 1px;\"><img src=\"http://localhost:7080/coregui/images/header/header_bg_line.png\"/></td>");
+ }
- right.addMember(links);
- right.addMember(new SearchBarPane());
+ headerString.append("</tr></table>");
- addMember(right);
+ return headerString.toString();
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/SearchBarPane.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/SearchBarPane.java
index d69fdf3..e1249f6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/SearchBarPane.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/SearchBarPane.java
@@ -24,6 +24,7 @@ import com.smartgwt.client.widgets.Window;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.ButtonItem;
import com.smartgwt.client.widgets.form.fields.SelectItem;
+import com.smartgwt.client.widgets.form.fields.SpacerItem;
import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.menu.Menu;
@@ -41,19 +42,19 @@ public class SearchBarPane extends HLayout {
public SearchBarPane() {
super();
setWidth100();
- setHeight(45);
+ setHeight(28);
}
@Override
- protected void onInit() {
- super.onInit();
+ protected void onDraw() {
+ super.onDraw();
DynamicForm form = new DynamicForm();
- form.setNumCols(4);
- form.setItemLayout(FormLayoutType.ABSOLUTE);
+ form.setNumCols(6);
// form.setWidth100();
+
LinkedHashMap<String, String> values = new LinkedHashMap<String, String>();
values.put("Resources", "Resources");
values.put("Resources Groups", "Resources Groups");
@@ -62,10 +63,11 @@ public class SearchBarPane extends HLayout {
values.put("Users", "Users");
values.put("Roles", "Roles");
+
SelectItem searchType = new SelectItem("searchType", "Search");
- searchType.setWidth(150);
+ searchType.setWidth(120);
searchType.setValueMap(values);
-
+ searchType.setValue("Resources");
TextItem query = new TextItem("query");
query.setLeft(210);
@@ -73,11 +75,14 @@ public class SearchBarPane extends HLayout {
query.setShowTitle(false);
ButtonItem search = new ButtonItem("Search", "Search");
+ search.setStartRow(false);
+ search.setEndRow(false);
+ search.setShowTitle(false);
search.setLeft(620);
search.setIcon(Window.getImgURL("[SKIN]/actions/view.png"));
- form.setItems(searchType, query, search);
+ form.setItems(searchType, query, search, new SpacerItem());
addMember(form);
}
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css
index 31d3f21..dcd511f 100644
--- a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css
+++ b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css
@@ -96,13 +96,19 @@ a:hover {
}
-.TopSectionLink {
- font-size: 16pt;
+A.TopSectionLink {
+ font-size: 10pt;
font-weight: bold;
text-decoration: none;
color: black;
}
+A.TopSectionLinkSelected {
+ font-size: 10pt;
+ font-weight: bold;
+ text-decoration: none;
+ color: white;
+}
.BreadCrumb {
font-size: 10pt;
commit b3befd4e8b98a26fda5ea3e165ee7991a9293f59
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Mar 18 16:14:41 2010 -0400
getting the first couple steps to work better
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
index 0b6d176..0397a48 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
@@ -29,6 +29,7 @@ import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
import org.rhq.core.domain.bundle.BundleType;
+import org.rhq.core.domain.bundle.BundleVersion;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
@@ -40,6 +41,9 @@ public class BundleInfoStep implements WizardStep {
private final BundleCreationWizard wizard;
private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
+ private TextItem nameTextItem;
+ private TextItem versionTextItem;
+ private TextAreaItem descriptionTextAreaItem;
public BundleInfoStep(BundleCreationWizard bundleCreationWizard) {
this.wizard = bundleCreationWizard;
@@ -52,23 +56,48 @@ public class BundleInfoStep implements WizardStep {
form.setNumCols(2);
form.setColWidths("50%", "*");
- final TextItem nameTextItem = new TextItem("name", "Name");
+ BundleVersion initialBundleVersion = wizard.getBundleVersion();
+
+ nameTextItem = new TextItem("name", "Name");
nameTextItem.setRequired(true);
- nameTextItem.addChangedHandler(new ChangedHandler() {
- public void onChanged(ChangedEvent event) {
- Object value = event.getValue();
- if (value == null) {
- value = "";
+ if (initialBundleVersion == null) {
+ nameTextItem.setValue("");
+ nameTextItem.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent event) {
+ Object value = event.getValue();
+ if (value == null) {
+ value = "";
+ }
+ wizard.setSubtitle(value.toString());
+ wizard.setBundleName(value.toString());
+ enableNextButtonWhenAppropriate();
}
- wizard.setSubtitle(value.toString());
- wizard.setBundleName(value.toString());
- enableNextButtonWhenAppropriate();
- }
- });
-
- final TextItem versionTextItem = new TextItem("version", "Initial Version");
- versionTextItem.setValue("1.0");
- wizard.setBundleVersionString("1.0");
+ });
+ } else {
+ nameTextItem.setValue(initialBundleVersion.getName());
+ nameTextItem.setDisabled(true);
+ }
+
+ final TextItem previousVersionTextItem = new TextItem("previousVersion", "Previous Version");
+ if (initialBundleVersion == null) {
+ previousVersionTextItem.setVisible(Boolean.FALSE);
+ } else {
+ previousVersionTextItem.setValue(initialBundleVersion.getVersion());
+ previousVersionTextItem.setDisabled(true);
+ }
+
+ versionTextItem = new TextItem("version");
+ if (initialBundleVersion == null) {
+ versionTextItem.setTitle("Initial Version");
+ String versionSuggestion = "1.0";
+ versionTextItem.setValue(versionSuggestion);
+ wizard.setBundleVersionString(versionSuggestion);
+ } else {
+ versionTextItem.setTitle("New Version");
+ String versionSuggestion = autoIncrementVersion(initialBundleVersion.getVersion());
+ versionTextItem.setValue(versionSuggestion);
+ wizard.setBundleVersionString(versionSuggestion);
+ }
versionTextItem.addChangedHandler(new ChangedHandler() {
public void onChanged(ChangedEvent event) {
Object value = event.getValue();
@@ -80,7 +109,12 @@ public class BundleInfoStep implements WizardStep {
}
});
- final TextAreaItem descriptionTextAreaItem = new TextAreaItem("description", "Description");
+ descriptionTextAreaItem = new TextAreaItem("description", "Description");
+ if (initialBundleVersion == null) {
+ descriptionTextAreaItem.setValue("");
+ } else {
+ descriptionTextAreaItem.setValue(initialBundleVersion.getDescription());
+ }
descriptionTextAreaItem.addChangedHandler(new ChangedHandler() {
public void onChanged(ChangedEvent event) {
Object value = event.getValue();
@@ -92,26 +126,38 @@ public class BundleInfoStep implements WizardStep {
}
});
- form.setItems(nameTextItem, versionTextItem, descriptionTextAreaItem);
+ form.setItems(nameTextItem, previousVersionTextItem, versionTextItem, descriptionTextAreaItem);
- // TODO: we should get all bundle types in a drop down menu and let the user pick
- // for now assume we always get one (the filetemplate one) and use it
- bundleServer.getAllBundleTypes(new AsyncCallback<ArrayList<BundleType>>() {
- public void onSuccess(ArrayList<BundleType> result) {
- wizard.setBundleType(result.get(0));
- enableNextButtonWhenAppropriate();
- }
+ if (wizard.getBundleType() == null) {
+ // TODO: we should get all bundle types in a drop down menu and let the user pick
+ // for now assume we always get one (the filetemplate one) and use it
+ bundleServer.getAllBundleTypes(new AsyncCallback<ArrayList<BundleType>>() {
+ public void onSuccess(ArrayList<BundleType> result) {
+ wizard.setBundleType(result.get(0));
+ enableNextButtonWhenAppropriate();
+ }
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("No bundle types available", caught);
- }
- });
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("No bundle types available", caught);
+ }
+ });
+ }
+
+ enableNextButtonWhenAppropriate();
+ } else {
+ if (wizard.getBundleVersion() != null) {
+ // we are traversing back to this step - don't allow changes if we've already created the bundle version
+ nameTextItem.setDisabled(Boolean.TRUE);
+ versionTextItem.setDisabled(Boolean.TRUE);
+ descriptionTextAreaItem.setDisabled(Boolean.TRUE);
+ }
}
return form;
}
public boolean nextPage() {
- return form.validate();
+ boolean ok = form.validate();
+ return ok;
}
public String getName() {
@@ -134,4 +180,19 @@ public class BundleInfoStep implements WizardStep {
private boolean isNotEmpty(String s) {
return (s != null && s.trim().length() > 0);
}
+
+ private String autoIncrementVersion(String oldVersion) {
+ String newVersion = "1.0";
+ if (oldVersion != null && oldVersion.length() != 0) {
+ String[] parts = oldVersion.split("[^a-zA-Z0-9]");
+ String lastPart = parts[parts.length - 1];
+ try {
+ int lastNumber = Integer.parseInt(lastPart);
+ newVersion = oldVersion.substring(0, oldVersion.length() - lastPart.length()) + (lastNumber + 1);
+ } catch (NumberFormatException nfe) {
+ newVersion = oldVersion + ".1";
+ }
+ }
+ return newVersion;
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
index 0a0a5c2..8bb2498 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
@@ -22,6 +22,7 @@ import java.util.HashMap;
import java.util.Map;
import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.Img;
import com.smartgwt.client.widgets.Label;
@@ -55,6 +56,8 @@ public class BundleUploadDataStep implements WizardStep {
form = new DynamicForm();
final VLayout layout = new VLayout();
+ layout.setMargin(Integer.valueOf(20));
+ layout.setAlign(Alignment.CENTER);
bundleServer.getAllBundleVersionFilenames(this.wizard.getBundleVersion().getId(),
new AsyncCallback<HashMap<String, Boolean>>() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
index 34e410e..d7aefbe 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
@@ -20,7 +20,6 @@ package org.rhq.enterprise.gui.coregui.client.bundle.create;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.form.fields.CanvasItem;
-import com.smartgwt.client.widgets.form.fields.HiddenItem;
import com.smartgwt.client.widgets.form.fields.LinkItem;
import com.smartgwt.client.widgets.form.fields.TextAreaItem;
import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
@@ -38,6 +37,7 @@ public class BundleUploadRecipeStep implements WizardStep {
private DynamicCallbackForm form;
private final BundleCreationWizard wizard;
+ private TextAreaItem recipe;
public BundleUploadRecipeStep(BundleCreationWizard bundleCreationWizard) {
this.wizard = bundleCreationWizard;
@@ -50,9 +50,6 @@ public class BundleUploadRecipeStep implements WizardStep {
form.setNumCols(1);
form.setMargin(Integer.valueOf(20));
- HiddenItem idField = new HiddenItem("id");
- idField.setValue(1);
-
final LinkItem showUpload = new LinkItem("showUpload");
showUpload.setValue("Click To Upload A Recipe File");
showUpload.setShowTitle(false);
@@ -70,7 +67,7 @@ public class BundleUploadRecipeStep implements WizardStep {
}
});
- final TextAreaItem recipe = new TextAreaItem("recipe");
+ recipe = new TextAreaItem("recipe");
recipe.setShowTitle(false);
recipe.setRequired(true);
recipe.setWidth("*");
@@ -97,8 +94,16 @@ public class BundleUploadRecipeStep implements WizardStep {
}
});
- form.setItems(idField, showUpload, upload, recipe);
+ form.setItems(showUpload, upload, recipe);
form.hideItem("upload");
+ } else {
+ // we are traversing back to this step - don't allow the recipe to change if we've already created the bundle version
+ if (wizard.getBundleVersion() != null) {
+ recipe.setValue(wizard.getBundleVersion().getRecipe());
+ recipe.setDisabled(Boolean.TRUE);
+ form.hideItem("showUpload");
+ form.hideItem("upload");
+ }
}
return form;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java
index 40fd9f9..46fe479 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java
@@ -46,6 +46,11 @@ public class BundleVerificationStep implements WizardStep {
}
public Canvas getCanvas() {
+ if (canvas != null && wizard.getBundleVersion() != null) {
+ // if we've already got a persisted bundle version, don't verify it again or try to create it again
+ return canvas;
+ }
+
canvas = new VLayout();
canvas.setWidth100();
canvas.setHeight100();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleFileUploadForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleFileUploadForm.java
index 5cff730..d67e38d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleFileUploadForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleFileUploadForm.java
@@ -43,7 +43,7 @@ public class BundleFileUploadForm extends DynamicCallbackForm {
private String name;
public BundleFileUploadForm(BundleVersion bundleVersion, String name) {
- super("bundleFileUpload");
+ super(name);
this.bundleVersion = bundleVersion;
this.name = name;
commit 1662b2a2088a1a0613c39c1fd799daca7b325a8e
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Mar 18 15:48:18 2010 -0400
the file dsl command also refers to a bundle file so it needs to be returned as a needed file by the plugin
diff --git a/modules/enterprise/server/plugins/filetemplate-bundle/src/main/java/org/rhq/enterprise/server/plugins/filetemplate/BundleServerPluginComponent.java b/modules/enterprise/server/plugins/filetemplate-bundle/src/main/java/org/rhq/enterprise/server/plugins/filetemplate/BundleServerPluginComponent.java
index 99b8504..342b5b1 100644
--- a/modules/enterprise/server/plugins/filetemplate-bundle/src/main/java/org/rhq/enterprise/server/plugins/filetemplate/BundleServerPluginComponent.java
+++ b/modules/enterprise/server/plugins/filetemplate-bundle/src/main/java/org/rhq/enterprise/server/plugins/filetemplate/BundleServerPluginComponent.java
@@ -78,6 +78,8 @@ public class BundleServerPluginComponent implements ServerPluginComponent, Bundl
bundleFileNames.addAll(deployFiles.keySet());
Set<String> scriptFiles = recipeContext.getScriptFiles();
bundleFileNames.addAll(scriptFiles);
+ Set<String> files = recipeContext.getFiles().keySet();
+ bundleFileNames.addAll(files);
ConfigurationDefinition configDef = null;
if (recipeContext.getReplacementVariables() != null) {
commit f30951b7cf33e874da77c4d628142a36a24bfe45
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Mar 18 14:06:20 2010 -0400
make sure the cancel button undos what the the wizard did
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java
index c75610a..00a26a3 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java
@@ -20,12 +20,18 @@ package org.rhq.enterprise.gui.coregui.client.bundle.create;
import java.util.ArrayList;
+import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
public class BundleCreationWizard extends AbstractBundleWizard {
@@ -47,9 +53,22 @@ public class BundleCreationWizard extends AbstractBundleWizard {
IButton cancelButton = getView().getCancelButton();
cancelButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
- BundleVersion bv = getBundleVersion();
+ final BundleVersion bv = getBundleVersion();
if (bv != null) {
// the user must have created it already after verification step, delete it
+ BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
+ bundleServer.deleteBundleVersion(bv.getId(), new AsyncCallback<Void>() {
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("Canceled bundle [" + bv.getName() + "] version [" + bv.getVersion() + "]",
+ Severity.Info));
+ }
+
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+ "Failed to fully cancel - bundle may still exist in the database", caught);
+ }
+ });
}
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
index a4de053..2670eb4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
@@ -100,7 +100,7 @@ public class BundleGWTServiceImpl extends AbstractGWTServiceImpl implements Bund
BundleVersion results;
try {
results = bundleManager.createBundleAndBundleVersion(getSessionSubject(), bundleName, description,
- bundleTypeId, name, null, version, recipe);
+ bundleTypeId, name, description, version, recipe);
} catch (Exception e) {
throw new RuntimeException(ThrowableUtil.getAllMessages(e));
}
commit 1c240f01dcc5b833a517c53a783a775617f1d753
Merge: 3f76833... 32aaf25...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Mar 18 13:41:28 2010 -0400
Merge branch 'gwt' into gwt-jay
commit 3f76833e9b01a888b7b29ab91790adfed384bd45
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Mar 18 13:40:26 2010 -0400
Basic framework for Deploy wizard
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
index 46bee74..8839c76 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
@@ -24,6 +24,7 @@ import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.layout.HLayout;
import org.rhq.enterprise.gui.coregui.client.bundle.create.BundleCreationWizard;
+import org.rhq.enterprise.gui.coregui.client.bundle.deploy.BundleDeployWizard;
/**
* @author Greg Hinkle
@@ -34,13 +35,21 @@ public class BundleTopView extends HLayout {
protected void onDraw() {
super.onDraw();
- IButton addButton = new IButton("New Bundle");
- addButton.addClickHandler(new ClickHandler() {
+ IButton addBundleButton = new IButton("New Bundle");
+ addBundleButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
new BundleCreationWizard().startBundleWizard();
}
});
- addMember(addButton);
+ IButton addDefinitionButton = new IButton("New Deployment");
+ addDefinitionButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ new BundleDeployWizard().startBundleWizard();
+ }
+ });
+
+ addMember(addBundleButton);
+ addMember(addDefinitionButton);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/AbstractBundleCreationWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/AbstractBundleCreationWizard.java
new file mode 100644
index 0000000..2994948
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/AbstractBundleCreationWizard.java
@@ -0,0 +1,81 @@
+/*
+ * 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.bundle.create;
+
+import org.rhq.core.domain.bundle.BundleType;
+import org.rhq.core.domain.bundle.BundleVersion;
+
+public abstract class AbstractBundleCreationWizard extends AbstractBundleWizard {
+
+ // the things we build up in the wizard
+ private BundleType bundleType;
+ private String bundleName;
+ private String bundleVersionString;
+ private String bundleDescription;
+ private String recipe;
+ private BundleVersion bundleVersion;
+
+ public BundleType getBundleType() {
+ return bundleType;
+ }
+
+ public void setBundleType(BundleType bundleType) {
+ this.bundleType = bundleType;
+ }
+
+ public String getBundleName() {
+ return bundleName;
+ }
+
+ public void setBundleName(String bundleName) {
+ this.bundleName = bundleName;
+ }
+
+ public String getBundleVersionString() {
+ return bundleVersionString;
+ }
+
+ public void setBundleVersionString(String bundleVersionString) {
+ this.bundleVersionString = bundleVersionString;
+ }
+
+ public String getBundleDescription() {
+ return bundleDescription;
+ }
+
+ public void setBundleDescription(String desc) {
+ this.bundleDescription = desc;
+ }
+
+ public String getRecipe() {
+ return recipe;
+ }
+
+ public void setRecipe(String recipe) {
+ this.recipe = recipe;
+ }
+
+ public BundleVersion getBundleVersion() {
+ return bundleVersion;
+ }
+
+ public void setBundleVersion(BundleVersion bv) {
+ this.bundleVersion = bv;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/AbstractBundleDeployWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/AbstractBundleDeployWizard.java
new file mode 100644
index 0000000..91b198a
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/AbstractBundleDeployWizard.java
@@ -0,0 +1,35 @@
+/*
+ * 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.bundle.deploy;
+
+import org.rhq.core.domain.bundle.Bundle;
+import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.enterprise.gui.coregui.client.bundle.create.AbstractBundleWizard;
+
+public abstract class AbstractBundleDeployWizard extends AbstractBundleWizard {
+
+ // the things we build up in the wizard
+ private Bundle bundle;
+ private BundleVersion bundleVersion;
+ private String name;
+ private String description;
+ private Configuration config;
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployWizard.java
new file mode 100644
index 0000000..3a71dea
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployWizard.java
@@ -0,0 +1,59 @@
+/*
+ * 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.bundle.deploy;
+
+import java.util.ArrayList;
+
+import org.rhq.core.domain.bundle.Bundle;
+import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+
+public class BundleDeployWizard extends AbstractBundleDeployWizard {
+
+ public BundleDeployWizard() {
+ setWindowTitle("Bundle Deployment Wizard");
+ setTitle("Bundle Deployment");
+
+ ArrayList<WizardStep> steps = new ArrayList<WizardStep>();
+ /*
+ steps.add(new SelectBundleStep(this));
+ steps.add(new BundleUploadRecipeStep(this));
+ steps.add(new BundleVerificationStep(this));
+ steps.add(new BundleUploadDataStep(this));
+ */
+ setSteps(steps);
+ }
+
+ public BundleDeployWizard(Bundle bundle) {
+ setWindowTitle("Bundle Deployment Wizard");
+ setTitle("Bundle Deployment");
+
+ ArrayList<WizardStep> steps = new ArrayList<WizardStep>();
+ setSteps(steps);
+ }
+
+ public BundleDeployWizard(BundleVersion bundleVersion) {
+ setWindowTitle("Bundle Deployment Wizard");
+ setTitle("Bundle Deployment");
+
+ ArrayList<WizardStep> steps = new ArrayList<WizardStep>();
+ setSteps(steps);
+ }
+
+}
commit 32aaf25199430651470632449aac8dd3147adb02
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Mar 18 13:38:22 2010 -0400
try-catch all gwt service impl methods, add delete bv method
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java
index b11815a..1b0f296 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java
@@ -42,4 +42,6 @@ public interface BundleGWTService extends RemoteService {
String description, String recipe) throws Exception;
HashMap<String, Boolean> getAllBundleVersionFilenames(int bundleVersionId) throws Exception;
+
+ void deleteBundleVersion(int bundleVersionId);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
index 51c29df..a4de053 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
@@ -38,20 +38,40 @@ public class BundleGWTServiceImpl extends AbstractGWTServiceImpl implements Bund
private BundleManagerLocal bundleManager = LookupUtil.getBundleManager();
+ public void deleteBundleVersion(int bundleVersionId) {
+ try {
+ bundleManager.deleteBundleVersion(getSessionSubject(), bundleVersionId);
+ } catch (Exception e) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ }
+ }
+
public ArrayList<BundleType> getAllBundleTypes() {
- ArrayList<BundleType> bundleTypes = new ArrayList<BundleType>();
- bundleTypes.addAll(bundleManager.getAllBundleTypes(getSessionSubject()));
- return SerialUtility.prepare(bundleTypes, "getBundleTypes");
+ try {
+ ArrayList<BundleType> bundleTypes = new ArrayList<BundleType>();
+ bundleTypes.addAll(bundleManager.getAllBundleTypes(getSessionSubject()));
+ return SerialUtility.prepare(bundleTypes, "getBundleTypes");
+ } catch (Exception e) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ }
}
public PageList<Bundle> findBundlesByCriteria(BundleCriteria criteria) {
- PageList<Bundle> results = bundleManager.findBundlesByCriteria(getSessionSubject(), criteria);
- return SerialUtility.prepare(results, "findBundlesByCriteria");
+ try {
+ PageList<Bundle> results = bundleManager.findBundlesByCriteria(getSessionSubject(), criteria);
+ return SerialUtility.prepare(results, "findBundlesByCriteria");
+ } catch (Exception e) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ }
}
public PageList<BundleVersion> findBundleVersionsByCriteria(BundleVersionCriteria criteria) {
- PageList<BundleVersion> results = bundleManager.findBundleVersionsByCriteria(getSessionSubject(), criteria);
- return SerialUtility.prepare(results, "findBundleVersionsByCriteria");
+ try {
+ PageList<BundleVersion> results = bundleManager.findBundleVersionsByCriteria(getSessionSubject(), criteria);
+ return SerialUtility.prepare(results, "findBundleVersionsByCriteria");
+ } catch (Exception e) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ }
}
public Bundle createBundle(String name, int bundleTypeId) throws Exception {
commit 59193cace78d186e6fc5fe7d2fe64f28ec6e99b6
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Mar 18 13:30:25 2010 -0400
fixing some bundle wizard things - makes sure description is saved
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java
index f3dab6d..c75610a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java
@@ -20,6 +20,11 @@ package org.rhq.enterprise.gui.coregui.client.bundle.create;
import java.util.ArrayList;
+import com.smartgwt.client.widgets.IButton;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+
+import org.rhq.core.domain.bundle.BundleVersion;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
public class BundleCreationWizard extends AbstractBundleWizard {
@@ -35,4 +40,18 @@ public class BundleCreationWizard extends AbstractBundleWizard {
steps.add(new BundleUploadDataStep(this));
setSteps(steps);
}
+
+ @Override
+ public void startBundleWizard() {
+ super.startBundleWizard();
+ IButton cancelButton = getView().getCancelButton();
+ cancelButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ BundleVersion bv = getBundleVersion();
+ if (bv != null) {
+ // the user must have created it already after verification step, delete it
+ }
+ }
+ });
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
index e4d8bee..0b6d176 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
@@ -34,9 +34,6 @@ import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-/**
- * @author Greg Hinkle
- */
public class BundleInfoStep implements WizardStep {
private DynamicForm form;
@@ -99,14 +96,14 @@ public class BundleInfoStep implements WizardStep {
// TODO: we should get all bundle types in a drop down menu and let the user pick
// for now assume we always get one (the filetemplate one) and use it
- bundleServer.getBundleTypes(new AsyncCallback<ArrayList<BundleType>>() {
+ bundleServer.getAllBundleTypes(new AsyncCallback<ArrayList<BundleType>>() {
public void onSuccess(ArrayList<BundleType> result) {
wizard.setBundleType(result.get(0));
enableNextButtonWhenAppropriate();
}
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("No bundle types available: " + caught.getMessage(), caught);
+ CoreGUI.getErrorHandler().handleError("No bundle types available", caught);
}
});
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
index 22275ac..0a0a5c2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
@@ -40,9 +40,6 @@ import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
-/**
- * @author Greg Hinkle
- */
public class BundleUploadDataStep implements WizardStep {
private final BundleCreationWizard wizard;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
index 14c53ce..34e410e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
@@ -34,9 +34,6 @@ import org.rhq.enterprise.gui.coregui.client.components.upload.DynamicFormSubmit
import org.rhq.enterprise.gui.coregui.client.components.upload.TextFileRetrieverForm;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
-/**
- * @author Greg Hinkle
- */
public class BundleUploadRecipeStep implements WizardStep {
private DynamicCallbackForm form;
@@ -47,12 +44,11 @@ public class BundleUploadRecipeStep implements WizardStep {
}
public Canvas getCanvas() {
-
if (form == null) {
-
- form = new DynamicCallbackForm("test");
+ form = new DynamicCallbackForm("uploadRecipeStepForm");
form.setWidth100();
form.setNumCols(1);
+ form.setMargin(Integer.valueOf(20));
HiddenItem idField = new HiddenItem("id");
idField.setValue(1);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java
index b185bb1..40fd9f9 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java
@@ -19,10 +19,11 @@
package org.rhq.enterprise.gui.coregui.client.bundle.create;
import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.Label;
+import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.Img;
-import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.bundle.BundleVersion;
@@ -30,42 +31,46 @@ import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
-/**
- * @author Greg Hinkle
- */
public class BundleVerificationStep implements WizardStep {
private final BundleCreationWizard wizard;
private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
- private DynamicForm form;
+ private VLayout canvas;
public BundleVerificationStep(BundleCreationWizard bundleCreationWizard) {
this.wizard = bundleCreationWizard;
}
public Canvas getCanvas() {
- form = new DynamicForm();
-
- VLayout layout = new VLayout();
- layout.setWidth100();
- layout.setHeight100();
+ canvas = new VLayout();
+ canvas.setWidth100();
+ canvas.setHeight100();
+ canvas.setAlign(Alignment.CENTER);
final Img verifyingImage = new Img("/images/status-bar.gif");
+ verifyingImage.setLayoutAlign(Alignment.CENTER);
verifyingImage.setWidth(50);
verifyingImage.setHeight(15);
- final Label verifiedMessage = new Label("Verifying...!");
- layout.addMember(verifyingImage);
- layout.addMember(verifiedMessage);
+ final Label verifiedMessage = new Label("Verifying...");
+ verifiedMessage.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
+
+ canvas.addMember(verifyingImage);
+ canvas.addMember(verifiedMessage);
bundleServer.createBundleAndBundleVersion(this.wizard.getBundleName(), this.wizard.getBundleType().getId(),
- this.wizard.getBundleName(), this.wizard.getBundleVersionString(), this.wizard.getRecipe(),
- new AsyncCallback<BundleVersion>() {
+ this.wizard.getBundleName(), this.wizard.getBundleVersionString(), this.wizard.getBundleDescription(),
+ this.wizard.getRecipe(), new AsyncCallback<BundleVersion>() {
public void onSuccess(BundleVersion result) {
verifyingImage.setSrc("/images/status_complete.gif");
verifiedMessage.setText("Verified!");
+ CoreGUI.getMessageCenter().notify(
+ new Message("Created bundle [" + result.getName() + "] version [" + result.getVersion() + "]",
+ Severity.Info));
wizard.setBundleVersion(result);
enableNextButtonWhenAppropriate();
}
@@ -79,8 +84,7 @@ public class BundleVerificationStep implements WizardStep {
}
});
- form.addChild(layout);
- return form;
+ return canvas;
}
public boolean nextPage() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java
index 0944786..b11815a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java
@@ -30,7 +30,7 @@ import org.rhq.core.domain.criteria.BundleCriteria;
import org.rhq.core.domain.util.PageList;
public interface BundleGWTService extends RemoteService {
- ArrayList<BundleType> getBundleTypes();
+ ArrayList<BundleType> getAllBundleTypes();
PageList<Bundle> findBundlesByCriteria(BundleCriteria criteria) throws Exception;
@@ -39,7 +39,7 @@ public interface BundleGWTService extends RemoteService {
BundleVersion createBundleVersion(int bundleId, String name, String version, String recipe) throws Exception;
BundleVersion createBundleAndBundleVersion(String bundleName, int bundleTypeId, String name, String version,
- String recipe) throws Exception;
+ String description, String recipe) throws Exception;
HashMap<String, Boolean> getAllBundleVersionFilenames(int bundleVersionId) throws Exception;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
index df50b53..51c29df 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
@@ -38,7 +38,7 @@ public class BundleGWTServiceImpl extends AbstractGWTServiceImpl implements Bund
private BundleManagerLocal bundleManager = LookupUtil.getBundleManager();
- public ArrayList<BundleType> getBundleTypes() {
+ public ArrayList<BundleType> getAllBundleTypes() {
ArrayList<BundleType> bundleTypes = new ArrayList<BundleType>();
bundleTypes.addAll(bundleManager.getAllBundleTypes(getSessionSubject()));
return SerialUtility.prepare(bundleTypes, "getBundleTypes");
@@ -75,11 +75,12 @@ public class BundleGWTServiceImpl extends AbstractGWTServiceImpl implements Bund
}
public BundleVersion createBundleAndBundleVersion(String bundleName, int bundleTypeId, String name, String version,
- String recipe) throws Exception {
+ String description, String recipe) throws Exception {
+
BundleVersion results;
try {
- results = bundleManager.createBundleAndBundleVersion(getSessionSubject(), bundleName, null, bundleTypeId,
- name, null, version, recipe);
+ results = bundleManager.createBundleAndBundleVersion(getSessionSubject(), bundleName, description,
+ bundleTypeId, name, null, version, recipe);
} catch (Exception e) {
throw new RuntimeException(ThrowableUtil.getAllMessages(e));
}
commit 5019f944b1cfd381f358023333e8a6ec988f58f4
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Thu Mar 18 10:14:47 2010 -0400
fix bug when trying to toggle favorite flag on current Resource
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/FavoritesUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/FavoritesUIBean.java
index 25b3dfe..5bf3da5 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/FavoritesUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/FavoritesUIBean.java
@@ -21,18 +21,22 @@ package org.rhq.enterprise.gui.inventory.resource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.rhq.core.gui.util.FacesContextUtility;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
import org.rhq.enterprise.gui.legacy.WebUser;
import org.rhq.enterprise.gui.legacy.WebUserPreferences;
import org.rhq.enterprise.gui.legacy.action.resource.common.QuickFavoritesUtil;
import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
-import org.rhq.enterprise.gui.util.WebUtility;
/**
- * A session-scoped bean for toggling the current resource in request scope
+ * A session-scoped bean for toggling the current resource in request scope.
*
* @author Joseph Marques
*/
+@Name("FavoritesUIBean")
+(a)Scope(ScopeType.EVENT)
public class FavoritesUIBean {
protected final Log log = LogFactory.getLog(FavoritesUIBean.class);
@@ -45,6 +49,7 @@ public class FavoritesUIBean {
* requests, particularly with the raw config editor. The raw config editor however extends the life of the
* current ResourceUIBean beyond the current request so that the id can be accessed through ResourceUIBean.
*/
+ @In(value = ResourceUIBean.MANAGED_BEAN_NAME, create = true)
private ResourceUIBean resourceUIBean;
public FavoritesUIBean() {
@@ -88,5 +93,4 @@ public class FavoritesUIBean {
return null;
}
-
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/ResourceUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/ResourceUIBean.java
index 03be73e..bc62589 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/ResourceUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/ResourceUIBean.java
@@ -25,6 +25,9 @@ import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -62,6 +65,8 @@ import org.rhq.enterprise.server.util.LookupUtil;
*
* @author Ian Springer
*/
+(a)Name(ResourceUIBean.MANAGED_BEAN_NAME)
+(a)Scope(ScopeType.EVENT)
public class ResourceUIBean {
protected final Log log = LogFactory.getLog(ResourceUIBean.class);
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans/inventory-beans.xml b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans/inventory-beans.xml
index ff5d3d9..fb313ca 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans/inventory-beans.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans/inventory-beans.xml
@@ -26,12 +26,14 @@
<!-- /rhq/resource/** -->
+ <!--
<managed-bean>
<managed-bean-name>ResourceUIBean</managed-bean-name>
<managed-bean-class>org.rhq.enterprise.gui.inventory.resource.ResourceUIBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
-
+ -->
+
<managed-bean>
<managed-bean-name>ResourceOverviewUIBean</managed-bean-name>
<managed-bean-class>org.rhq.enterprise.gui.inventory.resource.ResourceOverviewUIBean</managed-bean-class>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/group/layout/summary.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/group/layout/summary.xhtml
index 4a0e1cf..9f132c8 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/group/layout/summary.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/group/layout/summary.xhtml
@@ -85,9 +85,9 @@ groupId - the group id of the Group being accessed
<rich:toolTip for="favoritesStar">
- <h:outputText value="Add resource to favorites list"
+ <h:outputText value="Add group to favorites list"
rendered="#{!ResourceGroupUIBean.favorite}"/>
- <h:outputText value="Remove resource from favorites list"
+ <h:outputText value="Remove group from favorites list"
rendered="#{ResourceGroupUIBean.favorite}"/>
</rich:toolTip>
</a4j:region>
commit 8d0c6d3b9cceb6667c076406667d85caa383d3b4
Merge: 8eec5cf... 126990c...
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Mar 18 10:04:32 2010 +0100
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
commit 126990c52da90dd0526dd413fe175a827f8d7568
Merge: 976e80a... 3cb8035...
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Mar 17 21:17:07 2010 -0400
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
commit 976e80ab979d557fe00610b6568ca47d4d6f41a5
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Mar 17 21:15:30 2010 -0400
Initial commit for a prototype of the portal admin settings window
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
index eea078d..560935b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
@@ -18,21 +18,19 @@
*/
package org.rhq.enterprise.gui.coregui.client.dashboard;
-import org.rhq.enterprise.gui.coregui.client.admin.roles.RolesView;
-import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.RecentlyAddedView;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSearchView;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.SmallGraphView;
-
import com.google.gwt.user.client.Random;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.widgets.AnimationCallback;
import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.ButtonItem;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.layout.LayoutSpacer;
import com.smartgwt.client.widgets.layout.VLayout;
-import org.rhq.enterprise.gui.coregui.client.inventory.summary.SummaryCountsView;
+import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.RecentlyAddedView;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.SmallGraphView;
/**
* @author Greg Hinkle
@@ -77,7 +75,7 @@ public class DashboardView extends VLayout {
portalLayout.addPortlet(portlet);
}
- VLayout vLayout = new VLayout(15);
+ final VLayout vLayout = new VLayout(15);
final DynamicForm form = new DynamicForm();
form.setAutoWidth();
@@ -153,10 +151,19 @@ public class DashboardView extends VLayout {
// } else {
// newPortlet.addItem(new SummaryCountsView());
// }
+
+ ClickHandler handler = new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ PortletSettingsWindow settingsWindow = new PortletSettingsWindow("Recently Added Resources");
+ settingsWindow.show();
+ }
+ };
+
newPortlet.addItem(new RecentlyAddedView());
newPortlet.setHeight(350);
-
newPortlet.setVisible(false);
+ newPortlet.setHelpClickHandler(handler);
+ newPortlet.setSettingsClickHandler(handler);
PortalColumn column = portalLayout.addPortlet(newPortlet);
// also insert a blank spacer element, which will trigger the built-in
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletSettingsWindow.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletSettingsWindow.java
new file mode 100644
index 0000000..b0c37cd
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletSettingsWindow.java
@@ -0,0 +1,87 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package org.rhq.enterprise.gui.coregui.client.dashboard;
+
+import com.smartgwt.client.types.LayoutPolicy;
+import com.smartgwt.client.types.Overflow;
+import com.smartgwt.client.widgets.Window;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.TextItem;
+import com.smartgwt.client.widgets.layout.VLayout;
+
+/**
+ * This is a window for displaying portlet settings. The window contains a form which in turn will contain the
+ * widgets for a portlet's settings. Those widgets will have to be passed to the window since the window is intended
+ * to support all portlets. The layout and sizing strategy for this window is to be as large as the widgets contained
+ * within it. And the form will stretch and resize as the window is resized. This flexible layout strategy is used
+ * since there are different settings (with different widgets) for different portlets which will in turn result in
+ * different sizes for the parent window.
+ *
+ * @author John Sanda
+ */
+public class PortletSettingsWindow extends Window {
+
+ private String portletTitle;
+
+ public PortletSettingsWindow(String portletTitle) {
+ this.portletTitle = portletTitle;
+ setTitle("RHQ Dashboard Settings: " + portletTitle);
+ setOverflow(Overflow.VISIBLE);
+ setAutoSize(true);
+ setCanDragResize(true);
+ setCanDragReposition(true);
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+
+ VLayout layout = new VLayout();
+ layout.setWidth100();
+ layout.setHeight100();
+ layout.setPadding(15);
+ layout.setLayoutMargin(20);
+ layout.setVPolicy(LayoutPolicy.FILL);
+
+ final DynamicForm form = new DynamicForm();
+ form.setGroupTitle("Display Settings");
+ form.setIsGroup(true);
+ form.setNumCols(2);
+ form.setWidth100();
+ form.setHeight100();
+ form.setCellPadding(5);
+
+ TextItem username = new TextItem();
+ username.setTitle("Username");
+
+ TextItem password = new TextItem();
+ password.setTitle("Password");
+
+ form.setFields(username, password);
+
+ layout.addMember(form);
+ addItem(layout);
+ }
+
+}
commit 3cb8035a9f413a344d2ecd28bf60b8f65f59c990
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 17 16:55:23 2010 -0400
wrap data in brackets in log messages just to make them easier to pick out the paths
diff --git a/modules/plugins/filetemplate-bundle/src/main/java/org/rhq/plugins/filetemplate/ProcessingRecipeContext.java b/modules/plugins/filetemplate-bundle/src/main/java/org/rhq/plugins/filetemplate/ProcessingRecipeContext.java
index 504f1c9..1d9213d 100644
--- a/modules/plugins/filetemplate-bundle/src/main/java/org/rhq/plugins/filetemplate/ProcessingRecipeContext.java
+++ b/modules/plugins/filetemplate-bundle/src/main/java/org/rhq/plugins/filetemplate/ProcessingRecipeContext.java
@@ -78,14 +78,14 @@ public class ProcessingRecipeContext extends RecipeContext {
throw new RuntimeException("Failed to unbundle file [" + pe + "]: " + results);
}
// existingFile.delete(); WOULD WE WANT TO REMOVE THE COMPRESSED FILE?
- log.debug("bundle deploy: unzipped " + existingFile + " to " + directory);
+ log.debug("bundle deploy: unzipped [" + existingFile + "] to [" + directory + "]");
} else {
// not a zipped format - just move the file to the directory as-is
File newFile = new File(directory, filename);
if (!existingFile.renameTo(newFile)) {
throw new RuntimeException("Failed to move [" + existingFile + "] to [" + newFile + "]");
}
- log.debug("bundle deploy: renamed " + existingFile + " to " + newFile);
+ log.debug("bundle deploy: renamed [" + existingFile + "] to [" + newFile + "]");
}
}
@@ -100,7 +100,7 @@ public class ProcessingRecipeContext extends RecipeContext {
destinationFile.getParentFile().mkdirs();
FileUtil.copyFile(sourceFile, destinationFile);
- log.debug("bundle file: copied " + sourceFile + " to " + destinationFile);
+ log.debug("bundle file: copied [" + sourceFile + "] to [" + destinationFile + "]");
} catch (Exception e) {
throw new RuntimeException("Failed to copy file [" + sourceFile + "] to [" + destinationFile + "]", e);
}
@@ -142,7 +142,7 @@ public class ProcessingRecipeContext extends RecipeContext {
throw new RuntimeException("Failed to rename realized tmp file [" + realizedTmpFile + "]");
}
- log.debug("bundle realize file: renamed realized" + realizedTmpFile + " to " + trueFile);
+ log.debug("bundle realize file: renamed realized [" + realizedTmpFile + "] to [" + trueFile + "]");
} catch (Exception e) {
throw new RuntimeException("Cannot realize file [" + file + "]", e);
} finally {
commit 7d95dbc070ee5f185274ddc09b1f0e70c1bad538
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 17 16:37:25 2010 -0400
Just added some debug logging confirming successful command handling.
diff --git a/modules/plugins/filetemplate-bundle/src/main/java/org/rhq/plugins/filetemplate/ProcessingRecipeContext.java b/modules/plugins/filetemplate-bundle/src/main/java/org/rhq/plugins/filetemplate/ProcessingRecipeContext.java
index d20526c..504f1c9 100644
--- a/modules/plugins/filetemplate-bundle/src/main/java/org/rhq/plugins/filetemplate/ProcessingRecipeContext.java
+++ b/modules/plugins/filetemplate-bundle/src/main/java/org/rhq/plugins/filetemplate/ProcessingRecipeContext.java
@@ -29,6 +29,9 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
import org.rhq.bundle.filetemplate.recipe.RecipeContext;
import org.rhq.bundle.filetemplate.recipe.RecipeParser;
import org.rhq.core.domain.content.PackageVersion;
@@ -45,6 +48,8 @@ import org.rhq.core.util.file.FileUtil;
*/
public class ProcessingRecipeContext extends RecipeContext {
+ private final Log log = LogFactory.getLog(this.getClass());
+
private final Map<PackageVersion, File> packageVersionFiles;
private final SystemInfo systemInfo;
private String baseWorkingDirectory;
@@ -73,12 +78,14 @@ public class ProcessingRecipeContext extends RecipeContext {
throw new RuntimeException("Failed to unbundle file [" + pe + "]: " + results);
}
// existingFile.delete(); WOULD WE WANT TO REMOVE THE COMPRESSED FILE?
+ log.debug("bundle deploy: unzipped " + existingFile + " to " + directory);
} else {
// not a zipped format - just move the file to the directory as-is
File newFile = new File(directory, filename);
if (!existingFile.renameTo(newFile)) {
throw new RuntimeException("Failed to move [" + existingFile + "] to [" + newFile + "]");
}
+ log.debug("bundle deploy: renamed " + existingFile + " to " + newFile);
}
}
@@ -92,6 +99,8 @@ public class ProcessingRecipeContext extends RecipeContext {
try {
destinationFile.getParentFile().mkdirs();
FileUtil.copyFile(sourceFile, destinationFile);
+
+ log.debug("bundle file: copied " + sourceFile + " to " + destinationFile);
} catch (Exception e) {
throw new RuntimeException("Failed to copy file [" + sourceFile + "] to [" + destinationFile + "]", e);
}
@@ -132,6 +141,8 @@ public class ProcessingRecipeContext extends RecipeContext {
if (!realizedTmpFile.renameTo(trueFile)) {
throw new RuntimeException("Failed to rename realized tmp file [" + realizedTmpFile + "]");
}
+
+ log.debug("bundle realize file: renamed realized" + realizedTmpFile + " to " + trueFile);
} catch (Exception e) {
throw new RuntimeException("Cannot realize file [" + file + "]", e);
} finally {
@@ -175,6 +186,8 @@ public class ProcessingRecipeContext extends RecipeContext {
if (results.getError() != null) {
throw new RuntimeException("Could not execute script [" + pe + "]: " + results, results.getError());
}
+
+ log.debug("bundle script: executed script [" + pe + "]");
}
@Override
@@ -191,6 +204,8 @@ public class ProcessingRecipeContext extends RecipeContext {
if (results.getError() != null) {
throw new RuntimeException("Could not execute command [" + pe + "]: " + results, results.getError());
}
+
+ log.debug("bundle command: executed command [" + pe + "]");
}
private void ensureExecutable(File scriptFile) {
commit 8eec5cf8b4f7912311c7d26dd6c76f86bd8a3836
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Mar 17 20:43:52 2010 +0100
Optimize main table layout and details printing
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
index 9df2812..a97374f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
@@ -27,6 +27,7 @@ import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.data.DataSourceField;
+import com.smartgwt.client.data.fields.DataSourceBooleanField;
import com.smartgwt.client.data.fields.DataSourceIntegerField;
import com.smartgwt.client.data.fields.DataSourceTextField;
import com.smartgwt.client.rpc.RPCResponse;
@@ -81,7 +82,7 @@ public class AlertDataSource extends RPCDataSource<Alert> {
idField.setHidden(true);
fields.add(idField);
- DataSourceTextField nameField = new DataSourceTextField(AlertCriteria.SORT_FIELD_NAME, "Name", 100);
+ DataSourceTextField nameField = new DataSourceTextField(AlertCriteria.SORT_FIELD_NAME, "Name");
fields.add(nameField);
DataSourceTextField conditionTextField = new DataSourceTextField("conditionText", "Condition Text");
@@ -106,13 +107,9 @@ public class AlertDataSource extends RPCDataSource<Alert> {
DataSourceTextField ctimeField = new DataSourceTextField(AlertCriteria.SORT_FIELD_CTIME, "Creation Time");
fields.add(ctimeField);
- DataSourceTextField ackTimeField = new DataSourceTextField("ack_time", "Ack time");
- ackTimeField.setCanSortClientOnly(true);
- fields.add(ackTimeField);
-
- DataSourceTextField ackByField = new DataSourceTextField("ack_by", "Ack by");
- ackByField.setCanSortClientOnly(true);
- fields.add(ackByField);
+ DataSourceBooleanField boolField = new DataSourceBooleanField("ack","Ack'd");
+ boolField.setCanSortClientOnly(true);
+ fields.add(boolField);
return fields;
}
@@ -204,13 +201,7 @@ public class AlertDataSource extends RPCDataSource<Alert> {
record.setAttribute("priority", from.getAlertDefinition().getPriority().name());
record.setAttribute("ctime", DATE_TIME_FORMAT.format(new Date(from.getCtime())));
if (from.getAckTime() >0)
- record.setAttribute("ack_time",DATE_TIME_FORMAT.format(new Date(from.getAckTime())));
- else
- record.setAttribute("ack_time","");
- if (from.getAckBy()!=null)
- record.setAttribute("ack_by",from.getAckBy().getName());
- else
- record.setAttribute("ack_by","");
+ record.setAttribute("ack","true");
Set<AlertConditionLog> conditionLogs = from.getConditionLogs();
String conditionText;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
index e0f3cd8..fe64b84 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
@@ -95,6 +95,13 @@ public class AlertsView extends VLayout {
ListGrid listGrid = this.table.getListGrid();
this.dataSource = new AlertDataSource();
this.table.setDataSource(this.dataSource);
+ listGrid.getField("name").setWidth("10%");
+ listGrid.getField("conditionText").setWidth("30%");
+ listGrid.getField("conditionValue").setWidth("15%");
+ listGrid.getField("recoveryInfo").setWidth("20%");
+ listGrid.getField("priority").setWidth("7%");
+ listGrid.getField("ctime").setWidth("13%");
+ listGrid.getField("ack").setWidth("5%");
this.table.addTableAction("Delete", Table.SelectionEnablement.ANY, DELETE_CONFIRM_MESSAGE, new TableAction() {
public void executeAction(ListGridRecord[] selection) {
@@ -198,6 +205,10 @@ public class AlertsView extends VLayout {
}
items.add(ackTimeItem);
+ StaticTextItem recoveryItem = new StaticTextItem("recovery","Recovery Info");
+ recoveryItem.setValue(record.getAttribute("recoveryInfo"));
+ items.add(recoveryItem);
+
form.setItems(items.toArray(new FormItem[items.size()]));
commit 18b171aee5f9be3443ed8602108a21c6113be2c7
Merge: 50a34dc... 6726c54...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 17 14:50:40 2010 -0400
Merge branch 'gwt' into gwt-jay
commit 50a34dc7ae6a60b64bec06571bfcf1ef609cd16c
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 17 14:47:43 2010 -0400
Add unique indexes to various bundle tables to avoid logical duplicates.
Also, fixed up a lot of advisory-related db-upgrade stuff left over from
the former core team. The db-upgrade, at least for this stuff, now matches
the schema definitions. Also, got the db-upgrade to run through from a
2.3.1 db on postgres. Also tweaked a couple of entity classes to match the
schema.
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml b/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
index b2663d4..683c991 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
@@ -410,8 +410,8 @@
<column name="SEVERITY" size="64" type="VARCHAR2" required="false"/>
<column name="ISSUE_DATE" type="LONG" required="false"/>
<column name="UPDATE_DATE" type="LONG" required="false"/>
- <column name="CTIME" type="LONG" required="false"/>
- <column name="LAST_MODIFIED" type="LONG" required="false"/>
+ <column name="CTIME" type="LONG" required="true"/>
+ <column name="LAST_MODIFIED" type="LONG" required="true"/>
<index name="RHQ_ADVISORY_NAME_UQ" unique="true">
<field ref="ADVISORY_NAME"/>
@@ -423,23 +423,18 @@
<index name="RHQ_ADVISORY_UDATE_IDX" unique="false">
<field ref="UPDATE_DATE"/>
- </index>
-
- <index name="RHQ_ADVISORY_SYN_IDX" unique="false">
- <field ref="SYNOPSIS"/>
- </index>
-
+ </index>
</table>
<table name="RHQ_ADVISORY_PACKAGE">
- <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/>
+ <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/>
<column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/>
<column name="PACKAGE_VERSION_ID" type="INTEGER" required="true" references="RHQ_PACKAGE_VERSION"/>
- <column name="LAST_MODIFIED" type="LONG" required="false"/>
+ <column name="LAST_MODIFIED" type="LONG" required="true"/>
<index name="RHQ_ADVISORY_PKG_IDX" unique="true">
<field ref="ADVISORY_ID"/>
- <field ref="PACKAGE_VERSIOn_ID"/>
+ <field ref="PACKAGE_VERSION_ID"/>
</index>
</table>
@@ -492,6 +487,11 @@
<column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/>
<column name="NAME" size="200" type="VARCHAR2" required="true"/>
<column name="RESOURCE_TYPE_ID" type="INTEGER" required="true" references="RHQ_RESOURCE_TYPE"/>
+
+ <!-- This index is for constraint, not performance -->
+ <index name="RHQ_BUNDLE_TYPE_UNIQUE" unique="true">
+ <field ref="NAME"/>
+ </index>
</table>
<!-- BUNDLE is a named piece of content that can be versioned and installed somewhere -->
@@ -501,6 +501,12 @@
<column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/>
<column name="BUNDLE_TYPE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_TYPE"/>
<column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/>
+
+ <!-- This index is for constraint, not performance -->
+ <index name="RHQ_BUNDLE_UNIQUE" unique="true">
+ <field ref="BUNDLE_TYPE_ID"/>
+ <field ref="NAME"/>
+ </index>
</table>
<!-- BUNDLE_VERSION represents an actual piece of content that needs to be installed somewhere -->
@@ -513,6 +519,13 @@
<column name="CONFIG_DEF_ID" type="INTEGER" required="false" references="RHQ_CONFIG_DEF" />
<column name="BUNDLE_ID" type="INTEGER" required="true" references="RHQ_BUNDLE"/>
<column name="DISTRIBUTION_ID" type="INTEGER" required="false" references="RHQ_DISTRIBUTION"/>
+
+ <!-- This index is for constraint, not performance -->
+ <index name="RHQ_BUNDLE_VERSION_UNIQUE" unique="true">
+ <field ref="BUNDLE_ID"/>
+ <field ref="NAME"/>
+ <field ref="VERSION"/>
+ </index>
</table>
<!-- Many-to-many table that links many repos to a particular bundle version -->
@@ -548,6 +561,12 @@
<column name="ENFORCEMENT_INTERVAL" type="INTEGER" required="false"/>
<column name="BUNDLE_VERSION_ID" type="INTEGER" required="true" references="RHQ_BUNDLE_VERSION"/>
<column name="BUNDLE_ID" type="INTEGER" required="false" references="RHQ_BUNDLE"/>
+
+ <!-- This index is for constraint, not performance -->
+ <index name="RHQ_BUNDLE_DEPLOY_DEF_UNIQUE" unique="true">
+ <field ref="BUNDLE_VERSION_ID"/>
+ <field ref="NAME"/>
+ </index>
</table>
<!-- Represents a bundle version that is deployed on a platform resource -->
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 85fe084..23f1fbd 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -2219,337 +2219,80 @@
<!-- RHQ Advisory Representation -->
<schemaSpec version="2.71">
- <schema-directSQL>
- <statement>
- CREATE TABLE RHQ_ADVISORY_TYPE ( ID INTEGER PRIMARY KEY )
- </statement>
- </schema-directSQL>
- <schema-alterColumn table="RHQ_ADVISORY_TYPE" column="ID" nullable="false" />
- <schema-addColumn table="RHQ_ADVISORY_TYPE" column="NAME" precision="200" columnType="VARCHAR2" />
- <schema-alterColumn table="RHQ_ADVISORY_TYPE" column="NAME" nullable="false" />
- <schema-addColumn table="RHQ_ADVISORY_TYPE" column="DESCRIPTION" precision="500" columnType="VARCHAR2" />
- <schema-directSQL>
- <statement>
- INSERT INTO
- RHQ_ADVISORY_TYPE ( ID, NAME, DESCRIPTION )
- VALUES ( 101, 'Bug Fix Advisory', 'Bug fix(RHBA) Advisory' )
- </statement>
- <statement>
- INSERT INTO
- RHQ_ADVISORY_TYPE ( ID, NAME, DESCRIPTION )
- VALUES ( 102, 'Product Enhancement Advisory', 'Product Enhancement(RHEA) Advisory' )
- </statement>
- <statement>
- INSERT INTO
- RHQ_ADVISORY_TYPE ( ID, NAME, DESCRIPTION )
- VALUES ( 103, 'Security Advisory', 'Security Advisory(RHSA) Advisory' )
- </statement>
- </schema-directSQL>
- <schema-directSQL>
- <statement>
- CREATE TABLE RHQ_ADVISORY_SEVERITY ( ID INTEGER PRIMARY KEY )
- </statement>
- </schema-directSQL>
- <schema-alterColumn table="RHQ_ADVISORY_SEVERITY" column="ID" nullable="false" />
- <schema-addColumn table="RHQ_ADVISORY_SEVERITY" column="RANK" columnType="INTEGER" />
- <schema-alterColumn table="RHQ_ADVISORY_SEVERITY" column="RANK" nullable="false" />
- <schema-addColumn table="RHQ_ADVISORY_SEVERITY" column="LABEL" precision="40" columnType="VARCHAR2" />
- <schema-alterColumn table="RHQ_ADVISORY_SEVERITY" column="LABEL" nullable="false" />
- <schema-directSQL>
- <statement>
- INSERT INTO
- RHQ_ADVISORY_TYPE ( ID, RANK, LABEL)
- VALUES ( 101, 0, 'errata.sev.label.critical' )
- </statement>
- <statement>
- INSERT INTO
- RHQ_ADVISORY_TYPE ( ID, RANK, LABEL)
- VALUES ( 102, 1, 'errata.sev.label.important' )
- </statement>
- <statement>
- INSERT INTO
- RHQ_ADVISORY_TYPE ( ID, RANK, LABEL)
- VALUES ( 103, 2, 'errata.sev.label.moderate' )
- </statement>
- <statement>
- INSERT INTO
- RHQ_ADVISORY_TYPE ( ID, RANK, LABEL)
- VALUES ( 104, 3, 'errata.sev.label.low' )
- </statement>
- </schema-directSQL>
- <schema-directSQL>
- <statement>
- CREATE TABLE RHQ_ADVISORY_FILE_TYPE ( ID INTEGER PRIMARY KEY )
- </statement>
- </schema-directSQL>
- <schema-alterColumn table="RHQ_ADVISORY_FILE_TYPE" column="ID" nullable="false" />
- <schema-addColumn table="RHQ_ADVISORY_FILE_TYPE" column="LABEL" precision="40" columnType="VARCHAR2" />
- <schema-alterColumn table="RHQ_ADVISORY_FILE_TYPE" column="LABEL" nullable="false" />
- <schema-directSQL>
- <statement>
- INSERT INTO
- RHQ_ADVISORY_FILE_TYPE ( ID, LABEL)
- VALUES ( 101, 'RPM' )
- </statement>
- <statement>
- INSERT INTO
- RHQ_ADVISORY_FILE_TYPE ( ID, LABEL)
- VALUES ( 102, 'SRPM' )
- </statement>
- <statement>
- INSERT INTO
- RHQ_ADVISORY_FILE_TYPE ( ID, LABEL)
- VALUES ( 103, 'IMG')
- </statement>
- <statement>
- INSERT INTO
- RHQ_ADVISORY_FILE_TYPE ( ID, LABEL)
- VALUES ( 104, 'OVAL')
- </statement>
- </schema-directSQL>
<schema-createSequence name="RHQ_ADVISORY_SEQ" initial="10001" />
<schema-directSQL>
-
<statement desc="Creating table RHQ_ADVISORY">
CREATE TABLE RHQ_ADVISORY ( ID INTEGER PRIMARY KEY )
</statement>
</schema-directSQL>
+
<schema-alterColumn table="RHQ_ADVISORY" column="ID" nullable="false" columnType="INTEGER" />
<schema-addColumn table="RHQ_ADVISORY" column="ADVISORY" precision="64" columnType="VARCHAR2" />
<schema-alterColumn table="RHQ_ADVISORY" column="ADVISORY" nullable="false" />
- <schema-addColumn table="RHQ_ADVISORY" column="ADVISORY_TYPE_ID" columnType="INTEGER" />
- <schema-alterColumn table="RHQ_ADVISORY" column="ADVISORY_TYPE_ID" nullable="false" />
- <schema-addColumn table="RHQ_ADVISORY" column="ADVISORY_NAME" precision="64" columnType="VARCHAR2" />
- <schema-alterColumn table="RHQ_ADVISORY" column="ADVISORY_NAME" nullable="false" />
+ <schema-addColumn table="RHQ_ADVISORY" column="ADVISORY_TYPE" precision="64" columnType="VARCHAR2" />
+ <schema-alterColumn table="RHQ_ADVISORY" column="ADVISORY_TYPE" nullable="false" />
<schema-addColumn table="RHQ_ADVISORY" column="ADVISORY_REL" precision="64" columnType="VARCHAR2" />
- <schema-alterColumn table="RHQ_ADVISORY" column="ADVISORY_REL" nullable="false" />
- <schema-addColumn table="RHQ_ADVISORY" column="DESCRIPTION" precision="4000" columnType="VARCHAR2" />
- <schema-alterColumn table="RHQ_ADVISORY" column="DESCRIPTION" nullable="false" />
+ <schema-addColumn table="RHQ_ADVISORY" column="ADVISORY_NAME" precision="64" columnType="VARCHAR2" />
+ <schema-addColumn table="RHQ_ADVISORY" column="DESCRIPTION" precision="4000" columnType="VARCHAR2" />
<schema-addColumn table="RHQ_ADVISORY" column="SYNOPSIS" precision="4000" columnType="VARCHAR2" />
- <schema-alterColumn table="RHQ_ADVISORY" column="SYNOPSIS" nullable="false" />
+ <schema-alterColumn table="RHQ_ADVISORY" column="SYNOPSIS" nullable="false" />
<schema-addColumn table="RHQ_ADVISORY" column="TOPIC" precision="4000" columnType="VARCHAR2" />
- <schema-alterColumn table="RHQ_ADVISORY" column="TOPIC" nullable="false" />
<schema-addColumn table="RHQ_ADVISORY" column="SOLUTION" precision="4000" columnType="VARCHAR2" />
- <schema-alterColumn table="RHQ_ADVISORY" column="SOLUTION" nullable="false" />
- <schema-addColumn table="RHQ_ADVISORY" column="SEVERITY_ID" columnType="INTEGER" />
- <schema-alterColumn table="RHQ_ADVISORY" column="SEVERITY_ID" nullable="false" />
+ <schema-addColumn table="RHQ_ADVISORY" column="SEVERITY" precision="64" columnType="VARCHAR2" />
<schema-addColumn table="RHQ_ADVISORY" column="ISSUE_DATE" columnType="LONG" />
- <schema-alterColumn table="RHQ_ADVISORY" column="ISSUE_DATE" nullable="false" />
<schema-addColumn table="RHQ_ADVISORY" column="UPDATE_DATE" columnType="LONG" />
- <schema-alterColumn table="RHQ_ADVISORY" column="UPDATE_DATE" nullable="false" />
<schema-addColumn table="RHQ_ADVISORY" column="CTIME" columnType="LONG" />
<schema-alterColumn table="RHQ_ADVISORY" column="CTIME" nullable="false" />
<schema-addColumn table="RHQ_ADVISORY" column="LAST_MODIFIED" columnType="LONG" />
<schema-alterColumn table="RHQ_ADVISORY" column="LAST_MODIFIED" nullable="false" />
- <schema-directSQL>
- <statement targetDBVendor="postgresql">
- CREATE UNIQUE INDEX RHQ_ADVISORY_NAME_UQ
- ON RHQ_ADVISORY ( ADVISORY_NAME )
- </statement>
- <statement targetDBVendor="oracle">
- CREATE UNIQUE INDEX RHQ_ADVISORY_NAME_UQ
- ON RHQ_ADVISORY ( ADVISORY_NAME )
- </statement>
- </schema-directSQL>
- <schema-directSQL>
- <statement targetDBVendor="postgresql">
- CREATE UNIQUE INDEX RHQ_ADVISORY_UQ
- ON RHQ_ADVISORY ( ADVISORY )
- </statement>
- <statement targetDBVendor="oracle">
- CREATE UNIQUE INDEX RHQ_ADVISORY_UQ
- ON RHQ_ADVISORY ( ADVISORY )
- </statement>
- </schema-directSQL>
-
- <schema-directSQL>
- <statement targetDBVendor="postgresql">
- CREATE INDEX RHQ_ADVISORY_UDATE_IDX
- ON RHQ_ADVISORY (UPDATE_DATE )
- </statement>
- <statement targetDBVendor="oracle">
- CREATE INDEX RHQ_ADVISORY_UDATE_IDX
- ON RHQ_ADVISORY (UPDATE_DATE )
- </statement>
- </schema-directSQL>
- <schema-directSQL>
- <statement targetDBVendor="postgresql">
- CREATE INDEX RHQ_ADVISORY_SYN_IDX
- ON RHQ_ADVISORY ( SYNOPSIS )
- </statement>
- <statement targetDBVendor="oracle">
- CREATE INDEX RHQ_ADVISORY_SYN_IDX
- ON RHQ_ADVISORY ( SYNOPSIS )
- </statement>
- </schema-directSQL>
- <schema-directSQL>
- <statement targetDBVendor="oracle">
- ALTER TABLE RHQ_ADVISORY
- ADD CONSTRAINT RHQ_ADV_TYPE_FKEY
- FOREIGN KEY ( ADVISORY_TYPE_ID )
- REFERENCES RHQ_ADVISORY_TYPE ( ID )
- </statement>
- <statement targetDBVendor="postgresql">
- ALTER TABLE RHQ_ADVISORY
- ADD CONSTRAINT RHQ_ADV_TYPE_FKEY
- FOREIGN KEY ( ADVISORY_TYPE_ID )
- REFERENCES RHQ_ADVISORY_TYPE ( ID )
- </statement>
- </schema-directSQL>
- <schema-directSQL>
- <statement targetDBVendor="oracle">
- ALTER TABLE RHQ_ADVISORY
- ADD CONSTRAINT RHQ_ADV_SEV_FKEY
- FOREIGN KEY ( SEVERITY_ID )
- REFERENCES RHQ_ADVISORY_SEVERITY ( ID )
- </statement>
- <statement targetDBVendor="postgresql">
- ALTER TABLE RHQ_ADVISORY
- ADD CONSTRAINT RHQ_ADV_SEV_FKEY
- FOREIGN KEY ( SEVERITY_ID )
- REFERENCES RHQ_ADVISORY_SEVERITY ( ID )
- </statement>
- </schema-directSQL>
- <schema-createSequence name="RHQ_ADVISORY_FILE_SEQ" initial="10001" />
+
<schema-directSQL>
<statement>
- CREATE TABLE RHQ_ADVISORY_FILE ( ID INTEGER )
- </statement>
- </schema-directSQL>
- <schema-alterColumn table="RHQ_ADVISORY_FILE" column="ID" nullable="false" />
- <schema-addColumn table="RHQ_ADVISORY_FILE" column="ADVISORY_ID" columnType="INTEGER" />
- <schema-alterColumn table="RHQ_ADVISORY_FILE" column="ADVISORY_ID" nullable="false" />
- <schema-addColumn table="RHQ_ADVISORY_FILE" column="FILE_TYPE_ID" columnType="INTEGER" />
- <schema-alterColumn table="RHQ_ADVISORY_FILE" column="FILE_TYPE_ID" nullable="false" />
- <schema-addColumn table="RHQ_ADVISORY_FILE" column="RELATIVE_FILENAME" precision="256" columnType="VARCHAR2" />
- <schema-alterColumn table="RHQ_ADVISORY_FILE" column="RELATIVE_FILENAME" nullable="false" />
- <schema-addColumn table="RHQ_ADVISORY_FILE" column="MD5SUM" precision="64" columnType="VARCHAR2" />
- <schema-alterColumn table="RHQ_ADVISORY_FILE" column="MD5SUM" nullable="false" />
- <schema-addColumn table="RHQ_ADVISORY_FILE" column="LAST_MODIFIED" columnType="LONG" />
- <schema-alterColumn table="RHQ_ADVISORY_FILE" column="LAST_MODIFIED" nullable="false" />
- <schema-directSQL>
- <statement targetDBVendor="postgresql">
- CREATE UNIQUE INDEX RHQ_ADVISORY_ID_FILE_UQ
- ON RHQ_ADVISORY_FILE ( ADVISORY_ID, RELATIVE_FILENAME )
- </statement>
- <statement targetDBVendor="oracle">
- CREATE UNIQUE INDEX RHQ_ADVISORY_ID_FILE_UQ
- ON RHQ_ADVISORY_FILE ( ADVISORY_ID, RELATIVE_FILENAME )
- </statement>
- </schema-directSQL>
- <schema-directSQL>
- <statement targetDBVendor="oracle">
- ALTER TABLE RHQ_ADVISORY_FILE
- ADD CONSTRAINT RHQ_ADV_FILE_FKEY
- FOREIGN KEY ( ADVISORY_ID)
- REFERENCES RHQ_ADVISORY ( ID )
- </statement>
- <statement targetDBVendor="postgresql">
- ALTER TABLE RHQ_ADVISORY_FILE
- ADD CONSTRAINT RHQ_ADV_FILE_FKEY
- FOREIGN KEY ( ADVISORY_ID)
- REFERENCES RHQ_ADVISORY ( ID )
- </statement>
- </schema-directSQL>
- <schema-directSQL>
- <statement targetDBVendor="oracle">
- ALTER TABLE RHQ_ADVISORY_FILE
- ADD CONSTRAINT RHQ_ADV_FILE_TYPE_FKEY
- FOREIGN KEY ( FILE_TYPE_ID )
- REFERENCES RHQ_ADVISORY_FILE_TYPE ( ID )
+ CREATE UNIQUE INDEX RHQ_ADVISORY_NAME_UQ ON RHQ_ADVISORY ( ADVISORY_NAME )
</statement>
- <statement targetDBVendor="postgresql">
- ALTER TABLE RHQ_ADVISORY_FILE
- ADD CONSTRAINT RHQ_ADV_FILE_TYPE_FKEY
- FOREIGN KEY ( FILE_TYPE_TYPE )
- REFERENCES RHQ_ADVISORY_FILE_TYPE ( ID )
- </statement>
- </schema-directSQL>
- <schema-directSQL>
<statement>
- CREATE TABLE RHQ_ADVISORY_PACKAGE_MAP ( ADVISORY_ID INTEGER )
- </statement>
- </schema-directSQL>
- <schema-alterColumn table="RHQ_ADVISORY_PACKAGE_MAP" column="ADVISORY_ID" nullable="false" />
- <schema-addColumn table="RHQ_ADVISORY_PACKAGE_MAP" column="PACKAGE_ID" columnType="INTEGER" />
- <schema-alterColumn table="RHQ_ADVISORY_PACKAGE_MAP" column="PACKAGE_ID" nullable="false" />
- <schema-directSQL>
- <statement targetDBVendor="oracle">
- ALTER TABLE RHQ_ADVISORY_PACKAGE_MAP
- ADD CONSTRAINT RHQ_ADV_PKG_MAP_KEY
- PRIMARY KEY ( ADVISORY_ID, PACKAGE_ID )
+ CREATE UNIQUE INDEX RHQ_ADVISORY_UQ ON RHQ_ADVISORY ( ADVISORY )
</statement>
- <statement targetDBVendor="postgresql">
- ALTER TABLE RHQ_ADVISORY_PACKAGE_MAP
- ADD CONSTRAINT RHQ_ADV_PKG_MAP_KEY
- PRIMARY KEY ( ADVISORY_ID, PACKAGE_ID )
- </statement>
- <statement targetDBVendor="oracle">
- ALTER TABLE RHQ_ADVISORY_PACKAGE_MAP
- ADD FOREIGN KEY ( ADVISORY_ID )
- REFERENCES RHQ_ADVISORY ( ID )
- </statement>
- <statement targetDBVendor="postgresql">
- ALTER TABLE RHQ_ADVISORY_PACKAGE_MAP
- ADD FOREIGN KEY ( ADVISORY_ID )
- REFERENCES RHQ_ADVISORY ( ID )
- </statement>
- <statement targetDBVendor="oracle">
- ALTER TABLE RHQ_ADVISORY_PACKAGE_MAP
- ADD FOREIGN KEY ( PACKAGE_ID )
- REFERENCES RHQ_PACKAGE ( ID )
- </statement>
- <statement targetDBVendor="postgresql">
- ALTER TABLE RHQ_ADVISORY_PACKAGE_MAP
- ADD FOREIGN KEY ( PACKAGE_ID )
- REFERENCES RHQ_PACKAGE ( ID )
+ <statement>
+ CREATE INDEX RHQ_ADVISORY_UDATE_IDX ON RHQ_ADVISORY (UPDATE_DATE )
</statement>
</schema-directSQL>
+ <schema-createSequence name="RHQ_ADVISORY_PACKAGE_SEQ" initial="10001" />
<schema-directSQL>
<statement>
- CREATE TABLE RHQ_ADVISORY_FILE_PKG_MAP ( ADVISORY_ID INTEGER )
+ CREATE TABLE RHQ_ADVISORY_PACKAGE ( ID INTEGER PRIMARY KEY )
</statement>
</schema-directSQL>
- <schema-alterColumn table="RHQ_ADVISORY_FILE_PKG_MAP" column="ADVISORY_FILE_ID" nullable="false" />
- <schema-addColumn table="RHQ_ADVISORY_FILE_PKG_MAP" column="PACKAGE_ID" columnType="INTEGER" />
- <schema-alterColumn table="RHQ_ADVISORY_FILE_PKG_MAP" column="PACKAGE_ID" nullable="false" />
+ <schema-alterColumn table="RHQ_ADVISORY_PACKAGE" column="ID" nullable="false" />
+ <schema-addColumn table="RHQ_ADVISORY_PACKAGE" column="ADVISORY_ID" columnType="INTEGER" />
+ <schema-alterColumn table="RHQ_ADVISORY_PACKAGE" column="ADVISORY_ID" nullable="false" />
+ <schema-addColumn table="RHQ_ADVISORY_PACKAGE" column="PACKAGE_VERSION_ID" columnType="INTEGER" />
+ <schema-alterColumn table="RHQ_ADVISORY_PACKAGE" column="PACKAGE_VERSION_ID" nullable="false" />
+ <schema-addColumn table="RHQ_ADVISORY_PACKAGE" column="LAST_MODIFIED" columnType="LONG" />
+ <schema-alterColumn table="RHQ_ADVISORY_PACKAGE" column="LAST_MODIFIED" nullable="false" />
<schema-directSQL>
- <statement targetDBVendor="oracle">
- ALTER TABLE RHQ_ADVISORY_FILE_PKG_MAP
- ADD CONSTRAINT RHQ_ADV_FILE_PKG_MAP_KEY
- PRIMARY KEY ( ADVISORY_FILE_ID, PACKAGE_ID )
- </statement>
- <statement targetDBVendor="postgresql">
- ALTER TABLE RHQ_ADVISORY_FILE_PKG_MAP
- ADD CONSTRAINT RHQ_ADV_FILE_PKG_MAP_KEY
- PRIMARY KEY ( ADVISORY_FILE_ID, PACKAGE_ID )
- </statement>
- <statement targetDBVendor="oracle">
- ALTER TABLE RHQ_ADVISORY_FILE_PKG_MAP
- ADD FOREIGN KEY ( ADVISORY_FILE_ID )
- REFERENCES RHQ_ADVISORY_FILE ( ID )
- </statement>
- <statement targetDBVendor="postgresql">
- ALTER TABLE RHQ_ADVISORY_FILE_PKG_MAP
- ADD FOREIGN KEY ( ADVISORY_FILE_ID )
- REFERENCES RHQ_ADVISORY_FILE ( ID )
- </statement>
- <statement targetDBVendor="oracle">
- ALTER TABLE RHQ_ADVISORY_FILE_PKG_MAP
- ADD FOREIGN KEY ( PACKAGE_ID )
- REFERENCES RHQ_PACKAGE ( ID )
+ <statement>
+ CREATE UNIQUE INDEX RHQ_ADVISORY_PACKAGE_UQ ON RHQ_ADVISORY_PACKAGE ( ADVISORY_ID, PACKAGE_VERSION_ID )
</statement>
- <statement targetDBVendor="postgresql">
- ALTER TABLE RHQ_ADVISORY_FILE_PKG_MAP
- ADD FOREIGN KEY ( PACKAGE_ID )
- REFERENCES RHQ_PACKAGE ( ID )
+ <statement>
+ ALTER TABLE RHQ_ADVISORY_PACKAGE
+ ADD CONSTRAINT RHQ_ADVISORY_FKEY
+ FOREIGN KEY ( ADVISORY_ID )
+ REFERENCES RHQ_ADVISORY ( ID )
+ </statement>
+ <statement>
+ ALTER TABLE RHQ_ADVISORY_PACKAGE
+ ADD CONSTRAINT RHQ_PACKAGE_VERSION_FKEY
+ FOREIGN KEY ( PACKAGE_VERSION_ID )
+ REFERENCES RHQ_PACKAGE_VERSION ( ID )
</statement>
</schema-directSQL>
+
<schema-createSequence name="RHQ_CVE_SEQ" initial="101" />
<schema-directSQL>
<statement>
- CREATE TABLE RHQ_CVE ( ID INTEGER )
+ CREATE TABLE RHQ_CVE ( ID INTEGER PRIMARY KEY )
</statement>
</schema-directSQL>
<schema-alterColumn table="RHQ_CVE" column="ID" nullable="false" />
@@ -2558,84 +2301,60 @@
<schema-directSQL>
<statement>
- CREATE TABLE RHQ_ADVISORY_CVE ( ADVISORY_ID INTEGER )
+ CREATE TABLE RHQ_ADVISORY_CVE ( ID INTEGER PRIMARY KEY )
</statement>
</schema-directSQL>
+ <schema-alterColumn table="RHQ_ADVISORY_CVE" column="ID" nullable="false" />
+ <schema-addColumn table="RHQ_ADVISORY_CVE" column="ADVISORY_ID" columnType="INTEGER" />
<schema-alterColumn table="RHQ_ADVISORY_CVE" column="ADVISORY_ID" nullable="false" />
<schema-addColumn table="RHQ_ADVISORY_CVE" column="CVE_ID" columnType="INTEGER" />
<schema-alterColumn table="RHQ_ADVISORY_CVE" column="CVE_ID" nullable="false" />
- <schema-addColumn table="RHQ_ADVISORY_CVE" column="CTIME" columnType="LONG" />
- <schema-alterColumn table="RHQ_ADVISORY_CVE" column="CTIME" nullable="false" />
<schema-addColumn table="RHQ_ADVISORY_CVE" column="LAST_MODIFIED" columnType="LONG" />
<schema-alterColumn table="RHQ_ADVISORY_CVE" column="LAST_MODIFIED" nullable="false" />
<schema-directSQL>
- <statement targetDBVendor="oracle">
- ALTER TABLE RHQ_ADVISORY_CVE
- ADD CONSTRAINT RHQ_ADV_CVE_MAP_KEY
- PRIMARY KEY ( ADVISORY_ID, CVE_ID )
- </statement>
- <statement targetDBVendor="postgresql">
- ALTER TABLE RHQ_ADVISORY_CVE
- ADD CONSTRAINT RHQ_ADV_CVE_MAP_KEY
- PRIMARY KEY ( ADVISORY_ID, CVE_ID )
- </statement>
- <statement targetDBVendor="oracle">
- ALTER TABLE RHQ_ADVISORY_CVE
- ADD FOREIGN KEY ( ADVISORY_ID )
- REFERENCES RHQ_ADVISORY ( ID )
+ <statement>
+ CREATE UNIQUE INDEX RHQ_ADVISORY_CVE_UQ ON RHQ_ADVISORY_CVE ( ADVISORY_ID, CVE_ID )
</statement>
- <statement targetDBVendor="postgresql">
+ <statement>
ALTER TABLE RHQ_ADVISORY_CVE
- ADD FOREIGN KEY ( ADVISORY_ID )
+ ADD CONSTRAINT RHQ_ADVISORY_FKEY
+ FOREIGN KEY ( ADVISORY_ID )
REFERENCES RHQ_ADVISORY ( ID )
</statement>
- <statement targetDBVendor="oracle">
- ALTER TABLE RHQ_ADVISORY_CVE
- ADD FOREIGN KEY ( CVE_ID )
- REFERENCES RHQ_CVE ( ID )
- </statement>
- <statement targetDBVendor="postgresql">
- ALTER TABLE RHQ_ADVISORY_CVE
- ADD FOREIGN KEY ( CVE_ID )
- REFERENCES RHQ_CVE ( ID )
- </statement>
+ <statement>
+ ALTER TABLE RHQ_ADVISORY_CVE
+ ADD CONSTRAINT RHQ_CVE_FKEY
+ FOREIGN KEY ( CVE_ID )
+ REFERENCES RHQ_CVE ( ID )
+ </statement>
</schema-directSQL>
+ <schema-createSequence name="RHQ_ADVISORY_BUGLIST_SEQ" initial="10001" />
<schema-directSQL>
<statement>
- CREATE TABLE RHQ_ADVISORY_BUGLIST ( ADVISORY_ID INTEGER )
+ CREATE TABLE RHQ_ADVISORY_BUGLIST ( ID INTEGER PRIMARY KEY)
</statement>
</schema-directSQL>
+ <schema-alterColumn table="RHQ_ADVISORY_BUGLIST" column="ID" nullable="false" />
+ <schema-addColumn table="RHQ_ADVISORY_BUGLIST" column="ADVISORY_ID" columnType="INTEGER" />
<schema-alterColumn table="RHQ_ADVISORY_BUGLIST" column="ADVISORY_ID" nullable="false" />
- <schema-addColumn table="RHQ_ADVISORY_BUGLIST" column="BUG_ID" columnType="INTEGER" />
+ <schema-addColumn table="RHQ_ADVISORY_BUGLIST" column="BUG_ID" PRECISION="256" columnType="VARCHAR2" />
<schema-alterColumn table="RHQ_ADVISORY_BUGLIST" column="BUG_ID" nullable="false" />
- <schema-addColumn table="RHQ_ADVISORY_BUGLIST" column="CTIME" columnType="LONG" />
- <schema-alterColumn table="RHQ_ADVISORY_BUGLIST" column="CTIME" nullable="false" />
<schema-addColumn table="RHQ_ADVISORY_BUGLIST" column="LAST_MODIFIED" columnType="LONG" />
<schema-alterColumn table="RHQ_ADVISORY_BUGLIST" column="LAST_MODIFIED" nullable="false" />
<schema-directSQL>
- <statement targetDBVendor="oracle">
- ALTER TABLE RHQ_ADVISORY_BUGLIST
- ADD CONSTRAINT RHQ_ADV_BUG_LIST_KEY
- PRIMARY KEY ( ADVISORY_ID, BUG_ID )
- </statement>
- <statement targetDBVendor="postgresql">
- ALTER TABLE RHQ_ADVISORY_BUGLIST
- ADD CONSTRAINT RHQ_ADV_BUG_LIST_KEY
- PRIMARY KEY ( ADVISORY_ID, BUG_ID )
- </statement>
- <statement targetDBVendor="oracle">
- ALTER TABLE RHQ_ADVISORY_BUGLIST
- ADD FOREIGN KEY ( ADVISORY_ID )
- REFERENCES RHQ_ADVISORY ( ID )
- </statement>
- <statement targetDBVendor="postgresql">
- ALTER TABLE RHQ_ADVISORY_BUGLIST
- ADD FOREIGN KEY ( ADVISORY_ID )
- REFERENCES RHQ_ADVISORY ( ID )
- </statement>
+ <statement>
+ CREATE UNIQUE INDEX RHQ_ADVISORY_BUGLIST_UQ ON RHQ_ADVISORY_BUGLIST ( ADVISORY_ID, BUG_ID )
+ </statement>
+ <statement>
+ ALTER TABLE RHQ_ADVISORY_BUGLIST
+ ADD CONSTRAINT RHQ_ADVISORY_FKEY
+ FOREIGN KEY ( ADVISORY_ID )
+ REFERENCES RHQ_ADVISORY ( ID )
+ </statement>
</schema-directSQL>
+
<schema-directSQL>
<statement>
CREATE TABLE RHQ_REPO_ADVISORY ( REPO_ID INTEGER )
@@ -2644,40 +2363,25 @@
<schema-alterColumn table="RHQ_REPO_ADVISORY" column="REPO_ID" nullable="false" />
<schema-addColumn table="RHQ_REPO_ADVISORY" column="ADVISORY_ID" columnType="INTEGER" />
<schema-alterColumn table="RHQ_REPO_ADVISORY" column="ADVISORY_ID" nullable="false" />
- <schema-addColumn table="RHQ_REPO_ADVISORY" column="CTIME" columnType="LONG" />
- <schema-alterColumn table="RHQ_REPO_ADVISORY" column="CTIME" nullable="false" />
<schema-addColumn table="RHQ_REPO_ADVISORY" column="LAST_MODIFIED" columnType="LONG" />
<schema-alterColumn table="RHQ_REPO_ADVISORY" column="LAST_MODIFIED" nullable="false" />
<schema-directSQL>
- <statement targetDBVendor="oracle">
- ALTER TABLE RHQ_REPO_ADVISORY
- ADD CONSTRAINT RHQ_REPO_ADV_MAP_KEY
- PRIMARY KEY ( REPO_ID, ADVISORY_ID )
- </statement>
- <statement targetDBVendor="postgresql">
+ <statement>
ALTER TABLE RHQ_REPO_ADVISORY
ADD CONSTRAINT RHQ_REPO_ADV_MAP_KEY
PRIMARY KEY ( REPO_ID, ADVISORY_ID )
</statement>
- <statement targetDBVendor="oracle">
- ALTER TABLE RHQ_REPO_ADVISORY
- ADD FOREIGN KEY ( ADVISORY_ID )
- REFERENCES RHQ_ADVISORY ( ID )
- </statement>
- <statement targetDBVendor="postgresql">
- ALTER TABLE RHQ_REPO_ADVISORY
- ADD FOREIGN KEY ( ADVISORY_ID )
- REFERENCES RHQ_ADVISORY ( ID )
- </statement>
- <statement targetDBVendor="oracle">
+ <statement>
ALTER TABLE RHQ_REPO_ADVISORY
- ADD FOREIGN KEY ( REPO_ID )
+ ADD CONSTRAINT RHQ_REPO_FKEY
+ FOREIGN KEY ( REPO_ID )
REFERENCES RHQ_REPO ( ID )
</statement>
- <statement targetDBVendor="postgresql">
+ <statement>
ALTER TABLE RHQ_REPO_ADVISORY
- ADD FOREIGN KEY ( REPO_ID )
- REFERENCES RHQ_REPO ( ID )
+ ADD CONSTRAINT RHQ_ADVISORY_FKEY
+ FOREIGN KEY ( ADVISORY_ID )
+ REFERENCES RHQ_ADVISORY ( ID )
</statement>
</schema-directSQL>
</schemaSpec>
@@ -2710,54 +2414,6 @@
</schema-directSQL>
</schemaSpec>
- <schemaSpec version="2.74">
- <schema-createSequence name="RHQ_ADVISORY_ID_SEQ" initial="10001" />
- <schema-createSequence name="RHQ_ADVISORY_CVE_ID_SEQ" initial="10001" />
- <schema-directSQL>
- <statement>
- ALTER TABLE RHQ_ADVISORY_CVE DROP CONSTRAINT RHQ_ADV_CVE_MAP_KEY
- </statement>
- </schema-directSQL>
- <schema-addColumn table="RHQ_ADVISORY_CVE" column="ID" columnType="INTEGER" />
- <schema-alterColumn table="RHQ_ADVISORY_CVE" column="ID" nullable="false" />
- <schema-directSQL>
- <statement>
- ALTER TABLE RHQ_ADVISORY_CVE ALTER COLUMN ID SET DEFAULT NEXTVAL('RHQ_ADVISORY_CVE_SEQ')
- </statement>
- </schema-directSQL>
- <schema-createSequence name="RHQ_ADVISORY_BUGLIST_ID_SEQ" initial="10001" />
- <schema-directSQL>
- <statement>
- ALTER TABLE RHQ_ADVISORY_BUGLIST DROP CONSTRAINT RHQ_ADV_BUG_LIST_KEY
- </statement>
- </schema-directSQL>
- <schema-addColumn table="RHQ_ADVISORY_BUGLIST" column="ID" columnType="INTEGER" />
- <schema-alterColumn table="RHQ_ADVISORY_BUGLIST" column="ID" nullable="false" />
- <schema-directSQL>
- <statement>
- ALTER TABLE RHQ_ADVISORY_BUGLIST ALTER COLUMN ID SET DEFAULT NEXTVAL('RHQ_ADVISORY_BUG_SEQ')
- </statement>
- </schema-directSQL>
- <schema-directSQL>
- <statement>
- ALTER TABLE RHQ_ADVISORY_PACKAGE_MAP RENAME TO RHQ_ADVISORY_PACKAGE
- </statement>
- </schema-directSQL>
- <schema-createSequence name="RHQ_ADVISORY_PACKAGE_ID_SEQ" initial="10001" />
- <schema-directSQL>
- <statement>
- ALTER TABLE RHQ_ADVISORY_PACKAGE DROP CONSTRAINT RHQ_ADV_PKG_MAP_KEY
- </statement>
- </schema-directSQL>
- <schema-addColumn table="RHQ_ADVISORY_PACKAGE" column="ID" columnType="INTEGER" />
- <schema-alterColumn table="RHQ_ADVISORY_PACKAGE" column="ID" nullable="false" />
- <schema-directSQL>
- <statement>
- ALTER TABLE RHQ_ADVISORY_PACKAGE ALTER COLUMN ID SET DEFAULT NEXTVAL('RHQ_ADVISORY_PKG_SEQ')
- </statement>
- </schema-directSQL>
- </schemaSpec>
-
<schemaSpec version="2.75">
<schema-addColumn table="RHQ_REPO" column="SYNC_SCHEDULE" columnType="VARCHAR2" precision="64" />
</schemaSpec>
@@ -3211,6 +2867,32 @@
<schema-addColumn table="RHQ_BUNDLE_VERSION" column="DESCRIPTION" columnType="VARCHAR2" precision="500" />
</schemaSpec>
+ <schemaSpec version="2.78.3">
+ <schema-directSQL>
+ <statement desc="Creating RHQ_BUNDLE_TYPE unique constraint">
+ CREATE UNIQUE INDEX RHQ_BUNDLE_TYPE_UNIQUE ON RHQ_BUNDLE_TYPE (name)
+ </statement>
+ </schema-directSQL>
+
+ <schema-directSQL>
+ <statement desc="Creating RHQ_BUNDLE unique constraint">
+ CREATE UNIQUE INDEX RHQ_BUNDLE_UNIQUE ON RHQ_BUNDLE (bundle_type_id, name)
+ </statement>
+ </schema-directSQL>
+
+ <schema-directSQL>
+ <statement desc="Creating RHQ_BUNDLE_VERSION unique constraint">
+ CREATE UNIQUE INDEX RHQ_BUNDLE_VERSION_UNIQUE ON RHQ_BUNDLE_VERSION (bundle_id, name, version)
+ </statement>
+ </schema-directSQL>
+
+ <schema-directSQL>
+ <statement desc="Creating RHQ_BUNDLE_DEPLOY_DEF unique constraint">
+ CREATE UNIQUE INDEX RHQ_BUNDLE_DEPLOY_DEF_UNIQUE ON RHQ_BUNDLE_DEPLOY_DEF (bundle_version_id, name)
+ </statement>
+ </schema-directSQL>
+ </schemaSpec>
+
<schemaSpec version="2.79">
<schema-directSQL>
<statement desc="Normalizing resource group descriptions">
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/content/Advisory.java b/modules/core/domain/src/main/java/org/rhq/core/domain/content/Advisory.java
index d6389b1..26291fb 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/content/Advisory.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/content/Advisory.java
@@ -89,10 +89,10 @@ public class Advisory implements Serializable {
@Column(name = "UPDATE_DATE", nullable = true)
private long update_date;
- @Column(name = "CTIME", nullable = true)
+ @Column(name = "CTIME", nullable = false)
private long ctime;
- @Column(name = "LAST_MODIFIED", nullable = true)
+ @Column(name = "LAST_MODIFIED", nullable = false)
private long lastModifiedDate;
@OneToMany(mappedBy = "advisory", fetch = FetchType.EAGER, cascade = CascadeType.ALL)
@@ -264,9 +264,15 @@ public class Advisory implements Serializable {
return true;
}
+ public long getCtime() {
+ return ctime;
+ }
+
@PrePersist
void onPersist() {
- this.setLastModifiedDate(System.currentTimeMillis());
+ long now = System.currentTimeMillis();
+ this.ctime = now;
+ this.setLastModifiedDate(now);
}
@PreUpdate
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/content/AdvisoryPackage.java b/modules/core/domain/src/main/java/org/rhq/core/domain/content/AdvisoryPackage.java
index 17bd2d8..2185c65 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/content/AdvisoryPackage.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/content/AdvisoryPackage.java
@@ -79,7 +79,7 @@ public class AdvisoryPackage implements Serializable {
@JoinColumn(name = "PACKAGE_VERSION_ID", referencedColumnName = "ID", nullable = false)
private PackageVersion pkg;
- @Column(name = "LAST_MODIFIED", nullable = true)
+ @Column(name = "LAST_MODIFIED", nullable = false)
private long lastModifiedDate;
protected AdvisoryPackage() {
commit 6726c5492bdff5683348e420e3ef8aff4414aadb
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Mar 17 14:18:04 2010 -0400
Adding hooks for supplying ClickHandlers for the settings and help buttons
I spent a good bit of time looking and did not see another way of accessing the header
controls for a window.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/Portlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/Portlet.java
index 71e97c4..c0ec225 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/Portlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/Portlet.java
@@ -20,16 +20,38 @@ package org.rhq.enterprise.gui.coregui.client.dashboard;
import com.smartgwt.client.types.DragAppearance;
import com.smartgwt.client.types.HeaderControls;
-import com.smartgwt.client.types.LayoutPolicy;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.widgets.HeaderControl;
import com.smartgwt.client.widgets.Window;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
/**
* @author Greg Hinkle
*/
public class Portlet extends Window {
+ private static final ClickHandler NO_OP_HANDLER = new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ }
+ };
+
+ private ClickHandler settingsHandlerDelegate = NO_OP_HANDLER;
+
+ private ClickHandler helpHandlerDelegate = NO_OP_HANDLER;
+
+ private ClickHandler settingsHandler = new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ settingsHandlerDelegate.onClick(clickEvent);
+ }
+ };
+
+ private ClickHandler helpHandler = new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ helpHandlerDelegate.onClick(clickEvent);
+ }
+ };
+
public Portlet() {
setShowShadow(false);
@@ -43,7 +65,13 @@ public class Portlet extends Window {
setCanDrop(true);
// customize the appearance and order of the controls in the window header
- setHeaderControls(HeaderControls.MINIMIZE_BUTTON, HeaderControls.HEADER_LABEL, new HeaderControl(HeaderControl.SETTINGS), new HeaderControl(HeaderControl.HELP), HeaderControls.CLOSE_BUTTON);
+ setHeaderControls(
+ HeaderControls.MINIMIZE_BUTTON,
+ HeaderControls.HEADER_LABEL,
+ new HeaderControl(HeaderControl.SETTINGS, settingsHandler),
+ new HeaderControl(HeaderControl.HELP, helpHandler),
+ HeaderControls.CLOSE_BUTTON
+ );
// show either a shadow, or translucency, when dragging a portlet
// (could do both at the same time, but these are not visually compatible effects)
@@ -58,4 +86,12 @@ public class Portlet extends Window {
setCanDragResize(true);
setResizeFrom("B");
}
+
+ public void setSettingsClickHandler(ClickHandler handler) {
+ settingsHandlerDelegate = handler;
+ }
+
+ public void setHelpClickHandler(ClickHandler handler) {
+ helpHandlerDelegate = handler;
+ }
}
\ No newline at end of file
commit 1ea2a7b5a47cf6b7642cc4fa75693ea383777de0
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Mar 17 17:49:52 2010 +0100
Provide a better column title
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
index 15853a1..e0f3cd8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
@@ -243,7 +243,7 @@ public class AlertsView extends VLayout {
ListGrid grid = table.getListGrid();
grid.setData((Record[]) input);
- ListGridField condition = new ListGridField("text");
+ ListGridField condition = new ListGridField("text","Matching condition");
condition.setWidth("60%");
ListGridField value = new ListGridField("value","Value");
commit 19d0379ca1f292002e9fc725e7301ffdd7dc0ae1
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Mar 17 17:28:33 2010 +0100
Display conditions
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
index ae32169..9df2812 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
@@ -234,12 +234,30 @@ public class AlertDataSource extends RPCDataSource<Alert> {
record.setAttribute("conditionText", conditionText);
record.setAttribute("conditionValue", conditionValue);
+ // We also need the'raw' notification data to show in details
+ DataClass[] conditions = new DataClass[from.getConditionLogs().size()];
+ int i = 0;
+ for (AlertConditionLog log : from.getConditionLogs()) {
+ AlertCondition condition = log.getCondition();
+ DataClass dc = new DataClass();
+ dc.setAttribute("text",AlertFormatUtility.formatAlertConditionForDisplay(condition));
+ String value = log.getValue();
+ if (condition.getMeasurementDefinition() != null) {
+ value = MeasurementConverterClient.format(Double.valueOf(log.getValue()), condition
+ .getMeasurementDefinition().getUnits(), true);
+ }
+ dc.setAttribute("value",value);
+ conditions[i++] = dc;
+ }
+ record.setAttribute("conditionLogs",conditions);
+ record.setAttribute("conditionExpression",from.getAlertDefinition().getConditionExpression());
+
String recoveryInfo = AlertFormatUtility.getAlertRecoveryInfo(from);
record.setAttribute("recoveryInfo", recoveryInfo);
// Alert notification logs
DataClass[] notifications = new DataClass[from.getAlertNotificationLogs().size()];
- int i = 0;
+ i = 0;
for(AlertNotificationLog log : from.getAlertNotificationLogs()) {
DataClass dc = new DataClass();
dc.setAttribute("sender",log.getSender());
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
index 01958a8..15853a1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
@@ -142,9 +142,9 @@ public class AlertsView extends VLayout {
Tab generalTab = new Tab("General");
generalTab.setPane(getDetailsTableForAlert(record));
Tab conditionsTab = new Tab("Conditions");
- conditionsTab.setDisabled(true); // TODO change
+ conditionsTab.setPane(getConditionsForAlert(record));
Tab notificationsTab = new Tab("Notificatons");
- notificationsTab.setPane(getNotificationsForAlert(record.getAttributeAsRecordArray("notificationLogs")));
+ notificationsTab.setPane(getNotificationsForAlert(record));
tabset.addTab(generalTab);
tabset.addTab(conditionsTab);
@@ -204,7 +204,9 @@ public class AlertsView extends VLayout {
return form;
}
- private Table getNotificationsForAlert(DataClass[] input) {
+ private Table getNotificationsForAlert(Record record) {
+
+ DataClass[] input = record.getAttributeAsRecordArray("notificationLogs");
Table notifTable = new Table("Notifications",false);
notifTable.setHeight("35%");
@@ -229,6 +231,29 @@ public class AlertsView extends VLayout {
return notifTable;
}
+ private Table getConditionsForAlert(Record record) {
+
+ DataClass[] input = record.getAttributeAsRecordArray("conditionLogs");
+ String mode = record.getAttribute("conditionExpression");
+
+
+ Table table = new Table("Conditions: match = " + mode,false);
+ table.setHeight("35%");
+ table.setWidth100();
+ ListGrid grid = table.getListGrid();
+ grid.setData((Record[]) input);
+
+ ListGridField condition = new ListGridField("text");
+ condition.setWidth("60%");
+ ListGridField value = new ListGridField("value","Value");
+
+
+ grid.setFields(condition,value);
+
+ return table;
+
+ }
+
protected Criteria getCriteria() {
return null;
}
commit 4797d3abe715f767e54ccbe01552f78c93577d6d
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Mar 17 09:07:02 2010 -0400
Fixing logic to check whether or not a field is a primitive
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ObjectFilter.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ObjectFilter.java
index 6c46f7d..62dc79b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ObjectFilter.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ObjectFilter.java
@@ -53,7 +53,7 @@ public class ObjectFilter {
if (!goodFields.contains(f.getName())) {
// Only clearing objects, no point in clearing primitives as it
// doesn't save any space on the stream
- if (Object.class.isAssignableFrom(f.getType())) {
+ if (!f.getType().isPrimitive()) {
// System.out.println("clearing " + f.getName());
f.setAccessible(true);
f.set(object, null);
commit b9e35c748092d06f54595ffadec0297ba35dc116
Merge: 941b164... 091b01d...
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Mar 17 09:05:29 2010 -0400
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
commit 941b16476d541d2e33ce6718136eeb038ec588b5
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Mar 17 09:03:29 2010 -0400
Updating recently add resource portlet to use RecentlyAddedResourceComposite at least for now
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/RecentlyAddedResourceComposite.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/RecentlyAddedResourceComposite.java
index 37e4945..0018621 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/RecentlyAddedResourceComposite.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/RecentlyAddedResourceComposite.java
@@ -31,11 +31,15 @@ public class RecentlyAddedResourceComposite implements Serializable {
private static final long serialVersionUID = 1L;
private int id;
+ private int parentId;
private String name;
private long ctime;
private boolean showChildren;
private List<RecentlyAddedResourceComposite> children;
+ public RecentlyAddedResourceComposite() {
+ }
+
public RecentlyAddedResourceComposite(int id, String name, long ctime) {
this.id = id;
this.name = name;
@@ -46,6 +50,10 @@ public class RecentlyAddedResourceComposite implements Serializable {
return id;
}
+ public int getParentId() {
+ return parentId;
+ }
+
public String getName() {
return name;
}
@@ -68,6 +76,9 @@ public class RecentlyAddedResourceComposite implements Serializable {
public void setChildren(List<RecentlyAddedResourceComposite> children) {
this.children = children;
+ for (RecentlyAddedResourceComposite child : children) {
+ child.parentId = id;
+ }
}
@Override
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/RecentlyAddedResourceDS.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/RecentlyAddedResourceDS.java
index 514371f..df1ac0f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/RecentlyAddedResourceDS.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/RecentlyAddedResourceDS.java
@@ -23,27 +23,28 @@
package org.rhq.enterprise.gui.coregui.client.dashboard.portlets;
-import java.util.ArrayList;
-
+import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.data.DataSource;
-import com.smartgwt.client.data.fields.DataSourceIntegerField;
import com.smartgwt.client.data.fields.DataSourceTextField;
import com.smartgwt.client.types.DSDataFormat;
import com.smartgwt.client.types.DSProtocol;
import com.smartgwt.client.widgets.tree.TreeNode;
-
import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.domain.util.PageList;
+import org.rhq.core.domain.resource.composite.RecentlyAddedResourceComposite;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
public class RecentlyAddedResourceDS extends DataSource {
@@ -100,38 +101,87 @@ public class RecentlyAddedResourceDS extends DataSource {
// TODO GH: Enhance resourceCriteria query to support itime based filtering for
// "Recently imported" resources
- GWTServiceLookup.getResourceService().findResourcesByCriteria(c, new AsyncCallback<PageList<Resource>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load recently added resources data",caught);
- response.setStatus(DSResponse.STATUS_FAILURE);
- processResponse(request.getRequestId(), response);
- }
-
- public void onSuccess(PageList<Resource> result) {
- PageList<Resource> all = new PageList<Resource>();
-
- for (Resource root : result) {
- all.add(root);
- if (root.getChildResources() != null)
- all.addAll(root.getChildResources());
+ GWTServiceLookup.getResourceService().findRecentlyAddedResources(0, 100,
+ new AsyncCallback<List<RecentlyAddedResourceComposite>>() {
+ public void onFailure(Throwable throwable) {
+ CoreGUI.getErrorHandler().handleError("Failed to load recently added resources", throwable);
}
+ public void onSuccess(List<RecentlyAddedResourceComposite> recentlyAddedList) {
+ List<RecentlyAddedResourceComposite> list = new ArrayList<RecentlyAddedResourceComposite>();
+
+ for (RecentlyAddedResourceComposite recentlyAdded : recentlyAddedList) {
+ list.add(recentlyAdded);
+ list.addAll(recentlyAdded.getChildren());
+ }
- response.setData(buildNodes(all));
- response.setTotalRows(all.getTotalSize());
- processResponse(request.getRequestId(), response);
- }
- });
+ response.setData(buildNodes(list));
+ response.setTotalRows(list.size());
+ processResponse(request.getRequestId(), response);
+ }
+ });
+//
+// GWTServiceLookup.getResourceService().findResourcesByCriteria(c, new AsyncCallback<PageList<Resource>>() {
+// public void onFailure(Throwable caught) {
+// CoreGUI.getErrorHandler().handleError("Failed to load recently added resources data",caught);
+// response.setStatus(DSResponse.STATUS_FAILURE);
+// processResponse(request.getRequestId(), response);
+// }
+//
+// public void onSuccess(PageList<Resource> result) {
+// PageList<Resource> all = new PageList<Resource>();
+//
+// for (Resource root : result) {
+// all.add(root);
+// if (root.getChildResources() != null)
+// all.addAll(root.getChildResources());
+// }
+//
+//
+// response.setData(buildNodes(all));
+// response.setTotalRows(all.getTotalSize());
+// processResponse(request.getRequestId(), response);
+// }
+// });
}
- private TreeNode[] buildNodes(PageList<Resource> list) {
+// private TreeNode[] buildNodes(PageList<Resource> list) {
+// TreeNode[] treeNodes = new TreeNode[list.size()];
+// for (int i = 0; i < list.size(); ++i) {
+// treeNodes[i] = new ResourceTreeNode(list.get(i));
+// }
+// return treeNodes;
+// }
+
+ private TreeNode[] buildNodes(List<RecentlyAddedResourceComposite> list) {
TreeNode[] treeNodes = new TreeNode[list.size()];
for (int i = 0; i < list.size(); ++i) {
- treeNodes[i] = new ResourceTreeNode(list.get(i));
+ treeNodes[i] = new RecentlyAddedTreeNode(list.get(i));
}
return treeNodes;
}
+ public static class RecentlyAddedTreeNode extends TreeNode {
+ private RecentlyAddedResourceComposite recentlyAdded;
+
+ private RecentlyAddedTreeNode(RecentlyAddedResourceComposite c) {
+ recentlyAdded = c;
+ Date dateAdded = new Date(recentlyAdded.getCtime());
+
+ String id = String.valueOf(recentlyAdded.getId());
+ String parentId = recentlyAdded.getParentId() == 0 ? null
+ : String.valueOf((recentlyAdded.getParentId()));
+
+ setID(id);
+ setParentID(parentId);
+
+ setAttribute("id", id);
+ setAttribute("parentId", parentId);
+ setAttribute("name", recentlyAdded.getName());
+ setAttribute("timestamp", DateTimeFormat.getMediumDateTimeFormat().format(dateAdded));
+ setIsFolder(recentlyAdded.getParentId() == 0);
+ }
+ }
public static class ResourceTreeNode extends TreeNode {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java
index e63365b..5a5e0d4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java
@@ -22,6 +22,7 @@ import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.composite.RecentlyAddedResourceComposite;
import org.rhq.core.domain.util.PageList;
import com.google.gwt.user.client.rpc.RemoteService;
@@ -39,6 +40,8 @@ public interface ResourceGWTService extends RemoteService {
List<Resource> getResourceLineageAndSiblings(int resourceId);
+ List<RecentlyAddedResourceComposite> findRecentlyAddedResources(long ctime, int maxItems);
+
Resource getPlatformForResource(int resourceId);
List<Integer> deleteResources(int[] resourceIds);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
index 8c23ca4..484b434 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
@@ -24,6 +24,7 @@ import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.configuration.definition.ConfigurationTemplate;
import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.composite.RecentlyAddedResourceComposite;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTService;
import org.rhq.enterprise.gui.coregui.server.util.SerialUtility;
@@ -34,6 +35,7 @@ import org.rhq.enterprise.server.util.LookupUtil;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
@@ -135,6 +137,18 @@ public class ResourceGWTServiceImpl extends AbstractGWTServiceImpl implements Re
return SerialUtility.prepare(resourceManager.getRootResourceForResource(resourceId), "ResourceService.getPlatformForResource");
}
+ public List<RecentlyAddedResourceComposite> findRecentlyAddedResources(long ctime, int maxItems) {
+ List<RecentlyAddedResourceComposite> platforms = resourceManager.findRecentlyAddedPlatforms(
+ getSessionSubject(), ctime, maxItems);
+
+ for (RecentlyAddedResourceComposite platform : platforms) {
+ List<RecentlyAddedResourceComposite> servers = resourceManager.findRecentlyAddedServers(
+ getSessionSubject(), ctime, platform.getId());
+ platform.setChildren(servers);
+ }
+
+ return platforms;
+ }
public List<Integer> deleteResources(int[] resourceIds) {
return SerialUtility.prepare(
commit 091b01ddb2bffa070c98d95fccd321a3e548f34a
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Mar 17 10:08:39 2010 +0100
Show details in tabs.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
index e4f183d..01958a8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
@@ -38,6 +38,8 @@ import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionEvent;
import com.smartgwt.client.widgets.layout.VLayout;
+import com.smartgwt.client.widgets.tab.Tab;
+import com.smartgwt.client.widgets.tab.TabSet;
import org.rhq.core.domain.criteria.AlertCriteria;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
@@ -111,18 +113,12 @@ public class AlertsView extends VLayout {
String contents;
if (selectedRecords.length == 1) {
ListGridRecord record = selectedRecords[0];
- String name = record.getAttribute("name");
- String id = record.getAttribute("id");
// Clean out existing details and provide new ones
for (int i = 1 ; i <= getChildren().length ; i ++)
getChildren()[1].destroy();
- detailsTable = getDetailsTableForAlert(record);
- addMember(detailsTable);
- Table notifTable = getNotificationsForAlert(record.getAttributeAsRecordArray("notificationLogs"));
- addMember(notifTable);
-
+ addMember(getDetailsTabSet(record));
} else {
// Clean out existing details and show the "nothing selected message"
@@ -141,6 +137,22 @@ public class AlertsView extends VLayout {
}
+ private TabSet getDetailsTabSet(Record record) {
+ TabSet tabset = new TabSet();
+ Tab generalTab = new Tab("General");
+ generalTab.setPane(getDetailsTableForAlert(record));
+ Tab conditionsTab = new Tab("Conditions");
+ conditionsTab.setDisabled(true); // TODO change
+ Tab notificationsTab = new Tab("Notificatons");
+ notificationsTab.setPane(getNotificationsForAlert(record.getAttributeAsRecordArray("notificationLogs")));
+
+ tabset.addTab(generalTab);
+ tabset.addTab(conditionsTab);
+ tabset.addTab(notificationsTab);
+
+ return tabset;
+ }
+
private HTMLFlow getNoAlertSelectedMessage() {
HTMLFlow f = new HTMLFlow("<h3>Select a single alert above to display its details here.</h3>");
f.setHeight("50%");
@@ -187,7 +199,6 @@ public class AlertsView extends VLayout {
items.add(ackTimeItem);
-
form.setItems(items.toArray(new FormItem[items.size()]));
return form;
commit e0455191856fbeaecfe569f12b42460b0730bf67
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Wed Mar 17 00:42:28 2010 -0400
display Resource names, rather than ids, on Favorites menu
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
index d56aab5..e5534dc 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
@@ -32,6 +32,9 @@ import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.util.PageOrdering;
+import java.util.Arrays;
+import java.util.List;
+
/**
* @author Joseph Marques
*/
@@ -57,6 +60,7 @@ public class ResourceCriteria extends Criteria {
private AvailabilityType filterCurrentAvailability; // needs overrides
private Long filterStartItime;
private Long filterEndItime;
+ private List<Integer> filterIds; // needs overrides
private boolean fetchResourceType;
private boolean fetchChildResources;
@@ -103,6 +107,7 @@ public class ResourceCriteria extends Criteria {
filterOverrides.put("currentAvailability", "currentAvailability.availabilityType = ?");
filterOverrides.put("startItime", "itime >= ?");
filterOverrides.put("endItime", "itime <= ?");
+ filterOverrides.put("ids", "id IN ( ? )");
sortOverrides.put("resourceTypeName", "resourceType.name");
sortOverrides.put("resourceCategory", "resourceType.category");
@@ -181,6 +186,11 @@ public class ResourceCriteria extends Criteria {
filterEndItime = itime;
}
+ public void addFilterIds(Integer... filterIds) {
+ this.filterIds = Arrays.asList(filterIds);
+ }
+
+
public void fetchResourceType(boolean fetchResourceType) {
this.fetchResourceType = fetchResourceType;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java
index e83405e..72eb936 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java
@@ -18,9 +18,12 @@
*/
package org.rhq.enterprise.gui.coregui.client.footer;
+import java.util.HashMap;
+import java.util.Map;
import java.util.Set;
import com.google.gwt.user.client.History;
+import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.menu.IMenuButton;
@@ -28,10 +31,15 @@ import com.smartgwt.client.widgets.menu.Menu;
import com.smartgwt.client.widgets.menu.MenuItem;
import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent;
+import org.rhq.core.domain.criteria.ResourceCriteria;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
/**
* @author Greg Hinkle
+ * @author Ian Springer
*/
public class FavoritesButton extends IMenuButton {
@@ -45,31 +53,49 @@ public class FavoritesButton extends IMenuButton {
addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
+ // Cancel the click event. We'll call show() on the menu ourselves only if we're able to load the
+ // favorite Resources successfully.
+ clickEvent.cancel();
Set<Integer> favorites = CoreGUI.getUserPreferences().getFavoriteResources();
- // todo: lookup resource names
-//
-// ResourceCriteria criteria = new ResourceCriteria();
-// criteria.addFilter
-
- MenuItem[] items = new MenuItem[favorites.size()];
+ Integer[] resourceIds = new Integer[favorites.size()];
+ final MenuItem[] items = new MenuItem[favorites.size()];
+ final Map<Integer, MenuItem> idToMenuItemMap = new HashMap<Integer, MenuItem>(favorites.size());
int i = 0;
for (final Integer resourceId : favorites) {
+ resourceIds[i] = resourceId;
MenuItem item = new MenuItem(String.valueOf(resourceId));
item.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
public void onClick(MenuItemClickEvent event) {
History.newItem("Resource/" + resourceId);
}
});
- items[i++] = item;
+ items[i] = item;
+ idToMenuItemMap.put(resourceId, item);
+ i++;
}
- favoritesMenu.setItems(items);
+ ResourceCriteria criteria = new ResourceCriteria();
+ criteria.addFilterIds(resourceIds);
+ GWTServiceLookup.getResourceService().findResourcesByCriteria(criteria,
+ new AsyncCallback<PageList<Resource>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load favorite Resources.", caught);
+ }
+
+ public void onSuccess(PageList<Resource> resources) {
+ for (Resource resource : resources) {
+ MenuItem item = idToMenuItemMap.get(resource.getId());
+ // TODO: Ideally, we should use ResourceManagerLocal.disambiguate() here to obtain
+ // disambiguated Resource names.
+ item.setTitle(resource.getName());
+ }
+ favoritesMenu.setItems(items);
+ favoritesMenu.showContextMenu();
+ }
+ });
}
});
}
-
-
-
}
commit 979fdd1bfdb7b82a4e97095cdedd1ef8cd27fd3e
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Wed Mar 17 00:41:43 2010 -0400
provide better table title on Inventory>Children view
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 9350d64..a349722 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
@@ -42,25 +42,30 @@ import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
* @author Greg Hinkle
*/
public class ResourceSearchView extends VLayout {
+ private static final String DEFAULT_TITLE = "Resources";
private Table table;
private ArrayList<ResourceSelectListener> selectListeners = new ArrayList<ResourceSelectListener>();
- int parentResourceId;
-
/**
- * A resource list of all resources in the system
+ * A list of all Resources in the system.
*/
public ResourceSearchView() {
this(null);
}
/**
- * Resource list filtered by a given criteria
- * @param criteria
+ * A Resource list filtered by a given criteria.
*/
public ResourceSearchView(Criteria criteria) {
+ this(criteria, DEFAULT_TITLE);
+ }
+
+ /**
+ * A Resource list filtered by a given criteria with the given title.
+ */
+ public ResourceSearchView(Criteria criteria, String title) {
setWidth100();
setHeight100();
@@ -74,7 +79,7 @@ public class ResourceSearchView extends VLayout {
addMember(searchPanel);
final ResourceDatasource datasource = new ResourceDatasource();
- table = new Table("Resources", criteria);
+ table = new Table(title, criteria);
table.setDataSource(datasource);
table.getListGrid().setSelectionType(SelectionStyle.SIMPLE);
@@ -136,7 +141,6 @@ public class ResourceSearchView extends VLayout {
// -------- Static Utility loaders ------------
public static ResourceSearchView getChildrenOf(int resourceId) {
- return new ResourceSearchView(new Criteria("parentId", String.valueOf(resourceId)));
+ return new ResourceSearchView(new Criteria("parentId", String.valueOf(resourceId)), "Child Resources");
}
-
}
commit 14ffc80e737154303c50abfe9077bbce20185eac
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Tue Mar 16 23:37:41 2010 -0400
include cause.toString() as the details of the message
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/ErrorHandler.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/ErrorHandler.java
index f07ff4f..b2d5009 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/ErrorHandler.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/ErrorHandler.java
@@ -18,10 +18,7 @@
*/
package org.rhq.enterprise.gui.coregui.client.util;
-import com.smartgwt.client.util.SC;
-
import java.util.ArrayList;
-import java.util.List;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
@@ -31,19 +28,16 @@ import org.rhq.enterprise.gui.coregui.client.util.message.Message;
*/
public class ErrorHandler {
-
private ArrayList<String> errors = new ArrayList<String>();
-
public void handleError(String message, Throwable t) {
// SC.say(message);
- CoreGUI.getMessageCenter().notify(new Message(message, null, Message.Severity.Error));
+ CoreGUI.getMessageCenter().notify(new Message(message, t.toString(), Message.Severity.Error));
t.printStackTrace();
- errors.add(message);
-
+ this.errors.add(message);
}
}
commit ce0ad5c39ee6dae175d0771751b00863e8b775e4
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Tue Mar 16 23:36:43 2010 -0400
fix bug in nullOutUninitializedFields() - when 'value' parameter was a Collection, HibernateProxy items in the Collection were being converted to detached replacement Objects, but the Collection was not being updated to contain these replacements in place of the HibernateProxy's
diff --git a/modules/enterprise/server/safe-invoker/src/main/java/org/rhq/enterprise/server/util/HibernateDetachUtility.java b/modules/enterprise/server/safe-invoker/src/main/java/org/rhq/enterprise/server/util/HibernateDetachUtility.java
index d6b5987..e56f076 100644
--- a/modules/enterprise/server/safe-invoker/src/main/java/org/rhq/enterprise/server/util/HibernateDetachUtility.java
+++ b/modules/enterprise/server/safe-invoker/src/main/java/org/rhq/enterprise/server/util/HibernateDetachUtility.java
@@ -38,7 +38,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
@@ -100,9 +99,20 @@ public class HibernateDetachUtility {
}
} else if (value instanceof Collection) {
- for (Object val : (Collection) value) {
- nullOutUninitializedFields(val, nulledObjects, depth + 1, serializationType);
+ Collection collection = (Collection) value;
+ Collection itemsToBeReplaced = new ArrayList();
+ Collection replacementItems = new ArrayList();
+ for (Object item : collection) {
+ Object replacementItem = replaceObject(item);
+ if (replacementItem != null) {
+ itemsToBeReplaced.add(item);
+ replacementItems.add(replacementItem);
+ item = replacementItem;
+ }
+ nullOutUninitializedFields(item, nulledObjects, depth + 1, serializationType);
}
+ collection.removeAll(itemsToBeReplaced);
+ collection.addAll(replacementItems);
} else if (value instanceof Map) {
for (Object key : ((Map) value).keySet()) {
nullOutUninitializedFields(((Map) value).get(key), nulledObjects, depth + 1, serializationType);
commit 66588612c785dfd4cee997a76516c8236207a5c5
Merge: 9bdbc36... f232327...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Mar 16 17:37:49 2010 -0400
Merge branch 'gwt' into gwt-jay
Conflicts:
modules/enterprise/gui/portal-war/src/main/webapp/rhq/group/layout/summary.xhtml
commit f232327b5d9428d9da80255f38dd29b468b68166
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Mar 16 17:36:16 2010 -0400
LT commit
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/group/layout/summary.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/group/layout/summary.xhtml
index 8fd84d9..e616f0f 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/group/layout/summary.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/group/layout/summary.xhtml
@@ -1,244 +1,244 @@
-<?xml version="1.0"?>
-
-<!DOCTYPE html
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:c="http://java.sun.com/jstl/core"
- xmlns:rich="http://richfaces.ajax4jsf.org/rich"
- xmlns:fn="http://java.sun.com/jsp/jstl/functions"
- xmlns:onc="http://jboss.org/on/component"
- xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
- xmlns:onf="http://jboss.org/on/function">
-
-THIS TEXT WILL BE REMOVED.
-
-The template for the summary section of all Resource Group pages (i.e. the Monitor/Inventory/etc. tabbed pages).
-NOTE: This template is leveraged by both Facelets pages and JSP/Tiles pages.
-
-REQUEST PARAMETERS:
-groupId - the group id of the Group being accessed
-
-<ui:composition>
-
- <h:form id="groupHeaderSummaryForm">
-
- <input type="hidden" name="groupId" value="#{ResourceGroupUIBean.groupId}"/>
- <input type="hidden" name="parentGroupId" value="#{param.parentGroupId}"/>
- <input type="hidden" name="category" value="#{param.category}"/>
-
-
-
-
-
-
-<style type="text/css">
- \##{fn:replace(rich:clientId('summary-toggle-panel'),"\\:","\\\\:")}_header {
- background-color: white;
- border: none;
- }
-
- \##{fn:replace(rich:clientId('summary-toggle-panel'),"\\:","\\\\:")}_header > .dr-stglpanel-marker {
- float: left;
- padding-left: 10px;
- }
-</style>
-
-
-<h:panelGroup layout="block" style="width: 100%; background-color: #E5E5E5;">
-
-
- <table width="100%" style="align: center; padding-top: 5px;" cellpadding="0" cellspacing="0">
- <tr>
- <td>
-
- <h:graphicImage value="/images/icons/${ResourceGroupUIBean.compatible ? 'Cluster' : 'Group' }_up_24.png"/>
- <h:outputText style="font-size: 18px;" value="#{ResourceGroupUIBean.name}"/>
-
- </td>
- <td width="30">
- <h:graphicImage value="/images/icons/availability_green_24.png" alt="Up" title="Up"
- rendered="#{ResourceGroupUIBean.availability == 1}"/>
- <h:graphicImage value="/images/icons/availability_red_24.png" alt="Down" title="Down"
- rendered="#{ResourceGroupUIBean.availability == 0}"/>
- <h:graphicImage value="/images/icons/availability_yellow_24.png" alt="Mixed" title="Mixed"
- rendered="#{ResourceGroupUIBean.availability gt 0 and ResourceGroupUIBean.availability lt 1}"/>
- <h:graphicImage value="/images/icons/availability_grey_24.png" alt="Unknown" title="Unknown"
- rendered="#{ResourceGroupUIBean.availability == null}"/>
- </td>
-
- <td width="30">
- <a4j:region>
- <h:graphicImage style="z-index: 10;" id="favoritesStar"
- value="#{ResourceGroupUIBean.favorite ? '/images/icons/Favorite_24.png' : '/images/icons/Favorite_grey_24.png'}">
- <a4j:support event="onclick"
- action="#{ResourceGroupUIBean.toggleFavorite}"
- reRender="favoritesStar, groupsMenu"
- ajaxSingle="true"
- status="commonStatus"
- disableDefault="true"/>
- </h:graphicImage>
-
-
- <rich:toolTip for="favoritesStar">
- <h:outputText value="Add resource to favorites list"
- rendered="#{!ResourceGroupUIBean.favorite}"/>
- <h:outputText value="Remove resource from favorites list"
- rendered="#{ResourceGroupUIBean.favorite}"/>
- </rich:toolTip>
- </a4j:region>
- </td>
- </tr>
- </table>
-
-
-
- </h:panelGroup>
-
- <rich:simpleTogglePanel switchType="ajax" id="summary-toggle-panel" headerClass="summaryHeader"
- actionListener="#{UserPreferencesUIBean.updateSummaryPanelDisplayState}"
- value="#{UserPreferencesUIBean.summaryPanelDisplayState}">
-
-
- <f:facet name="openMarker"><h:graphicImage value="/images/summaryHidden.png"/> </f:facet>
- <f:facet name="closeMarker"><h:graphicImage value="/images/summaryShown.png"/> </f:facet>
-
- <f:facet name="header">Summary</f:facet>
-
-
-
- <h:panelGrid columns="2" width="100%" style="padding: 3px;">
-
- <h:panelGroup layout="block" styleClass="summary-content">
-
- <!-- general properties (type, version, etc.) -->
- <h:panelGrid columns="2" styleClass="summary-props-table" style=""
- columnClasses="summary-prop-cell">
- <h:panelGroup layout="block">
- <h:outputText value="Type: " styleClass="BoldText"/>
- <h:outputText value="#{ResourceGroupUIBean.resourceType.name}
- (#{ResourceGroupUIBean.resourceType.category.displayName})"
- rendered="#{!empty ResourceGroupUIBean.resourceType}"/>
- <h:outputText value="Mixed Types" style="font-style: italic"
- rendered="#{empty ResourceGroupUIBean.resourceType}"/>
- </h:panelGroup>
-
- <h:panelGroup layout="block">
- <h:outputText value="Description: " styleClass="BoldText"/>
- <h:outputText value="#{ResourceGroupUIBean.description}"
- rendered="#{!empty ResourceGroupUIBean.description}"/>
- <h:outputText value="none" style="font-style: italic"
- rendered="#{empty ResourceGroupUIBean.description}"/>
- </h:panelGroup>
-
-
- </h:panelGrid>
-
- <!-- spacer -->
- <h:panelGroup layout="block" style="height: 13px"/>
-
- </h:panelGroup>
-
-
- <ui:remove><!-- the blue box at the top right --></ui:remove>
- <h:panelGroup layout="block">
-
- <h:panelGrid columns="1" columnClasses="LinkBoxCell">
-
-
- </h:panelGrid>
-
- </h:panelGroup>
-
- </h:panelGrid>
-
- <ui:param name="resourceGroupMembersDataModel" value="#{ResourceGroupSummaryUIBean.dataModel}"/>
-
- <rich:dataTable id="resourceGroupMembersDataTable"
- rows="#{PageControl.MiniResourceGroupMemberList.pageSize}"
- style="width: 80%; margin-left: 10%; margin-right: 10%;"
- rendered="#{ResourceGroupUIBean.compatible}"
- value="#{resourceGroupMembersDataModel}"
- var="resourceWithAvailability"
- headerClass="tableRowHeader"
- footerClass="on-pager-footer">
-
- <f:facet name="PageControlView">
- <onc:paginationControl id="MiniResourceGroupMemberList"/>
- </f:facet>
-
-
- <rich:column>
- <f:facet name="header">
- <onc:sortableColumnHeader sort="res.name">
- <h:outputText styleClass="headerText" value="Name"/>
- </onc:sortableColumnHeader>
- </f:facet>
-
- <h:outputLink value="#{onf:getDefaultResourceTabURL()}">
- <f:param name="id" value="#{resourceWithAvailability.resource.id}"/>
- <h:outputText value="#{resourceWithAvailability.resource.name}"/>
- </h:outputLink>
- </rich:column>
-
- <rich:column>
- <f:facet name="header">
- <onc:sortableColumnHeader sort="parent.name">
- <h:outputText styleClass="headerText" value="Parent"/>
- </onc:sortableColumnHeader>
- </f:facet>
-
- <h:outputLink value="#{onf:getDefaultResourceTabURL()}">
- <f:param name="id" value="#{resourceWithAvailability.parent.id}"/>
- <h:outputText value="#{resourceWithAvailability.parent.name}"/>
- </h:outputLink>
- </rich:column>
-
-
- <rich:column>
- <f:facet name="header">
- <onc:sortableColumnHeader sort="a.availabilityType">
- <h:outputText styleClass="headerText" value="Availability"/>
- </onc:sortableColumnHeader>
- </f:facet>
-
- <h:graphicImage value="/images/icons/availability_green_16.png" alt="Up" title="Up"
- rendered="#{resourceWithAvailability.availability == 'UP'}"/>
- <h:graphicImage value="/images/icons/availability_red_16.png" alt="Down" title="Down"
- rendered="#{resourceWithAvailability.availability == 'DOWN'}"/>
- <h:graphicImage value="/images/icons/availability_grey_16.png" alt="Unknown" title="Unknown"
- rendered="#{resourceWithAvailability.availability == null}"/>
- </rich:column>
-
- <f:facet name="footer">
- <rich:columnGroup>
- <rich:column colspan="3" width="100%">
-
- <ui:param name="paginationDataTableName" value="resourceGroupMembersDataTable"/>
- <ui:param name="paginationDataModel" value="#{resourceGroupMembersDataModel}"/>
- <ui:param name="paginationPageControl" value="#{PageControl.MiniResourceGroupMemberList}"/>
- <ui:param name="paginationUIBean" value="#{ResourceGroupSummaryUIBean}"/>
- <ui:include src="/rhq/resource/include/pagination.xhtml"/>
-
- </rich:column>
- </rich:columnGroup>
- </f:facet>
-
- </rich:dataTable>
-
-
- </rich:simpleTogglePanel>
-
- </h:form>
-
- <rich:spacer height="10"/>
-
-</ui:composition>
-
-THIS TEXT WILL BE REMOVED AS WELL.
-
-</html>
+<?xml version="1.0"?>
+
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich"
+ xmlns:fn="http://java.sun.com/jsp/jstl/functions"
+ xmlns:onc="http://jboss.org/on/component"
+ xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
+ xmlns:onf="http://jboss.org/on/function">
+
+THIS TEXT WILL BE REMOVED.
+
+The template for the summary section of all Resource Group pages (i.e. the Monitor/Inventory/etc. tabbed pages).
+NOTE: This template is leveraged by both Facelets pages and JSP/Tiles pages.
+
+REQUEST PARAMETERS:
+groupId - the group id of the Group being accessed
+
+<ui:composition>
+
+ <h:form id="groupHeaderSummaryForm">
+
+ <input type="hidden" name="groupId" value="#{ResourceGroupUIBean.groupId}"/>
+ <input type="hidden" name="parentGroupId" value="#{param.parentGroupId}"/>
+ <input type="hidden" name="category" value="#{param.category}"/>
+
+
+
+
+
+
+<style type="text/css">
+ \##{fn:replace(rich:clientId('summary-toggle-panel'),"\\:","\\\\:")}_header {
+ background-color: white;
+ border: none;
+ }
+
+ \##{fn:replace(rich:clientId('summary-toggle-panel'),"\\:","\\\\:")}_header > .dr-stglpanel-marker {
+ float: left;
+ padding-left: 10px;
+ }
+</style>
+
+
+<h:panelGroup layout="block" style="width: 100%; background-color: #E5E5E5;">
+
+
+ <table width="100%" style="align: center; padding-top: 5px;" cellpadding="0" cellspacing="0">
+ <tr>
+ <td>
+
+ <h:graphicImage value="/images/icons/${ResourceGroupUIBean.compatible ? 'Cluster' : 'Group' }_up_24.png"/>
+ <h:outputText style="font-size: 18px;" value="#{ResourceGroupUIBean.name}"/>
+
+ </td>
+ <td width="30">
+ <h:graphicImage value="/images/icons/availability_green_24.png" alt="Up" title="Up"
+ rendered="#{ResourceGroupUIBean.availability == 1}"/>
+ <h:graphicImage value="/images/icons/availability_red_24.png" alt="Down" title="Down"
+ rendered="#{ResourceGroupUIBean.availability == 0}"/>
+ <h:graphicImage value="/images/icons/availability_yellow_24.png" alt="Mixed" title="Mixed"
+ rendered="#{ResourceGroupUIBean.availability gt 0 and ResourceGroupUIBean.availability lt 1}"/>
+ <h:graphicImage value="/images/icons/availability_grey_24.png" alt="Unknown" title="Unknown"
+ rendered="#{ResourceGroupUIBean.availability == null}"/>
+ </td>
+
+ <td width="30">
+ <a4j:region>
+ <h:graphicImage style="z-index: 10;" id="favoritesStar"
+ value="#{ResourceGroupUIBean.favorite ? '/images/icons/Favorite_24.png' : '/images/icons/Favorite_grey_24.png'}">
+ <a4j:support event="onclick"
+ action="#{ResourceGroupUIBean.toggleFavorite}"
+ reRender="favoritesStar, groupsMenu"
+ ajaxSingle="true"
+ status="commonStatus"
+ disableDefault="true"/>
+ </h:graphicImage>
+
+
+ <rich:toolTip for="favoritesStar">
+ <h:outputText value="Add resource to favorites list"
+ rendered="#{!ResourceGroupUIBean.favorite}"/>
+ <h:outputText value="Remove resource from favorites list"
+ rendered="#{ResourceGroupUIBean.favorite}"/>
+ </rich:toolTip>
+ </a4j:region>
+ </td>
+ </tr>
+ </table>
+
+
+
+ </h:panelGroup>
+
+ <rich:simpleTogglePanel switchType="ajax" id="summary-toggle-panel" headerClass="summaryHeader"
+ actionListener="#{UserPreferencesUIBean.updateSummaryPanelDisplayState}"
+ value="#{UserPreferencesUIBean.summaryPanelDisplayState}">
+
+
+ <f:facet name="openMarker"><h:graphicImage value="/images/summaryHidden.png"/> </f:facet>
+ <f:facet name="closeMarker"><h:graphicImage value="/images/summaryShown.png"/> </f:facet>
+
+ <f:facet name="header">Summary</f:facet>
+
+
+
+ <h:panelGrid columns="2" width="100%" style="padding: 3px;">
+
+ <h:panelGroup layout="block" styleClass="summary-content">
+
+ <!-- general properties (type, version, etc.) -->
+ <h:panelGrid columns="2" styleClass="summary-props-table" style=""
+ columnClasses="summary-prop-cell">
+ <h:panelGroup layout="block">
+ <h:outputText value="Type: " styleClass="BoldText"/>
+ <h:outputText value="#{ResourceGroupUIBean.resourceType.name}
+ (#{ResourceGroupUIBean.resourceType.category.displayName})"
+ rendered="#{!empty ResourceGroupUIBean.resourceType}"/>
+ <h:outputText value="Mixed Types" style="font-style: italic"
+ rendered="#{empty ResourceGroupUIBean.resourceType}"/>
+ </h:panelGroup>
+
+ <h:panelGroup layout="block">
+ <h:outputText value="Description: " styleClass="BoldText"/>
+ <h:outputText value="#{ResourceGroupUIBean.description}"
+ rendered="#{!empty ResourceGroupUIBean.description}"/>
+ <h:outputText value="none" style="font-style: italic"
+ rendered="#{empty ResourceGroupUIBean.description}"/>
+ </h:panelGroup>
+
+
+ </h:panelGrid>
+
+ <!-- spacer -->
+ <h:panelGroup layout="block" style="height: 13px"/>
+
+ </h:panelGroup>
+
+
+ <ui:remove><!-- the blue box at the top right --></ui:remove>
+ <h:panelGroup layout="block">
+
+ <h:panelGrid columns="1" columnClasses="LinkBoxCell">
+
+
+ </h:panelGrid>
+
+ </h:panelGroup>
+
+ </h:panelGrid>
+
+ <ui:param name="resourceGroupMembersDataModel" value="#{ResourceGroupSummaryUIBean.dataModel}"/>
+
+ <rich:dataTable id="resourceGroupMembersDataTable"
+ rows="#{PageControl.MiniResourceGroupMemberList.pageSize}"
+ style="width: 80%; margin-left: 10%; margin-right: 10%;"
+ rendered="#{ResourceGroupUIBean.compatible}"
+ value="#{resourceGroupMembersDataModel}"
+ var="resourceWithAvailability"
+ headerClass="tableRowHeader"
+ footerClass="on-pager-footer">
+
+ <f:facet name="PageControlView">
+ <onc:paginationControl id="MiniResourceGroupMemberList"/>
+ </f:facet>
+
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="res.name">
+ <h:outputText styleClass="headerText" value="Name"/>
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputLink value="#{onf:getDefaultResourceTabURL()}">
+ <f:param name="id" value="#{resourceWithAvailability.resource.id}"/>
+ <h:outputText value="#{resourceWithAvailability.resource.name}"/>
+ </h:outputLink>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="parent.name">
+ <h:outputText styleClass="headerText" value="Parent"/>
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputLink value="#{onf:getDefaultResourceTabURL()}">
+ <f:param name="id" value="#{resourceWithAvailability.parent.id}"/>
+ <h:outputText value="#{resourceWithAvailability.parent.name}"/>
+ </h:outputLink>
+ </rich:column>
+
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="a.availabilityType">
+ <h:outputText styleClass="headerText" value="Availability"/>
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:graphicImage value="/images/icons/availability_green_16.png" alt="Up" title="Up"
+ rendered="#{resourceWithAvailability.availability == 'UP'}"/>
+ <h:graphicImage value="/images/icons/availability_red_16.png" alt="Down" title="Down"
+ rendered="#{resourceWithAvailability.availability == 'DOWN'}"/>
+ <h:graphicImage value="/images/icons/availability_grey_16.png" alt="Unknown" title="Unknown"
+ rendered="#{resourceWithAvailability.availability == null}"/>
+ </rich:column>
+
+ <f:facet name="footer">
+ <rich:columnGroup>
+ <rich:column colspan="3" width="100%">
+
+ <ui:param name="paginationDataTableName" value="resourceGroupMembersDataTable"/>
+ <ui:param name="paginationDataModel" value="#{resourceGroupMembersDataModel}"/>
+ <ui:param name="paginationPageControl" value="#{PageControl.MiniResourceGroupMemberList}"/>
+ <ui:param name="paginationUIBean" value="#{ResourceGroupSummaryUIBean}"/>
+ <ui:include src="/rhq/resource/include/pagination.xhtml"/>
+
+ </rich:column>
+ </rich:columnGroup>
+ </f:facet>
+
+ </rich:dataTable>
+
+
+ </rich:simpleTogglePanel>
+
+ </h:form>
+
+ <rich:spacer height="10"/>
+
+</ui:composition>
+
+THIS TEXT WILL BE REMOVED AS WELL.
+
+</html>
commit 37cadd9a4cee330576e06ba43d8b3785bf073359
Merge: acd3727... 305b695...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Mar 16 17:35:59 2010 -0400
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
commit 9bdbc36475a898035b18bce32757b5cd90eda83b
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Mar 16 17:35:03 2010 -0400
add the description params to the necessary methods
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
index 8f1f780..0bc3f98 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
@@ -56,7 +56,7 @@ public class BundleGWTServiceImpl extends AbstractGWTServiceImpl implements Bund
public Bundle createBundle(String name, int bundleTypeId) throws Exception {
Bundle results;
try {
- results = bundleManager.createBundle(getSessionSubject(), name, bundleTypeId);
+ results = bundleManager.createBundle(getSessionSubject(), name, null, bundleTypeId);
} catch (Exception e) {
throw new Exception(ThrowableUtil.getAllMessages(e));
}
@@ -66,7 +66,7 @@ public class BundleGWTServiceImpl extends AbstractGWTServiceImpl implements Bund
public BundleVersion createBundleVersion(int bundleId, String name, String version, String recipe) throws Exception {
BundleVersion results;
try {
- results = bundleManager.createBundleVersion(getSessionSubject(), bundleId, name, version, recipe);
+ results = bundleManager.createBundleVersion(getSessionSubject(), bundleId, name, null, version, recipe);
} catch (Exception e) {
throw new Exception(ThrowableUtil.getAllMessages(e));
}
@@ -77,8 +77,8 @@ public class BundleGWTServiceImpl extends AbstractGWTServiceImpl implements Bund
String recipe) throws Exception {
BundleVersion results;
try {
- results = bundleManager.createBundleAndBundleVersion(getSessionSubject(), bundleName, bundleTypeId, name,
- version, recipe);
+ results = bundleManager.createBundleAndBundleVersion(getSessionSubject(), bundleName, null, bundleTypeId,
+ name, null, version, recipe);
} catch (Exception e) {
throw new RuntimeException(ThrowableUtil.getAllMessages(e));
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
index 4892166..3eff81a 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
@@ -363,10 +363,11 @@ public class WebservicesManagerBean implements WebservicesRemote {
return bundleManager.createBundleVersion(subject, bundleId, name, description, version, recipe);
}
- public BundleVersion createBundleAndBundleVersion(Subject subject, String bundleName, int bundleTypeId,
- String name, String bundleVersion, String recipe) throws Exception {
- return bundleManager.createBundleAndBundleVersion(subject, bundleName, bundleTypeId, name, bundleVersion,
- recipe);
+ public BundleVersion createBundleAndBundleVersion(Subject subject, String bundleName, String bundleDescription,
+ int bundleTypeId, String bundleVersionName, String bundleVersionDescription, String version, String recipe)
+ throws Exception {
+ return bundleManager.createBundleAndBundleVersion(subject, bundleName, bundleDescription, bundleTypeId,
+ bundleVersionName, bundleVersionDescription, version, recipe);
}
public void deleteBundle(Subject subject, int bundleId) throws Exception {
commit 2bfab8e7f6c798e6ff6a242d7ef153571099c147
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Mar 16 17:33:57 2010 -0400
remove deprecated criteria methods
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java
index 663350a..644b02d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java
@@ -18,20 +18,12 @@
*/
package org.rhq.enterprise.gui.coregui.client.admin.roles;
-import org.rhq.core.domain.auth.Subject;
-import org.rhq.core.domain.authz.Permission;
-import org.rhq.core.domain.authz.Role;
-import org.rhq.core.domain.criteria.RoleCriteria;
-import org.rhq.core.domain.resource.group.ResourceGroup;
-import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.gwt.RoleGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
@@ -43,10 +35,17 @@ import com.smartgwt.client.rpc.RPCResponse;
import com.smartgwt.client.util.JSOHelper;
import com.smartgwt.client.widgets.grid.ListGridRecord;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.authz.Permission;
+import org.rhq.core.domain.authz.Role;
+import org.rhq.core.domain.criteria.RoleCriteria;
+import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.gwt.RoleGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
/**
* @author Greg Hinkle
@@ -73,11 +72,9 @@ public class RolesDataSource extends RPCDataSource<Role> {
DataSourceTextField nameField = new DataSourceTextField("name", "Name");
-
setFields(idDataField, nameField);
}
-
public void executeFetch(final DSRequest request, final DSResponse response) {
final long start = System.currentTimeMillis();
@@ -86,12 +83,12 @@ public class RolesDataSource extends RPCDataSource<Role> {
Integer subjectId = request.getCriteria().getAttributeAsInt("subjectId");
if (subjectId != null) {
- criteria.setFilterSubjectId(subjectId);
+ criteria.addFilterSubjectId(subjectId);
}
- criteria.setFetchResourceGroups(true);
- criteria.setFetchPermissions(true);
- criteria.setFetchSubjects(true);
+ criteria.fetchResourceGroups(true);
+ criteria.fetchPermissions(true);
+ criteria.fetchSubjects(true);
roleService.findRolesByCriteria(criteria, new AsyncCallback<PageList<Role>>() {
public void onFailure(Throwable caught) {
@@ -105,13 +102,12 @@ public class RolesDataSource extends RPCDataSource<Role> {
System.out.println("Data retrieved in: " + (System.currentTimeMillis() - start));
response.setData(buildRecords(result));
- response.setTotalRows(result.getTotalSize()); // for paging to work we have to specify size of full result set
+ response.setTotalRows(result.getTotalSize()); // for paging to work we have to specify size of full result set
processResponse(request.getRequestId(), response);
}
});
}
-
@Override
protected void executeAdd(final DSRequest request, final DSResponse response) {
JavaScriptObject data = request.getData();
@@ -120,19 +116,20 @@ public class RolesDataSource extends RPCDataSource<Role> {
roleService.createRole(newRole, new AsyncCallback<Role>() {
public void onFailure(Throwable caught) {
- Map<String,String> errors = new HashMap<String, String>();
+ Map<String, String> errors = new HashMap<String, String>();
errors.put("name", "A role with name already exists.");
response.setErrors(errors);
-// CoreGUI.getErrorHandler().handleError("Failed to create role",caught);
+ // CoreGUI.getErrorHandler().handleError("Failed to create role",caught);
response.setStatus(RPCResponse.STATUS_VALIDATION_ERROR);
processResponse(request.getRequestId(), response);
}
public void onSuccess(Role result) {
- CoreGUI.getMessageCenter().notify(new Message("Role ["+ result.getName() + "] added", Message.Severity.Info));
+ CoreGUI.getMessageCenter().notify(
+ new Message("Role [" + result.getName() + "] added", Message.Severity.Info));
ListGridRecord record = new ListGridRecord();
- response.setData(new Record[] {copyValues(result)});
- processResponse(request.getRequestId(),response);
+ response.setData(new Record[] { copyValues(result) });
+ processResponse(request.getRequestId(), response);
}
});
@@ -145,14 +142,15 @@ public class RolesDataSource extends RPCDataSource<Role> {
Role updatedRole = copyValues(record);
roleService.updateRole(updatedRole, new AsyncCallback<Role>() {
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to update role",caught);
+ CoreGUI.getErrorHandler().handleError("Failed to update role", caught);
}
public void onSuccess(Role result) {
- CoreGUI.getMessageCenter().notify(new Message("Role ["+ result.getName() + "] updated", Message.Severity.Info));
+ CoreGUI.getMessageCenter().notify(
+ new Message("Role [" + result.getName() + "] updated", Message.Severity.Info));
System.out.println("Role Updated");
- response.setData(new Record[] {copyValues(result)});
- processResponse(request.getRequestId(),response);
+ response.setData(new Record[] { copyValues(result) });
+ processResponse(request.getRequestId(), response);
}
});
}
@@ -163,15 +161,16 @@ public class RolesDataSource extends RPCDataSource<Role> {
final ListGridRecord rec = new ListGridRecord(data);
final Role newRole = copyValues(rec);
- roleService.removeRoles(new Integer[]{newRole.getId()}, new AsyncCallback<Void>() {
+ roleService.removeRoles(new Integer[] { newRole.getId() }, new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to delete role",caught);
+ CoreGUI.getErrorHandler().handleError("Failed to delete role", caught);
}
public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(new Message("Role ["+ newRole.getName() + "] removed", Message.Severity.Info));
+ CoreGUI.getMessageCenter().notify(
+ new Message("Role [" + newRole.getName() + "] removed", Message.Severity.Info));
System.out.println("Role deleted");
- response.setData(new Record[]{rec});
+ response.setData(new Record[] { rec });
processResponse(request.getRequestId(), response);
}
});
@@ -182,8 +181,8 @@ public class RolesDataSource extends RPCDataSource<Role> {
Role to = new Role();
to.setId(from.getAttributeAsInt("id"));
to.setName(from.getAttributeAsString("name"));
-// to.setDate (from.getAttributeAsDate ("date"));
-// from.getAttributeAsIntArray("resourceGroups");
+ // to.setDate (from.getAttributeAsDate ("date"));
+ // from.getAttributeAsIntArray("resourceGroups");
to.setResourceGroups((Set<ResourceGroup>) from.getAttributeAsObject("resourceGroups"));
to.setPermissions((Set<Permission>) from.getAttributeAsObject("permissions"));
to.setSubjects((Set<Subject>) from.getAttributeAsObject("subjects"));
@@ -202,7 +201,6 @@ public class RolesDataSource extends RPCDataSource<Role> {
return to;
}
-
private ListGridRecord getEditedRecord(DSRequest request) {
// Retrieving values before edit
JavaScriptObject oldValues = request.getAttributeAsJavaScriptObject("oldValues");
commit 305b695dcd365230a47e8e383d2c74427f3e376f
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Mar 16 17:30:55 2010 -0400
Basics of a metric range editor component
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/measurement/MeasurementRangeEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/measurement/MeasurementRangeEditor.java
new file mode 100644
index 0000000..e9417bc
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/measurement/MeasurementRangeEditor.java
@@ -0,0 +1,121 @@
+/*
+ * 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.measurement;
+
+import java.util.Date;
+import java.util.LinkedHashMap;
+
+import com.google.gwt.dom.client.Document;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.ButtonItem;
+import com.smartgwt.client.widgets.form.fields.DateTimeItem;
+import com.smartgwt.client.widgets.form.fields.SelectItem;
+import com.smartgwt.client.widgets.form.fields.StaticTextItem;
+import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
+import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
+
+/**
+ * @author Greg Hinkle
+ */
+public class MeasurementRangeEditor extends DynamicForm {
+
+
+ private static LinkedHashMap<String, String> lastValues;
+
+ private boolean advanced = false;
+ private ButtonItem advancedButton;
+
+ static {
+ lastValues = new LinkedHashMap<String, String>();
+ lastValues.put("10", "10 Minutes");
+ lastValues.put("30", "30 Minutes");
+ lastValues.put("60", "1 Hour");
+ lastValues.put("120", "2 Hours");
+ lastValues.put("240", "4 Hours");
+ lastValues.put("480", "8 Hours");
+ lastValues.put("720", "12 Hours");
+ lastValues.put("1440", "1 Day");
+ lastValues.put("2880", "2 Days");
+ lastValues.put("10080", "7 Days");
+
+ }
+
+ public MeasurementRangeEditor() {
+ setNumCols(10);
+ setHeight(40);
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+ StaticTextItem title = new StaticTextItem("title","Range");
+
+ SelectItem timeItem = new SelectItem("last", "Last");
+ timeItem.setValueMap(lastValues);
+
+
+ DateTimeItem startItem = new DateTimeItem("start", "Start");
+ startItem.setValue(new Date(System.currentTimeMillis() - (1000L * 60 * 60 * 24)));
+
+ DateTimeItem endItem = new DateTimeItem("end", "End");
+ endItem.setValue(new Date());
+
+
+
+ final StaticTextItem display = new StaticTextItem("display");
+ display.setShowTitle(false);
+
+
+
+
+ advancedButton = new ButtonItem("advanced", "Advanced...");
+ advancedButton.setShowTitle(false);
+ advancedButton.setStartRow(false);
+ advancedButton.setEndRow(false);
+ advancedButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ advanced = !advanced;
+
+ update();
+
+ }
+ });
+
+
+ setItems(title, advancedButton, timeItem, startItem, endItem );
+
+ update();
+ }
+
+ private void update() {
+ if (advanced) {
+ advancedButton.setTitle("Simple...");
+ hideItem("last");
+ showItem("start");
+ showItem("end");
+ } else {
+ advancedButton.setTitle("Advanced...");
+ hideItem("start");
+ hideItem("end");
+ showItem("last");
+ }
+
+ }
+}
commit d9ec53476c36d419975ccb71759e80e55f236208
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Mar 16 17:29:05 2010 -0400
Fix the dashboard overflow problem
Updated the RecentlyAddedResourceDS prototype
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 34ca0df..66772ea 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
@@ -19,6 +19,7 @@ import com.google.gwt.user.client.History;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.RootPanel;
import com.smartgwt.client.core.KeyIdentifier;
+import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.util.KeyCallback;
import com.smartgwt.client.util.Page;
import com.smartgwt.client.util.SC;
@@ -133,6 +134,7 @@ public class CoreGUI implements EntryPoint {
private void buildCoreUI() {
RootCanvas rootCanvas = new RootCanvas();
+ rootCanvas.setOverflow(Overflow.HIDDEN);
this.currentView = this.rootView = new View(new ViewId("", null), rootCanvas);
// HTMLPane menuPane = new HTMLPane();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
index 596ea76..eea078d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
@@ -24,6 +24,7 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSearchVi
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.SmallGraphView;
import com.google.gwt.user.client.Random;
+import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.widgets.AnimationCallback;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.form.DynamicForm;
@@ -46,6 +47,10 @@ public class DashboardView extends VLayout {
"FFFF99", "CCFFCC", "CCFFFF", "99CCFF", "CC99FF", "FFFFFF"
};
+ public DashboardView() {
+ setOverflow(Overflow.AUTO);
+ setPadding(5);
+ }
public void onInit() {
setWidth100();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/RecentlyAddedResourceDS.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/RecentlyAddedResourceDS.java
index 22efb2d..514371f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/RecentlyAddedResourceDS.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/RecentlyAddedResourceDS.java
@@ -23,6 +23,8 @@
package org.rhq.enterprise.gui.coregui.client.dashboard.portlets;
+import java.util.ArrayList;
+
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
@@ -86,7 +88,14 @@ public class RecentlyAddedResourceDS extends DataSource {
ResourceCriteria c = new ResourceCriteria();
- c.addFilterResourceCategory(ResourceCategory.PLATFORM);
+ String p = request.getCriteria().getAttribute("parentId");
+
+ if (p == null) {
+ c.addFilterResourceCategory(ResourceCategory.PLATFORM);
+ c.fetchChildResources(true);
+ } else {
+ c.addFilterParentResourceId(Integer.parseInt(p));
+ }
// TODO GH: Enhance resourceCriteria query to support itime based filtering for
// "Recently imported" resources
@@ -99,8 +108,17 @@ public class RecentlyAddedResourceDS extends DataSource {
}
public void onSuccess(PageList<Resource> result) {
- response.setData(buildNodes(result));
- response.setTotalRows(result.getTotalSize());
+ PageList<Resource> all = new PageList<Resource>();
+
+ for (Resource root : result) {
+ all.add(root);
+ if (root.getChildResources() != null)
+ all.addAll(root.getChildResources());
+ }
+
+
+ response.setData(buildNodes(all));
+ response.setTotalRows(all.getTotalSize());
processResponse(request.getRequestId(), response);
}
});
@@ -124,7 +142,7 @@ public class RecentlyAddedResourceDS extends DataSource {
String id = String.valueOf(resource.getId());
String parentId = resource.getParentResource() == null ? null
- : (resource.getParentResource().getId() + "_" + resource.getResourceType().getName());
+ : String.valueOf((resource.getParentResource().getId()));
setID(id);
setParentID(parentId);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
index b7303c4..8c23ca4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
@@ -68,7 +68,7 @@ public class ResourceGWTServiceImpl extends AbstractGWTServiceImpl implements Re
// "modifiedBy \n" +
// "location \n" +
"resourceType",
-// "childResources \n" +
+ "childResources",
"parentResource",
// "resourceConfiguration \n" +
// "pluginConfiguration \n" +
commit 71f46feec7d1a5408e44c5597e4395f5a47ee142
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Mar 16 16:46:35 2010 -0400
opps, forgot to check this in
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
index 2d02919..e4d8bee 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
@@ -18,7 +18,7 @@
*/
package org.rhq.enterprise.gui.coregui.client.bundle.create;
-import java.util.List;
+import java.util.ArrayList;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.Canvas;
@@ -99,8 +99,8 @@ public class BundleInfoStep implements WizardStep {
// TODO: we should get all bundle types in a drop down menu and let the user pick
// for now assume we always get one (the filetemplate one) and use it
- bundleServer.getBundleTypes(new AsyncCallback<List<BundleType>>() {
- public void onSuccess(List<BundleType> result) {
+ bundleServer.getBundleTypes(new AsyncCallback<ArrayList<BundleType>>() {
+ public void onSuccess(ArrayList<BundleType> result) {
wizard.setBundleType(result.get(0));
enableNextButtonWhenAppropriate();
}
commit 58c025ca9c82dadfb054334099afbec76388844f
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Mar 16 16:26:32 2010 -0400
make gwt interface use ArrayList rather than List interface
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java
index de3b2ad..0944786 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java
@@ -18,8 +18,8 @@
*/
package org.rhq.enterprise.gui.coregui.client.gwt;
+import java.util.ArrayList;
import java.util.HashMap;
-import java.util.List;
import com.google.gwt.user.client.rpc.RemoteService;
@@ -30,7 +30,7 @@ import org.rhq.core.domain.criteria.BundleCriteria;
import org.rhq.core.domain.util.PageList;
public interface BundleGWTService extends RemoteService {
- List<BundleType> getBundleTypes();
+ ArrayList<BundleType> getBundleTypes();
PageList<Bundle> findBundlesByCriteria(BundleCriteria criteria) throws Exception;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
index 8f1f780..530aef1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
@@ -18,8 +18,8 @@
*/
package org.rhq.enterprise.gui.coregui.server.gwt;
+import java.util.ArrayList;
import java.util.HashMap;
-import java.util.List;
import org.rhq.core.domain.bundle.Bundle;
import org.rhq.core.domain.bundle.BundleType;
@@ -38,8 +38,9 @@ public class BundleGWTServiceImpl extends AbstractGWTServiceImpl implements Bund
private BundleManagerLocal bundleManager = LookupUtil.getBundleManager();
- public List<BundleType> getBundleTypes() {
- List<BundleType> bundleTypes = bundleManager.getAllBundleTypes(getSessionSubject());
+ public ArrayList<BundleType> getBundleTypes() {
+ ArrayList<BundleType> bundleTypes = new ArrayList<BundleType>();
+ bundleTypes.addAll(bundleManager.getAllBundleTypes(getSessionSubject()));
return SerialUtility.prepare(bundleTypes, "getBundleTypes");
}
commit fa4ba5875ca534239790ae2f16f3fb5a48a25325
Merge: c689578... 4de58e2...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Mar 16 16:16:15 2010 -0400
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
commit c689578c2f83f15fa2fdf28cd81a4a74100f3e4a
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Mar 16 16:12:27 2010 -0400
refactor bundle wizard with abstract superclass to support both an upgrade and create wizard and have them reuse as much as possible
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
index fe0fc30..46bee74 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
@@ -18,28 +18,26 @@
*/
package org.rhq.enterprise.gui.coregui.client.bundle;
-import org.rhq.enterprise.gui.coregui.client.bundle.create.BundleCreationWizard;
-
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.HLayout;
+import org.rhq.enterprise.gui.coregui.client.bundle.create.BundleCreationWizard;
+
/**
* @author Greg Hinkle
*/
public class BundleTopView extends HLayout {
-
@Override
protected void onDraw() {
super.onDraw();
-
IButton addButton = new IButton("New Bundle");
addButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
- new BundleCreationWizard().startBundleCreateWizard();
+ new BundleCreationWizard().startBundleWizard();
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/AbstractBundleWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/AbstractBundleWizard.java
new file mode 100644
index 0000000..0937655
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/AbstractBundleWizard.java
@@ -0,0 +1,142 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License 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.bundle.create;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import com.smartgwt.client.widgets.IButton;
+
+import org.rhq.core.domain.bundle.BundleType;
+import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.Wizard;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardView;
+
+public abstract class AbstractBundleWizard implements Wizard {
+
+ private ArrayList<WizardStep> steps;
+ private WizardView view;
+ private String windowTitle = "";
+ private String title = "";
+ private String subtitle = "";
+
+ // the things we build up in the wizard
+ private BundleType bundleType;
+ private String bundleName;
+ private String bundleVersionString;
+ private String bundleDescription;
+ private String recipe;
+ private BundleVersion bundleVersion;
+
+ public String getWindowTitle() {
+ return windowTitle;
+ }
+
+ public void setWindowTitle(String windowTitle) {
+ this.windowTitle = windowTitle;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public String getSubtitle() {
+ return subtitle;
+ }
+
+ public void setSubtitle(String subtitle) {
+ this.subtitle = subtitle;
+ this.view.refreshTitleLabelContents();
+ }
+
+ public List<WizardStep> getSteps() {
+ return steps;
+ }
+
+ public void setSteps(ArrayList<WizardStep> steps) {
+ this.steps = steps;
+ }
+
+ public List<IButton> getCustomButtons(int step) {
+ return Collections.emptyList();
+ }
+
+ public void startBundleWizard() {
+ view = new WizardView(this);
+ view.displayDialog();
+ }
+
+ public WizardView getView() {
+ return view;
+ }
+
+ public BundleType getBundleType() {
+ return bundleType;
+ }
+
+ public void setBundleType(BundleType bundleType) {
+ this.bundleType = bundleType;
+ }
+
+ public String getBundleName() {
+ return bundleName;
+ }
+
+ public void setBundleName(String bundleName) {
+ this.bundleName = bundleName;
+ }
+
+ public String getBundleVersionString() {
+ return bundleVersionString;
+ }
+
+ public void setBundleVersionString(String bundleVersionString) {
+ this.bundleVersionString = bundleVersionString;
+ }
+
+ public String getBundleDescription() {
+ return bundleDescription;
+ }
+
+ public void setBundleDescription(String desc) {
+ this.bundleDescription = desc;
+ }
+
+ public String getRecipe() {
+ return recipe;
+ }
+
+ public void setRecipe(String recipe) {
+ this.recipe = recipe;
+ }
+
+ public BundleVersion getBundleVersion() {
+ return bundleVersion;
+ }
+
+ public void setBundleVersion(BundleVersion bv) {
+ this.bundleVersion = bv;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java
index cf15fbd..f3dab6d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java
@@ -19,124 +19,20 @@
package org.rhq.enterprise.gui.coregui.client.bundle.create;
import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import com.smartgwt.client.widgets.IButton;
-
-import org.rhq.core.domain.bundle.BundleType;
-import org.rhq.core.domain.bundle.BundleVersion;
-import org.rhq.enterprise.gui.coregui.client.components.wizard.Wizard;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
-import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardView;
-
-/**
- * @author Greg Hinkle
- */
-public class BundleCreationWizard implements Wizard {
- private ArrayList<WizardStep> steps;
- private WizardView view;
- private String subtitle = "";
-
- // the things we build up in the wizard
- private BundleType bundleType;
- private String bundleName;
- private String bundleVersionString;
- private String bundleDescription;
- private String recipe;
- private BundleVersion bundleVersion;
+public class BundleCreationWizard extends AbstractBundleWizard {
public BundleCreationWizard() {
+ setWindowTitle("Bundle Creation Wizard");
+ setTitle("Create Bundle");
- steps = new ArrayList<WizardStep>();
-
+ ArrayList<WizardStep> steps = new ArrayList<WizardStep>();
steps.add(new BundleInfoStep(this));
steps.add(new BundleUploadRecipeStep(this));
steps.add(new BundleVerificationStep(this));
steps.add(new BundleUploadDataStep(this));
-
- }
-
- public String getWindowTitle() {
- return "Bundle Creation Wizard";
- }
-
- public String getTitle() {
- return "Create Bundle";
- }
-
- public String getSubtitle() {
- return subtitle;
- }
-
- public void setSubtitle(String subtitle) {
- this.subtitle = subtitle;
- this.view.refreshTitleLabelContents();
- }
-
- public List<WizardStep> getSteps() {
- return steps;
- }
-
- public List<IButton> getCustomButtons(int step) {
- return Collections.emptyList();
- }
-
- public void startBundleCreateWizard() {
- view = new WizardView(this);
- view.displayDialog();
- }
-
- public WizardView getView() {
- return view;
- }
-
- public BundleType getBundleType() {
- return bundleType;
- }
-
- public void setBundleType(BundleType bundleType) {
- this.bundleType = bundleType;
- }
-
- public String getBundleName() {
- return bundleName;
- }
-
- public void setBundleName(String bundleName) {
- this.bundleName = bundleName;
- }
-
- public String getBundleVersionString() {
- return bundleVersionString;
- }
-
- public void setBundleVersionString(String bundleVersionString) {
- this.bundleVersionString = bundleVersionString;
- }
-
- public String getBundleDescription() {
- return bundleDescription;
- }
-
- public void setBundleDescription(String desc) {
- this.bundleDescription = desc;
- }
-
- public String getRecipe() {
- return recipe;
- }
-
- public void setRecipe(String recipe) {
- this.recipe = recipe;
- }
-
- public BundleVersion getBundleVersion() {
- return bundleVersion;
- }
-
- public void setBundleVersion(BundleVersion bv) {
- this.bundleVersion = bv;
+ setSteps(steps);
}
}
commit 4de58e250fcb0727e8d0e96c7b2a7355afe85b6c
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Mar 16 15:28:11 2010 -0400
Adding support to filter by itime
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
index 627a6eb..d56aab5 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
@@ -55,6 +55,8 @@ public class ResourceCriteria extends Criteria {
private String filterParentResourceName; // needs overrides
private String filterAgentName; // needs overrides
private AvailabilityType filterCurrentAvailability; // needs overrides
+ private Long filterStartItime;
+ private Long filterEndItime;
private boolean fetchResourceType;
private boolean fetchChildResources;
@@ -99,6 +101,8 @@ public class ResourceCriteria extends Criteria {
filterOverrides.put("parentResourceName", "parentResource.name like ?");
filterOverrides.put("agentName", "agent.name like ?");
filterOverrides.put("currentAvailability", "currentAvailability.availabilityType = ?");
+ filterOverrides.put("startItime", "itime >= ?");
+ filterOverrides.put("endItime", "itime <= ?");
sortOverrides.put("resourceTypeName", "resourceType.name");
sortOverrides.put("resourceCategory", "resourceType.category");
@@ -169,6 +173,14 @@ public class ResourceCriteria extends Criteria {
this.filterCurrentAvailability = filterCurrentAvailability;
}
+ public void addFilterStartItime(long itime) {
+ filterStartItime = itime;
+ }
+
+ public void addFilterEndItime(long itime) {
+ filterEndItime = itime;
+ }
+
public void fetchResourceType(boolean fetchResourceType) {
this.fetchResourceType = fetchResourceType;
}
commit 6129e12c910c49630a048ef459c0c8115c545fad
Merge: acd3727... db755e1...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Mar 16 13:47:15 2010 -0400
Merge branch 'master' into gwt-jay
Conflicts:
.classpath
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentHistoryCriteria.java
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/RoleCriteria.java
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java
diff --cc modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
index 15332a4,5d66119..4caf4ab
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
@@@ -22,20 -22,24 +22,20 @@@
*/
package org.rhq.core.domain.criteria;
- import org.rhq.core.client.GwtClientUtility;
- import org.rhq.core.domain.authz.Permission;
- import org.rhq.core.domain.util.PageControl;
-
- import javax.xml.bind.annotation.XmlAccessType;
- import javax.xml.bind.annotation.XmlAccessorType;
-
import java.io.Serializable;
-import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+ import javax.xml.bind.annotation.XmlAccessType;
+ import javax.xml.bind.annotation.XmlAccessorType;
+
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
++import org.rhq.core.client.GwtClientUtility;
+ import org.rhq.core.domain.authz.Permission;
+ import org.rhq.core.domain.util.PageControl;
-import org.rhq.core.domain.util.PageOrdering;
+
/**
* @author Joseph Marques
*/
@@@ -60,16 -67,14 +60,16 @@@ public abstract class Criteria implemen
protected PageControl pageControlOverrides;
private List<String> orderingFieldNames;
+ private String alias;
- //added no args constructor for bean and JAXB requirement
- @SuppressWarnings("unused")
+ private String searchExpression;
+
public Criteria() {
- filterOverrides = new HashMap<String, String>();
- sortOverrides = new HashMap<String, String>();
- orderingFieldNames = new ArrayList<String>();
+ this.filterOverrides = new HashMap<String, String>();
+ this.sortOverrides = new HashMap<String, String>();
+
+ this.orderingFieldNames = new ArrayList<String>();
/*
* reasonably large default, but prevent accidentally returning 100K objects
@@@ -78,18 -83,46 +78,18 @@@
setPaging(0, 200);
}
- public abstract Class getPersistentClass();
+ public abstract Class<?> getPersistentClass();
- private List<Field> getFields(Type fieldType) {
- String prefix = fieldType.name().toLowerCase();
- List<Field> results = new ArrayList<Field>();
-
- Class<?> currentLevelClass = this.getClass();
- while (currentLevelClass.equals(Criteria.class) == false) {
- for (Field field : currentLevelClass.getDeclaredFields()) {
- field.setAccessible(true);
- if (field.getName().startsWith(prefix)) {
- results.add(field);
- }
- }
- currentLevelClass = currentLevelClass.getSuperclass();
- }
-
- return results;
+ public Integer getPageNumber() {
+ return pageNumber;
}
- public Map<String, Object> getFilterFields() {
- Map<String, Object> results = new HashMap<String, Object>();
- for (Field filterField : getFields(Type.FILTER)) {
- Object filterFieldValue = null;
- try {
- filterFieldValue = filterField.get(this);
- } catch (IllegalAccessException iae) {
- throw new RuntimeException(iae);
- }
- if (filterFieldValue != null) {
- results.put(getCleansedFieldName(filterField, 6), filterFieldValue);
- }
- }
+ public Integer getPageSize() {
+ return pageSize;
+ }
- if (LOG.isDebugEnabled()) {
- for (Map.Entry<String, Object> entries : results.entrySet()) {
- LOG.debug("Filter: (" + entries.getKey() + ", " + entries.getValue() + ")");
- }
- }
- return results;
+ public List<String> getOrderingFieldNames() {
+ return orderingFieldNames;
}
public String getJPQLFilterOverride(String fieldName) {
diff --cc modules/core/domain/src/main/java/org/rhq/core/domain/criteria/RoleCriteria.java
index 1b1c3fe,4e2c06f..03dd41b
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/RoleCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/RoleCriteria.java
@@@ -37,30 -37,74 +37,80 @@@ public class RoleCriteria extends Crite
private static final long serialVersionUID = 1L;
private Integer filterId;
-- private String filterName;
private String filterDescription;
++ private String filterName;
+ private Integer filterSubjectId;
-- private boolean fetchSubjects;
-- private boolean fetchResourceGroups;
private boolean fetchPermissions;
++ private boolean fetchResourceGroups;
private boolean fetchRoleNotifications;
++ private boolean fetchSubjects;
private PageOrdering sortName;
public RoleCriteria() {
- super();
+ filterOverrides.put("subjectId", "id in (select sr.id from Role sr JOIN sr.subjects s where s.id = :id)");
}
+ @Override
- public Class getPersistentClass() {
+ public Class<Role> getPersistentClass() {
return Role.class;
}
- public Integer getFilterId() {
- return this.filterId;
+ public void addFilterId(Integer filterId) {
+ this.filterId = filterId;
+ }
+
+ public void addFilterName(String filterName) {
+ this.filterName = filterName;
+ }
+
+ public void addFilterDescription(String filterDescription) {
+ this.filterDescription = filterDescription;
+ }
+
++ public void addFilterSubjectId(Integer filterSubjectId) {
++ this.filterSubjectId = filterSubjectId;
++ }
++
+ /**
+ * Requires MANAGE_SECURITY
+ * @param fetchSubjects
+ */
+ public void fetchSubjects(boolean fetchSubjects) {
+ this.fetchSubjects = fetchSubjects;
+ }
+
+ /**
+ * Requires MANAGE_SECURITY
+ * @param fetchResourceGroups
+ */
+ public void fetchResourceGroups(boolean fetchResourceGroups) {
+ this.fetchResourceGroups = fetchResourceGroups;
+ }
+
+ public void fetchPermissions(boolean fetchPermissions) {
+ this.fetchPermissions = fetchPermissions;
}
+ public void fetchRoleNotifications(boolean fetchRoleNotifications) {
+ this.fetchRoleNotifications = fetchRoleNotifications;
+ }
+
+ public void addSortName(PageOrdering sortName) {
+ addSortField("name");
+ this.sortName = sortName;
+ }
+
+ /** subclasses should override as necessary */
+ public boolean isSecurityManagerRequired() {
+ return (this.fetchSubjects || this.fetchResourceGroups);
+ }
+
+ /**
+ * @Deprecated use addFilterId
+ */
+ @Deprecated
public void setFilterId(Integer filterId) {
this.filterId = filterId;
}
@@@ -90,9 -146,11 +152,9 @@@
}
/**
-- * Requires MANAGE_SECURITY
- * @param fetchResourceGroups
- * @param fetchSubjects
+ * @Deprecated use fetchResourceGroups
*/
+ @Deprecated
public void setFetchResourceGroups(boolean fetchResourceGroups) {
this.fetchResourceGroups = fetchResourceGroups;
}
diff --cc modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
index 0ed5052,60e4c91..abc3637
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
@@@ -203,29 -205,8 +208,31 @@@ public class BundleManagerBean implemen
}
@RequiredPermission(Permission.MANAGE_INVENTORY)
- public BundleVersion createBundleAndBundleVersion(Subject subject, String bundleName, int bundleTypeId,
- String name, String bundleVersion, String recipe) throws Exception {
++ public BundleVersion createBundleAndBundleVersion(Subject subject, String bundleName, String bundleDescription,
++ int bundleTypeId, String bundleVersionName, String bundleVersionDescription, String version, String recipe)
++ throws Exception {
+
+ // first see if the bundle exists or not; if not, create one
+ BundleCriteria criteria = new BundleCriteria();
+ criteria.addFilterBundleTypeId(Integer.valueOf(bundleTypeId));
+ criteria.addFilterName(bundleName);
+ PageList<Bundle> bundles = findBundlesByCriteria(subject, criteria);
+ Bundle bundle;
+ if (bundles.getTotalSize() == 0) {
- bundle = createBundle(subject, bundleName, bundleTypeId);
++ bundle = createBundle(subject, bundleName, bundleDescription, bundleTypeId);
+ } else {
+ bundle = bundles.get(0);
+ }
+
+ // now create the bundle version with the bundle we either found or created
- BundleVersion bv = createBundleVersion(subject, bundle.getId(), name, bundleVersion, recipe);
++ BundleVersion bv = createBundleVersion(subject, bundle.getId(), bundleVersionName, bundleVersionDescription,
++ version, recipe);
+ return bv;
+ }
+
+ @RequiredPermission(Permission.MANAGE_INVENTORY)
- public BundleVersion createBundleVersion(Subject subject, int bundleId, String name, String version, String recipe)
- throws Exception {
+ public BundleVersion createBundleVersion(Subject subject, int bundleId, String name, String description,
+ String version, String recipe) throws Exception {
if (null == name || "".equals(name.trim())) {
throw new IllegalArgumentException("Invalid bundleVersionName: " + name);
}
diff --cc modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java
index 63579cc,1308d90..61a9032
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java
@@@ -151,32 -152,13 +152,37 @@@ public interface BundleManagerRemote
*/
BundleVersion createBundleVersion( //
@WebParam(name = "subject") Subject subject, //
-- @WebParam(name = "bundleId") int bundleId, //
++ @WebParam(name = "bundleId") int bundleId, //
@WebParam(name = "name") String name, //
- @WebParam(name = "bundleVersion") String bundleVersion, //
+ @WebParam(name = "description") String description, //
+ @WebParam(name = "version") String version, //
@WebParam(name = "recipe") String recipe) throws Exception;
/**
+ * Convienence method that combines {@link #createBundle(Subject, String, int)} and {@link #createBundleVersion(Subject, int, String, String, String)}.
+ * This will first check to see if a bundle with the given type/name exists - if it doesn't, it will be created. If it does, it will be reused.
+ * This will then create the bundle version that will be associated with the bundle that was created or found.
+ *
+ * @param subject must be InventoryManager
- * @param bundleName name of the bundle to use (if not found, it will be created)
++ * @param bundleName name of the bundle to use (if not found, it will be created)
++ * @param bundleDescription optional long description of the bundle
+ * @param bundleTypeId the bundle type for the new bundle (if it is created) for which this will be the first version
- * @param name name of the bundle version
- * @param bundleVersion optional. If not supplied set to 1.0 for first version, or incremented (as best as possible) for subsequent version
++ * @param bundleVersionName name of the bundle version
++ * @param bundleVersionDescription optional long description of the bundle version
++ * @param version optional. If not supplied set to 1.0 for first version, or incremented (as best as possible) for subsequent version
+ * @return the persisted BundleVersion (id is assigned)
+ */
+ BundleVersion createBundleAndBundleVersion( //
+ @WebParam(name = "subject") Subject subject, //
+ @WebParam(name = "bundleName") String bundleName, //
++ @WebParam(name = "bundleDescription") String bundleDescription, //
+ @WebParam(name = "bundleTypeId") int bundleTypeId, //
- @WebParam(name = "name") String name, //
- @WebParam(name = "bundleVersion") String bundleVersion, //
++ @WebParam(name = "bundleVersionName") String bundleVersionName, //
++ @WebParam(name = "bundleVersionDescription") String bundleVersionDescription, //
++ @WebParam(name = "version") String version, //
+ @WebParam(name = "recipe") String recipe) throws Exception;
+
+ /**
* Remove everything associated with the Bundle with the exception of files laid down by related deployments.
* Deployed files are left as is on the deployment platforms but the bundle mechanism will no longer track
* the deployment.
diff --cc modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java
index 5e487fc,5ffcae8..0e1a789
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java
@@@ -46,7 -46,9 +47,9 @@@ import org.rhq.core.domain.search.Searc
import org.rhq.core.domain.util.OrderingField;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageOrdering;
-import org.rhq.core.domain.util.PersistenceUtility;
+import org.rhq.core.server.PersistenceUtility;
+ import org.rhq.core.util.exception.ThrowableUtil;
+ import org.rhq.enterprise.server.search.execution.SearchTranslationManager;
/**
* A query generator used to generate queries with specific filtering, prefetching, or sorting requirements.
@@@ -78,8 -81,18 +82,10 @@@ public final class CriteriaQueryGenerat
public CriteriaQueryGenerator(Criteria criteria) {
this.criteria = criteria;
- this.className = criteria.getPersistentClass().getSimpleName();
- initializeJPQLFragmentFromSearchExpression();
-
- String criteriaClassName = criteria.getClass().getSimpleName();
- className = criteriaClassName.substring(0, criteriaClassName.length() - 8);
++ this.className = criteria.getPersistentClass().getSimpleName();
+ this.alias = this.criteria.getAlias();
+
- StringBuilder aliasBuilder = new StringBuilder();
- for (char c : this.className.toCharArray()) {
- if (Character.isUpperCase(c)) {
- aliasBuilder.append(Character.toLowerCase(c));
- }
- }
- this.alias = aliasBuilder.toString();
++ initializeJPQLFragmentFromSearchExpression();
}
public void setAuthorizationCustomConditionFragment(String fragment) {
@@@ -303,73 -328,30 +319,95 @@@
return results.toString();
}
- public List<String> getFetchFields(Criteria criteria) {
++ public List<String> getFetchFields(Criteria criteria) {
+ List<String> results = new ArrayList<String>();
+ for (Field fetchField : getFields(criteria, Criteria.Type.FETCH)) {
+ Object fetchFieldValue = null;
+ try {
+ fetchField.setAccessible(true);
+ fetchFieldValue = fetchField.get(criteria);
+ } catch (IllegalAccessException iae) {
+ throw new RuntimeException(iae);
+ }
+ if (fetchFieldValue != null) {
+ boolean shouldFetch = ((Boolean) fetchFieldValue).booleanValue();
+ if (shouldFetch) {
+ results.add(getCleansedFieldName(fetchField, 5));
+ }
+ }
+ }
- // for (String entry : results) {
- // LOG.info("Fetch: (" + entry + ")");
- // }
++ // for (String entry : results) {
++ // LOG.info("Fetch: (" + entry + ")");
++ // }
+ return results;
+ }
+
-
- private static List<Field> getFields(Criteria criteria, Criteria.Type fieldType) {
++ private static List<Field> getFields(Criteria criteria, Criteria.Type fieldType) {
+ String prefix = fieldType.name().toLowerCase();
+ List<Field> results = new ArrayList<Field>();
+
+ Class<?> currentLevelClass = criteria.getClass();
+ while (currentLevelClass.equals(Criteria.class) == false) {
+ for (Field field : currentLevelClass.getDeclaredFields()) {
+ field.setAccessible(true);
+ if (field.getName().startsWith(prefix)) {
+ results.add(field);
+ }
+ }
+ currentLevelClass = currentLevelClass.getSuperclass();
+ }
+
+ return results;
+ }
+
+ public static String getCleansedFieldName(Field field, int leadingCharsToStrip) {
+ String fieldNameFragment = field.getName().substring(leadingCharsToStrip);
+ String fieldName = Character.toLowerCase(fieldNameFragment.charAt(0)) + fieldNameFragment.substring(1);
+ return fieldName;
+ }
+
+ public Map<String, Object> getFilterFields(Criteria criteria) {
+ Map<String, Object> results = new HashMap<String, Object>();
+ for (Field filterField : getFields(criteria, Criteria.Type.FILTER)) {
+ Object filterFieldValue = null;
+ try {
+ filterFieldValue = filterField.get(criteria);
+ } catch (IllegalAccessException iae) {
+ throw new RuntimeException(iae);
+ }
+ if (filterFieldValue != null) {
+ results.put(getCleansedFieldName(filterField, 6), filterFieldValue);
+ }
+ }
- // for (Map.Entry<String, Object> entries : results.entrySet()) {
- // LOG.info("Filter: (" + entries.getKey() + ", " + entries.getValue() + ")");
- // }
++ // for (Map.Entry<String, Object> entries : results.entrySet()) {
++ // LOG.info("Filter: (" + entries.getKey() + ", " + entries.getValue() + ")");
++ // }
+ return results;
+ }
+
+ private void initializeJPQLFragmentFromSearchExpression() {
+ String searchExpression = criteria.getSearchExpression();
+ if (searchExpression == null) {
+ return;
+ }
+
+ try {
+ Class<?> entityClass = criteria.getPersistentClass();
+ SearchTranslationManager searchManager = new SearchTranslationManager(SearchSubsystem.get(entityClass));
+ searchManager.setExpression(searchExpression);
+
+ // translate first, if there was an error we won't add the dangling 'AND' to the where clause
+ String translatedJPQL = searchManager.getJPQLWhereFragment();
+ LOG.info("Translated JPQL Fragment was: " + translatedJPQL);
+ if (translatedJPQL != null) {
+ searchExpressionWhereClause = translatedJPQL;
+ }
+ } catch (Exception e) {
+ LOG.error("Could not get JPQL translation for '" + searchExpression + "': "
+ + ThrowableUtil.getAllMessages(e, true));
+ }
-
+ }
+
private boolean isPersistentBag(String fieldName) {
try {
Class<?> persistentClass = criteria.getPersistentClass();
@@@ -540,37 -522,4 +578,36 @@@
generator.getQueryString(false);
generator.getQueryString(true);
}
+
-
+ public static PageControl getPageControl(Criteria criteria) {
+ PageControl pc = null;
+
+ if (criteria.getPageControlOverrides() != null) {
+ pc = criteria.getPageControlOverrides();
+ } else {
+ if (criteria.getPageNumber() == null || criteria.getPageSize() == null) {
+ pc = PageControl.getUnlimitedInstance();
+ } else {
+ pc = new PageControl(criteria.getPageNumber(), criteria.getPageSize());
+ }
+ for (String fieldName : criteria.getOrderingFieldNames()) {
+ for (Field sortField : getFields(criteria, Criteria.Type.SORT)) {
+ if (sortField.getName().equals(fieldName) == false) {
+ continue;
+ }
+ Object sortFieldValue = null;
+ try {
+ sortFieldValue = sortField.get(criteria);
+ } catch (IllegalAccessException iae) {
+ throw new RuntimeException(iae);
+ }
+ if (sortFieldValue != null) {
+ PageOrdering pageOrdering = (PageOrdering) sortFieldValue;
+ pc.addDefaultOrderingField(getCleansedFieldName(sortField, 4), pageOrdering);
+ }
+ }
+ }
+ }
+ return pc;
+ }
}
diff --cc modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
index 3f6c7cb,5b83cb4..4892166
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
@@@ -360,17 -358,11 +358,17 @@@ public class WebservicesManagerBean imp
enforcePolicy, enforcementInterval, pinToBundle);
}
- public BundleVersion createBundleVersion(Subject subject, int bundleId, String name, String bundleVersion,
- String recipe) throws Exception {
- return bundleManager.createBundleVersion(subject, bundleId, name, bundleVersion, recipe);
+ public BundleVersion createBundleVersion(Subject subject, int bundleId, String name, String description,
+ String version, String recipe) throws Exception {
+ return bundleManager.createBundleVersion(subject, bundleId, name, description, version, recipe);
}
+ public BundleVersion createBundleAndBundleVersion(Subject subject, String bundleName, int bundleTypeId,
+ String name, String bundleVersion, String recipe) throws Exception {
+ return bundleManager.createBundleAndBundleVersion(subject, bundleName, bundleTypeId, name, bundleVersion,
+ recipe);
+ }
+
public void deleteBundle(Subject subject, int bundleId) throws Exception {
bundleManager.deleteBundle(subject, bundleId);
}
commit e7de0c496e5624e16fd19c08f7553c9f3bc184c8
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Mar 16 13:42:02 2010 -0400
exposed rest of authorization service
Security disablement of the resource tabs
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
index 4129f6f..7973bdd 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
@@ -56,5 +56,6 @@
<servlet path="/OperationGWTService" class="org.rhq.enterprise.gui.coregui.server.gwt.OperationGWTServiceImpl"/>
<servlet path="/BundleGWTService" class="org.rhq.enterprise.gui.coregui.server.gwt.BundleGWTServiceImpl"/>
<servlet path="/ResourceBossGWTService" class="org.rhq.enterprise.gui.coregui.server.gwt.ResourceBossGWTServiceImpl"/>
+ <servlet path="/AuthorizationGWTService" class="org.rhq.enterprise.gui.coregui.server.gwt.AuthorizationGWTServiceImpl"/>
</module>
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/AuthorizationGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/AuthorizationGWTService.java
new file mode 100644
index 0000000..5beb2b6
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/AuthorizationGWTService.java
@@ -0,0 +1,79 @@
+/*
+ * 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.gwt;
+
+import java.util.Set;
+
+import com.google.gwt.user.client.rpc.RemoteService;
+
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.authz.Permission;
+
+/**
+ * @author Greg Hinkle
+ */
+public interface AuthorizationGWTService extends RemoteService {
+
+ /**
+ * Gets the set of permissions that the current user explicitly possesses for the specified {@link org.rhq.core.domain.resource.Resource}.
+ *
+ * @param resourceId the id of some Resource to check permissions against
+ *
+ * @return the set of permissions that the current user possesses for the specified {@link org.rhq.core.domain.resource.Resource} - never null
+ */
+ Set<Permission> getExplicitResourcePermissions(int resourceId);
+
+ /**
+ * Gets the set of permissions that the current user implicitly possesses for the specified {@link org.rhq.core.domain.resource.Resource}.
+ *
+ * @param resourceId the id of some Resource to check permissions against
+ *
+ * @return the set of permissions that the current user implicitly possesses for the specified {@link org.rhq.core.domain.resource.Resource} - never null
+ */
+ Set<Permission> getImplicitResourcePermissions(int resourceId);
+
+ /**
+ * Gets the set of permissions that the current user explicitly possesses for the specified {@link org.rhq.core.domain.resource.group.Group}.
+ *
+ * @param groupId the id of some Group to check permissions against
+ *
+ * @return the set of permissions that the current user explicitly possesses for the specified {@link org.rhq.core.domain.resource.group.Group} - never null
+ */
+ Set<Permission> getExplicitGroupPermissions(int groupId);
+
+ /**
+ * Gets the set of permissions that the current user implicitly possesses for the specified {@link org.rhq.core.domain.resource.group.Group}.
+ *
+ * @param groupId the id of some Group to check permissions against
+ *
+ * @return the set of permissions that the current user implicitly possesses for the specified {@link org.rhq.core.domain.resource.group.Group}
+ */
+ Set<Permission> getImplicitGroupPermissions(int groupId);
+
+
+ /**
+ * Gets the set of global permissions that the current user explicitly possesses.
+ *
+ * @return the set of global permissions that the current user possesses - never null
+ */
+ Set<Permission> getExplicitGlobalPermissions();
+
+
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
index d61828a..84dbd42 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
@@ -80,6 +80,12 @@ public class GWTServiceLookup {
return secure(ResourceBossGWTServiceAsync.Util.getInstance());
}
+ public static AuthorizationGWTServiceAsync getAuthorizationService() {
+ return secure(AuthorizationGWTServiceAsync.Util.getInstance());
+ }
+
+
+
private static <T> T secure(Object sdt) {
if (!(sdt instanceof ServiceDefTarget))
return null;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index c338e06..47a7ab8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -18,9 +18,12 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail;
+import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.composite.ResourcePermission;
import org.rhq.enterprise.gui.coregui.client.Breadcrumb;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.UnknownViewException;
import org.rhq.enterprise.gui.coregui.client.View;
import org.rhq.enterprise.gui.coregui.client.ViewId;
@@ -33,6 +36,7 @@ import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTab;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSelectedEvent;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSelectedHandler;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSet;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSearchView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.alert.ResourceAlertHistoryView;
@@ -44,11 +48,13 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
import com.google.gwt.user.client.History;
+import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.Side;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.tab.Tab;
import java.util.EnumSet;
+import java.util.Set;
/**
* Right panel of the resource view.
@@ -58,6 +64,8 @@ import java.util.EnumSet;
public class ResourceDetailView extends VLayout implements ViewRenderer, ResourceSelectListener, TwoLevelTabSelectedHandler {
private Resource resource;
+ private ResourcePermission permissions;
+ private ResourceType type;
private SimpleCollapsiblePanel summaryPanel;
private ResourceSummaryView summaryView;
@@ -124,7 +132,7 @@ public class ResourceDetailView extends VLayout implements ViewRenderer, Resourc
eventsTab.registerSubTabs("History");
contentTab = new TwoLevelTab("Content", "/images/icons/Content_grey_16.png");
- contentTab.registerSubTabs("Deployed","New","Subscriptions","History");
+ contentTab.registerSubTabs("Deployed", "New", "Subscriptions", "History");
topTabSet.setTabs(summaryTab, monitoringTab, inventoryTab, operationsTab, alertsTab, configurationTab, eventsTab, contentTab);
@@ -166,7 +174,6 @@ public class ResourceDetailView extends VLayout implements ViewRenderer, Resourc
monitoringTab.updateSubTab("Call Time", new CallTimeView(resource));
-
inventoryTab.updateSubTab("Children", ResourceSearchView.getChildrenOf(resource.getId()));
inventoryTab.updateSubTab("Connection Settings", new ConfigurationEditor(resource.getId(), resource.getResourceType().getId(), ConfigurationEditor.ConfigType.plugin));
@@ -180,10 +187,10 @@ public class ResourceDetailView extends VLayout implements ViewRenderer, Resourc
eventsTab.updateSubTab("History", new FullHTMLPane("/rhq/common/events/history-plain.xhtml?id=" + resource.getId()));
- contentTab.updateSubTab("Deployed",new FullHTMLPane("/rhq/resource/content/view-plain.xhtml?id=" + resource.getId()));
- contentTab.updateSubTab("New",new FullHTMLPane("/rhq/resource/content/deploy-plain.xhtml?id=" + resource.getId()));
- contentTab.updateSubTab("Subscriptions",new FullHTMLPane("/rhq/resource/content/subscription-plain.xhtml?id=" + resource.getId()));
- contentTab.updateSubTab("History",new FullHTMLPane("/rhq/resource/content/history-plain.xhtml?id=" + resource.getId()));
+ contentTab.updateSubTab("Deployed", new FullHTMLPane("/rhq/resource/content/view-plain.xhtml?id=" + resource.getId()));
+ contentTab.updateSubTab("New", new FullHTMLPane("/rhq/resource/content/deploy-plain.xhtml?id=" + resource.getId()));
+ contentTab.updateSubTab("Subscriptions", new FullHTMLPane("/rhq/resource/content/subscription-plain.xhtml?id=" + resource.getId()));
+ contentTab.updateSubTab("History", new FullHTMLPane("/rhq/resource/content/history-plain.xhtml?id=" + resource.getId()));
// topTabSet.setSelectedTab(selectedTab);
@@ -195,6 +202,9 @@ public class ResourceDetailView extends VLayout implements ViewRenderer, Resourc
private void updateTabStatus() {
+ // Go and get the type with all needed metadata
+ // and then get the permissions for this resource
+
ResourceTypeRepository.Cache.getInstance().getResourceTypes(resource.getResourceType().getId(),
EnumSet.of(ResourceTypeRepository.MetadataType.content,
ResourceTypeRepository.MetadataType.operations,
@@ -203,49 +213,68 @@ public class ResourceDetailView extends VLayout implements ViewRenderer, Resourc
new ResourceTypeRepository.TypeLoadedCallback() {
public void onTypesLoaded(ResourceType type) {
+ ResourceDetailView.this.type = type;
- if (type.getOperationDefinitions() == null || type.getOperationDefinitions().isEmpty()) {
- if (topTabSet.getSelectedTabNumber() == 3) {
- topTabSet.setSelectedTab(0);
- }
- topTabSet.disableTab(operationsTab);
- } else {
- topTabSet.enableTab(operationsTab);
- }
+ GWTServiceLookup.getAuthorizationService().
+ getImplicitResourcePermissions(ResourceDetailView.this.resource.getId(),
+ new AsyncCallback<Set<Permission>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load resource permissions", caught);
+ }
- if (type.getEventDefinitions() == null || type.getEventDefinitions().isEmpty()) {
- if (topTabSet.getSelectedTabNumber() == 6) {
- topTabSet.setSelectedTab(0);
- }
- topTabSet.disableTab(eventsTab);
- } else {
- topTabSet.enableTab(eventsTab);
- }
+ public void onSuccess(Set<Permission> result) {
+ ResourceDetailView.this.permissions = new ResourcePermission(result);
+ completeTabUpdate();
+ }
+ });
+ }
+ });
+ }
- if (type.getPackageTypes() == null || type.getPackageTypes().isEmpty()) {
- if (topTabSet.getSelectedTabNumber() == 7) {
- topTabSet.setSelectedTab(0);
- }
- topTabSet.disableTab(contentTab);
- } else {
- topTabSet.enableTab(contentTab);
- }
+ private void completeTabUpdate() {
- if (type.getResourceConfigurationDefinition() == null) {
- if (topTabSet.getSelectedTabNumber() == 5) {
- topTabSet.setSelectedTab(0);
- }
- topTabSet.disableTab(configurationTab);
- } else {
- topTabSet.enableTab(configurationTab);
- }
+ if (!permissions.isMeasure()) {
+ topTabSet.disableTab(monitoringTab);
+ } else {
+ topTabSet.enableTab(monitoringTab);
+ }
+
+ if (type.getOperationDefinitions() == null || type.getOperationDefinitions().isEmpty() || !permissions.isControl()) {
+ topTabSet.disableTab(operationsTab);
+ } else {
+ topTabSet.enableTab(operationsTab);
+ }
+
+
+ if (!permissions.isAlert()) {
+ topTabSet.disableTab(alertsTab);
+ } else {
+ topTabSet.enableTab(alertsTab);
+ }
+
+ if (type.getResourceConfigurationDefinition() == null || !permissions.isConfigure()) {
+ topTabSet.disableTab(configurationTab);
+ } else {
+ topTabSet.enableTab(configurationTab);
+ }
+
+ if (type.getEventDefinitions() == null || type.getEventDefinitions().isEmpty() || !permissions.isMeasure()) {
+ topTabSet.disableTab(eventsTab);
+ } else {
+ topTabSet.enableTab(eventsTab);
+ }
+
+ if (type.getPackageTypes() == null || type.getPackageTypes().isEmpty() || !permissions.isContent()) {
+ topTabSet.disableTab(contentTab);
+ } else {
+ topTabSet.enableTab(contentTab);
+ }
- }
- });
}
+
public void onTabSelected(TwoLevelTabSelectedEvent tabSelectedEvent) {
String tabPath = "/" + tabSelectedEvent.getId() + "/" + tabSelectedEvent.getSubTabId();
// System.out.println("TAB: " + currentView.getPath() + tabPath);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AuthorizationGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AuthorizationGWTServiceImpl.java
new file mode 100644
index 0000000..ffbd94b
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AuthorizationGWTServiceImpl.java
@@ -0,0 +1,66 @@
+/*
+ * 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.server.gwt;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.rhq.core.domain.authz.Permission;
+import org.rhq.enterprise.gui.coregui.client.gwt.AuthorizationGWTService;
+import org.rhq.enterprise.gui.coregui.server.util.SerialUtility;
+import org.rhq.enterprise.server.authz.AuthorizationManagerLocal;
+import org.rhq.enterprise.server.util.LookupUtil;
+
+/**
+ * @author Greg Hinkle
+ */
+public class AuthorizationGWTServiceImpl extends AbstractGWTServiceImpl implements AuthorizationGWTService {
+
+ private AuthorizationManagerLocal authorizationManager = LookupUtil.getAuthorizationManager();
+
+ public Set<Permission> getExplicitResourcePermissions(int resourceId) {
+ return SerialUtility.prepare(
+ new HashSet(authorizationManager.getExplicitResourcePermissions(getSessionSubject(), resourceId)),
+ "AuthorizationManager.getExplicitResourcePermissions");
+ }
+
+ public Set<Permission> getImplicitResourcePermissions(int resourceId) {
+ return SerialUtility.prepare(
+ new HashSet(authorizationManager.getImplicitResourcePermissions(getSessionSubject(), resourceId)),
+ "AuthorizationManager.getImplicitResourcePermissions");
+ }
+
+ public Set<Permission> getExplicitGroupPermissions(int groupId) {
+ return SerialUtility.prepare(
+ new HashSet(authorizationManager.getExplicitGroupPermissions(getSessionSubject(), groupId)),
+ "AuthorizationManager.getExplicitGroupPermissions");
+ }
+
+ public Set<Permission> getImplicitGroupPermissions(int groupId) {
+ return SerialUtility.prepare(
+ new HashSet(authorizationManager.getImplicitGroupPermissions(getSessionSubject(), groupId)),
+ "AuthorizationManager.getImplicitGroupPermissions");
+ }
+
+ public Set<Permission> getExplicitGlobalPermissions() {
+ return SerialUtility.prepare(
+ new HashSet(authorizationManager.getExplicitGlobalPermissions(getSessionSubject())),
+ "AuthorizationManager.getExplicitGlobalPermissions");
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml b/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
index 78784d2..8dc1bcd 100644
--- a/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
+++ b/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
@@ -64,6 +64,10 @@
<servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI ResourceBossGWTService</servlet-name>
<servlet-class>org.rhq.enterprise.gui.coregui.server.gwt.ResourceBossGWTServiceImpl</servlet-class>
</servlet>
+ <servlet>
+ <servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI AuthorizationGWTService</servlet-name>
+ <servlet-class>org.rhq.enterprise.gui.coregui.server.gwt.AuthorizationGWTServiceImpl</servlet-class>
+ </servlet>
<servlet-mapping>
<servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI RoleGWTService</servlet-name>
@@ -119,4 +123,8 @@
<url-pattern>/org.rhq.enterprise.gui.coregui.CoreGUI/ResourceBossGWTService</url-pattern>
</servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI AuthorizationGWTService</servlet-name>
+ <url-pattern>/org.rhq.enterprise.gui.coregui.CoreGUI/AuthorizationGWTService</url-pattern>
+ </servlet-mapping>
</web-app>
commit 20b0f22479e667c76a49ceabb269774ac999f0c5
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Mar 16 11:49:56 2010 -0400
Eager load config def templates
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/ConfigurationDefinition.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/ConfigurationDefinition.java
index 5c28844..b49b465 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/ConfigurationDefinition.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/ConfigurationDefinition.java
@@ -97,7 +97,7 @@ public class ConfigurationDefinition implements Serializable {
private Map<String, PropertyDefinition> propertyDefinitions = new LinkedHashMap<String, PropertyDefinition>();
@MapKey(name = "name")
- @OneToMany(mappedBy = "configurationDefinition", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+ @OneToMany(mappedBy = "configurationDefinition", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@OrderBy
private Map<String, ConfigurationTemplate> templates = new LinkedHashMap<String, ConfigurationTemplate>();
commit b3ce5e7a1767d2b3187ceb23290168c120707a09
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Mar 16 11:49:39 2010 -0400
layout fixes
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/LiveGraphView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/LiveGraphView.java
index f7f493e..fdac23c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/LiveGraphView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/LiveGraphView.java
@@ -253,7 +253,7 @@ public class LiveGraphView extends VLayout {
dataLoader.scheduleRepeating(1000);
- plotOptions.setYAxisOptions(new AxisOptions().setTicks(5).setTickFormatter(new TickFormatter() {
+ plotOptions.setYAxisOptions(new AxisOptions().setLabelWidth(70).setTicks(5).setTickFormatter(new TickFormatter() {
public String formatTickValue(double v, Axis axis) {
return MeasurementConverterClient.format(v, definition.getUnits(), true);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java
index 082eac1..f14f00f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java
@@ -196,6 +196,7 @@ public class SmallGraphView extends VLayout {
titleLayout.setWidth100();
HTMLFlow title = new HTMLFlow("<b>" + definition.getDisplayName() + "</b> " + definition.getDescription());
+ title.setWidth("*");
title.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
displayAsDialog();
@@ -204,7 +205,8 @@ public class SmallGraphView extends VLayout {
titleLayout.addMember(title);
HTMLPane liveGraphLink = new HTMLPane();
- liveGraphLink.setContents("<a>Live Graph</a>");
+ liveGraphLink.setWidth(100);
+ liveGraphLink.setContents("Live Graph");
liveGraphLink.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
LiveGraphView.displayAsDialog(resourceId,definition);
@@ -235,7 +237,7 @@ public class SmallGraphView extends VLayout {
handler.add(new DataPoint(d.getTimestamp(), d.getValue()));
}
- plotOptions.setYAxisOptions(new AxisOptions().setTicks(5).setTickFormatter(new TickFormatter() {
+ plotOptions.setYAxisOptions(new AxisOptions().setTicks(5).setLabelWidth(70).setTickFormatter(new TickFormatter() {
public String formatTickValue(double v, Axis axis) {
return MeasurementConverterClient.format(v, definition.getUnits(), true);
}
commit 3599a9ddca21bd253c11d16d19fe87f13bf16e34
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Mar 16 11:49:16 2010 -0400
Create Principal's along with their subjects
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
index 1464217..edfddbd 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
@@ -105,6 +105,8 @@ public class UserEditView extends VLayout {
subjectRolesEditorItem = new SubjectRolesEditorItem("rolesEditor","Assigned Roles");
+ TextItem departmentItem = new TextItem("department");
+
SubmitItem saveButton = new SubmitItem("save", "Save");
@@ -115,7 +117,6 @@ public class UserEditView extends VLayout {
}
});
- TextItem departmentItem = new TextItem("department");
ResetItem resetButton = new ResetItem("reset", "Reset");
@@ -128,7 +129,8 @@ public class UserEditView extends VLayout {
public void editRecord(Record record) {
- form.getDataSource().getField("username").setCanEdit(false);
+
+ form.getDataSource().getField("username").setCanEdit(record.getAttribute("id") == null);
subjectRolesEditorItem.setSubject((Subject) record.getAttributeAsObject("entity"));
subjectRolesEditorItem.setRoles((Set<Role>) record.getAttributeAsObject("roles"));
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java
index 5673954..b76788b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java
@@ -78,7 +78,6 @@ public class UsersDataSource extends RPCDataSource<Subject> {
idDataField.setCanEdit(false);
DataSourceTextField usernameField = new DataSourceTextField("username", "User Name", 100, true);
- usernameField.setRequired(true);
DataSourceTextField firstName = new DataSourceTextField("firstName", "First Name", 100, true);
@@ -153,7 +152,7 @@ public class UsersDataSource extends RPCDataSource<Subject> {
protected void executeAdd(final DSRequest request, final DSResponse response) {
JavaScriptObject data = request.getData();
final ListGridRecord rec = new ListGridRecord(data);
- Subject newSubject = copyValues(rec);
+ final Subject newSubject = copyValues(rec);
subjectService.createSubject(newSubject, new AsyncCallback<Subject>() {
public void onFailure(Throwable caught) {
@@ -166,10 +165,19 @@ public class UsersDataSource extends RPCDataSource<Subject> {
processResponse(request.getRequestId(), response);
}
- public void onSuccess(Subject result) {
- CoreGUI.getMessageCenter().notify(new Message("User added", Message.Severity.Info));
- response.setData(new Record[]{copyValues(result)});
- processResponse(request.getRequestId(), response);
+ public void onSuccess(final Subject result) {
+ String password = rec.getAttribute("password");
+ subjectService.createPrincipal(newSubject.getName(), password, new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Subject created, but failed to create principal",caught);
+ }
+
+ public void onSuccess(Void nothing) {
+ CoreGUI.getMessageCenter().notify(new Message("Created User [" + newSubject.getName() + "]", Message.Severity.Info));
+ response.setData(new Record[]{copyValues(result)});
+ processResponse(request.getRequestId(), response);
+ }
+ });
}
});
commit 6859f19f79462c29d5b75286c196b72d700bf5e6
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Mar 16 11:48:38 2010 -0400
Resource create (by configuration)
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 208ce29..89fbba7 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
@@ -526,7 +526,7 @@ public class ConfigurationEditor extends VLayout {
buildListOfMapsField(fields, (PropertyDefinitionMap) ((PropertyDefinitionList) propertyDefinition).getMemberDefinition(), oddRow, (PropertyList) property);
}
} else if (propertyDefinition instanceof PropertyDefinitionMap) {
- buildMapsField(fields, (PropertyDefinitionMap)propertyDefinition, (PropertyMap) property);
+ buildMapsField(fields, (PropertyDefinitionMap) propertyDefinition, (PropertyMap) property);
}
}
@@ -545,16 +545,18 @@ public class ConfigurationEditor extends VLayout {
propertyGrid.setEditorsMap("fieldType", editorsMap);
- ListGridRecord[] records = new ListGridRecord[propertyMap.getMap().size()];
- int i = 0;
- for (Property property : propertyMap.getMap().values()) {
- ListGridRecord record = new ListGridRecord();
- record.setAttribute("Name",property.getName());
- record.setAttribute("Value",((PropertySimple)property).getStringValue());
- record.setAttribute("fieldType","simpleText");
- records[i++] = record;
+ if (propertyMap != null) {
+ ListGridRecord[] records = new ListGridRecord[propertyMap.getMap().size()];
+ int i = 0;
+ for (Property property : propertyMap.getMap().values()) {
+ ListGridRecord record = new ListGridRecord();
+ record.setAttribute("Name", property.getName());
+ record.setAttribute("Value", ((PropertySimple) property).getStringValue());
+ record.setAttribute("fieldType", "simpleText");
+ records[i++] = record;
+ }
+ propertyGrid.setData(records);
}
- propertyGrid.setData(records);
propertyGrid.draw();
@@ -753,18 +755,24 @@ public class ConfigurationEditor extends VLayout {
FormItem valueItem = null;
- boolean isUnset = property == null || propertySimple.getStringValue() == null;
-
+ boolean isUnset = (property == null || propertySimple.getStringValue() == null) && propertyDefinition.isRequired() == false;
- final CheckboxItem unsetItem = new CheckboxItem();
- unsetItem.setValue(isUnset);
- unsetItem.setDisabled(readOnly);
- unsetItem.setShowLabel(false);
- unsetItem.setShowTitle(false);
- unsetItem.setLabelAsTitle(false);
- unsetItem.setColSpan(1);
- unsetItem.setCellStyle(oddRow ? "OddRow" : "EvenRow");
- fields.add(unsetItem);
+ CheckboxItem unsetItem = null;
+ if (!propertyDefinition.isRequired()) {
+ unsetItem = new CheckboxItem();
+ unsetItem.setValue(isUnset);
+ unsetItem.setDisabled(readOnly);
+ unsetItem.setShowLabel(false);
+ unsetItem.setShowTitle(false);
+ unsetItem.setLabelAsTitle(false);
+ unsetItem.setColSpan(1);
+ unsetItem.setCellStyle(oddRow ? "OddRow" : "EvenRow");
+ fields.add(unsetItem);
+ } else {
+ SpacerItem spacer = new SpacerItem();
+ spacer.setCellStyle(oddRow ? "OddRow" : "EvenRow");
+ fields.add(spacer);
+ }
List<PropertyDefinitionEnumeration> enumeratedValues = propertyDefinition.getEnumeratedValues();
@@ -772,7 +780,7 @@ public class ConfigurationEditor extends VLayout {
LinkedHashMap<String, String> valueOptions = new LinkedHashMap<String, String>();
for (PropertyDefinitionEnumeration option : propertyDefinition.getEnumeratedValues()) {
- valueOptions.put(option.getName(), option.getValue());
+ valueOptions.put(option.getValue(), option.getName());
}
if (valueOptions.size() > 5) {
@@ -824,6 +832,8 @@ public class ConfigurationEditor extends VLayout {
}
+ valueItem.setRequired(propertyDefinition.isRequired());
+
if (propertyDefinition.getConstraints() != null) {
Set<Constraint> constraints = propertyDefinition.getConstraints();
for (Constraint c : constraints) {
@@ -871,19 +881,21 @@ public class ConfigurationEditor extends VLayout {
}
});
- unsetItem.addChangeHandler(new ChangeHandler() {
- public void onChange(ChangeEvent changeEvent) {
- Boolean isUnset = (Boolean) changeEvent.getValue();
- if (isUnset) {
- finalValueItem.setDisabled(true);
- finalValueItem.setValue((String) null);
- } else {
- finalValueItem.setDisabled(false);
- finalValueItem.focusInItem();
+ if (unsetItem != null) {
+ unsetItem.addChangeHandler(new ChangeHandler() {
+ public void onChange(ChangeEvent changeEvent) {
+ Boolean isUnset = (Boolean) changeEvent.getValue();
+ if (isUnset) {
+ finalValueItem.setDisabled(true);
+ finalValueItem.setValue((String) null);
+ } else {
+ finalValueItem.setDisabled(false);
+ finalValueItem.focusInItem();
+ }
+ propertySimple.setValue(finalValueItem.getValue());
}
- propertySimple.setValue(finalValueItem.getValue());
- }
- });
+ });
+ }
return valueItem;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
index 72eb3fe..07025a9 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
@@ -18,6 +18,7 @@
*/
package org.rhq.enterprise.gui.coregui.client.components.wizard;
+import java.util.List;
import java.util.ArrayList;
import com.smartgwt.client.widgets.Canvas;
@@ -112,7 +113,7 @@ public class WizardView extends VLayout {
*/
public void refreshTitleLabelContents() {
this.titleLabel.setContents("<span class=\"HeaderLabel\">" + wizard.getTitle() + "</span><br/>"
- + wizard.getSubtitle());
+ + (wizard.getSubtitle() != null ? wizard.getSubtitle() : ""));
}
private void setupButtons() {
@@ -174,9 +175,12 @@ public class WizardView extends VLayout {
buttonBar.removeMember(button);
}
customButtons.clear();
- for (IButton button : wizard.getCustomButtons(currentStep)) {
- buttonBar.addMember(button);
- customButtons.add(button);
+ List<IButton> cbs = wizard.getCustomButtons(currentStep);
+ if (cbs != null) {
+ for (IButton button : cbs) {
+ buttonBar.addMember(button);
+ customButtons.add(button);
+ }
}
if (currentCanvas != null) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java
index 8246581..e63365b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGWTService.java
@@ -19,6 +19,7 @@
package org.rhq.enterprise.gui.coregui.client.gwt;
import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.util.PageList;
@@ -40,4 +41,8 @@ public interface ResourceGWTService extends RemoteService {
Resource getPlatformForResource(int resourceId);
+ List<Integer> deleteResources(int[] resourceIds);
+
+ void createResource(int parentResourceId, int newResourceTypeId, String newResourceName, Configuration newResourceConfiguration);
+
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
index 1d756c1..30822c5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
@@ -27,6 +27,7 @@ import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.create.OperationCreateWizard;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.factory.ResourceFactoryCreateWizard;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
@@ -244,10 +245,16 @@ public class ResourceTreeView extends VLayout {
// Create Menu
MenuItem createChildMenu = new MenuItem("Create Child");
Menu createChildSubMenu = new Menu();
- for (ResourceType childType : node.getResourceType().getChildResourceTypes()) {
+ for (final ResourceType childType : node.getResourceType().getChildResourceTypes()) {
if (childType.isCreatable()) {
- createChildSubMenu.addItem(new MenuItem(childType.getName()));
- //todo action
+ MenuItem createItem = new MenuItem(childType.getName());
+ createChildSubMenu.addItem(createItem);
+ createItem.addClickHandler(new ClickHandler() {
+ public void onClick(MenuItemClickEvent event) {
+ ResourceFactoryCreateWizard.showCreateWizard(node.getResource(), childType);
+ }
+ });
+
}
}
createChildMenu.setSubmenu(createChildSubMenu);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ConfigurationStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ConfigurationStep.java
new file mode 100644
index 0000000..33ddebe
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ConfigurationStep.java
@@ -0,0 +1,75 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.factory;
+
+import java.util.Map;
+
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.SelectItem;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.configuration.definition.ConfigurationTemplate;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+
+/**
+ * @author Greg Hinkle
+ */
+public class ConfigurationStep implements WizardStep {
+
+ private ConfigurationEditor editor;
+ ResourceFactoryCreateWizard wizard;
+
+ public ConfigurationStep(ResourceFactoryCreateWizard wizard) {
+ this.wizard = wizard;
+ }
+
+ public Canvas getCanvas() {
+ if (editor == null) {
+
+ ConfigurationDefinition def = wizard.getConfigurationDefinition();
+ Configuration startingConfig = wizard.getConfiguration();
+
+ editor = new ConfigurationEditor(def, startingConfig);
+ }
+ return editor;
+ }
+
+ public boolean nextPage() {
+ return true;
+ }
+
+ public String getName() {
+ return "Edit Configuration";
+ }
+
+ public boolean isPreviousEnabled() {
+ return true;
+ }
+
+ public boolean isNextEnabled() {
+ return false;
+ }
+
+ public Configuration getConfiguration() {
+ return editor.getConfiguration();
+ }
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ConfigurationTemplateStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ConfigurationTemplateStep.java
new file mode 100644
index 0000000..eee603a
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ConfigurationTemplateStep.java
@@ -0,0 +1,95 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.factory;
+
+import java.util.Map;
+
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.SelectItem;
+import com.smartgwt.client.widgets.form.fields.TextItem;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.configuration.definition.ConfigurationTemplate;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+
+/**
+ * @author Greg Hinkle
+ */
+public class ConfigurationTemplateStep implements WizardStep {
+
+ private DynamicForm form;
+ private ResourceFactoryCreateWizard wizard;
+ private Map<String, ConfigurationTemplate> templates;
+
+ public ConfigurationTemplateStep(ResourceFactoryCreateWizard wizard) {
+ this.wizard = wizard;
+ }
+
+ public Canvas getCanvas() {
+ if (form == null) {
+
+ form = new DynamicForm();
+
+ TextItem nameItem = new TextItem("resourceName", "Resource Name");
+ nameItem.setRequired(true);
+
+ SelectItem templateSelect = new SelectItem("template","Template");
+
+ ConfigurationDefinition definition = wizard.getConfigurationDefinition();
+
+ templates = definition.getTemplates();
+
+ if (templates != null && !templates.isEmpty()) {
+ templateSelect.setValueMap(templates.keySet().toArray(new String[templates.size()]));
+ } else {
+ templateSelect.setDisabled(true);
+ }
+
+ form.setItems(nameItem, templateSelect);
+
+ }
+ return form;
+ }
+
+ public boolean nextPage() {
+ return form.validate();
+ }
+
+ public String getName() {
+ return "Select a Template";
+ }
+
+ public boolean isPreviousEnabled() {
+ return false;
+ }
+
+ public boolean isNextEnabled() {
+ return true;
+ }
+
+ public Configuration getConfiguration() {
+ return templates.get(form.getValueAsString("template")).createConfiguration();
+ }
+
+ public String getResourceName() {
+ return form.getValueAsString("resourceName");
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryCreateWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryCreateWizard.java
new file mode 100644
index 0000000..363bb3e
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryCreateWizard.java
@@ -0,0 +1,168 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.factory;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.List;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.widgets.IButton;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.Wizard;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardView;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+
+/**
+ * @author Greg Hinkle
+ */
+public class ResourceFactoryCreateWizard implements Wizard {
+
+ private ConfigurationDefinition configurationDefinition;
+ private Resource parentResource;
+ private ResourceType createType;
+
+ private WizardView view;
+
+ private ConfigurationTemplateStep configurationTemplateStep;
+ private ConfigurationStep configurationStep;
+
+ private ArrayList<WizardStep> steps;
+
+
+ public ResourceFactoryCreateWizard(Resource parentResource, ResourceType createType, ConfigurationDefinition configurationDefinition) {
+ this.parentResource = parentResource;
+ this.createType = createType;
+ this.configurationDefinition = configurationDefinition;
+
+ assert parentResource != null;
+ assert createType != null;
+ assert configurationDefinition != null;
+
+
+ steps = new ArrayList<WizardStep>();
+
+ configurationTemplateStep = new ConfigurationTemplateStep(this);
+ steps.add(configurationTemplateStep);
+
+ configurationStep = new ConfigurationStep(this);
+ steps.add(configurationStep);
+ }
+
+ public String getWindowTitle() {
+ return "Resource Create Wizard";
+ }
+
+ public String getTitle() {
+ return "Create New " + createType.getName();
+ }
+
+ public String getSubtitle() {
+ return null;
+ }
+
+ public List<WizardStep> getSteps() {
+ return steps;
+ }
+
+ public List<IButton> getCustomButtons(int step) {
+ switch (step) {
+ case 1:
+ IButton createButton = new IButton("Create");
+ createButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ execute();
+ }
+ });
+ return Collections.singletonList(createButton);
+ }
+ return null;
+ }
+
+
+ private void execute() {
+
+ int parentReourceId = parentResource.getId();
+ int createTypeId = createType.getId();
+ String newResourceName = configurationTemplateStep.getResourceName();
+ Configuration newConfiguration = configurationStep.getConfiguration();
+
+ GWTServiceLookup.getResourceService().createResource(
+ parentReourceId,
+ createTypeId,
+ newResourceName,
+ newConfiguration,
+ new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to create new resource", caught);
+ view.closeDialog();
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(new Message("Submitted request to create new resource [" +
+ configurationTemplateStep.getResourceName() + "]", Message.Severity.Info));
+ view.closeDialog();
+ }
+ });
+ }
+
+
+ public void display() {
+ view = new WizardView(this);
+ view.displayDialog();
+ }
+
+ public static void showCreateWizard(final Resource parentResource, ResourceType childType) {
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(childType.getId(),
+ EnumSet.of(ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
+ new ResourceTypeRepository.TypeLoadedCallback() {
+ public void onTypesLoaded(ResourceType type) {
+ ResourceFactoryCreateWizard wizard = new ResourceFactoryCreateWizard(parentResource, type, type.getResourceConfigurationDefinition());
+ wizard.display();
+ }
+ });
+ }
+
+ public ConfigurationDefinition getConfigurationDefinition() {
+ return configurationDefinition;
+ }
+
+ public Configuration getConfiguration() {
+ return configurationTemplateStep.getConfiguration();
+ }
+
+ public Resource getParentResource() {
+ return parentResource;
+ }
+
+ public ResourceType getCreateType() {
+ return createType;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
index b320630..b7303c4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
@@ -18,12 +18,16 @@
*/
package org.rhq.enterprise.gui.coregui.server.gwt;
+import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.RawConfiguration;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.configuration.definition.ConfigurationTemplate;
import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTService;
import org.rhq.enterprise.gui.coregui.server.util.SerialUtility;
+import org.rhq.enterprise.server.resource.ResourceFactoryManagerLocal;
import org.rhq.enterprise.server.resource.ResourceManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
@@ -41,6 +45,7 @@ import java.util.Set;
public class ResourceGWTServiceImpl extends AbstractGWTServiceImpl implements ResourceGWTService {
private ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();
+ private ResourceFactoryManagerLocal resourceFactoryManager = LookupUtil.getResourceFactoryManager();
private static String[] importantFields = {
@@ -130,11 +135,33 @@ public class ResourceGWTServiceImpl extends AbstractGWTServiceImpl implements Re
return SerialUtility.prepare(resourceManager.getRootResourceForResource(resourceId), "ResourceService.getPlatformForResource");
}
- public RawConfiguration dummy(RawConfiguration config) {
- System.out.println(config.getPath());
- return config;
+
+ public List<Integer> deleteResources(int[] resourceIds) {
+ return SerialUtility.prepare(
+ resourceManager.deleteResources(getSessionSubject(), resourceIds),
+ "ResourceService.deleteResources");
}
+ public void createResource(int parentResourceId, int newResourceTypeId, String newResourceName, Configuration newResourceConfiguration) {
+
+ ConfigurationDefinition pluginConfigDefinition =
+ LookupUtil.getConfigurationManager().
+ getPluginConfigurationDefinitionForResourceType(getSessionSubject(), newResourceTypeId);
+ Configuration pluginConfig = null;
+ if (pluginConfigDefinition != null) {
+ ConfigurationTemplate pluginConfigTemplate = pluginConfigDefinition.getDefaultTemplate();
+ pluginConfig = (pluginConfigTemplate != null) ? pluginConfigTemplate.createConfiguration()
+ : new Configuration();
+
+ // TODO GH: Is this still necessary now that we don't blow up on non-normalized configs
+ // ConfigurationUtility.normalizeConfiguration(pluginConfig, pluginConfigDefinition);
+ }
+
+
+ resourceFactoryManager.createResource(getSessionSubject(),
+ parentResourceId, newResourceTypeId, newResourceName, pluginConfig, newResourceConfiguration);
+ }
+
}
\ No newline at end of file
commit 9627f163b0a9332bfc823d768647aeb5cf1b356d
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Mar 16 18:05:43 2010 +0100
Finally this looks good.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
index 850915a..e4f183d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
@@ -49,6 +49,7 @@ import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
* selected alerts.
*
* @author Ian Springer
+ * @author Heiko W. Rupp
*/
public class AlertsView extends VLayout {
private static final String TITLE = "Alerts";
@@ -112,19 +113,22 @@ public class AlertsView extends VLayout {
ListGridRecord record = selectedRecords[0];
String name = record.getAttribute("name");
String id = record.getAttribute("id");
- // TODO: Finish this.
+
+ // Clean out existing details and provide new ones
+ for (int i = 1 ; i <= getChildren().length ; i ++)
+ getChildren()[1].destroy();
+
detailsTable = getDetailsTableForAlert(record);
- vpanel.clear();
- vpanel.setWidth(getWidthAsString());
- vpanel.add(detailsTable);
+ addMember(detailsTable);
Table notifTable = getNotificationsForAlert(record.getAttributeAsRecordArray("notificationLogs"));
- notifTable.setWidth(getWidth());
- vpanel.add(notifTable);
+ addMember(notifTable);
} else {
- vpanel.clear();
- vpanel.add(getNoAlertSelectedMessage());
+ // Clean out existing details and show the "nothing selected message"
+ for (int i = 1 ; i <= getChildren().length ; i ++)
+ getChildren()[1].destroy();
+ addMember(getNoAlertSelectedMessage());
}
}
});
@@ -132,20 +136,14 @@ public class AlertsView extends VLayout {
addMember(this.table);
// Add the details panel as the bottom half of the view.
- vpanel = new VerticalPanel();
- vpanel.setWidth("100%");
- vpanel.setHeight("50%");
- vpanel.add(getNoAlertSelectedMessage());
-
-// detailsTable = new DynamicForm(); // empty?
-// vpanel.add(detailsTable);
- addMember(vpanel);
+ // Default is the "nothing selected" message
+ addMember(getNoAlertSelectedMessage());
}
private HTMLFlow getNoAlertSelectedMessage() {
- HTMLFlow f = new HTMLFlow("<h2>Select a single alert above to display its details here.</h2>");
- f.setWidth100();
+ HTMLFlow f = new HTMLFlow("<h3>Select a single alert above to display its details here.</h3>");
+ f.setHeight("50%");
return f;
}
@@ -153,7 +151,7 @@ public class AlertsView extends VLayout {
DynamicForm form = new DynamicForm();
form.setNumCols(4);
- form.setWidth("60%");
+ form.setHeight("15%");
form.setWrapItemTitles(false);
form.setAlign(Alignment.LEFT);
@@ -198,6 +196,7 @@ public class AlertsView extends VLayout {
private Table getNotificationsForAlert(DataClass[] input) {
Table notifTable = new Table("Notifications",false);
+ notifTable.setHeight("35%");
notifTable.setWidth100();
ListGrid grid = notifTable.getListGrid();
grid.setData((Record[]) input);
commit acd372706fab4c4b0ee533c29f1e59b3449c040e
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Mar 16 11:26:12 2010 -0400
LT commit
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/units.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/units.js
index 54f2a5b..7bdcd0d 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/units.js
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/units.js
@@ -1,64 +1,64 @@
-/*==================================================
- * Default Unit
- *==================================================
- */
-
-SimileAjax.NativeDateUnit = new Object();
-
-SimileAjax.NativeDateUnit.makeDefaultValue = function() {
- return new Date();
-};
-
-SimileAjax.NativeDateUnit.cloneValue = function(v) {
- return new Date(v.getTime());
-};
-
-SimileAjax.NativeDateUnit.getParser = function(format) {
- if (typeof format == "string") {
- format = format.toLowerCase();
- }
- return (format == "iso8601" || format == "iso 8601") ?
- SimileAjax.DateTime.parseIso8601DateTime :
- SimileAjax.DateTime.parseGregorianDateTime;
-};
-
-SimileAjax.NativeDateUnit.parseFromObject = function(o) {
- return SimileAjax.DateTime.parseGregorianDateTime(o);
-};
-
-SimileAjax.NativeDateUnit.toNumber = function(v) {
- return v.getTime();
-};
-
-SimileAjax.NativeDateUnit.fromNumber = function(n) {
- return new Date(n);
-};
-
-SimileAjax.NativeDateUnit.compare = function(v1, v2) {
- var n1, n2;
- if (typeof v1 == "object") {
- n1 = v1.getTime();
- } else {
- n1 = Number(v1);
- }
- if (typeof v2 == "object") {
- n2 = v2.getTime();
- } else {
- n2 = Number(v2);
- }
-
- return n1 - n2;
-};
-
-SimileAjax.NativeDateUnit.earlier = function(v1, v2) {
- return SimileAjax.NativeDateUnit.compare(v1, v2) < 0 ? v1 : v2;
-};
-
-SimileAjax.NativeDateUnit.later = function(v1, v2) {
- return SimileAjax.NativeDateUnit.compare(v1, v2) > 0 ? v1 : v2;
-};
-
-SimileAjax.NativeDateUnit.change = function(v, n) {
- return new Date(v.getTime() + n);
-};
-
+/*==================================================
+ * Default Unit
+ *==================================================
+ */
+
+SimileAjax.NativeDateUnit = new Object();
+
+SimileAjax.NativeDateUnit.makeDefaultValue = function() {
+ return new Date();
+};
+
+SimileAjax.NativeDateUnit.cloneValue = function(v) {
+ return new Date(v.getTime());
+};
+
+SimileAjax.NativeDateUnit.getParser = function(format) {
+ if (typeof format == "string") {
+ format = format.toLowerCase();
+ }
+ return (format == "iso8601" || format == "iso 8601") ?
+ SimileAjax.DateTime.parseIso8601DateTime :
+ SimileAjax.DateTime.parseGregorianDateTime;
+};
+
+SimileAjax.NativeDateUnit.parseFromObject = function(o) {
+ return SimileAjax.DateTime.parseGregorianDateTime(o);
+};
+
+SimileAjax.NativeDateUnit.toNumber = function(v) {
+ return v.getTime();
+};
+
+SimileAjax.NativeDateUnit.fromNumber = function(n) {
+ return new Date(n);
+};
+
+SimileAjax.NativeDateUnit.compare = function(v1, v2) {
+ var n1, n2;
+ if (typeof v1 == "object") {
+ n1 = v1.getTime();
+ } else {
+ n1 = Number(v1);
+ }
+ if (typeof v2 == "object") {
+ n2 = v2.getTime();
+ } else {
+ n2 = Number(v2);
+ }
+
+ return n1 - n2;
+};
+
+SimileAjax.NativeDateUnit.earlier = function(v1, v2) {
+ return SimileAjax.NativeDateUnit.compare(v1, v2) < 0 ? v1 : v2;
+};
+
+SimileAjax.NativeDateUnit.later = function(v1, v2) {
+ return SimileAjax.NativeDateUnit.compare(v1, v2) > 0 ? v1 : v2;
+};
+
+SimileAjax.NativeDateUnit.change = function(v, n) {
+ return new Date(v.getTime() + n);
+};
+
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/scripts/units.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/scripts/units.js
index 86182ff..2b34f6f 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/scripts/units.js
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/scripts/units.js
@@ -1,86 +1,86 @@
-/*==================================================
- * Geochrono Unit
- *==================================================
- */
-
-Timeline.GeochronoUnit = new Object();
-
-Timeline.GeochronoUnit.MA = 0;
-Timeline.GeochronoUnit.AGE = 1;
-Timeline.GeochronoUnit.EPOCH = 2;
-Timeline.GeochronoUnit.PERIOD = 3;
-Timeline.GeochronoUnit.ERA = 4;
-Timeline.GeochronoUnit.EON = 5;
-
-Timeline.GeochronoUnit.getParser = function(format) {
- return Timeline.GeochronoUnit.parseFromObject;
-};
-
-Timeline.GeochronoUnit.createLabeller = function(locale, timeZone) {
- return new Timeline.GeochronoLabeller(locale);
-};
-
-Timeline.GeochronoUnit.wrapMA = function (n) {
- return new Timeline.GeochronoUnit._MA(n);
-};
-
-Timeline.GeochronoUnit.makeDefaultValue = function () {
- return Timeline.GeochronoUnit.wrapMA(0);
-};
-
-Timeline.GeochronoUnit.cloneValue = function (v) {
- return new Timeline.GeochronoUnit._MA(v._n);
-};
-
-Timeline.GeochronoUnit.parseFromObject = function(o) {
- if (o instanceof Timeline.GeochronoUnit._MA) {
- return o;
- } else if (typeof o == "number") {
- return Timeline.GeochronoUnit.wrapMA(o);
- } else if (typeof o == "string" && o.length > 0) {
- return Timeline.GeochronoUnit.wrapMA(Number(o));
- } else {
- return null;
- }
-};
-
-Timeline.GeochronoUnit.toNumber = function(v) {
- return v._n;
-};
-
-Timeline.GeochronoUnit.fromNumber = function(n) {
- return new Timeline.GeochronoUnit._MA(n);
-};
-
-Timeline.GeochronoUnit.compare = function(v1, v2) {
- var n1, n2;
- if (typeof v1 == "object") {
- n1 = v1._n;
- } else {
- n1 = Number(v1);
- }
- if (typeof v2 == "object") {
- n2 = v2._n;
- } else {
- n2 = Number(v2);
- }
-
- return n2 - n1;
-};
-
-Timeline.GeochronoUnit.earlier = function(v1, v2) {
- return Timeline.GeochronoUnit.compare(v1, v2) < 0 ? v1 : v2;
-};
-
-Timeline.GeochronoUnit.later = function(v1, v2) {
- return Timeline.GeochronoUnit.compare(v1, v2) > 0 ? v1 : v2;
-};
-
-Timeline.GeochronoUnit.change = function(v, n) {
- return new Timeline.GeochronoUnit._MA(v._n - n);
-};
-
-Timeline.GeochronoUnit._MA = function(n) {
- this._n = n;
-};
-
+/*==================================================
+ * Geochrono Unit
+ *==================================================
+ */
+
+Timeline.GeochronoUnit = new Object();
+
+Timeline.GeochronoUnit.MA = 0;
+Timeline.GeochronoUnit.AGE = 1;
+Timeline.GeochronoUnit.EPOCH = 2;
+Timeline.GeochronoUnit.PERIOD = 3;
+Timeline.GeochronoUnit.ERA = 4;
+Timeline.GeochronoUnit.EON = 5;
+
+Timeline.GeochronoUnit.getParser = function(format) {
+ return Timeline.GeochronoUnit.parseFromObject;
+};
+
+Timeline.GeochronoUnit.createLabeller = function(locale, timeZone) {
+ return new Timeline.GeochronoLabeller(locale);
+};
+
+Timeline.GeochronoUnit.wrapMA = function (n) {
+ return new Timeline.GeochronoUnit._MA(n);
+};
+
+Timeline.GeochronoUnit.makeDefaultValue = function () {
+ return Timeline.GeochronoUnit.wrapMA(0);
+};
+
+Timeline.GeochronoUnit.cloneValue = function (v) {
+ return new Timeline.GeochronoUnit._MA(v._n);
+};
+
+Timeline.GeochronoUnit.parseFromObject = function(o) {
+ if (o instanceof Timeline.GeochronoUnit._MA) {
+ return o;
+ } else if (typeof o == "number") {
+ return Timeline.GeochronoUnit.wrapMA(o);
+ } else if (typeof o == "string" && o.length > 0) {
+ return Timeline.GeochronoUnit.wrapMA(Number(o));
+ } else {
+ return null;
+ }
+};
+
+Timeline.GeochronoUnit.toNumber = function(v) {
+ return v._n;
+};
+
+Timeline.GeochronoUnit.fromNumber = function(n) {
+ return new Timeline.GeochronoUnit._MA(n);
+};
+
+Timeline.GeochronoUnit.compare = function(v1, v2) {
+ var n1, n2;
+ if (typeof v1 == "object") {
+ n1 = v1._n;
+ } else {
+ n1 = Number(v1);
+ }
+ if (typeof v2 == "object") {
+ n2 = v2._n;
+ } else {
+ n2 = Number(v2);
+ }
+
+ return n2 - n1;
+};
+
+Timeline.GeochronoUnit.earlier = function(v1, v2) {
+ return Timeline.GeochronoUnit.compare(v1, v2) < 0 ? v1 : v2;
+};
+
+Timeline.GeochronoUnit.later = function(v1, v2) {
+ return Timeline.GeochronoUnit.compare(v1, v2) > 0 ? v1 : v2;
+};
+
+Timeline.GeochronoUnit.change = function(v, n) {
+ return new Timeline.GeochronoUnit._MA(v._n - n);
+};
+
+Timeline.GeochronoUnit._MA = function(n) {
+ this._n = n;
+};
+
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/ext/japanese-eras.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/ext/japanese-eras.js
index 92027ac..46a8adf 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/ext/japanese-eras.js
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/ext/japanese-eras.js
@@ -144,252 +144,252 @@ Timeline.JapaneseEraDateLabeller._eras = new Timeline.SortedArray(
return e1.startingYear - e2.startingYear;
},
[
- { startingYear: 645, japaneseName: '倧å', romanizedName: "Taika" },
- { startingYear: 650, japaneseName: 'çœé', romanizedName: "Hakuchi" },
- { startingYear: 686, japaneseName: 'æ±é³¥', romanizedName: "ShuchÅ" },
- { startingYear: 701, japaneseName: '倧å®', romanizedName: "TaihÅ" },
- { startingYear: 704, japaneseName: 'æ
¶é²', romanizedName: "Keiun" },
- { startingYear: 708, japaneseName: 'åé
', romanizedName: "WadÅ" },
- { startingYear: 715, japaneseName: 'éäº', romanizedName: "Reiki" },
- { startingYear: 717, japaneseName: 'é€è', romanizedName: "YÅrÅ" },
- { startingYear: 724, japaneseName: 'ç¥äº', romanizedName: "Jinki" },
- { startingYear: 729, japaneseName: '倩平', romanizedName: "TenpyÅ" },
- { startingYear: 749, japaneseName: '倩平æå®', romanizedName: "TenpyÅ-kanpÅ" },
- { startingYear: 749, japaneseName: '倩平åå®', romanizedName: "TenpyÅ-shÅhÅ" },
- { startingYear: 757, japaneseName: '倩平å®å', romanizedName: "TenpyÅ-hÅji" },
- { startingYear: 765, japaneseName: '倩平ç¥è·', romanizedName: "TenpyÅ-jingo" },
- { startingYear: 767, japaneseName: 'ç¥è·æ¯é²', romanizedName: "Jingo-keiun" },
- { startingYear: 770, japaneseName: 'å®äº', romanizedName: "HÅki" },
- { startingYear: 781, japaneseName: '倩å¿', romanizedName: "Ten'Å" },
- { startingYear: 782, japaneseName: 'å»¶æŠ', romanizedName: "Enryaku" },
- { startingYear: 806, japaneseName: '倧å', romanizedName: "DaidÅ" },
- { startingYear: 810, japaneseName: 'åŒä»', romanizedName: "KÅnin" },
- { startingYear: 824, japaneseName: '倩é·', romanizedName: "TenchÅ" },
- { startingYear: 834, japaneseName: 'æ¿å', romanizedName: "JÅwa" },
- { startingYear: 848, japaneseName: 'å祥', romanizedName: "KajÅ" },
- { startingYear: 851, japaneseName: 'ä»å¯¿', romanizedName: "Ninju" },
- { startingYear: 854, japaneseName: 'æè¡¡', romanizedName: "SaikÅ" },
- { startingYear: 857, japaneseName: '倩å®', romanizedName: "Tennan" },
- { startingYear: 859, japaneseName: 'è²èг', romanizedName: "JÅgan" },
- { startingYear: 877, japaneseName: 'å
æ
¶', romanizedName: "GangyÅ" },
- { startingYear: 885, japaneseName: 'ä»å', romanizedName: "Ninna" },
- { startingYear: 889, japaneseName: 'å¯å¹³', romanizedName: "KanpyÅ" },
- { startingYear: 898, japaneseName: 'ææ³°', romanizedName: "ShÅtai" },
- { startingYear: 901, japaneseName: 'å»¶å', romanizedName: "Engi" },
- { startingYear: 923, japaneseName: 'å»¶é·', romanizedName: "EnchÅ" },
- { startingYear: 931, japaneseName: 'æ¿å¹³', romanizedName: "JÅhei" },
- { startingYear: 938, japaneseName: '倩æ
¶', romanizedName: "TengyÅ" },
- { startingYear: 947, japaneseName: '倩æŠ', romanizedName: "Tenryaku" },
- { startingYear: 957, japaneseName: '倩埳', romanizedName: "Tentoku" },
- { startingYear: 961, japaneseName: 'å¿å', romanizedName: "Åwa" },
- { startingYear: 964, japaneseName: '康ä¿', romanizedName: "KÅhÅ" },
- { startingYear: 968, japaneseName: 'å®å', romanizedName: "Anna" },
- { startingYear: 970, japaneseName: '倩çŠ', romanizedName: "Tenroku" },
- { startingYear: 973, japaneseName: '倩延', romanizedName: "Ten'en" },
- { startingYear: 976, japaneseName: 'è²å
', romanizedName: "JÅgen" },
- { startingYear: 978, japaneseName: '倩å
', romanizedName: "Tengen" },
- { startingYear: 983, japaneseName: '氞芳', romanizedName: "Eikan" },
- { startingYear: 985, japaneseName: 'å¯å', romanizedName: "Kanna" },
- { startingYear: 987, japaneseName: 'æ°žå»¶', romanizedName: "Eien" },
- { startingYear: 988, japaneseName: 'æ°žç¥', romanizedName: "Eiso" },
- { startingYear: 990, japaneseName: 'æ£æŠ', romanizedName: "ShÅryaku" },
- { startingYear: 995, japaneseName: 'é·åŸ³', romanizedName: "ChÅtoku" },
- { startingYear: 999, japaneseName: 'é·ä¿', romanizedName: "ChÅhÅ" },
- { startingYear: 1004, japaneseName: 'å¯åŒ', romanizedName: "KankÅ" },
- { startingYear: 1012, japaneseName: 'é·å', romanizedName: "ChÅwa" },
- { startingYear: 1017, japaneseName: 'å¯ä»', romanizedName: "Kannin" },
- { startingYear: 1021, japaneseName: 'æ²»å®', romanizedName: "Jian" },
- { startingYear: 1024, japaneseName: 'äžå¯¿', romanizedName: "Manju" },
- { startingYear: 1028, japaneseName: 'é·å
', romanizedName: "ChÅgen" },
- { startingYear: 1037, japaneseName: 'é·æŠ', romanizedName: "ChÅryaku" },
- { startingYear: 1040, japaneseName: 'é·ä¹
', romanizedName: "ChÅkyÅ«" },
- { startingYear: 1044, japaneseName: 'å¯åŸ³', romanizedName: "Kantoku" },
- { startingYear: 1046, japaneseName: 'æ°žæ¿', romanizedName: "EishÅ" },
- { startingYear: 1053, japaneseName: '倩å', romanizedName: "Tengi" },
- { startingYear: 1058, japaneseName: '康平', romanizedName: "KÅhei" },
- { startingYear: 1065, japaneseName: 'æ²»æŠ', romanizedName: "Jiryaku" },
- { startingYear: 1069, japaneseName: 'å»¶ä¹
', romanizedName: "Enkyū" },
- { startingYear: 1074, japaneseName: 'æ¿ä¿', romanizedName: "JÅhÅ" },
- { startingYear: 1077, japaneseName: 'æ¿æŠ', romanizedName: "JÅryaku" },
- { startingYear: 1081, japaneseName: 'æ°žä¿', romanizedName: "EihÅ" },
- { startingYear: 1084, japaneseName: 'å¿åŸ³', romanizedName: "Åtoku" },
- { startingYear: 1087, japaneseName: '坿²»', romanizedName: "Kanji" },
- { startingYear: 1094, japaneseName: 'åä¿', romanizedName: "KahÅ" },
- { startingYear: 1096, japaneseName: 'æ°žé·', romanizedName: "EichÅ" },
- { startingYear: 1097, japaneseName: 'æ¿åŸ³', romanizedName: "JÅtoku" },
- { startingYear: 1099, japaneseName: '康å', romanizedName: "KÅwa" },
- { startingYear: 1104, japaneseName: 'é·æ²»', romanizedName: "ChÅji" },
- { startingYear: 1106, japaneseName: 'åæ¿', romanizedName: "KajÅ" },
- { startingYear: 1108, japaneseName: '倩ä»', romanizedName: "Tennin" },
- { startingYear: 1110, japaneseName: '倩氞', romanizedName: "Ten'ei" },
- { startingYear: 1113, japaneseName: 'æ°žä¹
', romanizedName: "Eikyū" },
- { startingYear: 1118, japaneseName: 'å
æ°ž', romanizedName: "Gen'ei" },
- { startingYear: 1120, japaneseName: 'ä¿å®', romanizedName: "HÅan" },
- { startingYear: 1124, japaneseName: '倩治', romanizedName: "Tenji" },
- { startingYear: 1126, japaneseName: '倧治', romanizedName: "Daiji" },
- { startingYear: 1131, japaneseName: '倩æ¿', romanizedName: "TenshÅ" },
- { startingYear: 1132, japaneseName: 'é·æ¿', romanizedName: "ChÅshÅ" },
- { startingYear: 1135, japaneseName: 'ä¿å»¶', romanizedName: "HÅen" },
- { startingYear: 1141, japaneseName: 'æ°žæ²»', romanizedName: "Eiji" },
- { startingYear: 1142, japaneseName: '康治', romanizedName: "KÅji" },
- { startingYear: 1144, japaneseName: '倩é€', romanizedName: "Ten'yÅ" },
- { startingYear: 1145, japaneseName: 'ä¹
å®', romanizedName: "KyÅ«an" },
- { startingYear: 1151, japaneseName: 'ä»å¹³', romanizedName: "Ninpei" },
- { startingYear: 1154, japaneseName: 'ä¹
寿', romanizedName: "Kyūju" },
- { startingYear: 1156, japaneseName: 'ä¿å
', romanizedName: "HÅgen" },
- { startingYear: 1159, japaneseName: '平治', romanizedName: "Heiji" },
- { startingYear: 1160, japaneseName: 'æ°žæŠ', romanizedName: "Eiryaku" },
- { startingYear: 1161, japaneseName: 'å¿ä¿', romanizedName: "ÅhÅ" },
- { startingYear: 1163, japaneseName: 'é·å¯', romanizedName: "ChÅkan" },
- { startingYear: 1165, japaneseName: 'æ°žäž', romanizedName: "Eiman" },
- { startingYear: 1166, japaneseName: 'ä»å®', romanizedName: "Ninnan" },
- { startingYear: 1169, japaneseName: 'åå¿', romanizedName: "KaÅ" },
- { startingYear: 1171, japaneseName: 'æ¿å®', romanizedName: "JÅan" },
- { startingYear: 1175, japaneseName: 'å®å
', romanizedName: "Angen" },
- { startingYear: 1177, japaneseName: 'æ²»æ¿', romanizedName: "JishÅ" },
- { startingYear: 1181, japaneseName: 'é€å', romanizedName: "YÅwa" },
- { startingYear: 1182, japaneseName: '寿氞', romanizedName: "Juei" },
- { startingYear: 1184, japaneseName: 'å
æŠ', romanizedName: "Genryaku" },
- { startingYear: 1185, japaneseName: 'ææ²»', romanizedName: "Bunji" },
- { startingYear: 1190, japaneseName: '建ä¹
', romanizedName: "Kenkyū" },
- { startingYear: 1199, japaneseName: 'æ£æ²»', romanizedName: "ShÅji" },
- { startingYear: 1201, japaneseName: '建ä»', romanizedName: "Kennin" },
- { startingYear: 1204, japaneseName: 'å
ä¹
', romanizedName: "Genkyū" },
- { startingYear: 1206, japaneseName: '建氞', romanizedName: "Ken'ei" },
- { startingYear: 1207, japaneseName: 'æ¿å
', romanizedName: "JÅgen" },
- { startingYear: 1211, japaneseName: '建æŠ', romanizedName: "Kenryaku" },
- { startingYear: 1213, japaneseName: '建ä¿', romanizedName: "KenpÅ" },
- { startingYear: 1219, japaneseName: 'æ¿ä¹
', romanizedName: "JÅkyÅ«" },
- { startingYear: 1222, japaneseName: 'è²å¿', romanizedName: "JÅÅ" },
- { startingYear: 1224, japaneseName: 'å
ä»', romanizedName: "Gennin" },
- { startingYear: 1225, japaneseName: 'åçŠ', romanizedName: "Karoku" },
- { startingYear: 1227, japaneseName: 'å®è²', romanizedName: "Antei" },
- { startingYear: 1229, japaneseName: 'å¯å', romanizedName: "Kanki" },
- { startingYear: 1232, japaneseName: 'è²æ°ž', romanizedName: "JÅei" },
- { startingYear: 1233, japaneseName: '倩çŠ', romanizedName: "Tenpuku" },
- { startingYear: 1234, japaneseName: 'ææŠ', romanizedName: "Bunryaku" },
- { startingYear: 1235, japaneseName: 'åçŠ', romanizedName: "Katei" },
- { startingYear: 1238, japaneseName: 'æŠä»', romanizedName: "Ryakunin" },
- { startingYear: 1239, japaneseName: 'å»¶å¿', romanizedName: "En'Å" },
- { startingYear: 1240, japaneseName: '仿²»', romanizedName: "Ninji" },
- { startingYear: 1243, japaneseName: 'å¯å
', romanizedName: "Kangen" },
- { startingYear: 1247, japaneseName: '宿²»', romanizedName: "HÅji" },
- { startingYear: 1249, japaneseName: '建é·', romanizedName: "KenchÅ" },
- { startingYear: 1256, japaneseName: '康å
', romanizedName: "KÅgen" },
- { startingYear: 1257, japaneseName: 'æ£å', romanizedName: "ShÅka" },
- { startingYear: 1259, japaneseName: 'æ£å
', romanizedName: "ShÅgen" },
- { startingYear: 1260, japaneseName: 'æå¿', romanizedName: "Bun'Å" },
- { startingYear: 1261, japaneseName: 'åŒé·', romanizedName: "KÅcho" },
- { startingYear: 1264, japaneseName: 'ææ°ž', romanizedName: "Bun'ei" },
- { startingYear: 1275, japaneseName: '建治', romanizedName: "Kenji" },
- { startingYear: 1278, japaneseName: 'åŒå®', romanizedName: "KÅan" },
- { startingYear: 1288, japaneseName: 'æ£å¿', romanizedName: "ShÅÅ" },
- { startingYear: 1293, japaneseName: 'æ°žä»', romanizedName: "Einin" },
- { startingYear: 1299, japaneseName: 'æ£å®', romanizedName: "ShÅan" },
- { startingYear: 1302, japaneseName: '也å
', romanizedName: "Kengen" },
- { startingYear: 1303, japaneseName: 'åå
', romanizedName: "Kagen" },
- { startingYear: 1306, japaneseName: '埳治', romanizedName: "Tokuji" },
- { startingYear: 1308, japaneseName: 'å»¶æ
¶', romanizedName: "Enkei" },
- { startingYear: 1311, japaneseName: 'å¿é·', romanizedName: "ÅchÅ" },
- { startingYear: 1312, japaneseName: 'æ£å', romanizedName: "ShÅwa" },
- { startingYear: 1317, japaneseName: 'æä¿', romanizedName: "BunpÅ" },
- { startingYear: 1319, japaneseName: 'å
å¿', romanizedName: "Gen'Å" },
- { startingYear: 1321, japaneseName: 'å
亚', romanizedName: "GenkyÅ" },
- { startingYear: 1324, japaneseName: 'æ£äž', romanizedName: "ShÅchÅ«" },
- { startingYear: 1326, japaneseName: 'åæŠ', romanizedName: "Karyaku" },
- { startingYear: 1329, japaneseName: 'å
埳', romanizedName: "Gentoku" },
- { startingYear: 1331, japaneseName: 'å
åŒ', romanizedName: "GenkÅ" },
- { startingYear: 1334, japaneseName: '建æŠ', romanizedName: "Kenmu" },
- { startingYear: 1336, japaneseName: 'å»¶å
', romanizedName: "Engen" },
- { startingYear: 1340, japaneseName: 'èåœ', romanizedName: "KÅkoku" },
- { startingYear: 1346, japaneseName: 'æ£å¹³', romanizedName: "ShÅhei" },
- { startingYear: 1370, japaneseName: '建埳', romanizedName: "Kentoku" },
- { startingYear: 1372, japaneseName: 'æäž', romanizedName: "BunchÅ«" },
- { startingYear: 1375, japaneseName: '倩æ', romanizedName: "Tenju" },
- { startingYear: 1381, japaneseName: 'åŒå', romanizedName: "KÅwa" },
- { startingYear: 1384, japaneseName: 'å
äž', romanizedName: "GenchÅ«" },
- { startingYear: 1332, japaneseName: 'æ£æ
¶', romanizedName: "ShÅkei" },
- { startingYear: 1338, japaneseName: 'æŠå¿', romanizedName: "RyakuÅ" },
- { startingYear: 1342, japaneseName: '康氞', romanizedName: "KÅei" },
- { startingYear: 1345, japaneseName: 'è²å', romanizedName: "JÅwa" },
- { startingYear: 1350, japaneseName: '芳å¿', romanizedName: "Kan'Å" },
- { startingYear: 1352, japaneseName: 'æå', romanizedName: "Bunna" },
- { startingYear: 1356, japaneseName: 'å»¶æ', romanizedName: "Enbun" },
- { startingYear: 1361, japaneseName: '康å®', romanizedName: "KÅan" },
- { startingYear: 1362, japaneseName: 'è²æ²»', romanizedName: "JÅji" },
- { startingYear: 1368, japaneseName: 'å¿å®', romanizedName: "Åan" },
- { startingYear: 1375, japaneseName: 'æ°žå', romanizedName: "Eiwa" },
- { startingYear: 1379, japaneseName: '康æŠ', romanizedName: "KÅryaku" },
- { startingYear: 1381, japaneseName: '氞埳', romanizedName: "Eitoku" },
- { startingYear: 1384, japaneseName: 'è³åŸ³', romanizedName: "Shitoku" },
- { startingYear: 1387, japaneseName: 'åæ
¶', romanizedName: "Kakei" },
- { startingYear: 1389, japaneseName: '康å¿', romanizedName: "KÅÅ" },
- { startingYear: 1390, japaneseName: 'æåŸ³', romanizedName: "Meitoku" },
- { startingYear: 1394, japaneseName: 'å¿æ°ž', romanizedName: "Åei" },
- { startingYear: 1428, japaneseName: 'æ£é·', romanizedName: "ShÅchÅ" },
- { startingYear: 1429, japaneseName: '氞享', romanizedName: "EikyÅ" },
- { startingYear: 1441, japaneseName: 'åå', romanizedName: "Kakitsu" },
- { startingYear: 1444, japaneseName: 'æå®', romanizedName: "Bunnan" },
- { startingYear: 1449, japaneseName: 'å®åŸ³', romanizedName: "HÅtoku" },
- { startingYear: 1452, japaneseName: '享埳', romanizedName: "KyÅtoku" },
- { startingYear: 1455, japaneseName: '康æ£', romanizedName: "KÅshÅ" },
- { startingYear: 1457, japaneseName: 'é·çŠ', romanizedName: "ChÅroku" },
- { startingYear: 1460, japaneseName: '坿£', romanizedName: "KanshÅ" },
- { startingYear: 1466, japaneseName: 'ææ£', romanizedName: "BunshÅ" },
- { startingYear: 1467, japaneseName: 'å¿ä»', romanizedName: "Ånin" },
- { startingYear: 1469, japaneseName: 'ææ', romanizedName: "Bunmei" },
- { startingYear: 1487, japaneseName: 'é·äº«', romanizedName: "ChÅkyÅ" },
- { startingYear: 1489, japaneseName: '延埳', romanizedName: "Entoku" },
- { startingYear: 1492, japaneseName: 'æå¿', romanizedName: "MeiÅ" },
- { startingYear: 1501, japaneseName: 'æäº', romanizedName: "Bunki" },
- { startingYear: 1504, japaneseName: 'æ°žæ£', romanizedName: "EishÅ" },
- { startingYear: 1521, japaneseName: '倧氞', romanizedName: "Daiei" },
- { startingYear: 1528, japaneseName: '享çŠ', romanizedName: "KyÅroku" },
- { startingYear: 1532, japaneseName: '倩æ', romanizedName: "Tenbun" },
- { startingYear: 1555, japaneseName: 'åŒæ²»', romanizedName: "KÅji" },
- { startingYear: 1558, japaneseName: 'æ°žçŠ', romanizedName: "Eiroku" },
- { startingYear: 1570, japaneseName: 'å
äº', romanizedName: "Genki" },
- { startingYear: 1573, japaneseName: '倩æ£', romanizedName: "TenshÅ" },
- { startingYear: 1592, japaneseName: 'æçŠ', romanizedName: "Bunroku" },
- { startingYear: 1596, japaneseName: 'æ
¶é·', romanizedName: "KeichÅ" },
- { startingYear: 1615, japaneseName: 'å
å', romanizedName: "Genna" },
- { startingYear: 1624, japaneseName: '坿°ž', romanizedName: "Kan'ei" },
- { startingYear: 1644, japaneseName: 'æ£ä¿', romanizedName: "ShÅhÅ" },
- { startingYear: 1648, japaneseName: 'æ
¶å®', romanizedName: "Keian" },
- { startingYear: 1652, japaneseName: 'æ¿å¿', romanizedName: "JÅÅ" },
- { startingYear: 1655, japaneseName: 'ææŠ', romanizedName: "Meireki" },
- { startingYear: 1658, japaneseName: 'äžæ²»', romanizedName: "Manji" },
- { startingYear: 1661, japaneseName: '坿', romanizedName: "Kanbun" },
- { startingYear: 1673, japaneseName: 'å»¶å®', romanizedName: "EnpÅ" },
- { startingYear: 1681, japaneseName: '倩å', romanizedName: "Tenna" },
- { startingYear: 1684, japaneseName: 'è²äº«', romanizedName: "JÅkyÅ" },
- { startingYear: 1688, japaneseName: 'å
çŠ', romanizedName: "Genroku" },
- { startingYear: 1704, japaneseName: '宿°ž', romanizedName: "HÅei" },
- { startingYear: 1711, japaneseName: 'æ£åŸ³', romanizedName: "ShÅtoku" },
- { startingYear: 1716, japaneseName: '享ä¿', romanizedName: "KyÅhÅ" },
- { startingYear: 1736, japaneseName: 'å
æ', romanizedName: "Genbun" },
- { startingYear: 1741, japaneseName: 'å¯ä¿', romanizedName: "KanpÅ" },
- { startingYear: 1744, japaneseName: '延享', romanizedName: "EnkyÅ" },
- { startingYear: 1748, japaneseName: 'å¯å»¶', romanizedName: "Kan'en" },
- { startingYear: 1751, japaneseName: '宿Š', romanizedName: "HÅreki" },
- { startingYear: 1764, japaneseName: 'æå', romanizedName: "Meiwa" },
- { startingYear: 1772, japaneseName: '宿°ž', romanizedName: "An'ei" },
- { startingYear: 1781, japaneseName: '倩æ', romanizedName: "Tenmei" },
- { startingYear: 1789, japaneseName: '坿¿', romanizedName: "Kansei" },
- { startingYear: 1801, japaneseName: '享å', romanizedName: "KyÅwa" },
- { startingYear: 1804, japaneseName: 'æå', romanizedName: "Bunka" },
- { startingYear: 1818, japaneseName: 'ææ¿', romanizedName: "Bunsei" },
- { startingYear: 1830, japaneseName: '倩ä¿', romanizedName: "TenpÅ" },
- { startingYear: 1844, japaneseName: 'åŒå', romanizedName: "KÅka" },
- { startingYear: 1848, japaneseName: 'åæ°ž', romanizedName: "Kaei" },
- { startingYear: 1854, japaneseName: '宿¿', romanizedName: "Ansei" },
- { startingYear: 1860, japaneseName: 'äžå»¶', romanizedName: "Man'en" },
- { startingYear: 1861, japaneseName: 'æä¹
', romanizedName: "Bunkyū" },
- { startingYear: 1864, japaneseName: 'å
æ²»', romanizedName: "Genji" },
- { startingYear: 1865, japaneseName: 'æ
¶å¿', romanizedName: "KeiÅ" },
- { startingYear: 1868, japaneseName: 'ææ²»', romanizedName: "Meiji" },
- { startingYear: 1912, japaneseName: '倧æ£', romanizedName: "TaishÅ" },
- { startingYear: 1926, japaneseName: 'æå', romanizedName: "ShÅwa" },
- { startingYear: 1989, japaneseName: 'å¹³æ', romanizedName: "Heisei" }
+ { startingYear: 645, japaneseName: '倧å', romanizedName: "Taika" },
+ { startingYear: 650, japaneseName: 'çœé', romanizedName: "Hakuchi" },
+ { startingYear: 686, japaneseName: 'æ±é³¥', romanizedName: "ShuchÅ" },
+ { startingYear: 701, japaneseName: '倧å®', romanizedName: "TaihÅ" },
+ { startingYear: 704, japaneseName: 'æ
¶é²', romanizedName: "Keiun" },
+ { startingYear: 708, japaneseName: 'åé
', romanizedName: "WadÅ" },
+ { startingYear: 715, japaneseName: 'éäº', romanizedName: "Reiki" },
+ { startingYear: 717, japaneseName: 'é€è', romanizedName: "YÅrÅ" },
+ { startingYear: 724, japaneseName: 'ç¥äº', romanizedName: "Jinki" },
+ { startingYear: 729, japaneseName: '倩平', romanizedName: "TenpyÅ" },
+ { startingYear: 749, japaneseName: '倩平æå®', romanizedName: "TenpyÅ-kanpÅ" },
+ { startingYear: 749, japaneseName: '倩平åå®', romanizedName: "TenpyÅ-shÅhÅ" },
+ { startingYear: 757, japaneseName: '倩平å®å', romanizedName: "TenpyÅ-hÅji" },
+ { startingYear: 765, japaneseName: '倩平ç¥è·', romanizedName: "TenpyÅ-jingo" },
+ { startingYear: 767, japaneseName: 'ç¥è·æ¯é²', romanizedName: "Jingo-keiun" },
+ { startingYear: 770, japaneseName: 'å®äº', romanizedName: "HÅki" },
+ { startingYear: 781, japaneseName: '倩å¿', romanizedName: "Ten'Å" },
+ { startingYear: 782, japaneseName: 'å»¶æŠ', romanizedName: "Enryaku" },
+ { startingYear: 806, japaneseName: '倧å', romanizedName: "DaidÅ" },
+ { startingYear: 810, japaneseName: 'åŒä»', romanizedName: "KÅnin" },
+ { startingYear: 824, japaneseName: '倩é·', romanizedName: "TenchÅ" },
+ { startingYear: 834, japaneseName: 'æ¿å', romanizedName: "JÅwa" },
+ { startingYear: 848, japaneseName: 'å祥', romanizedName: "KajÅ" },
+ { startingYear: 851, japaneseName: 'ä»å¯¿', romanizedName: "Ninju" },
+ { startingYear: 854, japaneseName: 'æè¡¡', romanizedName: "SaikÅ" },
+ { startingYear: 857, japaneseName: '倩å®', romanizedName: "Tennan" },
+ { startingYear: 859, japaneseName: 'è²èг', romanizedName: "JÅgan" },
+ { startingYear: 877, japaneseName: 'å
æ
¶', romanizedName: "GangyÅ" },
+ { startingYear: 885, japaneseName: 'ä»å', romanizedName: "Ninna" },
+ { startingYear: 889, japaneseName: 'å¯å¹³', romanizedName: "KanpyÅ" },
+ { startingYear: 898, japaneseName: 'ææ³°', romanizedName: "ShÅtai" },
+ { startingYear: 901, japaneseName: 'å»¶å', romanizedName: "Engi" },
+ { startingYear: 923, japaneseName: 'å»¶é·', romanizedName: "EnchÅ" },
+ { startingYear: 931, japaneseName: 'æ¿å¹³', romanizedName: "JÅhei" },
+ { startingYear: 938, japaneseName: '倩æ
¶', romanizedName: "TengyÅ" },
+ { startingYear: 947, japaneseName: '倩æŠ', romanizedName: "Tenryaku" },
+ { startingYear: 957, japaneseName: '倩埳', romanizedName: "Tentoku" },
+ { startingYear: 961, japaneseName: 'å¿å', romanizedName: "Åwa" },
+ { startingYear: 964, japaneseName: '康ä¿', romanizedName: "KÅhÅ" },
+ { startingYear: 968, japaneseName: 'å®å', romanizedName: "Anna" },
+ { startingYear: 970, japaneseName: '倩çŠ', romanizedName: "Tenroku" },
+ { startingYear: 973, japaneseName: '倩延', romanizedName: "Ten'en" },
+ { startingYear: 976, japaneseName: 'è²å
', romanizedName: "JÅgen" },
+ { startingYear: 978, japaneseName: '倩å
', romanizedName: "Tengen" },
+ { startingYear: 983, japaneseName: '氞芳', romanizedName: "Eikan" },
+ { startingYear: 985, japaneseName: 'å¯å', romanizedName: "Kanna" },
+ { startingYear: 987, japaneseName: 'æ°žå»¶', romanizedName: "Eien" },
+ { startingYear: 988, japaneseName: 'æ°žç¥', romanizedName: "Eiso" },
+ { startingYear: 990, japaneseName: 'æ£æŠ', romanizedName: "ShÅryaku" },
+ { startingYear: 995, japaneseName: 'é·åŸ³', romanizedName: "ChÅtoku" },
+ { startingYear: 999, japaneseName: 'é·ä¿', romanizedName: "ChÅhÅ" },
+ { startingYear: 1004, japaneseName: 'å¯åŒ', romanizedName: "KankÅ" },
+ { startingYear: 1012, japaneseName: 'é·å', romanizedName: "ChÅwa" },
+ { startingYear: 1017, japaneseName: 'å¯ä»', romanizedName: "Kannin" },
+ { startingYear: 1021, japaneseName: 'æ²»å®', romanizedName: "Jian" },
+ { startingYear: 1024, japaneseName: 'äžå¯¿', romanizedName: "Manju" },
+ { startingYear: 1028, japaneseName: 'é·å
', romanizedName: "ChÅgen" },
+ { startingYear: 1037, japaneseName: 'é·æŠ', romanizedName: "ChÅryaku" },
+ { startingYear: 1040, japaneseName: 'é·ä¹
', romanizedName: "ChÅkyÅ«" },
+ { startingYear: 1044, japaneseName: 'å¯åŸ³', romanizedName: "Kantoku" },
+ { startingYear: 1046, japaneseName: 'æ°žæ¿', romanizedName: "EishÅ" },
+ { startingYear: 1053, japaneseName: '倩å', romanizedName: "Tengi" },
+ { startingYear: 1058, japaneseName: '康平', romanizedName: "KÅhei" },
+ { startingYear: 1065, japaneseName: 'æ²»æŠ', romanizedName: "Jiryaku" },
+ { startingYear: 1069, japaneseName: 'å»¶ä¹
', romanizedName: "Enkyū" },
+ { startingYear: 1074, japaneseName: 'æ¿ä¿', romanizedName: "JÅhÅ" },
+ { startingYear: 1077, japaneseName: 'æ¿æŠ', romanizedName: "JÅryaku" },
+ { startingYear: 1081, japaneseName: 'æ°žä¿', romanizedName: "EihÅ" },
+ { startingYear: 1084, japaneseName: 'å¿åŸ³', romanizedName: "Åtoku" },
+ { startingYear: 1087, japaneseName: '坿²»', romanizedName: "Kanji" },
+ { startingYear: 1094, japaneseName: 'åä¿', romanizedName: "KahÅ" },
+ { startingYear: 1096, japaneseName: 'æ°žé·', romanizedName: "EichÅ" },
+ { startingYear: 1097, japaneseName: 'æ¿åŸ³', romanizedName: "JÅtoku" },
+ { startingYear: 1099, japaneseName: '康å', romanizedName: "KÅwa" },
+ { startingYear: 1104, japaneseName: 'é·æ²»', romanizedName: "ChÅji" },
+ { startingYear: 1106, japaneseName: 'åæ¿', romanizedName: "KajÅ" },
+ { startingYear: 1108, japaneseName: '倩ä»', romanizedName: "Tennin" },
+ { startingYear: 1110, japaneseName: '倩氞', romanizedName: "Ten'ei" },
+ { startingYear: 1113, japaneseName: 'æ°žä¹
', romanizedName: "Eikyū" },
+ { startingYear: 1118, japaneseName: 'å
æ°ž', romanizedName: "Gen'ei" },
+ { startingYear: 1120, japaneseName: 'ä¿å®', romanizedName: "HÅan" },
+ { startingYear: 1124, japaneseName: '倩治', romanizedName: "Tenji" },
+ { startingYear: 1126, japaneseName: '倧治', romanizedName: "Daiji" },
+ { startingYear: 1131, japaneseName: '倩æ¿', romanizedName: "TenshÅ" },
+ { startingYear: 1132, japaneseName: 'é·æ¿', romanizedName: "ChÅshÅ" },
+ { startingYear: 1135, japaneseName: 'ä¿å»¶', romanizedName: "HÅen" },
+ { startingYear: 1141, japaneseName: 'æ°žæ²»', romanizedName: "Eiji" },
+ { startingYear: 1142, japaneseName: '康治', romanizedName: "KÅji" },
+ { startingYear: 1144, japaneseName: '倩é€', romanizedName: "Ten'yÅ" },
+ { startingYear: 1145, japaneseName: 'ä¹
å®', romanizedName: "KyÅ«an" },
+ { startingYear: 1151, japaneseName: 'ä»å¹³', romanizedName: "Ninpei" },
+ { startingYear: 1154, japaneseName: 'ä¹
寿', romanizedName: "Kyūju" },
+ { startingYear: 1156, japaneseName: 'ä¿å
', romanizedName: "HÅgen" },
+ { startingYear: 1159, japaneseName: '平治', romanizedName: "Heiji" },
+ { startingYear: 1160, japaneseName: 'æ°žæŠ', romanizedName: "Eiryaku" },
+ { startingYear: 1161, japaneseName: 'å¿ä¿', romanizedName: "ÅhÅ" },
+ { startingYear: 1163, japaneseName: 'é·å¯', romanizedName: "ChÅkan" },
+ { startingYear: 1165, japaneseName: 'æ°žäž', romanizedName: "Eiman" },
+ { startingYear: 1166, japaneseName: 'ä»å®', romanizedName: "Ninnan" },
+ { startingYear: 1169, japaneseName: 'åå¿', romanizedName: "KaÅ" },
+ { startingYear: 1171, japaneseName: 'æ¿å®', romanizedName: "JÅan" },
+ { startingYear: 1175, japaneseName: 'å®å
', romanizedName: "Angen" },
+ { startingYear: 1177, japaneseName: 'æ²»æ¿', romanizedName: "JishÅ" },
+ { startingYear: 1181, japaneseName: 'é€å', romanizedName: "YÅwa" },
+ { startingYear: 1182, japaneseName: '寿氞', romanizedName: "Juei" },
+ { startingYear: 1184, japaneseName: 'å
æŠ', romanizedName: "Genryaku" },
+ { startingYear: 1185, japaneseName: 'ææ²»', romanizedName: "Bunji" },
+ { startingYear: 1190, japaneseName: '建ä¹
', romanizedName: "Kenkyū" },
+ { startingYear: 1199, japaneseName: 'æ£æ²»', romanizedName: "ShÅji" },
+ { startingYear: 1201, japaneseName: '建ä»', romanizedName: "Kennin" },
+ { startingYear: 1204, japaneseName: 'å
ä¹
', romanizedName: "Genkyū" },
+ { startingYear: 1206, japaneseName: '建氞', romanizedName: "Ken'ei" },
+ { startingYear: 1207, japaneseName: 'æ¿å
', romanizedName: "JÅgen" },
+ { startingYear: 1211, japaneseName: '建æŠ', romanizedName: "Kenryaku" },
+ { startingYear: 1213, japaneseName: '建ä¿', romanizedName: "KenpÅ" },
+ { startingYear: 1219, japaneseName: 'æ¿ä¹
', romanizedName: "JÅkyÅ«" },
+ { startingYear: 1222, japaneseName: 'è²å¿', romanizedName: "JÅÅ" },
+ { startingYear: 1224, japaneseName: 'å
ä»', romanizedName: "Gennin" },
+ { startingYear: 1225, japaneseName: 'åçŠ', romanizedName: "Karoku" },
+ { startingYear: 1227, japaneseName: 'å®è²', romanizedName: "Antei" },
+ { startingYear: 1229, japaneseName: 'å¯å', romanizedName: "Kanki" },
+ { startingYear: 1232, japaneseName: 'è²æ°ž', romanizedName: "JÅei" },
+ { startingYear: 1233, japaneseName: '倩çŠ', romanizedName: "Tenpuku" },
+ { startingYear: 1234, japaneseName: 'ææŠ', romanizedName: "Bunryaku" },
+ { startingYear: 1235, japaneseName: 'åçŠ', romanizedName: "Katei" },
+ { startingYear: 1238, japaneseName: 'æŠä»', romanizedName: "Ryakunin" },
+ { startingYear: 1239, japaneseName: 'å»¶å¿', romanizedName: "En'Å" },
+ { startingYear: 1240, japaneseName: '仿²»', romanizedName: "Ninji" },
+ { startingYear: 1243, japaneseName: 'å¯å
', romanizedName: "Kangen" },
+ { startingYear: 1247, japaneseName: '宿²»', romanizedName: "HÅji" },
+ { startingYear: 1249, japaneseName: '建é·', romanizedName: "KenchÅ" },
+ { startingYear: 1256, japaneseName: '康å
', romanizedName: "KÅgen" },
+ { startingYear: 1257, japaneseName: 'æ£å', romanizedName: "ShÅka" },
+ { startingYear: 1259, japaneseName: 'æ£å
', romanizedName: "ShÅgen" },
+ { startingYear: 1260, japaneseName: 'æå¿', romanizedName: "Bun'Å" },
+ { startingYear: 1261, japaneseName: 'åŒé·', romanizedName: "KÅcho" },
+ { startingYear: 1264, japaneseName: 'ææ°ž', romanizedName: "Bun'ei" },
+ { startingYear: 1275, japaneseName: '建治', romanizedName: "Kenji" },
+ { startingYear: 1278, japaneseName: 'åŒå®', romanizedName: "KÅan" },
+ { startingYear: 1288, japaneseName: 'æ£å¿', romanizedName: "ShÅÅ" },
+ { startingYear: 1293, japaneseName: 'æ°žä»', romanizedName: "Einin" },
+ { startingYear: 1299, japaneseName: 'æ£å®', romanizedName: "ShÅan" },
+ { startingYear: 1302, japaneseName: '也å
', romanizedName: "Kengen" },
+ { startingYear: 1303, japaneseName: 'åå
', romanizedName: "Kagen" },
+ { startingYear: 1306, japaneseName: '埳治', romanizedName: "Tokuji" },
+ { startingYear: 1308, japaneseName: 'å»¶æ
¶', romanizedName: "Enkei" },
+ { startingYear: 1311, japaneseName: 'å¿é·', romanizedName: "ÅchÅ" },
+ { startingYear: 1312, japaneseName: 'æ£å', romanizedName: "ShÅwa" },
+ { startingYear: 1317, japaneseName: 'æä¿', romanizedName: "BunpÅ" },
+ { startingYear: 1319, japaneseName: 'å
å¿', romanizedName: "Gen'Å" },
+ { startingYear: 1321, japaneseName: 'å
亚', romanizedName: "GenkyÅ" },
+ { startingYear: 1324, japaneseName: 'æ£äž', romanizedName: "ShÅchÅ«" },
+ { startingYear: 1326, japaneseName: 'åæŠ', romanizedName: "Karyaku" },
+ { startingYear: 1329, japaneseName: 'å
埳', romanizedName: "Gentoku" },
+ { startingYear: 1331, japaneseName: 'å
åŒ', romanizedName: "GenkÅ" },
+ { startingYear: 1334, japaneseName: '建æŠ', romanizedName: "Kenmu" },
+ { startingYear: 1336, japaneseName: 'å»¶å
', romanizedName: "Engen" },
+ { startingYear: 1340, japaneseName: 'èåœ', romanizedName: "KÅkoku" },
+ { startingYear: 1346, japaneseName: 'æ£å¹³', romanizedName: "ShÅhei" },
+ { startingYear: 1370, japaneseName: '建埳', romanizedName: "Kentoku" },
+ { startingYear: 1372, japaneseName: 'æäž', romanizedName: "BunchÅ«" },
+ { startingYear: 1375, japaneseName: '倩æ', romanizedName: "Tenju" },
+ { startingYear: 1381, japaneseName: 'åŒå', romanizedName: "KÅwa" },
+ { startingYear: 1384, japaneseName: 'å
äž', romanizedName: "GenchÅ«" },
+ { startingYear: 1332, japaneseName: 'æ£æ
¶', romanizedName: "ShÅkei" },
+ { startingYear: 1338, japaneseName: 'æŠå¿', romanizedName: "RyakuÅ" },
+ { startingYear: 1342, japaneseName: '康氞', romanizedName: "KÅei" },
+ { startingYear: 1345, japaneseName: 'è²å', romanizedName: "JÅwa" },
+ { startingYear: 1350, japaneseName: '芳å¿', romanizedName: "Kan'Å" },
+ { startingYear: 1352, japaneseName: 'æå', romanizedName: "Bunna" },
+ { startingYear: 1356, japaneseName: 'å»¶æ', romanizedName: "Enbun" },
+ { startingYear: 1361, japaneseName: '康å®', romanizedName: "KÅan" },
+ { startingYear: 1362, japaneseName: 'è²æ²»', romanizedName: "JÅji" },
+ { startingYear: 1368, japaneseName: 'å¿å®', romanizedName: "Åan" },
+ { startingYear: 1375, japaneseName: 'æ°žå', romanizedName: "Eiwa" },
+ { startingYear: 1379, japaneseName: '康æŠ', romanizedName: "KÅryaku" },
+ { startingYear: 1381, japaneseName: '氞埳', romanizedName: "Eitoku" },
+ { startingYear: 1384, japaneseName: 'è³åŸ³', romanizedName: "Shitoku" },
+ { startingYear: 1387, japaneseName: 'åæ
¶', romanizedName: "Kakei" },
+ { startingYear: 1389, japaneseName: '康å¿', romanizedName: "KÅÅ" },
+ { startingYear: 1390, japaneseName: 'æåŸ³', romanizedName: "Meitoku" },
+ { startingYear: 1394, japaneseName: 'å¿æ°ž', romanizedName: "Åei" },
+ { startingYear: 1428, japaneseName: 'æ£é·', romanizedName: "ShÅchÅ" },
+ { startingYear: 1429, japaneseName: '氞享', romanizedName: "EikyÅ" },
+ { startingYear: 1441, japaneseName: 'åå', romanizedName: "Kakitsu" },
+ { startingYear: 1444, japaneseName: 'æå®', romanizedName: "Bunnan" },
+ { startingYear: 1449, japaneseName: 'å®åŸ³', romanizedName: "HÅtoku" },
+ { startingYear: 1452, japaneseName: '享埳', romanizedName: "KyÅtoku" },
+ { startingYear: 1455, japaneseName: '康æ£', romanizedName: "KÅshÅ" },
+ { startingYear: 1457, japaneseName: 'é·çŠ', romanizedName: "ChÅroku" },
+ { startingYear: 1460, japaneseName: '坿£', romanizedName: "KanshÅ" },
+ { startingYear: 1466, japaneseName: 'ææ£', romanizedName: "BunshÅ" },
+ { startingYear: 1467, japaneseName: 'å¿ä»', romanizedName: "Ånin" },
+ { startingYear: 1469, japaneseName: 'ææ', romanizedName: "Bunmei" },
+ { startingYear: 1487, japaneseName: 'é·äº«', romanizedName: "ChÅkyÅ" },
+ { startingYear: 1489, japaneseName: '延埳', romanizedName: "Entoku" },
+ { startingYear: 1492, japaneseName: 'æå¿', romanizedName: "MeiÅ" },
+ { startingYear: 1501, japaneseName: 'æäº', romanizedName: "Bunki" },
+ { startingYear: 1504, japaneseName: 'æ°žæ£', romanizedName: "EishÅ" },
+ { startingYear: 1521, japaneseName: '倧氞', romanizedName: "Daiei" },
+ { startingYear: 1528, japaneseName: '享çŠ', romanizedName: "KyÅroku" },
+ { startingYear: 1532, japaneseName: '倩æ', romanizedName: "Tenbun" },
+ { startingYear: 1555, japaneseName: 'åŒæ²»', romanizedName: "KÅji" },
+ { startingYear: 1558, japaneseName: 'æ°žçŠ', romanizedName: "Eiroku" },
+ { startingYear: 1570, japaneseName: 'å
äº', romanizedName: "Genki" },
+ { startingYear: 1573, japaneseName: '倩æ£', romanizedName: "TenshÅ" },
+ { startingYear: 1592, japaneseName: 'æçŠ', romanizedName: "Bunroku" },
+ { startingYear: 1596, japaneseName: 'æ
¶é·', romanizedName: "KeichÅ" },
+ { startingYear: 1615, japaneseName: 'å
å', romanizedName: "Genna" },
+ { startingYear: 1624, japaneseName: '坿°ž', romanizedName: "Kan'ei" },
+ { startingYear: 1644, japaneseName: 'æ£ä¿', romanizedName: "ShÅhÅ" },
+ { startingYear: 1648, japaneseName: 'æ
¶å®', romanizedName: "Keian" },
+ { startingYear: 1652, japaneseName: 'æ¿å¿', romanizedName: "JÅÅ" },
+ { startingYear: 1655, japaneseName: 'ææŠ', romanizedName: "Meireki" },
+ { startingYear: 1658, japaneseName: 'äžæ²»', romanizedName: "Manji" },
+ { startingYear: 1661, japaneseName: '坿', romanizedName: "Kanbun" },
+ { startingYear: 1673, japaneseName: 'å»¶å®', romanizedName: "EnpÅ" },
+ { startingYear: 1681, japaneseName: '倩å', romanizedName: "Tenna" },
+ { startingYear: 1684, japaneseName: 'è²äº«', romanizedName: "JÅkyÅ" },
+ { startingYear: 1688, japaneseName: 'å
çŠ', romanizedName: "Genroku" },
+ { startingYear: 1704, japaneseName: '宿°ž', romanizedName: "HÅei" },
+ { startingYear: 1711, japaneseName: 'æ£åŸ³', romanizedName: "ShÅtoku" },
+ { startingYear: 1716, japaneseName: '享ä¿', romanizedName: "KyÅhÅ" },
+ { startingYear: 1736, japaneseName: 'å
æ', romanizedName: "Genbun" },
+ { startingYear: 1741, japaneseName: 'å¯ä¿', romanizedName: "KanpÅ" },
+ { startingYear: 1744, japaneseName: '延享', romanizedName: "EnkyÅ" },
+ { startingYear: 1748, japaneseName: 'å¯å»¶', romanizedName: "Kan'en" },
+ { startingYear: 1751, japaneseName: '宿Š', romanizedName: "HÅreki" },
+ { startingYear: 1764, japaneseName: 'æå', romanizedName: "Meiwa" },
+ { startingYear: 1772, japaneseName: '宿°ž', romanizedName: "An'ei" },
+ { startingYear: 1781, japaneseName: '倩æ', romanizedName: "Tenmei" },
+ { startingYear: 1789, japaneseName: '坿¿', romanizedName: "Kansei" },
+ { startingYear: 1801, japaneseName: '享å', romanizedName: "KyÅwa" },
+ { startingYear: 1804, japaneseName: 'æå', romanizedName: "Bunka" },
+ { startingYear: 1818, japaneseName: 'ææ¿', romanizedName: "Bunsei" },
+ { startingYear: 1830, japaneseName: '倩ä¿', romanizedName: "TenpÅ" },
+ { startingYear: 1844, japaneseName: 'åŒå', romanizedName: "KÅka" },
+ { startingYear: 1848, japaneseName: 'åæ°ž', romanizedName: "Kaei" },
+ { startingYear: 1854, japaneseName: '宿¿', romanizedName: "Ansei" },
+ { startingYear: 1860, japaneseName: 'äžå»¶', romanizedName: "Man'en" },
+ { startingYear: 1861, japaneseName: 'æä¹
', romanizedName: "Bunkyū" },
+ { startingYear: 1864, japaneseName: 'å
æ²»', romanizedName: "Genji" },
+ { startingYear: 1865, japaneseName: 'æ
¶å¿', romanizedName: "KeiÅ" },
+ { startingYear: 1868, japaneseName: 'ææ²»', romanizedName: "Meiji" },
+ { startingYear: 1912, japaneseName: '倧æ£', romanizedName: "TaishÅ" },
+ { startingYear: 1926, japaneseName: 'æå', romanizedName: "ShÅwa" },
+ { startingYear: 1989, japaneseName: 'å¹³æ', romanizedName: "Heisei" }
]
);
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/cs/labellers.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/cs/labellers.js
index 954c7a8..caef889 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/cs/labellers.js
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/cs/labellers.js
@@ -1,30 +1,30 @@
-/*==================================================
- * Localization of labellers.js
- *==================================================
- */
-
-Timeline.GregorianDateLabeller.monthNames["cs"] = [
- "Leden", "Únor", "Bøezen", "Duben", "Kvìten", "Èerven", "Èervenec", "Srpen", "Záøí", "Øíjen", "Listopad", "Prosinec"
-];
-
-Timeline.GregorianDateLabeller.dayNames["cs"] = [
- "Ne", "Po", "Út", "St", "Èt", "Pá", "So"
-];
-
-Timeline.GregorianDateLabeller.labelIntervalFunctions["cs"] = function(date, intervalUnit) {
- var text;
- var emphasized = false;
-
- var date2 = Timeline.DateTime.removeTimeZoneOffset(date, this._timeZone);
-
- switch(intervalUnit) {
- case Timeline.DateTime.DAY:
- case Timeline.DateTime.WEEK:
- text = date2.getUTCDate() + ". " + (date2.getUTCMonth() + 1) + ".";
- break;
- default:
- return this.defaultLabelInterval(date, intervalUnit);
- }
-
- return { text: text, emphasized: emphasized };
-};
+/*==================================================
+ * Localization of labellers.js
+ *==================================================
+ */
+
+Timeline.GregorianDateLabeller.monthNames["cs"] = [
+ "Leden", "Únor", "Bøezen", "Duben", "Kvìten", "Èerven", "Èervenec", "Srpen", "Záøí", "Øíjen", "Listopad", "Prosinec"
+];
+
+Timeline.GregorianDateLabeller.dayNames["cs"] = [
+ "Ne", "Po", "Út", "St", "Èt", "Pá", "So"
+];
+
+Timeline.GregorianDateLabeller.labelIntervalFunctions["cs"] = function(date, intervalUnit) {
+ var text;
+ var emphasized = false;
+
+ var date2 = Timeline.DateTime.removeTimeZoneOffset(date, this._timeZone);
+
+ switch(intervalUnit) {
+ case Timeline.DateTime.DAY:
+ case Timeline.DateTime.WEEK:
+ text = date2.getUTCDate() + ". " + (date2.getUTCMonth() + 1) + ".";
+ break;
+ default:
+ return this.defaultLabelInterval(date, intervalUnit);
+ }
+
+ return { text: text, emphasized: emphasized };
+};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/cs/timeline.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/cs/timeline.js
index d823a51..21d41a4 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/cs/timeline.js
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/cs/timeline.js
@@ -1,9 +1,9 @@
-/*==================================================
- * Common localization strings
- *==================================================
- */
-
-Timeline.strings["cs"] = {
- wikiLinkLabel: "Diskuze"
-};
-
+/*==================================================
+ * Common localization strings
+ *==================================================
+ */
+
+Timeline.strings["cs"] = {
+ wikiLinkLabel: "Diskuze"
+};
+
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/se/labellers.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/se/labellers.js
index 378cda1..f4ec6ae 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/se/labellers.js
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/se/labellers.js
@@ -3,10 +3,10 @@
*==================================================
*/
-Timeline.GregorianDateLabeller.monthNames["se"] = [
- "Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec"
+Timeline.GregorianDateLabeller.monthNames["se"] = [
+ "Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec"
];
-Timeline.GregorianDateLabeller.dayNames["se"] = [
- "Sön", "Mån", "Tis", "Ons", "Tors", "Fre", "Lör"
+Timeline.GregorianDateLabeller.dayNames["se"] = [
+ "Sön", "Mån", "Tis", "Ons", "Tors", "Fre", "Lör"
];
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/units.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/units.js
index 15ea379..00a3ff1 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/units.js
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/units.js
@@ -1,14 +1,14 @@
-/*==================================================
- * Default Unit
- *==================================================
- */
-
+/*==================================================
+ * Default Unit
+ *==================================================
+ */
+
Timeline.NativeDateUnit = new Object();
Timeline.NativeDateUnit.createLabeller = function(locale, timeZone) {
return new Timeline.GregorianDateLabeller(locale, timeZone);
};
-
+
Timeline.NativeDateUnit.makeDefaultValue = function() {
return new Date();
};
@@ -21,15 +21,15 @@ Timeline.NativeDateUnit.getParser = function(format) {
if (typeof format == "string") {
format = format.toLowerCase();
}
- return (format == "iso8601" || format == "iso 8601") ?
- Timeline.DateTime.parseIso8601DateTime :
- Timeline.DateTime.parseGregorianDateTime;
+ return (format == "iso8601" || format == "iso 8601") ?
+ Timeline.DateTime.parseIso8601DateTime :
+ Timeline.DateTime.parseGregorianDateTime;
};
Timeline.NativeDateUnit.parseFromObject = function(o) {
return Timeline.DateTime.parseGregorianDateTime(o);
};
-
+
Timeline.NativeDateUnit.toNumber = function(v) {
return v.getTime();
};
commit 2efa840ab69ef5086de27f7367c99392b7dc5ce4
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Mar 16 11:05:37 2010 +0100
Add more properties and fix display when !=1 alert selected.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
index 0e4bf28..850915a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
@@ -26,10 +26,12 @@ import com.smartgwt.client.core.DataClass;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.data.Record;
import com.smartgwt.client.data.SortSpecifier;
+import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.SortDirection;
import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.form.DynamicForm;
-import com.smartgwt.client.widgets.form.fields.TextItem;
+import com.smartgwt.client.widgets.form.fields.FormItem;
+import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
@@ -37,7 +39,6 @@ import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionEvent;
import com.smartgwt.client.widgets.layout.VLayout;
-import org.rhq.core.domain.alert.notification.AlertNotificationLog;
import org.rhq.core.domain.criteria.AlertCriteria;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
@@ -112,19 +113,19 @@ public class AlertsView extends VLayout {
String name = record.getAttribute("name");
String id = record.getAttribute("id");
// TODO: Finish this.
- contents = "Details for alert '" + name + "' with id " + id ;
- detailsTable = getDetailsTableForAlertId(id);
+ detailsTable = getDetailsTableForAlert(record);
vpanel.clear();
+ vpanel.setWidth(getWidthAsString());
vpanel.add(detailsTable);
- vpanel.add(getNotificationsForAlertId(record.getAttributeAsRecordArray("notificationLogs")));
-// vpanel.redraw();
+ Table notifTable = getNotificationsForAlert(record.getAttributeAsRecordArray("notificationLogs"));
+ notifTable.setWidth(getWidth());
+ vpanel.add(notifTable);
} else {
- contents = "Select a single alert above to display its details here.";
- detailsTable = new DynamicForm(); // empty ?
+ vpanel.clear();
+ vpanel.add(getNoAlertSelectedMessage());
}
- AlertsView.this.detailsContent.setContents(contents);
}
});
@@ -132,39 +133,69 @@ public class AlertsView extends VLayout {
// Add the details panel as the bottom half of the view.
vpanel = new VerticalPanel();
+ vpanel.setWidth("100%");
vpanel.setHeight("50%");
- vpanel.setTitle("Details for alert");
- this.detailsContent = new HTMLFlow("Select a single alert above to display its details here.");
- this.detailsContent.setWidth100();
- vpanel.add(detailsContent);
+ vpanel.add(getNoAlertSelectedMessage());
- detailsTable = new DynamicForm(); // empty?
- vpanel.add(detailsTable);
+// detailsTable = new DynamicForm(); // empty?
+// vpanel.add(detailsTable);
addMember(vpanel);
}
- private DynamicForm getDetailsTableForAlertId(String id) {
+ private HTMLFlow getNoAlertSelectedMessage() {
+ HTMLFlow f = new HTMLFlow("<h2>Select a single alert above to display its details here.</h2>");
+ f.setWidth100();
+ return f;
+ }
+
+ private DynamicForm getDetailsTableForAlert(Record record) {
DynamicForm form = new DynamicForm();
form.setNumCols(4);
+ form.setWidth("60%");
form.setWrapItemTitles(false);
- form.setLeft("10%");
- form.setWidth("80%");
+ form.setAlign(Alignment.LEFT);
+
+ List<FormItem> items = new ArrayList<FormItem>();
+
+ StaticTextItem nameTextItem = new StaticTextItem("name", "Name");
+ nameTextItem.setValue(record.getAttribute("name"));
+ nameTextItem.setTooltip("Id = " + record.getAttribute("id"));
+ items.add(nameTextItem);
+
+ StaticTextItem descriptionTextItem = new StaticTextItem("description", "Description");
+ descriptionTextItem.setValue(record.getAttribute("description"));
+ items.add(descriptionTextItem);
+
+ StaticTextItem prioTextItem = new StaticTextItem("priority","Priority");
+ prioTextItem.setValue(record.getAttribute("priority"));
+ items.add(prioTextItem);
+
+ StaticTextItem createdTextItem = new StaticTextItem("ctime","Created at");
+ createdTextItem.setValue(record.getAttribute("ctime"));
+ items.add(createdTextItem);
+
+ StaticTextItem ackByItem = new StaticTextItem("ack_by","Acknowledged by");
+ if (record.getAttribute("ack_by")!=null) {
+ ackByItem.setValue(record.getAttribute("ack_by"));
+ }
+ items.add(ackByItem);
+
+ StaticTextItem ackTimeItem = new StaticTextItem("ack_time","Acknowledged at");
+ if (record.getAttribute("ack_time")!=null) {
+ ackTimeItem.setValue(record.getAttribute("ack_time"));
+ }
+ items.add(ackTimeItem);
+
- final TextItem nameTextItem = new TextItem("name", "Name");
- nameTextItem.setRequired(true);
- nameTextItem.setValue("Hello World");
- final TextItem idTextItem = new TextItem("id", "Id");
- idTextItem.setRequired(true);
- idTextItem.setValue(id);
- form.setItems(nameTextItem,idTextItem);
+ form.setItems(items.toArray(new FormItem[items.size()]));
return form;
}
- private Table getNotificationsForAlertId(DataClass[] input) {
+ private Table getNotificationsForAlert(DataClass[] input) {
Table notifTable = new Table("Notifications",false);
notifTable.setWidth100();
@@ -175,9 +206,9 @@ public class AlertsView extends VLayout {
ListGridField sender = new ListGridField(SENDER,"Sender");
sender.setWidth("10%");
ListGridField status = new ListGridField("status","Result");
- status.setWidth("10%");
+ status.setWidth("8%");
ListGridField message = new ListGridField("message","Message");
- message.setWidth("30%");
+ message.setWidth("32%");
ListGridField allEmails = new ListGridField("allEmails","All Emails");
allEmails.setWidth("25%");
ListGridField badEmails = new ListGridField("badEmails","Bad Emails");
commit e537c05fc7bc3ff1480f884b5f2228e85ffacd68
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Mon Mar 15 15:25:41 2010 -0400
Live charting... yea i know... couldn't help it
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/GraphListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/GraphListView.java
index e193716..4cfc2da 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/GraphListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/GraphListView.java
@@ -127,7 +127,7 @@ public class GraphListView extends VLayout implements ResourceSelectListener {
}
private void buildGraph(MeasurementDefinition def, List<MeasurementDataNumericHighLowComposite> data) {
- SmallGraphView graph = new SmallGraphView(def, data);
+ SmallGraphView graph = new SmallGraphView(resource.getId(), def, data);
graph.setWidth("80%");
graph.setHeight(220);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/LiveGraphView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/LiveGraphView.java
new file mode 100644
index 0000000..f7f493e
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/LiveGraphView.java
@@ -0,0 +1,309 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring;
+
+import java.util.Date;
+import java.util.Set;
+
+import ca.nanometrics.gflot.client.Axis;
+import ca.nanometrics.gflot.client.DataPoint;
+import ca.nanometrics.gflot.client.PlotItem;
+import ca.nanometrics.gflot.client.PlotModel;
+import ca.nanometrics.gflot.client.PlotModelStrategy;
+import ca.nanometrics.gflot.client.PlotPosition;
+import ca.nanometrics.gflot.client.SeriesHandler;
+import ca.nanometrics.gflot.client.SeriesType;
+import ca.nanometrics.gflot.client.SimplePlot;
+import ca.nanometrics.gflot.client.event.PlotHoverListener;
+import ca.nanometrics.gflot.client.jsni.Plot;
+import ca.nanometrics.gflot.client.options.AxisOptions;
+import ca.nanometrics.gflot.client.options.GridOptions;
+import ca.nanometrics.gflot.client.options.LineSeriesOptions;
+import ca.nanometrics.gflot.client.options.PlotOptions;
+import ca.nanometrics.gflot.client.options.PointsSeriesOptions;
+import ca.nanometrics.gflot.client.options.TickFormatter;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.i18n.client.DateTimeFormat;
+import com.google.gwt.user.client.Timer;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.types.AnimationEffect;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.HTMLFlow;
+import com.smartgwt.client.widgets.Label;
+import com.smartgwt.client.widgets.WidgetCanvas;
+import com.smartgwt.client.widgets.Window;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.events.CloseClickHandler;
+import com.smartgwt.client.widgets.events.CloseClientEvent;
+import com.smartgwt.client.widgets.events.MouseOutEvent;
+import com.smartgwt.client.widgets.events.MouseOutHandler;
+import com.smartgwt.client.widgets.layout.VLayout;
+
+import org.rhq.core.domain.measurement.MeasurementConverterClient;
+import org.rhq.core.domain.measurement.MeasurementData;
+import org.rhq.core.domain.measurement.MeasurementDataNumeric;
+import org.rhq.core.domain.measurement.MeasurementDefinition;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.gwt.MeasurementDataGWTServiceAsync;
+
+/**
+ * @author Greg Hinkle
+ */
+public class LiveGraphView extends VLayout {
+
+ private static final String INSTRUCTIONS = "Point your mouse to a data point on the chart";
+
+ private final Label selectedPointLabel = new Label(INSTRUCTIONS);
+ private final Label positionLabel = new Label();
+
+ private final Label hoverLabel = new Label();
+
+ private int resourceId;
+ private MeasurementDefinition definition;
+
+ private SimplePlot plot;
+ private Timer dataLoader;
+ private long min, max;
+
+ public LiveGraphView() {
+ super();
+ }
+
+ public LiveGraphView(int resourceId, MeasurementDefinition def) {
+ super();
+ this.resourceId = resourceId;
+ this.definition = def;
+ setHeight100();
+ setWidth100();
+ }
+
+ public String getName() {
+ return "PlotHoverListener";
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+ for (Canvas c : getChildren()) {
+ c.destroy();
+ }
+
+ drawGraph();
+ }
+
+
+ @Override
+ protected void onDetach() {
+ super.onDetach(); // TODO: Implement this method.
+ }
+
+ @Override
+ protected void onUnload() {
+ super.onUnload(); // TODO: Implement this method.
+ }
+
+ @Override
+ public void parentResized() {
+ super.parentResized();
+ onDraw();
+ }
+
+ private void drawGraph() {
+
+ PlotModel model = new PlotModel();
+ PlotOptions plotOptions = new PlotOptions();
+ plotOptions.setDefaultLineSeriesOptions(new LineSeriesOptions().setLineWidth(1).setShow(true));
+ plotOptions.setDefaultPointsOptions(new PointsSeriesOptions().setRadius(2).setShow(true));
+ plotOptions.setDefaultShadowSize(0);
+
+
+ // You need make the grid hoverable <<<<<<<<<
+ plotOptions.setGridOptions(new GridOptions().setHoverable(true).setMouseActiveRadius(10).setAutoHighlight(true));
+
+
+ // create a series
+ loadData(model, plotOptions);
+
+ // create the plot
+ plot = new SimplePlot(model, plotOptions);
+ plot.setSize(String.valueOf(getInnerContentWidth()), String.valueOf(getInnerContentHeight() - 20));
+
+
+
+ // add hover listener
+ plot.addHoverListener(new PlotHoverListener() {
+ public void onPlotHover(Plot plot, PlotPosition position, PlotItem item) {
+ if (position != null) {
+ positionLabel.setContents("position: (" + position.getX() + "," + position.getY() + ")");
+ }
+ if (item != null) {
+ hoverLabel.setContents(getHover(item));
+
+ hoverLabel.animateShow(AnimationEffect.FADE);
+ if (hoverLabel.getLeft() > 0 || hoverLabel.getTop() > 0) {
+ hoverLabel.animateMove(item.getPageX() + 5, item.getPageY() + 5);
+ } else {
+ hoverLabel.moveTo(item.getPageX() + 5, item.getPageY() + 5);
+ }
+ hoverLabel.redraw();
+
+ selectedPointLabel.setContents("x: " + item.getDataPoint().getX() + ", y: " + item.getDataPoint().getY());
+ } else {
+ hoverLabel.animateHide(AnimationEffect.FADE);
+ selectedPointLabel.setContents(INSTRUCTIONS);
+ }
+ }
+ }, false);
+
+ addMouseOutHandler(new MouseOutHandler() {
+ public void onMouseOut(MouseOutEvent mouseOutEvent) {
+ hoverLabel.animateHide(AnimationEffect.FADE);
+ }
+ });
+
+
+ hoverLabel.setOpacity(80);
+ hoverLabel.setWrap(false);
+ hoverLabel.setHeight(25);
+ hoverLabel.setBackgroundColor("yellow");
+ hoverLabel.setBorder("1px solid orange");
+ hoverLabel.hide();
+
+ hoverLabel.draw();
+
+ // put it on a panel
+
+ if (definition != null) {
+
+ HTMLFlow title = new HTMLFlow("<b>" + definition.getDisplayName() + "</b> " + definition.getDescription());
+ title.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+// displayAsDialog();
+ }
+ });
+
+ addMember(title);
+ }
+
+ addMember(new WidgetCanvas(plot));
+ }
+
+ private String getHover(PlotItem item) {
+ if (definition != null) {
+ DateTimeFormat df = DateTimeFormat.getMediumDateTimeFormat();
+ return definition.getDisplayName() + ": " + MeasurementConverterClient.format(item.getDataPoint().getY(), definition.getUnits(), true)
+ + "<br/>" + df.format(new Date((long) item.getDataPoint().getX()));
+ } else {
+ return "x: " + item.getDataPoint().getX() + ", y: " + item.getDataPoint().getY();
+ }
+ }
+
+ private void loadData(final PlotModel model, final PlotOptions plotOptions) {
+ final SeriesHandler handler = model.addSeries(definition.getDisplayName(), "#007f00");
+
+ model.setStrategy(PlotModelStrategy.slidingWindowStrategy(60));
+ final MeasurementDataGWTServiceAsync dataService = GWTServiceLookup.getMeasurementDataService();
+
+ dataLoader = new Timer() {
+ @Override
+ public void run() {
+ dataService.findLiveData(resourceId, new int[]{definition.getId()}, new AsyncCallback<Set<MeasurementData>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load live data", caught);
+ }
+
+ public void onSuccess(Set<MeasurementData> result) {
+ MeasurementDataNumeric d = (MeasurementDataNumeric) result.iterator().next();
+
+ handler.add(new DataPoint(d.getTimestamp(), d.getValue()));
+ plot.redraw();
+
+ if (d.getTimestamp()> max) {
+ max = System.currentTimeMillis();
+ min = max - (1000L * 60);
+
+// plotOptions.setXAxisOptions(new AxisOptions().setMinimum(min).setMaximum(max));
+ }
+
+ }
+ });
+ }
+ };
+
+ dataLoader.scheduleRepeating(1000);
+
+
+ plotOptions.setYAxisOptions(new AxisOptions().setTicks(5).setTickFormatter(new TickFormatter() {
+ public String formatTickValue(double v, Axis axis) {
+ return MeasurementConverterClient.format(v, definition.getUnits(), true);
+ }
+ }));
+
+
+ min = System.currentTimeMillis();
+ max = System.currentTimeMillis() + (1000L * 60);
+
+
+ plotOptions.setXAxisOptions(new AxisOptions().setTicks(8).setTickFormatter(new TickFormatter() {
+ public String formatTickValue(double tickValue, Axis axis) {
+ DateTimeFormat dateFormat = DateTimeFormat.getMediumTimeFormat();
+ return dateFormat.format(new Date((long) tickValue));
+ }
+ }));
+
+ }
+
+
+ public static void displayAsDialog(int resourceId, MeasurementDefinition def) {
+ final LiveGraphView graph = new LiveGraphView(resourceId, def);
+ final Window graphPopup = new Window();
+ graphPopup.setTitle("Detailed Graph");
+ graphPopup.setWidth(800);
+ graphPopup.setHeight(400);
+ graphPopup.setIsModal(true);
+ graphPopup.setShowModalMask(true);
+ graphPopup.setCanDragResize(true);
+ graphPopup.centerInPage();
+ graphPopup.addItem(graph);
+ graphPopup.show();
+
+ graphPopup.addCloseClickHandler(new CloseClickHandler() {
+ public void onCloseClick(CloseClientEvent closeClientEvent) {
+ graph.stop();
+ graphPopup.destroy();
+ }
+ });
+ }
+
+ protected void stop() {
+ dataLoader.cancel();
+ hoverLabel.destroy();
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ dataLoader.cancel();
+ hoverLabel.destroy();
+ }
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java
index 58b3a05..082eac1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java
@@ -18,6 +18,9 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring;
+import java.util.Date;
+import java.util.List;
+
import ca.nanometrics.gflot.client.Axis;
import ca.nanometrics.gflot.client.DataPoint;
import ca.nanometrics.gflot.client.PlotItem;
@@ -34,22 +37,24 @@ import ca.nanometrics.gflot.client.options.PlotOptions;
import ca.nanometrics.gflot.client.options.PointsSeriesOptions;
import ca.nanometrics.gflot.client.options.TickFormatter;
-import org.rhq.core.domain.measurement.MeasurementConverterClient;
-import org.rhq.core.domain.measurement.MeasurementDefinition;
-import org.rhq.core.domain.measurement.composite.MeasurementDataNumericHighLowComposite;
-
import com.google.gwt.i18n.client.DateTimeFormat;
import com.smartgwt.client.types.AnimationEffect;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
+import com.smartgwt.client.widgets.HTMLPane;
import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.WidgetCanvas;
+import com.smartgwt.client.widgets.Window;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.events.MouseOutEvent;
import com.smartgwt.client.widgets.events.MouseOutHandler;
+import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.VLayout;
-import java.util.Date;
-import java.util.List;
+import org.rhq.core.domain.measurement.MeasurementConverterClient;
+import org.rhq.core.domain.measurement.MeasurementDefinition;
+import org.rhq.core.domain.measurement.composite.MeasurementDataNumericHighLowComposite;
/**
* @author Greg Hinkle
@@ -65,6 +70,7 @@ public class SmallGraphView extends VLayout {
private final Label hoverLabel = new Label();
+ private int resourceId;
private MeasurementDefinition definition;
private List<MeasurementDataNumericHighLowComposite> data;
@@ -73,8 +79,9 @@ public class SmallGraphView extends VLayout {
super();
}
- public SmallGraphView(MeasurementDefinition def, List<MeasurementDataNumericHighLowComposite> data) {
+ public SmallGraphView(int resourceId, MeasurementDefinition def, List<MeasurementDataNumericHighLowComposite> data) {
super();
+ this.resourceId = resourceId;
this.definition = def;
this.data = data;
// setHeight(250);
@@ -124,7 +131,6 @@ public class SmallGraphView extends VLayout {
plotOptions.setDefaultShadowSize(0);
-
// You need make the grid hoverable <<<<<<<<<
plotOptions.setGridOptions(new GridOptions().setHoverable(true).setMouseActiveRadius(10).setAutoHighlight(true));
@@ -142,7 +148,6 @@ public class SmallGraphView extends VLayout {
// "80%","80%");
-
// add hover listener
plot.addHoverListener(new PlotHoverListener() {
public void onPlotHover(Plot plot, PlotPosition position, PlotItem item) {
@@ -186,7 +191,28 @@ public class SmallGraphView extends VLayout {
// put it on a panel
if (definition != null) {
- addMember(new HTMLFlow("<b>" + definition.getDisplayName() + "</b> " + definition.getDescription()));
+
+ HLayout titleLayout = new HLayout();
+ titleLayout.setWidth100();
+
+ HTMLFlow title = new HTMLFlow("<b>" + definition.getDisplayName() + "</b> " + definition.getDescription());
+ title.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ displayAsDialog();
+ }
+ });
+ titleLayout.addMember(title);
+
+ HTMLPane liveGraphLink = new HTMLPane();
+ liveGraphLink.setContents("<a>Live Graph</a>");
+ liveGraphLink.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ LiveGraphView.displayAsDialog(resourceId,definition);
+ }
+ });
+ titleLayout.addMember(liveGraphLink);
+
+ addMember(titleLayout);
}
addMember(new WidgetCanvas(plot));
@@ -194,8 +220,8 @@ public class SmallGraphView extends VLayout {
private String getHover(PlotItem item) {
if (definition != null) {
- com.google.gwt.i18n.client.DateTimeFormat df = DateTimeFormat.getMediumDateTimeFormat();
- return definition.getDisplayName() + ": " + MeasurementConverterClient.format(item.getDataPoint().getY(),definition.getUnits(), true)
+ com.google.gwt.i18n.client.DateTimeFormat df = DateTimeFormat.getMediumDateTimeFormat();
+ return definition.getDisplayName() + ": " + MeasurementConverterClient.format(item.getDataPoint().getY(), definition.getUnits(), true)
+ "<br/>" + df.format(new Date((long) item.getDataPoint().getX()));
} else {
return "x: " + item.getDataPoint().getX() + ", y: " + item.getDataPoint().getY();
@@ -216,12 +242,12 @@ public class SmallGraphView extends VLayout {
}));
long max = System.currentTimeMillis();
- long min = max - (1000L * 60 * 60 *8);
+ long min = max - (1000L * 60 * 60 * 8);
- plotOptions.setXAxisOptions(new AxisOptions().setTicks(8). setMinimum(min).setMaximum(max).setTickFormatter(new TickFormatter() {
+ plotOptions.setXAxisOptions(new AxisOptions().setTicks(8).setMinimum(min).setMaximum(max).setTickFormatter(new TickFormatter() {
public String formatTickValue(double tickValue, Axis axis) {
com.google.gwt.i18n.client.DateTimeFormat dateFormat = DateTimeFormat.getShortDateTimeFormat();
- return dateFormat.format(new Date((long)tickValue));
+ return dateFormat.format(new Date((long) tickValue));
// return String.valueOf(new Date((long) tickValue));
// return MONTH_NAMES[(int) (tickValue - 1)];
}
@@ -253,6 +279,21 @@ public class SmallGraphView extends VLayout {
}));
}
+ private void displayAsDialog() {
+ SmallGraphView graph = new SmallGraphView(resourceId, definition, data);
+ Window graphPopup = new Window();
+ graphPopup.setTitle("Detailed Graph");
+ graphPopup.setWidth(800);
+ graphPopup.setHeight(400);
+ graphPopup.setIsModal(true);
+ graphPopup.setShowModalMask(true);
+ graphPopup.setCanDragResize(true);
+ graphPopup.centerInPage();
+ graphPopup.addItem(graph);
+ graphPopup.show();
+ }
+
+
@Override
protected void onDestroy() {
super.onDestroy();
commit b5ed62ebbf0ad74ac03982aa93fdd374f9d9f85b
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Mon Mar 15 15:25:12 2010 -0400
Viewing of previous configurations in bottom of detail pane
Viewing of Map configuration properties
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 24efd6e..208ce29 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
@@ -38,6 +38,7 @@ import org.rhq.core.domain.configuration.definition.constraint.Constraint;
import org.rhq.core.domain.configuration.definition.constraint.IntegerRangeConstraint;
import org.rhq.core.domain.configuration.definition.constraint.RegexConstraint;
import org.rhq.core.domain.resource.ResourceType;
+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;
@@ -113,6 +114,7 @@ import java.util.EnumSet;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Map;
import java.util.Set;
/**
@@ -139,6 +141,7 @@ public class ConfigurationEditor extends VLayout {
private ConfigType configType;
private IButton saveButton;
+ private boolean readOnly = false;
public static enum ConfigType {
plugin, resource
@@ -171,6 +174,14 @@ public class ConfigurationEditor extends VLayout {
return configuration;
}
+ public boolean isReadOnly() {
+ return readOnly;
+ }
+
+ public void setReadOnly(boolean readOnly) {
+ this.readOnly = readOnly;
+ }
+
public void showError(Throwable failure) {
addMember(new Label(failure.getMessage()));
}
@@ -489,6 +500,7 @@ public class ConfigurationEditor extends VLayout {
public void addItems(ArrayList<FormItem> fields, PropertyDefinition propertyDefinition, Property property, boolean oddRow) {
StaticTextItem nameItem = new StaticTextItem();
+ nameItem.setStartRow(true);
nameItem.setValue("<b>" + propertyDefinition.getDisplayName() + "</b>");
nameItem.setShowTitle(false);
nameItem.setCellStyle(oddRow ? "OddRow" : "EvenRow");
@@ -513,9 +525,48 @@ public class ConfigurationEditor extends VLayout {
// List of Maps is a specially supported case with summary fields as columns in a table
buildListOfMapsField(fields, (PropertyDefinitionMap) ((PropertyDefinitionList) propertyDefinition).getMemberDefinition(), oddRow, (PropertyList) property);
}
+ } else if (propertyDefinition instanceof PropertyDefinitionMap) {
+ buildMapsField(fields, (PropertyDefinitionMap)propertyDefinition, (PropertyMap) property);
+ }
+ }
+
+ private void buildMapsField(ArrayList<FormItem> fields, PropertyDefinitionMap propertyDefinitionMap, PropertyMap propertyMap) {
+ // create the property grid
+ PropertyGrid propertyGrid = new PropertyGrid();
+ propertyGrid.getNameField().setName("Name");
+ propertyGrid.getValuesField().setName("Value");
+ // create the editors
+ HashMap<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);
+
+
+ ListGridRecord[] records = new ListGridRecord[propertyMap.getMap().size()];
+ int i = 0;
+ for (Property property : propertyMap.getMap().values()) {
+ ListGridRecord record = new ListGridRecord();
+ record.setAttribute("Name",property.getName());
+ record.setAttribute("Value",((PropertySimple)property).getStringValue());
+ record.setAttribute("fieldType","simpleText");
+ records[i++] = record;
}
+ propertyGrid.setData(records);
+
+ propertyGrid.draw();
+
+ CanvasItem item = new CanvasItem();
+ item.setCanvas(propertyGrid);
+// item.setHeight(500);
+ item.setColSpan(3);
+ item.setEndRow(true);
+ item.setShowTitle(false);
+ fields.add(item);
+
+
}
private void buildListOfMapsField(ArrayList<FormItem> fields, final PropertyDefinitionMap propertyDefinition, boolean oddRow, final PropertyList propertyList) {
@@ -581,32 +632,34 @@ public class ConfigurationEditor extends VLayout {
fieldsList.add(editField);
- ListGridField removeField = new ListGridField("remove", 20);
- removeField.setType(ListGridFieldType.ICON);
+ if (!readOnly) {
+ ListGridField removeField = new ListGridField("remove", 20);
+ removeField.setType(ListGridFieldType.ICON);
// removeField.setIcon(Window.getImgURL("[SKIN]/actions/remove.png")); //"/images/tbb_delete.gif");
- removeField.setCellIcon(Window.getImgURL("[SKIN]/actions/remove.png")); //"/images/tbb_delete.gif");
- removeField.setCanEdit(false);
- removeField.setCanFilter(true);
- removeField.setFilterEditorType(new SpacerItem());
- removeField.setCanGroupBy(false);
- removeField.setCanSort(false);
- removeField.setCanHide(false);
-
- removeField.addRecordClickHandler(new RecordClickHandler() {
- public void onRecordClick(final RecordClickEvent recordClickEvent) {
- System.out.println("You want to delete: " + recordClickEvent.getRecordNum());
- SC.confirm("Are you sure you want to delete this row?", new BooleanCallback() {
- public void execute(Boolean aBoolean) {
- if (aBoolean) {
- summaryTable.removeData(recordClickEvent.getRecord());
+ removeField.setCellIcon(Window.getImgURL("[SKIN]/actions/remove.png")); //"/images/tbb_delete.gif");
+ removeField.setCanEdit(false);
+ removeField.setCanFilter(true);
+ removeField.setFilterEditorType(new SpacerItem());
+ removeField.setCanGroupBy(false);
+ removeField.setCanSort(false);
+ removeField.setCanHide(false);
+
+ removeField.addRecordClickHandler(new RecordClickHandler() {
+ public void onRecordClick(final RecordClickEvent recordClickEvent) {
+ System.out.println("You want to delete: " + recordClickEvent.getRecordNum());
+ SC.confirm("Are you sure you want to delete this row?", new BooleanCallback() {
+ public void execute(Boolean aBoolean) {
+ if (aBoolean) {
+ summaryTable.removeData(recordClickEvent.getRecord());
+ }
}
- }
- });
- }
- });
+ });
+ }
+ });
- editField.setEditorType(new ButtonItem("delete", "Delete"));
- fieldsList.add(removeField);
+ editField.setEditorType(new ButtonItem("delete", "Delete"));
+ fieldsList.add(removeField);
+ }
summaryTable.setFields(fieldsList.toArray(new ListGridField[fieldsList.size()]));
@@ -705,6 +758,7 @@ public class ConfigurationEditor extends VLayout {
final CheckboxItem unsetItem = new CheckboxItem();
unsetItem.setValue(isUnset);
+ unsetItem.setDisabled(readOnly);
unsetItem.setShowLabel(false);
unsetItem.setShowTitle(false);
unsetItem.setLabelAsTitle(false);
@@ -803,7 +857,7 @@ public class ConfigurationEditor extends VLayout {
valueItem.setShowTitle(false);
- valueItem.setDisabled(isUnset);
+ valueItem.setDisabled(isUnset || readOnly);
valueItem.setWidth(220);
valueItem.setCellStyle(oddRow ? "OddRow" : "EvenRow");
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/PropertyGrid.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/PropertyGrid.java
new file mode 100644
index 0000000..ee6b7d7
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/PropertyGrid.java
@@ -0,0 +1,133 @@
+/*
+ * 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.table;
+
+import java.util.Map;
+
+import com.smartgwt.client.data.Record;
+import com.smartgwt.client.widgets.form.fields.FormItem;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.grid.events.EditorEnterEvent;
+import com.smartgwt.client.widgets.grid.events.EditorEnterHandler;
+import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
+import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
+
+
+/**
+ * A PropertyGrid based on a {@link ListGrid} that automatically creates two
+ * fields (one for name column and other for values column) and can display a
+ * custom editor for every row
+ *
+ * @author Dan Mihai Ile
+ */
+public class PropertyGrid extends ListGrid {
+
+ /**
+ * Map to hold the editors
+ */
+ private Map<String, FormItem> editorsMap;
+
+ /**
+ * Hold the name of the attribute on a {@link Record} which contains the
+ * editorsMap key
+ */
+ private String valueFieldAttribute;
+
+ /**
+ * Create a new {@link PropertyGrid} with two column fields (first for
+ * names, second for values)
+ */
+ public PropertyGrid() {
+
+ // create the 2 fields, one for names, other for values
+ ListGridField nameField = new ListGridField();
+ nameField.setCanEdit(false);
+ ListGridField valueField = new ListGridField();
+ valueField.setCanEdit(true);
+
+ setFields(nameField, valueField);
+
+ // listeners to intercept when the user starts to edit data
+ addEditorEnterHandler(new EditorEnterHandler() {
+ public void onEditorEnter(EditorEnterEvent event) {
+ Record record = event.getRecord();
+ enableSpecificEditor(record);
+ }
+ });
+ addRecordClickHandler(new RecordClickHandler() {
+ public void onRecordClick(RecordClickEvent event) {
+ Record record = event.getRecord();
+ enableSpecificEditor(record);
+ }
+ });
+
+ }
+
+ /**
+ * The name column field
+ *
+ * @return
+ */
+ public ListGridField getNameField() {
+ return getField(0);
+ }
+
+ /**
+ * The values column field
+ *
+ * @return
+ */
+ public ListGridField getValuesField() {
+ return getField(1);
+ }
+
+ /**
+ * Set the name of the attribute from where the row will get the editor name
+ * to be used on the {@link Map} from where the rows will get it's editors
+ * <p/>
+ * When an edit starts the {@link PropertyGrid} will retrieve the key of the
+ * editor form the row's attributes and use that key on the map to get the
+ * editor to be used
+ *
+ * @param attribute the name of the attribute on the rows that contains the key of
+ * the editor
+ * @param map a map that contains the key of the editor and the editor
+ */
+ public void setEditorsMap(String attribute, Map<String, FormItem> map) {
+ this.valueFieldAttribute = attribute;
+ this.editorsMap = map;
+ }
+
+ /**
+ * Enable the specific editor for the given record
+ *
+ * @param record the record
+ */
+ private void enableSpecificEditor(Record record) {
+ if (editorsMap != null) {
+ String attribute = record.getAttribute(valueFieldAttribute);
+ if (editorsMap.containsKey(attribute)) {
+ FormItem formItem = editorsMap.get(attribute);
+ getField(1).setEditorType(formItem);
+ }
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java
index 9eab1ae..c476bee 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java
@@ -69,7 +69,7 @@ public class ConfigurationHistoryDataSource extends RPCDataSource<ResourceConfig
@Override
protected void executeFetch(final DSRequest request, final DSResponse response) {
- int resourceId = Integer.parseInt((String) request.getCriteria().getValues().get("resourceId"));
+ int resourceId = (Integer) request.getCriteria().getValues().get("resourceId");
configurationService.findResourceConfigurationUpdates(resourceId, new AsyncCallback<PageList<ResourceConfigurationUpdate>>() {
public void onFailure(Throwable caught) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDetailView.java
new file mode 100644
index 0000000..6d64732
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDetailView.java
@@ -0,0 +1,64 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration;
+
+import java.util.EnumSet;
+
+import com.smartgwt.client.widgets.layout.Layout;
+
+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.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+
+/**
+ * @author Greg Hinkle
+ */
+public class ConfigurationHistoryDetailView extends Layout {
+
+ private ConfigurationDefinition definition;
+ private Configuration configuration;
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+ if (definition != null && configuration != null) {
+ setup();
+ }
+ }
+
+ public void setConfiguration(ConfigurationDefinition definition, Configuration configuration) {
+ this.definition = definition;
+ this.configuration = configuration;
+ setup();
+ }
+
+
+ private void setup() {
+ if (getChildren().length > 0)
+ getChildren()[0].destroy();
+
+ ConfigurationEditor editor = new ConfigurationEditor(definition, configuration);
+ editor.setReadOnly(true);
+ addMember(editor);
+ markForRedraw();
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
index 3961d0c..d7ca524 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
@@ -18,177 +18,142 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration;
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
-import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationComparisonView;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDatasource;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
+import java.util.ArrayList;
+import java.util.EnumSet;
-import com.google.gwt.event.dom.client.KeyCodes;
import com.smartgwt.client.data.Criteria;
-import com.smartgwt.client.types.Alignment;
-import com.smartgwt.client.types.ListGridFieldType;
import com.smartgwt.client.types.SelectionAppearance;
import com.smartgwt.client.types.SelectionStyle;
-import com.smartgwt.client.util.BooleanCallback;
-import com.smartgwt.client.util.SC;
-import com.smartgwt.client.widgets.IButton;
-import com.smartgwt.client.widgets.Label;
-import com.smartgwt.client.widgets.events.ClickEvent;
-import com.smartgwt.client.widgets.events.ClickHandler;
-import com.smartgwt.client.widgets.form.DynamicForm;
-import com.smartgwt.client.widgets.form.fields.TextItem;
-import com.smartgwt.client.widgets.form.fields.events.KeyPressEvent;
-import com.smartgwt.client.widgets.form.fields.events.KeyPressHandler;
-import com.smartgwt.client.widgets.grid.CellFormatter;
-import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
-import com.smartgwt.client.widgets.grid.events.DataArrivedEvent;
-import com.smartgwt.client.widgets.grid.events.DataArrivedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionEvent;
-import com.smartgwt.client.widgets.layout.LayoutSpacer;
import com.smartgwt.client.widgets.layout.VLayout;
-import com.smartgwt.client.widgets.toolbar.ToolStrip;
-import java.util.ArrayList;
+import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationComparisonView;
+import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
/**
* @author Greg Hinkle
*/
public class ConfigurationHistoryView extends VLayout {
- private ListGrid listGrid;
+ private int resourceId;
+
+ ConfigurationHistoryDetailView detailView;
- /**
- * A resource list of all resources in the system
- */
- public ConfigurationHistoryView() {
- this(null);
- }
/**
* Resource list filtered by a given criteria
*/
- public ConfigurationHistoryView(final Criteria criteria) {
+ public ConfigurationHistoryView(final int resourceId) {
+ this.resourceId = resourceId;
setWidth100();
setHeight100();
+ setAnimateMembers(true);
+ }
- final ConfigurationHistoryDataSource datasource = new ConfigurationHistoryDataSource();
-
- VLayout gridHolder = new VLayout();
-
- listGrid = new ListGrid();
- listGrid.setWidth100();
- listGrid.setHeight100();
- listGrid.setDataSource(datasource);
- listGrid.setAutoFetchData(true);
- listGrid.setAlternateRecordStyles(true);
- listGrid.setUseAllDataSourceFields(true);
-
-
- ListGridField idField = new ListGridField("id","ID",60);
- ListGridField createdField = new ListGridField("createdTime","Timestamp",200);
- ListGridField statusField = new ListGridField("status","Status",100);
- ListGridField userField = new ListGridField("subject","User",150);
- listGrid.setFields(idField,createdField,statusField,userField);
-
-
- if (criteria != null) {
- listGrid.setInitialCriteria(criteria);
- }
-
- listGrid.setSelectionType(SelectionStyle.SIMPLE);
- listGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
- listGrid.setResizeFieldsInRealTime(true);
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+ Criteria criteria = new Criteria();
+ criteria.addCriteria("resourceId", resourceId);
- gridHolder.addMember(listGrid);
- ToolStrip toolStrip = new ToolStrip();
- toolStrip.setPadding(5);
- toolStrip.setWidth100();
- toolStrip.setMembersMargin(15);
+ final ConfigurationHistoryDataSource datasource = new ConfigurationHistoryDataSource();
- final IButton removeButton = new IButton("Remove");
- removeButton.setDisabled(true);
- removeButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- SC.confirm("Are you sure you want to delete " + listGrid.getSelection().length + " configurations?",
- new BooleanCallback() {
- public void execute(Boolean aBoolean) {
- }
+ Table table = new Table("Configuration History", criteria);
+ table.setDataSource(datasource);
+ table.getListGrid().setUseAllDataSourceFields(true);
+
+ ListGridField idField = new ListGridField("id", "ID", 60);
+ ListGridField createdField = new ListGridField("createdTime", "Timestamp", 200);
+ ListGridField statusField = new ListGridField("status", "Status", 100);
+ ListGridField userField = new ListGridField("subject", "User", 150);
+ table.getListGrid().setFields(idField, createdField, statusField, userField);
+
+ table.getListGrid().setSelectionType(SelectionStyle.SIMPLE);
+ table.getListGrid().setSelectionAppearance(SelectionAppearance.CHECKBOX);
+ table.getListGrid().setResizeFieldsInRealTime(true);
+
+
+ table.addTableAction("Remove", Table.SelectionEnablement.ANY,
+ "Are you sure you want to delete # configurations?",
+ new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ // TODO: Implement this method.
+ }
+ });
+
+ table.addTableAction("Compare", Table.SelectionEnablement.MULTIPLE, null,
+ new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ ArrayList<ResourceConfigurationUpdate> configs = new ArrayList<ResourceConfigurationUpdate>();
+ for (ListGridRecord record : selection) {
+ ResourceConfigurationUpdate update = (ResourceConfigurationUpdate) record.getAttributeAsObject("entity");
+ configs.add(update);
}
- );
- }
- });
-
-
- final IButton compareButton = new IButton("Compare");
- compareButton.setDisabled(true);
- compareButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- int resourceId = Integer.parseInt((String)criteria.getValues().get("resourceId"));
-
- ListGridRecord[] selection = listGrid.getSelection();
- ArrayList<ResourceConfigurationUpdate> configs = new ArrayList<ResourceConfigurationUpdate>();
- for (ListGridRecord record : selection) {
- ResourceConfigurationUpdate update = (ResourceConfigurationUpdate) record.getAttributeAsObject("entity");
- configs.add(update);
- }
+ ConfigurationComparisonView.displayComparisonDialog(configs);
+ }
+ });
- ConfigurationComparisonView.displayComparisonDialog(configs);
- }
- });
+ table.setShowResizeBar(true);
+ table.setResizeBarTarget("next");
+ addMember(table);
- final Label tableInfo = new Label("Total: " + listGrid.getTotalRows());
- tableInfo.setWrap(false);
+ detailView = new ConfigurationHistoryDetailView();
+ detailView.setHeight("70%");
+ detailView.hide();
- toolStrip.addMember(removeButton);
- toolStrip.addMember(compareButton);
- toolStrip.addMember(new LayoutSpacer());
- toolStrip.addMember(tableInfo);
+ addMember(detailView);
- gridHolder.addMember(toolStrip);
-
- listGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
+ table.getListGrid().addSelectionChangedHandler(new SelectionChangedHandler() {
public void onSelectionChanged(SelectionEvent selectionEvent) {
- int selectedCount = ((ListGrid) selectionEvent.getSource()).getSelection().length;
- tableInfo.setContents("Total: " + listGrid.getTotalRows() + " (" + selectedCount + " selected)");
- removeButton.setDisabled(selectedCount == 0);
- compareButton.setDisabled(selectedCount == 0);
- }
- });
-
-
- addMember(gridHolder);
-
-
- listGrid.addDataArrivedHandler(new DataArrivedHandler() {
- public void onDataArrived(DataArrivedEvent dataArrivedEvent) {
- int selectedCount = ((ListGrid) dataArrivedEvent.getSource()).getSelection().length;
- tableInfo.setContents("Total: " + listGrid.getTotalRows() + " (" + selectedCount + " selected)");
+ if (selectionEvent.getState()) {
+ ListGridRecord record = (ListGridRecord) selectionEvent.getRecord();
+ final ResourceConfigurationUpdate update = (ResourceConfigurationUpdate) record.getAttributeAsObject("entity");
+
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(
+ update.getResource().getResourceType().getId(),
+ EnumSet.of(ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
+ new ResourceTypeRepository.TypeLoadedCallback() {
+
+ public void onTypesLoaded(ResourceType type) {
+
+ ConfigurationDefinition definition = type.getResourceConfigurationDefinition();
+
+ detailView.setConfiguration(definition, update.getConfiguration());
+ detailView.setHeight("75%");
+ showMember(detailView);
+ }
+ });
+ } else {
+ hideMember(detailView);
+ }
}
});
}
-
// -------- Static Utility loaders ------------
public static ConfigurationHistoryView getHistoryOf(int resourceId) {
- return new ConfigurationHistoryView(new Criteria("resourceId",String.valueOf(resourceId)));
- }
-
+ return new ConfigurationHistoryView(resourceId);
+ }
-}
\ No newline at end of file
+}
commit 9d217b87f52bce386dba9911b19f391bac2c32b5
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Mar 15 13:31:07 2010 -0400
do better error handling on upload failure
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
index d3a3fdf..22275ac 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
@@ -24,7 +24,10 @@ import java.util.Map;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.Img;
+import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.events.FormSubmitFailedEvent;
+import com.smartgwt.client.widgets.form.events.FormSubmitFailedHandler;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.VLayout;
@@ -35,6 +38,7 @@ import org.rhq.enterprise.gui.coregui.client.components.upload.DynamicFormSubmit
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
/**
* @author Greg Hinkle
@@ -66,6 +70,7 @@ public class BundleUploadDataStep implements WizardStep {
public void onFailure(Throwable caught) {
allFilesStatus = null;
+ enableNextButtonWhenAppropriate();
CoreGUI.getErrorHandler().handleError("Cannot obtain bundle file information from server", caught);
}
});
@@ -93,7 +98,7 @@ public class BundleUploadDataStep implements WizardStep {
}
public boolean isPreviousEnabled() {
- return false;
+ return true;
}
private void enableNextButtonWhenAppropriate() {
@@ -106,19 +111,37 @@ public class BundleUploadDataStep implements WizardStep {
layout.addMember(formLayout);
String fileToBeUploaded = entry.getKey();
+ Boolean isAlreadyUploaded = entry.getValue();
- if (entry.getValue()) {
- Img img = new Img("/images/status_complete.gif", 50, 15);
+ if (isAlreadyUploaded) {
+ Label nameLabel = new Label(fileToBeUploaded + ": ");
+ formLayout.addMember(nameLabel);
+ Img img = new Img("/images/icons/availability_green_16.png", 16, 16);
formLayout.addMember(img);
} else {
final BundleFileUploadForm uploadForm = new BundleFileUploadForm(this.wizard.getBundleVersion(),
fileToBeUploaded);
uploadForm.addFormHandler(new DynamicFormHandler() {
public void onSubmitComplete(DynamicFormSubmitCompleteEvent event) {
- uploadForm.retrievalStatus(true);
- form.showItem("showUpload");
- form.hideItem("upload");
- allFilesStatus.put(uploadForm.getName(), Boolean.TRUE);
+ String results = event.getResults();
+ if (!results.contains("Failed to upload bundle file")) {
+ uploadForm.retrievalStatus(true);
+ allFilesStatus.put(uploadForm.getName(), Boolean.TRUE);
+ } else {
+ uploadForm.retrievalStatus(false);
+ allFilesStatus.put(uploadForm.getName(), Boolean.FALSE);
+ CoreGUI.getMessageCenter().notify(
+ new Message("Failed to upload bundle file", results, Message.Severity.Error));
+ }
+ enableNextButtonWhenAppropriate();
+ }
+ });
+ uploadForm.addFormSubmitFailedHandler(new FormSubmitFailedHandler() {
+ public void onFormSubmitFailed(FormSubmitFailedEvent event) {
+ uploadForm.retrievalStatus(false);
+ allFilesStatus.put(uploadForm.getName(), Boolean.FALSE);
+ CoreGUI.getMessageCenter().notify(
+ new Message("Failed to upload file", null, Message.Severity.Error));
enableNextButtonWhenAppropriate();
}
});
commit b7ce44dbbfddad61fb3e61231874580a5ec825eb
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Mar 15 13:30:45 2010 -0400
get the exception message output properly with cause strings and the html br element
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleFileUploadServlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleFileUploadServlet.java
index 4e07cc2..d10a63c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleFileUploadServlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleFileUploadServlet.java
@@ -59,7 +59,7 @@ public class BundleFileUploadServlet extends FileUploadServlet {
fileStream, pinToPackage);
successMsg = "success [" + bundleFile.getId() + "]";
} catch (Exception e) {
- writeExceptionResponse(response, "Failed to upload bundle file", e);
+ writeExceptionResponse(response, "Failed to upload bundle file", e); // clients will look for this string!
return;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/FileUploadServlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/FileUploadServlet.java
index e10a8b2..32b1ddc 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/FileUploadServlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/FileUploadServlet.java
@@ -22,6 +22,7 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
+import java.io.StringWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -131,11 +132,12 @@ public class FileUploadServlet extends HttpServlet {
}
protected void writeExceptionResponse(HttpServletResponse resp, String msg, Exception e) throws IOException {
+ resp.setStatus(500);
PrintWriter writer = resp.getWriter();
writer.write("<html><head></head><body><strong>" + msg + "</strong><br/>\n");
- for (StackTraceElement elem : e.getStackTrace()) {
- writer.write(elem.toString() + "<br/>\n");
- }
+ StringWriter sw = new StringWriter();
+ e.printStackTrace(new PrintWriter(sw));
+ writer.write(sw.toString().replace("\n", "<br/>\n"));
writer.write("</body></html>");
writer.flush();
}
commit 4cb718b3524bbf1ade613d01125b6b7353ea70f6
Merge: 4526541... 12ce792...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Mar 15 12:20:59 2010 -0400
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
commit 452654154f405a3635f7dbd36526d0604bb2e274
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Mar 15 12:20:44 2010 -0400
starting the file uploads for the bundle files
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
index 08e2f5a..d3a3fdf 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
@@ -22,7 +22,6 @@ import java.util.HashMap;
import java.util.Map;
import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.ui.Label;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.Img;
import com.smartgwt.client.widgets.form.DynamicForm;
@@ -31,6 +30,8 @@ import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.upload.BundleFileUploadForm;
+import org.rhq.enterprise.gui.coregui.client.components.upload.DynamicFormHandler;
+import org.rhq.enterprise.gui.coregui.client.components.upload.DynamicFormSubmitCompleteEvent;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
@@ -52,9 +53,7 @@ public class BundleUploadDataStep implements WizardStep {
public Canvas getCanvas() {
form = new DynamicForm();
- final HLayout layout = new HLayout();
- layout.setWidth100();
- layout.setHeight100();
+ final VLayout layout = new VLayout();
bundleServer.getAllBundleVersionFilenames(this.wizard.getBundleVersion().getId(),
new AsyncCallback<HashMap<String, Boolean>>() {
@@ -84,7 +83,13 @@ public class BundleUploadDataStep implements WizardStep {
}
public boolean isNextEnabled() {
- return this.allFilesStatus != null; // TODO && when all files are available
+ if (this.allFilesStatus == null) {
+ return false;
+ }
+ if (this.allFilesStatus.containsValue(Boolean.FALSE)) {
+ return false;
+ }
+ return true;
}
public boolean isPreviousEnabled() {
@@ -95,21 +100,30 @@ public class BundleUploadDataStep implements WizardStep {
this.wizard.getView().getNextButton().setDisabled(!isNextEnabled());
}
- private void prepareForm(HLayout layout) {
+ private void prepareForm(VLayout layout) {
for (Map.Entry<String, Boolean> entry : this.allFilesStatus.entrySet()) {
- VLayout vlayout = new VLayout();
- layout.addChild(vlayout);
+ HLayout formLayout = new HLayout();
+ layout.addMember(formLayout);
- Label label = new Label(entry.getKey());
- vlayout.addMember(label);
+ String fileToBeUploaded = entry.getKey();
if (entry.getValue()) {
Img img = new Img("/images/status_complete.gif", 50, 15);
- vlayout.addMember(img);
+ formLayout.addMember(img);
} else {
- BundleFileUploadForm uploadForm = new BundleFileUploadForm(this.wizard.getBundleVersion(), entry
- .getKey());
- vlayout.addMember(uploadForm);
+ final BundleFileUploadForm uploadForm = new BundleFileUploadForm(this.wizard.getBundleVersion(),
+ fileToBeUploaded);
+ uploadForm.addFormHandler(new DynamicFormHandler() {
+ public void onSubmitComplete(DynamicFormSubmitCompleteEvent event) {
+ uploadForm.retrievalStatus(true);
+ form.showItem("showUpload");
+ form.hideItem("upload");
+ allFilesStatus.put(uploadForm.getName(), Boolean.TRUE);
+ enableNextButtonWhenAppropriate();
+ }
+ });
+
+ formLayout.addMember(uploadForm);
}
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
index 124f715..14c53ce 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
@@ -64,7 +64,7 @@ public class BundleUploadRecipeStep implements WizardStep {
final CanvasItem upload = new CanvasItem("upload");
upload.setShowTitle(false);
- TextFileRetrieverForm textFileRetrieverForm = new TextFileRetrieverForm();
+ final TextFileRetrieverForm textFileRetrieverForm = new TextFileRetrieverForm();
upload.setCanvas(textFileRetrieverForm);
showUpload.addClickHandler(new ClickHandler() {
@@ -94,6 +94,7 @@ public class BundleUploadRecipeStep implements WizardStep {
public void onSubmitComplete(DynamicFormSubmitCompleteEvent event) {
wizard.setRecipe(event.getResults());
recipe.setValue(event.getResults());
+ textFileRetrieverForm.retrievalStatus(true);
form.showItem("showUpload");
form.hideItem("upload");
enableNextButtonWhenAppropriate();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleFileUploadForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleFileUploadForm.java
index f817dbc..5cff730 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleFileUploadForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleFileUploadForm.java
@@ -31,9 +31,14 @@ import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
import org.rhq.core.domain.bundle.BundleVersion;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
public class BundleFileUploadForm extends DynamicCallbackForm {
+ private ButtonItem uploadButton;
+ private UploadItem bundleUploadItem;
+
private BundleVersion bundleVersion;
private String name;
@@ -47,6 +52,19 @@ public class BundleFileUploadForm extends DynamicCallbackForm {
setAction(GWT.getModuleBaseURL() + "/BundleFileUploadServlet");
}
+ public BundleVersion getBundleVersion() {
+ return bundleVersion;
+ }
+
+ /**
+ * The name of the file that is to be uploaded to the server. The actual client file can
+ * be named whatever, but the server will use this name as the name of the bundle file.
+ * @return bundle file name
+ */
+ public String getName() {
+ return name;
+ }
+
@Override
protected void onDraw() {
super.onDraw();
@@ -60,10 +78,13 @@ public class BundleFileUploadForm extends DynamicCallbackForm {
HiddenItem nameField = new HiddenItem("name");
nameField.setValue(this.name);
- final UploadItem bundleUploadItem = new UploadItem("bundleFile", "Upload File");
+ setNumCols(4);
+
+ bundleUploadItem = new UploadItem("bundleFile", name);
bundleUploadItem.setEndRow(false);
- final ButtonItem uploadButton = new ButtonItem("Upload");
+ uploadButton = new ButtonItem("Upload");
+ uploadButton.setStartRow(false);
uploadButton.setDisabled(true);
bundleUploadItem.addChangeHandler(new ChangeHandler() {
@@ -89,4 +110,26 @@ public class BundleFileUploadForm extends DynamicCallbackForm {
setItems(sessionIdField, bundleVersionIdField, nameField, bundleUploadItem, uploadButton);
}
+
+ /**
+ * Call this when the file retrieval finished. <code>true</code> means successful,
+ * <code>false</code> means an error occurred.
+ * @param ok status
+ */
+ public void retrievalStatus(boolean ok) {
+ if (uploadButton != null) {
+ FormItemIcon loadedIcon = new FormItemIcon();
+ if (ok) {
+ loadedIcon.setSrc("/images/icons/availability_green_16.png");
+ CoreGUI.getMessageCenter().notify(new Message("Uploaded bundle file successfully", Severity.Info));
+ } else {
+ loadedIcon.setSrc("/images/icons/availability_red_16.png");
+ CoreGUI.getMessageCenter().notify(new Message("Bundle file upload failed", Severity.Error));
+ }
+ loadedIcon.setWidth(16);
+ loadedIcon.setHeight(16);
+ uploadButton.setIcons(loadedIcon);
+ uploadButton.setShowIcons(true);
+ }
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/TextFileRetrieverForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/TextFileRetrieverForm.java
index fbc0c3e..7863b4f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/TextFileRetrieverForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/TextFileRetrieverForm.java
@@ -30,12 +30,17 @@ import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
/**
* @author Greg Hinkle
*/
public class TextFileRetrieverForm extends DynamicCallbackForm {
+ private ButtonItem uploadButton = null;
+ private UploadItem textFile;
+
public TextFileRetrieverForm() {
super("textFileRetriever");
setNumCols(8);
@@ -53,10 +58,13 @@ public class TextFileRetrieverForm extends DynamicCallbackForm {
HiddenItem sessionIdField = new HiddenItem("sessionid");
sessionIdField.setValue(CoreGUI.getSessionSubject().getSessionId().intValue());
- final UploadItem textFile = new UploadItem("textFile", "Upload File");
+ setNumCols(4);
+
+ textFile = new UploadItem("textFile", "Upload File");
textFile.setEndRow(false);
- final ButtonItem uploadButton = new ButtonItem("Upload");
+ uploadButton = new ButtonItem("Upload");
+ uploadButton.setStartRow(false);
uploadButton.setDisabled(true);
textFile.addChangeHandler(new ChangeHandler() {
@@ -83,4 +91,26 @@ public class TextFileRetrieverForm extends DynamicCallbackForm {
setItems(retrieveField, sessionIdField, textFile, uploadButton);
}
+
+ /**
+ * Call this when the file retrieval finished. <code>true</code> means successful,
+ * <code>false</code> means an error occurred.
+ * @param ok status
+ */
+ public void retrievalStatus(boolean ok) {
+ if (uploadButton != null) {
+ FormItemIcon loadedIcon = new FormItemIcon();
+ if (ok) {
+ loadedIcon.setSrc("/images/icons/availability_green_16.png");
+ CoreGUI.getMessageCenter().notify(new Message("Uploaded file successfully", Severity.Info));
+ } else {
+ loadedIcon.setSrc("/images/icons/availability_red_16.png");
+ CoreGUI.getMessageCenter().notify(new Message("File upload failed", Severity.Error));
+ }
+ loadedIcon.setWidth(16);
+ loadedIcon.setHeight(16);
+ uploadButton.setIcons(loadedIcon);
+ uploadButton.setShowIcons(true);
+ }
+ }
}
commit 7cb3f1fcf539fb971599963129e543c4e51e38d6
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Mar 15 12:20:20 2010 -0400
get rid of the sys.err.println
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackForm.java
index bad2a86..102dfda 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackForm.java
@@ -1,6 +1,23 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2009 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
package org.rhq.enterprise.gui.coregui.client.components.upload;
-
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.GWT.UncaughtExceptionHandler;
import com.google.gwt.dom.client.Document;
@@ -14,12 +31,10 @@ public class DynamicCallbackForm extends DynamicForm implements DynamicCallbackF
private String frameName;
private Element synthesizedFrame;
private DynamicCallbackFormHandlerCollection formHandlers;
- private static DynamicCallbackFormImpl impl = GWT
- .create(DynamicCallbackFormImpl.class);
+ private static DynamicCallbackFormImpl impl = GWT.create(DynamicCallbackFormImpl.class);
public DynamicCallbackForm(String frameName) {
super();
- System.err.println("Hello World");
this.frameName = frameName;
setTarget(frameName);
init();
@@ -28,7 +43,6 @@ public class DynamicCallbackForm extends DynamicForm implements DynamicCallbackF
@Override
protected void onAttach() {
super.onAttach();
- System.err.println("ATTACH");
}
private void init() {
@@ -60,7 +74,7 @@ public class DynamicCallbackForm extends DynamicForm implements DynamicCallbackF
// most browsers.
Element dummy = Document.get().createDivElement();
dummy.setInnerHTML("<iframe src=\"javascript:''\" name='" + frameName
- + "' style='position:absolute;width:0;height:0;border:0'>");
+ + "' style='position:absolute;width:0;height:0;border:0'>");
synthesizedFrame = dummy.getFirstChildElement();
}
@@ -97,8 +111,7 @@ public class DynamicCallbackForm extends DynamicForm implements DynamicCallbackF
// 'infinite loading' state. See issue 916.
DeferredCommand.addCommand(new Command() {
public void execute() {
- formHandlers.fireOnComplete(DynamicCallbackForm.this, impl
- .getContents(synthesizedFrame));
+ formHandlers.fireOnComplete(DynamicCallbackForm.this, impl.getContents(synthesizedFrame));
}
});
}
@@ -106,7 +119,6 @@ public class DynamicCallbackForm extends DynamicForm implements DynamicCallbackF
@Override
public void destroy() {
- System.err.println("Destroy");
if (synthesizedFrame != null) {
// Unhook the iframe's onLoad when detached.
impl.unhookEvents(synthesizedFrame);
@@ -133,4 +145,3 @@ public class DynamicCallbackForm extends DynamicForm implements DynamicCallbackF
}
}
-
commit 12ce792b87edc1a50763e8f2a858facf11f77e00
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Mon Mar 15 12:13:45 2010 -0400
AlertDefinitions list view
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AlertDefinitionsDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AlertDefinitionsDataSource.java
new file mode 100644
index 0000000..e8ec455
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AlertDefinitionsDataSource.java
@@ -0,0 +1,194 @@
+/*
+ * 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.alert.definitions;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Embedded;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.FetchType;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
+import javax.persistence.OrderBy;
+import javax.xml.bind.annotation.XmlTransient;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.data.fields.DataSourceIntegerField;
+import com.smartgwt.client.data.fields.DataSourceTextField;
+import com.smartgwt.client.types.FieldType;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+import org.rhq.core.domain.alert.Alert;
+import org.rhq.core.domain.alert.AlertCondition;
+import org.rhq.core.domain.alert.AlertDampening;
+import org.rhq.core.domain.alert.AlertDampeningEvent;
+import org.rhq.core.domain.alert.AlertDefinition;
+import org.rhq.core.domain.alert.AlertDefinitionContext;
+import org.rhq.core.domain.alert.AlertPriority;
+import org.rhq.core.domain.alert.BooleanExpression;
+import org.rhq.core.domain.alert.notification.AlertNotification;
+import org.rhq.core.domain.criteria.AlertCriteria;
+import org.rhq.core.domain.criteria.AlertDefinitionCriteria;
+import org.rhq.core.domain.operation.OperationDefinition;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+
+/**
+ * @author Greg Hinkle
+ */
+public class AlertDefinitionsDataSource extends RPCDataSource<AlertDefinition> {
+
+
+ public AlertDefinitionsDataSource() {
+
+ DataSourceIntegerField idField = new DataSourceIntegerField("id","ID");
+ idField.setPrimaryKey(true);
+ addField(idField);
+
+ DataSourceTextField nameField = new DataSourceTextField("name","Name");
+ addField(nameField);
+
+ DataSourceTextField ctimeField = new DataSourceTextField("ctime","Created Time");
+ ctimeField.setType(FieldType.DATETIME);
+ addField(ctimeField);
+
+ DataSourceTextField mtimeField = new DataSourceTextField("mtime", "Modified Time");
+ mtimeField.setType(FieldType.DATETIME);
+ addField(mtimeField);
+
+ DataSourceTextField descriptionField = new DataSourceTextField("description","Description");
+ addField(descriptionField);
+
+ DataSourceTextField priorityField = new DataSourceTextField("priority","Priority");
+ addField(priorityField);
+
+ DataSourceTextField enabledField = new DataSourceTextField("enabled","Enabled");
+ enabledField.setType(FieldType.BOOLEAN);
+ addField(enabledField);
+
+ }
+
+ @Override
+ protected void executeFetch(final DSRequest request, final DSResponse response) {
+
+ AlertDefinitionCriteria criteria = getCriteria(request);
+
+ GWTServiceLookup.getAlertService().findAlertDefinitionsByCriteria(
+ criteria,
+ new AsyncCallback<PageList<AlertDefinition>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load alert definition data", caught);
+ response.setStatus(DSResponse.STATUS_FAILURE);
+ processResponse(request.getRequestId(), response);
+ }
+
+ public void onSuccess(PageList<AlertDefinition> result) {
+ response.setData(buildRecords(result));
+ processResponse(request.getRequestId(), response);
+ }
+ }
+ );
+ }
+
+
+ protected AlertDefinitionCriteria getCriteria(DSRequest request) {
+ AlertDefinitionCriteria criteria = new AlertDefinitionCriteria();
+ criteria.fetchConditions(true);
+
+ Criteria requestCriteria = request.getCriteria();
+ if (requestCriteria != null) {
+ Map values = requestCriteria.getValues();
+ for (Object key : values.keySet()) {
+ String fieldName = (String) key;
+ if (fieldName.equals("resourceId")) {
+ Integer resourceId = (Integer) values.get(fieldName);
+ criteria.addFilterResourceIds(resourceId);
+ }
+ // TODO: Add support for other fields we need to filter by (e.g. resourceGroupId).
+ }
+ }
+
+ criteria.setPageControl(getPageControl(request));
+ return criteria;
+ }
+
+
+ @Override
+ public AlertDefinition copyValues(ListGridRecord from) {
+ return null; // TODO: Implement this method.
+ }
+
+ @Override
+ public ListGridRecord copyValues(AlertDefinition from) {
+ ListGridRecord record = new ListGridRecord();
+
+ record.setAttribute("id", from.getId());
+ record.setAttribute("name", from.getName());
+ record.setAttribute("ctime", new Date(from.getCtime()));
+ record.setAttribute("mtime", new Date(from.getMtime()));
+ record.setAttribute("parentId", from.getParentId());
+ record.setAttribute("description", from.getDescription());
+ record.setAttribute("priority", from.getPriority().getDisplayName());
+ record.setAttribute("enabled", from.getEnabled());
+
+ record.setAttribute("recoveryId", from.getRecoveryId());
+ record.setAttribute("willRecover", from.getWillRecover());
+ record.setAttribute("notifyFiltered", from.getNotifyFiltered());
+ record.setAttribute("controlFiltered", from.getControlFiltered());
+ record.setAttribute("deleted", from.getDeleted());
+ record.setAttribute("readOnly", from.isReadOnly());
+ record.setAttribute("conditionExpression", from.getConditionExpression());
+
+
+ return record;
+ }
+
+
+/*
+The following is not yet translated into the record
+ private AlertDefinition groupAlertDefinition;
+ private Set<AlertDefinition> groupAlertDefinitionChildren = new LinkedHashSet<AlertDefinition>();
+ private AlertDampening alertDampening;
+ private BooleanExpression conditionExpression;
+ private Set<AlertCondition> conditions = new LinkedHashSet<AlertCondition>(1); // Most alerts will only have one condition.
+ private List<AlertNotification> alertNotifications = new ArrayList<AlertNotification>();
+ private OperationDefinition operationDefinition;
+ private Set<AlertDampeningEvent> alertDampeningEvents = new HashSet<AlertDampeningEvent>();
+ private Set<Alert> alerts = new LinkedHashSet<Alert>();
+*/
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AlertDefinitionsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AlertDefinitionsView.java
new file mode 100644
index 0000000..8f0ea70
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AlertDefinitionsView.java
@@ -0,0 +1,59 @@
+/*
+ * 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.alert.definitions;
+
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.widgets.layout.VLayout;
+
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+
+/**
+ * @author Greg Hinkle
+ */
+public class AlertDefinitionsView extends VLayout {
+
+ private Resource resource;
+
+ public AlertDefinitionsView(Resource resource) {
+ setWidth100();
+ this.resource = resource;
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+ Criteria criteria = new Criteria();
+ criteria.addCriteria("resourceId",resource.getId());
+
+ Table table = new Table("Alert Definitions", criteria);
+ table.setDataSource(new AlertDefinitionsDataSource());
+ table.getListGrid().setUseAllDataSourceFields(true);
+
+ addMember(table);
+ }
+
+
+ public static AlertDefinitionsView getResourceView(Resource resource) {
+ return new AlertDefinitionsView(resource);
+ }
+
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/AlertGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/AlertGWTService.java
index eb35f9a..38b19ee 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/AlertGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/AlertGWTService.java
@@ -20,8 +20,10 @@ package org.rhq.enterprise.gui.coregui.client.gwt;
import com.google.gwt.user.client.rpc.RemoteService;
import org.rhq.core.domain.alert.Alert;
+import org.rhq.core.domain.alert.AlertDefinition;
import org.rhq.core.domain.authz.Role;
import org.rhq.core.domain.criteria.AlertCriteria;
+import org.rhq.core.domain.criteria.AlertDefinitionCriteria;
import org.rhq.core.domain.criteria.RoleCriteria;
import org.rhq.core.domain.util.PageList;
@@ -55,4 +57,9 @@ public interface AlertGWTService extends RemoteService {
* @param alertIds the ids of the Resource alerts to be acknowledged
*/
void acknowledgeResourceAlerts(Integer[] alertIds);
+
+
+
+ PageList<AlertDefinition> findAlertDefinitionsByCriteria(AlertDefinitionCriteria criteria);
+
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index f4b2bb5..c338e06 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -25,6 +25,7 @@ import org.rhq.enterprise.gui.coregui.client.UnknownViewException;
import org.rhq.enterprise.gui.coregui.client.View;
import org.rhq.enterprise.gui.coregui.client.ViewId;
import org.rhq.enterprise.gui.coregui.client.ViewRenderer;
+import org.rhq.enterprise.gui.coregui.client.alert.definitions.AlertDefinitionsView;
import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
import org.rhq.enterprise.gui.coregui.client.components.SimpleCollapsiblePanel;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
@@ -175,6 +176,7 @@ public class ResourceDetailView extends VLayout implements ViewRenderer, Resourc
configurationTab.updateSubTab("History", ConfigurationHistoryView.getHistoryOf(resource.getId()));
alertsTab.updateSubTab("History", new ResourceAlertHistoryView(resource.getId()));
+ alertsTab.updateSubTab("Definitions", AlertDefinitionsView.getResourceView(resource));
eventsTab.updateSubTab("History", new FullHTMLPane("/rhq/common/events/history-plain.xhtml?id=" + resource.getId()));
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AlertGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AlertGWTServiceImpl.java
index 0f694c3..90469e0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AlertGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AlertGWTServiceImpl.java
@@ -19,10 +19,13 @@
package org.rhq.enterprise.gui.coregui.server.gwt;
import org.rhq.core.domain.alert.Alert;
+import org.rhq.core.domain.alert.AlertDefinition;
import org.rhq.core.domain.criteria.AlertCriteria;
+import org.rhq.core.domain.criteria.AlertDefinitionCriteria;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.gwt.AlertGWTService;
import org.rhq.enterprise.gui.coregui.server.util.SerialUtility;
+import org.rhq.enterprise.server.alert.AlertDefinitionManagerLocal;
import org.rhq.enterprise.server.alert.AlertManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
@@ -31,6 +34,7 @@ import org.rhq.enterprise.server.util.LookupUtil;
*/
public class AlertGWTServiceImpl extends AbstractGWTServiceImpl implements AlertGWTService {
private AlertManagerLocal alertManager = LookupUtil.getAlertManager();
+ private AlertDefinitionManagerLocal alertDefinitionManager = LookupUtil.getAlertDefinitionManager();
public PageList<Alert> findAlertsByCriteria(AlertCriteria criteria) {
return SerialUtility.prepare(this.alertManager.findAlertsByCriteria(getSessionSubject(), criteria),
@@ -44,4 +48,13 @@ public class AlertGWTServiceImpl extends AbstractGWTServiceImpl implements Alert
public void acknowledgeResourceAlerts(Integer[] alertIds) {
this.alertManager.acknowledgeAlerts(getSessionSubject(), alertIds);
}
+
+
+ public PageList<AlertDefinition> findAlertDefinitionsByCriteria(AlertDefinitionCriteria criteria) {
+ return SerialUtility.prepare(this.alertDefinitionManager.findAlertDefinitionsByCriteria(getSessionSubject(), criteria),
+ "AlertService.findAlertDefinitionsByCriteria");
+ }
+
+
+
}
\ No newline at end of file
commit 83900da636fe272c93a1263e6e1ff95fd2d9f1f4
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Sun Mar 14 22:50:51 2010 -0400
Resource configuration editing and event viewing
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 0cf2e86..24efd6e 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
@@ -382,6 +382,9 @@ public class ConfigurationEditor extends VLayout {
});
menu.addItem(hideAllItem);
+ // TODO GH: Save button as saveListener() or remove the buttons from this form and have
+ // the container provide them?
+
toolStrip = new ToolStrip();
toolStrip.setBackgroundImage(null);
@@ -392,7 +395,7 @@ public class ConfigurationEditor extends VLayout {
saveButton = new IButton("Save");
saveButton.setAlign(Alignment.CENTER);
saveButton.setDisabled(true);
- toolStrip.addMember(saveButton);
+// toolStrip.addMember(saveButton);
IButton resetButton = new IButton("Reset");
@@ -403,7 +406,7 @@ public class ConfigurationEditor extends VLayout {
});
- toolStrip.addMember(resetButton);
+// toolStrip.addMember(resetButton);
toolStrip.addMember(new LayoutSpacer());
toolStrip.addMember(new MenuButton("Jump to Section", menu));
@@ -422,9 +425,9 @@ public class ConfigurationEditor extends VLayout {
section = new SectionStackSection("General Properties");
} else {
- section = new SectionStackSection(group.getDisplayName() +
+ section = new SectionStackSection("<div style=\"float:left; font-weight: bold;\">" + group.getDisplayName() + "</div>" +
(group.getDescription() != null
- ? ("<div style='padding-left: 30px; font-weight: normal; font-size: smaller;'>" + group.getDescription() + "</div>")
+ ? ("<div style='padding-left: 50px; font-weight: normal; font-size: smaller; float: right;'>" + group.getDescription() + "</div>")
: ""));
section.setExpanded(!group.isDefaultHidden());
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/RecentlyAddedResourceDS.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/RecentlyAddedResourceDS.java
index 9e0d690..22efb2d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/RecentlyAddedResourceDS.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/RecentlyAddedResourceDS.java
@@ -23,112 +23,136 @@
package org.rhq.enterprise.gui.coregui.client.dashboard.portlets;
-import com.smartgwt.client.data.Criteria;
+import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.data.DataSource;
-import com.smartgwt.client.data.DataSourceField;
+import com.smartgwt.client.data.fields.DataSourceIntegerField;
+import com.smartgwt.client.data.fields.DataSourceTextField;
import com.smartgwt.client.types.DSDataFormat;
-import com.smartgwt.client.types.FieldType;
-import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.types.DSProtocol;
import com.smartgwt.client.widgets.tree.TreeNode;
-import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
+import org.rhq.core.domain.criteria.ResourceCriteria;
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceCategory;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
public class RecentlyAddedResourceDS extends DataSource {
- boolean fetched;
public RecentlyAddedResourceDS() {
setClientOnly(false);
+ setDataProtocol(DSProtocol.CLIENTCUSTOM);
setDataFormat(DSDataFormat.CUSTOM);
- DataSourceField resourceNameField = new DataSourceField("resourceName", FieldType.TEXT, "Resource Name");
+
+
+ DataSourceTextField idField = new DataSourceTextField("id", "ID");
+ idField.setPrimaryKey(true);
+
+ DataSourceTextField parentIdField = new DataSourceTextField("parentId", "Parent ID");
+ parentIdField.setForeignKey("id");
+
+ DataSourceTextField resourceNameField = new DataSourceTextField("name", "Resource Name");
resourceNameField.setPrimaryKey(true);
- DataSourceField timestampField = new DataSourceField("timestamp", FieldType.TEXT, "Date/Time");
+ DataSourceTextField timestampField = new DataSourceTextField("timestamp", "Date/Time");
- setFields(resourceNameField, timestampField);
+ setFields(idField, parentIdField, resourceNameField, timestampField);
}
@Override
protected Object transformRequest(DSRequest request) {
- String requestId = request.getRequestId();
DSResponse response = new DSResponse();
response.setAttribute("clientContext", request.getAttributeAsObject("clientContext"));
// Asume success
response.setStatus(0);
switch (request.getOperationType()) {
- case ADD:
- //executeAdd(lstRec, true);
- break;
- case FETCH:
- executeFetch(requestId, request, response);
- break;
- case REMOVE:
- //executeRemove(lstRec);
- break;
- case UPDATE:
- //executeAdd(lstRec, false);
- break;
-
- default:
- break;
+ case FETCH:
+ executeFetch(request, response);
+ break;
+ default:
+ break;
}
return request.getData();
}
- public void executeFetch(String requestId, DSRequest request, DSResponse response) {
- if (fetched) {
- return;
- }
- PageList<RecentlyAddedResource> list = new PageList<RecentlyAddedResource>();
- RecentlyAddedResource platform1 = new RecentlyAddedResource("Platform 1", "today");
- RecentlyAddedResource server1 = new RecentlyAddedResource("Server 1", "today", platform1);
- RecentlyAddedResource service1 = new RecentlyAddedResource("Service 1", "today", server1);
-
- RecentlyAddedResource platform2 = new RecentlyAddedResource("Platform 2", "today");
- RecentlyAddedResource server2 = new RecentlyAddedResource("Server 2", "today", platform2);
- RecentlyAddedResource service2 = new RecentlyAddedResource("Service 2", "today", server2);
-
- list.add(platform1);
- list.add(server1);
- list.add(service1);
- list.add(platform2);
- list.add(server2);
- list.add(service2);
-
- response.setData(buildNodes(list));
- fetched = true;
-
- processResponse(requestId, response);
+ public void executeFetch(final DSRequest request, final DSResponse response) {
+
+ ResourceCriteria c = new ResourceCriteria();
+
+ c.addFilterResourceCategory(ResourceCategory.PLATFORM);
+
+ // TODO GH: Enhance resourceCriteria query to support itime based filtering for
+ // "Recently imported" resources
+
+ GWTServiceLookup.getResourceService().findResourcesByCriteria(c, new AsyncCallback<PageList<Resource>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load recently added resources data",caught);
+ response.setStatus(DSResponse.STATUS_FAILURE);
+ processResponse(request.getRequestId(), response);
+ }
+
+ public void onSuccess(PageList<Resource> result) {
+ response.setData(buildNodes(result));
+ response.setTotalRows(result.getTotalSize());
+ processResponse(request.getRequestId(), response);
+ }
+ });
}
- private TreeNode[] buildNodes(List<RecentlyAddedResource> list) {
+ private TreeNode[] buildNodes(PageList<Resource> list) {
TreeNode[] treeNodes = new TreeNode[list.size()];
for (int i = 0; i < list.size(); ++i) {
- treeNodes[i] = new RecentlyAddedTreeNode(list.get(i));
+ treeNodes[i] = new ResourceTreeNode(list.get(i));
}
return treeNodes;
}
- static class RecentlyAddedTreeNode extends TreeNode {
- private RecentlyAddedResource recentlyAdded;
- public RecentlyAddedTreeNode(RecentlyAddedResource recentlyAdded) {
- this.recentlyAdded = recentlyAdded;
- setID(recentlyAdded.getResourceName());
- if (recentlyAdded.getParent() != null) {
- setParentID(recentlyAdded.getParent().getResourceName());
- }
+ public static class ResourceTreeNode extends TreeNode {
+
+ private Resource resource;
+
+ private ResourceTreeNode(Resource resource) {
+ this.resource = resource;
+
+ String id = String.valueOf(resource.getId());
+ String parentId = resource.getParentResource() == null ? null
+ : (resource.getParentResource().getId() + "_" + resource.getResourceType().getName());
+
+ setID(id);
+ setParentID(parentId);
+
+ setAttribute("id", id);
+ setAttribute("parentId", parentId);
+ setAttribute("name", resource.getName());
+ setAttribute("timestamp", "");//String.valueOf(resource.getItime())); // Seems to be null
+ setAttribute("currentAvailability",
+ resource.getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP
+ ? "/images/icons/availability_green_16.png"
+ : "/images/icons/availability_red_16.png");
+ }
+
+ public Resource getResource() {
+ return resource;
+ }
+
+ public void setResource(Resource resource) {
+ this.resource = resource;
+ }
+
+ public ResourceType getResourceType() {
+ return resource.getResourceType();
+ }
- setAttribute("resourceName", recentlyAdded.getResourceName());
- setAttribute("timestamp", recentlyAdded.getTimestamp());
- setIsFolder(recentlyAdded.getResourceName().startsWith("Platform"));
+ public String getParentId() {
+ return getAttribute("parentId");
}
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/RecentlyAddedView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/RecentlyAddedView.java
index e177101..fe023a6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/RecentlyAddedView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/RecentlyAddedView.java
@@ -27,24 +27,30 @@ import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.tree.TreeGrid;
+
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
public class RecentlyAddedView extends VLayout {
- public RecentlyAddedView() {
+
+ @Override
+ protected void onInit() {
+ super.onInit();
TreeGrid treeGrid = new TreeGrid();
+ treeGrid.setDataSource(new RecentlyAddedResourceDS());
+ treeGrid.setAutoFetchData(true);
treeGrid.setTitle("Recently Added Resources");
treeGrid.setResizeFieldsInRealTime(true);
treeGrid.setTreeFieldTitle("Resource Name");
- ListGridField resourceNameField = new ListGridField("resourceName", "Resource Name");
+ ListGridField resourceNameField = new ListGridField("name", "Resource Name");
ListGridField timestampField = new ListGridField("timestamp", "Date//Time");
treeGrid.setFields(resourceNameField, timestampField);
- treeGrid.setDataSource(new RecentlyAddedResourceDS());
- treeGrid.fetchData();
+
addMember(treeGrid);
+
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java
index 307bafe..66d9d5f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java
@@ -6,6 +6,7 @@ import org.rhq.core.domain.configuration.RawConfiguration;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.server.configuration.ConfigurationUpdateStillInProgressException;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
@@ -23,6 +24,7 @@ public interface ConfigurationGWTService extends RemoteService {
PageList<ResourceConfigurationUpdate> findResourceConfigurationUpdates(int resourceId);
+ ResourceConfigurationUpdate updateResourceConfiguration(int resourceId, Configuration configuration);
RawConfiguration dummy(RawConfiguration config);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index a9a6543..f4b2bb5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -36,6 +36,7 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSearchVi
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.alert.ResourceAlertHistoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration.ConfigurationHistoryView;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration.ResourceConfigurationEditView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.GraphListView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.calltime.CallTimeView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.OperationHistoryView;
@@ -119,6 +120,7 @@ public class ResourceDetailView extends VLayout implements ViewRenderer, Resourc
configurationTab.registerSubTabs("Current", "History");
eventsTab = new TwoLevelTab("Events", "/images/icons/Events_grey_16.png");
+ eventsTab.registerSubTabs("History");
contentTab = new TwoLevelTab("Content", "/images/icons/Content_grey_16.png");
contentTab.registerSubTabs("Deployed","New","Subscriptions","History");
@@ -169,11 +171,12 @@ public class ResourceDetailView extends VLayout implements ViewRenderer, Resourc
operationsTab.updateSubTab("History", OperationHistoryView.getResourceHistoryView(resource.getId()));
- configurationTab.updateSubTab("Current", new ConfigurationEditor(resource.getId(), resource.getResourceType().getId()));
+ configurationTab.updateSubTab("Current", new ResourceConfigurationEditView(resource));
configurationTab.updateSubTab("History", ConfigurationHistoryView.getHistoryOf(resource.getId()));
alertsTab.updateSubTab("History", new ResourceAlertHistoryView(resource.getId()));
+ eventsTab.updateSubTab("History", new FullHTMLPane("/rhq/common/events/history-plain.xhtml?id=" + resource.getId()));
contentTab.updateSubTab("Deployed",new FullHTMLPane("/rhq/resource/content/view-plain.xhtml?id=" + resource.getId()));
contentTab.updateSubTab("New",new FullHTMLPane("/rhq/resource/content/deploy-plain.xhtml?id=" + resource.getId()));
@@ -181,7 +184,7 @@ public class ResourceDetailView extends VLayout implements ViewRenderer, Resourc
contentTab.updateSubTab("History",new FullHTMLPane("/rhq/resource/content/history-plain.xhtml?id=" + resource.getId()));
- topTabSet.setSelectedTab(selectedTab);
+// topTabSet.setSelectedTab(selectedTab);
updateTabStatus();
@@ -191,39 +194,51 @@ public class ResourceDetailView extends VLayout implements ViewRenderer, Resourc
private void updateTabStatus() {
ResourceTypeRepository.Cache.getInstance().getResourceTypes(resource.getResourceType().getId(),
- EnumSet.of(ResourceTypeRepository.MetadataType.content, ResourceTypeRepository.MetadataType.operations, ResourceTypeRepository.MetadataType.events, ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
+ EnumSet.of(ResourceTypeRepository.MetadataType.content,
+ ResourceTypeRepository.MetadataType.operations,
+ ResourceTypeRepository.MetadataType.events,
+ ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
new ResourceTypeRepository.TypeLoadedCallback() {
public void onTypesLoaded(ResourceType type) {
if (type.getOperationDefinitions() == null || type.getOperationDefinitions().isEmpty()) {
+ if (topTabSet.getSelectedTabNumber() == 3) {
+ topTabSet.setSelectedTab(0);
+ }
topTabSet.disableTab(operationsTab);
} else {
topTabSet.enableTab(operationsTab);
}
if (type.getEventDefinitions() == null || type.getEventDefinitions().isEmpty()) {
+ if (topTabSet.getSelectedTabNumber() == 6) {
+ topTabSet.setSelectedTab(0);
+ }
topTabSet.disableTab(eventsTab);
} else {
topTabSet.enableTab(eventsTab);
}
if (type.getPackageTypes() == null || type.getPackageTypes().isEmpty()) {
+ if (topTabSet.getSelectedTabNumber() == 7) {
+ topTabSet.setSelectedTab(0);
+ }
+
topTabSet.disableTab(contentTab);
} else {
topTabSet.enableTab(contentTab);
}
if (type.getResourceConfigurationDefinition() == null) {
+ if (topTabSet.getSelectedTabNumber() == 5) {
+ topTabSet.setSelectedTab(0);
+ }
topTabSet.disableTab(configurationTab);
} else {
topTabSet.enableTab(configurationTab);
}
- if (topTabSet.getSelectedTab().getDisabled()) {
- topTabSet.setSelectedTab(0);
- }
-
}
});
@@ -235,7 +250,7 @@ public class ResourceDetailView extends VLayout implements ViewRenderer, Resourc
if (resource != null) {
String path = "Resource/" + resource.getId() + tabPath;
- History.newItem(path);
+ History.newItem(path, false);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
new file mode 100644
index 0000000..c939492
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
@@ -0,0 +1,102 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+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.layout.VLayout;
+import com.smartgwt.client.widgets.toolbar.ToolStrip;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
+import org.rhq.core.domain.resource.Resource;
+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.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+
+/**
+ * @author Greg Hinkle
+ */
+public class ResourceConfigurationEditView extends VLayout {
+
+
+ Resource resource;
+ ConfigurationEditor editor;
+
+ public ResourceConfigurationEditView(Resource resource) {
+ this.resource = resource;
+ }
+
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+ build();
+ }
+
+ public void build() {
+
+ ToolStrip toolStrip = new ToolStrip();
+ toolStrip.setWidth100();
+
+ toolStrip.addMember(new LayoutSpacer());
+
+ IButton saveButton = new IButton("Save");
+ saveButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ save();
+ }
+ });
+// saveButton.disable();
+ toolStrip.addMember(saveButton);
+
+
+ editor = new ConfigurationEditor(resource.getId(), resource.getResourceType().getId());
+ editor.setOverflow(Overflow.AUTO);
+
+
+ addMember(toolStrip);
+
+ addMember(editor);
+ }
+
+ private void save() {
+ Configuration updatedConfiguration = editor.getConfiguration();
+
+
+ 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 for resource [" + resource.getName() + "]", Message.Severity.Info));
+
+ }
+ }
+ );
+
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AbstractGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AbstractGWTServiceImpl.java
index 48245f3..db3af54 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AbstractGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AbstractGWTServiceImpl.java
@@ -21,6 +21,7 @@ package org.rhq.enterprise.gui.coregui.server.gwt;
import org.rhq.core.domain.auth.Subject;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
+import org.rhq.enterprise.server.util.HibernatePerformanceMonitor;
import org.rhq.enterprise.server.util.LookupUtil;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
@@ -57,7 +58,9 @@ public abstract class AbstractGWTServiceImpl extends RemoteServiceServlet {
}
sessionSubject.set(subject);
+ long id = HibernatePerformanceMonitor.get().start();
super.service(req, resp);
+ HibernatePerformanceMonitor.get().stop(id, "GWT Service Request");
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java
index d4d9386..16062f4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java
@@ -11,6 +11,7 @@ import org.rhq.core.domain.util.PageOrdering;
import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTService;
import org.rhq.enterprise.gui.coregui.server.util.SerialUtility;
import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal;
+import org.rhq.enterprise.server.configuration.ConfigurationUpdateStillInProgressException;
import org.rhq.enterprise.server.util.LookupUtil;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
@@ -37,7 +38,7 @@ public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implemen
public Configuration getResourceConfiguration(int resourceId) {
- Configuration configuration = configurationManager.getResourceConfiguration(getSessionSubject(), resourceId);
+ Configuration configuration = configurationManager.getResourceConfiguration(getSessionSubject(), resourceId);
return SerialUtility.prepare(configuration, "ResourceConfiguration");
}
@@ -56,7 +57,15 @@ public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implemen
// TODO GH: I'd prefer a criteria based solution here
result = configurationManager.findResourceConfigurationUpdates(getSessionSubject(), resourceId, null, null, false, pc);
- return SerialUtility.prepare(result,"ConfigurationService.findResourceConfigurationUpdates");
+ return SerialUtility.prepare(result, "ConfigurationService.findResourceConfigurationUpdates");
+ }
+
+
+ public ResourceConfigurationUpdate updateResourceConfiguration(int resourceId, Configuration configuration) {
+ ResourceConfigurationUpdate update =
+ configurationManager.updateResourceConfiguration(getSessionSubject(), resourceId, configuration);
+
+ return SerialUtility.prepare(update, "ConfigurationService.updateResourceConfiguration");
}
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/events/history-plain.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/events/history-plain.xhtml
new file mode 100644
index 0000000..fc68398
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/events/history-plain.xhtml
@@ -0,0 +1,257 @@
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:onc="http://jboss.org/on/component"
+ xmlns:onf="http://jboss.org/on/function"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+
+<head>
+ <link rel="stylesheet" href="/css/win.css" type="text/css" />
+</head>
+<body>
+
+ <h:form id="eventHistoryForm" >
+
+ <a4j:keepAlive beanName="EventHistoryUIBean"/>
+
+ <c:if test="#{EventHistoryUIBean.context.resourceId != -1}">
+ <input type="hidden" name="id" value="#{EventHistoryUIBean.context.resourceId}" />
+ </c:if>
+ <c:if test="#{EventHistoryUIBean.context.groupId != -1}">
+ <input type="hidden" name="groupId" value="#{EventHistoryUIBean.context.groupId}" />
+ </c:if>
+ <c:if test="#{EventHistoryUIBean.context.parentResourceId != -1}">
+ <input type="hidden" name="parent" value="#{EventHistoryUIBean.context.parentResourceId}" />
+ </c:if>
+ <c:if test="#{EventHistoryUIBean.context.resourceTypeId != -1}">
+ <input type="hidden" name="type" value="#{EventHistoryUIBean.context.resourceTypeId}" />
+ </c:if>
+ <c:if test="#{not empty param.category}">
+ <input type="hidden" name="category" value="#{param.category}" />
+ </c:if>
+
+ <rich:panel styleClass="BlockContent">
+ <f:facet name="header">
+ <h:outputText value="Events" />
+ </f:facet>
+
+ <h:panelGrid columns="3" cellspacing="3">
+ <h:outputLabel for="sourceFilter" value="Source Filter: " />
+ <h:inputText id="sourceFilter" value="#{EventHistoryUIBean.sourceFilter}"
+ style="width: 300px;">
+ <a4j:support event="onchange"
+ status="commonStatus"
+ reRender="eventHistoryDataTable, eventHistoryDataTableScroller"
+ actionListener="#{EventHistoryUIBean.clearDataModel}" />
+ </h:inputText>
+ <rich:spacer/>
+
+ <h:outputLabel for="searchFilter" value="Details Filter: " />
+ <h:inputText id="searchFilter" value="#{EventHistoryUIBean.searchFilter}"
+ onkeypress="return ignoreEnterKey(event);"
+ style="width: 300px;" />
+ <a4j:support event="onchange"
+ status="commonStatus"
+ reRender="eventHistoryDataTable, eventHistoryDataTableScroller"
+ actionListener="#{EventHistoryUIBean.clearDataModel}" />
+ <rich:spacer/>
+
+ <h:outputLabel for="severityFilter" value="Severity Filter: " />
+ <h:selectManyCheckbox id="severityFilter" value="#{EventHistoryUIBean.severityFilter}"
+ style="width: 300px;">
+ <a4j:support event="onchange"
+ status="commonStatus"
+ reRender="eventHistoryDataTable,eventHistoryDataTableScroller"
+ actionListener="#{EventHistoryUIBean.clearDataModel}" />
+
+ <f:selectItems value="#{EventHistoryUIBean.severityFilterSelectItems}"/>
+ </h:selectManyCheckbox>
+
+ <a4j:commandButton value="GO"
+ status="commonStatus"
+ reRender="eventHistoryDataTable,eventHistoryDataTableScroller"
+ actionListener="#{EventHistoryUIBean.clearDataModel}"
+ styleClass="buttonmed">
+ <s:defaultAction />
+ </a4j:commandButton>
+ </h:panelGrid>
+
+ <br />
+
+ <ui:param name="eventHistoryDataModel" value="#{EventHistoryUIBean.dataModel}" />
+
+ <rich:dataTable id="eventHistoryDataTable"
+ value="#{eventHistoryDataModel}"
+ rows="#{PageControl.EventsHistoryList.pageSize}"
+ var="item"
+ width="100%"
+ styleClass="resources-table"
+ headerClass="tableRowHeader"
+ footerClass="on-pager-footer"
+ onRowMouseOver="this.style.backgroundColor='#E7E7E7'"
+ onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
+
+ <f:facet name="PageControlView">
+ <onc:paginationControl id="EventsHistoryList" />
+ </f:facet>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:allSelect target="selectedEvents" />
+ </f:facet>
+
+ <onc:select name="selectedEvents" value="#{item.eventId}" />
+ </rich:column>
+
+ <rich:column style="white-space: nowrap;">
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="ev.severity">
+ <h:outputText styleClass="headerText" value="Severity" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:graphicImage value="/images/icons/Events_fatal_16.png" rendered="#{item.severity == 'FATAL'}"/>
+ <h:graphicImage value="/images/icons/Events_error_16.png" rendered="#{item.severity == 'ERROR'}"/>
+ <h:graphicImage value="/images/icons/Events_warning_16.png" rendered="#{item.severity == 'WARN'}"/>
+ <h:graphicImage value="/images/icons/Events_info_16.png" rendered="#{item.severity == 'INFO'}"/>
+ <h:graphicImage value="/images/icons/Events_debug_16.png" rendered="#{item.severity == 'DEBUG'}"/>
+
+ <h:outputText value=" #{item.severity}" />
+ </rich:column>
+
+ <rich:column rendered="#{EventHistoryUIBean.context.resourceId == -1}">
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="res.name">
+ <h:outputText styleClass="headerText" value="Resource" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+ <h:outputText value="#{item.resourceName}" />
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="evs.location">
+ <h:outputText styleClass="headerText" value="Source" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+ <h:outputText value="#{onf:elideString(item.sourceLocation, 50, 'left')}" title="#{item.sourceLocation}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Detail" />
+ </f:facet>
+
+ <a4j:commandLink action="#{EventHistoryUIBean.populateEventId(item.eventId)}"
+ reRender="eventDetailsModalPanel" ajaxSingle="true"
+ limitToList="true"
+ oncomplete="Richfaces.showModalPanel('modalPanelForm:eventDetailsModalPanel')">
+ <h:outputText value="#{onf:elideString(item.eventDetail, 160, 'right')}" />
+ </a4j:commandLink>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="ev.timestamp">
+ <h:outputText styleClass="headerText" value="Time occurred" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.timestamp}" >
+ <f:converter converterId="RelativeDurationConverter" />
+ </h:outputText>
+ </rich:column>
+
+ <f:facet name="footer">
+ <rich:columnGroup>
+ <rich:column colspan="#{EventHistoryUIBean.context.resourceId == -1 ? 6 : 5}" width="100%">
+ <onc:selectCommandButton action="#{EventHistoryUIBean.deleteSelectedEvents}"
+ value="DELETE SELECTED" target="selectedEvents" styleClass="on-pager-button buttonsmall" />
+ <h:commandButton action="#{EventHistoryUIBean.purgeAllEvents}"
+ value="PURGE ALL" styleClass="on-pager-button buttonsmall" />
+
+ <ui:param name="paginationDataTableName" value="eventHistoryDataTable" />
+ <ui:param name="paginationDataModel" value="#{eventHistoryDataModel}" />
+ <ui:param name="paginationPageControl" value="#{PageControl.EventsHistoryList}" />
+ <ui:include src="/rhq/resource/include/pagination.xhtml" />
+ </rich:column>
+ </rich:columnGroup>
+ </f:facet>
+ </rich:dataTable>
+
+ <table>
+ <tr>
+ <td>
+ <table>
+ <tr>
+ <td><onc:metric optionList="m,h,d" /></td>
+ <td>
+ <h:commandLink rendered="#{not MetricComponentUtilityUIBean.readOnly}"
+ action="#{MetricComponentUtilityUIBean.update}" >
+ <img src="/images/dash-button_go-arrow.gif" alt="Apply Metric Settings "/>
+ </h:commandLink>
+ <h:commandLink rendered="#{MetricComponentUtilityUIBean.readOnly}"
+ action="#{MetricComponentUtilityUIBean.switchToSimpleMode}">
+ <h:outputText value="Switch to Simple Mode" />
+ </h:commandLink>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </rich:panel>
+ <br />
+ </h:form>
+
+ <h:form id="modalPanelForm">
+ <rich:modalPanel id="eventDetailsModalPanel" width="600" height="450" onmaskclick="#{rich:component('eventDetailsModalPanel')}.hide()">
+ <f:facet name="header">
+ <h:outputText value="Event Details"/>
+ </f:facet>
+ <f:facet name="controls">
+ <a href="javascript:Richfaces.hideModalPanel('modalPanelForm:eventDetailsModalPanel')">Close</a>
+ </f:facet>
+ <ui:param name="event" value="#{EventHistoryUIBean.selectedEvent}" />
+ <h:panelGroup rendered="#{not empty event}">
+ <table width="100%">
+ <tr style="width: 200px">
+ <td style="font-weight: bold;">Resource: </td>
+ <td><h:outputText value="#{onf:getResource(event.resourceId).name}" /></td>
+ </tr>
+ <tr>
+ <td style="font-weight: bold;">Source: </td>
+ <td><h:outputText value="#{event.sourceLocation}" /></td>
+ </tr>
+ <tr>
+ <td style="font-weight: bold;">Severity: </td>
+ <td style="white-space: nowrap;">
+ <h:graphicImage value="/images/icons/Events_fatal_16.png" rendered="#{event.severity == 'FATAL'}"/>
+ <h:graphicImage value="/images/icons/Events_error_16.png" rendered="#{event.severity == 'ERROR'}"/>
+ <h:graphicImage value="/images/icons/Events_warning_16.png" rendered="#{event.severity == 'WARN'}"/>
+ <h:graphicImage value="/images/icons/Events_info_16.png" rendered="#{event.severity == 'INFO'}"/>
+ <h:graphicImage value="/images/icons/Events_debug_16.png" rendered="#{event.severity == 'DEBUG'}"/>
+
+ <h:outputText value="#{event.severity}" /></td>
+ </tr>
+ <tr>
+ <td style="font-weight: bold; vertical-align: top;">Details: </td>
+ <td>
+ <div style="height: 300px; border-style: inset; border-width: 1px; overflow: auto">
+ <h:outputText value="#{event.eventDetail}" />
+ </div>
+ </td>
+ </tr>
+ </table>
+ </h:panelGroup>
+ </rich:modalPanel>
+ </h:form>
+
+</body>
+</html>
+
commit 3f11656d1e60af57f84f65db21d1702260348113
Merge: 1b30327... bfe81d5...
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Mon Mar 15 13:20:17 2010 +0100
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
commit 1b3032748116d236e5deb1224eb39b5320a6a2be
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Mon Mar 15 13:17:12 2010 +0100
Show notification logs for fired alerts.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
index 7bc3fcb..c941ce3 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
@@ -22,6 +22,7 @@ import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.core.DataClass;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
@@ -34,6 +35,7 @@ import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.core.domain.alert.Alert;
import org.rhq.core.domain.alert.AlertCondition;
import org.rhq.core.domain.alert.AlertConditionLog;
+import org.rhq.core.domain.alert.notification.AlertNotificationLog;
import org.rhq.core.domain.criteria.AlertCriteria;
import org.rhq.core.domain.measurement.MeasurementConverterClient;
import org.rhq.core.domain.util.PageList;
@@ -235,6 +237,22 @@ public class AlertDataSource extends RPCDataSource<Alert> {
String recoveryInfo = AlertFormatUtility.getAlertRecoveryInfo(from);
record.setAttribute("recoveryInfo", recoveryInfo);
+
+ // Alert notification logs
+ DataClass[] notifications = new DataClass[from.getAlertNotificationLogs().size()];
+ int i = 0;
+ for(AlertNotificationLog log : from.getAlertNotificationLogs()) {
+ DataClass dc = new DataClass();
+ dc.setAttribute("sender",log.getSender());
+ dc.setAttribute("status",log.getResultState());
+ dc.setAttribute("message",log.getMessage());
+ dc.setAttribute("allEmails",log.getAllEmails());
+ dc.setAttribute("badEmails",log.getBadEmails());
+
+ notifications[i++] = dc;
+
+ }
+ record.setAttribute("notificationLogs",notifications);
return record;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
index 17d6416..0e4bf28 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
@@ -18,16 +18,26 @@
*/
package org.rhq.enterprise.gui.coregui.client.alert;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.smartgwt.client.core.DataClass;
import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.data.Record;
import com.smartgwt.client.data.SortSpecifier;
import com.smartgwt.client.types.SortDirection;
import com.smartgwt.client.widgets.HTMLFlow;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionEvent;
-import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.VLayout;
+
+import org.rhq.core.domain.alert.notification.AlertNotificationLog;
import org.rhq.core.domain.criteria.AlertCriteria;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
@@ -52,6 +62,9 @@ public class AlertsView extends VLayout {
private Table table;
private AlertDataSource dataSource;
private HTMLFlow detailsContent;
+ private DynamicForm detailsTable;
+ private VerticalPanel vpanel;
+ private static final String SENDER = "sender";
public AlertsView(Criteria criteria, String[] excludedFieldNames) {
this.table = new Table(TITLE, criteria, SORT_SPECIFIERS, excludedFieldNames);
@@ -99,10 +112,17 @@ public class AlertsView extends VLayout {
String name = record.getAttribute("name");
String id = record.getAttribute("id");
// TODO: Finish this.
- contents = "Details for alert '" + name + "' with id " + id + "...<h2>TODO</h2>";
+ contents = "Details for alert '" + name + "' with id " + id ;
+ detailsTable = getDetailsTableForAlertId(id);
+ vpanel.clear();
+ vpanel.add(detailsTable);
+ vpanel.add(getNotificationsForAlertId(record.getAttributeAsRecordArray("notificationLogs")));
+// vpanel.redraw();
+
} else {
contents = "Select a single alert above to display its details here.";
+ detailsTable = new DynamicForm(); // empty ?
}
AlertsView.this.detailsContent.setContents(contents);
}
@@ -111,13 +131,61 @@ public class AlertsView extends VLayout {
addMember(this.table);
// Add the details panel as the bottom half of the view.
- HLayout detailsPane = new HLayout();
- detailsPane.setWidth100();
- detailsPane.setHeight("50%");
+ vpanel = new VerticalPanel();
+ vpanel.setHeight("50%");
+ vpanel.setTitle("Details for alert");
this.detailsContent = new HTMLFlow("Select a single alert above to display its details here.");
this.detailsContent.setWidth100();
- detailsPane.addMember(this.detailsContent);
- addMember(detailsPane);
+ vpanel.add(detailsContent);
+
+ detailsTable = new DynamicForm(); // empty?
+ vpanel.add(detailsTable);
+ addMember(vpanel);
+
+ }
+
+ private DynamicForm getDetailsTableForAlertId(String id) {
+
+ DynamicForm form = new DynamicForm();
+ form.setNumCols(4);
+ form.setWrapItemTitles(false);
+ form.setLeft("10%");
+ form.setWidth("80%");
+
+ final TextItem nameTextItem = new TextItem("name", "Name");
+ nameTextItem.setRequired(true);
+ nameTextItem.setValue("Hello World");
+
+ final TextItem idTextItem = new TextItem("id", "Id");
+ idTextItem.setRequired(true);
+ idTextItem.setValue(id);
+ form.setItems(nameTextItem,idTextItem);
+
+ return form;
+ }
+
+ private Table getNotificationsForAlertId(DataClass[] input) {
+
+ Table notifTable = new Table("Notifications",false);
+ notifTable.setWidth100();
+ ListGrid grid = notifTable.getListGrid();
+ grid.setData((Record[]) input);
+
+
+ ListGridField sender = new ListGridField(SENDER,"Sender");
+ sender.setWidth("10%");
+ ListGridField status = new ListGridField("status","Result");
+ status.setWidth("10%");
+ ListGridField message = new ListGridField("message","Message");
+ message.setWidth("30%");
+ ListGridField allEmails = new ListGridField("allEmails","All Emails");
+ allEmails.setWidth("25%");
+ ListGridField badEmails = new ListGridField("badEmails","Bad Emails");
+ badEmails.setWidth("25%");
+
+ grid.setFields(sender,status,message,allEmails,badEmails);
+
+ return notifTable;
}
protected Criteria getCriteria() {
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 d11fad9..1c7c68c 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
@@ -84,18 +84,26 @@ public class Table extends VLayout {
private ArrayList<TableActionInfo> tableActions = new ArrayList<TableActionInfo>();
public Table(String tableTitle) {
- this(tableTitle, null, null, null);
+ this(tableTitle, null, null, null, true);
}
public Table(String tableTitle, Criteria criteria) {
- this(tableTitle, criteria, null, null);
+ this(tableTitle, criteria, null, null, true);
}
public Table(String tableTitle, SortSpecifier[] sortSpecifiers) {
- this(tableTitle, null, sortSpecifiers, null);
+ this(tableTitle, null, sortSpecifiers, null, true);
+ }
+
+ public Table(String tableTitle, boolean autoFetchData) {
+ this(tableTitle, null, null, null, autoFetchData);
}
public Table(String tableTitle, Criteria criteria, SortSpecifier[] sortSpecifiers, String[] excludedFieldNames) {
+ this(tableTitle,criteria,sortSpecifiers,excludedFieldNames,true);
+ }
+ public Table(String tableTitle, Criteria criteria, SortSpecifier[] sortSpecifiers, String[] excludedFieldNames,
+ boolean autoFetchData) {
super();
setWidth100();
@@ -119,7 +127,7 @@ public class Table extends VLayout {
}
listGrid.setWidth100();
listGrid.setHeight100();
- listGrid.setAutoFetchData(true);
+ listGrid.setAutoFetchData(autoFetchData);
listGrid.setAutoFitData(Autofit.HORIZONTAL);
listGrid.setAlternateRecordStyles(true);
listGrid.setResizeFieldsInRealTime(false);
commit bfe81d5b5c4d2fa10cfe63f7d3368dedcb969f1d
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Fri Mar 12 22:28:05 2010 -0500
tidy up deps a bit
diff --git a/modules/enterprise/gui/coregui/pom.xml b/modules/enterprise/gui/coregui/pom.xml
index 343d40d..d498c61 100644
--- a/modules/enterprise/gui/coregui/pom.xml
+++ b/modules/enterprise/gui/coregui/pom.xml
@@ -40,6 +40,35 @@
<dependencies>
+ <!-- ============= Internal Deps ============= -->
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-domain</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ <!-- by rhq.ear (as ejb-jar) -->
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-enterprise-server</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ <!-- by rhq.ear (as ejb-jar) -->
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-util</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ <!-- by rhq.ear -->
+ </dependency>
+
+
+ <!-- =============== 3rd Party Deps =============== -->
+
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
@@ -73,7 +102,7 @@
</dependency>
-->
- <!-- The graphing library -->
+ <!-- the GWT graphing library -->
<dependency>
<groupId>ca.nanometrics</groupId>
<artifactId>gflot</artifactId>
@@ -109,35 +138,6 @@
<!-- by JBossAS itself, which the container build has packaged with 1.6.5 -->
</dependency>
-
- <!-- Internal Deps -->
-
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-core-domain</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- <!-- by rhq.ear (as ejb-jar) -->
- </dependency>
-
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-enterprise-server</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- <!-- by rhq.ear (as ejb-jar) -->
- </dependency>
-
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-core-util</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- <!-- by rhq.ear -->
- </dependency>
-
- <!-- 3rd Party Deps -->
-
<!-- needed for referenced domain entities that use Hibernate annotations (due to JDK5 bug) -->
<dependency>
<groupId>hibernate-annotations</groupId>
commit 4988af3682cac95727dd431d05923c8f7ac6b05e
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Fri Mar 12 22:23:49 2010 -0500
reformat XML
diff --git a/modules/enterprise/gui/coregui/pom.xml b/modules/enterprise/gui/coregui/pom.xml
index 604d3a1..343d40d 100644
--- a/modules/enterprise/gui/coregui/pom.xml
+++ b/modules/enterprise/gui/coregui/pom.xml
@@ -1,5 +1,6 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
<modelVersion>4.0.0</modelVersion>
<parent>
@@ -21,7 +22,8 @@
</developerConnection>
</scm>
- <properties>
+
+ <properties>
<!-- dependency versions -->
<gwt.version>2.0.3</gwt.version>
@@ -35,6 +37,7 @@
<product.help.doc.root>http://support.rhq-project.org/display/RHQ/</product.help.doc.root>
</properties>
+
<dependencies>
<dependency>
@@ -78,31 +81,33 @@
</dependency>
<!-- for file uploads -->
- <dependency>
- <groupId>commons-fileupload</groupId>
- <artifactId>commons-fileupload</artifactId>
- <version>1.2</version>
- </dependency>
+ <dependency>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ <version>1.2</version>
+ </dependency>
<dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>1.3.1</version>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.3.1</version>
</dependency>
<dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.0.4</version>
- <scope>provided</scope> <!-- by JBossAS -->
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.0.4</version>
+ <scope>provided</scope>
+ <!-- by JBossAS -->
</dependency>
<dependency>
- <groupId>org.opensymphony.quartz</groupId>
- <artifactId>quartz</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
- <scope>provided</scope> <!-- by JBossAS itself, which the container build has packaged with 1.6.5 -->
- </dependency>
+ <groupId>org.opensymphony.quartz</groupId>
+ <artifactId>quartz</artifactId>
+ <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
+ <scope>provided</scope>
+ <!-- by JBossAS itself, which the container build has packaged with 1.6.5 -->
+ </dependency>
<!-- Internal Deps -->
@@ -180,10 +185,10 @@
</dependencies>
+
<build>
<finalName>coregui</finalName>
-
<resources>
<resource>
<directory>src/main/java</directory>
@@ -296,6 +301,7 @@
</build>
+
<profiles>
<profile>
<id>dev</id>
@@ -386,9 +392,9 @@
</build>
</profile>
-
</profiles>
+
<repositories>
<repository>
<id>smartgwt</id>
commit a6d6ad1835155c86c425a42e6cc0756c55e98d96
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Fri Mar 12 22:21:00 2010 -0500
upgrade GWT from 2.0.0 to 2.0.3
diff --git a/modules/enterprise/gui/coregui/pom.xml b/modules/enterprise/gui/coregui/pom.xml
index 2ce8056..604d3a1 100644
--- a/modules/enterprise/gui/coregui/pom.xml
+++ b/modules/enterprise/gui/coregui/pom.xml
@@ -21,13 +21,9 @@
</developerConnection>
</scm>
- <properties>
-
- <scm.module.path>modules/enterprise/gui/coregui/</scm.module.path>
-
+ <properties>
<!-- dependency versions -->
-
- <gwt.version>2.0.0</gwt.version>
+ <gwt.version>2.0.3</gwt.version>
<product.shortName>RHQ</product.shortName>
<product.name>RHQ</product.name>
@@ -41,7 +37,6 @@
<dependencies>
-
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
@@ -62,7 +57,6 @@
<version>2.0</version>
</dependency>-->
-
<dependency>
<groupId>com.smartgwt</groupId>
<artifactId>smartgwt</artifactId>
@@ -76,7 +70,6 @@
</dependency>
-->
-
<!-- The graphing library -->
<dependency>
<groupId>ca.nanometrics</groupId>
@@ -84,9 +77,6 @@
<version>1.0.0</version>
</dependency>
-
-
-
<!-- for file uploads -->
<dependency>
<groupId>commons-fileupload</groupId>
@@ -143,7 +133,6 @@
<!-- 3rd Party Deps -->
-
<!-- needed for referenced domain entities that use Hibernate annotations (due to JDK5 bug) -->
<dependency>
<groupId>hibernate-annotations</groupId>
commit 5b8fcd992d9ca617cfc1a746024c042a7efa692d
Merge: 61dfe4d... f345d00...
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Fri Mar 12 15:42:23 2010 -0500
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
commit 61dfe4d6cb8911ac71bbc425ae72aeed1cde77f9
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Fri Mar 12 15:41:59 2010 -0500
improve default text for "breadcrumbs" ui:define in main.xhtml; override this ui:define in largeenv.xhtml
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/largeenv.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/largeenv.xhtml
index c133e64..ba2c0e7 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/largeenv.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/largeenv.xhtml
@@ -17,6 +17,10 @@
<ui:param name="pageTitle" value="Large Environment Preparation"/>
+ <ui:define name="breadcrumbs">
+ Large Environment Preparation
+ </ui:define>
+
<ui:define name="body">
<br/>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/layout/main.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/layout/main.xhtml
index 3d034e6..00666c1 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/layout/main.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/layout/main.xhtml
@@ -17,7 +17,7 @@
<ui:define name="body-area">
<div id="content-full" style="width: 100%; height: 100%; overflow: auto;">
<h:panelGroup id="Breadcrumb" layout="block" rendered="#{empty disableBreadcrumbs}">
- <ui:insert name="breadcrumbs">Default Full Screen Content</ui:insert>
+ <ui:insert name="breadcrumbs">Default Full Screen Breadcrumbs</ui:insert>
</h:panelGroup>
<p />
<ui:insert name="body">Default Full Screen Body</ui:insert>
commit d75aa7dfad321051afa826a62e1468db30528972
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Fri Mar 12 15:40:19 2010 -0500
add a few more user pref names that were missing
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferenceNames.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferenceNames.java
index 751c54b..cdf586e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferenceNames.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferenceNames.java
@@ -1,10 +1,10 @@
package org.rhq.enterprise.gui.coregui.client.util.preferences;
/**
- * Names of user preference properties. The default values for these preferences are stored in
- * portal-war/WEB-INF/DefaultUserPreferences.properties and are populated for a user the first
- * time that user logs in to portal-war. The default values are also stated in the Javadoc
- * below for convenience sake.
+ * Names of {@link org.rhq.core.domain.auth.Subject#getUserConfiguration() user preference properties}. The default
+ * values for these preferences are stored in portal-war/WEB-INF/DefaultUserPreferences.properties and are populated for
+ * a user the first time that user logs in to portal-war. For convenience sake, the default values are also stated in
+ * the Javadoc below.
*
* @author Ian Springer
*/
@@ -75,11 +75,17 @@ public abstract class UserPreferenceNames {
public static final String RESOURCE_HEALTH_ALERTS = ".dashContent.resourcehealth.alerts";
/**
- * List of favorite Resource id's, delimited by '|' characters. Default is "".
+ * List of favorite {@link org.rhq.core.domain.resource.Resource} id's, delimited by '|' characters. Default is "".
*/
public static final String RESOURCE_HEALTH_RESOURCES = ".dashContent.resourcehealth.resources";
/**
+ * List of favorite {@link org.rhq.core.domain.resource.group.ResourceGroup} id's, delimited by '|' characters.
+ * Default is "".
+ */
+ public static final String GROUP_HEALTH_GROUPS = ".dashContent.grouphealth.groups";
+
+ /**
* Default is 24.
*/
public static final String RECENTLY_APPROVED_RANGE = ".dashContent.recentlyApproved.range";
@@ -195,12 +201,12 @@ public abstract class UserPreferenceNames {
public static final String MONITOR_VISIBILITY_THRESHOLD = ".resource.common.monitor.visibility.metricThreshold";
/**
- * Default is "".
+ * Favorite Charts portlet: List of chart queries. Default is "".
*/
public static final String CHARTS = ".dashContent.charts";
/**
- * The time, in seconds, between automatic refreshes of the DashBoard and
+ * The time, in seconds, between automatic refreshes of the Dashboard and
* the monitoring Indicator charts. 0 (zero) indicates no refreshes are to happen.
* A refresh period longer than the current session timeout, e.g. 1800 seconds (30 minutes),
* would likely require the user to log back into the Portal when the refresh occurs.
@@ -213,6 +219,24 @@ public abstract class UserPreferenceNames {
*/
public static final String GROUP_CONFIGURATION_TIMEOUT_PERIOD = ".group.configuration.timeout.period";
+ /**
+ * A pipe-delimited list containing the last 3 URLs the user has visited. This is used by a workaround for the
+ * JSF VIewExpiredException issue when the user tries to click the browser's Back button.
+ */
+ public static final String LAST_URL = ".last.url";
+
+ /**
+ * List of recently visited Resources and Groups. Entries are delimited by commas. The format of each entry is
+ * id|type|name (e.g. 10001|platform|MyPlatform).
+ */
+ public static final String RECENT_RESOURCES = ".recent.resources";
+
+ /**
+ * View mode for Browse Resource page - "CHART" or "LIST". This is most likely obsolete if we switch to GWT, since
+ * we probably won't provide a CHART mode.
+ */
+ public static final String RESOURCE_BROWSER_VIEW_MODE = ".resource.browser.view";
+
private UserPreferenceNames() {
}
}
commit f345d00043d60173ae54176cdc58d3aeeb47e787
Merge: 7dbfbc2... ce1467a...
Author: John Sanda <john(a)localhost.localdomain>
Date: Fri Mar 12 13:41:30 2010 -0500
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
commit 7dbfbc2ebf5d85b52632305990d81fd68e4150ad
Author: John Sanda <john(a)localhost.localdomain>
Date: Fri Mar 12 13:40:53 2010 -0500
Initial attempt at building table for recently added resources portlet
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
index 9b318b6..596ea76 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
@@ -19,6 +19,7 @@
package org.rhq.enterprise.gui.coregui.client.dashboard;
import org.rhq.enterprise.gui.coregui.client.admin.roles.RolesView;
+import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.RecentlyAddedView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSearchView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.SmallGraphView;
@@ -138,15 +139,16 @@ public class DashboardView extends VLayout {
int nextInt = Random.nextInt() % 3;
- if (nextInt == 0) {
- ResourceSearchView item = new ResourceSearchView();
- newPortlet.addItem(item);
-
- } else if (nextInt == 1) {
- newPortlet.addItem(new RolesView());
- } else {
- newPortlet.addItem(new SummaryCountsView());
- }
+// if (nextInt == 0) {
+// ResourceSearchView item = new ResourceSearchView();
+// newPortlet.addItem(item);
+//
+// } else if (nextInt == 1) {
+// newPortlet.addItem(new RolesView());
+// } else {
+// newPortlet.addItem(new SummaryCountsView());
+// }
+ newPortlet.addItem(new RecentlyAddedView());
newPortlet.setHeight(350);
newPortlet.setVisible(false);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/RecentlyAddedResource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/RecentlyAddedResource.java
new file mode 100644
index 0000000..db4205a
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/RecentlyAddedResource.java
@@ -0,0 +1,78 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package org.rhq.enterprise.gui.coregui.client.dashboard.portlets;
+
+import com.google.gwt.user.client.rpc.IsSerializable;
+
+/**
+ * This class is just for use in prototyping the TreeGrid and DataSource classes.
+ *
+ * @author John Sanda
+ */
+public class RecentlyAddedResource implements IsSerializable {
+
+ private RecentlyAddedResource parent;
+
+ private String resourceName;
+
+ private String timestamp;
+
+ public RecentlyAddedResource() {
+ }
+
+ public RecentlyAddedResource(String resourceName, String timestamp) {
+ this(resourceName, timestamp, null);
+ }
+
+ public RecentlyAddedResource(String resourceName, String timestamp, RecentlyAddedResource parent) {
+ this.resourceName = resourceName;
+ this.timestamp = timestamp;
+ this.parent = parent;
+ }
+
+ public String getResourceName() {
+ return resourceName;
+ }
+
+ public void setResourceName(String resourceName) {
+ this.resourceName = resourceName;
+ }
+
+ public String getTimestamp() {
+ return timestamp;
+ }
+
+ public void setTimestamp(String timestamp) {
+ this.timestamp = timestamp;
+ }
+
+ public RecentlyAddedResource getParent() {
+ return parent;
+ }
+
+ public void setParent(RecentlyAddedResource parent) {
+ this.parent = parent;
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/RecentlyAddedResourceDS.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/RecentlyAddedResourceDS.java
new file mode 100644
index 0000000..9e0d690
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/RecentlyAddedResourceDS.java
@@ -0,0 +1,134 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package org.rhq.enterprise.gui.coregui.client.dashboard.portlets;
+
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.data.DataSource;
+import com.smartgwt.client.data.DataSourceField;
+import com.smartgwt.client.types.DSDataFormat;
+import com.smartgwt.client.types.FieldType;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.tree.TreeNode;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class RecentlyAddedResourceDS extends DataSource {
+
+ boolean fetched;
+
+ public RecentlyAddedResourceDS() {
+ setClientOnly(false);
+ setDataFormat(DSDataFormat.CUSTOM);
+ DataSourceField resourceNameField = new DataSourceField("resourceName", FieldType.TEXT, "Resource Name");
+ resourceNameField.setPrimaryKey(true);
+
+ DataSourceField timestampField = new DataSourceField("timestamp", FieldType.TEXT, "Date/Time");
+
+ setFields(resourceNameField, timestampField);
+ }
+
+ @Override
+ protected Object transformRequest(DSRequest request) {
+ String requestId = request.getRequestId();
+ DSResponse response = new DSResponse();
+ response.setAttribute("clientContext", request.getAttributeAsObject("clientContext"));
+ // Asume success
+ response.setStatus(0);
+ switch (request.getOperationType()) {
+ case ADD:
+ //executeAdd(lstRec, true);
+ break;
+ case FETCH:
+ executeFetch(requestId, request, response);
+ break;
+ case REMOVE:
+ //executeRemove(lstRec);
+ break;
+ case UPDATE:
+ //executeAdd(lstRec, false);
+ break;
+
+ default:
+ break;
+ }
+
+ return request.getData();
+ }
+
+ public void executeFetch(String requestId, DSRequest request, DSResponse response) {
+ if (fetched) {
+ return;
+ }
+ PageList<RecentlyAddedResource> list = new PageList<RecentlyAddedResource>();
+ RecentlyAddedResource platform1 = new RecentlyAddedResource("Platform 1", "today");
+ RecentlyAddedResource server1 = new RecentlyAddedResource("Server 1", "today", platform1);
+ RecentlyAddedResource service1 = new RecentlyAddedResource("Service 1", "today", server1);
+
+ RecentlyAddedResource platform2 = new RecentlyAddedResource("Platform 2", "today");
+ RecentlyAddedResource server2 = new RecentlyAddedResource("Server 2", "today", platform2);
+ RecentlyAddedResource service2 = new RecentlyAddedResource("Service 2", "today", server2);
+
+ list.add(platform1);
+ list.add(server1);
+ list.add(service1);
+ list.add(platform2);
+ list.add(server2);
+ list.add(service2);
+
+ response.setData(buildNodes(list));
+ fetched = true;
+
+ processResponse(requestId, response);
+ }
+
+ private TreeNode[] buildNodes(List<RecentlyAddedResource> list) {
+ TreeNode[] treeNodes = new TreeNode[list.size()];
+ for (int i = 0; i < list.size(); ++i) {
+ treeNodes[i] = new RecentlyAddedTreeNode(list.get(i));
+ }
+ return treeNodes;
+ }
+
+ static class RecentlyAddedTreeNode extends TreeNode {
+ private RecentlyAddedResource recentlyAdded;
+
+ public RecentlyAddedTreeNode(RecentlyAddedResource recentlyAdded) {
+ this.recentlyAdded = recentlyAdded;
+ setID(recentlyAdded.getResourceName());
+ if (recentlyAdded.getParent() != null) {
+ setParentID(recentlyAdded.getParent().getResourceName());
+ }
+
+ setAttribute("resourceName", recentlyAdded.getResourceName());
+ setAttribute("timestamp", recentlyAdded.getTimestamp());
+ setIsFolder(recentlyAdded.getResourceName().startsWith("Platform"));
+ }
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/RecentlyAddedView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/RecentlyAddedView.java
new file mode 100644
index 0000000..e177101
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/RecentlyAddedView.java
@@ -0,0 +1,50 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package org.rhq.enterprise.gui.coregui.client.dashboard.portlets;
+
+import com.smartgwt.client.data.DataSource;
+import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.layout.VLayout;
+import com.smartgwt.client.widgets.tree.TreeGrid;
+import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+
+public class RecentlyAddedView extends VLayout {
+
+ public RecentlyAddedView() {
+ TreeGrid treeGrid = new TreeGrid();
+ treeGrid.setTitle("Recently Added Resources");
+ treeGrid.setResizeFieldsInRealTime(true);
+ treeGrid.setTreeFieldTitle("Resource Name");
+
+ ListGridField resourceNameField = new ListGridField("resourceName", "Resource Name");
+ ListGridField timestampField = new ListGridField("timestamp", "Date//Time");
+
+ treeGrid.setFields(resourceNameField, timestampField);
+ treeGrid.setDataSource(new RecentlyAddedResourceDS());
+ treeGrid.fetchData();
+
+ addMember(treeGrid);
+ }
+
+}
commit ce1467ae34206b5f1a272fa777cf3d9617ea3a72
Author: Joseph Marques <joseph(a)redhat.com>
Date: Fri Mar 12 13:28:52 2010 -0500
temporary workaround for compilation error when building the web services module
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerLocal.java
index df7758a..8be7a95 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerLocal.java
@@ -18,6 +18,8 @@
*/
package org.rhq.enterprise.server.bundle;
+import java.util.Map;
+
import javax.ejb.Local;
import org.rhq.core.domain.auth.Subject;
@@ -65,4 +67,8 @@ public interface BundleManagerLocal extends BundleManagerRemote {
*/
BundleDeployment createBundleDeployment(Subject subject, int bundleDeployDefinitionId, int resourceId)
throws Exception;
+
+ // added here because the same method in @Remote was commented out to bypass a WSProvide issue
+ Map<String, Boolean> getAllBundleVersionFilenames(Subject subject, int bundleVersionId) throws Exception;
+
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java
index eb077e8..63579cc 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java
@@ -20,7 +20,6 @@ package org.rhq.enterprise.server.bundle;
import java.io.InputStream;
import java.util.List;
-import java.util.Map;
import java.util.Set;
import javax.ejb.Remote;
@@ -267,9 +266,11 @@ public interface BundleManagerRemote {
* @return map keyed on filenames whose value indicates if a bundle file exists for the file or not
* @throws Exception
*/
+ /* comment back in when someone writes an adapter to support Map un/marshalling
Map<String, Boolean> getAllBundleVersionFilenames( //
@WebParam(name = "subject") Subject subject, //
@WebParam(name = "bundleVersionId") int bundleVersionId) throws Exception;
+ */
/**
* Deploy the bundle as described in the provided deploy definition to the specified resource.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
index 6908666..3f6c7cb 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
@@ -414,9 +414,11 @@ public class WebservicesManagerBean implements WebservicesRemote {
return bundleManager.getBundleVersionFilenames(subject, bundleVersionId, withoutBundleFileOnly);
}
+ /*
public Map<String, Boolean> getAllBundleVersionFilenames(Subject subject, int bundleVersionId) throws Exception {
return bundleManager.getAllBundleVersionFilenames(subject, bundleVersionId);
}
+ */
public BundleDeployment scheduleBundleDeployment(Subject subject, int bundleDeployDefinitionId, int resourceId)
throws Exception {
commit fcdda25ef94a6a769b74add19feba745f138f328
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Fri Mar 12 12:40:58 2010 -0500
Further integration of the error handling strategy
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java
index 097cfd7..663350a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java
@@ -95,8 +95,7 @@ public class RolesDataSource extends RPCDataSource<Role> {
roleService.findRolesByCriteria(criteria, new AsyncCallback<PageList<Role>>() {
public void onFailure(Throwable caught) {
- Window.alert("Failed to load " + caught.getMessage());
- System.err.println("Failed to fetch Resource Data");
+ CoreGUI.getErrorHandler().handleError("Failed to fetch Roles Data", caught);
response.setStatus(RPCResponse.STATUS_FAILURE);
processResponse(request.getRequestId(), response);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java
index 11380af..5673954 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java
@@ -126,8 +126,7 @@ public class UsersDataSource extends RPCDataSource<Subject> {
subjectService.findSubjectsByCriteria(criteria, new AsyncCallback<PageList<Subject>>() {
public void onFailure(Throwable caught) {
- Window.alert("Failed to load " + caught.getMessage());
- System.err.println("Failed to fetch Resource Data");
+ CoreGUI.getErrorHandler().handleError("Failed to fetch users data", caught);
response.setStatus(RPCResponse.STATUS_FAILURE);
processResponse(request.getRequestId(), response);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
index 7bc3fcb..cc6bb96 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
@@ -147,8 +147,7 @@ public class AlertDataSource extends RPCDataSource<Alert> {
this.alertService.findAlertsByCriteria(criteria, new AsyncCallback<PageList<Alert>>() {
public void onFailure(Throwable caught) {
- Window.alert("Failed to fetch Alerts - cause: " + caught);
- System.err.println("Failed to fetch Alerts - cause: " + caught);
+ CoreGUI.getErrorHandler().handleError("Failed to fetch alerts data", caught);
response.setStatus(RPCResponse.STATUS_FAILURE);
processResponse(request.getRequestId(), response);
}
@@ -264,7 +263,7 @@ public class AlertDataSource extends RPCDataSource<Alert> {
}
public void onFailure(Throwable caught) {
- Window.alert("Failed to acknowledge Alerts with id's: " + Arrays.toString(alertIds) + " - cause: " + caught);
+ CoreGUI.getErrorHandler().handleError("Failed to acknowledge Alerts with id's: " + Arrays.toString(alertIds), caught);
System.err.println("Failed to acknowledge Alerts with id's " + Arrays.toString(alertIds) + " - cause: " + caught);
}
});
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 f096cc2..89bee8b 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
@@ -34,6 +34,7 @@ import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
@@ -105,8 +106,7 @@ public class ResourceDatasource extends RPCDataSource<Resource> {
resourceService.findResourcesByCriteria(criteria, new AsyncCallback<PageList<Resource>>() {
public void onFailure(Throwable caught) {
- Window.alert("Failed to load " + caught.getMessage());
- System.err.println("Failed to fetch Resource Data");
+ CoreGUI.getErrorHandler().handleError("Failed to fetch resource data", caught);
response.setStatus(RPCResponse.STATUS_FAILURE);
processResponse(request.getRequestId(), response);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceSummaryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceSummaryView.java
index 2793d5d..58d0d08 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceSummaryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceSummaryView.java
@@ -24,6 +24,7 @@ import org.rhq.core.domain.measurement.MeasurementDataTrait;
import org.rhq.core.domain.measurement.MeasurementDefinition;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
@@ -88,6 +89,7 @@ public class ResourceSummaryView extends DynamicForm implements ResourceSelectLi
new AsyncCallback<List<MeasurementDataTrait>>() {
public void onFailure(Throwable caught) {
SC.say("Failed to load traits");
+ CoreGUI.getErrorHandler().handleError("Failed to load traits information for resource",caught);
}
public void onSuccess(List<MeasurementDataTrait> result) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
index d849cfb..67417dd 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
@@ -44,6 +44,7 @@ import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.ResourceSubCategory;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
@@ -154,8 +155,7 @@ public class ResourceTreeDatasource extends DataSource {
resourceService.findResourcesByCriteria(criteria, new AsyncCallback<PageList<Resource>>() {
public void onFailure(Throwable caught) {
- Window.alert("Failed to load " + caught.getMessage());
- System.err.println("Failed to fetch resources");
+ CoreGUI.getErrorHandler().handleError("Failed to load resource data for tree", caught);
response.setStatus(RPCResponse.STATUS_FAILURE);
processResponse(requestId, response);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
index 7adabb8..f2dd8b8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
@@ -30,6 +30,7 @@ import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.InventoryView;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.util.SC;
@@ -94,11 +95,12 @@ public class ResourceView extends HLayout implements ViewRenderer {
} else {
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterId(resourceId);
- criteria.fetchParentResource(true);
+ //criteria.fetchParentResource(true);
resourceService.findResourcesByCriteria(criteria, new AsyncCallback<PageList<Resource>>() {
public void onFailure(Throwable caught) {
- SC.say("Failed to load Resource with id " + resourceId + ": " + caught);
- // TODO: Display this error in a red box at top of page instead?
+ CoreGUI.getMessageCenter().notify(new Message("Resource with id [" + resourceId +
+ "] does not exist or is not accessible.", Message.Severity.Warning));
+
CoreGUI.goTo(InventoryView.VIEW_PATH);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/GraphListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/GraphListView.java
index a444748..e193716 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/GraphListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/GraphListView.java
@@ -24,6 +24,7 @@ import org.rhq.core.domain.measurement.MeasurementDefinition;
import org.rhq.core.domain.measurement.composite.MeasurementDataNumericHighLowComposite;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
@@ -102,7 +103,7 @@ public class GraphListView extends VLayout implements ResourceSelectListener {
60,
new AsyncCallback<List<List<MeasurementDataNumericHighLowComposite>>>() {
public void onFailure(Throwable caught) {
- SC.say("Failed data load");
+ CoreGUI.getErrorHandler().handleError("Failed to load data for graphs",caught);
loadingLabel.setContents("failed to load graphs");
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationCreateWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationCreateWizard.java
index 5fb555f..fb17747 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationCreateWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationCreateWizard.java
@@ -132,7 +132,6 @@ public class OperationCreateWizard implements Wizard {
0,
new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
- // TODO: Implement this method.
CoreGUI.getErrorHandler().handleError("Failed to schedule operation execution",caught);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java
index d33c25f..24fc0e0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java
@@ -190,7 +190,6 @@ public class ResourceTypeRepository {
resourceTypeService.findResourceTypesByCriteria(criteria, new AsyncCallback<PageList<ResourceType>>() {
public void onFailure(Throwable caught) {
- caught.printStackTrace();
CoreGUI.getErrorHandler().handleError("Failed to load resource type metadata",caught);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java
index fb998ff..a52f987 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java
@@ -23,6 +23,7 @@ import java.util.LinkedList;
import com.google.gwt.user.client.Timer;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.AnimationEffect;
+import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.types.TitleOrientation;
import com.smartgwt.client.types.VerticalAlignment;
import com.smartgwt.client.util.SC;
@@ -52,18 +53,26 @@ import org.rhq.enterprise.gui.coregui.client.components.upload.DynamicFormHandle
*/
public class MessageCenterView extends HLayout implements MessageCenter.MessageListener {
+ public MessageCenterView() {
+ super(5);
+ setAlign(Alignment.LEFT);
+ setAlign(VerticalAlignment.CENTER);
+ setOverflow(Overflow.CLIP_H);
+ }
@Override
protected void onDraw() {
super.onDraw();
- setAlign(Alignment.LEFT);
- setAlign(VerticalAlignment.CENTER);
CoreGUI.getMessageCenter().addMessageListener(this);
final Menu recentEventsMenu = new Menu();
+
IMenuButton recentEventsButton = new IMenuButton("Messages",recentEventsMenu);
+ recentEventsButton.setTop(5);
recentEventsButton.setShowMenuBelow(false);
recentEventsButton.setAutoFit(true);
+ recentEventsButton.setValign(VerticalAlignment.CENTER);
+
recentEventsButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
LinkedList<Message> messages = CoreGUI.getMessageCenter().getMessages();
@@ -88,6 +97,7 @@ public class MessageCenterView extends HLayout implements MessageCenter.MessageL
}
});
+
addMember(recentEventsButton);
addMember(new LayoutSpacer());
@@ -132,7 +142,7 @@ public class MessageCenterView extends HLayout implements MessageCenter.MessageL
okButton.focusInItem();
okButton .addClickHandler( new com.smartgwt.client.widgets.form.fields.events.ClickHandler() {
public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent clickEvent) {
- window.destroy();
+ window.destroy();
}
});
}
commit 303205155a57fc164cec048f39b3216d469ad2ce
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Fri Mar 12 11:00:45 2010 -0500
Fixed the resource tree switching to a new resource
Now properly merges in new tree nodes
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/CustomResourceTreeGrid.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/CustomResourceTreeGrid.java
index 6f73db8..d7543fb 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/CustomResourceTreeGrid.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/CustomResourceTreeGrid.java
@@ -34,22 +34,25 @@ public class CustomResourceTreeGrid extends TreeGrid {
@Override
protected String getIcon(Record record, boolean defaultState) {
- boolean open = getTree().isOpen((TreeNode) record);
+ if (record instanceof TreeNode) {
+ boolean open = getTree().isOpen((TreeNode) record);
- if (record instanceof ResourceTreeDatasource.ResourceTreeNode) {
- Resource resource = ((ResourceTreeDatasource.ResourceTreeNode) record).getResource();
+ if (record instanceof ResourceTreeDatasource.ResourceTreeNode) {
+ Resource resource = ((ResourceTreeDatasource.ResourceTreeNode) record).getResource();
- boolean up = resource.getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP;
+ boolean up = resource.getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP;
- if (resource.getResourceType().getChildResourceTypes() == null || resource.getResourceType().getChildResourceTypes().isEmpty()) {
- return "resources/Service_" + (up ? "up" : "down") + "_16.png";
+ if (resource.getResourceType().getChildResourceTypes() == null || resource.getResourceType().getChildResourceTypes().isEmpty()) {
+ return "resources/Service_" + (up ? "up" : "down") + "_16.png";
+ } else {
+ return "resources/folder_" + (up ? "" : "down_") + (open ? "opened" : "closed") + ".png";
+ }
} else {
- return "resources/folder_" + (up ? "" : "down_") + (open ? "opened" : "closed") + ".png";
+ return "resources/folder_group_" + (open ? "opened" : "closed") + ".png";
}
- } else {
- return "resources/folder_group_" + (open ? "opened" : "closed") + ".png";
}
+ return null;
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
index dd86d70..d849cfb 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
@@ -29,6 +29,7 @@ import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.data.DataSourceField;
+import com.smartgwt.client.data.Record;
import com.smartgwt.client.data.fields.DataSourceImageField;
import com.smartgwt.client.data.fields.DataSourceTextField;
import com.smartgwt.client.rpc.RPCResponse;
@@ -106,7 +107,7 @@ public class ResourceTreeDatasource extends DataSource {
response.setStatus(0);
switch (request.getOperationType()) {
case ADD:
- //executeAdd(lstRec, true);
+ //executeAdd(request, response);
break;
case FETCH:
executeFetch(requestId, request, response);
@@ -125,6 +126,7 @@ public class ResourceTreeDatasource extends DataSource {
return request.getData();
}
+
public void executeFetch(final String requestId, final DSRequest request, final DSResponse response) {
final long start = System.currentTimeMillis();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
index ce95ec5..1d756c1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
@@ -21,11 +21,14 @@ package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail;
import org.rhq.core.domain.operation.OperationDefinition;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
+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.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.create.OperationCreateWizard;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.rpc.AsyncCallback;
@@ -50,6 +53,7 @@ import com.smartgwt.client.widgets.tree.events.NodeContextClickEvent;
import com.smartgwt.client.widgets.tree.events.NodeContextClickHandler;
import java.util.ArrayList;
+import java.util.EnumSet;
import java.util.List;
/**
@@ -102,27 +106,6 @@ public class ResourceTreeView extends VLayout {
contextMenu = new Menu();
MenuItem item = new MenuItem("Expand node");
- /* Do menu support datasources? GH: Seemingly they'll only load once when done this way
- contextMenu.setDataSource(new DataSource() {
- {
- setClientOnly(false);
- setDataProtocol(DSProtocol.CLIENTCUSTOM);
- setDataFormat(DSDataFormat.CUSTOM);
- }
- protected Object transformRequest(DSRequest request) {
- System.out.println("Looking up menu info");
- return request;
- }
- });
- */
-
- // Should only do this once, but it opens the platform node (which is not actually the root node)
-// treeGrid.addDataArrivedHandler(new DataArrivedHandler() {
-// public void onDataArrived(DataArrivedEvent dataArrivedEvent) {
-// treeGrid.getTree().openFolders(treeGrid.getTree().getChildren(treeGrid.getTree().getRoot()));
-// }
-// });
-
treeGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
public void onSelectionChanged(SelectionEvent selectionEvent) {
@@ -319,8 +302,7 @@ public class ResourceTreeView extends VLayout {
final ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();
resourceService.getResourceLineageAndSiblings(selectedResource.getId(), new AsyncCallback<List<Resource>>() {
public void onFailure(Throwable caught) {
- SC.say("Failed to lookup platform");
- System.out.println("Failed to lookup parent");
+ CoreGUI.getErrorHandler().handleError("Failed to lookup platform for tree", caught);
}
public void onSuccess(List<Resource> result) {
@@ -388,20 +370,30 @@ public class ResourceTreeView extends VLayout {
} else {
initialSelect = false;
- for (TreeNode n : ResourceTreeDatasource.build(result)) {
- treeGrid.getDataSource().addData(n);
- }
+ ResourceTypeRepository.Cache.getInstance().loadResourceTypes(result,
+ EnumSet.of(ResourceTypeRepository.MetadataType.operations, ResourceTypeRepository.MetadataType.children, ResourceTypeRepository.MetadataType.subCategory),
+ new ResourceTypeRepository.ResourceTypeLoadedCallback() {
+ public void onResourceTypeLoaded(List<Resource> result) {
+
+ treeGrid.getTree().linkNodes(ResourceTreeDatasource.build(result));
+
+ TreeNode selectedNode = treeGrid.getTree().findById(String.valueOf(selectedResource.getId()));
+ if (selectedNode != null) {
+ treeGrid.deselectAllRecords();
+ treeGrid.selectRecord(selectedNode);
+
+ TreeNode[] parents = treeGrid.getTree().getParents(selectedNode);
+ treeGrid.getTree().openFolders(parents);
+ treeGrid.getTree().openFolder(selectedNode);
+ } else {
+ CoreGUI.getMessageCenter().notify(new Message("Failed to select resource [" + selectedResource.getId() + "] in tree.", Message.Severity.Warning));
+ }
+
+
+ }
+ });
- TreeNode selectedNode = treeGrid.getTree().findById(String.valueOf(selectedResource.getId()));
- if (selectedNode != null) {
- treeGrid.deselectAllRecords();
- treeGrid.selectRecord(selectedNode);
- TreeNode[] parents = treeGrid.getTree().getParents(selectedNode);
- treeGrid.getTree().openFolders(parents);
- treeGrid.getTree().openFolder(selectedNode);
- }
-
}
commit 741c06a6a896492fbf6c6d6e0fd60eed0e4cc4df
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Thu Mar 11 18:54:31 2010 -0500
Tree subcategory support
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
index 162037d..dd86d70 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
@@ -40,6 +40,7 @@ import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceCategory;
+import org.rhq.core.domain.resource.ResourceSubCategory;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
@@ -49,6 +50,7 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTyp
/**
* This doesn't extend RPCDataSource because it is tree oriented and
* behaves different from normal list data sources in some places.
+ *
* @author Greg Hinkle
*/
public class ResourceTreeDatasource extends DataSource {
@@ -103,21 +105,21 @@ public class ResourceTreeDatasource extends DataSource {
// Asume success
response.setStatus(0);
switch (request.getOperationType()) {
- case ADD:
- //executeAdd(lstRec, true);
- break;
- case FETCH:
- executeFetch(requestId, request, response);
- break;
- case REMOVE:
- //executeRemove(lstRec);
- break;
- case UPDATE:
- //executeAdd(lstRec, false);
- break;
-
- default:
- break;
+ case ADD:
+ //executeAdd(lstRec, true);
+ break;
+ case FETCH:
+ executeFetch(requestId, request, response);
+ break;
+ case REMOVE:
+ //executeRemove(lstRec);
+ break;
+ case UPDATE:
+ //executeAdd(lstRec, false);
+ break;
+
+ default:
+ break;
}
return request.getData();
@@ -165,14 +167,14 @@ public class ResourceTreeDatasource extends DataSource {
private void processIncomingData(List<Resource> result, final DSResponse response, final String requestId) {
ResourceTypeRepository.Cache.getInstance().loadResourceTypes(result,
- EnumSet.of(ResourceTypeRepository.MetadataType.operations, ResourceTypeRepository.MetadataType.children),
- new ResourceTypeRepository.ResourceTypeLoadedCallback() {
- public void onResourceTypeLoaded(List<Resource> result) {
- response.setData(build(result));
- processResponse(requestId, response);
-
- }
- });
+ EnumSet.of(ResourceTypeRepository.MetadataType.operations, ResourceTypeRepository.MetadataType.children, ResourceTypeRepository.MetadataType.subCategory),
+ new ResourceTypeRepository.ResourceTypeLoadedCallback() {
+ public void onResourceTypeLoaded(List<Resource> result) {
+ response.setData(build(result));
+ processResponse(requestId, response);
+
+ }
+ });
}
/**
@@ -194,15 +196,42 @@ public class ResourceTreeDatasource extends DataSource {
private static TreeNode[] introduceTypeFolders(ResourceTreeNode[] nodes) {
ArrayList<TreeNode> built = new ArrayList<TreeNode>();
+ HashMap<ResourceSubCategory, CategoryTreeNode> categories = new HashMap<ResourceSubCategory, CategoryTreeNode>();
HashMap<ResourceType, TypeTreeNode> types = new HashMap<ResourceType, TypeTreeNode>();
+
for (ResourceTreeNode node : nodes) {
built.add(node);
if (!types.containsKey(node.getResourceType())
- && node.getResourceType().getCategory() != ResourceCategory.PLATFORM) {
- TypeTreeNode typeNode = new TypeTreeNode(
- String.valueOf(node.getResource().getParentResource().getId()), node.getResourceType().getName());
+ && node.getResourceType().getCategory() != ResourceCategory.PLATFORM) {
+
+ String parentResourceId = String.valueOf(node.getResource().getParentResource().getId());
+
+ CategoryTreeNode categoryNode = null;
+
+ if (node.getResourceType().getSubCategory() != null) {
+ ResourceSubCategory category = node.getResourceType().getSubCategory();
+ if (category.getName() != null) {
+ categoryNode = categories.get(category);
+
+ if (categoryNode == null) {
+ categoryNode = new CategoryTreeNode(parentResourceId, category);
+
+ categories.put(category, categoryNode);
+ built.add(categoryNode);
+ }
+ }
+ }
+
+ String parentId = null;
+ if (categoryNode != null) {
+ parentId = categoryNode.getAttribute("id");
+ } else {
+ parentId = parentResourceId;
+ }
+
+ TypeTreeNode typeNode = new TypeTreeNode(parentId, parentResourceId, node.getResourceType().getName());
built.add(typeNode);
types.put(node.getResourceType(), typeNode);
}
@@ -222,13 +251,26 @@ public class ResourceTreeDatasource extends DataSource {
return true;
}
+ public static class CategoryTreeNode extends TreeNode {
+ public CategoryTreeNode(String parentId, ResourceSubCategory category) {
+ setID(parentId + "__" + category.getName());
+ setParentID(parentId);
+ setName(category.getDisplayName());
+
+ setAttribute("id", parentId + "__" + category.getName());
+ setAttribute("parentId", parentId);
+ setAttribute("name", category.getDisplayName());
+ }
+ }
+
+
public static class TypeTreeNode extends TreeNode {
- private TypeTreeNode(String parentId, String type) {
+ private TypeTreeNode(String parentId, String parentResourceId, String type) {
setID(parentId + "_" + type);
setParentID(parentId);
- setAttribute("id", parentId + "_" + type);
+ setAttribute("id", parentResourceId + "_" + type);
setAttribute("parentId", parentId);
// setAttribute("parentKey", parentId);
setAttribute("name", type);
@@ -245,7 +287,7 @@ public class ResourceTreeDatasource extends DataSource {
String id = String.valueOf(resource.getId());
String parentId = resource.getParentResource() == null ? null
- : (resource.getParentResource().getId() + "_" + resource.getResourceType().getName());
+ : (resource.getParentResource().getId() + "_" + resource.getResourceType().getName());
// System.out.println(id + " / " + parentId);
@@ -260,12 +302,12 @@ public class ResourceTreeDatasource extends DataSource {
setAttribute("name", resource.getName());
setAttribute("description", resource.getDescription());
setAttribute(
- "currentAvailability",
- resource.getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP ? "/images/icons/availability_green_16.png"
- : "/images/icons/availability_red_16.png");
+ "currentAvailability",
+ resource.getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP ? "/images/icons/availability_green_16.png"
+ : "/images/icons/availability_red_16.png");
setIsFolder((resource.getResourceType().getChildResourceTypes() != null && !resource.getResourceType()
- .getChildResourceTypes().isEmpty()));
+ .getChildResourceTypes().isEmpty()));
}
public Resource getResource() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java
index 2e9dc00..d33c25f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java
@@ -48,7 +48,8 @@ public class ResourceTypeRepository {
private static ResourceTypeGWTServiceAsync resourceTypeService = GWTServiceLookup.getResourceTypeGWTService();
public enum MetadataType {
- children, operations, measurements, content, events, pluginConfigurationDefinition, resourceConfigurationDefinition
+ children, operations, measurements, content, events, pluginConfigurationDefinition, resourceConfigurationDefinition,
+ subCategory, parentTypes, processScans, productVersions
}
@@ -167,6 +168,18 @@ public class ResourceTypeRepository {
case resourceConfigurationDefinition:
criteria.fetchResourceConfigurationDefinition(true);
break;
+ case subCategory:
+ criteria.fetchSubCategory(true);
+ break;
+ case parentTypes:
+ criteria.fetchParentResourceTypes(true);
+ break;
+ case processScans:
+ criteria.fetchProcessScans(true);
+ break;
+ case productVersions:
+ criteria.fetchProductVersions(true);
+ break;
}
}
}
commit 3f6bc0b640bf52e4849421ae3a57e9a64f693ec5
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Thu Mar 11 16:57:19 2010 -0500
Favorites popup menu
user prefs change listener
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java
index 56f1528..8c9d8fa 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java
@@ -24,6 +24,7 @@ import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.toolbar.ToolStrip;
import com.smartgwt.client.widgets.toolbar.ToolStripSeparator;
+import org.rhq.enterprise.gui.coregui.client.footer.FavoritesButton;
import org.rhq.enterprise.gui.coregui.client.util.message.MessageCenterView;
/**
@@ -57,6 +58,8 @@ public class Footer extends ToolStrip {
addMember(new ToolStripSeparator());
+ addMember(new FavoritesButton());
+
addMember(new Img("/images/icons/Alert_red_16.png",16,16));
addMember(new Label("15 recent alerts"));
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java
new file mode 100644
index 0000000..e83405e
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java
@@ -0,0 +1,75 @@
+/*
+ * 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.footer;
+
+import java.util.Set;
+
+import com.google.gwt.user.client.History;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.menu.IMenuButton;
+import com.smartgwt.client.widgets.menu.Menu;
+import com.smartgwt.client.widgets.menu.MenuItem;
+import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent;
+
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+
+/**
+ * @author Greg Hinkle
+ */
+public class FavoritesButton extends IMenuButton {
+
+ public FavoritesButton() {
+ super("Favorites");
+
+ final Menu favoritesMenu = new Menu();
+ setMenu(favoritesMenu);
+ setShowMenuBelow(false);
+ setAutoFit(true);
+
+ addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+
+ Set<Integer> favorites = CoreGUI.getUserPreferences().getFavoriteResources();
+
+ // todo: lookup resource names
+//
+// ResourceCriteria criteria = new ResourceCriteria();
+// criteria.addFilter
+
+ MenuItem[] items = new MenuItem[favorites.size()];
+ int i = 0;
+ for (final Integer resourceId : favorites) {
+ MenuItem item = new MenuItem(String.valueOf(resourceId));
+ item.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
+ public void onClick(MenuItemClickEvent event) {
+ History.newItem("Resource/" + resourceId);
+ }
+ });
+ items[i++] = item;
+ }
+
+ favoritesMenu.setItems(items);
+ }
+ });
+ }
+
+
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java
index 905e6c6..fb998ff 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java
@@ -119,7 +119,7 @@ public class MessageCenterView extends HLayout implements MessageCenter.MessageL
form.setItems(title,severity,date,detail, okButton );
- Window window = new Window();
+ final Window window = new Window();
window.setTitle(message.title);
window.setWidth(600);
window.setHeight(400);
@@ -130,6 +130,11 @@ public class MessageCenterView extends HLayout implements MessageCenter.MessageL
window.addItem(form);
window.show();
okButton.focusInItem();
+ okButton .addClickHandler( new com.smartgwt.client.widgets.form.fields.events.ClickHandler() {
+ public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent clickEvent) {
+ window.destroy();
+ }
+ });
}
public void onMessage(final Message message) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferenceChangeEvent.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferenceChangeEvent.java
new file mode 100644
index 0000000..c06d285
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferenceChangeEvent.java
@@ -0,0 +1,47 @@
+/*
+ * 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.util.preferences;
+
+/**
+ * @author Greg Hinkle
+ */
+public class UserPreferenceChangeEvent {
+
+ String name;
+ String newValue;
+ String oldValue;
+
+ public UserPreferenceChangeEvent(String name, String newValue, String oldValue) {
+ this.name = name;
+ this.newValue = newValue;
+ this.oldValue = oldValue;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getNewValue() {
+ return newValue;
+ }
+
+ public String getOldValue() {
+ return oldValue;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferenceChangeListener.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferenceChangeListener.java
new file mode 100644
index 0000000..d1e321c
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferenceChangeListener.java
@@ -0,0 +1,30 @@
+/*
+ * 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.util.preferences;
+
+/**
+ * @author Greg Hinkle
+ */
+public interface UserPreferenceChangeListener {
+
+
+ void onPreferrenceChange(UserPreferenceChangeEvent event);
+
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferences.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferences.java
index 835646a..2837a7d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferences.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferences.java
@@ -45,6 +45,9 @@ public class UserPreferences {
private Configuration userConfiguration;
private SubjectGWTServiceAsync subjectService = GWTServiceLookup.getSubjectService();
+ private ArrayList<UserPreferenceChangeListener> changeListeners = new ArrayList<UserPreferenceChangeListener>();
+
+
public UserPreferences(Subject subject) {
this.subject = subject;
this.userConfiguration = subject.getUserConfiguration();
@@ -78,14 +81,25 @@ public class UserPreferences {
protected void setPreference(String name, String value, AsyncCallback<Subject> callback) {
PropertySimple prop = this.userConfiguration.getSimple(name);
+ String oldValue = null;
if (prop == null) {
this.userConfiguration.put(new PropertySimple(name, value));
} else {
+ oldValue = prop.getStringValue();
prop.setStringValue(value);
}
this.subjectService.updateSubject(this.subject, callback);
+
+
+ UserPreferenceChangeEvent event = new UserPreferenceChangeEvent(name, value, oldValue);
+ for (UserPreferenceChangeListener listener : changeListeners) {
+ listener.onPreferrenceChange(event);
+ }
}
+
+
+
protected List<String> getPreferenceAsList(String key) {
String pref = null;
try {
@@ -114,4 +128,9 @@ public class UserPreferences {
return new HashSet<Integer>();
}
}
+
+
+ public void addChangeListener(UserPreferenceChangeListener listener) {
+ changeListeners.add(listener);
+ }
}
commit 1af5ec3a1af1710acfcfe4a53ea4d285741b5887
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Thu Mar 11 16:56:24 2010 -0500
Start to integrating jsf content tabs
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index e1af01f..a9a6543 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -121,6 +121,7 @@ public class ResourceDetailView extends VLayout implements ViewRenderer, Resourc
eventsTab = new TwoLevelTab("Events", "/images/icons/Events_grey_16.png");
contentTab = new TwoLevelTab("Content", "/images/icons/Content_grey_16.png");
+ contentTab.registerSubTabs("Deployed","New","Subscriptions","History");
topTabSet.setTabs(summaryTab, monitoringTab, inventoryTab, operationsTab, alertsTab, configurationTab, eventsTab, contentTab);
@@ -172,7 +173,14 @@ public class ResourceDetailView extends VLayout implements ViewRenderer, Resourc
configurationTab.updateSubTab("History", ConfigurationHistoryView.getHistoryOf(resource.getId()));
alertsTab.updateSubTab("History", new ResourceAlertHistoryView(resource.getId()));
-
+
+
+ contentTab.updateSubTab("Deployed",new FullHTMLPane("/rhq/resource/content/view-plain.xhtml?id=" + resource.getId()));
+ contentTab.updateSubTab("New",new FullHTMLPane("/rhq/resource/content/deploy-plain.xhtml?id=" + resource.getId()));
+ contentTab.updateSubTab("Subscriptions",new FullHTMLPane("/rhq/resource/content/subscription-plain.xhtml?id=" + resource.getId()));
+ contentTab.updateSubTab("History",new FullHTMLPane("/rhq/resource/content/history-plain.xhtml?id=" + resource.getId()));
+
+
topTabSet.setSelectedTab(selectedTab);
updateTabStatus();
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/deploy-plain.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/deploy-plain.xhtml
new file mode 100644
index 0000000..ef85b15
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/deploy-plain.xhtml
@@ -0,0 +1,148 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:onc="http://jboss.org/on/component"
+ xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+
+<head>
+ <link rel="stylesheet" href="/css/win.css" type="text/css"/>
+</head>
+<body>
+
+ <h:form id="currentPackageVersionsForm">
+ <input type="hidden" name="id" value="${param.id}"/>
+
+ <rich:panel styleClass="BlockContent">
+ <f:facet name="header"><h:outputText value="Packages Eligible for Deployment"/></f:facet>
+
+ <p>The following packages were found from the repositories currently subscribed to by this resource. In order
+ to enable more existing packages for deployment, use the subscriptions sub-tab to subscribe this resource
+ to more repositories.</p>
+
+ <a4j:keepAlive beanName="ResourcePackageVersionsUIBean"/>
+
+ <ui:param name="resourcePackageVersionsDataModel" value="#{ResourcePackageVersionsUIBean.dataModel}"/>
+ <rich:dataTable id="resourcePackageVersionsDataTable"
+ rows="#{PageControl.ResourcePackageVersionsList.pageSize}"
+ value="#{resourcePackageVersionsDataModel}"
+ var="item"
+ width="100%"
+ columnsWidth="1%, 15%, 10%, 10%, 10%, 54%"
+ headerClass="tableRowHeader"
+ footerClass="on-pager-footer"
+ onRowMouseOver="this.style.backgroundColor='#E7E7E7'"
+ onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
+
+ <f:facet name="PageControlView">
+ <onc:paginationControl id="ResourcePackageVersionsList" />
+ </f:facet>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:allSelect target="selectedPackages" />
+ </f:facet>
+
+ <onc:select name="selectedPackages" value="#{item.packageVersion.id}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="pv.generalPackage.name">
+ <h:outputText styleClass="headerText" value="Package Name" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputLink value="../../content/packageVersion.xhtml">
+ <f:param name="id" value="#{item.packageVersion.id}"/>
+ <h:outputText value="#{item.packageName}"/>
+ </h:outputLink>
+
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="pv.displayVersion">
+ <h:outputText styleClass="headerText" value="Version" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.packageVersion.displayVersion}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="pv.generalPackage.packageType.displayName">
+ <h:outputText styleClass="headerText" value="Type" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.packageTypeName}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="pv.architecture">
+ <h:outputText styleClass="headerText" value="Architecture" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.architectureName}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Description" />
+ </f:facet>
+
+ <h:outputText value="#{item.packageVersion.shortDescription}" escape="false"/>
+ </rich:column>
+
+ <f:facet name="footer">
+ <rich:columnGroup>
+ <rich:column colspan="6" width="100%">
+ <onc:selectCommandButton action="#{CreateNewPackageUIBean.deployExisting}"
+ value="DEPLOY SELECTED" target="selectedPackages" styleClass="on-pager-button buttonsmall"
+ rendered="${ResourceUIBean.permissions.content}"/>
+
+ <ui:include src="/rhq/resource/include/pagination.xhtml">
+ <ui:param name="paginationDataTableName" value="resourcePackageVersionsDataTable"/>
+ <ui:param name="paginationDataModel" value="#{resourcePackageVersionsDataModel}"/>
+ <ui:param name="paginationPageControl" value="#{PageControl.ResourcePackageVersionsList}"/>
+ </ui:include>
+ </rich:column>
+ </rich:columnGroup>
+ </f:facet>
+
+ </rich:dataTable>
+
+
+ </rich:panel>
+
+ <rich:panel styleClass="BlockContent"
+ rendered="${ResourceUIBean.permissions.content}">
+ <f:facet name="header"><h:outputText value="Upload New Package"/></f:facet>
+
+ <p>The following option will begin the workflow to upload a new package into the system. Once
+ the package information has been specified and the file uploaded, the workflow to deploy the newly
+ created package to this resource will resume.</p>
+
+ <h:panelGrid columns="1" styleClass="buttons-table" columnClasses="button-cell">
+ <h:commandButton action="uploadNew"
+ value="UPLOAD NEW PACKAGE" styleClass="buttonmed"/>
+ </h:panelGrid>
+
+ <br/>
+ </rich:panel>
+
+ </h:form>
+</body>
+</html>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/history-plain.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/history-plain.xhtml
new file mode 100644
index 0000000..01ae31c
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/history-plain.xhtml
@@ -0,0 +1,363 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:onc="http://jboss.org/on/component"
+ xmlns:onf="http://jboss.org/on/function"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+
+
+<head>
+ <link rel="stylesheet" href="/css/win.css" type="text/css"/>
+</head>
+<body>
+
+<!-- Content Requests Table -->
+
+<h:form id="contentaRequestsForm">
+<input type="hidden" name="id" value="${param.id}"/>
+
+<rich:panel>
+ <f:facet name="header"><h:outputText value="Currently Executing Requests"/></f:facet>
+
+ <i><h:outputText value="There are no currently executing content requests"
+ rendered="#{ListInProgressContentRequestsUIBean.dataModel.rowCount eq 0}"/></i>
+
+ <rich:dataTable rendered="#{ListInProgressContentRequestsUIBean.dataModel.rowCount gt 0}"
+ id="contentInProgressRequestsDataTable"
+ rows="#{PageControl.ContentInProgressRequestsList.pageSize}"
+ value="#{ListInProgressContentRequestsUIBean.dataModel}"
+ var="item"
+ width="100%"
+ columnsWidth="16%, 17%, 16%, 16%, 16%, 16%"
+ headerClass="tableRowHeader"
+ footerClass="on-pager-footer"
+ onRowMouseOver="this.style.backgroundColor='#E7E7E7'"
+ onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
+
+ <f:facet name="PageControlView">
+ <onc:paginationControl id="ContentInProgressRequestsList"/>
+ </f:facet>
+
+ <rich:column rendered="#{param.debug}">
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="csr.id">
+ <h:outputText styleClass="headerText" value="ID"/>
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.id}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="csr.ctime">
+ <h:outputText styleClass="headerText" value="Request Started"/>
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.createdDate}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="csr.notes">
+ <h:outputText styleClass="headerText" value="Notes"/>
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.notes}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="csr.status">
+ <h:outputText styleClass="headerText" value="Request Status"/>
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.status}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="csr.contentRequestType">
+ <h:outputText styleClass="headerText" value="Request Type"/>
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.contentRequestType}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Details"/>
+ </f:facet>
+
+ <h:commandLink style="margin-top: 10px;" value="VIEW"
+ action="showContentServiceRequestDetails">
+ <f:param name="selectedRequestId" value="#{item.id}"/>
+ </h:commandLink>
+
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="csr.subjectName">
+ <h:outputText styleClass="headerText" value="User"/>
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.subjectName}"/>
+ </rich:column>
+
+ <f:facet name="footer">
+ <rich:columnGroup>
+ <rich:column colspan="6" width="100%">
+ <ui:param name="paginationDataTableName" value="contentInProgressRequestsDataTable"/>
+ <ui:param name="paginationDataModel" value="#{ListInProgressContentRequestsUIBean.dataModel}"/>
+ <ui:param name="paginationPageControl" value="#{PageControl.ContentInProgressRequestsList}"/>
+ <ui:include src="../include/pagination.xhtml"/>
+ </rich:column>
+ </rich:columnGroup>
+ </f:facet>
+
+
+ </rich:dataTable>
+
+</rich:panel>
+
+<rich:panel>
+ <f:facet name="header"><h:outputText value="Completed Requests"/></f:facet>
+
+ <i><h:outputText value="There are no completed content requests"
+ rendered="#{ListCompletedContentRequestsUIBean.dataModel.rowCount eq 0}"/></i>
+
+
+ <rich:dataTable rendered="#{ListCompletedContentRequestsUIBean.dataModel.rowCount gt 0}"
+ binding="#{ListCompletedContentRequestsUIBean.dataTable}"
+ id="contentCompletedRequestsDataTable"
+ rows="#{PageControl.ContentCompletedRequestsList.pageSize}"
+ value="#{ListCompletedContentRequestsUIBean.dataModel}"
+ var="item"
+ width="100%"
+ columnsWidth="16%, 17%, 16%, 16%, 16%, 16%"
+ headerClass="tableRowHeader"
+ footerClass="on-pager-footer"
+ onRowMouseOver="this.style.backgroundColor='#E7E7E7'"
+ onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
+
+ <f:facet name="PageControlView">
+ <onc:paginationControl id="ContentCompletedRequestsList"/>
+ </f:facet>
+
+ <rich:column rendered="#{param.debug}">
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="csr.id">
+ <h:outputText styleClass="headerText" value="ID"/>
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.id}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="csr.ctime">
+ <h:outputText styleClass="headerText" value="Request Started"/>
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.createdDate}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="csr.notes">
+ <h:outputText styleClass="headerText" value="Notes"/>
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.notes}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="csr.status">
+ <h:outputText styleClass="headerText" value="Request Status"/>
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.status}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="csr.contentRequestType">
+ <h:outputText styleClass="headerText" value="Request Type"/>
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.contentRequestType}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Details"/>
+ </f:facet>
+
+ <h:commandLink style="margin-top: 10px;" value="VIEW"
+ action="showContentServiceRequestDetails">
+ <f:param name="selectedRequestId" value="#{item.id}"/>
+ </h:commandLink>
+
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="csr.subjectName">
+ <h:outputText styleClass="headerText" value="User"/>
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.subjectName}"/>
+ </rich:column>
+
+ <f:facet name="footer">
+ <rich:columnGroup>
+ <rich:column colspan="6" width="100%">
+ <ui:param name="paginationDataTableName" value="contentCompletedRequestsDataTable"/>
+ <ui:param name="paginationDataModel" value="#{ListCompletedContentRequestsUIBean.dataModel}"/>
+ <ui:param name="paginationPageControl" value="#{PageControl.ContentCompletedRequestsList}"/>
+ <ui:include src="../include/pagination.xhtml"/>
+ </rich:column>
+ </rich:columnGroup>
+ </f:facet>
+
+
+ </rich:dataTable>
+
+
+</rich:panel>
+
+<rich:panel>
+ <f:facet name="header"><h:outputText value="Full Package Audit Trail"/></f:facet>
+
+ <p>The following is a complete listing of all of the package operations that have occurred on this resource.
+ By default, they are ordered from newest to oldest. In other words, for packages that are referenced more than
+ one time in this list, the most recent item indicates the current status of the package.</p>
+
+ <i><h:outputText value="There are no package related events on this resource"
+ rendered="#{AuditTrailUIBean.dataModel.rowCount eq 0}"/></i>
+
+
+ <rich:dataTable rendered="#{AuditTrailUIBean.dataModel.rowCount gt 0}"
+ binding="#{AuditTrailUIBean.dataTable}"
+ id="auditTrailDataTable"
+ rows="#{PageControl.AuditTrailList.pageSize}"
+ value="#{AuditTrailUIBean.dataModel}"
+ var="item"
+ width="100%"
+ columnsWidth="20%, 20%, 20%, 10%, 20%, 10%"
+ headerClass="tableRowHeader"
+ footerClass="on-pager-footer"
+ onRowMouseOver="this.style.backgroundColor='#E7E7E7'"
+ onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
+
+ <f:facet name="PageControlView">
+ <onc:paginationControl id="AuditTrailList"/>
+ </f:facet>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="iph.packageVersion.displayName">
+ <h:outputText styleClass="headerText" value="Package Name" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.packageVersion.displayName}" rendered="#{!empty item.packageVersion.displayName}"/>
+ <h:outputText value="#{item.packageVersion.generalPackage.name}" rendered="#{empty item.packageVersion.displayName}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="iph.packageVersion.displayVersion">
+ <h:outputText styleClass="headerText" value="Version" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.packageVersion.displayVersion}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="iph.packageVersion.architecture">
+ <h:outputText styleClass="headerText" value="Architecture" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.packageVersion.architecture.name}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="iph.status.displayName">
+ <h:outputText styleClass="headerText" value="Status" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.status.displayName}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="iph.timestamp">
+ <h:outputText styleClass="headerText" value="Timestamp" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.timestamp}">
+ <f:converter converterId="UserDateTimeConverter" />
+ </h:outputText>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Details" />
+ </f:facet>
+
+ <h:commandLink style="margin-top: 10px;" value="VIEW"
+ action="showHistoryItem">
+ <f:param name="selectedHistoryId" value="#{item.id}"/>
+ </h:commandLink>
+
+ </rich:column>
+
+ <f:facet name="footer">
+ <rich:columnGroup>
+ <rich:column colspan="6" width="100%">
+ <ui:param name="paginationDataTableName" value="auditTrailDataTable"/>
+ <ui:param name="paginationDataModel" value="#{AuditTrailUIBean.dataModel}"/>
+ <ui:param name="paginationPageControl" value="#{PageControl.AuditTrailList}"/>
+ <ui:include src="../include/pagination.xhtml"/>
+ </rich:column>
+ </rich:columnGroup>
+ </f:facet>
+
+
+ </rich:dataTable>
+
+
+</rich:panel>
+
+</h:form>
+</body>
+
+</html>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/installed_package_details-plain.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/installed_package_details-plain.xhtml
new file mode 100644
index 0000000..cf93350
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/installed_package_details-plain.xhtml
@@ -0,0 +1,157 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:onc="http://jboss.org/on/component"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich"
+ xmlns:a4j="http://richfaces.org/a4j">
+
+
+
+<head>
+ <link rel="stylesheet" href="/css/win.css" type="text/css"/>
+</head>
+<body>
+
+ <a4j:keepAlive beanName="ListPackageHistoryUIBean"/>
+
+ <ui:param name="current" value="#{ListPackageHistoryUIBean.currentPackage}"/>
+
+ <!-- Current Package Display -->
+
+ <rich:panel rendered="#{!empty current}">
+ <f:facet name="header"><h:outputText value="Current Package Information"/></f:facet>
+
+ <h:form id="packageDataForm">
+ <input type="hidden" name="id" value="#{param.id}"/>
+ <input type="hidden" name="currentPackageId" value="#{current.id}"/>
+
+ <h:dataTable value="#{ListPackageHistoryUIBean.packageValues}" var="item"
+ styleClass="revision-data-table"
+ headerClass="revision-data-table-header"
+ rowClasses="revision-data-table-even-row,revision-data-table-odd-row"
+ cellpadding="3"
+ cellspacing="0">
+
+ <h:column>
+ <b><h:outputText value="#{item.name}"/><f:verbatim>:</f:verbatim> </b>
+ </h:column>
+ <h:column>
+ <h:outputText value="#{item.currentValue}"/>
+ </h:column>
+
+ </h:dataTable>
+
+ </h:form>
+ </rich:panel>
+
+ <!-- Packages List Table -->
+
+ <!-- TODO: jdobies, Feb 22, 2008: Revisit this and reuse it on history subtab.
+ For now, just making this change to use the history entries since InstalledPackage no longer carries
+ historical data. -->
+
+ <rich:panel>
+
+ <f:facet name="header"><h:outputText value="Package History"/></f:facet>
+
+ <h:form id="previousForm">
+ <input type="hidden" name="id" value="#{param.id}"/>
+ <input type="hidden" name="currentPackageId" value="#{current.id}"/>
+
+ <ui:param name="packagesDataModel" value="#{ListPackageHistoryUIBean.dataModel}"/>
+ <rich:dataTable id="packagesDataTable"
+ rows="#{PageControl.AllPackageVersionsList.pageSize}"
+ value="#{packagesDataModel}"
+ var="item"
+ width="100%"
+ columnsWidth="20%, 20%, 20%, 20%, 20%"
+ headerClass="tableRowHeader"
+ footerClass="on-pager-footer"
+ onRowMouseOver="this.style.backgroundColor='#E7E7E7'"
+ onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
+
+ <f:facet name="PageControlView">
+ <onc:paginationControl id="AllPackageVersionsList"/>
+ </f:facet>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="iph.timestamp">
+ <h:outputText styleClass="headerText" value="Timestamp"/>
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.timestamp}">
+ <f:converter converterId="UserDateTimeConverter"/>
+ </h:outputText>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="iph.status">
+ <h:outputText styleClass="headerText" value="Status"/>
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.status}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="iph.packageVersion.displayVersion">
+ <h:outputText styleClass="headerText" value="Version"/>
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.packageVersion.displayVersion}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="ip.packageVersion.architecture">
+ <h:outputText styleClass="headerText" value="Architecture"/>
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.packageVersion.architecture.name}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Original Request"/>
+ </f:facet>
+
+ <h:outputText value="View Request" rendered="#{item.contentServiceRequest ne null}"/>
+ </rich:column>
+
+ <f:facet name="footer">
+ <rich:columnGroup>
+ <rich:column colspan="5" width="100%">
+ <ui:param name="paginationDataTableName" value="packagesDataTable"/>
+ <ui:param name="paginationDataModel" value="#{packagesDataModel}"/>
+ <ui:param name="paginationPageControl" value="#{PageControl.AllPackageVersionsList}"/>
+ <ui:include src="../include/pagination.xhtml"/>
+ </rich:column>
+ </rich:columnGroup>
+ </f:facet>
+
+ </rich:dataTable>
+
+ </h:form>
+ </rich:panel>
+
+ <!-- Return Link -->
+
+ <h:outputLink value="/rhq/resource/content/view-plain.xhtml?id=#{param.id}">
+ <h:outputText value="Return to Packages"/>
+ </h:outputLink>
+</body>
+</html>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/subscription-plain.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/subscription-plain.xhtml
new file mode 100644
index 0000000..c5fb200
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/subscription-plain.xhtml
@@ -0,0 +1,259 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:onc="http://jboss.org/on/component"
+ xmlns:onf="http://jboss.org/on/function"
+ xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+
+<head>
+ <link rel="stylesheet" href="/css/win.css" type="text/css"/>
+</head>
+<body>
+ <!-- CURRENT REPOS -->
+ <h:form id="currentRepoForm">
+ <input type="hidden" name="id" value="${param.id}"/>
+
+ <rich:panel styleClass="BlockContent">
+ <f:facet name="header"><h:outputText value="Current Resource Subscriptions"/></f:facet>
+ <a4j:keepAlive beanName="ResourceReposUIBean"/>
+
+ <ui:param name="resourceReposDataModel" value="#{ResourceReposUIBean.dataModel}"/>
+ <rich:dataTable id="resourceReposDataTable"
+ rows="#{PageControl.ResourceReposList.pageSize}"
+ value="#{resourceReposDataModel}"
+ var="item"
+ width="100%"
+ columnsWidth="1%, 25%, 40%, 5%, 15%, 15%"
+ headerClass="tableRowHeader"
+ footerClass="on-pager-footer"
+ onRowMouseOver="this.style.backgroundColor='#E7E7E7'"
+ onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
+
+ <f:facet name="PageControlView">
+ <onc:paginationControl id="ResourceReposList" />
+ </f:facet>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:allSelect target="selectedResourceRepos" />
+ </f:facet>
+
+ <onc:select name="selectedResourceRepos" value="#{item.repo.id}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="c.name">
+ <h:outputText styleClass="headerText" value="Name" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputLink value="/rhq/content/repo.xhtml">
+ <f:param name="mode" value="view"/>
+ <f:param name="id" value="#{item.repo.id}"/>
+ <h:outputText value="#{item.repo.name}" />
+ </h:outputLink>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Description" />
+ </f:facet>
+
+ <h:outputText value="#{item.repo.description}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="COUNT(pv)">
+ <h:outputText styleClass="headerText" value="Package Count" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.packageVersionCount}" />
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="c.creationDate">
+ <h:outputText styleClass="headerText" value="Created" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.repo.creationDate}">
+ <f:convertDateTime pattern="M/d/yy, h:mm:ss aa, zzz" timeZone="#{ServerInfoUIBean.timeZone}"/>
+ </h:outputText>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="c.lastModifiedDate">
+ <h:outputText styleClass="headerText" value="Last Modified" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.repo.lastModifiedDate}">
+ <f:convertDateTime pattern="M/d/yy, h:mm:ss aa, zzz" timeZone="#{ServerInfoUIBean.timeZone}"/>
+ </h:outputText>
+ </rich:column>
+
+ <f:facet name="footer">
+ <rich:columnGroup>
+ <rich:column colspan="6" width="100%">
+ <onc:selectCommandButton action="#{ResourceReposUIBean.deleteSelectedResourceRepos}"
+ value="REMOVE SUBSCRIPTIONS"
+ target="selectedResourceRepos"
+ styleClass="on-pager-button buttonsmall"
+ rendered="${GlobalPermissionsUIBean.inventory}"/>
+
+ <ui:include src="/rhq/resource/include/pagination.xhtml">
+ <ui:param name="paginationDataTableName" value="resourceReposDataTable"/>
+ <ui:param name="paginationDataModel" value="#{resourceReposDataModel}"/>
+ <ui:param name="paginationPageControl" value="#{PageControl.ResourceReposList}"/>
+ </ui:include>
+ </rich:column>
+ </rich:columnGroup>
+ </f:facet>
+
+ </rich:dataTable>
+
+ </rich:panel>
+ </h:form>
+
+
+ <!-- AVAILABLE REPOS -->
+ <h:form id="availableRepoForm"
+ rendered="${GlobalPermissionsUIBean.inventory}">
+ <input type="hidden" name="id" value="${param.id}"/>
+ <rich:panel styleClass="BlockContent">
+ <f:facet name="header"><h:outputText value="Available Repositories"/></f:facet>
+
+ <a4j:keepAlive beanName="AvailableResourceReposUIBean"/>
+
+ <ui:param name="availableResourceReposDataModel" value="#{AvailableResourceReposUIBean.dataModel}"/>
+ <rich:dataTable id="availableResourceReposDataTable"
+ rows="#{PageControl.AvailableResourceReposList.pageSize}"
+ value="#{availableResourceReposDataModel}"
+ var="item"
+ width="100%"
+ columnsWidth="1%, 25%, 40%, 5%, 15%, 15%"
+ headerClass="tableRowHeader"
+ footerClass="on-pager-footer"
+ onRowMouseOver="this.style.backgroundColor='#E7E7E7'"
+ onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
+
+ <f:facet name="PageControlView">
+ <onc:paginationControl id="AvailableResourceReposList" />
+ </f:facet>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:allSelect target="selectedAvailableResourceRepos" />
+ </f:facet>
+
+ <onc:select name="selectedAvailableResourceRepos" value="#{item.repo.id}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="c.name">
+ <h:outputText styleClass="headerText" value="Name" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputLink value="/rhq/content/repo.xhtml">
+ <f:param name="mode" value="view"/>
+ <f:param name="id" value="#{item.repo.id}"/>
+ <h:outputText value="#{item.repo.name}" />
+ </h:outputLink>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Description" />
+ </f:facet>
+
+ <h:outputText value="#{item.repo.description}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="COUNT(pv)">
+ <h:outputText styleClass="headerText" value="Package Count" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.packageVersionCount}" />
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="c.creationDate">
+ <h:outputText styleClass="headerText" value="Created" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.repo.creationDate}">
+ <f:convertDateTime pattern="M/d/yy, h:mm:ss aa, zzz" timeZone="#{ServerInfoUIBean.timeZone}"/>
+ </h:outputText>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="c.lastModifiedDate">
+ <h:outputText styleClass="headerText" value="Last Modified" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.repo.lastModifiedDate}">
+ <f:convertDateTime pattern="M/d/yy, h:mm:ss aa, zzz" timeZone="#{ServerInfoUIBean.timeZone}"/>
+ </h:outputText>
+ </rich:column>
+
+ <f:facet name="footer">
+ <rich:columnGroup>
+ <rich:column colspan="6" width="100%">
+ <onc:selectCommandButton action="#{AvailableResourceReposUIBean.subscribeSelectedResourceRepos}"
+ value="ADD SUBSCRIPTIONS"
+ target="selectedAvailableResourceRepos"
+ styleClass="on-pager-button buttonsmall"
+ rendered="${GlobalPermissionsUIBean.inventory}"/>
+
+ <ui:include src="/rhq/resource/include/pagination.xhtml">
+ <ui:param name="paginationDataTableName" value="availableResourceReposDataTable"/>
+ <ui:param name="paginationDataModel" value="#{availableResourceReposDataModel}"/>
+ <ui:param name="paginationPageControl" value="#{PageControl.AvailableResourceReposList}"/>
+ </ui:include>
+ </rich:column>
+ </rich:columnGroup>
+ </f:facet>
+
+ </rich:dataTable>
+
+ </rich:panel>
+
+ <ui:remove><!-- The package mode isn't returning enough data to differentiate it from the new subtab, so
+ disabling it for now until we decide if this is needed. --></ui:remove>
+ <!--
+ <p align="center">
+ <h:outputLink value="/rhq/resource/content/subscription_packages.xhtml">
+ <f:param name="id" value="${param.id}"/>
+ <h:outputText value="Switch To Package Mode" />
+ </h:outputLink>
+ </p>
+ -->
+
+ </h:form>
+
+</body>
+
+</html>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/view-plain.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/view-plain.xhtml
new file mode 100644
index 0000000..918c3ce
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/content/view-plain.xhtml
@@ -0,0 +1,170 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:onc="http://jboss.org/on/component"
+ xmlns:onf="http://jboss.org/on/function"
+ xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+
+<head>
+ <link rel="stylesheet" href="/css/win.css" type="text/css"/>
+</head>
+<body>
+<!-- Content Table -->
+
+ <h:form id="contentForm">
+ <input type="hidden" name="id" value="${param.id}"/>
+ <rich:panel styleClass="BlockContent">
+
+
+ <f:facet name="header"><h:outputText value="Deployed Content"/></f:facet>
+
+ <a4j:log level="debug" width="400"/>
+
+
+ <h:panelGrid columns="3" width="100%">
+ <h:panelGroup>
+ <h:outputText value="Filter: " />
+ <h:inputText id="search" value="#{ListPackagesUIBean.search}">
+ <a4j:support event="onchange"
+ status="commonStatus"
+ reRender="packagesDataTable, packagesDataTableScroller"
+ actionListener="#{ListPackagesUIBean.clearDataModel}"/>
+ </h:inputText>
+ </h:panelGroup>
+
+ <h:panelGroup>
+ <h:outputText value="Package Type Filter: " />
+ <h:selectOneMenu id="packageTypeFilter"
+ value="#{ListPackagesUIBean.packageTypeFilter}">
+ <a4j:support event="onchange"
+ status="commonStatus"
+ reRender="packagesDataTable, packagesDataTableScroller"
+ actionListener="#{ListPackagesUIBean.clearDataModel}"/>
+ <f:selectItems value="#{ListPackagesUIBean.packageTypes}" />
+ </h:selectOneMenu>
+ </h:panelGroup>
+
+ <h:panelGroup>
+ <h:outputText value="Package Version Filter: " />
+ <h:selectOneMenu id="packageVersionFilter"
+ value="#{ListPackagesUIBean.packageVersionFilter}">
+ <a4j:support event="onchange"
+ status="commonStatus"
+ reRender="packagesDataTable, packagesDataTableScroller"
+ actionListener="#{ListPackagesUIBean.clearDataModel}"/>
+ <f:selectItems value="#{ListPackagesUIBean.packageVersions}" />
+ </h:selectOneMenu>
+ </h:panelGroup>
+
+ </h:panelGrid>
+
+ <a4j:keepAlive beanName="ListPackagesUIBean"/>
+
+
+ <ui:param name="packagesDataModel" value="#{ListPackagesUIBean.dataModel}"/>
+ <rich:dataTable id="packagesDataTable"
+ rows="#{PageControl.InstalledPackagesList.pageSize}"
+ value="#{packagesDataModel}"
+ var="item"
+ width="100%"
+ columnsWidth="1%, 35%, 30%, 15%, 19%"
+ headerClass="tableRowHeader"
+ footerClass="on-pager-footer"
+ onRowMouseOver="this.style.backgroundColor='#E7E7E7'"
+ onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
+
+ <f:facet name="PageControlView">
+ <onc:paginationControl id="InstalledPackagesList" />
+ </f:facet>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:allSelect target="selectedPackages" />
+ </f:facet>
+
+ <ui:remove><!--
+ Rendered attribute here will not show the checkbox if this package is of the same type as the
+ package type that backs this resource (if it is content backed.
+ --></ui:remove>
+ <onc:select name="selectedPackages" value="#{item.id}"
+ rendered="#{item.packageTypeName ne ListPackagesUIBean.contentBackedResourceTypeName}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="gp.name">
+ <h:outputText styleClass="headerText" value="Name" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputLink value="installed_package_details-plain.xhtml">
+ <f:param name="id" value="${param.id}"/>
+ <f:param name="currentPackageId" value="#{item.id}"/>
+ <h:outputText value="#{item.packageName}" />
+ </h:outputLink>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="pv.version">
+ <h:outputText styleClass="headerText" value="Version" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.version}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="pt.displayName">
+ <h:outputText styleClass="headerText" value="Type" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.packageTypeName}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="ip.installationDate">
+ <h:outputText styleClass="headerText" value="Installation Date" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.timestamp}">
+ <f:converter converterId="RelativeDurationConverter" />
+ </h:outputText>
+ </rich:column>
+
+
+
+ <f:facet name="footer">
+ <rich:columnGroup>
+ <rich:column colspan="5" width="100%">
+ <onc:selectCommandButton action="#{DeletePackagesUIBean.beginDeleteWorkflow}"
+ value="DELETE SELECTED" target="selectedPackages" styleClass="on-pager-button buttonsmall"/>
+
+ <ui:include src="../include/pagination.xhtml">
+ <ui:param name="paginationDataTableName" value="packagesDataTable"/>
+ <ui:param name="paginationDataModel" value="#{packagesDataModel}"/>
+ <ui:param name="paginationPageControl" value="#{PageControl.InstalledPackagesList}"/>
+ </ui:include>
+ </rich:column>
+ </rich:columnGroup>
+ </f:facet>
+
+ </rich:dataTable>
+
+ </rich:panel>
+ </h:form>
+</body>
+</html>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/summary/overview-plain.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/summary/overview-plain.xhtml
index ad0ff64..f85c872 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/summary/overview-plain.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/summary/overview-plain.xhtml
@@ -13,6 +13,9 @@
xmlns:onf="http://jboss.org/on/function"
xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+<head>
+ <link rel="stylesheet" href="/css/win.css" type="text/css"/>
+</head>
<body>
<table width="100%">
<tr>
commit 0557dd6596cae8f2b4f9e0f2ee6282b9022e50ec
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Thu Mar 11 14:17:08 2010 -0500
Basic operation execution and results viewing
Tweaks to message center
css fixes for the *-plain.xhtml jsf pages
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/availabilityHistory-plain.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/availabilityHistory-plain.xhtml
index 61c7798..545e523 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/availabilityHistory-plain.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/availabilityHistory-plain.xhtml
@@ -14,6 +14,10 @@
xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+<head>
+ <link rel="stylesheet" href="/css/win.css" type="text/css"/>
+</head>
+
<body>
<f:facet name="header" styleClass="BlockTitle">
<a name="AvailabilityHistory"/>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/schedules-plain.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/schedules-plain.xhtml
index ac82b66..a9d1ab3 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/schedules-plain.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/schedules-plain.xhtml
@@ -14,6 +14,9 @@
xmlns:s="http://jboss.com/products/seam/taglib"
xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+<head>
+ <link rel="stylesheet" href="/css/win.css" type="text/css"/>
+</head>
<body>
<h:outputText rendered="#{not ResourceUIBean.permissions.measure}" value="You don't have the measure permission for this resource and therefore can not change metric schedules"/>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/traits-plain.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/traits-plain.xhtml
index 8d0a42a..9038116 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/traits-plain.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/traits-plain.xhtml
@@ -13,6 +13,9 @@
xmlns:onf="http://jboss.org/on/function"
xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+<head>
+ <link rel="stylesheet" href="/css/win.css" type="text/css"/>
+</head>
<body>
<rich:panel styleClass="BlockContent">
@@ -32,7 +35,7 @@
<f:facet name="header">
<h:outputText value="Name"/>
</f:facet>
- <h:outputLink value="/rhq/resource/monitor/traits.xhtml">
+ <h:outputLink value="/rhq/resource/monitor/traits-plain.xhtml">
<f:param name="traitDefinitionId" value="#{metric.definitionId}"/>
<f:param name="id" value="#{ResourceUIBean.id}"/>
<h:outputText value="#{metric.label}"/>
commit 058f1cca887f55a9ff68346b41be0705134c020c
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Thu Mar 11 14:16:51 2010 -0500
Basic operation execution and results viewing
Tweaks to message center
css fixes for the *-plain.xhtml jsf pages
diff --git a/modules/enterprise/gui/coregui/pom.xml b/modules/enterprise/gui/coregui/pom.xml
index a1e7cc2..2ce8056 100644
--- a/modules/enterprise/gui/coregui/pom.xml
+++ b/modules/enterprise/gui/coregui/pom.xml
@@ -107,6 +107,12 @@
<scope>provided</scope> <!-- by JBossAS -->
</dependency>
+ <dependency>
+ <groupId>org.opensymphony.quartz</groupId>
+ <artifactId>quartz</artifactId>
+ <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
+ <scope>provided</scope> <!-- by JBossAS itself, which the container build has packaged with 1.6.5 -->
+ </dependency>
<!-- Internal Deps -->
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 96239e2..0cf2e86 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
@@ -33,6 +33,7 @@ import org.rhq.core.domain.configuration.definition.PropertyDefinitionList;
import org.rhq.core.domain.configuration.definition.PropertyDefinitionMap;
import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
import org.rhq.core.domain.configuration.definition.PropertyGroupDefinition;
+import org.rhq.core.domain.configuration.definition.PropertySimpleType;
import org.rhq.core.domain.configuration.definition.constraint.Constraint;
import org.rhq.core.domain.configuration.definition.constraint.IntegerRangeConstraint;
import org.rhq.core.domain.configuration.definition.constraint.RegexConstraint;
@@ -82,6 +83,7 @@ import com.smartgwt.client.widgets.form.validator.RegExpValidator;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.grid.SortNormalizer;
import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
@@ -138,7 +140,6 @@ public class ConfigurationEditor extends VLayout {
private IButton saveButton;
-
public static enum ConfigType {
plugin, resource
}
@@ -531,6 +532,15 @@ public class ConfigurationEditor extends VLayout {
for (PropertyDefinition subDef : definitions) {
if (subDef.isSummary()) {
ListGridField field = new ListGridField(subDef.getName(), subDef.getDisplayName());
+
+ PropertyDefinitionSimple defSimple = (PropertyDefinitionSimple) subDef;
+ if (defSimple.getType() == PropertySimpleType.INTEGER) {
+ field.setType(ListGridFieldType.INTEGER);
+ } else if (defSimple.getType() == PropertySimpleType.FLOAT) {
+ field.setType(ListGridFieldType.FLOAT);
+ }
+
+
fieldsList.add(field);
}
}
@@ -541,6 +551,13 @@ public class ConfigurationEditor extends VLayout {
for (PropertyDefinition subDef : definitions) {
ListGridField field = new ListGridField(subDef.getName(), subDef.getDisplayName());
fieldsList.add(field);
+ PropertyDefinitionSimple defSimple = (PropertyDefinitionSimple) subDef;
+ if (defSimple.getType() == PropertySimpleType.INTEGER) {
+ field.setType(ListGridFieldType.FLOAT);
+ } else if (defSimple.getType() == PropertySimpleType.FLOAT) {
+ field.setType(ListGridFieldType.FLOAT);
+ }
+
}
}
@@ -625,7 +642,7 @@ public class ConfigurationEditor extends VLayout {
}
private ListGridRecord[] buildSummaryRecords(PropertyList propertyList, ArrayList<PropertyDefinition> definitions) {
- ListGridRecord[] rows = new ListGridRecord[propertyList.getList().size()];
+ ListGridRecord[] rows = new ListGridRecord[propertyList == null ? 0 : propertyList.getList().size()];
int i = 0;
for (Property row : propertyList.getList()) {
PropertyMap rowMap = (PropertyMap) row;
@@ -641,8 +658,33 @@ public class ConfigurationEditor extends VLayout {
for (PropertyDefinition subDef : definitions) {
PropertyDefinitionSimple subDefSimple = (PropertyDefinitionSimple) subDef;
PropertySimple propertySimple = ((PropertySimple) rowMap.get(subDefSimple.getName()));
- record.setAttribute(subDefSimple.getName(), propertySimple != null ? propertySimple.getStringValue() : null);
- //((PropertySimple) rowMap.get(subDefSimple.getName())).getStringValue());
+
+ if (propertySimple.getStringValue() != null) {
+ record.setAttribute(subDefSimple.getName(), propertySimple.getStringValue());
+ /*
+ switch (((PropertyDefinitionSimple) subDef).getType()) {
+ case BOOLEAN:
+ record.setAttribute(subDefSimple.getName(), propertySimple.getBooleanValue());
+ break;
+ case INTEGER:
+ record.setAttribute(subDefSimple.getName(), propertySimple.getLongValue());
+ break;
+ case LONG:
+ record.setAttribute(subDefSimple.getName(), propertySimple.getLongValue());
+ break;
+ case FLOAT:
+ record.setAttribute(subDefSimple.getName(), propertySimple.getDoubleValue());
+ break;
+ case DOUBLE:
+ record.setAttribute(subDefSimple.getName(), propertySimple.getDoubleValue());
+ break;
+ default:
+ record.setAttribute(subDefSimple.getName(), propertySimple.getStringValue());
+ break;
+ }*/
+ } else {
+
+ }
}
record.setAttribute("_RHQ_PROPERTY", rowMap);
return record;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/OperationGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/OperationGWTService.java
index e1615a3..2ba537f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/OperationGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/OperationGWTService.java
@@ -18,14 +18,15 @@
*/
package org.rhq.enterprise.gui.coregui.client.gwt;
+import com.google.gwt.user.client.rpc.RemoteService;
+
+import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.criteria.GroupOperationHistoryCriteria;
import org.rhq.core.domain.criteria.ResourceOperationHistoryCriteria;
import org.rhq.core.domain.operation.GroupOperationHistory;
import org.rhq.core.domain.operation.ResourceOperationHistory;
import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.gui.coregui.server.util.SerialUtility;
-
-import com.google.gwt.user.client.rpc.RemoteService;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.create.ExecutionSchedule;
/**
* @author Greg Hinkle
@@ -37,5 +38,8 @@ public interface OperationGWTService extends RemoteService {
PageList<GroupOperationHistory> findGroupOperationHistoriesByCriteria(GroupOperationHistoryCriteria criteria);
+ void scheduleResourceOperation(
+ int resourceId, String operationName, Configuration parameters, ExecutionSchedule schedule, String description, int timeout)
+ throws RuntimeException;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryDataSource.java
index 5a01bce..fd79d76 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryDataSource.java
@@ -31,6 +31,7 @@ import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.data.fields.DataSourceIntegerField;
import com.smartgwt.client.data.fields.DataSourceTextField;
+import com.smartgwt.client.types.FieldType;
import com.smartgwt.client.widgets.grid.ListGridRecord;
/**
@@ -53,6 +54,10 @@ public class OperationHistoryDataSource extends RPCDataSource<ResourceOperationH
DataSourceTextField statusField = new DataSourceTextField("status");
addField(statusField);
+
+ DataSourceTextField startedField = new DataSourceTextField("startedTime");
+ startedField.setType(FieldType.DATETIME);
+ addField(startedField);
}
@Override
@@ -69,7 +74,7 @@ public class OperationHistoryDataSource extends RPCDataSource<ResourceOperationH
operationService.findResourceOperationHistoriesByCriteria(
criteria, new AsyncCallback<PageList<ResourceOperationHistory>>() {
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failure loading operation histories",caught);
+ CoreGUI.getErrorHandler().handleError("Failure loading operation histories", caught);
}
public void onSuccess(PageList<ResourceOperationHistory> result) {
@@ -88,18 +93,19 @@ public class OperationHistoryDataSource extends RPCDataSource<ResourceOperationH
@Override
public ListGridRecord copyValues(ResourceOperationHistory from) {
ListGridRecord record = new ListGridRecord();
- record.setAttribute("id",from.getId());
- record.setAttribute("createdTime",from.getCreatedTime());
- record.setAttribute("startedTime",from.getStartedTime());
- record.setAttribute("duration",from.getDuration());
- record.setAttribute("resource",from.getResource());
- record.setAttribute("subject",from.getSubjectName());
- record.setAttribute("operationDefinition",from.getOperationDefinition());
- record.setAttribute("operationName",from.getOperationDefinition().getDisplayName());
- record.setAttribute("errorMessage",from.getErrorMessage());
- record.setAttribute("status",from.getStatus().getDisplayName());
- record.setAttribute("parameters",from.getParameters());
-
+ record.setAttribute("id", from.getId());
+ record.setAttribute("createdTime", from.getCreatedTime());
+ record.setAttribute("startedTime", from.getStartedTime());
+ record.setAttribute("duration", from.getDuration());
+ record.setAttribute("resource", from.getResource());
+ record.setAttribute("subject", from.getSubjectName());
+ record.setAttribute("operationDefinition", from.getOperationDefinition());
+ record.setAttribute("operationName", from.getOperationDefinition().getDisplayName());
+ record.setAttribute("errorMessage", from.getErrorMessage());
+ record.setAttribute("status", from.getStatus().getDisplayName());
+ record.setAttribute("parameters", from.getParameters());
+
+ record.setAttribute("entity",from);
return record;
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
index a5c083a..758cc3d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
@@ -18,9 +18,18 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation;
+import org.rhq.core.domain.criteria.ResourceOperationHistoryCriteria;
+import org.rhq.core.domain.operation.ResourceOperationHistory;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.detail.OperationDetailsView;
+import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.layout.VLayout;
/**
@@ -58,6 +67,34 @@ public class OperationHistoryView extends VLayout {
table.setDataSource(new OperationHistoryDataSource());
+ table.addTableAction("Details", Table.SelectionEnablement.SINGLE,null, new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ ResourceOperationHistory history = (ResourceOperationHistory) selection[0].getAttributeAsObject("entity");
+
+ ResourceOperationHistoryCriteria criteria = new ResourceOperationHistoryCriteria();
+
+ criteria.addFilterId(history.getId());
+
+ criteria.fetchOperationDefinition(true);
+ criteria.fetchParameters(true);
+ criteria.fetchResults(true);
+
+ GWTServiceLookup.getOperationService().findResourceOperationHistoriesByCriteria(
+ criteria, new AsyncCallback<PageList<ResourceOperationHistory>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failure loading operation history", caught);
+ }
+
+ public void onSuccess(PageList<ResourceOperationHistory> result) {
+ ResourceOperationHistory item = result.get(0);
+ OperationDetailsView.displayDetailsDialog(item);
+ }
+ }
+ );
+ }
+ });
+
+
addMember(table);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/ExecutionSchedule.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/ExecutionSchedule.java
new file mode 100644
index 0000000..c471dc7
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/ExecutionSchedule.java
@@ -0,0 +1,292 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.create;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.HashSet;
+
+import com.google.gwt.i18n.client.DateTimeFormat;
+
+/**
+ * @author Greg Hinkle
+ */
+public class ExecutionSchedule implements Serializable {
+
+
+ public enum Start {
+ Immediately, Future
+ };
+
+ public enum Recurr {
+ Once, EveryNMinutes, Hourly, Daily, Weekly, Monthly
+ };
+
+ public enum DayOfWeek {
+ Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday
+ };
+
+ private Start start = Start.Immediately;
+
+ // start.Future
+ private Recurr recurr = Recurr.Once;
+
+ // Once
+ private Date onceDateTime;
+
+
+ // EveryNMinutes
+ private Integer minuteInterval;
+
+
+ // Hourly
+ private Integer minuteInHour;
+
+
+ // Daily
+ private Date timeOfDay;
+
+
+ // Weekly
+ // Time of Day above
+ private HashSet<DayOfWeek> daysOfWeek; // Can't use EnumSet because it doesn't have default instantiator
+
+
+ // Monthly
+ // Time of Day above
+ private Integer dayOfMonth;
+
+
+ // Used for all start.Future except for once
+ private Date startDate;
+
+ private Date endDate;
+
+
+ public Start getStart() {
+ return start;
+ }
+
+ public void setStart(Start start) {
+ this.start = start;
+ }
+
+ public Recurr getRecurr() {
+ return recurr;
+ }
+
+ public void setRecurr(Recurr recurr) {
+ this.recurr = recurr;
+ }
+
+ public Date getOnceDateTime() {
+ return onceDateTime;
+ }
+
+ public void setOnceDateTime(Date onceDateTime) {
+ this.onceDateTime = onceDateTime;
+ }
+
+ public Integer getMinuteInterval() {
+ return minuteInterval;
+ }
+
+ public void setMinuteInterval(Integer minuteInterval) {
+ this.minuteInterval = minuteInterval;
+ }
+
+ public Integer getMinuteInHour() {
+ return minuteInHour;
+ }
+
+ public void setMinuteInHour(Integer minuteInHour) {
+ this.minuteInHour = minuteInHour;
+ }
+
+ public HashSet<DayOfWeek> getDaysOfWeek() {
+ return daysOfWeek;
+ }
+
+ public void setDaysOfWeek(HashSet<DayOfWeek> daysOfWeek) {
+ this.daysOfWeek = daysOfWeek;
+ }
+
+ public Integer getDayOfMonth() {
+ return dayOfMonth;
+ }
+
+ public void setDayOfMonth(Integer dayOfMonth) {
+ this.dayOfMonth = dayOfMonth;
+ }
+
+ public Date getStartDate() {
+ return startDate;
+ }
+
+ public void setStartDate(Date startDate) {
+ this.startDate = startDate;
+ }
+
+ public Date getEndDate() {
+ return endDate;
+ }
+
+ public void setEndDate(Date endDate) {
+ this.endDate = endDate;
+ }
+
+ public Date getTimeOfDay() {
+ return timeOfDay;
+ }
+
+ public void setTimeOfDay(Date timeOfDay) {
+ this.timeOfDay = timeOfDay;
+ }
+
+ public String getMessage() {
+ DateTimeFormat dateFormat = DateTimeFormat.getMediumDateFormat();
+ DateTimeFormat timeFormat = DateTimeFormat.getMediumTimeFormat();
+
+
+ String message = "Will execute";
+ switch (start) {
+
+ case Immediately:
+ message += " immediately";
+ break;
+ case Future:
+
+ if (recurr == Recurr.Once) {
+ message += " once at " + onceDateTime;
+
+ } else {
+ switch (recurr) {
+ case EveryNMinutes:
+ message += " every " + minuteInterval + " minutes";
+ break;
+ case Hourly:
+ message += " every hour on the " + suffix(minuteInHour) + " minute";
+ break;
+ case Daily:
+ message += " every day at " + timeFormat.format(timeOfDay);
+ break;
+ case Weekly:
+ message += " every week on " + daysOfWeek.toString() + " at " + timeFormat.format(timeOfDay);
+ break;
+ case Monthly:
+ message += " every month on the " + suffix(dayOfMonth) + " day at " + timeFormat.format(timeOfDay);
+ break;
+ }
+
+ message += ", starting on " + dateFormat.format(startDate);
+ if (endDate != null) {
+ message += " and ending on " + dateFormat.format(endDate);
+ }
+
+ }
+ break;
+ }
+ message += ".";
+ return message;
+ }
+
+
+ public String getCronString() {
+
+ /* Cron fields
+ 1. Seconds
+ 2. Minutes
+ 3. Hours
+ 4. Day-of-Month
+ 5. Month
+ 6. Day-of-Week
+ 7. Year (optional field)
+ */
+
+ String cseconds, cminutes = null, chours = null, cdayOfMonth = null, cmonth = null, cdayOfWeek = null;
+
+ cseconds = "0";
+
+ DateTimeFormat dateFormat = DateTimeFormat.getMediumDateFormat();
+ DateTimeFormat timeFormat = DateTimeFormat.getMediumTimeFormat();
+
+ switch (start) {
+
+ case Immediately:
+ return null; // No cron string for immediate execution
+
+ case Future:
+
+ if (recurr == Recurr.Once) {
+ return null; // No cron string for non recurring
+ } else {
+ switch (recurr) {
+ case EveryNMinutes:
+ cminutes = "0/" + minuteInterval;
+ chours = cdayOfMonth = cmonth = "*";
+ cdayOfWeek = "?";
+ break;
+ case Hourly:
+ cminutes = "" + minuteInHour;
+ chours = "*";
+ cdayOfMonth = cmonth = cdayOfWeek = "*";
+ break;
+ case Daily:
+ cminutes = "" + timeOfDay.getMinutes();
+ chours = "" + timeOfDay.getHours();
+ cdayOfMonth = cmonth = cdayOfWeek = "*";
+ break;
+ case Weekly:
+ cminutes = "" + timeOfDay.getMinutes();
+ chours = "" + timeOfDay.getHours();
+ cdayOfMonth = "?";
+ cmonth = "*";
+ cdayOfWeek = daysOfWeek.toString();
+ break;
+ case Monthly:
+ cminutes = "" + timeOfDay.getMinutes();
+ chours = "" + timeOfDay.getHours();
+ cdayOfMonth = "" + dayOfMonth;
+ cmonth = "*";
+ cdayOfWeek = "?";
+ break;
+ }
+ }
+ break;
+ }
+ return cseconds + " " + cminutes + " " + chours + " " + cdayOfMonth + " " + cmonth + " " + cdayOfWeek;
+
+ }
+
+
+ public String suffix(int num) {
+ int last = num % 10;
+ switch (last) {
+ case 1:
+ return num + "st";
+ case 2:
+ return num + "nd";
+ case 3:
+ return num + "rd";
+ default:
+ return num + "th";
+ }
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationCreateWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationCreateWizard.java
index adedfb0..5fb555f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationCreateWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationCreateWizard.java
@@ -23,6 +23,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
@@ -30,11 +31,13 @@ import com.smartgwt.client.widgets.events.ClickHandler;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.operation.OperationDefinition;
import org.rhq.core.domain.resource.Resource;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.wizard.Wizard;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardView;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.OperationGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
/**
* @author Greg Hinkle
@@ -118,6 +121,31 @@ public class OperationCreateWizard implements Wizard {
OperationGWTServiceAsync operationService = GWTServiceLookup.getOperationService();
Configuration parameters = parametersStep.getParameterConfiguration();
+ final ExecutionSchedule schedule = schedulingStep.getExecutionSchedule();
+
+ GWTServiceLookup.getOperationService().scheduleResourceOperation(
+ resource.getId(),
+ operationDefinition.getName(),
+ parameters,
+ schedule,
+ " testing ",
+ 0,
+ new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ // TODO: Implement this method.
+ CoreGUI.getErrorHandler().handleError("Failed to schedule operation execution",caught);
+ }
+
+ public void onSuccess(Void result) {
+
+ String message = "Schedule operation [" + operationDefinition.getName()
+ + "] on resource [" + resource.getId() + "] with cron string [" + schedule.getCronString() + "]";
+
+ CoreGUI.getMessageCenter().notify(new Message(message, Message.Severity.Info));
+ }
+ }
+ );
+
view.closeDialog();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationParametersStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationParametersStep.java
index 5874f2d..6ae3921 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationParametersStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationParametersStep.java
@@ -65,7 +65,7 @@ public class OperationParametersStep implements WizardStep {
}
public Configuration getParameterConfiguration() {
- return configurationEditor.getConfiguration();
+ return configurationEditor != null ? configurationEditor.getConfiguration() : null;
}
public boolean isNextEnabled() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java
index 6d3fd2c..e923b08 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java
@@ -19,12 +19,18 @@
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.create;
import java.util.Date;
+import java.util.EnumSet;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
import com.smartgwt.client.types.FormErrorOrientation;
import com.smartgwt.client.types.TimeFormatter;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.FormItemIfFunction;
+import com.smartgwt.client.widgets.form.ValuesManager;
+import com.smartgwt.client.widgets.form.events.ItemChangedEvent;
+import com.smartgwt.client.widgets.form.events.ItemChangedHandler;
import com.smartgwt.client.widgets.form.fields.CanvasItem;
import com.smartgwt.client.widgets.form.fields.CheckboxItem;
import com.smartgwt.client.widgets.form.fields.DateItem;
@@ -32,32 +38,40 @@ import com.smartgwt.client.widgets.form.fields.FormItem;
import com.smartgwt.client.widgets.form.fields.HeaderItem;
import com.smartgwt.client.widgets.form.fields.IntegerItem;
import com.smartgwt.client.widgets.form.fields.RadioGroupItem;
+import com.smartgwt.client.widgets.form.fields.SpacerItem;
+import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.form.fields.TimeItem;
import com.smartgwt.client.widgets.form.validator.CustomValidator;
-
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
/**
* @author Greg Hinkle
*/
-public class OperationSchedulingStep implements WizardStep {
+public class OperationSchedulingStep implements WizardStep, ItemChangedHandler {
private DynamicForm form;
+ private ValuesManager valuesManager;
+
+ private ExecutionSchedule executionSchedule = new ExecutionSchedule();
public Canvas getCanvas() {
if (form == null) {
+ valuesManager = new ValuesManager();
form = new DynamicForm();
+ form.setValuesManager(valuesManager);
form.setWrapItemTitles(false);
form.setErrorOrientation(FormErrorOrientation.RIGHT);
form.setWidth100();
- form.setNumCols(4);
- form.setColWidths("15%", "35%", "15%", "*");
+ form.setPadding(10);
+ form.setNumCols(3);
+// form.setColWidths("15%", "35%", "15%", "*");
form.setValidateOnChange(true);
final RadioGroupItem start = new RadioGroupItem("start", "Start");
start.setColSpan(3);
- start.setValueMap("Immediately", "Schedule for Future");
+ start.setValueMap(enumValueMap(ExecutionSchedule.Start.class)); // "Immediately", "Future"
start.setRedrawOnChange(true);
start.setValue("Immediately");
@@ -70,7 +84,7 @@ public class OperationSchedulingStep implements WizardStep {
});
RadioGroupItem recurr = new RadioGroupItem("recurr", "Recurrence");
- recurr.setValueMap("Once", "Daily", "Weekly", "Monthly");
+ recurr.setValueMap(enumValueMap(ExecutionSchedule.Recurr.class)); // "Once", "EveryNMinutes", "Hourly", "Daily", "Weekly", "Monthly");
recurr.setRedrawOnChange(true);
recurr.setValue("Once");
recurr.setShowIfCondition(new FormItemIfFunction() {
@@ -79,40 +93,64 @@ public class OperationSchedulingStep implements WizardStep {
}
});
- CanvasItem onceItem = new CanvasItem("once", "Run At");
- onceItem.setShowTitle(false);
- onceItem.setCanvas(getOnceForm());
- onceItem.setShowIfCondition(new FormItemIfFunction() {
+
+
+ CanvasItem onceForm = new CanvasItem("once", "Run At");
+ onceForm.setShowTitle(false);
+ onceForm.setCanvas(getOnceForm());
+ onceForm.setShowIfCondition(new FormItemIfFunction() {
public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !"Immediately".equals(form.getValueAsString("start"))
- && "Once".equals(form.getValueAsString("recurr"));
+ return !"Immediately".equals(form.getValueAsString("start")) &&
+ ExecutionSchedule.Recurr.Once.name().equals(form.getValueAsString("recurr"));
}
});
- CanvasItem dailyItem = new CanvasItem("daily", "Days");
- dailyItem.setShowTitle(false);
- dailyItem.setCanvas(getDailyForm());
- dailyItem.setShowIfCondition(new FormItemIfFunction() {
+
+ CanvasItem everyNMinuteForm = new CanvasItem("everyNMinutesForm", "NMinutes");
+ everyNMinuteForm.setShowTitle(false);
+ everyNMinuteForm.setCanvas(getEveryNMinutesForm());
+ everyNMinuteForm.setShowIfCondition(new FormItemIfFunction() {
+ public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
+ return !"Immediately".equals(form.getValueAsString("start")) &&
+ ExecutionSchedule.Recurr.EveryNMinutes.name().equals(form.getValueAsString("recurr"));
+ }
+ });
+
+ CanvasItem hourlyForm = new CanvasItem("hourlyForm", "Hourly");
+ hourlyForm.setShowTitle(false);
+ hourlyForm.setCanvas(getHourlyForm());
+ hourlyForm.setShowIfCondition(new FormItemIfFunction() {
+ public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
+ return !"Immediately".equals(form.getValueAsString("start")) &&
+ ExecutionSchedule.Recurr.Hourly.name().equals(form.getValueAsString("recurr"));
+ }
+ });
+
+ CanvasItem dailyForm = new CanvasItem("daily", "Days");
+ dailyForm.setShowTitle(false);
+ dailyForm.setCanvas(getDailyForm());
+ dailyForm.setShowIfCondition(new FormItemIfFunction() {
public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
return !"Immediately".equals(form.getValueAsString("start"))
&& "Daily".equals(form.getValueAsString("recurr"));
}
});
- CanvasItem weeklyItem = new CanvasItem("weekly", "Weekly");
- weeklyItem.setShowTitle(false);
- weeklyItem.setCanvas(getWeeklyForm());
- weeklyItem.setShowIfCondition(new FormItemIfFunction() {
+
+ CanvasItem weeklyForm = new CanvasItem("weekly", "Weekly");
+ weeklyForm.setShowTitle(false);
+ weeklyForm.setCanvas(getWeeklyForm());
+ weeklyForm.setShowIfCondition(new FormItemIfFunction() {
public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
return !"Immediately".equals(form.getValueAsString("start"))
&& "Weekly".equals(form.getValueAsString("recurr"));
}
});
- CanvasItem monthlyItem = new CanvasItem("monthly", "Monthly");
- monthlyItem.setShowTitle(false);
- monthlyItem.setCanvas(getMonthlyForm());
- monthlyItem.setShowIfCondition(new FormItemIfFunction() {
+ CanvasItem monthlyForm = new CanvasItem("monthly", "Monthly");
+ monthlyForm.setShowTitle(false);
+ monthlyForm.setCanvas(getMonthlyForm());
+ monthlyForm.setShowIfCondition(new FormItemIfFunction() {
public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
return !"Immediately".equals(form.getValueAsString("start"))
&& "Monthly".equals(form.getValueAsString("recurr"));
@@ -167,31 +205,123 @@ public class OperationSchedulingStep implements WizardStep {
}
});
- form.setItems(start, scheduleHeader, recurr, onceItem, dailyItem, weeklyItem, monthlyItem, rangeHeader,
- startDate, end, endDate);
+ StaticTextItem messageItem = new StaticTextItem("message");
+ messageItem.setValue("Will execute immediately");
+ messageItem.setStartRow(true);
+ messageItem.setColSpan(3);
+ messageItem.setShowTitle(false);
+ messageItem.setCellStyle("HeaderLabel");
+
+ form.setItems(start, scheduleHeader, recurr,
+ onceForm, everyNMinuteForm, hourlyForm, dailyForm, weeklyForm, monthlyForm,
+ rangeHeader, startDate, end, endDate,
+ new SpacerItem(), messageItem);
+
+
+
+ form.addItemChangedHandler(this);
}
+
return form;
}
private DynamicForm getOnceForm() {
DynamicForm form = new DynamicForm();
+ form.setValuesManager(valuesManager);
+ form.setPadding(10);
+ form.setIsGroup(true);
+ form.setGroupTitle("Once At");
+ form.addItemChangedHandler(this);
+
form.setWrapItemTitles(false);
form.setNumCols(2);
- DateItem startDate = new DateItem("startDate", "Date");
+ DateItem startDate = new DateItem("onceStartDate", "Date");
+ startDate.setValue(new Date());
- TimeItem startTime = new TimeItem("startTime", "Time");
+ TimeItem startTime = new TimeItem("onceStartDate", "Time");
+ startTime.setValue(new Date());
startTime.setDisplayFormat(TimeFormatter.TOSHORTPADDEDTIME);
startTime.setUseMask(true);
form.setItems(startDate, startTime);
return form;
}
+ private DynamicForm getEveryNMinutesForm() {
+ DynamicForm form = new DynamicForm();
+ form.setValuesManager(valuesManager);
+ form.setPadding(10);
+ form.setIsGroup(true);
+ form.setGroupTitle("Every N Minutes");
+ form.addItemChangedHandler(this);
+
+
+ form.setWrapItemTitles(false);
+ form.setNumCols(2);
+
+ IntegerItem everyNMinutes = new IntegerItem();
+ everyNMinutes.setName("minuteInterval");
+ everyNMinutes.setTitle("Minute Interval");
+ everyNMinutes.setValue(60);
+
+ form.setItems(everyNMinutes);
+ return form;
+ }
+
+ private DynamicForm getHourlyForm() {
+ DynamicForm form = new DynamicForm();
+ form.setValuesManager(valuesManager);
+ form.setPadding(10);
+ form.setIsGroup(true);
+ form.setGroupTitle("Hourly At");
+ form.addItemChangedHandler(this);
+
+
+ form.setWrapItemTitles(false);
+ form.setNumCols(2);
+
+ IntegerItem minuteOfHour = new IntegerItem();
+ minuteOfHour.setName("minuteOfHour");
+ minuteOfHour.setTitle("Minute of Hour");
+ minuteOfHour.setValue(5);
+
+ form.setItems(minuteOfHour);
+ return form;
+ }
+
+
+ private DynamicForm getDailyForm() {
+ DynamicForm form = new DynamicForm();
+ form.setValuesManager(valuesManager);
+ form.setPadding(10);
+ form.setWrapItemTitles(false);
+ form.setIsGroup(true);
+ form.setGroupTitle("Daily At");
+ form.addItemChangedHandler(this);
+
+ TimeItem timeOfDay = new TimeItem("timeOfDay", "Time Of Day");
+ timeOfDay.setValue(new Date());
+ timeOfDay.setDisplayFormat(TimeFormatter.TOSHORTPADDEDTIME);
+ timeOfDay.setUseMask(true);
+
+ form.setItems(timeOfDay);
+ return form;
+ }
+
+
private DynamicForm getWeeklyForm() {
DynamicForm form = new DynamicForm();
+ form.setValuesManager(valuesManager);
+ form.setPadding(10);
+ form.setIsGroup(true);
+ form.setGroupTitle("Weekly On");
+ form.addItemChangedHandler(this);
+
+
form.setWrapItemTitles(false);
TimeItem timeOfDay = new TimeItem("timeOfDay", "Time Of Day");
+ timeOfDay.setValue(new Date());
timeOfDay.setDisplayFormat(TimeFormatter.TOSHORTPADDEDTIME);
timeOfDay.setUseMask(true);
@@ -208,26 +338,23 @@ public class OperationSchedulingStep implements WizardStep {
return form;
}
- private DynamicForm getDailyForm() {
- DynamicForm form = new DynamicForm();
- form.setWrapItemTitles(false);
-
- TimeItem timeOfDay = new TimeItem("timeOfDay", "Time Of Day");
- timeOfDay.setDisplayFormat(TimeFormatter.TOSHORTPADDEDTIME);
- timeOfDay.setUseMask(true);
-
- form.setItems(timeOfDay);
- return form;
- }
-
private DynamicForm getMonthlyForm() {
DynamicForm form = new DynamicForm();
+ form.setValuesManager(valuesManager);
+ form.setPadding(10);
form.setWrapItemTitles(false);
+ form.setIsGroup(true);
+ form.setGroupTitle("Monthly On");
+ form.addItemChangedHandler(this);
+
IntegerItem dayItem = new IntegerItem();
+ dayItem.setName("dayOfMonth");
dayItem.setTitle("Day of Month");
+ dayItem.setValue(1);
TimeItem timeOfDay = new TimeItem("timeOfDay", "Time Of Day");
+ timeOfDay.setValue(new Date());
timeOfDay.setDisplayFormat(TimeFormatter.TOSHORTPADDEDTIME);
timeOfDay.setUseMask(true);
@@ -250,4 +377,60 @@ public class OperationSchedulingStep implements WizardStep {
public boolean isPreviousEnabled() {
return true;
}
+
+ public void onItemChanged(ItemChangedEvent itemChangeEvent) {
+
+
+ executionSchedule.setStart(ExecutionSchedule.Start.valueOf(valuesManager.getValueAsString("start")));
+ executionSchedule.setRecurr(ExecutionSchedule.Recurr.valueOf(valuesManager.getValueAsString("recurr")));
+
+
+ Date onceDate = (Date) valuesManager.getValues().get("onceStartDate");
+ executionSchedule.setOnceDateTime(onceDate);
+
+ executionSchedule.setMinuteInterval(Integer.parseInt(valuesManager.getValueAsString("minuteInterval")));
+
+ executionSchedule.setMinuteInHour(Integer.parseInt(valuesManager.getValueAsString("minuteOfHour")));
+
+ executionSchedule.setTimeOfDay((Date) valuesManager.getValues().get("timeOfDay"));
+
+
+ HashSet<ExecutionSchedule.DayOfWeek> selectedDays = new HashSet<ExecutionSchedule.DayOfWeek>(); //.noneOf(ExecutionSchedule.DayOfWeek.class);
+ for (ExecutionSchedule.DayOfWeek d : EnumSet.allOf(ExecutionSchedule.DayOfWeek.class)) {
+ if (valuesManager.getValues().containsKey(d.name())) {
+ selectedDays.add(d);
+ }
+ }
+ executionSchedule.setDaysOfWeek(selectedDays);
+
+
+
+ executionSchedule.setDayOfMonth(Integer.parseInt(valuesManager.getValueAsString("dayOfMonth")));
+
+
+
+ executionSchedule.setStartDate((Date)valuesManager.getValues().get("startDate"));
+
+ if ("Never".equals(valuesManager.getValues().get("endType"))) {
+ executionSchedule.setEndDate(null);
+ } else {
+ executionSchedule.setEndDate((Date)valuesManager.getValues().get("endDate"));
+ }
+
+ form.setValue("message",executionSchedule.getMessage());
+ }
+
+
+ private LinkedHashMap<String,String> enumValueMap(Class<? extends Enum> e) {
+ LinkedHashMap<String,String> map = new LinkedHashMap<String, String>();
+ for (Object o : EnumSet.allOf(e)) {
+ Enum v = (Enum) o;
+ map.put(v.name(),v.name()); // localize
+ }
+ return map;
+ }
+
+ public ExecutionSchedule getExecutionSchedule() {
+ return executionSchedule;
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/detail/OperationDetailsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/detail/OperationDetailsView.java
new file mode 100644
index 0000000..9c14c0e
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/detail/OperationDetailsView.java
@@ -0,0 +1,116 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.detail;
+
+import java.util.Date;
+
+import com.smartgwt.client.widgets.Window;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.StaticTextItem;
+import com.smartgwt.client.widgets.layout.VLayout;
+
+import org.rhq.core.domain.operation.OperationDefinition;
+import org.rhq.core.domain.operation.ResourceOperationHistory;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
+
+/**
+ * @author Greg Hinkle
+ */
+public class OperationDetailsView extends VLayout {
+
+ OperationDefinition definition;
+ ResourceOperationHistory operationHistory;
+
+ public OperationDetailsView(OperationDefinition definition, ResourceOperationHistory operationHistory) {
+ this.definition = definition;
+ this.operationHistory = operationHistory;
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+
+ // Information Form
+
+ DynamicForm form = new DynamicForm();
+
+ StaticTextItem operationItem = new StaticTextItem("operation", "Operation");
+ operationItem.setValue(definition.getName());
+
+
+ StaticTextItem submittedItem = new StaticTextItem("submitted", "Date Submitted");
+ submittedItem.setValue(new Date(operationHistory.getStartedTime()));
+
+ StaticTextItem completedItem = new StaticTextItem("completed", "Date Completed");
+ completedItem.setValue(new Date(operationHistory.getStartedTime() + operationHistory.getDuration()));
+
+
+ StaticTextItem requesterItem = new StaticTextItem("requester", "Requester");
+ requesterItem.setValue(operationHistory.getSubjectName());
+
+ StaticTextItem statusItem = new StaticTextItem("status", "Status");
+ statusItem.setValue(operationHistory.getStatus().name());
+
+ /*
+ Operation: View Process List
+ Date Submitted: 3/11/10, 12:24:02 PM, EST
+ Date Completed: 3/11/10, 12:24:03 PM, EST
+ Requester: rhqadmin
+ Status: Success
+ */
+
+ form.setItems(operationItem, submittedItem, completedItem, requesterItem,statusItem);
+
+ addMember(form);
+
+ // Results configuration view
+
+
+ if (operationHistory.getResults() != null) {
+
+ ConfigurationEditor resultsEditor = new ConfigurationEditor(definition.getResultsConfigurationDefinition(), operationHistory.getResults());
+
+ addMember(resultsEditor);
+
+ }
+ }
+
+
+
+ public static void displayDetailsDialog(ResourceOperationHistory operationHistory) {
+
+ OperationDetailsView detailsView = new OperationDetailsView(operationHistory.getOperationDefinition(), operationHistory);
+
+
+ Window window = new Window();
+ window.setTitle(operationHistory.getOperationDefinition().getDisplayName() + " History");
+ window.setWidth(900);
+ window.setHeight(900);
+ window.setIsModal(true);
+ window.setShowModalMask(true);
+ window.setCanDragResize(true);
+ window.centerInPage();
+ window.addItem(detailsView);
+ window.show();
+
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java
index b5f5da7..905e6c6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java
@@ -23,18 +23,29 @@ import java.util.LinkedList;
import com.google.gwt.user.client.Timer;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.AnimationEffect;
+import com.smartgwt.client.types.TitleOrientation;
import com.smartgwt.client.types.VerticalAlignment;
+import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.AnimationCallback;
+import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.Label;
+import com.smartgwt.client.widgets.Window;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.ButtonItem;
+import com.smartgwt.client.widgets.form.fields.FormItemIcon;
+import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.LayoutSpacer;
import com.smartgwt.client.widgets.menu.IMenuButton;
import com.smartgwt.client.widgets.menu.Menu;
import com.smartgwt.client.widgets.menu.MenuItem;
+import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent;
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.upload.DynamicFormHandler;
/**
* @author Greg Hinkle
@@ -61,8 +72,16 @@ public class MessageCenterView extends HLayout implements MessageCenter.MessageL
} else {
MenuItem[] items = new MenuItem[messages.size()];
int i = 0;
- for (Message message : messages) {
- items[i++] = new MenuItem(message.title, getSeverityIcon(message.severity));
+ for (final Message message : messages) {
+ MenuItem messageItem = new MenuItem(message.title, getSeverityIcon(message.severity));
+
+ items[i++] = messageItem;
+
+ messageItem.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
+ public void onClick(MenuItemClickEvent event) {
+ showDetails(message);
+ }
+ });
}
recentEventsMenu.setItems(items);
}
@@ -74,7 +93,46 @@ public class MessageCenterView extends HLayout implements MessageCenter.MessageL
addMember(new LayoutSpacer());
}
- public void onMessage(Message message) {
+ private void showDetails(Message message) {
+ DynamicForm form = new DynamicForm();
+ form.setWrapItemTitles(false);
+
+ StaticTextItem title = new StaticTextItem("title","Title");
+ title.setValue(message.title);
+
+ StaticTextItem severity = new StaticTextItem("severity","Severity");
+ FormItemIcon severityIcon = new FormItemIcon();
+ severityIcon.setSrc(getSeverityIcon(message.severity));
+ severity.setIcons(severityIcon);
+ severity.setValue(message.severity.name());
+
+ StaticTextItem date = new StaticTextItem("time","Time");
+ date.setValue(message.fired);
+
+ StaticTextItem detail = new StaticTextItem("detail","Detail");
+ detail.setTitleOrientation(TitleOrientation.TOP);
+ detail.setValue(message.detail);
+
+ ButtonItem okButton = new ButtonItem("Ok","Ok");
+ okButton.setColSpan(2);
+ okButton.setAlign(Alignment.CENTER);
+
+ form.setItems(title,severity,date,detail, okButton );
+
+ Window window = new Window();
+ window.setTitle(message.title);
+ window.setWidth(600);
+ window.setHeight(400);
+ window.setIsModal(true);
+ window.setShowModalMask(true);
+ window.setCanDragResize(true);
+ window.centerInPage();
+ window.addItem(form);
+ window.show();
+ okButton.focusInItem();
+ }
+
+ public void onMessage(final Message message) {
final Label label = new Label(message.title);
label.setMargin(5);
label.setAutoFit(true);
@@ -87,6 +145,11 @@ public class MessageCenterView extends HLayout implements MessageCenter.MessageL
label.setTooltip(message.detail);
+ label.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ showDetails(message);
+ }
+ });
addMember(label,1);
redraw();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/OperationGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/OperationGWTServiceImpl.java
index 52d29e4..0519a0b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/OperationGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/OperationGWTServiceImpl.java
@@ -18,14 +18,19 @@
*/
package org.rhq.enterprise.gui.coregui.server.gwt;
+import org.quartz.CronTrigger;
+
+import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.criteria.GroupOperationHistoryCriteria;
import org.rhq.core.domain.criteria.ResourceOperationHistoryCriteria;
import org.rhq.core.domain.operation.GroupOperationHistory;
import org.rhq.core.domain.operation.ResourceOperationHistory;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.gwt.OperationGWTService;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.create.ExecutionSchedule;
import org.rhq.enterprise.gui.coregui.server.util.SerialUtility;
import org.rhq.enterprise.server.operation.OperationManagerLocal;
+import org.rhq.enterprise.server.operation.ResourceOperationSchedule;
import org.rhq.enterprise.server.util.LookupUtil;
/**
@@ -40,11 +45,34 @@ public class OperationGWTServiceImpl extends AbstractGWTServiceImpl implements O
"OperationService.findResourceOperationHistoriesByCriteria");
}
+
public PageList<GroupOperationHistory> findGroupOperationHistoriesByCriteria(GroupOperationHistoryCriteria criteria) {
return SerialUtility.prepare(operationManager.findGroupOperationHistoriesByCriteria(getSessionSubject(), criteria),
"OperationService.findGroupOperationHistoriesByCriteria");
}
+ public void scheduleResourceOperation(
+ int resourceId, String operationName, Configuration parameters, ExecutionSchedule schedule, String description, int timeout)
+ throws RuntimeException {
+ ResourceOperationSchedule opSchedule;
+ try {
+
+ if (schedule.getStart() == ExecutionSchedule.Start.Immediately) {
+ opSchedule = operationManager.scheduleResourceOperation(getSessionSubject(), resourceId, operationName, 0, 0, 0, 0, parameters, description);
+ } else {
+
+ CronTrigger ct = new CronTrigger(
+ "resource " + resourceId + "_" + operationName,
+ "group",
+ schedule.getCronString());
+
+ opSchedule = operationManager.scheduleResourceOperation(getSessionSubject(), resourceId, operationName, parameters, ct, description);
+ }
+ } catch (Exception e) {
+ throw new RuntimeException("Unabled to schedule operation execution" + e.getMessage());
+ }
+ }
+
}
commit 1cefdb850b0583df0befa7fc46ea9ef4d686fd39
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Mar 11 15:09:14 2010 -0500
add a prototype of bundle file upload from gwt wizard - not pretty but at least the file upload works which is what I wanted to confirm
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
index 0bdcff3..08e2f5a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
@@ -30,6 +30,7 @@ import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.components.upload.BundleFileUploadForm;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
@@ -106,9 +107,9 @@ public class BundleUploadDataStep implements WizardStep {
Img img = new Img("/images/status_complete.gif", 50, 15);
vlayout.addMember(img);
} else {
- // TODO I really want a file upload component here
- Img img = new Img("/images/status_error.gif", 50, 15);
- vlayout.addMember(img);
+ BundleFileUploadForm uploadForm = new BundleFileUploadForm(this.wizard.getBundleVersion(), entry
+ .getKey());
+ vlayout.addMember(uploadForm);
}
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleFileUploadForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleFileUploadForm.java
new file mode 100644
index 0000000..f817dbc
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleFileUploadForm.java
@@ -0,0 +1,92 @@
+/*
+ * 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.upload;
+
+import com.google.gwt.core.client.GWT;
+import com.smartgwt.client.types.Encoding;
+import com.smartgwt.client.widgets.form.fields.ButtonItem;
+import com.smartgwt.client.widgets.form.fields.FormItemIcon;
+import com.smartgwt.client.widgets.form.fields.HiddenItem;
+import com.smartgwt.client.widgets.form.fields.UploadItem;
+import com.smartgwt.client.widgets.form.fields.events.ChangeEvent;
+import com.smartgwt.client.widgets.form.fields.events.ChangeHandler;
+import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
+import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
+
+import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+
+public class BundleFileUploadForm extends DynamicCallbackForm {
+
+ private BundleVersion bundleVersion;
+ private String name;
+
+ public BundleFileUploadForm(BundleVersion bundleVersion, String name) {
+ super("bundleFileUpload");
+ this.bundleVersion = bundleVersion;
+ this.name = name;
+
+ setNumCols(8);
+ setEncoding(Encoding.MULTIPART);
+ setAction(GWT.getModuleBaseURL() + "/BundleFileUploadServlet");
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+ HiddenItem sessionIdField = new HiddenItem("sessionid");
+ sessionIdField.setValue(CoreGUI.getSessionSubject().getSessionId().intValue());
+
+ HiddenItem bundleVersionIdField = new HiddenItem("bundleVersionId");
+ bundleVersionIdField.setValue(this.bundleVersion.getId());
+
+ HiddenItem nameField = new HiddenItem("name");
+ nameField.setValue(this.name);
+
+ final UploadItem bundleUploadItem = new UploadItem("bundleFile", "Upload File");
+ bundleUploadItem.setEndRow(false);
+
+ final ButtonItem uploadButton = new ButtonItem("Upload");
+ uploadButton.setDisabled(true);
+
+ bundleUploadItem.addChangeHandler(new ChangeHandler() {
+ public void onChange(ChangeEvent changeEvent) {
+ uploadButton.setDisabled(false);
+ }
+ });
+
+ uploadButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ uploadButton.setShowIcons(true);
+ markForRedraw();
+ submitForm();
+ }
+ });
+
+ FormItemIcon loadingIcon = new FormItemIcon();
+ loadingIcon.setSrc("ajax-loader.gif");
+ loadingIcon.setWidth(16);
+ loadingIcon.setHeight(16);
+ uploadButton.setIcons(loadingIcon);
+ uploadButton.setShowIcons(false);
+
+ setItems(sessionIdField, bundleVersionIdField, nameField, bundleUploadItem, uploadButton);
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleFileUploadServlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleFileUploadServlet.java
new file mode 100644
index 0000000..4e07cc2
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleFileUploadServlet.java
@@ -0,0 +1,81 @@
+/*
+ * 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.server.gwt;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.bundle.BundleFile;
+import org.rhq.core.domain.content.Architecture;
+import org.rhq.enterprise.server.bundle.BundleManagerLocal;
+import org.rhq.enterprise.server.util.LookupUtil;
+
+public class BundleFileUploadServlet extends FileUploadServlet {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected void processUploadedFiles(Subject subject, Map<String, File> files, Map<String, String> formFields,
+ HttpServletRequest request, HttpServletResponse response) throws IOException {
+
+ String successMsg;
+
+ try {
+ // note that this assumes 1 and only 1 file is uploaded
+ File file = files.values().iterator().next();
+
+ int bundleVersionId = Integer.parseInt(getFormField(formFields, "bundleVersionId", null));
+ String name = getFormField(formFields, "name", file.getName());
+ String version = getFormField(formFields, "version", "1.0");
+ Architecture architecture = new Architecture(getFormField(formFields, "arch", "noarch"));
+ InputStream fileStream = new FileInputStream(file);
+ boolean pinToPackage = Boolean.parseBoolean(getFormField(formFields, "pinToPackage", "false"));
+
+ BundleManagerLocal bundleManager = LookupUtil.getBundleManager();
+ BundleFile bundleFile = bundleManager.addBundleFile(subject, bundleVersionId, name, version, architecture,
+ fileStream, pinToPackage);
+ successMsg = "success [" + bundleFile.getId() + "]";
+ } catch (Exception e) {
+ writeExceptionResponse(response, "Failed to upload bundle file", e);
+ return;
+ }
+
+ PrintWriter writer = response.getWriter();
+ writer.println("<html>");
+ writer.println(successMsg);
+ writer.println("</html>");
+ writer.flush();
+ return;
+ }
+
+ private String getFormField(Map<String, String> formFields, String key, String defaultValue) {
+ String value = formFields.get(key);
+ if (value == null) {
+ value = defaultValue;
+ }
+ return value;
+ }
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/FileUploadServlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/FileUploadServlet.java
index d0bf1b4..e10a8b2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/FileUploadServlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/FileUploadServlet.java
@@ -64,13 +64,7 @@ public class FileUploadServlet extends HttpServlet {
try {
fileItemsList = (List<FileItem>) servletFileUpload.parseRequest(req);
} catch (FileUploadException e) {
- PrintWriter writer = resp.getWriter();
- writer.write("<html><head></head><body><strong>File upload failed:</strong><br/>\n");
- for (StackTraceElement elem : e.getStackTrace()) {
- writer.write(elem.toString() + "<br/>\n");
- }
- writer.write("</body></html>");
- writer.flush();
+ writeExceptionResponse(resp, "File upload failed", e);
return;
}
@@ -136,6 +130,16 @@ public class FileUploadServlet extends HttpServlet {
}
}
+ protected void writeExceptionResponse(HttpServletResponse resp, String msg, Exception e) throws IOException {
+ PrintWriter writer = resp.getWriter();
+ writer.write("<html><head></head><body><strong>" + msg + "</strong><br/>\n");
+ for (StackTraceElement elem : e.getStackTrace()) {
+ writer.write(elem.toString() + "<br/>\n");
+ }
+ writer.write("</body></html>");
+ writer.flush();
+ }
+
/**
* This method will write the names of all files (the local file system location where the file was stored)
* to the response - each local filename on its own line.
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml b/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
index eb7a02d..78784d2 100644
--- a/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
+++ b/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
@@ -56,6 +56,11 @@
</servlet>
<servlet>
+ <servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI BundleFileUploadServlet</servlet-name>
+ <servlet-class>org.rhq.enterprise.gui.coregui.server.gwt.BundleFileUploadServlet</servlet-class>
+ </servlet>
+
+ <servlet>
<servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI ResourceBossGWTService</servlet-name>
<servlet-class>org.rhq.enterprise.gui.coregui.server.gwt.ResourceBossGWTServiceImpl</servlet-class>
</servlet>
@@ -104,6 +109,10 @@
<servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI FileUploadServlet</servlet-name>
<url-pattern>/org.rhq.enterprise.gui.coregui.CoreGUI/FileUploadServlet</url-pattern>
</servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI BundleFileUploadServlet</servlet-name>
+ <url-pattern>/org.rhq.enterprise.gui.coregui.CoreGUI/BundleFileUploadServlet</url-pattern>
+ </servlet-mapping>
<servlet-mapping>
<servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI ResourceBossGWTService</servlet-name>
commit 234c6082dcf182c27b6d6512f5e2147d7f7dc18c
Merge: 24c241f... 9e8ccb0...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Mar 11 14:18:06 2010 -0500
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
commit 24c241f350f90c7ffcfbd7e673ff5d8fc5e5bc41
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Mar 11 14:17:47 2010 -0500
make sure to load in the architecture so we know its ID if its not yet known
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
index 570a0a6..0ed5052 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
@@ -299,6 +299,11 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
Bundle bundle = bundleVersion.getBundle();
PackageType packageType = getBundleTypePackageType(bundle.getBundleType());
architecture = (null == architecture) ? contentManager.getNoArchitecture() : architecture;
+ if (architecture.getId() == 0) {
+ Query q = entityManager.createNamedQuery(Architecture.QUERY_FIND_BY_NAME);
+ q.setParameter("name", architecture.getName());
+ architecture = (Architecture) q.getSingleResult();
+ }
PackageVersion packageVersion = contentManager.createPackageVersion(name, packageType.getId(), version,
architecture.getId(), fileStream);
commit 9e8ccb04599ea282a80e71d12576e1a897733dd7
Merge: d20cbcb... 254b9a9...
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Thu Mar 11 14:08:07 2010 -0500
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
commit d20cbcb7c4247849e1715a09f130b48da68bc524
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Thu Mar 11 14:07:28 2010 -0500
get favorite Resource toggle on Resource details view working
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
index d67cf26..4c9206e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
@@ -18,37 +18,34 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.resource.Resource;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
-import com.smartgwt.client.types.SelectionType;
-import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
-import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.Img;
-import com.smartgwt.client.widgets.ImgButton;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.layout.HLayout;
+import java.util.Set;
/**
* @author Greg Hinkle
+ * @author Ian Springer
*/
public class ResourceTitleBar extends HLayout {
+ private static final String FAV_ICON = "Favorite_24_Selected.png";
+ private static final String NOT_FAV_ICON = "Favorite_24.png";
- Resource resource;
- Img favoriteButton;
- HTMLFlow title;
- Img availabilityImage;
-
- boolean favorite;
-
- public static final String FAV_ICON = "Favorite_24_Selected.png";
- public static final String NOT_FAV_ICON = "Favorite_24.png";
-
+ private Resource resource;
+ private Img favoriteButton;
+ private HTMLFlow title;
+ private Img availabilityImage;
+ private boolean favorite;
public ResourceTitleBar() {
super();
@@ -60,25 +57,20 @@ public class ResourceTitleBar extends HLayout {
protected void onInit() {
super.onInit();
- title = new HTMLFlow();
- title.setWidth("*");
+ this.title = new HTMLFlow();
+ this.title.setWidth("*");
- availabilityImage = new Img("resources/availability_grey_24.png",24,24);
+ this.availabilityImage = new Img("resources/availability_grey_24.png", 24, 24);
+ this.favoriteButton = new Img(NOT_FAV_ICON, 24, 24);
- favoriteButton = new Img(NOT_FAV_ICON,24, 24);
- favoriteButton.setTooltip("Click to add or remove this resource as a favorite.");
-
- favoriteButton.addClickHandler(new ClickHandler() {
+ this.favoriteButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
- favorite = !favorite;
- favoriteButton.setSrc(favorite ? FAV_ICON : NOT_FAV_ICON);
- CoreGUI.getMessageCenter().notify(new Message((favorite ? "Added " : "Removed ") + " resource " + resource.getName() + " as a favorite.", Message.Severity.Info));
+ Set<Integer> favorites = toggleFavoriteLocally();
+ CoreGUI.getUserPreferences().setFavoriteResources(favorites, new UpdateFavoritesCallback());
}
});
-
-
addMember(title);
addMember(availabilityImage);
addMember(favoriteButton);
@@ -87,16 +79,47 @@ public class ResourceTitleBar extends HLayout {
public void setResource(Resource resource) {
this.resource = resource;
- title.setContents("<h2>" + resource.getName() + "</h2>");
+ this.title.setContents("<h2>" + resource.getName() + "</h2>");
- favorite = CoreGUI.getUserPreferences().getFavoriteResources().contains(resource.getId());
- favoriteButton.setSrc(favorite ? FAV_ICON : NOT_FAV_ICON);
+ Set<Integer> favorites = CoreGUI.getUserPreferences().getFavoriteResources();
+ this.favorite = favorites.contains(resource.getId());
+ updateFavoriteButton();
- availabilityImage.setSrc("resources/availability_" +
+ this.availabilityImage.setSrc("resources/availability_" +
(resource.getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP ? "green" : "red") +
"_24.png");
markForRedraw();
}
+ private void updateFavoriteButton() {
+ this.favoriteButton.setSrc(favorite ? FAV_ICON : NOT_FAV_ICON);
+ this.favoriteButton.setTooltip("Click to " + (favorite ? "remove" : "add") + " this Resource as a favorite.");
+ }
+ private Set<Integer> toggleFavoriteLocally() {
+ this.favorite = !this.favorite;
+ Set<Integer> favorites = CoreGUI.getUserPreferences().getFavoriteResources();
+ int resourceId = this.resource.getId();
+ if (this.favorite) {
+ favorites.add(resourceId);
+ } else {
+ favorites.remove(resourceId);
+ }
+ return favorites;
+ }
+
+ public class UpdateFavoritesCallback implements AsyncCallback<Subject> {
+ public void onSuccess(Subject subject) {
+ CoreGUI.getMessageCenter().notify(new Message((favorite ? "Added " : "Removed ") + " Resource "
+ + ResourceTitleBar.this.resource.getName() + " as a favorite.", Message.Severity.Info));
+ updateFavoriteButton();
+ }
+
+ public void onFailure(Throwable throwable) {
+ CoreGUI.getMessageCenter().notify(new Message("Failed to " + (favorite ? "add " : "remove ") + " Resource "
+ + ResourceTitleBar.this.resource.getName() + " as a favorite.", Message.Severity.Error));
+ // Revert back to our original favorite status, since the server update failed.
+ toggleFavoriteLocally();
+ }
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferenceNames.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferenceNames.java
new file mode 100644
index 0000000..751c54b
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferenceNames.java
@@ -0,0 +1,218 @@
+package org.rhq.enterprise.gui.coregui.client.util.preferences;
+
+/**
+ * Names of user preference properties. The default values for these preferences are stored in
+ * portal-war/WEB-INF/DefaultUserPreferences.properties and are populated for a user the first
+ * time that user logs in to portal-war. The default values are also stated in the Javadoc
+ * below for convenience sake.
+ *
+ * @author Ian Springer
+ */
+public abstract class UserPreferenceNames {
+ /**
+ * Default is 10.
+ */
+ public static final String AUTODISCOVERY_RANGE = ".dashContent.autoDiscovery.range";
+
+ /**
+ * Default is 5.
+ */
+ public static final String OPERATIONS_LAST_COMPLETED = ".dashContent.operations.lastCompleted";
+
+ /**
+ * Default is 5.
+ */
+ public static final String OPERATIONS_NEXT_SCHEDULED = ".dashContent.operations.nextScheduled";
+
+ /**
+ * Default is true.
+ */
+ public static final String OPERATIONS_ = ".dashContent.operations.useLastCompleted";
+
+ /**
+ * Default is true.
+ */
+ public static final String OPERATIONS_USE_NEXT_SCHEDULED = ".dashContent.operations.useNextScheduled";
+
+ /**
+ * Show platform summary counts? Default is true.
+ */
+ public static final String SUMMARY_COUNTS_PLATFORM = ".dashContent.summaryCounts.platform";
+
+ /**
+ * Show server summary counts? Default is true.
+ */
+ public static final String SUMMARY_COUNTS_SERVER = ".dashContent.summaryCounts.server";
+
+ /**
+ * Show service summary counts? Default is true.
+ */
+ public static final String SUMMARY_COUNTS_SERVICE = ".dashContent.summaryCounts.service";
+
+ /**
+ * Default is true.
+ */
+ public static final String SUMMARY_COUNTS_GROUP_COMPAT = ".dashContent.summaryCounts.group.compat";
+
+ /**
+ * Default is true.
+ */
+ public static final String SUMMARY_COUNTS_GROUP_MIXED = ".dashContent.summaryCounts.group.mixed";
+
+ /**
+ * Default is true.
+ */
+ public static final String SUMMARY_COUNTS_SOFTWARE = ".dashContent.summaryCounts.software";
+
+ /**
+ * Default is true.
+ */
+ public static final String RESOURCE_HEALTH_AVAILABILITY = ".dashContent.resourcehealth.availability";
+
+ /**
+ * Default is true.
+ */
+ public static final String RESOURCE_HEALTH_ALERTS = ".dashContent.resourcehealth.alerts";
+
+ /**
+ * List of favorite Resource id's, delimited by '|' characters. Default is "".
+ */
+ public static final String RESOURCE_HEALTH_RESOURCES = ".dashContent.resourcehealth.resources";
+
+ /**
+ * Default is 24.
+ */
+ public static final String RECENTLY_APPROVED_RANGE = ".dashContent.recentlyApproved.range";
+
+ /**
+ * Default is "".
+ */
+ public static final String RECENTLY_APPROVED_RANGE_EXPANDED_PLATFORMS = ".dashContent.recentlyApproved.expandedPlatforms";
+
+ /**
+ * Default is 5.
+ */
+ public static final String ALERTS_NUMBER_OF_ALERTS = ".dashContent.criticalalerts.numberOfAlerts";
+
+ /**
+ * Default is 86400000.
+ */
+ public static final String ALERTS_PAST = ".dashContent.criticalalerts.past";
+
+ /**
+ * Default is 0.
+ */
+ public static final String ALERTS_PRIORITY = ".dashContent.criticalalerts.priority";
+
+ /**
+ * Default is "all".
+ */
+ public static final String ALERTS_SELECTED_OR_ALL = ".dashContent.criticalalerts.selectedOrAll";
+
+ /**
+ * Default is "".
+ */
+ public static final String ALERTS_RESOURCES = ".dashContent.criticalalerts.resources";
+
+ /**
+ * Default is 10.
+ */
+ public static final String PROBLEM_RESOURCES_RANGE = ".dashContent.problemResources.range";
+
+ /**
+ * Default is 8.
+ */
+ public static final String PROBLEM_RESOURCES_HOURS = ".dashContent.problemResources.hours";
+
+ /**
+ * Default is false.
+ */
+ public static final String PROBLEM_RESOURCES_SHOW_IGNORED = ".dashContent.problemResources.showIgnored";
+
+ /**
+ * Default is "".
+ */
+ public static final String PROBLEM_RESOURCES_IGNORE_LIST = ".dashContent.problemResources.ignoreList";
+
+ /**
+ * Dashboard portlets in first/left column. Default is "|.dashContent.searchResources|.dashContent.savedCharts|.dashContent.summaryCounts".
+ */
+ public static final String PORTAL_PORTLETS_FIRST = ".dashcontent.portal.portlets.first";
+
+ /**
+ * Dashboard portlets in second/right column. Default is "|.dashContent.autoDiscovery|.dashContent.recentlyApproved|.dashContent.resourceHealth|.dashContent.criticalAlerts|.dashContent.controlActions|.dashContent.problemResources".
+ */
+ public static final String PORTAL_PORTLETS_SECOND = ".dashcontent.portal.portlets.second";
+
+ /**
+ * Default is "".
+ */
+ public static final String MONITOR_VISIBILITY_FAVORITE_METRICS_PLATFORM = ".resource.common.monitor.visibility.favoriteMetrics.platform";
+
+ /**
+ * Default is "".
+ */
+ public static final String MONITOR_VISIBILITY_FAVORITE_METRICS_SERVER = ".resource.common.monitor.visibility.favoriteMetrics.server";
+
+ /**
+ * Default is "".
+ */
+ public static final String MONITOR_VISIBILITY_FAVORITE_METRICS_SERVICE = ".resource.common.monitor.visibility.favoriteMetrics.service";
+
+ /**
+ * Default is "".
+ */
+ public static final String MONITOR_VISIBILITY_FAVORITE_METRICS_APPLICATION = ".resource.common.monitor.visibility.favoriteMetrics.application";
+
+ /**
+ * Default is "".
+ */
+ public static final String MONITOR_VISIBILITY_FAVORITE_METRICS_GROUP = ".resource.common.monitor.visibility.favoriteMetrics.group";
+
+ /**
+ * Default is "".
+ */
+ public static final String MONITOR_VISIBILITY_METRIC_RANGE = ".resource.common.monitor.visibility.metricRange";
+
+ /**
+ * Default is false.
+ */
+ public static final String MONITOR_VISIBILITY_METRIC_RANGE_RO = ".resource.common.monitor.visibility.metricRange.ro";
+
+ /**
+ * Default is "";
+ */
+ public static final String MONITOR_VISIBILITY_METRIC_RANGE_LAST_N = ".resource.common.monitor.visibility.metricRange.lastN";
+
+ /**
+ * Default is "".
+ */
+ public static final String MONITOR_VISIBILITY_METRIC_RANGE_UNIT = ".resource.common.monitor.visibility.metricRange.unit";
+
+ /**
+ * Default is 1.
+ */
+ public static final String MONITOR_VISIBILITY_THRESHOLD = ".resource.common.monitor.visibility.metricThreshold";
+
+ /**
+ * Default is "".
+ */
+ public static final String CHARTS = ".dashContent.charts";
+
+ /**
+ * The time, in seconds, between automatic refreshes of the DashBoard and
+ * the monitoring Indicator charts. 0 (zero) indicates no refreshes are to happen.
+ * A refresh period longer than the current session timeout, e.g. 1800 seconds (30 minutes),
+ * would likely require the user to log back into the Portal when the refresh occurs.
+ * Default is 60.
+ */
+ public static final String PAGE_REFRESH_PERIOD = ".page.refresh.period";
+
+ /**
+ * Default is 60.
+ */
+ public static final String GROUP_CONFIGURATION_TIMEOUT_PERIOD = ".group.configuration.timeout.period";
+
+ private UserPreferenceNames() {
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferences.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferences.java
index 2b935e5..835646a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferences.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferences.java
@@ -18,51 +18,75 @@
*/
package org.rhq.enterprise.gui.coregui.client.util.preferences;
+import com.google.gwt.user.client.rpc.AsyncCallback;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.gwt.SubjectGWTServiceAsync;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
/**
* @author Greg Hinkle
+ * @author Ian Springer
*/
public class UserPreferences {
-
+ private static final String PREF_LIST_DELIM = "|";
+ private static final String PREF_LIST_DELIM_REGEX = "\\|";
private Subject subject;
-
private Configuration userConfiguration;
-
-
- protected static final String PREF_ITEM_DELIM = "|";
-
- public static final String PREF_DASH_FAVORITE_RESOURCES = ".dashContent.resourcehealth.resources";
-
+ private SubjectGWTServiceAsync subjectService = GWTServiceLookup.getSubjectService();
public UserPreferences(Subject subject) {
- this.subject = subject;
+ this.subject = subject;
this.userConfiguration = subject.getUserConfiguration();
}
-
-
-
-
-
-
- public List<Integer> getFavoriteResources() {
- return getPreferenceAsIntegerList(PREF_DASH_FAVORITE_RESOURCES,PREF_ITEM_DELIM);
+ public Set<Integer> getFavoriteResources() {
+ return getPreferenceAsIntegerSet(UserPreferenceNames.RESOURCE_HEALTH_RESOURCES);
}
-
+ public void setFavoriteResources(Set<Integer> resourceIds, AsyncCallback<Subject> callback) {
+ setPreference(UserPreferenceNames.RESOURCE_HEALTH_RESOURCES, resourceIds, callback);
+ }
protected String getPreference(String name) {
return userConfiguration.getSimpleValue(name, null);
}
- protected List<String> getPreferenceAsList(String key, String delimiter) {
+ protected void setPreference(String name, Collection value, AsyncCallback<Subject> callback) {
+ StringBuilder buffer = new StringBuilder();
+ boolean first = true;
+ for (Object item : value) {
+ if (first) {
+ first = false;
+ } else {
+ buffer.append(PREF_LIST_DELIM);
+ }
+ buffer.append(item);
+ }
+ setPreference(name, buffer.toString(), callback);
+ }
+
+ protected void setPreference(String name, String value, AsyncCallback<Subject> callback) {
+ PropertySimple prop = this.userConfiguration.getSimple(name);
+ if (prop == null) {
+ this.userConfiguration.put(new PropertySimple(name, value));
+ } else {
+ prop.setStringValue(value);
+ }
+ this.subjectService.updateSubject(this.subject, callback);
+ }
+
+ protected List<String> getPreferenceAsList(String key) {
String pref = null;
try {
pref = getPreference(key);
@@ -70,26 +94,24 @@ public class UserPreferences {
// log.debug("A user preference named '" + key + "' does not exist.");
}
- return (pref != null) ? Arrays.asList(pref.split(delimiter)) : new ArrayList<String>();
+ return (pref != null) ? Arrays.asList(pref.split(PREF_LIST_DELIM_REGEX)) : new ArrayList<String>();
}
- protected List<Integer> getPreferenceAsIntegerList(String key, String delimiter) {
+ protected Set<Integer> getPreferenceAsIntegerSet(String key) {
try {
- List<String> value = getPreferenceAsList(key, delimiter);
-
- List<Integer> result = new ArrayList<Integer>(value.size());
- for (int i = 0; i < value.size(); i++) {
- String trimmed = value.get(i).trim();
+ List<String> value = getPreferenceAsList(key);
+ // Use a TreeSet, so the Resource id's are sorted.
+ Set<Integer> result = new TreeSet<Integer>();
+ for (String aValue : value) {
+ String trimmed = aValue.trim();
if (trimmed.length() > 0) {
- result.add(Integer.valueOf(trimmed));
+ Integer intValue = Integer.valueOf(trimmed);
+ result.add(intValue);
}
}
-
return result;
} catch (Exception e) {
- return new ArrayList<Integer>();
+ return new HashSet<Integer>();
}
}
-
-
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java
index 3639826..10b7eb2 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java
@@ -165,7 +165,7 @@ public class SubjectManagerBean implements SubjectManagerLocal, SubjectManagerRe
}
/**
- * @see org.rhq.enterprise.server.auth.SubjectManagerRemote#g(Subject,String)
+ * @see org.rhq.enterprise.server.auth.SubjectManagerRemote#getSubjectByName(String)
*/
public Subject getSubjectByName(String username) {
Subject subject;
@@ -227,7 +227,7 @@ public class SubjectManagerBean implements SubjectManagerLocal, SubjectManagerRe
}
/**
- * @see org.rhq.enterprise.server.auth.SubjectManagerLocal#getSubjectById(org.rhq.core.domain.auth.Subject, int)
+ * @see org.rhq.enterprise.server.auth.SubjectManagerLocal#getSubjectById(int)
*/
public Subject getSubjectById(int id) {
Subject subject = entityManager.find(Subject.class, id);
@@ -291,10 +291,13 @@ public class SubjectManagerBean implements SubjectManagerLocal, SubjectManagerRe
throw new LoginException("User account has been disabled.");
}
+ // fetch the roles
+ subject.getRoles().size();
+
// let's see if this user was already logged in with a valid session
try {
- int session_id = sessionManager.getSessionIdFromUsername(username);
- subject.setSessionId(session_id);
+ int sessionId = sessionManager.getSessionIdFromUsername(username);
+ subject.setSessionId(sessionId);
return subject;
} catch (SessionException se) {
// nope, no session; continue on so we can create the session
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerLocal.java
index 9b19825..cbd364b 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerLocal.java
@@ -37,11 +37,12 @@ import org.rhq.enterprise.server.exception.LoginException;
@Local
public interface SubjectManagerLocal {
/**
- * Loads in the given subject's {@link Subject#getUserConfiguration() configuration}.
+ * Loads in the given subject's {@link Subject#getUserConfiguration() preferences} and
+ * {@link Subject#getRoles() roles}.
*
- * @param subjectId identifies the subject whose user configuration is to be loaded
+ * @param subjectId identifies the subject whose preferences and roles are to be loaded
*
- * @return the subject, with its user configuration loaded
+ * @return the subject, with its preferences and roles loaded
*/
Subject loadUserConfiguration(Integer subjectId);
@@ -64,7 +65,7 @@ public interface SubjectManagerLocal {
Subject getOverlord();
/**
- * @see SubjectManagerRemote#findAllSubjects(PageControl)
+ * @see SubjectManagerRemote#findAllSubjects
*/
PageList<Subject> findAllSubjects(PageControl pageControl);
@@ -217,7 +218,7 @@ public interface SubjectManagerLocal {
Subject getSubjectByName(String username);
/**
- * @see {@link SubjectManagerRemote#getSubjectBySessionId(int)}
+ * @see {@link SubjectManagerRemote#getSubjectByNameAndSessionId(String, int)}
*/
Subject getSubjectByNameAndSessionId(String username, int sessionId) throws Exception;
@@ -232,7 +233,7 @@ public interface SubjectManagerLocal {
void logout(Subject subject);
/**
- * @see SubjectManagerRemote#findSubjectsByCriteria(Subject, Subject)
+ * @see SubjectManagerRemote#updateSubject(org.rhq.core.domain.auth.Subject, org.rhq.core.domain.auth.Subject)
*/
Subject updateSubject(Subject subject, Subject subjectToModify);
commit 254b9a928078a1cdac0722f3d24db6475d859fa9
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Mar 11 13:59:08 2010 -0500
add TODO warning to remember that we need JDBC streaming here
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
index b84dea8..38e93f9 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
@@ -51,11 +51,9 @@ import org.jboss.annotation.ejb.TransactionTimeout;
import org.rhq.core.clientapi.agent.PluginContainerException;
import org.rhq.core.clientapi.agent.content.ContentAgentService;
import org.rhq.core.clientapi.server.content.ContentDiscoveryReport;
-import org.rhq.core.domain.content.transfer.ContentResponseResult;
import org.rhq.core.clientapi.server.content.ContentServiceResponse;
+import org.rhq.core.clientapi.server.content.DeletePackagesRequest;
import org.rhq.core.clientapi.server.content.DeployPackagesRequest;
-import org.rhq.core.domain.content.transfer.RemoveIndividualPackageResponse;
-import org.rhq.core.domain.content.transfer.RemovePackagesResponse;
import org.rhq.core.clientapi.server.content.RetrievePackageBitsRequest;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Permission;
@@ -73,10 +71,12 @@ import org.rhq.core.domain.content.PackageDetailsKey;
import org.rhq.core.domain.content.PackageInstallationStep;
import org.rhq.core.domain.content.PackageType;
import org.rhq.core.domain.content.PackageVersion;
-import org.rhq.core.clientapi.server.content.DeletePackagesRequest;
+import org.rhq.core.domain.content.transfer.ContentResponseResult;
import org.rhq.core.domain.content.transfer.DeployIndividualPackageResponse;
import org.rhq.core.domain.content.transfer.DeployPackageStep;
import org.rhq.core.domain.content.transfer.DeployPackagesResponse;
+import org.rhq.core.domain.content.transfer.RemoveIndividualPackageResponse;
+import org.rhq.core.domain.content.transfer.RemovePackagesResponse;
import org.rhq.core.domain.content.transfer.ResourcePackageDetails;
import org.rhq.core.domain.criteria.InstalledPackageCriteria;
import org.rhq.core.domain.criteria.PackageVersionCriteria;
@@ -1213,6 +1213,7 @@ public class ContentManagerBean implements ContentManagerLocal, ContentManagerRe
PackageVersion newPackageVersion = new PackageVersion(existingPackage, version, architecture);
newPackageVersion.setDisplayName(existingPackage.getName());
+ // TODO: THIS IS VERY BAD - MUST FIX - DO NOT SLURP THE ENTIRE FILE IN MEMORY - USE JDBC STREAMING
// Write the content into the newly created package version. This may eventually move, but for now we'll just
// use the byte array in the package version to store the bits.
byte[] packageBits;
commit 21b6b5c1ca4cb332d60fa9702cd3b68ae3f34d2f
Merge: 4ad4d69... 510f09c...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Mar 11 13:54:58 2010 -0500
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
commit 4ad4d69cc894594aa3fe4c328654e30d843e041b
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Mar 11 13:54:45 2010 -0500
refactor so this is more easily subclass-able
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/FileUploadServlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/FileUploadServlet.java
index d6574fe..d0bf1b4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/FileUploadServlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/FileUploadServlet.java
@@ -20,11 +20,15 @@ package org.rhq.enterprise.gui.coregui.server.gwt;
import java.io.File;
import java.io.IOException;
+import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import javax.servlet.ServletException;
+import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -36,6 +40,7 @@ import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.util.stream.StreamUtil;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
@@ -48,8 +53,6 @@ public class FileUploadServlet extends HttpServlet {
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- PrintWriter writer;
-
if (ServletFileUpload.isMultipartContent(req)) {
DiskFileItemFactory fileItemFactory = new DiskFileItemFactory();
@@ -61,7 +64,7 @@ public class FileUploadServlet extends HttpServlet {
try {
fileItemsList = (List<FileItem>) servletFileUpload.parseRequest(req);
} catch (FileUploadException e) {
- writer = resp.getWriter();
+ PrintWriter writer = resp.getWriter();
writer.write("<html><head></head><body><strong>File upload failed:</strong><br/>\n");
for (StackTraceElement elem : e.getStackTrace()) {
writer.write(elem.toString() + "<br/>\n");
@@ -72,11 +75,15 @@ public class FileUploadServlet extends HttpServlet {
}
List<FileItem> actualFiles = new ArrayList<FileItem>();
+ Map<String, String> formFields = new HashMap<String, String>();
boolean retrieve = false;
Subject authenticatedSubject = null;
for (FileItem fileItem : fileItemsList) {
if (fileItem.isFormField()) {
+ if (fileItem.getFieldName() != null) {
+ formFields.put(fileItem.getFieldName(), fileItem.getString());
+ }
if ("retrieve".equals(fileItem.getFieldName())) {
retrieve = true;
} else if ("sessionid".equals(fileItem.getFieldName())) {
@@ -107,37 +114,65 @@ public class FileUploadServlet extends HttpServlet {
// sending in "retrieve" form element with a single file means the client just wants the content echoed back
FileItem fileItem = actualFiles.get(0);
- writer = resp.getWriter();
- writer.write("<html>");
- writer.write(new String(fileItem.get()));
- writer.write("</html>");
- writer.flush();
+ ServletOutputStream outputStream = resp.getOutputStream();
+ outputStream.print("<html>");
+ InputStream inputStream = fileItem.getInputStream();
+ try {
+ StreamUtil.copy(inputStream, outputStream, false);
+ } finally {
+ inputStream.close();
+ }
+ outputStream.print("</html>");
+ outputStream.flush();
fileItem.delete();
} else {
- writer = resp.getWriter();
- writer.println("<html>");
+ Map<String, File> allUploadedFiles = new HashMap<String, File>();
for (FileItem fileItem : actualFiles) {
- String absolutePath;
- if (fileItem.isInMemory()) {
- // force it to disk
- File tmpFile = File.createTempFile("" + fileItem.getName(), null);
- try {
- fileItem.write(tmpFile);
- } catch (Exception e) {
- throw new ServletException("Failed to persist uploaded file to disk", e);
- }
- absolutePath = tmpFile.getAbsolutePath();
- } else {
- absolutePath = ((DiskFileItem) fileItem).getStoreLocation().getAbsolutePath();
- }
- writer.println(absolutePath);
+ allUploadedFiles.put(fileItem.getFieldName(), forceToFile(fileItem));
}
- writer.println("</html>");
- writer.flush();
+ processUploadedFiles(authenticatedSubject, allUploadedFiles, formFields, req, resp);
}
+ }
+ }
+ /**
+ * This method will write the names of all files (the local file system location where the file was stored)
+ * to the response - each local filename on its own line.
+ * Subclasses are free to override this to process the files however they need.
+ *
+ * @param subject
+ * @param files
+ * @param formFields
+ * @param request
+ * @param response
+ * @throws IOException
+ */
+ protected void processUploadedFiles(Subject subject, Map<String, File> files, Map<String, String> formFields,
+ HttpServletRequest request, HttpServletResponse response) throws IOException {
+
+ PrintWriter writer = response.getWriter();
+ writer.println("<html>");
+ for (File file : files.values()) {
+ String absolutePath = file.getAbsolutePath();
+ writer.println(absolutePath);
}
+ writer.println("</html>");
+ writer.flush();
+ return;
+ }
+ protected File forceToFile(FileItem fileItem) throws IOException, ServletException {
+ if (fileItem.isInMemory()) {
+ File tmpFile = File.createTempFile("" + fileItem.getName(), null);
+ try {
+ fileItem.write(tmpFile);
+ return tmpFile;
+ } catch (Exception e) {
+ throw new ServletException("Failed to persist uploaded file to disk", e);
+ }
+ } else {
+ return ((DiskFileItem) fileItem).getStoreLocation();
+ }
}
}
\ No newline at end of file
commit 510f09cfa3a978f3ba6cf0f62061a28bb6aca147
Author: John Sanda <john(a)localhost.localdomain>
Date: Thu Mar 11 13:43:05 2010 -0500
Adding initial support for handling click events
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/summary/SummaryCountsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/summary/SummaryCountsView.java
index 8b932da..24ef04b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/summary/SummaryCountsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/summary/SummaryCountsView.java
@@ -23,6 +23,7 @@
package org.rhq.enterprise.gui.coregui.client.inventory.summary;
+import com.google.gwt.user.client.History;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.Alignment;
@@ -37,6 +38,7 @@ import org.rhq.core.domain.resource.InventorySummary;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceBossGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.InventoryView;
import java.util.ArrayList;
import java.util.List;
@@ -96,6 +98,12 @@ public class SummaryCountsView extends VLayout {
final LinkItem item = new LinkItem(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_PATH);
+ }
+ });
return item;
}
commit 3abddd5565ee87269b49485c1671b62372e1b7a8
Merge: 0f5b515... 8450260...
Author: John Sanda <john(a)localhost.localdomain>
Date: Thu Mar 11 13:12:40 2010 -0500
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
commit 0f5b515b19c2be2235ad3313d5fe10dabe58033b
Author: John Sanda <john(a)localhost.localdomain>
Date: Thu Mar 11 13:11:07 2010 -0500
Refactoring to use a smartgwt DynamicForm
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/summary/SummaryCountsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/summary/SummaryCountsView.java
index ef09028..8b932da 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/summary/SummaryCountsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/summary/SummaryCountsView.java
@@ -23,18 +23,30 @@
package org.rhq.enterprise.gui.coregui.client.inventory.summary;
+import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.ui.Grid;
+import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.FormItem;
+import com.smartgwt.client.widgets.form.fields.LinkItem;
+import com.smartgwt.client.widgets.form.fields.StaticTextItem;
+import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
+import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.resource.InventorySummary;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceBossGWTServiceAsync;
+import java.util.ArrayList;
+import java.util.List;
+
public class SummaryCountsView extends VLayout {
private ResourceBossGWTServiceAsync resourceBossService = GWTServiceLookup.getResourceBossService();
+ private DynamicForm form;
+
public SummaryCountsView() {
resourceBossService.getInventorySummaryForLoggedInUser(new AsyncCallback<InventorySummary>() {
public void onFailure(Throwable throwable) {
@@ -42,17 +54,49 @@ public class SummaryCountsView extends VLayout {
}
public void onSuccess(InventorySummary summary) {
- Grid grid = new Grid(4, 2);
+ form = new DynamicForm();
+ List<FormItem> formItems = new ArrayList<FormItem>();
+
+ StaticTextItem platformTotal = createSummaryRow("platformTotal", "Platform Total",
+ summary.getPlatformCount());
+ formItems.add(platformTotal);
+
+ StaticTextItem serverTotal = createSummaryRow("serverTotal", "Server Total", summary.getServerCount());
+ formItems.add(serverTotal);
+
+ StaticTextItem serviceTotal = createSummaryRow("serviceTotal", "Service Total",
+ summary.getServiceCount());
+ formItems.add(serviceTotal);
- grid.setText(0, 0, "Platform Total");
- grid.setText(0, 1, Integer.toString(summary.getPlatformCount()));
+ StaticTextItem compatibleGroupTotal = createSummaryRow("compatibleGroupTotal", "Compatible Group Total",
+ summary.getCompatibleGroupCount());
+ formItems.add(compatibleGroupTotal);
- grid.setText(1, 0, "Server Total");
- grid.setText(1, 1, Integer.toString(summary.getServerCount()));
+ StaticTextItem mixedGroupTotal = createSummaryRow("mixedGroupTotal", "Mixed Group Total",
+ summary.getMixedGroupCount());
+ formItems.add(mixedGroupTotal);
- addMember(grid);
+ StaticTextItem groupDefinitionTotal = createSummaryRow("groupDefinitionTotal", "Group Definition Total",
+ summary.getGroupDefinitionCount());
+ formItems.add(groupDefinitionTotal);
+
+ StaticTextItem avergeMetricsTotal = createSummaryRow("averageMetricsTotal",
+ "Average Metrics per Minute", summary.getScheduledMeasurementsPerMinute());
+ formItems.add(avergeMetricsTotal);
+
+ form.setItems(formItems.toArray(new FormItem[formItems.size()]));
+ form.setWrapItemTitles(false);
+ form.setCellSpacing(15);
+ addMember(form);
}
});
}
+ private StaticTextItem createSummaryRow(String name, String label, int value) {
+ final LinkItem item = new LinkItem(name);
+ item.setTitle(label);
+ item.setValue(value);
+
+ return item;
+ }
}
commit 8450260f184076a677ca41fa9f78d282efcf63b7
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Mar 11 13:10:49 2010 -0500
add authentication to the file upload plus prepare to upload files that won't be retrieved back
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/TextFileRetrieverForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/TextFileRetrieverForm.java
index 444ed48..fbc0c3e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/TextFileRetrieverForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/TextFileRetrieverForm.java
@@ -29,6 +29,8 @@ import com.smartgwt.client.widgets.form.fields.events.ChangeHandler;
import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+
/**
* @author Greg Hinkle
*/
@@ -39,7 +41,6 @@ public class TextFileRetrieverForm extends DynamicCallbackForm {
setNumCols(8);
setEncoding(Encoding.MULTIPART);
setAction(GWT.getModuleBaseURL() + "/FileUploadServlet");
-
}
@Override
@@ -49,6 +50,9 @@ public class TextFileRetrieverForm extends DynamicCallbackForm {
HiddenItem retrieveField = new HiddenItem("retrieve");
retrieveField.setValue(true);
+ HiddenItem sessionIdField = new HiddenItem("sessionid");
+ sessionIdField.setValue(CoreGUI.getSessionSubject().getSessionId().intValue());
+
final UploadItem textFile = new UploadItem("textFile", "Upload File");
textFile.setEndRow(false);
@@ -76,7 +80,7 @@ public class TextFileRetrieverForm extends DynamicCallbackForm {
uploadButton.setIcons(loadingIcon);
uploadButton.setShowIcons(false);
- setItems(retrieveField, textFile, uploadButton);
+ setItems(retrieveField, sessionIdField, textFile, uploadButton);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/FileUploadServlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/FileUploadServlet.java
index 4d3585c..d6574fe 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/FileUploadServlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/FileUploadServlet.java
@@ -18,6 +18,7 @@
*/
package org.rhq.enterprise.gui.coregui.server.gwt;
+import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
@@ -30,74 +31,110 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileUploadException;
+import org.apache.commons.fileupload.disk.DiskFileItem;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.enterprise.server.auth.SubjectManagerLocal;
+import org.rhq.enterprise.server.util.LookupUtil;
+
/**
* @author Heiko W. Rupp
*/
public class FileUploadServlet extends HttpServlet {
-
-// private final Log log = LogFactory.getLog(MigrationServlet.class);
+ private static final long serialVersionUID = 1L;
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
PrintWriter writer;
+
if (ServletFileUpload.isMultipartContent(req)) {
- ServletFileUpload servletFileUpload = new ServletFileUpload(new DiskFileItemFactory());
- List<FileItem> fileItemsList = null;
+ DiskFileItemFactory fileItemFactory = new DiskFileItemFactory();
+ //fileItemFactory.setSizeThreshold(0);
+
+ ServletFileUpload servletFileUpload = new ServletFileUpload(fileItemFactory);
+
+ List<FileItem> fileItemsList;
try {
fileItemsList = (List<FileItem>) servletFileUpload.parseRequest(req);
} catch (FileUploadException e) {
-
writer = resp.getWriter();
- writer.write("<strong>File upload failed: </strong><br/>");
- for (StackTraceElement elem : e.getStackTrace())
- writer.write(elem.toString() + "br/>");
+ writer.write("<html><head></head><body><strong>File upload failed:</strong><br/>\n");
+ for (StackTraceElement elem : e.getStackTrace()) {
+ writer.write(elem.toString() + "<br/>\n");
+ }
+ writer.write("</body></html>");
writer.flush();
return;
}
- List<FileItem> files = new ArrayList<FileItem>();
+ List<FileItem> actualFiles = new ArrayList<FileItem>();
boolean retrieve = false;
+ Subject authenticatedSubject = null;
for (FileItem fileItem : fileItemsList) {
if (fileItem.isFormField()) {
if ("retrieve".equals(fileItem.getFieldName())) {
retrieve = true;
+ } else if ("sessionid".equals(fileItem.getFieldName())) {
+ int sessionid = Integer.parseInt(fileItem.getString());
+ SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
+ try {
+ authenticatedSubject = subjectManager.getSubjectBySessionId(sessionid);
+ } catch (Exception e) {
+ throw new ServletException("Cannot authenticate request", e);
+ }
}
- /* The file item contains a simple name-value pair of a form field */
- // TODO flag as error ?
+ fileItem.delete();
} else {
- /* The file item contains an uploaded file */
-
- files.add(fileItem);
-
- System.out.println("Got the file: " + fileItem);
-
+ // file item contains an actual uploaded file
+ actualFiles.add(fileItem);
+ log("file was uploaded: " + fileItem.getName());
+ }
+ }
+ if (authenticatedSubject == null) {
+ for (FileItem fileItem : actualFiles) {
+ fileItem.delete();
}
+ throw new ServletException("Cannot process unauthenticated request");
}
+ if (retrieve && actualFiles.size() == 1) {
+ // sending in "retrieve" form element with a single file means the client just wants the content echoed back
+ FileItem fileItem = actualFiles.get(0);
- if (retrieve && files.size() == 1) {
writer = resp.getWriter();
-
- // TODO
-// InputStream s = files.get(0).getInputStream();
-// IOUtils.copy(s,writer);
writer.write("<html>");
- writer.write(new String(files.get(0).get()));
+ writer.write(new String(fileItem.get()));
writer.write("</html>");
writer.flush();
+ fileItem.delete();
} else {
writer = resp.getWriter();
- writer.write("<strong>File received</strong><p/>");
+ writer.println("<html>");
+ for (FileItem fileItem : actualFiles) {
+ String absolutePath;
+ if (fileItem.isInMemory()) {
+ // force it to disk
+ File tmpFile = File.createTempFile("" + fileItem.getName(), null);
+ try {
+ fileItem.write(tmpFile);
+ } catch (Exception e) {
+ throw new ServletException("Failed to persist uploaded file to disk", e);
+ }
+ absolutePath = tmpFile.getAbsolutePath();
+ } else {
+ absolutePath = ((DiskFileItem) fileItem).getStoreLocation().getAbsolutePath();
+ }
+ writer.println(absolutePath);
+ }
+ writer.println("</html>");
writer.flush();
-
}
}
commit fdf3ac31b397a53ea9ab51144ed086f85f7b6c4d
Merge: 9fd4d1a... 8c84f5f...
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Thu Mar 11 09:28:44 2010 -0500
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
commit 8c84f5fac0789dba68ef7ab2e519b72a5150ef42
Merge: 0aeffbf... 04973ca...
Author: John Sanda <john(a)localhost.localdomain>
Date: Thu Mar 11 09:03:55 2010 -0500
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
commit 0aeffbf38db694f9a18128951b9a97c59f5d80fb
Author: John Sanda <john(a)localhost.localdomain>
Date: Thu Mar 11 09:02:48 2010 -0500
Moving class InventorySummary from server/jar module to core/domain module so it can be serialized by gwt
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/plugin/SummaryCounts.java b/modules/core/domain/src/main/java/org/rhq/core/domain/plugin/SummaryCounts.java
deleted file mode 100644
index 9621e3f..0000000
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/plugin/SummaryCounts.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-package org.rhq.core.domain.plugin;
-
-import com.google.gwt.user.client.rpc.IsSerializable;
-
-public class SummaryCounts implements IsSerializable {
-
- private Integer platformCount;
-
- private Integer serverCount;
-
- public Integer getPlatformCount() {
- return platformCount;
- }
-
- public void setPlatformCount(Integer platformCount) {
- this.platformCount = platformCount;
- }
-
- public Integer getServerCount() {
- return serverCount;
- }
-
- public void setServerCount(Integer serverCount) {
- this.serverCount = serverCount;
- }
-}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/InventorySummary.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/InventorySummary.java
new file mode 100644
index 0000000..decafe2
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/InventorySummary.java
@@ -0,0 +1,114 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.core.domain.resource;
+
+import java.io.Serializable;
+
+/**
+ * A summary of inventoried {@link org.rhq.core.domain.resource.Resource}s and
+ * {@link org.rhq.core.domain.resource.group.Group}s that are viewable by the specified user. The summary includes the
+ * total number of platforms, servers, services, {@link org.rhq.core.domain.resource.group.CompatibleGroup}s, and
+ * {@link org.rhq.core.domain.resource.group.MixedGroup}s. Only Resources with an inventory status of COMMITTED are
+ * tallied.
+ *
+ * @author Ian Springer
+ */
+public class InventorySummary implements Serializable {
+ private int platformCount;
+ private int serverCount;
+ private int serviceCount;
+ private int compatibleGroupCount;
+ private int mixedGroupCount;
+ private int groupDefinitionCount;
+ private int softwareProductCount;
+ private int softwareUpdateCount;
+ private int scheduledMeasurementsPerMinute;
+
+ public int getPlatformCount() {
+ return platformCount;
+ }
+
+ public void setPlatformCount(int platformCount) {
+ this.platformCount = platformCount;
+ }
+
+ public int getServerCount() {
+ return serverCount;
+ }
+
+ public void setServerCount(int serverCount) {
+ this.serverCount = serverCount;
+ }
+
+ public int getServiceCount() {
+ return serviceCount;
+ }
+
+ public void setServiceCount(int serviceCount) {
+ this.serviceCount = serviceCount;
+ }
+
+ public int getCompatibleGroupCount() {
+ return compatibleGroupCount;
+ }
+
+ public void setCompatibleGroupCount(int compatibleGroupCount) {
+ this.compatibleGroupCount = compatibleGroupCount;
+ }
+
+ public int getMixedGroupCount() {
+ return mixedGroupCount;
+ }
+
+ public void setMixedGroupCount(int mixedGroupCount) {
+ this.mixedGroupCount = mixedGroupCount;
+ }
+
+ public int getSoftwareProductCount() {
+ return softwareProductCount;
+ }
+
+ public void setSoftwareProductCount(int softwareProductCount) {
+ this.softwareProductCount = softwareProductCount;
+ }
+
+ public int getSoftwareUpdateCount() {
+ return softwareUpdateCount;
+ }
+
+ public void setSoftwareUpdateCount(int softwareUpdateCount) {
+ this.softwareUpdateCount = softwareUpdateCount;
+ }
+
+ public int getScheduledMeasurementsPerMinute() {
+ return scheduledMeasurementsPerMinute;
+ }
+
+ public void setScheduledMeasurementsPerMinute(int scheduledMeasurementsPerMinute) {
+ this.scheduledMeasurementsPerMinute = scheduledMeasurementsPerMinute;
+ }
+
+ public int getGroupDefinitionCount() {
+ return groupDefinitionCount;
+ }
+
+ public void setGroupDefinitionCount(int groupDefinitionCount) {
+ this.groupDefinitionCount = groupDefinitionCount;
+ }
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceBossGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceBossGWTService.java
index 67b89fb..a114335 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceBossGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceBossGWTService.java
@@ -25,15 +25,15 @@ package org.rhq.enterprise.gui.coregui.client.gwt;
import com.google.gwt.user.client.rpc.RemoteService;
import org.rhq.core.domain.auth.Subject;
-import org.rhq.core.domain.plugin.SummaryCounts;
+import org.rhq.core.domain.resource.InventorySummary;
/**
* @author John Sanda
*/
public interface ResourceBossGWTService extends RemoteService {
- SummaryCounts getInventorySummaryForLoggedInUser();
+ InventorySummary getInventorySummaryForLoggedInUser();
- SummaryCounts getInventorySummary(Subject user);
+ InventorySummary getInventorySummary(Subject user);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/summary/SummaryCountsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/summary/SummaryCountsView.java
index 61f2c9e..ef09028 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/summary/SummaryCountsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/summary/SummaryCountsView.java
@@ -26,7 +26,7 @@ package org.rhq.enterprise.gui.coregui.client.inventory.summary;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Grid;
import com.smartgwt.client.widgets.layout.VLayout;
-import org.rhq.core.domain.plugin.SummaryCounts;
+import org.rhq.core.domain.resource.InventorySummary;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceBossGWTServiceAsync;
@@ -36,19 +36,19 @@ public class SummaryCountsView extends VLayout {
private ResourceBossGWTServiceAsync resourceBossService = GWTServiceLookup.getResourceBossService();
public SummaryCountsView() {
- resourceBossService.getInventorySummaryForLoggedInUser(new AsyncCallback<SummaryCounts>() {
+ resourceBossService.getInventorySummaryForLoggedInUser(new AsyncCallback<InventorySummary>() {
public void onFailure(Throwable throwable) {
CoreGUI.getErrorHandler().handleError("Failed to retrieve inventory summary", throwable);
}
- public void onSuccess(SummaryCounts summary) {
+ public void onSuccess(InventorySummary summary) {
Grid grid = new Grid(4, 2);
grid.setText(0, 0, "Platform Total");
- grid.setText(0, 1, summary.getPlatformCount().toString());
+ grid.setText(0, 1, Integer.toString(summary.getPlatformCount()));
grid.setText(1, 0, "Server Total");
- grid.setText(1, 1, summary.getServerCount().toString());
+ grid.setText(1, 1, Integer.toString(summary.getServerCount()));
addMember(grid);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceBossGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceBossGWTServiceImpl.java
index 02e73fc..5ac22b5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceBossGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceBossGWTServiceImpl.java
@@ -24,9 +24,8 @@
package org.rhq.enterprise.gui.coregui.server.gwt;
import org.rhq.core.domain.auth.Subject;
-import org.rhq.core.domain.plugin.SummaryCounts;
+import org.rhq.core.domain.resource.InventorySummary;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceBossGWTService;
-import org.rhq.enterprise.server.resource.InventorySummary;
import org.rhq.enterprise.server.resource.ResourceBossLocal;
import org.rhq.enterprise.server.util.LookupUtil;
@@ -37,17 +36,12 @@ public class ResourceBossGWTServiceImpl extends AbstractGWTServiceImpl implement
private ResourceBossLocal resourceBoss = LookupUtil.getResourceBoss();
- public SummaryCounts getInventorySummaryForLoggedInUser() {
+ public InventorySummary getInventorySummaryForLoggedInUser() {
Subject subject = getSessionSubject();
return getInventorySummary(subject);
}
- public SummaryCounts getInventorySummary(Subject user) {
- InventorySummary inventorySummary = resourceBoss.getInventorySummary(user);
- SummaryCounts counts = new SummaryCounts();
- counts.setPlatformCount(inventorySummary.getPlatformCount());
- counts.setServerCount(inventorySummary.getServerCount());
-
- return counts;
+ public InventorySummary getInventorySummary(Subject user) {
+ return resourceBoss.getInventorySummary(user);
}
}
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/browse/InventorySummaryUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/browse/InventorySummaryUIBean.java
index 40d3c3d..f490f92 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/browse/InventorySummaryUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/browse/InventorySummaryUIBean.java
@@ -4,8 +4,8 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.resource.InventorySummary;
import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
-import org.rhq.enterprise.server.resource.InventorySummary;
import org.rhq.enterprise.server.resource.ResourceBossLocal;
import org.rhq.enterprise.server.util.LookupUtil;
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/hub/GroupHubPortalAction.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/hub/GroupHubPortalAction.java
index da00a6a..1f135aa 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/hub/GroupHubPortalAction.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/hub/GroupHubPortalAction.java
@@ -36,6 +36,7 @@ import org.apache.struts.util.MessageResources;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.plugin.Plugin;
+import org.rhq.core.domain.resource.InventorySummary;
import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.group.GroupCategory;
@@ -51,7 +52,6 @@ import org.rhq.enterprise.gui.legacy.util.HubUtils;
import org.rhq.enterprise.gui.legacy.util.RequestUtils;
import org.rhq.enterprise.gui.legacy.util.SessionUtils;
import org.rhq.enterprise.gui.util.WebUtility;
-import org.rhq.enterprise.server.resource.InventorySummary;
import org.rhq.enterprise.server.util.LookupUtil;
/**
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/hub/ResourceHubPortalAction.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/hub/ResourceHubPortalAction.java
index 35b9778..f3d14be 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/hub/ResourceHubPortalAction.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/hub/ResourceHubPortalAction.java
@@ -48,7 +48,7 @@ import org.rhq.enterprise.gui.legacy.util.HubUtils;
import org.rhq.enterprise.gui.legacy.util.RequestUtils;
import org.rhq.enterprise.gui.legacy.util.SessionUtils;
import org.rhq.enterprise.gui.util.WebUtility;
-import org.rhq.enterprise.server.resource.InventorySummary;
+import org.rhq.core.domain.resource.InventorySummary;
import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/portlet/summaryCounts/ViewAction.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/portlet/summaryCounts/ViewAction.java
index 9eb18b5..f66adde 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/portlet/summaryCounts/ViewAction.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/portlet/summaryCounts/ViewAction.java
@@ -33,7 +33,7 @@ import org.rhq.enterprise.gui.legacy.WebUser;
import org.rhq.enterprise.gui.legacy.WebUserPreferences;
import org.rhq.enterprise.gui.legacy.WebUserPreferences.SummaryCountPortletPreferences;
import org.rhq.enterprise.gui.legacy.util.SessionUtils;
-import org.rhq.enterprise.server.resource.InventorySummary;
+import org.rhq.core.domain.resource.InventorySummary;
import org.rhq.enterprise.server.resource.ResourceBossLocal;
import org.rhq.enterprise.server.util.LookupUtil;
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/InventorySummary.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/InventorySummary.java
deleted file mode 100644
index 9392150..0000000
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/InventorySummary.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.server.resource;
-
-import java.io.Serializable;
-
-/**
- * A summary of inventoried {@link org.rhq.core.domain.resource.Resource}s and
- * {@link org.rhq.core.domain.resource.group.Group}s that are viewable by the specified user. The summary includes the
- * total number of platforms, servers, services, {@link org.rhq.core.domain.resource.group.CompatibleGroup}s, and
- * {@link org.rhq.core.domain.resource.group.MixedGroup}s. Only Resources with an inventory status of COMMITTED are
- * tallied.
- *
- * @author Ian Springer
- */
-public class InventorySummary implements Serializable {
- private int platformCount;
- private int serverCount;
- private int serviceCount;
- private int compatibleGroupCount;
- private int mixedGroupCount;
- private int groupDefinitionCount;
- private int softwareProductCount;
- private int softwareUpdateCount;
- private int scheduledMeasurementsPerMinute;
-
- public int getPlatformCount() {
- return platformCount;
- }
-
- public void setPlatformCount(int platformCount) {
- this.platformCount = platformCount;
- }
-
- public int getServerCount() {
- return serverCount;
- }
-
- public void setServerCount(int serverCount) {
- this.serverCount = serverCount;
- }
-
- public int getServiceCount() {
- return serviceCount;
- }
-
- public void setServiceCount(int serviceCount) {
- this.serviceCount = serviceCount;
- }
-
- public int getCompatibleGroupCount() {
- return compatibleGroupCount;
- }
-
- public void setCompatibleGroupCount(int compatibleGroupCount) {
- this.compatibleGroupCount = compatibleGroupCount;
- }
-
- public int getMixedGroupCount() {
- return mixedGroupCount;
- }
-
- public void setMixedGroupCount(int mixedGroupCount) {
- this.mixedGroupCount = mixedGroupCount;
- }
-
- public int getSoftwareProductCount() {
- return softwareProductCount;
- }
-
- public void setSoftwareProductCount(int softwareProductCount) {
- this.softwareProductCount = softwareProductCount;
- }
-
- public int getSoftwareUpdateCount() {
- return softwareUpdateCount;
- }
-
- public void setSoftwareUpdateCount(int softwareUpdateCount) {
- this.softwareUpdateCount = softwareUpdateCount;
- }
-
- public int getScheduledMeasurementsPerMinute() {
- return scheduledMeasurementsPerMinute;
- }
-
- public void setScheduledMeasurementsPerMinute(int scheduledMeasurementsPerMinute) {
- this.scheduledMeasurementsPerMinute = scheduledMeasurementsPerMinute;
- }
-
- public int getGroupDefinitionCount() {
- return groupDefinitionCount;
- }
-
- public void setGroupDefinitionCount(int groupDefinitionCount) {
- this.groupDefinitionCount = groupDefinitionCount;
- }
-}
\ No newline at end of file
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceBossBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceBossBean.java
index 42db676..ce7449f 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceBossBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceBossBean.java
@@ -23,6 +23,7 @@ import javax.ejb.Stateless;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.resource.InventoryStatus;
+import org.rhq.core.domain.resource.InventorySummary;
import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.group.GroupCategory;
import org.rhq.enterprise.server.measurement.MeasurementScheduleManagerLocal;
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceBossLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceBossLocal.java
index b23c3ce..a96e7c7 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceBossLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceBossLocal.java
@@ -20,6 +20,7 @@ package org.rhq.enterprise.server.resource;
import javax.ejb.Local;
import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.resource.InventorySummary;
/**
* The boss for "high-level" operations involving {@link org.rhq.core.domain.resource.Resource}s and/or
commit 04973ca1d7cd0ef6a198f9cde657081904ac486d
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Mar 11 08:49:57 2010 -0500
bz 572535 - make sure security interceptor checks subject ID as well as subject NAME when confirming the session is valid.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java
index c934f48..3639826 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java
@@ -567,14 +567,14 @@ public class SubjectManagerBean implements SubjectManagerLocal, SubjectManagerRe
}
/**
- * @see org.rhq.enterprise.server.auth.SubjectManagerLocal#isValidSessionId(int, String)
+ * @see org.rhq.enterprise.server.auth.SubjectManagerLocal#isValidSessionId(int, String, int)
*/
// we exclude the default interceptors because the required permissions interceptor calls into this
@ExcludeDefaultInterceptors
- public boolean isValidSessionId(int session, String username) {
+ public boolean isValidSessionId(int session, String username, int userid) {
try {
Subject sessionSubject = sessionManager.getSubject(session);
- return username.equals(sessionSubject.getName());
+ return username.equals(sessionSubject.getName()) && userid == sessionSubject.getId();
} catch (Exception e) {
return false;
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerLocal.java
index e3f8ded..9b19825 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerLocal.java
@@ -150,15 +150,16 @@ public interface SubjectManagerLocal {
void deleteUsers(Subject subject, int[] subjectIds);
/**
- * Determines if the given session ID is valid and it is associated with the given user.
+ * Determines if the given session ID is valid and it is associated with the given username and user ID.
*
* @param session
* @param username
+ * @param userid
*
* @return <code>true</code> if the session ID indentifies a valid session; <code>false</code> if it is invalid or
* has timed out
*/
- boolean isValidSessionId(int session, String username);
+ boolean isValidSessionId(int session, String username, int userid);
/**
* This returns a list of subjects that are available to be assigned to a given role but not yet assigned to that
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RequiredPermissionsInterceptor.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RequiredPermissionsInterceptor.java
index b9847a5..1b6962d 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RequiredPermissionsInterceptor.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RequiredPermissionsInterceptor.java
@@ -22,10 +22,13 @@ import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
+
import javax.interceptor.AroundInvoke;
import javax.interceptor.InvocationContext;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Permission;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
@@ -92,7 +95,7 @@ public class RequiredPermissionsInterceptor {
SubjectManagerLocal subject_manager = LookupUtil.getSubjectManager();
// isValidSessionId will also update the session's last-access-time
- if (!subject_manager.isValidSessionId(subject.getSessionId(), subject.getName())) {
+ if (!subject_manager.isValidSessionId(subject.getSessionId(), subject.getName(), subject.getId())) {
// if this happens, it is possible someone is trying to spoof an authenticated user!
throw buildPermissionException("The session ID for user [" + subject.getName()
+ "] is invalid!", invocation_context);
commit 9fd4d1ae87ca782e0e2e47904cf7699b5cf66ba3
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Thu Mar 11 08:24:20 2010 -0500
suffix coregui links w/ #Inventory, rather than #Resources
diff --git a/modules/enterprise/server/plugins/perspectives/core/perspective/src/main/resources/META-INF/rhq-serverplugin.xml b/modules/enterprise/server/plugins/perspectives/core/perspective/src/main/resources/META-INF/rhq-serverplugin.xml
index cd02787..c94cf6e 100644
--- a/modules/enterprise/server/plugins/perspectives/core/perspective/src/main/resources/META-INF/rhq-serverplugin.xml
+++ b/modules/enterprise/server/plugins/perspectives/core/perspective/src/main/resources/META-INF/rhq-serverplugin.xml
@@ -95,7 +95,7 @@
<menu-item
name="overview.gwtGui"
displayName="GWT GUI"
- url="/coregui/CoreGUI.html#Resources">
+ url="/coregui/CoreGUI.html#Inventory">
<position
name="overview.dashboard"
placement="after" />
@@ -103,7 +103,7 @@
<menu-item
name="overview.gwtGuiDevMode"
displayName="GWT GUI - Dev Mode"
- url="/coregui/CoreGUI.html?gwt.codesvr=127.0.0.1:9997#Resources">
+ url="/coregui/CoreGUI.html?gwt.codesvr=127.0.0.1:9997#Inventory">
<position
name="overview.gwtGui"
placement="after" />
commit 55843543f6158196507a46c041de86f1d87e4870
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Mar 11 02:48:15 2010 -0500
use HashMap in gwt service interface
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
index b812cca..0bdcff3 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
@@ -18,6 +18,7 @@
*/
package org.rhq.enterprise.gui.coregui.client.bundle.create;
+import java.util.HashMap;
import java.util.Map;
import com.google.gwt.user.client.rpc.AsyncCallback;
@@ -55,9 +56,9 @@ public class BundleUploadDataStep implements WizardStep {
layout.setHeight100();
bundleServer.getAllBundleVersionFilenames(this.wizard.getBundleVersion().getId(),
- new AsyncCallback<Map<String, Boolean>>() {
+ new AsyncCallback<HashMap<String, Boolean>>() {
- public void onSuccess(Map<String, Boolean> result) {
+ public void onSuccess(HashMap<String, Boolean> result) {
allFilesStatus = result;
prepareForm(layout);
enableNextButtonWhenAppropriate();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java
index 9569c5d..de3b2ad 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java
@@ -18,8 +18,8 @@
*/
package org.rhq.enterprise.gui.coregui.client.gwt;
+import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import com.google.gwt.user.client.rpc.RemoteService;
@@ -41,5 +41,5 @@ public interface BundleGWTService extends RemoteService {
BundleVersion createBundleAndBundleVersion(String bundleName, int bundleTypeId, String name, String version,
String recipe) throws Exception;
- Map<String, Boolean> getAllBundleVersionFilenames(int bundleVersionId) throws Exception;
+ HashMap<String, Boolean> getAllBundleVersionFilenames(int bundleVersionId) throws Exception;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
index 3c02118..8f1f780 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
@@ -18,8 +18,8 @@
*/
package org.rhq.enterprise.gui.coregui.server.gwt;
+import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import org.rhq.core.domain.bundle.Bundle;
import org.rhq.core.domain.bundle.BundleType;
@@ -85,10 +85,10 @@ public class BundleGWTServiceImpl extends AbstractGWTServiceImpl implements Bund
return SerialUtility.prepare(results, "createBundleAndBundleVersion");
}
- public Map<String, Boolean> getAllBundleVersionFilenames(int bundleVersionId) throws Exception {
- Map<String, Boolean> results;
+ public HashMap<String, Boolean> getAllBundleVersionFilenames(int bundleVersionId) throws Exception {
+ HashMap<String, Boolean> results = new HashMap<String, Boolean>();
try {
- results = bundleManager.getAllBundleVersionFilenames(getSessionSubject(), bundleVersionId);
+ results.putAll(bundleManager.getAllBundleVersionFilenames(getSessionSubject(), bundleVersionId));
} catch (Exception e) {
throw new RuntimeException(ThrowableUtil.getAllMessages(e));
}
commit 351c6bb1eb31d5bee1c188d920e6309a48657843
Merge: ed54965... 04ca1fb...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Mar 11 01:26:05 2010 -0500
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
commit ed54965463bc14dcc2624e28581c1dd486e99dcf
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Mar 11 01:24:47 2010 -0500
add api that lets you know what bundle files are needed and which are already uploaded
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
index 7c13c79..b812cca 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
@@ -18,12 +18,20 @@
*/
package org.rhq.enterprise.gui.coregui.client.bundle.create;
-import com.smartgwt.client.types.Alignment;
+import java.util.Map;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.ui.Label;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.Img;
+import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.layout.HLayout;
+import com.smartgwt.client.widgets.layout.VLayout;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
/**
* @author Greg Hinkle
@@ -31,21 +39,38 @@ import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
public class BundleUploadDataStep implements WizardStep {
private final BundleCreationWizard wizard;
+ private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
+ private DynamicForm form;
+ private Map<String, Boolean> allFilesStatus;
public BundleUploadDataStep(BundleCreationWizard bundleCreationWizard) {
this.wizard = bundleCreationWizard;
}
public Canvas getCanvas() {
- HLayout hlayout = new HLayout();
- hlayout.setWidth100();
- hlayout.setHeight100();
+ form = new DynamicForm();
+
+ final HLayout layout = new HLayout();
+ layout.setWidth100();
+ layout.setHeight100();
+
+ bundleServer.getAllBundleVersionFilenames(this.wizard.getBundleVersion().getId(),
+ new AsyncCallback<Map<String, Boolean>>() {
- Img loaderImage = new Img("/images/ajax-loader.gif");
- loaderImage.setAlign(Alignment.CENTER);
- hlayout.addChild(loaderImage);
+ public void onSuccess(Map<String, Boolean> result) {
+ allFilesStatus = result;
+ prepareForm(layout);
+ enableNextButtonWhenAppropriate();
+ }
- return hlayout;
+ public void onFailure(Throwable caught) {
+ allFilesStatus = null;
+ CoreGUI.getErrorHandler().handleError("Cannot obtain bundle file information from server", caught);
+ }
+ });
+
+ form.addChild(layout);
+ return form;
}
public boolean nextPage() {
@@ -57,7 +82,7 @@ public class BundleUploadDataStep implements WizardStep {
}
public boolean isNextEnabled() {
- return true;
+ return this.allFilesStatus != null; // TODO && when all files are available
}
public boolean isPreviousEnabled() {
@@ -68,7 +93,22 @@ public class BundleUploadDataStep implements WizardStep {
this.wizard.getView().getNextButton().setDisabled(!isNextEnabled());
}
- private void enablePreviousButtonWhenAppropriate() {
- this.wizard.getView().getPreviousButton().setDisabled(!isPreviousEnabled());
+ private void prepareForm(HLayout layout) {
+ for (Map.Entry<String, Boolean> entry : this.allFilesStatus.entrySet()) {
+ VLayout vlayout = new VLayout();
+ layout.addChild(vlayout);
+
+ Label label = new Label(entry.getKey());
+ vlayout.addMember(label);
+
+ if (entry.getValue()) {
+ Img img = new Img("/images/status_complete.gif", 50, 15);
+ vlayout.addMember(img);
+ } else {
+ // TODO I really want a file upload component here
+ Img img = new Img("/images/status_error.gif", 50, 15);
+ vlayout.addMember(img);
+ }
+ }
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java
index ef1ee4a..9569c5d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java
@@ -19,6 +19,7 @@
package org.rhq.enterprise.gui.coregui.client.gwt;
import java.util.List;
+import java.util.Map;
import com.google.gwt.user.client.rpc.RemoteService;
@@ -39,4 +40,6 @@ public interface BundleGWTService extends RemoteService {
BundleVersion createBundleAndBundleVersion(String bundleName, int bundleTypeId, String name, String version,
String recipe) throws Exception;
+
+ Map<String, Boolean> getAllBundleVersionFilenames(int bundleVersionId) throws Exception;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
index 825fe04..3c02118 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
@@ -19,6 +19,7 @@
package org.rhq.enterprise.gui.coregui.server.gwt;
import java.util.List;
+import java.util.Map;
import org.rhq.core.domain.bundle.Bundle;
import org.rhq.core.domain.bundle.BundleType;
@@ -84,4 +85,14 @@ public class BundleGWTServiceImpl extends AbstractGWTServiceImpl implements Bund
return SerialUtility.prepare(results, "createBundleAndBundleVersion");
}
+ public Map<String, Boolean> getAllBundleVersionFilenames(int bundleVersionId) throws Exception {
+ Map<String, Boolean> results;
+ try {
+ results = bundleManager.getAllBundleVersionFilenames(getSessionSubject(), bundleVersionId);
+ } catch (Exception e) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ }
+ return SerialUtility.prepare(results, "getAllBundleVersionFilenames");
+ }
+
}
\ No newline at end of file
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
index af88312..570a0a6 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
@@ -20,8 +20,10 @@ package org.rhq.enterprise.server.bundle;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import javax.ejb.EJB;
@@ -478,6 +480,40 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
}
+ @RequiredPermission(Permission.MANAGE_INVENTORY)
+ public Map<String, Boolean> getAllBundleVersionFilenames(Subject subject, int bundleVersionId) throws Exception {
+
+ BundleVersion bundleVersion = entityManager.find(BundleVersion.class, bundleVersionId);
+ if (null == bundleVersion) {
+ throw new IllegalArgumentException("Invalid bundleVersionId: " + bundleVersionId);
+ }
+
+ // parse the recipe (validation occurs here) and get the config def and list of files
+ BundleType bundleType = bundleVersion.getBundle().getBundleType();
+ BundleServerPluginFacet bp = BundleManagerHelper.getPluginContainer().getBundleServerPluginManager()
+ .getBundleServerPluginFacet(bundleType.getName());
+ RecipeParseResults parseResults = bp.parseRecipe(bundleVersion.getRecipe());
+
+ Set<String> filenames = parseResults.getBundleFileNames();
+ Map<String, Boolean> result = new HashMap<String, Boolean>(filenames.size());
+
+ List<BundleFile> bundleFiles = bundleVersion.getBundleFiles();
+ for (String filename : filenames) {
+ boolean found = false;
+ for (BundleFile bundleFile : bundleFiles) {
+ String name = bundleFile.getPackageVersion().getGeneralPackage().getName();
+ if (name.equals(filename)) {
+ found = true;
+ break;
+ }
+ }
+ result.put(filename, found);
+ }
+
+ return result;
+
+ }
+
@SuppressWarnings("unchecked")
public List<BundleType> getAllBundleTypes(Subject subject) {
// the list of types will be small, no need to support paging
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java
index c001222..eb077e8 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java
@@ -20,6 +20,7 @@ package org.rhq.enterprise.server.bundle;
import java.io.InputStream;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import javax.ejb.Remote;
@@ -257,6 +258,20 @@ public interface BundleManagerRemote {
@WebParam(name = "withoutBundleFileOnly") boolean withoutBundleFileOnly) throws Exception;
/**
+ * Similar to {@link #getBundleVersionFilenames(Subject, int, boolean)}, this will determine the files required for a BundleVersion and return
+ * all of the filenames, with the values of the map being true if they already exist or false if they lack BundleFile representation
+ * in the BundleVersion.
+ *
+ * @param subject must be InventoryManager
+ * @param bundleVersionId the BundleVersion being queried
+ * @return map keyed on filenames whose value indicates if a bundle file exists for the file or not
+ * @throws Exception
+ */
+ Map<String, Boolean> getAllBundleVersionFilenames( //
+ @WebParam(name = "subject") Subject subject, //
+ @WebParam(name = "bundleVersionId") int bundleVersionId) throws Exception;
+
+ /**
* Deploy the bundle as described in the provided deploy definition to the specified resource.
* Deployment is asynchronous so return of this method does not indicate deployments are complete. The
* returned BundleDeployment can be used to track the history of the deployment.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
index 8a0064d..6908666 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
@@ -414,6 +414,10 @@ public class WebservicesManagerBean implements WebservicesRemote {
return bundleManager.getBundleVersionFilenames(subject, bundleVersionId, withoutBundleFileOnly);
}
+ public Map<String, Boolean> getAllBundleVersionFilenames(Subject subject, int bundleVersionId) throws Exception {
+ return bundleManager.getAllBundleVersionFilenames(subject, bundleVersionId);
+ }
+
public BundleDeployment scheduleBundleDeployment(Subject subject, int bundleDeployDefinitionId, int resourceId)
throws Exception {
return bundleManager.scheduleBundleDeployment(subject, bundleDeployDefinitionId, resourceId);
commit 04ca1fb86c614d5ac945184851da8437cf0d666f
Merge: 567fa32... f0ba520...
Author: John Sanda <john(a)localhost.localdomain>
Date: Wed Mar 10 22:16:20 2010 -0500
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
Conflicts:
modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
diff --cc modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
index dcd8397,efe75c7..eb7a02d
--- a/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
+++ b/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
@@@ -49,11 -49,12 +49,17 @@@
<servlet-class>org.rhq.enterprise.gui.coregui.server.gwt.BundleGWTServiceImpl</servlet-class>
</servlet>
+
+ <servlet>
+ <servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI FileUploadServlet</servlet-name>
+ <servlet-class>org.rhq.enterprise.gui.coregui.server.gwt.FileUploadServlet</servlet-class>
+ </servlet>
+
+ <servlet>
+ <servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI ResourceBossGWTService</servlet-name>
+ <servlet-class>org.rhq.enterprise.gui.coregui.server.gwt.ResourceBossGWTServiceImpl</servlet-class>
+ </servlet>
+
<servlet-mapping>
<servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI RoleGWTService</servlet-name>
<url-pattern>/org.rhq.enterprise.gui.coregui.CoreGUI/RoleGWTService</url-pattern>
@@@ -94,8 -95,11 +100,14 @@@
<servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI BundleGWTService</servlet-name>
<url-pattern>/org.rhq.enterprise.gui.coregui.CoreGUI/BundleGWTService</url-pattern>
</servlet-mapping>
-
-
-
<servlet-mapping>
+ <servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI FileUploadServlet</servlet-name>
+ <url-pattern>/org.rhq.enterprise.gui.coregui.CoreGUI/FileUploadServlet</url-pattern>
+ </servlet-mapping>
++
++ <servlet-mapping>
+ <servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI ResourceBossGWTService</servlet-name>
+ <url-pattern>/org.rhq.enterprise.gui.coregui.CoreGUI/ResourceBossGWTService</url-pattern>
+ </servlet-mapping>
++
</web-app>
commit 567fa32741266c128f2571e12cc170d124f1ac4f
Author: John Sanda <john(a)localhost.localdomain>
Date: Wed Mar 10 21:35:55 2010 -0500
First cut at summary counts portlet for the dashboard.
This is the initial commit for the ResourceBossGWTService and corresponding classes. Also the
initial commit for SummaryCountsView which is the widget that displays the inventory counts.
I am also adding the SummaryCounts which is just a wrapper around the class InventorySummary.
Initially I tried returning an InventorySummary object from ResourceBossService but that does
not work since it lives in the portal-war module. If it does not break anything I may wind up
moving InventorySummary into core/domain so that it is accessible client side.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/plugin/SummaryCounts.java b/modules/core/domain/src/main/java/org/rhq/core/domain/plugin/SummaryCounts.java
new file mode 100644
index 0000000..9621e3f
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/plugin/SummaryCounts.java
@@ -0,0 +1,49 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package org.rhq.core.domain.plugin;
+
+import com.google.gwt.user.client.rpc.IsSerializable;
+
+public class SummaryCounts implements IsSerializable {
+
+ private Integer platformCount;
+
+ private Integer serverCount;
+
+ public Integer getPlatformCount() {
+ return platformCount;
+ }
+
+ public void setPlatformCount(Integer platformCount) {
+ this.platformCount = platformCount;
+ }
+
+ public Integer getServerCount() {
+ return serverCount;
+ }
+
+ public void setServerCount(Integer serverCount) {
+ this.serverCount = serverCount;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
index ad288af..f2610d3 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
@@ -44,5 +44,6 @@
<servlet path="/AlertGWTService" class="org.rhq.enterprise.gui.coregui.server.gwt.AlertGWTServiceImpl"/>
<servlet path="/OperationGWTService" class="org.rhq.enterprise.gui.coregui.server.gwt.OperationGWTServiceImpl"/>
<servlet path="/BundleGWTService" class="org.rhq.enterprise.gui.coregui.server.gwt.BundleGWTServiceImpl"/>
+ <servlet path="/ResourceBossGWTService" class="org.rhq.enterprise.gui.coregui.server.gwt.ResourceBossGWTServiceImpl"/>
</module>
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
index 7764657..9b318b6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
@@ -30,6 +30,7 @@ import com.smartgwt.client.widgets.form.fields.ButtonItem;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.layout.LayoutSpacer;
import com.smartgwt.client.widgets.layout.VLayout;
+import org.rhq.enterprise.gui.coregui.client.inventory.summary.SummaryCountsView;
/**
* @author Greg Hinkle
@@ -135,12 +136,16 @@ public class DashboardView extends VLayout {
// label.setBackgroundColor(colors[Random.nextInt(colors.length - 1)]);
// newPortlet.addItem(label);
- if (Random.nextBoolean()) {
+ int nextInt = Random.nextInt() % 3;
+
+ if (nextInt == 0) {
ResourceSearchView item = new ResourceSearchView();
newPortlet.addItem(item);
+ } else if (nextInt == 1) {
+ newPortlet.addItem(new RolesView());
} else {
- newPortlet.addItem(new RolesView());
+ newPortlet.addItem(new SummaryCountsView());
}
newPortlet.setHeight(350);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
index 316119a..d61828a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
@@ -76,6 +76,10 @@ public class GWTServiceLookup {
return secure(BundleGWTServiceAsync.Util.getInstance());
}
+ public static ResourceBossGWTServiceAsync getResourceBossService() {
+ return secure(ResourceBossGWTServiceAsync.Util.getInstance());
+ }
+
private static <T> T secure(Object sdt) {
if (!(sdt instanceof ServiceDefTarget))
return null;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceBossGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceBossGWTService.java
new file mode 100644
index 0000000..67b89fb
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceBossGWTService.java
@@ -0,0 +1,39 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package org.rhq.enterprise.gui.coregui.client.gwt;
+
+import com.google.gwt.user.client.rpc.RemoteService;
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.plugin.SummaryCounts;
+
+/**
+ * @author John Sanda
+ */
+public interface ResourceBossGWTService extends RemoteService {
+
+ SummaryCounts getInventorySummaryForLoggedInUser();
+
+ SummaryCounts getInventorySummary(Subject user);
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/summary/SummaryCountsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/summary/SummaryCountsView.java
new file mode 100644
index 0000000..61f2c9e
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/summary/SummaryCountsView.java
@@ -0,0 +1,58 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package org.rhq.enterprise.gui.coregui.client.inventory.summary;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.ui.Grid;
+import com.smartgwt.client.widgets.layout.VLayout;
+import org.rhq.core.domain.plugin.SummaryCounts;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.gwt.ResourceBossGWTServiceAsync;
+
+public class SummaryCountsView extends VLayout {
+
+ private ResourceBossGWTServiceAsync resourceBossService = GWTServiceLookup.getResourceBossService();
+
+ public SummaryCountsView() {
+ resourceBossService.getInventorySummaryForLoggedInUser(new AsyncCallback<SummaryCounts>() {
+ public void onFailure(Throwable throwable) {
+ CoreGUI.getErrorHandler().handleError("Failed to retrieve inventory summary", throwable);
+ }
+
+ public void onSuccess(SummaryCounts summary) {
+ Grid grid = new Grid(4, 2);
+
+ grid.setText(0, 0, "Platform Total");
+ grid.setText(0, 1, summary.getPlatformCount().toString());
+
+ grid.setText(1, 0, "Server Total");
+ grid.setText(1, 1, summary.getServerCount().toString());
+
+ addMember(grid);
+ }
+ });
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceBossGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceBossGWTServiceImpl.java
new file mode 100644
index 0000000..02e73fc
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceBossGWTServiceImpl.java
@@ -0,0 +1,53 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package org.rhq.enterprise.gui.coregui.server.gwt;
+
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.plugin.SummaryCounts;
+import org.rhq.enterprise.gui.coregui.client.gwt.ResourceBossGWTService;
+import org.rhq.enterprise.server.resource.InventorySummary;
+import org.rhq.enterprise.server.resource.ResourceBossLocal;
+import org.rhq.enterprise.server.util.LookupUtil;
+
+/**
+ * @author John Sanda
+ */
+public class ResourceBossGWTServiceImpl extends AbstractGWTServiceImpl implements ResourceBossGWTService {
+
+ private ResourceBossLocal resourceBoss = LookupUtil.getResourceBoss();
+
+ public SummaryCounts getInventorySummaryForLoggedInUser() {
+ Subject subject = getSessionSubject();
+ return getInventorySummary(subject);
+ }
+
+ public SummaryCounts getInventorySummary(Subject user) {
+ InventorySummary inventorySummary = resourceBoss.getInventorySummary(user);
+ SummaryCounts counts = new SummaryCounts();
+ counts.setPlatformCount(inventorySummary.getPlatformCount());
+ counts.setServerCount(inventorySummary.getServerCount());
+
+ return counts;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml b/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
index 7edb4ee..dcd8397 100644
--- a/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
+++ b/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
@@ -49,6 +49,11 @@
<servlet-class>org.rhq.enterprise.gui.coregui.server.gwt.BundleGWTServiceImpl</servlet-class>
</servlet>
+ <servlet>
+ <servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI ResourceBossGWTService</servlet-name>
+ <servlet-class>org.rhq.enterprise.gui.coregui.server.gwt.ResourceBossGWTServiceImpl</servlet-class>
+ </servlet>
+
<servlet-mapping>
<servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI RoleGWTService</servlet-name>
<url-pattern>/org.rhq.enterprise.gui.coregui.CoreGUI/RoleGWTService</url-pattern>
@@ -89,4 +94,8 @@
<servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI BundleGWTService</servlet-name>
<url-pattern>/org.rhq.enterprise.gui.coregui.CoreGUI/BundleGWTService</url-pattern>
</servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI ResourceBossGWTService</servlet-name>
+ <url-pattern>/org.rhq.enterprise.gui.coregui.CoreGUI/ResourceBossGWTService</url-pattern>
+ </servlet-mapping>
</web-app>
commit f0ba52047de91a8c5571a4559af371f783d065ca
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 10 18:14:53 2010 -0500
verified msgs
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java
index 8c7d4e4..b185bb1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java
@@ -19,9 +19,11 @@
package org.rhq.enterprise.gui.coregui.client.bundle.create;
import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.ui.Label;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.Img;
-import com.smartgwt.client.widgets.layout.HLayout;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.bundle.BundleVersion;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
@@ -37,43 +39,52 @@ public class BundleVerificationStep implements WizardStep {
private final BundleCreationWizard wizard;
private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
+ private DynamicForm form;
public BundleVerificationStep(BundleCreationWizard bundleCreationWizard) {
this.wizard = bundleCreationWizard;
}
public Canvas getCanvas() {
- HLayout hlayout = new HLayout();
- hlayout.setWidth100();
- hlayout.setHeight100();
+ form = new DynamicForm();
+
+ VLayout layout = new VLayout();
+ layout.setWidth100();
+ layout.setHeight100();
final Img verifyingImage = new Img("/images/status-bar.gif");
- verifyingImage.setWidth100();
+ verifyingImage.setWidth(50);
verifyingImage.setHeight(15);
- hlayout.addChild(verifyingImage);
+ final Label verifiedMessage = new Label("Verifying...!");
+ layout.addMember(verifyingImage);
+ layout.addMember(verifiedMessage);
bundleServer.createBundleAndBundleVersion(this.wizard.getBundleName(), this.wizard.getBundleType().getId(),
this.wizard.getBundleName(), this.wizard.getBundleVersionString(), this.wizard.getRecipe(),
new AsyncCallback<BundleVersion>() {
public void onSuccess(BundleVersion result) {
verifyingImage.setSrc("/images/status_complete.gif");
+ verifiedMessage.setText("Verified!");
wizard.setBundleVersion(result);
enableNextButtonWhenAppropriate();
}
public void onFailure(Throwable caught) {
verifyingImage.setSrc("/images/status_error.gif");
+ verifiedMessage.setText("Failed!");
CoreGUI.getErrorHandler().handleError("Failed to create bundle: " + caught.getMessage(), caught);
wizard.setBundleVersion(null);
enableNextButtonWhenAppropriate();
}
});
- return hlayout;
+
+ form.addChild(layout);
+ return form;
}
public boolean nextPage() {
- return false; // TODO: Implement this method.
+ return this.wizard.getBundleVersion() != null;
}
public String getName() {
commit 013fde3310c78e19598a15ae135fb39777f48649
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 10 17:45:46 2010 -0500
total brain freeze - correcting obvious logic problems
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
index bdd1fbe..72eb3fe 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
@@ -160,14 +160,14 @@ public class WizardView extends VLayout {
if (stepIndex == 0) {
previousButton.setDisabled(true);
} else {
- previousButton.setDisabled(step.isNextEnabled());
+ previousButton.setDisabled(!step.isPreviousEnabled());
}
boolean last = (stepIndex == (wizard.getSteps().size() - 1));
if (last) {
nextButton.setDisabled(true);
} else {
- nextButton.setDisabled(step.isPreviousEnabled());
+ nextButton.setDisabled(!step.isNextEnabled());
}
for (IButton button : customButtons) {
commit 06b490ebbed617b521533de55798e53ad4ed6af4
Merge: 315a1e5... 8b18830...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 10 17:33:45 2010 -0500
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
commit 315a1e50683584ff4625cc377900e69dd8c4ddf8
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 10 17:33:05 2010 -0500
more control over next/previous buttons
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java
index b9060e2..cf15fbd 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java
@@ -88,6 +88,10 @@ public class BundleCreationWizard implements Wizard {
view.displayDialog();
}
+ public WizardView getView() {
+ return view;
+ }
+
public BundleType getBundleType() {
return bundleType;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
index ab0beb5..2d02919 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
@@ -23,7 +23,6 @@ import java.util.List;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.form.DynamicForm;
-import com.smartgwt.client.widgets.form.fields.FormItem;
import com.smartgwt.client.widgets.form.fields.TextAreaItem;
import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
@@ -66,6 +65,7 @@ public class BundleInfoStep implements WizardStep {
}
wizard.setSubtitle(value.toString());
wizard.setBundleName(value.toString());
+ enableNextButtonWhenAppropriate();
}
});
@@ -79,6 +79,7 @@ public class BundleInfoStep implements WizardStep {
value = "";
}
wizard.setBundleVersionString(value.toString());
+ enableNextButtonWhenAppropriate();
}
});
@@ -90,6 +91,7 @@ public class BundleInfoStep implements WizardStep {
value = "";
}
wizard.setBundleDescription(value.toString());
+ enableNextButtonWhenAppropriate();
}
});
@@ -100,6 +102,7 @@ public class BundleInfoStep implements WizardStep {
bundleServer.getBundleTypes(new AsyncCallback<List<BundleType>>() {
public void onSuccess(List<BundleType> result) {
wizard.setBundleType(result.get(0));
+ enableNextButtonWhenAppropriate();
}
public void onFailure(Throwable caught) {
@@ -111,7 +114,6 @@ public class BundleInfoStep implements WizardStep {
}
public boolean nextPage() {
- FormItem nameField = form.getField("name");
return form.validate();
}
@@ -119,4 +121,20 @@ public class BundleInfoStep implements WizardStep {
return "Provide Bundle Information";
}
+ public boolean isNextEnabled() {
+ return isNotEmpty(this.wizard.getBundleName()) && isNotEmpty(this.wizard.getBundleVersionString())
+ && this.wizard.getBundleType() != null;
+ }
+
+ public boolean isPreviousEnabled() {
+ return false;
+ }
+
+ private void enableNextButtonWhenAppropriate() {
+ this.wizard.getView().getNextButton().setDisabled(!isNextEnabled());
+ }
+
+ private boolean isNotEmpty(String s) {
+ return (s != null && s.trim().length() > 0);
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
index e637769..7c13c79 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
@@ -56,4 +56,19 @@ public class BundleUploadDataStep implements WizardStep {
return "Upload Bundle Files";
}
+ public boolean isNextEnabled() {
+ return true;
+ }
+
+ public boolean isPreviousEnabled() {
+ return false;
+ }
+
+ private void enableNextButtonWhenAppropriate() {
+ this.wizard.getView().getNextButton().setDisabled(!isNextEnabled());
+ }
+
+ private void enablePreviousButtonWhenAppropriate() {
+ this.wizard.getView().getPreviousButton().setDisabled(!isPreviousEnabled());
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
index 80b2c8a..124f715 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
@@ -74,7 +74,7 @@ public class BundleUploadRecipeStep implements WizardStep {
}
});
- final TextAreaItem recipe = new TextAreaItem("recipe", "Recipe");
+ final TextAreaItem recipe = new TextAreaItem("recipe");
recipe.setShowTitle(false);
recipe.setRequired(true);
recipe.setWidth("*");
@@ -86,6 +86,7 @@ public class BundleUploadRecipeStep implements WizardStep {
value = "";
}
wizard.setRecipe(value.toString());
+ enableNextButtonWhenAppropriate();
}
});
@@ -95,6 +96,7 @@ public class BundleUploadRecipeStep implements WizardStep {
recipe.setValue(event.getResults());
form.showItem("showUpload");
form.hideItem("upload");
+ enableNextButtonWhenAppropriate();
}
});
@@ -112,4 +114,15 @@ public class BundleUploadRecipeStep implements WizardStep {
return "Provide Bundle Recipe";
}
+ public boolean isNextEnabled() {
+ return this.wizard.getRecipe() != null && this.wizard.getRecipe().trim().length() > 0;
+ }
+
+ public boolean isPreviousEnabled() {
+ return true;
+ }
+
+ private void enableNextButtonWhenAppropriate() {
+ this.wizard.getView().getNextButton().setDisabled(!isNextEnabled());
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java
index 339c357..8c7d4e4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java
@@ -59,11 +59,14 @@ public class BundleVerificationStep implements WizardStep {
public void onSuccess(BundleVersion result) {
verifyingImage.setSrc("/images/status_complete.gif");
wizard.setBundleVersion(result);
+ enableNextButtonWhenAppropriate();
}
public void onFailure(Throwable caught) {
verifyingImage.setSrc("/images/status_error.gif");
CoreGUI.getErrorHandler().handleError("Failed to create bundle: " + caught.getMessage(), caught);
+ wizard.setBundleVersion(null);
+ enableNextButtonWhenAppropriate();
}
});
return hlayout;
@@ -77,4 +80,15 @@ public class BundleVerificationStep implements WizardStep {
return "Verify Recipe";
}
+ public boolean isNextEnabled() {
+ return this.wizard.getBundleVersion() != null;
+ }
+
+ public boolean isPreviousEnabled() {
+ return true;
+ }
+
+ private void enableNextButtonWhenAppropriate() {
+ this.wizard.getView().getNextButton().setDisabled(!isNextEnabled());
+ }
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardStep.java
index 06fc1c0..c3655f8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardStep.java
@@ -25,11 +25,13 @@ import com.smartgwt.client.widgets.Canvas;
*/
public interface WizardStep {
-
Canvas getCanvas();
boolean nextPage();
String getName();
+ boolean isPreviousEnabled();
+
+ boolean isNextEnabled();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
index 82d46d0..bdd1fbe 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
@@ -117,18 +117,21 @@ public class WizardView extends VLayout {
private void setupButtons() {
cancelButton = new IButton("Cancel");
+ cancelButton.setDisabled(false);
cancelButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
wizardWindow.destroy();
}
});
previousButton = new IButton("Previous");
+ previousButton.setDisabled(true);
previousButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
setStep(currentStep - 1);
}
});
nextButton = new IButton("Next");
+ nextButton.setDisabled(true);
nextButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
@@ -154,9 +157,18 @@ public class WizardView extends VLayout {
stepTitleLabel.setContents(step.getName());
- previousButton.setDisabled(stepIndex == 0);
+ if (stepIndex == 0) {
+ previousButton.setDisabled(true);
+ } else {
+ previousButton.setDisabled(step.isNextEnabled());
+ }
+
boolean last = (stepIndex == (wizard.getSteps().size() - 1));
- nextButton.setDisabled(last);
+ if (last) {
+ nextButton.setDisabled(true);
+ } else {
+ nextButton.setDisabled(step.isPreviousEnabled());
+ }
for (IButton button : customButtons) {
buttonBar.removeMember(button);
@@ -199,4 +211,20 @@ public class WizardView extends VLayout {
public void closeDialog() {
wizardWindow.destroy();
}
+
+ public IButton getCancelButton() {
+ return cancelButton;
+ }
+
+ public IButton getPreviousButton() {
+ return previousButton;
+ }
+
+ public IButton getNextButton() {
+ return nextButton;
+ }
+
+ public ArrayList<IButton> getCustomButtons() {
+ return customButtons;
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationParametersStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationParametersStep.java
index 4ddb244..5874f2d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationParametersStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationParametersStep.java
@@ -18,17 +18,15 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.create;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.HTMLFlow;
+
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.operation.OperationDefinition;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
-import org.rhq.enterprise.gui.coregui.client.components.wizard.Wizard;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
-import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.HTMLFlow;
-
-
/**
* @author Greg Hinkle
*/
@@ -47,7 +45,9 @@ public class OperationParametersStep implements WizardStep {
if (definition.getParametersConfigurationDefinition() != null) {
if (configurationEditor == null) {
ConfigurationDefinition configurationDefinition = definition.getParametersConfigurationDefinition();
- Configuration defaultConfiguration = configurationDefinition.getDefaultTemplate() != null ? configurationDefinition.getDefaultTemplate().createConfiguration() : new Configuration();
+ Configuration defaultConfiguration = configurationDefinition.getDefaultTemplate() != null ? configurationDefinition
+ .getDefaultTemplate().createConfiguration()
+ : new Configuration();
configurationEditor = new ConfigurationEditor(configurationDefinition, defaultConfiguration);
}
return configurationEditor;
@@ -57,15 +57,22 @@ public class OperationParametersStep implements WizardStep {
}
public boolean nextPage() {
- return true; // TODO: Implement this method.
+ return true; // TODO: Implement this method.
}
public String getName() {
return "Operation Parameters";
}
-
public Configuration getParameterConfiguration() {
return configurationEditor.getConfiguration();
}
+
+ public boolean isNextEnabled() {
+ return true;
+ }
+
+ public boolean isPreviousEnabled() {
+ return true;
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java
index 75c8edb..6d3fd2c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java
@@ -18,7 +18,7 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.create;
-import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+import java.util.Date;
import com.smartgwt.client.types.FormErrorOrientation;
import com.smartgwt.client.types.TimeFormatter;
@@ -34,9 +34,8 @@ import com.smartgwt.client.widgets.form.fields.IntegerItem;
import com.smartgwt.client.widgets.form.fields.RadioGroupItem;
import com.smartgwt.client.widgets.form.fields.TimeItem;
import com.smartgwt.client.widgets.form.validator.CustomValidator;
-import com.smartgwt.client.widgets.form.validator.DateRangeValidator;
-import java.util.Date;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
/**
* @author Greg Hinkle
@@ -62,9 +61,6 @@ public class OperationSchedulingStep implements WizardStep {
start.setRedrawOnChange(true);
start.setValue("Immediately");
-
-
-
HeaderItem scheduleHeader = new HeaderItem("scheduleHeader");
scheduleHeader.setValue("Schedule");
scheduleHeader.setShowIfCondition(new FormItemIfFunction() {
@@ -73,8 +69,6 @@ public class OperationSchedulingStep implements WizardStep {
}
});
-
-
RadioGroupItem recurr = new RadioGroupItem("recurr", "Recurrence");
recurr.setValueMap("Once", "Daily", "Weekly", "Monthly");
recurr.setRedrawOnChange(true);
@@ -85,39 +79,33 @@ public class OperationSchedulingStep implements WizardStep {
}
});
-
-
-
-
CanvasItem onceItem = new CanvasItem("once", "Run At");
onceItem.setShowTitle(false);
onceItem.setCanvas(getOnceForm());
onceItem.setShowIfCondition(new FormItemIfFunction() {
public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !"Immediately".equals(form.getValueAsString("start")) &&
- "Once".equals(form.getValueAsString("recurr"));
+ return !"Immediately".equals(form.getValueAsString("start"))
+ && "Once".equals(form.getValueAsString("recurr"));
}
});
-
CanvasItem dailyItem = new CanvasItem("daily", "Days");
dailyItem.setShowTitle(false);
dailyItem.setCanvas(getDailyForm());
dailyItem.setShowIfCondition(new FormItemIfFunction() {
public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !"Immediately".equals(form.getValueAsString("start")) &&
- "Daily".equals(form.getValueAsString("recurr"));
+ return !"Immediately".equals(form.getValueAsString("start"))
+ && "Daily".equals(form.getValueAsString("recurr"));
}
});
-
CanvasItem weeklyItem = new CanvasItem("weekly", "Weekly");
weeklyItem.setShowTitle(false);
weeklyItem.setCanvas(getWeeklyForm());
weeklyItem.setShowIfCondition(new FormItemIfFunction() {
public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !"Immediately".equals(form.getValueAsString("start")) &&
- "Weekly".equals(form.getValueAsString("recurr"));
+ return !"Immediately".equals(form.getValueAsString("start"))
+ && "Weekly".equals(form.getValueAsString("recurr"));
}
});
@@ -126,20 +114,17 @@ public class OperationSchedulingStep implements WizardStep {
monthlyItem.setCanvas(getMonthlyForm());
monthlyItem.setShowIfCondition(new FormItemIfFunction() {
public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !"Immediately".equals(form.getValueAsString("start")) &&
- "Monthly".equals(form.getValueAsString("recurr"));
+ return !"Immediately".equals(form.getValueAsString("start"))
+ && "Monthly".equals(form.getValueAsString("recurr"));
}
});
-
-
-
HeaderItem rangeHeader = new HeaderItem("timePeriod");
rangeHeader.setValue("Time Period");
rangeHeader.setShowIfCondition(new FormItemIfFunction() {
public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !"Immediately".equals(form.getValueAsString("start")) &&
- !"Once".equals(form.getValueAsString("recurr"));
+ return !"Immediately".equals(form.getValueAsString("start"))
+ && !"Once".equals(form.getValueAsString("recurr"));
}
});
@@ -148,18 +133,16 @@ public class OperationSchedulingStep implements WizardStep {
startDate.setStartDate(new Date());
startDate.setShowIfCondition(new FormItemIfFunction() {
public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !"Immediately".equals(form.getValueAsString("start")) &&
- !"Once".equals(form.getValueAsString("recurr"));
+ return !"Immediately".equals(form.getValueAsString("start"))
+ && !"Once".equals(form.getValueAsString("recurr"));
}
});
-
-
final RadioGroupItem end = new RadioGroupItem("endType", "Recurrence End");
end.setShowIfCondition(new FormItemIfFunction() {
public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !"Immediately".equals(form.getValueAsString("start")) &&
- !"Once".equals(form.getValueAsString("recurr"));
+ return !"Immediately".equals(form.getValueAsString("start"))
+ && !"Once".equals(form.getValueAsString("recurr"));
}
});
end.setStartRow(true);
@@ -172,25 +155,24 @@ public class OperationSchedulingStep implements WizardStep {
endDate.setStartDate(new Date());
endDate.setShowIfCondition(new FormItemIfFunction() {
public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !"Immediately".equals(form.getValueAsString("start")) &&
- !"Once".equals(form.getValueAsString("recurr")) &&
- !"Never".equals(form.getValueAsString("endType"));
+ return !"Immediately".equals(form.getValueAsString("start"))
+ && !"Once".equals(form.getValueAsString("recurr"))
+ && !"Never".equals(form.getValueAsString("endType"));
}
});
endDate.setValidators(new CustomValidator() {
@Override
protected boolean condition(Object o) {
- return (((Date)form.getValue("startDate")).before((Date)o));
+ return (((Date) form.getValue("startDate")).before((Date) o));
}
});
-
- form.setItems(start, scheduleHeader, recurr, onceItem, dailyItem, weeklyItem, monthlyItem, rangeHeader, startDate, end, endDate);
+ form.setItems(start, scheduleHeader, recurr, onceItem, dailyItem, weeklyItem, monthlyItem, rangeHeader,
+ startDate, end, endDate);
}
return form;
}
-
private DynamicForm getOnceForm() {
DynamicForm form = new DynamicForm();
form.setWrapItemTitles(false);
@@ -205,7 +187,6 @@ public class OperationSchedulingStep implements WizardStep {
return form;
}
-
private DynamicForm getWeeklyForm() {
DynamicForm form = new DynamicForm();
form.setWrapItemTitles(false);
@@ -214,7 +195,7 @@ public class OperationSchedulingStep implements WizardStep {
timeOfDay.setDisplayFormat(TimeFormatter.TOSHORTPADDEDTIME);
timeOfDay.setUseMask(true);
- String[] days = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
+ String[] days = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };
FormItem[] items = new FormItem[8];
items[0] = timeOfDay;
int i = 1;
@@ -231,7 +212,6 @@ public class OperationSchedulingStep implements WizardStep {
DynamicForm form = new DynamicForm();
form.setWrapItemTitles(false);
-
TimeItem timeOfDay = new TimeItem("timeOfDay", "Time Of Day");
timeOfDay.setDisplayFormat(TimeFormatter.TOSHORTPADDEDTIME);
timeOfDay.setUseMask(true);
@@ -255,13 +235,19 @@ public class OperationSchedulingStep implements WizardStep {
return form;
}
-
public boolean nextPage() {
- return true; // TODO: Implement this method.
+ return true; // TODO: Implement this method.
}
public String getName() {
return "Schedule";
}
+ public boolean isNextEnabled() {
+ return true;
+ }
+
+ public boolean isPreviousEnabled() {
+ return true;
+ }
}
commit 8b188306a8f7446af472af480e70331b3c0134f7
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Wed Mar 10 17:15:02 2010 -0500
Fix JSF pages used by old UI by making -plain versions of pages
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index 53d6a4b..e1af01f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -155,10 +155,10 @@ public class ResourceDetailView extends VLayout implements ViewRenderer, Resourc
monitoringTab.updateSubTab("Graphs", new GraphListView(resource)); // new FullHTMLPane("/rhq/common/monitor/graphs.xhtml?id=" + resource.getId()));
- monitoringTab.updateSubTab("Tables", new FullHTMLPane("/rhq/common/monitor/tables.xhtml?id=" + resource.getId()));
- monitoringTab.updateSubTab("Traits", new FullHTMLPane("/rhq/resource/monitor/traits.xhtml?id=" + resource.getId()));
- monitoringTab.updateSubTab("Availability", new FullHTMLPane("/rhq/resource/monitor/availabilityHistory.xhtml?id=" + resource.getId()));
- monitoringTab.updateSubTab("Schedules", new FullHTMLPane("/rhq/resource/monitor/schedules.xhtml?id=" + resource.getId()));
+ monitoringTab.updateSubTab("Tables", new FullHTMLPane("/rhq/common/monitor/tables-plain.xhtml?id=" + resource.getId()));
+ monitoringTab.updateSubTab("Traits", new FullHTMLPane("/rhq/resource/monitor/traits-plain.xhtml?id=" + resource.getId()));
+ monitoringTab.updateSubTab("Availability", new FullHTMLPane("/rhq/resource/monitor/availabilityHistory-plain.xhtml?id=" + resource.getId()));
+ monitoringTab.updateSubTab("Schedules", new FullHTMLPane("/rhq/resource/monitor/schedules-plain.xhtml?id=" + resource.getId()));
monitoringTab.updateSubTab("Call Time", new CallTimeView(resource));
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeView.java
index 6b385e7..61fdaa1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeView.java
@@ -23,6 +23,7 @@ import java.util.EnumSet;
import com.google.gwt.i18n.client.NumberFormat;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
@@ -86,16 +87,11 @@ public class CallTimeView extends Layout {
scheduleId = s.getId();
setup();
+ return;
}
-
-
}
-
-
}
-
-
-
+ setupNone();
}
}
);
@@ -113,6 +109,9 @@ public class CallTimeView extends Layout {
}
+ public void setupNone() {
+ addMember(new Label("No calltime data available for this resource"));
+ }
public void setup() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java
index d9960e3..2e9dc00 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java
@@ -24,6 +24,7 @@ import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceTypeGWTServiceAsync;
@@ -176,8 +177,8 @@ public class ResourceTypeRepository {
resourceTypeService.findResourceTypesByCriteria(criteria, new AsyncCallback<PageList<ResourceType>>() {
public void onFailure(Throwable caught) {
- // TODO: Implement this method.
caught.printStackTrace();
+ CoreGUI.getErrorHandler().handleError("Failed to load resource type metadata",caught);
}
public void onSuccess(PageList<ResourceType> result) {
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/monitor/tables-plain.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/monitor/tables-plain.xhtml
new file mode 100644
index 0000000..b75b9b2
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/monitor/tables-plain.xhtml
@@ -0,0 +1,168 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:onc="http://jboss.org/on/component"
+ xmlns:onf="http://jboss.org/on/function"
+ xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+
+<ui:composition>
+
+ <rich:panel styleClass="BlockContent">
+
+ <f:facet name="header" styleClass="BlockTitle">
+ <a name="Numeric Metrics" />
+ Numeric Metrics
+ </f:facet>
+
+ <h:form id="metricsTableForm">
+ <!-- On submit make sure these are provided for the context of any new instance of the UI beans -->
+ <c:if test="#{MetricsTableUIBean.context.resourceId != -1}">
+ <input type="hidden" name="id"
+ value="#{MetricsTableUIBean.context.resourceId}" />
+ </c:if>
+ <c:if test="#{MetricsTableUIBean.context.groupId != -1}">
+ <input type="hidden" name="groupId"
+ value="#{MetricsTableUIBean.context.groupId}" />
+ </c:if>
+ <c:if
+ test="#{MetricsTableUIBean.context.parentResourceId != -1}">
+ <input type="hidden" name="parent"
+ value="#{MetricsTableUIBean.context.parentResourceId}" />
+ </c:if>
+ <c:if test="#{MetricsTableUIBean.context.resourceTypeId != -1}">
+ <input type="hidden" name="type"
+ value="#{MetricsTableUIBean.context.resourceTypeId}" />
+ </c:if>
+
+
+ <rich:dataTable value="#{MetricsTableUIBean.metricSummaries}"
+ width="100%"
+ var="metric"
+ columnsWidth="1%"
+ onRowMouseOver="this.style.backgroundColor='#E7E7E7'"
+ onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
+
+ <rich:column
+ rendered="#{MetricsTableUIBean.context.category == 'Resource'}">
+ <f:facet name="header">
+ <onc:allSelect target="selectedMetrics" />
+ </f:facet>
+
+ <onc:select name="selectedMetrics"
+ value="#{metric.definitionId}" />
+ </rich:column>
+
+ <rich:column
+ rendered="#{MetricsTableUIBean.context.category != 'Resource'}">
+ <f:facet name="header">
+ <h:outputText value="Group Members Reporting" />
+ </f:facet>
+ <h:outputText value="#{metric.numberCollecting}" />
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="Name" />
+ </f:facet>
+
+ <c:if test="#{MetricsTableUIBean.context.category == 'Resource'}">
+ <h:outputText value="#{metric.label}" />
+ </c:if>
+
+ <c:if test="#{MetricsTableUIBean.context.category == 'ResourceGroup'}">
+ <h:outputLink value="/resource/common/monitor/Visibility.do?mode=chartSingleMetricMultiResource&groupId=#{MetricsTableUIBean.context.groupId}&m=#{metric.definitionId}">
+ <h:outputText value="#{metric.label}" />
+ </h:outputLink>
+ </c:if>
+
+ <c:if test="#{MetricsTableUIBean.context.category == 'AutoGroup'}">
+ <h:outputLink value="/resource/common/monitor/Visibility.do?mode=chartSingleMetricMultiResource&parent=#{MetricsTableUIBean.context.parentResourceId}&type=#{MetricsTableUIBean.context.resourceTypeId}&m=#{metric.definitionId}">
+ <h:outputText value="#{metric.label}" />
+ </h:outputLink>
+ </c:if>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="Alerts" />
+ </f:facet>
+ <h:outputText value="#{metric.alertCount}" />
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="Min" />
+ </f:facet>
+ <h:outputText value="#{metric.minMetric.valueFmt}" />
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="Max" />
+ </f:facet>
+ <h:outputText value="#{metric.maxMetric.valueFmt}" />
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="Average" />
+ </f:facet>
+ <h:outputText value="#{metric.avgMetric.valueFmt}" />
+ </rich:column>
+
+ <rich:column
+ rendered="#{MetricsTableUIBean.context.category == 'Resource'}">
+ <f:facet name="header">
+ <h:outputText value="Last" />
+ </f:facet>
+ <h:outputText value="#{metric.lastMetric.valueFmt}" />
+ </rich:column>
+
+ <f:facet name="footer">
+ <rich:columnGroup
+ rendered="#{MetricsTableUIBean.context.category == 'Resource'}">
+ <rich:column colspan="8" width="100%">
+
+ <onc:selectCommandButton
+ action="#{MetricsTableChartUIBean.chartSelected}"
+ value="CHART SELECTED METRICS"
+ target="selectedMetrics"
+ styleClass="on-pager-button buttonsmall" />
+
+ </rich:column>
+ </rich:columnGroup>
+ </f:facet>
+
+ </rich:dataTable>
+
+ <table>
+ <tr>
+ <td><onc:metric optionList="m,h,d" /></td>
+ <td>
+ <h:commandLink rendered="#{not MetricComponentUtilityUIBean.readOnly}"
+ action="#{MetricComponentUtilityUIBean.update}" >
+ <img src="/images/dash-button_go-arrow.gif" alt="Apply Metric Settings "/>
+ </h:commandLink>
+ <h:commandLink rendered="#{MetricComponentUtilityUIBean.readOnly}"
+ action="#{MetricComponentUtilityUIBean.switchToSimpleMode}">
+ <h:outputText value="Switch to Simple Mode" />
+ </h:commandLink>
+ </td>
+ </tr>
+ </table>
+ </h:form>
+
+ </rich:panel>
+
+</ui:composition>
+
+</html>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/availabilityHistory-plain.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/availabilityHistory-plain.xhtml
new file mode 100644
index 0000000..61c7798
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/availabilityHistory-plain.xhtml
@@ -0,0 +1,196 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:onc="http://jboss.org/on/component"
+ xmlns:onf="http://jboss.org/on/function"
+ xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+
+<body>
+ <f:facet name="header" styleClass="BlockTitle">
+ <a name="AvailabilityHistory"/>
+ Availability History
+ </f:facet>
+
+
+ <h:panelGroup layout="block" rendered="#{ListAvailabilityHistoryUIBean.dataModel.rowCount == 0}">
+ This resource does not currently have any availability history.
+ </h:panelGroup>
+
+ <rich:panel styleClass="BlockContent" rendered="#{ListAvailabilityHistoryUIBean.dataModel.rowCount != 0}">
+
+
+ <h:panelGrid columns="2" styleClass="general-props-table" columnClasses="general-prop-cell">
+
+
+ <h:panelGroup layout="block">
+ <h:outputText value="Resource has been #{ResourceUIBean.availabilityType.name} since: "/>
+ <h:outputText value="#{ResourceUIBean.availabilitySummary.lastChange}">
+ <f:convertDateTime pattern="M/d/yy, h:mm:ss aa, zzz"
+ timeZone="#{ServerInfoUIBean.timeZone}"/>
+ </h:outputText>
+ </h:panelGroup>
+
+ <rich:spacer/>
+
+ <h:panelGroup layout="block" id="availPercent">
+ <h:outputText value="Availability: " styleClass="BoldText"/>
+ <h:outputText value="#{ResourceUIBean.availabilitySummary.upPercentage}">
+ <f:convertNumber type="percent" maxFractionDigits="3"/>
+ </h:outputText>
+ </h:panelGroup>
+
+
+ <h:panelGroup layout="block">
+ <b>Failures: </b>
+ <h:outputText value="#{ResourceUIBean.availabilitySummary.failures}"/>
+ </h:panelGroup>
+
+
+ <h:panelGroup layout="block">
+ <b>Down for: </b>
+ <h:outputText value="#{ResourceUIBean.availabilitySummary.downTime}">
+ <f:converter converterId="LongDurationConverter"/>
+ </h:outputText>
+ </h:panelGroup>
+ <h:panelGroup layout="block">
+
+ <b>Up for: </b>
+ <h:outputText value="#{ResourceUIBean.availabilitySummary.upTime}">
+ <f:converter converterId="LongDurationConverter"/>
+ </h:outputText>
+ </h:panelGroup>
+
+
+
+
+ <h:panelGroup layout="block">
+ <h:outputText value="MTBF: " styleClass="BoldText"/>
+ <h:outputText value="#{ResourceUIBean.availabilitySummary.MTBF}">
+ <f:converter converterId="LongDurationConverter"/>
+ </h:outputText>
+ <rich:toolTip>
+ Mean Time Between Failures over the known resource lifetime.
+ </rich:toolTip>
+ </h:panelGroup>
+
+
+ <h:panelGroup layout="block">
+ <h:outputText value="MTTR: " styleClass="BoldText"/>
+ <h:outputText value="#{ResourceUIBean.availabilitySummary.MTTR}">
+ <f:converter converterId="LongDurationConverter"/>
+ </h:outputText>
+ <rich:toolTip>
+ Mean Time To Recover from failure over the known resource lifetime.
+ </rich:toolTip>
+ </h:panelGroup>
+
+ </h:panelGrid>
+
+
+ <h:form id="availabilityHistoryForm">
+
+ <input type="hidden" name="id" value="#{param.id}"/>
+
+ <ui:param name="availabilityHistoryDataModel" value="#{ListAvailabilityHistoryUIBean.dataModel}"/>
+ <rich:dataTable id="availabilityHistoryDataTable"
+ rows="#{PageControl.AvailabilityHistoryList.pageSize}"
+ value="#{availabilityHistoryDataModel}"
+ rendered="#{ListAvailabilityHistoryUIBean.dataModel.rowCount > 0}"
+ var="availability"
+ columnsWidth="5%,25%,25%, 25%"
+ footerClass="on-pager-footer">
+
+
+ <f:facet name="PageControlView">
+ <onc:paginationControl id="AvailabilityHistoryList"/>
+ </f:facet>
+
+
+ <rich:column
+ style="background-color: #{availability.availabilityType == 'UP' ? '#E2F2E6' : '#E2D2D2'}">
+ <f:facet name="header">
+
+
+ <onc:sortableColumnHeader sort="av.availabilityType">
+ <h:outputText styleClass="headerText" value="Availablility"/>
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:graphicImage value="/images/icons/availability_green_16.png" alt="Up" title="Up"
+ rendered="#{availability.availabilityType == 'UP'}"/>
+ <h:graphicImage value="/images/icons/availability_red_16.png" alt="Down" title="Down"
+ rendered="#{availability.availabilityType == 'DOWN'}"/>
+ <h:graphicImage value="/images/icons/availability_grey_16.png" alt="Unknown" title="Unknown"
+ rendered="#{availability.availabilityType == null}"/>
+
+ <h:outputText value="#{availability.availabilityType}"/>
+ </rich:column>
+
+ <rich:column
+ style="background-color: #{availability.availabilityType == 'UP' ? '#E2F2E6' : '#E2D2D2'}">
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="av.startTime">
+ <h:outputText styleClass="headerText" value="Start"/>
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{availability.startTime}"/>
+ </rich:column>
+
+ <rich:column
+ style="background-color: #{availability.availabilityType == 'UP' ? '#E2F2E6' : '#E2D2D2'}">
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="av.endTime">
+ <h:outputText styleClass="headerText" value="End"/>
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{availability.endTime}"/>
+ </rich:column>
+
+ <rich:column
+ style="background-color: #{availability.availabilityType == 'UP' ? '#E2F2E6' : '#E2D2D2'}">
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="(av.endTime - av.startTime)">
+ <h:outputText styleClass="headerText" value="Duration"/>
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+
+ <h:outputText
+ value="#{(availability.endTime == null) ? (ListAvailabilityHistoryUIBean.currentTime.time - availability.startTime.time) : (availability.endTime.time - availability.startTime.time)}">
+ <f:converter converterId="LongDurationConverter"/>
+ </h:outputText>
+ </rich:column>
+
+
+ <f:facet name="footer">
+ <rich:columnGroup>
+ <rich:column colspan="4">
+
+ <ui:include src="../include/pagination.xhtml">
+ <ui:param name="paginationDataTableName" value="availabilityHistoryDataTable"/>
+ <ui:param name="paginationDataModel" value="#{availabilityHistoryDataModel}"/>
+ <ui:param name="paginationPageControl"
+ value="#{PageControl.AvailabilityHistoryList}"/>
+ </ui:include>
+ </rich:column>
+ </rich:columnGroup>
+ </f:facet>
+
+ </rich:dataTable>
+
+ </h:form>
+ </rich:panel>
+</body>
+
+</html>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/availabilityHistory.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/availabilityHistory.xhtml
index 61c7798..932adc1 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/availabilityHistory.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/availabilityHistory.xhtml
@@ -14,7 +14,14 @@
xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
xmlns:rich="http://richfaces.ajax4jsf.org/rich">
-<body>
+<ui:composition template="/rhq/resource/layout/main.xhtml">
+
+ <ui:param name="pageTitle" value="#{ResourceUIBean.resourceType.name} '#{ResourceUIBean.name}' - Metric Tables"/>
+ <ui:param name="selectedTabName" value="Monitor.Availability"/>
+
+ <ui:define name="content">
+
+
<f:facet name="header" styleClass="BlockTitle">
<a name="AvailabilityHistory"/>
Availability History
@@ -191,6 +198,9 @@
</h:form>
</rich:panel>
-</body>
+
+ </ui:define>
+
+</ui:composition>
</html>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/schedules-plain.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/schedules-plain.xhtml
new file mode 100644
index 0000000..ac82b66
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/schedules-plain.xhtml
@@ -0,0 +1,169 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:onc="http://jboss.org/on/component"
+ xmlns:onf="http://jboss.org/on/function"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+
+<body>
+ <h:outputText rendered="#{not ResourceUIBean.permissions.measure}" value="You don't have the measure permission for this resource and therefore can not change metric schedules"/>
+
+
+ <h:form id="resourceSchedulesForm">
+ <!-- hack to override the default button on the page, make this button pseudo-first in the form,
+ but take it out of the document flow and position it off the screen -->
+ <div style="position:absolute; top:-100px; ">
+ <onc:selectCommandButton name="enableAndSetSelectedSchedules"
+ action="#{ListResourceMeasurementScheduleUIBean.enableAndSetSelected}"
+ value="SET" target="selectedResourceSchedules"
+ styleClass="on-pager-button buttonsmall"
+ rendered="#{ResourceUIBean.permissions.measure}" />
+ </div>
+ <input type="hidden" name="id" value="${param.id}"/>
+
+ <rich:panel styleClass="BlockContent">
+ <f:facet name="header">
+ <h:outputText value="Configure Metric Collection Schedules"/>
+ </f:facet>
+
+ <h:panelGrid columns="1" styleClass="data-table">
+
+ <ui:param name="resourceSchedulesDataModel" value="#{ListResourceMeasurementScheduleUIBean.dataModel}"/>
+ <rich:dataTable id="resourceSchedulesDataTable"
+ rows="#{PageControl.ResourceMeasurementScheduleList.pageSize}"
+ value="#{resourceSchedulesDataModel}"
+ var="item"
+ width="100%"
+ columnsWidth="1%, 20%, 30%, 20%, 9%, 20%"
+ styleClass="resources-table"
+ headerClass="tableRowHeader"
+ footerClass="on-pager-footer"
+ onRowMouseOver="this.style.backgroundColor='#E7E7E7'"
+ onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
+
+ <f:facet name="PageControlView">
+ <onc:paginationControl id="ResourceMeasurementScheduleList" />
+ </f:facet>
+
+ <rich:column
+ style="background-color: #{item.collectionEnabled ? '#E2F2E6' : '#E2D2D2'}">
+ <f:facet name="header">
+ <onc:allSelect target="selectedResourceSchedules" />
+ </f:facet>
+
+ <onc:select name="selectedResourceSchedules" value="#{item.measurementDefinition.id}" />
+ </rich:column>
+
+ <rich:column
+ style="background-color: #{item.collectionEnabled ? '#E2F2E6' : '#E2D2D2'}">
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="ms.definition.displayName">
+ <h:outputText styleClass="headerText" value="Metric" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.measurementDefinition.displayName}"/>
+ </rich:column>
+
+ <rich:column
+ style="background-color: #{item.collectionEnabled ? '#E2F2E6' : '#E2D2D2'}">
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Description" />
+ </f:facet>
+
+ <h:outputText value="#{item.measurementDefinition.description}"/>
+ </rich:column>
+
+ <rich:column
+ style="background-color: #{item.collectionEnabled ? '#E2F2E6' : '#E2D2D2'}">
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="ms.definition.dataType">
+ <h:outputText styleClass="headerText" value="Type" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.measurementDefinition.dataType}" />
+ </rich:column>
+
+ <rich:column
+ style="background-color: #{item.collectionEnabled ? '#E2F2E6' : '#E2D2D2'}">
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="ms.enabled">
+ <h:outputText styleClass="headerText" value="Enabled" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+ <h:outputText value="Yes" style="color:green;font:bold;" rendered="#{item.collectionEnabled}"/>
+ <h:outputText value="No" style="color:red;font:bold;" rendered="#{!item.collectionEnabled}"/>
+ </rich:column>
+
+ <rich:column
+ style="background-color: #{item.collectionEnabled ? '#E2F2E6' : '#E2D2D2'}">
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="ms.interval">
+ <h:outputText styleClass="headerText" value="Collection Interval" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+
+ <h:outputText value="#{item.collectionInterval}">
+ <f:converter converterId="DurationConverter" />
+ </h:outputText>
+ </rich:column>
+
+ <f:facet name="footer" rendered="false">
+ <rich:columnGroup>
+ <rich:column colspan="6">
+ <h:panelGrid columns="5" width="100%" rendered="#{ResourceUIBean.permissions.measure}">
+ <onc:selectCommandButton id="enableSelectedSchedules"
+ name="enableSelectedSchedules"
+ action="#{ListResourceMeasurementScheduleUIBean.enableSelected}"
+ value="ENABLE" target="selectedResourceSchedules"
+ styleClass="on-pager-button buttonsmall"
+ rendered="#{ResourceUIBean.permissions.measure}" />
+
+ <onc:selectCommandButton id="disableSelectedSchedules"
+ name="disableSelectedSchedules"
+ action="#{ListResourceMeasurementScheduleUIBean.disableSelected}"
+ value="DISABLE" target="selectedResourceSchedules"
+ styleClass="on-pager-button buttonsmall"
+ rendered="#{ResourceUIBean.permissions.measure}"/>
+ <h:panelGrid columns="3">
+ <h:outputText value="Collection Interval: "/>
+ <onc:duration binding="#{ListResourceMeasurementScheduleUIBean.duration}"
+ optionList="s,m,h"/>
+ <onc:selectCommandButton id="enableAndSetSelectedSchedules"
+ name="enableAndSetSelectedSchedules"
+ action="#{ListResourceMeasurementScheduleUIBean.enableAndSetSelected}"
+ value="SET" target="selectedResourceSchedules"
+ styleClass="on-pager-button buttonsmall"
+ rendered="#{ResourceUIBean.permissions.measure}"/>
+ </h:panelGrid>
+
+ <rich:spacer/>
+
+ <ui:param name="paginationDataTableName" value="resourceSchedulesDataTable"/>
+ <ui:param name="paginationDataModel" value="#{resourceSchedulesDataModel}"/>
+ <ui:param name="paginationPageControl" value="#{PageControl.ResourceMeasurementScheduleList}"/>
+ <ui:include src="/rhq/resource/include/pagination.xhtml"/>
+ </h:panelGrid>
+ </rich:column>
+ </rich:columnGroup>
+ </f:facet>
+
+ </rich:dataTable>
+
+ </h:panelGrid>
+
+ </rich:panel>
+ </h:form>
+</body>
+</html>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/schedules.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/schedules.xhtml
index ac82b66..c568507 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/schedules.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/schedules.xhtml
@@ -15,7 +15,13 @@
xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
xmlns:rich="http://richfaces.ajax4jsf.org/rich">
-<body>
+<ui:composition template="/rhq/resource/layout/main.xhtml">
+
+<ui:param name="pageTitle" value="#{ResourceUIBean.resourceType.name} '#{ResourceUIBean.name}' - Metric Schedules"/>
+<ui:param name="selectedTabName" value="Monitor.Schedules"/>
+
+<ui:define name="content">
+
<h:outputText rendered="#{not ResourceUIBean.permissions.measure}" value="You don't have the measure permission for this resource and therefore can not change metric schedules"/>
@@ -165,5 +171,9 @@
</rich:panel>
</h:form>
-</body>
+
+</ui:define>
+
+</ui:composition>
+
</html>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/traits-plain.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/traits-plain.xhtml
new file mode 100644
index 0000000..8d0a42a
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/traits-plain.xhtml
@@ -0,0 +1,102 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:onc="http://jboss.org/on/component"
+ xmlns:onf="http://jboss.org/on/function"
+ xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+
+<body>
+ <rich:panel styleClass="BlockContent">
+
+ <f:facet name="header" styleClass="BlockTitle">
+ <a name="Traits"/>
+ Traits
+ </f:facet>
+
+ <rich:dataTable value="#{ResourceMetricsTableUIBean.traitSummaries}"
+ width="100%"
+ var="metric"
+ onRowMouseOver="this.style.backgroundColor='#E7E7E7'"
+ onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
+
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="Name"/>
+ </f:facet>
+ <h:outputLink value="/rhq/resource/monitor/traits.xhtml">
+ <f:param name="traitDefinitionId" value="#{metric.definitionId}"/>
+ <f:param name="id" value="#{ResourceUIBean.id}"/>
+ <h:outputText value="#{metric.label}"/>
+ </h:outputLink>
+ <h:outputText rendered="#{not empty param.traitDefinitionId and
+ param.traitDefinitionId eq metric.definitionId}">
+ <h:outputText value=" {selected}"/>
+ </h:outputText>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="Alerts"/>
+ </f:facet>
+ <h:outputText value="#{metric.alertCount}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="Value"/>
+ </f:facet>
+ <h:outputText value="#{metric.value}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="Last Changed"/>
+ </f:facet>
+ <h:outputText value="#{metric.changedDate}"/>
+ </rich:column>
+ </rich:dataTable>
+
+ </rich:panel>
+
+ <rich:panel styleClass="BlockContent"
+ rendered="#{not empty param.traitDefinitionId}">
+
+ <f:facet name="header" styleClass="BlockTitle">
+ <a name="History"/>
+ </f:facet>
+
+ <rich:dataTable value="#{ResourceMetricsTableUIBean.traitHistory}"
+ width="100%"
+ var="history"
+ onRowMouseOver="this.style.backgroundColor='#E7E7E7'"
+ onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
+
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="Value"/>
+ </f:facet>
+ <h:outputText value="#{history.value}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="Last Changed"/>
+ </f:facet>
+ <h:outputText value="#{history.timestamp}">
+ <f:converter converterId="UserDateTimeConverter" />
+ </h:outputText>
+ </rich:column>
+ </rich:dataTable>
+
+ </rich:panel>
+</body>
+</html>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/traits.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/traits.xhtml
index 8d0a42a..1509fc2 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/traits.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/traits.xhtml
@@ -14,7 +14,13 @@
xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
xmlns:rich="http://richfaces.ajax4jsf.org/rich">
-<body>
+<ui:composition template="/rhq/resource/layout/main.xhtml">
+
+<ui:param name="pageTitle" value="#{ResourceUIBean.resourceType.name} '#{ResourceUIBean.name}' - Metric Traits"/>
+<ui:param name="selectedTabName" value="Monitor.Traits"/>
+
+<ui:define name="content">
+
<rich:panel styleClass="BlockContent">
<f:facet name="header" styleClass="BlockTitle">
@@ -98,5 +104,9 @@
</rich:dataTable>
</rich:panel>
-</body>
+
+</ui:define>
+
+</ui:composition>
+
</html>
commit 3d5fb31bb8cc7e4e022432e517845406cbcfdbf1
Merge: b8d5a3b... 25689f4...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 10 15:49:22 2010 -0500
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
Conflicts:
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
index c33f6a8,1ace236..ab0beb5
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
@@@ -57,14 -48,10 +57,15 @@@ public class BundleInfoStep implements
form.setColWidths("50%", "*");
final TextItem nameTextItem = new TextItem("name", "Name");
+ nameTextItem.setRequired(true);
nameTextItem.addChangedHandler(new ChangedHandler() {
public void onChanged(ChangedEvent event) {
- wizard.setSubtitle(event.getValue().toString());
+ Object value = event.getValue();
+ if (value == null) {
+ value = "";
+ }
+ wizard.setSubtitle(value.toString());
+ wizard.setBundleName(value.toString());
}
});
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
index 2a5c519,0d7daa5..e637769
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
@@@ -37,19 -35,11 +37,19 @@@ public class BundleUploadDataStep imple
}
public Canvas getCanvas() {
- return new Label("Todo: implement me");
+ HLayout hlayout = new HLayout();
+ hlayout.setWidth100();
+ hlayout.setHeight100();
+
+ Img loaderImage = new Img("/images/ajax-loader.gif");
+ loaderImage.setAlign(Alignment.CENTER);
+ hlayout.addChild(loaderImage);
+
+ return hlayout;
}
- public boolean valid() {
- return false; // TODO: Implement this method.
+ public boolean nextPage() {
+ return true; // TODO: Implement this method.
}
public String getName() {
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
index 7d86396,c5ffe6a..80b2c8a
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
@@@ -74,19 -75,14 +74,20 @@@ public class BundleUploadRecipeStep imp
}
});
-
- final TextAreaItem recipe = new TextAreaItem("recipe","Recipe");
+ final TextAreaItem recipe = new TextAreaItem("recipe", "Recipe");
recipe.setShowTitle(false);
+ recipe.setRequired(true);
-
recipe.setWidth("*");
recipe.setHeight("*");
-
+ recipe.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent event) {
+ Object value = event.getValue();
+ if (value == null) {
+ value = "";
+ }
+ wizard.setRecipe(value.toString());
+ }
+ });
textFileRetrieverForm.addFormHandler(new DynamicFormHandler() {
public void onSubmitComplete(DynamicFormSubmitCompleteEvent event) {
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java
index 7e95f6f,498d7cb..339c357
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java
@@@ -43,33 -35,10 +43,33 @@@ public class BundleVerificationStep imp
}
public Canvas getCanvas() {
- return new Label("Todo: implement me");
+ HLayout hlayout = new HLayout();
+ hlayout.setWidth100();
+ hlayout.setHeight100();
+
+ final Img verifyingImage = new Img("/images/status-bar.gif");
+ verifyingImage.setWidth100();
+ verifyingImage.setHeight(15);
+
+ hlayout.addChild(verifyingImage);
+
+ bundleServer.createBundleAndBundleVersion(this.wizard.getBundleName(), this.wizard.getBundleType().getId(),
+ this.wizard.getBundleName(), this.wizard.getBundleVersionString(), this.wizard.getRecipe(),
+ new AsyncCallback<BundleVersion>() {
+ public void onSuccess(BundleVersion result) {
+ verifyingImage.setSrc("/images/status_complete.gif");
+ wizard.setBundleVersion(result);
+ }
+
+ public void onFailure(Throwable caught) {
+ verifyingImage.setSrc("/images/status_error.gif");
+ CoreGUI.getErrorHandler().handleError("Failed to create bundle: " + caught.getMessage(), caught);
+ }
+ });
+ return hlayout;
}
- public boolean valid() {
+ public boolean nextPage() {
return false; // TODO: Implement this method.
}
commit b8d5a3b5bbdb3144f6faefc56d8493b49ba03265
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 10 15:46:26 2010 -0500
slowly filling out bundle wizard
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java
index 62e5691..b9060e2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java
@@ -24,6 +24,8 @@ import java.util.List;
import com.smartgwt.client.widgets.IButton;
+import org.rhq.core.domain.bundle.BundleType;
+import org.rhq.core.domain.bundle.BundleVersion;
import org.rhq.enterprise.gui.coregui.client.components.wizard.Wizard;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardView;
@@ -37,14 +39,22 @@ public class BundleCreationWizard implements Wizard {
private WizardView view;
private String subtitle = "";
+ // the things we build up in the wizard
+ private BundleType bundleType;
+ private String bundleName;
+ private String bundleVersionString;
+ private String bundleDescription;
+ private String recipe;
+ private BundleVersion bundleVersion;
+
public BundleCreationWizard() {
steps = new ArrayList<WizardStep>();
steps.add(new BundleInfoStep(this));
steps.add(new BundleUploadRecipeStep(this));
- steps.add(new BundleUploadDataStep(this));
steps.add(new BundleVerificationStep(this));
+ steps.add(new BundleUploadDataStep(this));
}
@@ -77,4 +87,52 @@ public class BundleCreationWizard implements Wizard {
view = new WizardView(this);
view.displayDialog();
}
+
+ public BundleType getBundleType() {
+ return bundleType;
+ }
+
+ public void setBundleType(BundleType bundleType) {
+ this.bundleType = bundleType;
+ }
+
+ public String getBundleName() {
+ return bundleName;
+ }
+
+ public void setBundleName(String bundleName) {
+ this.bundleName = bundleName;
+ }
+
+ public String getBundleVersionString() {
+ return bundleVersionString;
+ }
+
+ public void setBundleVersionString(String bundleVersionString) {
+ this.bundleVersionString = bundleVersionString;
+ }
+
+ public String getBundleDescription() {
+ return bundleDescription;
+ }
+
+ public void setBundleDescription(String desc) {
+ this.bundleDescription = desc;
+ }
+
+ public String getRecipe() {
+ return recipe;
+ }
+
+ public void setRecipe(String recipe) {
+ this.recipe = recipe;
+ }
+
+ public BundleVersion getBundleVersion() {
+ return bundleVersion;
+ }
+
+ public void setBundleVersion(BundleVersion bv) {
+ this.bundleVersion = bv;
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
index e25bdda..c33f6a8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
@@ -18,6 +18,9 @@
*/
package org.rhq.enterprise.gui.coregui.client.bundle.create;
+import java.util.List;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.FormItem;
@@ -26,7 +29,11 @@ import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
+import org.rhq.core.domain.bundle.BundleType;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
/**
* @author Greg Hinkle
@@ -36,6 +43,8 @@ public class BundleInfoStep implements WizardStep {
private DynamicForm form;
private final BundleCreationWizard wizard;
+ private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
+
public BundleInfoStep(BundleCreationWizard bundleCreationWizard) {
this.wizard = bundleCreationWizard;
}
@@ -50,19 +59,58 @@ public class BundleInfoStep implements WizardStep {
final TextItem nameTextItem = new TextItem("name", "Name");
nameTextItem.addChangedHandler(new ChangedHandler() {
public void onChanged(ChangedEvent event) {
- wizard.setSubtitle(event.getValue().toString());
+ Object value = event.getValue();
+ if (value == null) {
+ value = "";
+ }
+ wizard.setSubtitle(value.toString());
+ wizard.setBundleName(value.toString());
}
});
final TextItem versionTextItem = new TextItem("version", "Initial Version");
versionTextItem.setValue("1.0");
+ wizard.setBundleVersionString("1.0");
+ versionTextItem.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent event) {
+ Object value = event.getValue();
+ if (value == null) {
+ value = "";
+ }
+ wizard.setBundleVersionString(value.toString());
+ }
+ });
+
final TextAreaItem descriptionTextAreaItem = new TextAreaItem("description", "Description");
+ descriptionTextAreaItem.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent event) {
+ Object value = event.getValue();
+ if (value == null) {
+ value = "";
+ }
+ wizard.setBundleDescription(value.toString());
+ }
+ });
+
form.setItems(nameTextItem, versionTextItem, descriptionTextAreaItem);
+
+ // TODO: we should get all bundle types in a drop down menu and let the user pick
+ // for now assume we always get one (the filetemplate one) and use it
+ bundleServer.getBundleTypes(new AsyncCallback<List<BundleType>>() {
+ public void onSuccess(List<BundleType> result) {
+ wizard.setBundleType(result.get(0));
+ }
+
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("No bundle types available: " + caught.getMessage(), caught);
+ }
+ });
}
return form;
}
public boolean valid() {
+ // TODO make sure I have a bundle type
FormItem nameField = form.getField("name");
return true;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
index 6ae2579..2a5c519 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
@@ -18,8 +18,10 @@
*/
package org.rhq.enterprise.gui.coregui.client.bundle.create;
+import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.Label;
+import com.smartgwt.client.widgets.Img;
+import com.smartgwt.client.widgets.layout.HLayout;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
@@ -35,7 +37,15 @@ public class BundleUploadDataStep implements WizardStep {
}
public Canvas getCanvas() {
- return new Label("Todo: implement me");
+ HLayout hlayout = new HLayout();
+ hlayout.setWidth100();
+ hlayout.setHeight100();
+
+ Img loaderImage = new Img("/images/ajax-loader.gif");
+ loaderImage.setAlign(Alignment.CENTER);
+ hlayout.addChild(loaderImage);
+
+ return hlayout;
}
public boolean valid() {
@@ -43,7 +53,7 @@ public class BundleUploadDataStep implements WizardStep {
}
public String getName() {
- return "Upload Bundle Binary Information";
+ return "Upload Bundle Files";
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
index 98b5860..7d86396 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
@@ -23,6 +23,8 @@ import com.smartgwt.client.widgets.form.fields.CanvasItem;
import com.smartgwt.client.widgets.form.fields.HiddenItem;
import com.smartgwt.client.widgets.form.fields.LinkItem;
import com.smartgwt.client.widgets.form.fields.TextAreaItem;
+import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
+import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
@@ -43,31 +45,28 @@ public class BundleUploadRecipeStep implements WizardStep {
public BundleUploadRecipeStep(BundleCreationWizard bundleCreationWizard) {
this.wizard = bundleCreationWizard;
}
+
public Canvas getCanvas() {
if (form == null) {
-
form = new DynamicCallbackForm("test");
form.setWidth100();
form.setNumCols(1);
-// form.setColWidths("25%","75%");
+
HiddenItem idField = new HiddenItem("id");
idField.setValue(1);
-
final LinkItem showUpload = new LinkItem("showUpload");
- showUpload.setValue("Upload a file");
+ showUpload.setValue("Click To Upload A Recipe File");
showUpload.setShowTitle(false);
-
final CanvasItem upload = new CanvasItem("upload");
upload.setShowTitle(false);
+
TextFileRetrieverForm textFileRetrieverForm = new TextFileRetrieverForm();
upload.setCanvas(textFileRetrieverForm);
-
-
showUpload.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
form.hideItem("showUpload");
@@ -75,36 +74,41 @@ public class BundleUploadRecipeStep implements WizardStep {
}
});
-
- final TextAreaItem recipe = new TextAreaItem("recipe","Recipe");
+ final TextAreaItem recipe = new TextAreaItem("recipe", "Recipe");
recipe.setShowTitle(false);
-
recipe.setWidth("*");
recipe.setHeight("*");
-
+ recipe.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent event) {
+ Object value = event.getValue();
+ if (value == null) {
+ value = "";
+ }
+ wizard.setRecipe(value.toString());
+ }
+ });
textFileRetrieverForm.addFormHandler(new DynamicFormHandler() {
public void onSubmitComplete(DynamicFormSubmitCompleteEvent event) {
+ wizard.setRecipe(event.getResults());
recipe.setValue(event.getResults());
form.showItem("showUpload");
form.hideItem("upload");
}
});
- form.setItems(idField,showUpload,upload, recipe);
-
+ form.setItems(idField, showUpload, upload, recipe);
form.hideItem("upload");
-
}
return form;
}
public boolean valid() {
- return false; // TODO: Implement this method.
+ return false; // TODO: Implement this method.
}
public String getName() {
- return "Setup Bundle Recipe Information";
+ return "Provide Bundle Recipe";
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java
index 02df491..7e95f6f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java
@@ -18,10 +18,16 @@
*/
package org.rhq.enterprise.gui.coregui.client.bundle.create;
+import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.Label;
+import com.smartgwt.client.widgets.Img;
+import com.smartgwt.client.widgets.layout.HLayout;
+import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
/**
* @author Greg Hinkle
@@ -30,12 +36,37 @@ public class BundleVerificationStep implements WizardStep {
private final BundleCreationWizard wizard;
+ private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
+
public BundleVerificationStep(BundleCreationWizard bundleCreationWizard) {
this.wizard = bundleCreationWizard;
}
public Canvas getCanvas() {
- return new Label("Todo: implement me");
+ HLayout hlayout = new HLayout();
+ hlayout.setWidth100();
+ hlayout.setHeight100();
+
+ final Img verifyingImage = new Img("/images/status-bar.gif");
+ verifyingImage.setWidth100();
+ verifyingImage.setHeight(15);
+
+ hlayout.addChild(verifyingImage);
+
+ bundleServer.createBundleAndBundleVersion(this.wizard.getBundleName(), this.wizard.getBundleType().getId(),
+ this.wizard.getBundleName(), this.wizard.getBundleVersionString(), this.wizard.getRecipe(),
+ new AsyncCallback<BundleVersion>() {
+ public void onSuccess(BundleVersion result) {
+ verifyingImage.setSrc("/images/status_complete.gif");
+ wizard.setBundleVersion(result);
+ }
+
+ public void onFailure(Throwable caught) {
+ verifyingImage.setSrc("/images/status_error.gif");
+ CoreGUI.getErrorHandler().handleError("Failed to create bundle: " + caught.getMessage(), caught);
+ }
+ });
+ return hlayout;
}
public boolean valid() {
@@ -43,7 +74,7 @@ public class BundleVerificationStep implements WizardStep {
}
public String getName() {
- return "Verify Bundle Information";
+ return "Verify Recipe";
}
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java
index e155553..ef1ee4a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java
@@ -18,8 +18,25 @@
*/
package org.rhq.enterprise.gui.coregui.client.gwt;
+import java.util.List;
+
import com.google.gwt.user.client.rpc.RemoteService;
+import org.rhq.core.domain.bundle.Bundle;
+import org.rhq.core.domain.bundle.BundleType;
+import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.core.domain.criteria.BundleCriteria;
+import org.rhq.core.domain.util.PageList;
+
public interface BundleGWTService extends RemoteService {
+ List<BundleType> getBundleTypes();
+
+ PageList<Bundle> findBundlesByCriteria(BundleCriteria criteria) throws Exception;
+
+ Bundle createBundle(String name, int bundleTypeId) throws Exception;
+
+ BundleVersion createBundleVersion(int bundleId, String name, String version, String recipe) throws Exception;
+ BundleVersion createBundleAndBundleVersion(String bundleName, int bundleTypeId, String name, String version,
+ String recipe) throws Exception;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
index a87ea8a..825fe04 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
@@ -18,6 +18,15 @@
*/
package org.rhq.enterprise.gui.coregui.server.gwt;
+import java.util.List;
+
+import org.rhq.core.domain.bundle.Bundle;
+import org.rhq.core.domain.bundle.BundleType;
+import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.core.domain.criteria.BundleCriteria;
+import org.rhq.core.domain.criteria.BundleVersionCriteria;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.core.util.exception.ThrowableUtil;
import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTService;
import org.rhq.enterprise.gui.coregui.server.util.SerialUtility;
import org.rhq.enterprise.server.bundle.BundleManagerLocal;
@@ -28,8 +37,51 @@ public class BundleGWTServiceImpl extends AbstractGWTServiceImpl implements Bund
private BundleManagerLocal bundleManager = LookupUtil.getBundleManager();
- // TODO: this just illustrates how we are to prepare the results for the GWT client on the other end
- public Object foo() {
- return SerialUtility.prepare(null, null);
+ public List<BundleType> getBundleTypes() {
+ List<BundleType> bundleTypes = bundleManager.getAllBundleTypes(getSessionSubject());
+ return SerialUtility.prepare(bundleTypes, "getBundleTypes");
+ }
+
+ public PageList<Bundle> findBundlesByCriteria(BundleCriteria criteria) {
+ PageList<Bundle> results = bundleManager.findBundlesByCriteria(getSessionSubject(), criteria);
+ return SerialUtility.prepare(results, "findBundlesByCriteria");
+ }
+
+ public PageList<BundleVersion> findBundleVersionsByCriteria(BundleVersionCriteria criteria) {
+ PageList<BundleVersion> results = bundleManager.findBundleVersionsByCriteria(getSessionSubject(), criteria);
+ return SerialUtility.prepare(results, "findBundleVersionsByCriteria");
+ }
+
+ public Bundle createBundle(String name, int bundleTypeId) throws Exception {
+ Bundle results;
+ try {
+ results = bundleManager.createBundle(getSessionSubject(), name, bundleTypeId);
+ } catch (Exception e) {
+ throw new Exception(ThrowableUtil.getAllMessages(e));
+ }
+ return SerialUtility.prepare(results, "createBundle");
+ }
+
+ public BundleVersion createBundleVersion(int bundleId, String name, String version, String recipe) throws Exception {
+ BundleVersion results;
+ try {
+ results = bundleManager.createBundleVersion(getSessionSubject(), bundleId, name, version, recipe);
+ } catch (Exception e) {
+ throw new Exception(ThrowableUtil.getAllMessages(e));
+ }
+ return SerialUtility.prepare(results, "createBundleVersion");
}
+
+ public BundleVersion createBundleAndBundleVersion(String bundleName, int bundleTypeId, String name, String version,
+ String recipe) throws Exception {
+ BundleVersion results;
+ try {
+ results = bundleManager.createBundleAndBundleVersion(getSessionSubject(), bundleName, bundleTypeId, name,
+ version, recipe);
+ } catch (Exception e) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ }
+ return SerialUtility.prepare(results, "createBundleAndBundleVersion");
+ }
+
}
\ No newline at end of file
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
index d689f48..af88312 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
@@ -22,9 +22,7 @@ import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.HashSet;
import java.util.List;
-import java.util.Random;
import java.util.Set;
-import java.util.UUID;
import javax.ejb.EJB;
import javax.ejb.Stateless;
@@ -66,6 +64,7 @@ import org.rhq.core.domain.criteria.BundleVersionCriteria;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.util.PageList;
+import org.rhq.core.util.NumberUtil;
import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.agentclient.AgentClient;
import org.rhq.enterprise.server.authz.AuthorizationManagerLocal;
@@ -238,7 +237,14 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
BundleType bundleType = bundle.getBundleType();
BundleServerPluginFacet bp = BundleManagerHelper.getPluginContainer().getBundleServerPluginManager()
.getBundleServerPluginFacet(bundleType.getName());
- RecipeParseResults results = bp.parseRecipe(recipe);
+ RecipeParseResults results;
+
+ try {
+ results = bp.parseRecipe(recipe);
+ } catch (Exception e) {
+ // ensure that we throw a runtime exception to force a rollback
+ throw new RuntimeException("Failed to parse recipe", e);
+ }
// ensure we have a version
version = getVersion(version, bundle);
@@ -264,18 +270,7 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
// note - this is the same algo used by ResourceClientProxy in updatebackingContent (for a resource)
String oldVersion = (null == currentBundleVersion) ? null : currentBundleVersion.getVersion();
- String newVersion = "1.0";
- if (oldVersion != null && oldVersion.length() != 0) {
- String[] parts = oldVersion.split("[^a-zA-Z0-9]");
- String lastPart = parts[parts.length - 1];
- try {
- int lastNumber = Integer.parseInt(lastPart);
- newVersion = oldVersion.substring(0, oldVersion.length() - lastPart.length()) + (lastNumber + 1);
- } catch (NumberFormatException nfe) {
- newVersion = oldVersion + ".1";
- }
- }
-
+ String newVersion = NumberUtil.autoIncrementVersion(oldVersion);
return newVersion;
}
@@ -585,48 +580,4 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
// the deployments.
this.entityManager.remove(bundleVersion);
}
-
- public BundleType createMockBundleType(Subject subject) {
-
- try {
- ResourceType linuxPlatformResourceType = this.resourceTypeManager.getResourceTypeByNameAndPlugin("Linux",
- "Platforms");
- return createBundleType(subject, UUID.randomUUID().toString(), linuxPlatformResourceType.getId());
- } catch (Exception e) {
- e.printStackTrace();
- return null;
- }
- }
-
- public Bundle createMockBundle(Subject subject, List<BundleType> bundleTypes) throws Exception {
- Random random = new Random();
- BundleType bundleType;
- if (bundleTypes.isEmpty()) {
- bundleType = createMockBundleType(subject);
- } else {
- int randomIndex = random.nextInt(bundleTypes.size());
- bundleType = bundleTypes.get(randomIndex);
- }
-
- Bundle bundle = createBundle(subject, UUID.randomUUID().toString(), bundleType.getId());
-
- // Add 1 to 5 bundle versions.
- int bundleVersionCount = random.nextInt(5) + 1;
- for (int i = 0; i < bundleVersionCount; i++) {
- String bundleVersionName = UUID.randomUUID().toString();
- final String RECIPE = "repo rhel-x86_64-5\n" //
- + "package foo-1.25.rpm\n" //
- + "package bar-1.25.rpm\n" //
- + "script foo.bash -c some parameter\n" //
- + "deploy jboss.tar %{jboss.home.directory}\n" //
- + "realize %{jboss.home.directory}/server/default/setting.xml\n" //
- + "file example.setting /etc/some/setting.ini\n" + "service example restart\n";
- BundleVersion bundleVersion = new BundleVersion(bundleVersionName, String.valueOf(i + 1), null, RECIPE);
- bundle.addBundleVersion(bundleVersion);
- }
-
- bundle = entityManager.merge(bundle);
- return bundle;
- }
-
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
index c62bf55..8a0064d 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
@@ -365,6 +365,12 @@ public class WebservicesManagerBean implements WebservicesRemote {
return bundleManager.createBundleVersion(subject, bundleId, name, bundleVersion, recipe);
}
+ public BundleVersion createBundleAndBundleVersion(Subject subject, String bundleName, int bundleTypeId,
+ String name, String bundleVersion, String recipe) throws Exception {
+ return bundleManager.createBundleAndBundleVersion(subject, bundleName, bundleTypeId, name, bundleVersion,
+ recipe);
+ }
+
public void deleteBundle(Subject subject, int bundleId) throws Exception {
bundleManager.deleteBundle(subject, bundleId);
}
commit f7d82fa36084ad241740100e5da459c6fb8f47fa
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 10 15:45:53 2010 -0500
some minor fixes in file template commons
diff --git a/modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/RecipeContext.java b/modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/RecipeContext.java
index bc8932f..212c87b 100644
--- a/modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/RecipeContext.java
+++ b/modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/RecipeContext.java
@@ -51,6 +51,9 @@ public class RecipeContext {
private final List<Command> commands;
public RecipeContext(String recipe) {
+ if (recipe == null) {
+ throw new IllegalArgumentException("recipe == null");
+ }
this.recipe = recipe;
this.deployFiles = new HashMap<String, String>();
this.files = new HashMap<String, String>();
diff --git a/modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/RecipeParser.java b/modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/RecipeParser.java
index f22c04c..d48c3ba 100644
--- a/modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/RecipeParser.java
+++ b/modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/RecipeParser.java
@@ -108,7 +108,7 @@ public class RecipeParser {
RecipeCommand recipeCommand = this.recipeCommands.get(commandName);
if (recipeCommand == null) {
- throw new Exception("Unknown command in recipe: " + commandName);
+ throw new Exception("Unknown command in recipe [" + commandName + "]");
}
Set<String> replacementVars = getReplacementVariables(line);
commit 25689f4eb304401c6f58ec2c5e5d6d24f64a588c
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Wed Mar 10 15:27:23 2010 -0500
Basic wizard validation on moving to next step
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
index e25bdda..1ace236 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
@@ -48,6 +48,7 @@ public class BundleInfoStep implements WizardStep {
form.setColWidths("50%", "*");
final TextItem nameTextItem = new TextItem("name", "Name");
+ nameTextItem.setRequired(true);
nameTextItem.addChangedHandler(new ChangedHandler() {
public void onChanged(ChangedEvent event) {
wizard.setSubtitle(event.getValue().toString());
@@ -62,9 +63,9 @@ public class BundleInfoStep implements WizardStep {
return form;
}
- public boolean valid() {
+ public boolean nextPage() {
FormItem nameField = form.getField("name");
- return true;
+ return form.validate();
}
public String getName() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
index 6ae2579..0d7daa5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
@@ -38,8 +38,8 @@ public class BundleUploadDataStep implements WizardStep {
return new Label("Todo: implement me");
}
- public boolean valid() {
- return false; // TODO: Implement this method.
+ public boolean nextPage() {
+ return true; // TODO: Implement this method.
}
public String getName() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
index 98b5860..c5ffe6a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
@@ -78,6 +78,7 @@ public class BundleUploadRecipeStep implements WizardStep {
final TextAreaItem recipe = new TextAreaItem("recipe","Recipe");
recipe.setShowTitle(false);
+ recipe.setRequired(true);
recipe.setWidth("*");
recipe.setHeight("*");
@@ -99,8 +100,8 @@ public class BundleUploadRecipeStep implements WizardStep {
return form;
}
- public boolean valid() {
- return false; // TODO: Implement this method.
+ public boolean nextPage() {
+ return form.validate();
}
public String getName() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java
index 02df491..498d7cb 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java
@@ -38,7 +38,7 @@ public class BundleVerificationStep implements WizardStep {
return new Label("Todo: implement me");
}
- public boolean valid() {
+ public boolean nextPage() {
return false; // TODO: Implement this method.
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardStep.java
index c6e3437..06fc1c0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardStep.java
@@ -28,7 +28,7 @@ public interface WizardStep {
Canvas getCanvas();
- boolean valid();
+ boolean nextPage();
String getName();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
index 61dc533..82d46d0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
@@ -131,7 +131,11 @@ public class WizardView extends VLayout {
nextButton = new IButton("Next");
nextButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
- setStep(currentStep + 1);
+
+ WizardStep step = wizard.getSteps().get(currentStep);
+ if (step.nextPage()) {
+ setStep(currentStep + 1);
+ }
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationParametersStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationParametersStep.java
index 27c4fd9..4ddb244 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationParametersStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationParametersStep.java
@@ -56,8 +56,8 @@ public class OperationParametersStep implements WizardStep {
}
}
- public boolean valid() {
- return false; // TODO: Implement this method.
+ public boolean nextPage() {
+ return true; // TODO: Implement this method.
}
public String getName() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java
index b1a4a10..75c8edb 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java
@@ -256,8 +256,8 @@ public class OperationSchedulingStep implements WizardStep {
}
- public boolean valid() {
- return false; // TODO: Implement this method.
+ public boolean nextPage() {
+ return true; // TODO: Implement this method.
}
public String getName() {
commit ffc773a96c6eb8771e5b046d97ba59bce0988bb1
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Wed Mar 10 15:14:18 2010 -0500
New Footer bar that includes a message center
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 e4feffa..34ca0df 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
@@ -36,6 +36,7 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.InventoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceView;
import org.rhq.enterprise.gui.coregui.client.menu.MenuBarView;
import org.rhq.enterprise.gui.coregui.client.util.ErrorHandler;
+import org.rhq.enterprise.gui.coregui.client.util.message.MessageCenter;
import org.rhq.enterprise.gui.coregui.client.util.preferences.UserPreferences;
/**
@@ -55,6 +56,8 @@ public class CoreGUI implements EntryPoint {
private static BreadcrumbTrailPane breadCrumbTrailPane;
+ private static MessageCenter messageCenter;
+
private static Canvas content;
private View rootView;
@@ -76,8 +79,7 @@ public class CoreGUI implements EntryPoint {
GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {
public void onUncaughtException(Throwable e) {
- SC.say("Globally uncaught exception... " + e.getMessage());
- e.printStackTrace();
+ getErrorHandler().handleError("Globally uncaught exception", e);
}
});
@@ -98,6 +100,8 @@ public class CoreGUI implements EntryPoint {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
+ messageCenter = new MessageCenter();
+
SubjectGWTServiceAsync subjectService = SubjectGWTServiceAsync.Util.getInstance();
subjectService.login("rhqadmin", "rhqadmin", new AsyncCallback<Subject>() {
@@ -157,6 +161,8 @@ public class CoreGUI implements EntryPoint {
canvas.setHeight100();
rootCanvas.addMember(canvas);
+ rootCanvas.addMember(new Footer());
+
rootCanvas.draw();
History.addValueChangeHandler(new ValueChangeHandler<String>() {
@@ -265,6 +271,11 @@ public class CoreGUI implements EntryPoint {
// -------------------- Static application utilities ----------------------
+ public static MessageCenter getMessageCenter() {
+ return messageCenter;
+ }
+
+
public static ErrorHandler getErrorHandler() {
return errorHandler;
}
@@ -277,6 +288,8 @@ public class CoreGUI implements EntryPoint {
return userPreferences;
}
+
+
public static void setSessionSubject(Subject subject) {
GWTServiceLookup.registerSession(String.valueOf(subject.getSessionId()));
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java
index e5579cf..56f1528 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java
@@ -18,19 +18,53 @@
*/
package org.rhq.enterprise.gui.coregui.client;
-import com.smartgwt.client.widgets.layout.HLayout;
+import com.smartgwt.client.types.VerticalAlignment;
+import com.smartgwt.client.widgets.Img;
+import com.smartgwt.client.widgets.Label;
+import com.smartgwt.client.widgets.toolbar.ToolStrip;
+import com.smartgwt.client.widgets.toolbar.ToolStripSeparator;
+
+import org.rhq.enterprise.gui.coregui.client.util.message.MessageCenterView;
/**
* @author Greg Hinkle
*/
-public class Footer extends HLayout {
+public class Footer extends ToolStrip {
+
+ MessageCenterView recentMessage;
public Footer() {
super();
+ setHeight(30);
+ setAlign(VerticalAlignment.CENTER);
+// setPadding(5);
+ setWidth100();
+ setMembersMargin(15);
+ }
+
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+ addMember(new Label("Welcome to RHQ"));
+ addMember(new ToolStripSeparator());
+
+ recentMessage = new MessageCenterView();
+ recentMessage.setWidth("*");
- setHeight(100);
- setBackgroundColor("gray");
+ addMember(recentMessage);
+ addMember(new ToolStripSeparator());
+ addMember(new Img("/images/icons/Alert_red_16.png",16,16));
+ addMember(new Label("15 recent alerts"));
}
+
+
+
+
+
+
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java
index 312d10e..097cfd7 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java
@@ -28,6 +28,7 @@ import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.RoleGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.user.client.Window;
@@ -129,6 +130,7 @@ public class RolesDataSource extends RPCDataSource<Role> {
}
public void onSuccess(Role result) {
+ CoreGUI.getMessageCenter().notify(new Message("Role ["+ result.getName() + "] added", Message.Severity.Info));
ListGridRecord record = new ListGridRecord();
response.setData(new Record[] {copyValues(result)});
processResponse(request.getRequestId(),response);
@@ -148,6 +150,7 @@ public class RolesDataSource extends RPCDataSource<Role> {
}
public void onSuccess(Role result) {
+ CoreGUI.getMessageCenter().notify(new Message("Role ["+ result.getName() + "] updated", Message.Severity.Info));
System.out.println("Role Updated");
response.setData(new Record[] {copyValues(result)});
processResponse(request.getRequestId(),response);
@@ -159,7 +162,7 @@ public class RolesDataSource extends RPCDataSource<Role> {
protected void executeRemove(final DSRequest request, final DSResponse response) {
JavaScriptObject data = request.getData();
final ListGridRecord rec = new ListGridRecord(data);
- Role newRole = copyValues(rec);
+ final Role newRole = copyValues(rec);
roleService.removeRoles(new Integer[]{newRole.getId()}, new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
@@ -167,6 +170,7 @@ public class RolesDataSource extends RPCDataSource<Role> {
}
public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(new Message("Role ["+ newRole.getName() + "] removed", Message.Severity.Info));
System.out.println("Role deleted");
response.setData(new Record[]{rec});
processResponse(request.getRequestId(), response);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
index d6b3137..dc36ee6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
@@ -63,7 +63,7 @@ public class RolesView extends VLayout {
table.addTableAction("Remove",
- Table.SelectionEnablement.MULTIPLE,
+ Table.SelectionEnablement.ANY,
"Are you sure you want to delete # roles?",
new TableAction() {
public void executeAction(ListGridRecord[] selection) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
index 9f3e896..1464217 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
@@ -153,7 +153,7 @@ public class UserEditView extends VLayout {
public void editNew() {
form.getDataSource().getField("username").setCanEdit(true);
-
+ subject = new Subject();
ListGridRecord r = dataSource.copyValues(subject);
editRecord(r);
form.setSaveOperationType(DSOperationType.ADD);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java
index b874fe7..11380af 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java
@@ -28,6 +28,7 @@ import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.SubjectGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.JavaScriptObject;
@@ -167,6 +168,7 @@ public class UsersDataSource extends RPCDataSource<Subject> {
}
public void onSuccess(Subject result) {
+ CoreGUI.getMessageCenter().notify(new Message("User added", Message.Severity.Info));
response.setData(new Record[]{copyValues(result)});
processResponse(request.getRequestId(), response);
}
@@ -194,7 +196,7 @@ public class UsersDataSource extends RPCDataSource<Subject> {
}
public void onSuccess(Void nothing) {
- System.out.println("Subject Updated");
+ CoreGUI.getMessageCenter().notify(new Message("User updated and password changed", Message.Severity.Info));
response.setData(new Record[]{copyValues(result)});
processResponse(request.getRequestId(), response);
@@ -202,6 +204,7 @@ public class UsersDataSource extends RPCDataSource<Subject> {
});
} else {
System.out.println("Subject Updated");
+ CoreGUI.getMessageCenter().notify(new Message("User [" + result.getName() + "] updated", Message.Severity.Info));
response.setData(new Record[]{copyValues(result)});
processResponse(request.getRequestId(), response);
}
@@ -213,7 +216,7 @@ public class UsersDataSource extends RPCDataSource<Subject> {
protected void executeRemove(final DSRequest request, final DSResponse response) {
JavaScriptObject data = request.getData();
final ListGridRecord rec = new ListGridRecord(data);
- Subject subjectToDelete = copyValues(rec);
+ final Subject subjectToDelete = copyValues(rec);
subjectService.deleteSubjects(new int[]{subjectToDelete.getId()}, new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
@@ -221,7 +224,7 @@ public class UsersDataSource extends RPCDataSource<Subject> {
}
public void onSuccess(Void result) {
- System.out.println("Subject deleted");
+ CoreGUI.getMessageCenter().notify(new Message("User [" + subjectToDelete.getName() + "] removed", Message.Severity.Info));
response.setData(new Record[]{rec});
processResponse(request.getRequestId(), response);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
index c85edb9..a574eb2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
@@ -70,15 +70,15 @@ public class UsersView extends VLayout {
toolStrip.setMembersMargin(15);
table.addTableAction("Remove",
- Table.SelectionEnablement.MULTIPLE,
- "Are you sure you want to delete # roles?",
+ Table.SelectionEnablement.ANY,
+ "Are you sure you want to delete # users?",
new TableAction() {
public void executeAction(ListGridRecord[] selection) {
table.getListGrid().removeSelectedData();
}
});
- table.addTableAction("Add Role",
+ table.addTableAction("Add User",
new TableAction() {
public void executeAction(ListGridRecord[] selection) {
createUser();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
index a7130ce..7bc3fcb 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
@@ -37,9 +37,11 @@ import org.rhq.core.domain.alert.AlertConditionLog;
import org.rhq.core.domain.criteria.AlertCriteria;
import org.rhq.core.domain.measurement.MeasurementConverterClient;
import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.gwt.AlertGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import java.util.ArrayList;
import java.util.Arrays;
@@ -126,12 +128,13 @@ public class AlertDataSource extends RPCDataSource<Alert> {
this.alertService.deleteResourceAlerts(alertIds, new AsyncCallback<Void>() {
public void onSuccess(Void blah) {
+ CoreGUI.getMessageCenter().notify(new Message("Deleted ["+ alertIds.length + "] alerts", Message.Severity.Info));
System.out.println("Deleted Alerts with id's: " + Arrays.toString(alertIds) + ".");
alertsView.refresh();
}
public void onFailure(Throwable caught) {
- Window.alert("Failed to delete Alerts with id's: " + Arrays.toString(alertIds) + " - cause: " + caught);
+ CoreGUI.getErrorHandler().handleError("Failed to delete Alerts with id's: " + Arrays.toString(alertIds), caught);
System.err.println("Failed to delete Alerts with id's " + Arrays.toString(alertIds) + " - cause: " + caught);
}
});
@@ -254,6 +257,8 @@ public class AlertDataSource extends RPCDataSource<Alert> {
this.alertService.acknowledgeResourceAlerts(alertIds, new AsyncCallback<Void>() {
public void onSuccess(Void blah) {
+ CoreGUI.getMessageCenter().notify(new Message("Acknowledged ["+ alertIds.length + "] alerts", Message.Severity.Info));
+
System.out.println("Acknowledged Alerts with id's: " + Arrays.toString(alertIds) + ".");
alertsView.refresh();
}
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 46c28d2..d11fad9 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
@@ -160,7 +160,10 @@ public class Table extends VLayout {
button.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
if (tableAction.confirmMessage != null) {
- SC.ask(tableAction.confirmMessage, new BooleanCallback() {
+
+ String message = tableAction.confirmMessage.replaceAll("\\#", String.valueOf(listGrid.getSelection().length));
+
+ SC.ask(message, new BooleanCallback() {
public void execute(Boolean confirmed) {
if (confirmed) {
tableAction.action.executeAction(listGrid.getSelection());
@@ -176,6 +179,15 @@ public class Table extends VLayout {
footer.addMember(button);
}
footer.addMember(new LayoutSpacer());
+
+ IButton refreshButton = new IButton("Refresh");
+ refreshButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ listGrid.invalidateCache();
+ }
+ });
+ footer.addMember(refreshButton);
+
footer.addMember(tableInfo);
// Manages enable/disable buttons for the grid
@@ -190,8 +202,6 @@ public class Table extends VLayout {
refreshTableInfo();
fieldSizes.clear();
totalWidth = 0;
-
-
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
index 486c290..a3da094 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
@@ -81,7 +81,7 @@ public class ResourceGroupListView extends VLayout {
table.getListGrid().setFields(idField, nameField, descriptionField, typeNameField, pluginNameField,
categoryField, availabilityField);
- table.addTableAction("Delete Groups", Table.SelectionEnablement.MULTIPLE,
+ table.addTableAction("Delete Groups", Table.SelectionEnablement.ANY,
"Are you sure you want to delete # groups?", new TableAction() {
public void executeAction(ListGridRecord[] selection) {
// TODO: Implement this method.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionDataSource.java
index 2d2ca93..308f5f5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionDataSource.java
@@ -59,10 +59,11 @@ public class GroupDefinitionDataSource extends RPCDataSource<GroupDefinition> {
DataSourceTextField createdTimeField = new DataSourceTextField("createdTime", "Created Time");
DataSourceTextField lastCalculationTimeField = new DataSourceTextField("lastCalculationTime", "Last Calculation Time");
DataSourceTextField nextCalculationTimeField = new DataSourceTextField("nextCalculationTime", "Next Calculation Time");
- DataSourceTextField managedResourceGroupsField = new DataSourceTextField("managedResourceGroups", "Managed Resource Groups");
+// DataSourceTextField managedResourceGroupsField = new DataSourceTextField("managedResourceGroups", "Managed Resource Groups");
- setFields(idDataField, nameField, descriptionField, expressionField, recalculationIntervalField, modifiedTimeField, createdTimeField, lastCalculationTimeField, nextCalculationTimeField, managedResourceGroupsField);
+ setFields(idDataField, nameField, descriptionField, expressionField, recalculationIntervalField,
+ modifiedTimeField, createdTimeField, lastCalculationTimeField, nextCalculationTimeField);
}
@@ -105,7 +106,7 @@ public class GroupDefinitionDataSource extends RPCDataSource<GroupDefinition> {
record.setAttribute("createdTime", from.getCreatedTime());
record.setAttribute("lastCalculationTime", from.getLastCalculationTime());
record.setAttribute("nextCalculationTime", from.getNextCalculationTime());
- record.setAttribute("managedResourceGroups", from.getManagedResourceGroups());
+// record.setAttribute("managedResourceGroups", from.getManagedResourceGroups());
return record;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java
index 91dc3ba..7c0156a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java
@@ -18,6 +18,7 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.groups.definitions;
+import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupsDataSource;
import com.smartgwt.client.types.Alignment;
@@ -47,40 +48,19 @@ import com.smartgwt.client.widgets.toolbar.ToolStrip;
*/
public class GroupDefinitionListView extends VLayout {
- private ListGrid listGrid;
-
public GroupDefinitionListView() {
setWidth100();
setHeight100();
-// DynamicForm searchPanel = new DynamicForm();
-// final TextItem searchBox = new TextItem("query", "Search Resources");
-// searchBox.setValue("");
-// searchPanel.setWrapItemTitles(false);
-// searchPanel.setFields(searchBox);
-//
-//
-// addMember(searchPanel);
-
-
final GroupDefinitionDataSource datasource = new GroupDefinitionDataSource();
- VLayout gridHolder = new VLayout();
-
- listGrid = new ListGrid();
- listGrid.setWidth100();
- listGrid.setHeight100();
- listGrid.setDataSource(datasource);
- listGrid.setAutoFetchData(true);
- listGrid.setAlternateRecordStyles(true);
-// listGrid.setAutoFitData(Autofit.HORIZONTAL);
-// listGrid.setCriteria(new Criteria("name", searchPanel.getValueAsString("query")));
+ Table table = new Table("Group Definitions");
+ table.setDataSource(datasource);
- listGrid.setSelectionType(SelectionStyle.SIMPLE);
- listGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
- listGrid.setResizeFieldsInRealTime(true);
+ table.getListGrid().setSelectionType(SelectionStyle.SIMPLE);
+ table.getListGrid().setSelectionAppearance(SelectionAppearance.CHECKBOX);
ListGridField idField = new ListGridField("id", "Id", 55);
@@ -104,70 +84,10 @@ public class GroupDefinitionListView extends VLayout {
// listGrid.setFields(idField, nameField, descriptionField, typeNameField, pluginNameField, categoryField, availabilityField);
- gridHolder.addMember(listGrid);
-
- ToolStrip toolStrip = new ToolStrip();
- toolStrip.setMembersMargin(15);
-
- final IButton removeButton = new IButton("Remove");
- removeButton.setDisabled(true);
- removeButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- SC.confirm("Are you sure you want to delete " + listGrid.getSelection().length + " resources?",
- new BooleanCallback() {
- public void execute(Boolean aBoolean) {
-
- }
- }
- );
- }
- });
-
-
- final Label tableInfo = new Label("Total: " + listGrid.getTotalRows());
- tableInfo.setWrap(false);
-
- toolStrip.addMember(removeButton);
- toolStrip.addMember(new LayoutSpacer());
- toolStrip.addMember(tableInfo);
-
- gridHolder.addMember(toolStrip);
-
-
- listGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
- public void onSelectionChanged(SelectionEvent selectionEvent) {
- int selectedCount = ((ListGrid)selectionEvent.getSource()).getSelection().length;
- tableInfo.setContents("Total: " + listGrid.getTotalRows() + " (" + selectedCount + " selected)");
- removeButton.setDisabled(selectedCount == 0);
- }
- });
-
-
-
- addMember(gridHolder);
-
-
- listGrid.addDataArrivedHandler(new DataArrivedHandler() {
- public void onDataArrived(DataArrivedEvent dataArrivedEvent) {
- int selectedCount = ((ListGrid)dataArrivedEvent.getSource()).getSelection().length;
- tableInfo.setContents("Total: " + listGrid.getTotalRows() + " (" + selectedCount + " selected)");
- }
- });
+ addMember(table);
- /*
- searchBox.addKeyPressHandler(new KeyPressHandler() {
- public void onKeyPress(KeyPressEvent event) {
- if (event.getCharacterValue() == KeyCodes.KEY_ENTER) {
- datasource.setQuery((String) searchBox.getValue());
- Criteria c = new Criteria("name", (String) searchBox.getValue());
- long start = System.currentTimeMillis();
- listGrid.fetchData(c);
- System.out.println("Loaded in: " + (System.currentTimeMillis() - start));
- }
- }
- });*/
}
}
\ No newline at end of file
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 289960a..9350d64 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
@@ -100,7 +100,7 @@ public class ResourceSearchView extends VLayout {
table.getListGrid().setFields(idField, nameField, descriptionField, typeNameField, pluginNameField,
categoryField, availabilityField);
- table.addTableAction("Uninventory", Table.SelectionEnablement.MULTIPLE,
+ table.addTableAction("Uninventory", Table.SelectionEnablement.ANY,
"Are you sure you want to delete # resources?", new TableAction() {
public void executeAction(ListGridRecord[] selection) {
table.getListGrid().removeSelectedData();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
index 002c1ce..d67cf26 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
@@ -21,6 +21,7 @@ package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.resource.Resource;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import com.smartgwt.client.types.SelectionType;
import com.smartgwt.client.widgets.Canvas;
@@ -39,7 +40,7 @@ import com.smartgwt.client.widgets.layout.HLayout;
public class ResourceTitleBar extends HLayout {
Resource resource;
- ImgButton favoriteButton;
+ Img favoriteButton;
HTMLFlow title;
Img availabilityImage;
@@ -62,32 +63,25 @@ public class ResourceTitleBar extends HLayout {
title = new HTMLFlow();
title.setWidth("*");
- favoriteButton = new ImgButton();
- favoriteButton.setSrc(NOT_FAV_ICON);
- favoriteButton.setShowHover(false);
- favoriteButton.setShowDownIcon(false);
- favoriteButton.setShowRollOverIcon(false);
- favoriteButton.setShowFocusedIcon(false);
+ availabilityImage = new Img("resources/availability_grey_24.png",24,24);
+
- favoriteButton.setActionType(SelectionType.CHECKBOX);
- favoriteButton.setWidth(24);
- favoriteButton.setHeight(24);
+ favoriteButton = new Img(NOT_FAV_ICON,24, 24);
+ favoriteButton.setTooltip("Click to add or remove this resource as a favorite.");
favoriteButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
favorite = !favorite;
-
-// favoriteButton.setIcon(favorite ? FAV_ICON : NOT_FAV_ICON);
-
+ favoriteButton.setSrc(favorite ? FAV_ICON : NOT_FAV_ICON);
+ CoreGUI.getMessageCenter().notify(new Message((favorite ? "Added " : "Removed ") + " resource " + resource.getName() + " as a favorite.", Message.Severity.Info));
}
});
- availabilityImage = new Img("resources/availability_grey_24.png",24,24);
addMember(title);
- addMember(favoriteButton);
addMember(availabilityImage);
+ addMember(favoriteButton);
}
public void setResource(Resource resource) {
@@ -96,6 +90,7 @@ public class ResourceTitleBar extends HLayout {
title.setContents("<h2>" + resource.getName() + "</h2>");
favorite = CoreGUI.getUserPreferences().getFavoriteResources().contains(resource.getId());
+ favoriteButton.setSrc(favorite ? FAV_ICON : NOT_FAV_ICON);
availabilityImage.setSrc("resources/availability_" +
(resource.getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP ? "green" : "red") +
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeView.java
index bd78210..6b385e7 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeView.java
@@ -20,9 +20,12 @@ package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitori
import java.util.EnumSet;
+import com.google.gwt.i18n.client.NumberFormat;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.layout.Layout;
import org.rhq.core.domain.criteria.ResourceCriteria;
@@ -118,10 +121,17 @@ public class CallTimeView extends Layout {
table.setDataSource(new CallTimeDataSource());
table.getListGrid().setUseAllDataSourceFields(true);
+ final NumberFormat format = NumberFormat.getFormat("0");
+
ListGridField callDestination = new ListGridField("callDestination", "Call Destination");
ListGridField count = new ListGridField("count", 70);
ListGridField minimum = new ListGridField("minimum", 70);
ListGridField average = new ListGridField("average", 70);
+ average.setCellFormatter(new CellFormatter() {
+ public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
+ return format.format(((Number)o).doubleValue());
+ }
+ });
ListGridField maximum = new ListGridField("maximum", 70);
ListGridField total = new ListGridField("total",70);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/ErrorHandler.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/ErrorHandler.java
index 5fcee6b..f07ff4f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/ErrorHandler.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/ErrorHandler.java
@@ -23,6 +23,9 @@ import com.smartgwt.client.util.SC;
import java.util.ArrayList;
import java.util.List;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+
/**
* @author Greg Hinkle
*/
@@ -34,8 +37,9 @@ public class ErrorHandler {
public void handleError(String message, Throwable t) {
- // TODO: This is just a placeholder implementation
- SC.say(message);
+// SC.say(message);
+
+ CoreGUI.getMessageCenter().notify(new Message(message, null, Message.Severity.Error));
t.printStackTrace();
errors.add(message);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/Message.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/Message.java
new file mode 100644
index 0000000..410853f
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/Message.java
@@ -0,0 +1,48 @@
+/*
+ * 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.util.message;
+
+import java.util.Date;
+
+/**
+ * @author Greg Hinkle
+ */
+public class Message {
+
+ protected String title;
+ protected String detail;
+ protected Date fired = new Date();
+ protected Severity severity;
+
+ public enum Severity { Info, Warning, Error };
+
+ public Message(String title, Severity severity) {
+ this.title = title;
+ this.severity = severity;
+ }
+
+ public Message(String title, String detail, Severity severity) {
+ this.title = title;
+ this.detail = detail;
+ this.severity = severity;
+ }
+
+
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenter.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenter.java
new file mode 100644
index 0000000..1c4f012
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenter.java
@@ -0,0 +1,51 @@
+/*
+ * 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.util.message;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+
+/**
+ * @author Greg Hinkle
+ */
+public class MessageCenter {
+
+ private LinkedList<Message> messages = new LinkedList<Message>();
+
+ private ArrayList<MessageListener> listeners = new ArrayList<MessageListener>();
+
+ public void notify(Message message) {
+ this.messages.add(message);
+ for (MessageListener listener : listeners) {
+ listener.onMessage(message);
+ }
+ }
+
+ public void addMessageListener(MessageListener listener) {
+ this.listeners.add(listener);
+ }
+
+ public LinkedList<Message> getMessages() {
+ return messages;
+ }
+
+ public interface MessageListener {
+ void onMessage(Message message);
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java
new file mode 100644
index 0000000..b5f5da7
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java
@@ -0,0 +1,122 @@
+/*
+ * 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.util.message;
+
+import java.util.LinkedList;
+
+import com.google.gwt.user.client.Timer;
+import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.types.AnimationEffect;
+import com.smartgwt.client.types.VerticalAlignment;
+import com.smartgwt.client.widgets.AnimationCallback;
+import com.smartgwt.client.widgets.Label;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.layout.HLayout;
+import com.smartgwt.client.widgets.layout.LayoutSpacer;
+import com.smartgwt.client.widgets.menu.IMenuButton;
+import com.smartgwt.client.widgets.menu.Menu;
+import com.smartgwt.client.widgets.menu.MenuItem;
+
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+
+/**
+ * @author Greg Hinkle
+ */
+public class MessageCenterView extends HLayout implements MessageCenter.MessageListener {
+
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+ setAlign(Alignment.LEFT);
+ setAlign(VerticalAlignment.CENTER);
+ CoreGUI.getMessageCenter().addMessageListener(this);
+
+ final Menu recentEventsMenu = new Menu();
+ IMenuButton recentEventsButton = new IMenuButton("Messages",recentEventsMenu);
+ recentEventsButton.setShowMenuBelow(false);
+ recentEventsButton.setAutoFit(true);
+ recentEventsButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ LinkedList<Message> messages = CoreGUI.getMessageCenter().getMessages();
+ if (messages.isEmpty()) {
+ recentEventsMenu.setItems(new MenuItem("No recent messages"));
+ } else {
+ MenuItem[] items = new MenuItem[messages.size()];
+ int i = 0;
+ for (Message message : messages) {
+ items[i++] = new MenuItem(message.title, getSeverityIcon(message.severity));
+ }
+ recentEventsMenu.setItems(items);
+ }
+ }
+ });
+
+ addMember(recentEventsButton);
+
+ addMember(new LayoutSpacer());
+ }
+
+ public void onMessage(Message message) {
+ final Label label = new Label(message.title);
+ label.setMargin(5);
+ label.setAutoFit(true);
+ label.setHeight(25);
+ label.setWrap(false);
+
+ String iconSrc = getSeverityIcon(message.severity);
+
+ label.setIcon(iconSrc);
+
+ label.setTooltip(message.detail);
+
+
+ addMember(label,1);
+ redraw();
+
+ Timer hideTimer = new Timer() {
+ @Override
+ public void run() {
+ label.animateHide(AnimationEffect.FADE, new AnimationCallback() {
+ public void execute(boolean b) {
+ label.destroy();
+ }
+ });
+ }
+ };
+ hideTimer.schedule(10000);
+ }
+
+ private String getSeverityIcon(Message.Severity severity) {
+ String iconSrc = null;
+ switch (severity) {
+ case Info:
+ iconSrc = "info/icn_info_blue.png";
+ break;
+ case Warning:
+ iconSrc = "info/icn_info_orange.png";
+ break;
+ case Error:
+ iconSrc = "info/icn_info_red.png";
+ break;
+ }
+ return iconSrc;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/info/icn_info_blue.png b/modules/enterprise/gui/coregui/src/main/webapp/images/info/icn_info_blue.png
new file mode 100644
index 0000000..ee0e0de
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/info/icn_info_blue.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/info/icn_info_orange.png b/modules/enterprise/gui/coregui/src/main/webapp/images/info/icn_info_orange.png
new file mode 100644
index 0000000..0d77f3e
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/info/icn_info_orange.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/info/icn_info_red.png b/modules/enterprise/gui/coregui/src/main/webapp/images/info/icn_info_red.png
new file mode 100644
index 0000000..ee51d43
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/info/icn_info_red.png differ
commit a516dea2405990bcad0b1816230483f2c7947692
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 10 15:03:47 2010 -0500
add util method that auto-increments a version string
diff --git a/modules/core/util/src/main/java/org/rhq/core/util/NumberUtil.java b/modules/core/util/src/main/java/org/rhq/core/util/NumberUtil.java
index a8fca83..a9f709d 100644
--- a/modules/core/util/src/main/java/org/rhq/core/util/NumberUtil.java
+++ b/modules/core/util/src/main/java/org/rhq/core/util/NumberUtil.java
@@ -1,25 +1,25 @@
- /*
- * RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
package org.rhq.core.util;
import java.text.NumberFormat;
@@ -72,6 +72,27 @@ public final class NumberUtil {
return _format(input, NumberFormat.getPercentInstance());
}
+ /**
+ * Given an old version string, this attempts to auto-generate a new incremented version.
+ *
+ * @param oldVersion the version to increment
+ * @return the auto-incremented version
+ */
+ public static String autoIncrementVersion(String oldVersion) {
+ String newVersion = "1.0";
+ if (oldVersion != null && oldVersion.length() != 0) {
+ String[] parts = oldVersion.split("[^a-zA-Z0-9]");
+ String lastPart = parts[parts.length - 1];
+ try {
+ int lastNumber = Integer.parseInt(lastPart);
+ newVersion = oldVersion.substring(0, oldVersion.length() - lastPart.length()) + (lastNumber + 1);
+ } catch (NumberFormatException nfe) {
+ newVersion = oldVersion + ".1";
+ }
+ }
+ return newVersion;
+ }
+
//------------------------------------------------------------------
//-- private helpers
//------------------------------------------------------------------
diff --git a/modules/core/util/src/test/java/org/rhq/core/util/NumberUtilTest.java b/modules/core/util/src/test/java/org/rhq/core/util/NumberUtilTest.java
new file mode 100644
index 0000000..cc1536b
--- /dev/null
+++ b/modules/core/util/src/test/java/org/rhq/core/util/NumberUtilTest.java
@@ -0,0 +1,44 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2009 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.core.util;
+
+import org.testng.annotations.Test;
+
+@Test
+public class NumberUtilTest {
+ public void testAutoIncrementVersion() {
+ assertAutoIncrementVersion("1", "2");
+ assertAutoIncrementVersion("9", "10");
+ assertAutoIncrementVersion("1.0", "1.1");
+ assertAutoIncrementVersion("2.0", "2.1");
+ assertAutoIncrementVersion("2.5", "2.6");
+ assertAutoIncrementVersion("2.5.0", "2.5.1");
+ assertAutoIncrementVersion("1.0-1", "1.0-2");
+ assertAutoIncrementVersion("1.5-29", "1.5-30");
+ assertAutoIncrementVersion("3.5.GA_49", "3.5.GA_50");
+ assertAutoIncrementVersion("My Wiki 9 v 1.2.3", "My Wiki 9 v 1.2.4");
+ }
+
+ private void assertAutoIncrementVersion(String old, String expectedNew) {
+ String actualNew = NumberUtil.autoIncrementVersion(old);
+ assert expectedNew.equals(actualNew) : "Incrementing [" + old + "] was not [" + expectedNew
+ + "] but instead was [" + actualNew + "]";
+ }
+}
commit 0b654827ab8d43fd528792b29723a60f8c81ef55
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 10 12:03:30 2010 -0500
add SLSB method that lets you create a bundle and bundle version at the same time
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
index be5a070..d689f48 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
@@ -202,6 +202,27 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
}
@RequiredPermission(Permission.MANAGE_INVENTORY)
+ public BundleVersion createBundleAndBundleVersion(Subject subject, String bundleName, int bundleTypeId,
+ String name, String bundleVersion, String recipe) throws Exception {
+
+ // first see if the bundle exists or not; if not, create one
+ BundleCriteria criteria = new BundleCriteria();
+ criteria.addFilterBundleTypeId(Integer.valueOf(bundleTypeId));
+ criteria.addFilterName(bundleName);
+ PageList<Bundle> bundles = findBundlesByCriteria(subject, criteria);
+ Bundle bundle;
+ if (bundles.getTotalSize() == 0) {
+ bundle = createBundle(subject, bundleName, bundleTypeId);
+ } else {
+ bundle = bundles.get(0);
+ }
+
+ // now create the bundle version with the bundle we either found or created
+ BundleVersion bv = createBundleVersion(subject, bundle.getId(), name, bundleVersion, recipe);
+ return bv;
+ }
+
+ @RequiredPermission(Permission.MANAGE_INVENTORY)
public BundleVersion createBundleVersion(Subject subject, int bundleId, String name, String version, String recipe)
throws Exception {
if (null == name || "".equals(name.trim())) {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java
index 5b5f89e..c001222 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java
@@ -145,7 +145,7 @@ public interface BundleManagerRemote {
/**
* @param subject must be InventoryManager
* @param bundleId the bundle for which this will be the next version
- * @param name not null or empty
+ * @param name name of the bundle version
* @param bundleVersion optional. If not supplied set to 1.0 for first version, or incremented (as best as possible) for subsequent version
* @return the persisted BundleVersion (id is assigned)
*/
@@ -157,6 +157,26 @@ public interface BundleManagerRemote {
@WebParam(name = "recipe") String recipe) throws Exception;
/**
+ * Convienence method that combines {@link #createBundle(Subject, String, int)} and {@link #createBundleVersion(Subject, int, String, String, String)}.
+ * This will first check to see if a bundle with the given type/name exists - if it doesn't, it will be created. If it does, it will be reused.
+ * This will then create the bundle version that will be associated with the bundle that was created or found.
+ *
+ * @param subject must be InventoryManager
+ * @param bundleName name of the bundle to use (if not found, it will be created)
+ * @param bundleTypeId the bundle type for the new bundle (if it is created) for which this will be the first version
+ * @param name name of the bundle version
+ * @param bundleVersion optional. If not supplied set to 1.0 for first version, or incremented (as best as possible) for subsequent version
+ * @return the persisted BundleVersion (id is assigned)
+ */
+ BundleVersion createBundleAndBundleVersion( //
+ @WebParam(name = "subject") Subject subject, //
+ @WebParam(name = "bundleName") String bundleName, //
+ @WebParam(name = "bundleTypeId") int bundleTypeId, //
+ @WebParam(name = "name") String name, //
+ @WebParam(name = "bundleVersion") String bundleVersion, //
+ @WebParam(name = "recipe") String recipe) throws Exception;
+
+ /**
* Remove everything associated with the Bundle with the exception of files laid down by related deployments.
* Deployed files are left as is on the deployment platforms but the bundle mechanism will no longer track
* the deployment.
commit c2d6b70567d6f1790f367174139771d5402442aa
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Wed Mar 10 10:32:02 2010 -0500
comment out gflot repository, since it has been down for a couple days now, and the gflot jar has been added to the JBoss repo
diff --git a/modules/enterprise/gui/coregui/pom.xml b/modules/enterprise/gui/coregui/pom.xml
index 6b847a1..a1e7cc2 100644
--- a/modules/enterprise/gui/coregui/pom.xml
+++ b/modules/enterprise/gui/coregui/pom.xml
@@ -398,7 +398,7 @@
<repository>
<id>smartgwt</id>
<name>SmartGWT</name>
- <url>http://www.smartclient.com/maven2</url>
+ <url>http://www.smartclient.com/maven2/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
@@ -413,10 +413,13 @@
</snapshots>
</repository>
+ <!--
<repository>
- <id>gflot-repository</id>
+ <id>gflot</id>
+ <name>GFlot</name>
<url>http://codemonkey.dumontierlab.com/maven/repo/</url>
</repository>
+ -->
</repositories>
</project>
commit 6f44ba688c4a37d149c417691f44fe0ed43d3c6d
Merge: 3d68f60... 3a68679...
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Wed Mar 10 10:27:34 2010 -0500
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
commit 3a68679ace8a263ebd655bd5c876a22c5206be92
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 10 10:03:05 2010 -0500
fix some dsl processing stuff and add tests
diff --git a/modules/enterprise/remoting/scripts/src/test/resources/dummy.zip b/modules/enterprise/remoting/scripts/src/test/resources/dummy.zip
new file mode 100644
index 0000000..933fa1a
Binary files /dev/null and b/modules/enterprise/remoting/scripts/src/test/resources/dummy.zip differ
diff --git a/modules/enterprise/remoting/scripts/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManager.js b/modules/enterprise/remoting/scripts/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManager.js
index 0edf73e..e97495b 100644
--- a/modules/enterprise/remoting/scripts/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManager.js
+++ b/modules/enterprise/remoting/scripts/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManager.js
@@ -67,15 +67,15 @@ function testDeployment() {
// create the config, setting the required properties from the recipe
var config = new Configuration();
- var property = new PropertySimple("bundleTest.deployHome", "C:/temp");
+ var property = new PropertySimple("bundleTest.deployHome", "/tmp/bundle-test");
config.put( property );
// create a deploy def using the above config
- var testDeployDef = BundleManager.createBundleDeployDefinition(testBundleVersion.getId(), "Windows Deployment", "Windows Deployment of testBundle WAR", config, false, -1, false);
+ var testDeployDef = BundleManager.createBundleDeployDefinition(testBundleVersion.getId(), "Deployment Test", "Deployment Test of testBundle WAR", config, false, -1, false);
// Find a target platform
var rc = new ResourceCriteria();
- rc.addFilterResourceTypeName("win");
+ rc.addFilterResourceTypeName("in"); // wINdows, lINux
var winPlatforms = ResourceManager.findResourcesByCriteria(rc);
var platformId = winPlatforms.get(0).getId();
diff --git a/modules/enterprise/remoting/scripts/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManagerZip.js b/modules/enterprise/remoting/scripts/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManagerZip.js
new file mode 100644
index 0000000..4cc0bd1
--- /dev/null
+++ b/modules/enterprise/remoting/scripts/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManagerZip.js
@@ -0,0 +1,101 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/**
+ * Thus test script works with a real env including at least one platform resource and a running agent on
+ * said platform.
+ */
+
+var TestsEnabled = true;
+
+var bundleName = 'testScriptBundleZip';
+
+// note, super-user, will not test any security constraints
+var subject = rhq.login('rhqadmin', 'rhqadmin');
+
+executeAllTests();
+
+rhq.logout();
+
+function testDeployment() {
+ if ( !TestsEnabled ) {
+ return;
+ }
+
+ // delete the test bundle if it exists
+ var bc = new BundleCriteria();
+ bc.addFilterName( bundleName );
+ var bundles = BundleManager.findBundlesByCriteria( bc );
+ if ( null != bundles && bundles.size() > 0 ) {
+ print( "\n Deleting existing testScriptBundle in order to test a fresh deploy...")
+ BundleManager.deleteBundle( bundles.get(0).getId() );
+ }
+
+ // create the test bundle
+ var testBundle = BundleManager.createBundle( bundleName, getBundleType() );
+
+ // define the recipe for bundleVersion 1.0
+ var recipe = "deploy -f dummy.zip -d <%dummy.deployHome%>\n"
+ + "realize -f <%dummy.deployHome%>/dummy/README.txt\n"
+ + "realize -f <%dummy.deployHome%>/dummy/subdirectory/file.txt";
+
+ // create bundleVersion 1.0
+ var testBundleVersion = BundleManager.createBundleVersion( testBundle.getId(), bundleName, null, recipe);
+
+ // add the single bundleFile, the test war file
+ var fileBytes = scriptUtil.getFileBytes("./src/test/resources/dummy.zip");
+ var bundleFile = BundleManager.addBundleFileViaByteArray(testBundleVersion.getId(), "dummy.zip",
+ "1.0", null, fileBytes, false);
+
+ // create the config, setting the required properties from the recipe
+ var config = new Configuration();
+ var property = new PropertySimple("dummy.deployHome", "/tmp/bundle-test");
+ config.put( property );
+ var property2 = new PropertySimple("dummy.name", "NAME REPLACED HERE!!!");
+ config.put( property2 );
+ var property3 = new PropertySimple("dummy.description", "FLOPPY!!!");
+ config.put( property3 );
+
+ // create a deploy def using the above config
+ var testDeployDef = BundleManager.createBundleDeployDefinition(testBundleVersion.getId(), "Deployment Test", "Deployment Test of dummy ZIP", config, false, -1, false);
+
+ // Find a target platform
+ var rc = new ResourceCriteria();
+ rc.addFilterResourceTypeName("in"); // wINdows, lINux
+ var winPlatforms = ResourceManager.findResourcesByCriteria(rc);
+ var platformId = winPlatforms.get(0).getId();
+
+ var bundleScheduleResponse = BundleManager.scheduleBundleDeployment(testDeployDef.getId(), platformId);
+}
+
+function getBundleType() {
+
+ var types = BundleManager.getAllBundleTypes();
+ for (i=0; ( i < types.size()); ++i ) {
+ if ( types.get(i).getName().equals( "File Template Bundle" )) {
+ return types.get(i).getId();
+ }
+ }
+
+ print( "\n Could not find template bundle type, is the plugin loaded?");
+}
diff --git a/modules/plugins/filetemplate-bundle/src/main/java/org/rhq/plugins/filetemplate/ProcessingRecipeContext.java b/modules/plugins/filetemplate-bundle/src/main/java/org/rhq/plugins/filetemplate/ProcessingRecipeContext.java
index f4cb102..d20526c 100644
--- a/modules/plugins/filetemplate-bundle/src/main/java/org/rhq/plugins/filetemplate/ProcessingRecipeContext.java
+++ b/modules/plugins/filetemplate-bundle/src/main/java/org/rhq/plugins/filetemplate/ProcessingRecipeContext.java
@@ -103,7 +103,7 @@ public class ProcessingRecipeContext extends RecipeContext {
public void addRealizedFile(String file) {
super.addRealizedFile(file);
- File trueFile = new File(this.baseWorkingDirectory, file);
+ File trueFile = new File(file);
RecipeParser parser = getParser();
File realizedTmpFile = null;
FileWriter realizedTmpFileWriter = null;
@@ -252,6 +252,7 @@ public class ProcessingRecipeContext extends RecipeContext {
} else if (filepath.endsWith(".zip")) {
exe = "unzip";
args = new ArrayList<String>();
+ args.add("-o");
args.add(filepath);
args.add("-d");
args.add(directory);
diff --git a/modules/plugins/filetemplate-bundle/src/test/java/org/rhq/plugins/filetemplate/ProcessingRecipeContextTest.java b/modules/plugins/filetemplate-bundle/src/test/java/org/rhq/plugins/filetemplate/ProcessingRecipeContextTest.java
index 188e127..ff65c2f 100644
--- a/modules/plugins/filetemplate-bundle/src/test/java/org/rhq/plugins/filetemplate/ProcessingRecipeContextTest.java
+++ b/modules/plugins/filetemplate-bundle/src/test/java/org/rhq/plugins/filetemplate/ProcessingRecipeContextTest.java
@@ -63,7 +63,7 @@ public class ProcessingRecipeContextTest {
File testDir = getTestDir("testrealize");
File file = writeFile("a b c\nhello<% var %>world\na b c\n", testDir, "config.txt");
- addRecipeCommand("realize --file=" + file.getName());
+ addRecipeCommand("realize --file=" + file.getPath());
ProcessingRecipeContext context = createRecipeContext(testDir);
context.addReplacementVariableValue("var", "BOO");
@@ -71,7 +71,7 @@ public class ProcessingRecipeContextTest {
Set<String> files = context.getRealizedFiles();
assert files.size() == 1 : files;
- assert files.contains(file.getName()) : files;
+ assert files.contains(file.getPath()) : files;
String realizedContent = readFile(file);
assert realizedContent.equals("a b c\nhelloBOOworld\na b c\n") : realizedContent;
commit d80fa3fa85c6ed646b0665f2e08f81bc9e51d2a3
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Wed Mar 10 09:58:31 2010 -0500
CallTime data display for a resource
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/MeasurementDataGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/MeasurementDataGWTService.java
index 04df2bb..5a9ae94 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/MeasurementDataGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/MeasurementDataGWTService.java
@@ -22,7 +22,10 @@ import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.measurement.DisplayType;
import org.rhq.core.domain.measurement.MeasurementData;
import org.rhq.core.domain.measurement.MeasurementDataTrait;
+import org.rhq.core.domain.measurement.calltime.CallTimeDataComposite;
import org.rhq.core.domain.measurement.composite.MeasurementDataNumericHighLowComposite;
+import org.rhq.core.domain.util.PageControl;
+import org.rhq.core.domain.util.PageList;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
@@ -45,4 +48,5 @@ public interface MeasurementDataGWTService extends RemoteService {
int[] definitionIds, long beginTime, long endTime, int numPoints);
+ PageList<CallTimeDataComposite> findCallTimeDataForResource(int scheduleId, long start, long end, PageControl pageControl);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index 2cf07c2..53d6a4b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -37,6 +37,7 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectLi
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.alert.ResourceAlertHistoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration.ConfigurationHistoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.GraphListView;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.calltime.CallTimeView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.OperationHistoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
@@ -103,7 +104,7 @@ public class ResourceDetailView extends VLayout implements ViewRenderer, Resourc
summaryTab.registerSubTabs("Overview", "Timeline");
monitoringTab = new TwoLevelTab("Monitoring", "/images/icons/Monitor_grey_16.png");
- monitoringTab.registerSubTabs("Graphs", "Tables", "Traits", "Availability", "Schedules");
+ monitoringTab.registerSubTabs("Graphs", "Tables", "Traits", "Availability", "Schedules", "Call Time");
inventoryTab = new TwoLevelTab("Inventory", "/images/icons/Inventory_grey_16.png");
inventoryTab.registerSubTabs("Children", "Connection Settings");
@@ -158,6 +159,8 @@ public class ResourceDetailView extends VLayout implements ViewRenderer, Resourc
monitoringTab.updateSubTab("Traits", new FullHTMLPane("/rhq/resource/monitor/traits.xhtml?id=" + resource.getId()));
monitoringTab.updateSubTab("Availability", new FullHTMLPane("/rhq/resource/monitor/availabilityHistory.xhtml?id=" + resource.getId()));
monitoringTab.updateSubTab("Schedules", new FullHTMLPane("/rhq/resource/monitor/schedules.xhtml?id=" + resource.getId()));
+ monitoringTab.updateSubTab("Call Time", new CallTimeView(resource));
+
inventoryTab.updateSubTab("Children", ResourceSearchView.getChildrenOf(resource.getId()));
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeDataSource.java
new file mode 100644
index 0000000..5efbcca
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeDataSource.java
@@ -0,0 +1,130 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.calltime;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.data.fields.DataSourceIntegerField;
+import com.smartgwt.client.data.fields.DataSourceTextField;
+import com.smartgwt.client.widgets.HTMLFlow;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+import org.rhq.core.domain.measurement.calltime.CallTimeDataComposite;
+import org.rhq.core.domain.util.PageControl;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+
+/**
+ * @author Greg Hinkle
+ */
+public class CallTimeDataSource extends RPCDataSource<CallTimeDataComposite> {
+
+ private double maxMaximum;
+
+ public CallTimeDataSource() {
+
+ DataSourceTextField callDestination = new DataSourceTextField("callDestination", "Call Destination");
+ addField(callDestination);
+ DataSourceIntegerField count = new DataSourceIntegerField("count");
+ addField(count);
+ DataSourceIntegerField minimum = new DataSourceIntegerField("minimum");
+ addField(minimum);
+ DataSourceIntegerField average = new DataSourceIntegerField("average");
+ addField(average);
+ DataSourceIntegerField maximum = new DataSourceIntegerField("maximum");
+ addField(maximum);
+ DataSourceIntegerField total = new DataSourceIntegerField("total");
+ addField(total);
+
+ }
+
+ @Override
+ protected void executeFetch(final DSRequest request, final DSResponse response) {
+
+ int scheduleId = Integer.parseInt((String) request.getCriteria().getValues().get("scheduleId"));
+ long now = System.currentTimeMillis();
+ long eightHoursAgo = now - (1000L * 60 * 60 * 8);
+
+ PageControl pc = getPageControl(request);
+
+ GWTServiceLookup.getMeasurementDataService().findCallTimeDataForResource(
+ scheduleId, eightHoursAgo, now, pc, new AsyncCallback<PageList<CallTimeDataComposite>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Could not load call time data", caught);
+ }
+
+ public void onSuccess(PageList<CallTimeDataComposite> result) {
+ ListGridRecord[] data = buildRecords(result);
+ setGraphs(data);
+ response.setData(data);
+
+ processResponse(request.getRequestId(), response);
+ }
+ }
+ );
+ }
+
+ @Override
+ public CallTimeDataComposite copyValues(ListGridRecord from) {
+ throw new UnsupportedOperationException("Calltime not editable");
+ }
+
+ public void setGraphs(ListGridRecord[] records) {
+ for (ListGridRecord record : records) {
+ if (record.getAttributeAsInt("maximum") > maxMaximum)
+ maxMaximum = record.getAttributeAsInt("maximum");
+ }
+
+ for (ListGridRecord record : records) {
+
+ int minWidth = (int) ((record.getAttributeAsInt("minimum") / maxMaximum) * 100d);
+ int avgWidth = (int) ((record.getAttributeAsInt("average") / maxMaximum) * 100d);
+ int maxWidth = (int) ((record.getAttributeAsInt("maximum") / maxMaximum) * 100d);
+
+
+
+ record.setBackgroundComponent(
+ new HTMLFlow(
+ "<div style=\"width: " + minWidth + "%; height: 33%; background-color: #A5B391;\"> </div>" +
+ "<div style=\"width: " + avgWidth + "%; height: 33%; background-color: #A5B391;\"> </div>" +
+ "<div style=\"width: " + maxWidth + "%; height: 33%; background-color: #A5B391;\"> </div>"));
+
+ }
+
+ }
+
+ @Override
+ public ListGridRecord copyValues(CallTimeDataComposite from) {
+ ListGridRecord record = new ListGridRecord();
+
+ record.setAttribute("callDestination", from.getCallDestination());
+
+ record.setAttribute("count", from.getCount());
+ record.setAttribute("minimum", from.getMinimum());
+ record.setAttribute("average", from.getAverage());
+ record.setAttribute("maximum", from.getMaximum());
+ record.setAttribute("total", from.getTotal());
+
+
+ return record;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeView.java
new file mode 100644
index 0000000..bd78210
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeView.java
@@ -0,0 +1,135 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.calltime;
+
+import java.util.EnumSet;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.layout.Layout;
+
+import org.rhq.core.domain.criteria.ResourceCriteria;
+import org.rhq.core.domain.measurement.DataType;
+import org.rhq.core.domain.measurement.MeasurementDefinition;
+import org.rhq.core.domain.measurement.MeasurementSchedule;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+
+/**
+ * @author Greg Hinkle
+ */
+public class CallTimeView extends Layout {
+
+ private Resource resource;
+ private int scheduleId;
+
+ public CallTimeView(Resource resource) {
+ this.resource = resource;
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(
+ resource.getResourceType().getId(),
+ EnumSet.of(ResourceTypeRepository.MetadataType.measurements),
+ new ResourceTypeRepository.TypeLoadedCallback() {
+ public void onTypesLoaded(ResourceType type) {
+
+ for (final MeasurementDefinition def : type.getMetricDefinitions()) {
+ if (def.getDataType() == DataType.CALLTIME) {
+
+ ResourceCriteria criteria = new ResourceCriteria();
+ criteria.addFilterId(resource.getId());
+ criteria.fetchSchedules(true);
+
+ GWTServiceLookup.getResourceService().findResourcesByCriteria(criteria,
+ new AsyncCallback<PageList<Resource>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load resource for call time",caught);
+ }
+
+ public void onSuccess(PageList<Resource> result) {
+ if (result.size() == 1) {
+
+ Resource res = result.get(0);
+ for (MeasurementSchedule s : res.getSchedules()) {
+
+ if (s.getDefinition().getId() == def.getId()) {
+
+ scheduleId = s.getId();
+
+ setup();
+ }
+
+
+ }
+
+
+ }
+
+
+
+ }
+ }
+ );
+ break;
+
+
+ }
+
+
+ }
+
+
+ }
+ });
+
+ }
+
+
+ public void setup() {
+
+ Table table = new Table("Call Time Data", new Criteria("scheduleId", String.valueOf(scheduleId)));
+ table.getListGrid().setAlternateRecordStyles(false);
+ table.setDataSource(new CallTimeDataSource());
+ table.getListGrid().setUseAllDataSourceFields(true);
+
+ ListGridField callDestination = new ListGridField("callDestination", "Call Destination");
+ ListGridField count = new ListGridField("count", 70);
+ ListGridField minimum = new ListGridField("minimum", 70);
+ ListGridField average = new ListGridField("average", 70);
+ ListGridField maximum = new ListGridField("maximum", 70);
+ ListGridField total = new ListGridField("total",70);
+
+ table.getListGrid().setFields(callDestination,count, minimum, average, maximum, total);
+
+ addMember(table);
+ markForRedraw();
+ }
+
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/MeasurementDataGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/MeasurementDataGWTServiceImpl.java
index 8ef7f0a..d57f5ac 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/MeasurementDataGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/MeasurementDataGWTServiceImpl.java
@@ -22,9 +22,13 @@ import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.measurement.DisplayType;
import org.rhq.core.domain.measurement.MeasurementData;
import org.rhq.core.domain.measurement.MeasurementDataTrait;
+import org.rhq.core.domain.measurement.calltime.CallTimeDataComposite;
import org.rhq.core.domain.measurement.composite.MeasurementDataNumericHighLowComposite;
+import org.rhq.core.domain.util.PageControl;
+import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.gwt.MeasurementDataGWTService;
import org.rhq.enterprise.gui.coregui.server.util.SerialUtility;
+import org.rhq.enterprise.server.measurement.CallTimeDataManagerLocal;
import org.rhq.enterprise.server.measurement.MeasurementDataManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
@@ -37,6 +41,7 @@ import java.util.Set;
public class MeasurementDataGWTServiceImpl extends AbstractGWTServiceImpl implements MeasurementDataGWTService {
private MeasurementDataManagerLocal dataManager = LookupUtil.getMeasurementDataManager();
+ private CallTimeDataManagerLocal callTimeDataManager = LookupUtil.getCallTimeDataManager();
public List<MeasurementDataTrait> findCurrentTraitsForResource(int resourceId, DisplayType displayType) {
return SerialUtility.prepare(
@@ -58,4 +63,10 @@ public class MeasurementDataGWTServiceImpl extends AbstractGWTServiceImpl implem
getSessionSubject(), resourceId, definitionIds, beginTime, endTime, numPoints),
"MeasurementDataService.findDataForResource");
}
+
+ public PageList<CallTimeDataComposite> findCallTimeDataForResource(int scheduleId, long start, long end, PageControl pageControl) {
+ return SerialUtility.prepare(
+ callTimeDataManager.findCallTimeDataForResource(getSessionSubject(), scheduleId, start, end, pageControl),
+ "MeasurementDataService.findCallTimeDataForResource");
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
index b523e3d..b320630 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
@@ -80,7 +80,7 @@ public class ResourceGWTServiceImpl extends AbstractGWTServiceImpl implements Re
// "installedPackages \n" +
// "installedPackageHistory \n" +
// "resourceRepos \n" +
-// "schedules \n" +
+ "schedules",
// "availability \n" +
"currentAvailability"
// "resourceErrors \n" +
commit 3d68f606b17c99e9425032d7ae27f26449e8eeba
Merge: 9d788c9... 00a36c0...
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Wed Mar 10 07:42:48 2010 -0500
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
commit 00a36c08e0b75f5e7880a1d06b521b5db6e1f573
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Mar 10 12:27:16 2010 +0100
Implement acknowledgement of alerts.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
index 09ccd6a..a7130ce 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
@@ -102,6 +102,14 @@ public class AlertDataSource extends RPCDataSource<Alert> {
DataSourceTextField ctimeField = new DataSourceTextField(AlertCriteria.SORT_FIELD_CTIME, "Creation Time");
fields.add(ctimeField);
+ DataSourceTextField ackTimeField = new DataSourceTextField("ack_time", "Ack time");
+ ackTimeField.setCanSortClientOnly(true);
+ fields.add(ackTimeField);
+
+ DataSourceTextField ackByField = new DataSourceTextField("ack_by", "Ack by");
+ ackByField.setCanSortClientOnly(true);
+ fields.add(ackByField);
+
return fields;
}
@@ -119,7 +127,7 @@ public class AlertDataSource extends RPCDataSource<Alert> {
this.alertService.deleteResourceAlerts(alertIds, new AsyncCallback<Void>() {
public void onSuccess(Void blah) {
System.out.println("Deleted Alerts with id's: " + Arrays.toString(alertIds) + ".");
- alertsView.refresh();
+ alertsView.refresh();
}
public void onFailure(Throwable caught) {
@@ -191,6 +199,14 @@ public class AlertDataSource extends RPCDataSource<Alert> {
record.setAttribute("name", from.getAlertDefinition().getName());
record.setAttribute("priority", from.getAlertDefinition().getPriority().name());
record.setAttribute("ctime", DATE_TIME_FORMAT.format(new Date(from.getCtime())));
+ if (from.getAckTime() >0)
+ record.setAttribute("ack_time",DATE_TIME_FORMAT.format(new Date(from.getAckTime())));
+ else
+ record.setAttribute("ack_time","");
+ if (from.getAckBy()!=null)
+ record.setAttribute("ack_by",from.getAckBy().getName());
+ else
+ record.setAttribute("ack_by","");
Set<AlertConditionLog> conditionLogs = from.getConditionLogs();
String conditionText;
@@ -224,4 +240,28 @@ public class AlertDataSource extends RPCDataSource<Alert> {
ListGridRecord record = new ListGridRecord(data);
Window.alert(String.valueOf(record.getAttributeAsInt("id")));
}
+
+ public void acknowledgeAlerts(final AlertsView alertsView) {
+ ListGrid listGrid = alertsView.getListGrid();
+ ListGridRecord[] records = listGrid.getSelection();
+
+ final Integer[] alertIds = new Integer[records.length];
+ for (int i = 0, selectionLength = records.length; i < selectionLength; i++) {
+ ListGridRecord record = records[i];
+ Integer alertId = record.getAttributeAsInt("id");
+ alertIds[i] = alertId;
+ }
+
+ this.alertService.acknowledgeResourceAlerts(alertIds, new AsyncCallback<Void>() {
+ public void onSuccess(Void blah) {
+ System.out.println("Acknowledged Alerts with id's: " + Arrays.toString(alertIds) + ".");
+ alertsView.refresh();
+ }
+
+ public void onFailure(Throwable caught) {
+ Window.alert("Failed to acknowledge Alerts with id's: " + Arrays.toString(alertIds) + " - cause: " + caught);
+ System.err.println("Failed to acknowledge Alerts with id's " + Arrays.toString(alertIds) + " - cause: " + caught);
+ }
+ });
+ }
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
index 881b7f9..17d6416 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
@@ -84,6 +84,11 @@ public class AlertsView extends VLayout {
AlertsView.this.dataSource.deleteAlerts(AlertsView.this);
}
});
+ this.table.addTableAction("Acknowledge", Table.SelectionEnablement.ANY, null, new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ AlertsView.this.dataSource.acknowledgeAlerts(AlertsView.this);
+ }
+ });
listGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
public void onSelectionChanged(SelectionEvent event) {
@@ -108,7 +113,7 @@ public class AlertsView extends VLayout {
// Add the details panel as the bottom half of the view.
HLayout detailsPane = new HLayout();
detailsPane.setWidth100();
- detailsPane.setHeight("50%");
+ detailsPane.setHeight("50%");
this.detailsContent = new HTMLFlow("Select a single alert above to display its details here.");
this.detailsContent.setWidth100();
detailsPane.addMember(this.detailsContent);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/AlertGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/AlertGWTService.java
index be970b9..eb35f9a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/AlertGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/AlertGWTService.java
@@ -27,6 +27,7 @@ import org.rhq.core.domain.util.PageList;
/**
* @author Ian Springer
+ * @author Heiko W. Rupp
*/
public interface AlertGWTService extends RemoteService {
/**
@@ -47,4 +48,11 @@ public interface AlertGWTService extends RemoteService {
* @param alertIds the id's of the Resource alerts to be deleted
*/
void deleteResourceAlerts(Integer[] alertIds);
+
+ /**
+ * Acknowledge the Resource alerts with the specified ids if the current uer has permission to do so.
+ *
+ * @param alertIds the ids of the Resource alerts to be acknowledged
+ */
+ void acknowledgeResourceAlerts(Integer[] alertIds);
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AlertGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AlertGWTServiceImpl.java
index 685543e..0f694c3 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AlertGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AlertGWTServiceImpl.java
@@ -40,4 +40,8 @@ public class AlertGWTServiceImpl extends AbstractGWTServiceImpl implements Alert
public void deleteResourceAlerts(Integer[] alertIds) {
this.alertManager.deleteResourceAlerts(getSessionSubject(), alertIds);
}
+
+ public void acknowledgeResourceAlerts(Integer[] alertIds) {
+ this.alertManager.acknowledgeAlerts(getSessionSubject(), alertIds);
+ }
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/ListAlertHistoryUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/ListAlertHistoryUIBean.java
index 3cce217..b1717ce 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/ListAlertHistoryUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/ListAlertHistoryUIBean.java
@@ -179,7 +179,7 @@ public class ListAlertHistoryUIBean extends PagedDataTableUIBean {
Integer[] alertIds = StringUtility.getIntegerArray(selectedAlerts);
try {
- int num = alertManager.acknowledgeAlerts(subject,resource.getId(),alertIds);
+ int num = alertManager.acknowledgeAlerts(subject, alertIds);
if (num==-1)
FacesContextUtility.addMessage(FacesMessage.SEVERITY_WARN,"No Alerts passed to ack");
else
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/subsystem/SubsystemAlertHistoryUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/subsystem/SubsystemAlertHistoryUIBean.java
index 12e28b3..c2e5001 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/subsystem/SubsystemAlertHistoryUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/subsystem/SubsystemAlertHistoryUIBean.java
@@ -67,12 +67,12 @@ public class SubsystemAlertHistoryUIBean extends SubsystemView {
private SelectItem[] categoryFilterItems;
private static final IntExtractor<AlertHistoryComposite> RESOURCE_ID_EXTRACTOR = new IntExtractor<AlertHistoryComposite>() {
-
+
public int extract(AlertHistoryComposite object) {
return object.getAlert().getAlertDefinition().getResource().getId();
}
};
-
+
public SubsystemAlertHistoryUIBean() {
datePattern = EnterpriseFacesContextUtility.getWebUser().getWebPreferences().getDateTimeDisplayPreferences()
.getDateTimeFormatTrigger();
@@ -163,7 +163,7 @@ public class SubsystemAlertHistoryUIBean extends SubsystemView {
try {
Integer[] selectedItems = getSelectedItems();
- int num = alertManager.acknowledgeAlerts(subject,resource.getId(), selectedItems);
+ int num = alertManager.acknowledgeAlerts(subject, selectedItems);
if (num==-1)
FacesContextUtility.addMessage(FacesMessage.SEVERITY_WARN,"No Alerts passed to ack");
else
@@ -243,7 +243,7 @@ public class SubsystemAlertHistoryUIBean extends SubsystemView {
protected IntExtractor<AlertHistoryComposite> getResourceIdExtractor() {
return RESOURCE_ID_EXTRACTOR;
}
-
+
private void getDataFromRequest() {
SubsystemAlertHistoryUIBean outer = SubsystemAlertHistoryUIBean.this;
outer.resourceFilter = FacesContextUtility.getOptionalRequestParameter(FORM_PREFIX + "resourceFilter");
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
index b76527f..8aae6d6 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
@@ -177,7 +177,7 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
for (Resource resource : resources) {
if (!authorizationManager.hasResourcePermission(user, Permission.MANAGE_ALERTS, resource.getId())) {
forbiddenResources.add(resource);
- }
+ }
}
if (!forbiddenResources.isEmpty()) {
throw new PermissionException("User [" + user.getName() + "] does not have permissions to delete alerts "
@@ -586,14 +586,12 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
* Acknowledge the alerts (that got fired) so that admins know who is working
* on fixing the situation.
* @param user calling user
- * @param resourceId resource the alerts happened on
* @param alertIds PKs of the alerts to ack
* @return number of alerts acknowledged
*/
- public int acknowledgeAlerts(Subject user, int resourceId, Integer[] alertIds) {
- if (!authorizationManager.hasResourcePermission(user, Permission.MANAGE_ALERTS, resourceId)) {
- throw new PermissionException("User [" + user.getName() + "] does not have permissions to acknowledge alerts "
- + "for resourceId=" + resourceId);
+ public int acknowledgeAlerts(Subject user, Integer[] alertIds) {
+ if (!authorizationManager.hasGlobalPermission(user, Permission.MANAGE_ALERTS)) {
+ throw new PermissionException("User [" + user.getName() + "] does not have permissions to acknowledge alerts ");
}
int i=0;
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerLocal.java
index ba05f34..45deaf4 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerLocal.java
@@ -133,11 +133,10 @@ public interface AlertManagerLocal {
* Acknowledge the alerts (that got fired) so that admins know who is working
* on fixing the situation.
* @param user calling user
- * @param resourceId resource the alerts happened on
* @param alertIds PKs of the alerts to ack
* @return number of alerts acknowledged
*/
- int acknowledgeAlerts(Subject user, int resourceId, Integer[] alertIds);
+ int acknowledgeAlerts(Subject user, Integer[] alertIds);
/**
* Remove the alerts with the specified id's.
commit e867f8989084e9066b5ec78ae2b3e2ba71ee56b6
Merge: 44b8c66... 0773645...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Mar 9 23:04:40 2010 -0500
Merge branch 'bundle' into gwt
Conflicts:
modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/scripts/units.js
modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/ext/japanese-eras.js
modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/cs/labellers.js
modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/cs/timeline.js
modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/se/labellers.js
modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/units.js
commit 44b8c6607b70699989a65cb4c958f544d472ba93
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Mar 9 23:01:18 2010 -0500
Get rid of unnecessary calls to Canvas.draw when we really mean to request a "redraw" with markForRedraw()
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 b0d73be..e4feffa 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
@@ -296,7 +296,7 @@ public class CoreGUI implements EntryPoint {
content = newContent;
contentCanvas.addChild(newContent);
}
- contentCanvas.draw();
+ contentCanvas.markForRedraw();
}
public static void goTo(String path) {
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 c1c321e..bf580ed 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
@@ -342,8 +342,7 @@ public class AdministrationView extends HLayout implements ViewRenderer {
contentCanvas.getChildren()[0].destroy();
contentCanvas.addChild(newContent);
- contentCanvas.draw();
-
+ contentCanvas.markForRedraw();
}
public View renderView(ViewId viewId, boolean lastNode) throws UnknownViewException {
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 d553b6d..b2a7f14 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
@@ -177,6 +177,6 @@ public class InventoryView extends HLayout {
newContent.setWidth100();
newContent.setHeight100();
contentCanvas.addChild(newContent);
- contentCanvas.draw();
+ contentCanvas.markForRedraw();
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
index 9bc16c0..7adabb8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
@@ -131,7 +131,7 @@ public class ResourceView extends HLayout implements ViewRenderer {
if (contentCanvas.getChildren().length > 0)
contentCanvas.getChildren()[0].destroy();
contentCanvas.addChild(newContent);
- contentCanvas.draw();
+ contentCanvas.markForRedraw();
}
public View renderView(ViewId viewId, boolean lastNode) throws UnknownViewException {
commit 28acda7dedd989793a0df4c5f3c5cd4722eb6bdb
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Mar 9 22:34:03 2010 -0500
File upload infrastructure including file upload completion listening
diff --git a/modules/enterprise/gui/coregui/pom.xml b/modules/enterprise/gui/coregui/pom.xml
index b0f49c3..6b847a1 100644
--- a/modules/enterprise/gui/coregui/pom.xml
+++ b/modules/enterprise/gui/coregui/pom.xml
@@ -85,6 +85,30 @@
</dependency>
+
+
+ <!-- for file uploads -->
+ <dependency>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ <version>1.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.3.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.0.4</version>
+ <scope>provided</scope> <!-- by JBossAS -->
+ </dependency>
+
+
+
<!-- Internal Deps -->
<dependency>
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
index ad288af..b430471 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
@@ -23,6 +23,17 @@
<when-type-assignable class="org.rhq.core.domain.util.Recordizable"/>
</generate-with>-->
+
+ <replace-with class="at.bestsolution.gwt.util.impl.DynamicCallbackFormImpl">
+ <when-type-is class="at.bestsolution.gwt.util.impl.DynamicCallbackFormImpl"/>
+ </replace-with>
+
+ <replace-with class="at.bestsolution.gwt.util.impl.DynamicCallbackFormImplIE6">
+ <when-type-is class="at.bestsolution.gwt.util.impl.DynamicCallbackFormImpl"/>
+ <when-property-is name="user.agent" value="ie6"/>
+ </replace-with>
+
+
<!-- limit builds to your preferred browser -->
<!-- Safari -->
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
index 497aebd..98b5860 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
@@ -19,13 +19,17 @@
package org.rhq.enterprise.gui.coregui.client.bundle.create;
import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.form.DynamicForm;
-import com.smartgwt.client.widgets.form.FormItemIfFunction;
-import com.smartgwt.client.widgets.form.fields.FormItem;
-import com.smartgwt.client.widgets.form.fields.RadioGroupItem;
+import com.smartgwt.client.widgets.form.fields.CanvasItem;
+import com.smartgwt.client.widgets.form.fields.HiddenItem;
+import com.smartgwt.client.widgets.form.fields.LinkItem;
import com.smartgwt.client.widgets.form.fields.TextAreaItem;
-import com.smartgwt.client.widgets.form.fields.TextItem;
+import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
+import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
+import org.rhq.enterprise.gui.coregui.client.components.upload.DynamicCallbackForm;
+import org.rhq.enterprise.gui.coregui.client.components.upload.DynamicFormHandler;
+import org.rhq.enterprise.gui.coregui.client.components.upload.DynamicFormSubmitCompleteEvent;
+import org.rhq.enterprise.gui.coregui.client.components.upload.TextFileRetrieverForm;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
/**
@@ -33,65 +37,74 @@ import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
*/
public class BundleUploadRecipeStep implements WizardStep {
- private DynamicForm form;
+ private DynamicCallbackForm form;
private final BundleCreationWizard wizard;
public BundleUploadRecipeStep(BundleCreationWizard bundleCreationWizard) {
this.wizard = bundleCreationWizard;
}
-
public Canvas getCanvas() {
+
if (form == null) {
- form = new DynamicForm();
+
+
+ form = new DynamicCallbackForm("test");
form.setWidth100();
- form.setNumCols(2);
- form.setColWidths("50%", "*");
-
- final String uploadRecipeString = "Upload Recipe";
- final String writeRecipeString = "Write Recipe";
-
- final RadioGroupItem radioGroupItem = new RadioGroupItem("reciperadio");
- radioGroupItem.setTitle("");
- radioGroupItem.setValueMap(uploadRecipeString, writeRecipeString);
- radioGroupItem.setRedrawOnChange(true);
-
- final TextItem recipeFileUploadItem = new TextItem("recipefile", "Recipe File");
- recipeFileUploadItem.setVisible(false);
- recipeFileUploadItem.setShowIfCondition(new FormItemIfFunction() {
- public boolean execute(FormItem item, Object value, DynamicForm form) {
- String radioSelect = form.getValueAsString("reciperadio");
- if (radioSelect != null) {
- return radioSelect.equals(uploadRecipeString);
- } else {
- return false;
- }
+ form.setNumCols(1);
+// form.setColWidths("25%","75%");
+ HiddenItem idField = new HiddenItem("id");
+ idField.setValue(1);
+
+
+ final LinkItem showUpload = new LinkItem("showUpload");
+ showUpload.setValue("Upload a file");
+ showUpload.setShowTitle(false);
+
+
+ final CanvasItem upload = new CanvasItem("upload");
+ upload.setShowTitle(false);
+ TextFileRetrieverForm textFileRetrieverForm = new TextFileRetrieverForm();
+ upload.setCanvas(textFileRetrieverForm);
+
+
+
+ showUpload.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ form.hideItem("showUpload");
+ form.showItem("upload");
}
});
- final TextAreaItem recipeTextAreaItem = new TextAreaItem("recipetext", "Recipe Text");
- recipeTextAreaItem.setVisible(false);
- recipeTextAreaItem.setShowIfCondition(new FormItemIfFunction() {
- public boolean execute(FormItem item, Object value, DynamicForm form) {
- String radioSelect = form.getValueAsString("reciperadio");
- if (radioSelect != null) {
- return radioSelect.equals(writeRecipeString);
- } else {
- return false;
- }
+
+ final TextAreaItem recipe = new TextAreaItem("recipe","Recipe");
+ recipe.setShowTitle(false);
+
+ recipe.setWidth("*");
+ recipe.setHeight("*");
+
+
+ textFileRetrieverForm.addFormHandler(new DynamicFormHandler() {
+ public void onSubmitComplete(DynamicFormSubmitCompleteEvent event) {
+ recipe.setValue(event.getResults());
+ form.showItem("showUpload");
+ form.hideItem("upload");
}
});
- form.setItems(radioGroupItem, recipeFileUploadItem, recipeTextAreaItem);
+ form.setItems(idField,showUpload,upload, recipe);
+
+ form.hideItem("upload");
+
}
return form;
}
public boolean valid() {
- return false; // TODO: Implement this method.
+ return false; // TODO: Implement this method.
}
public String getName() {
return "Setup Bundle Recipe Information";
}
-}
\ No newline at end of file
+}
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 3e81000..46c28d2 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
@@ -18,10 +18,10 @@
*/
package org.rhq.enterprise.gui.coregui.client.components.table;
-import com.smartgwt.client.data.SortSpecifier;
-import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+import java.util.ArrayList;
import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.data.SortSpecifier;
import com.smartgwt.client.types.Autofit;
import com.smartgwt.client.util.BooleanCallback;
import com.smartgwt.client.util.SC;
@@ -31,15 +31,18 @@ import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.events.DataArrivedEvent;
import com.smartgwt.client.widgets.grid.events.DataArrivedHandler;
+import com.smartgwt.client.widgets.grid.events.FieldStateChangedEvent;
+import com.smartgwt.client.widgets.grid.events.FieldStateChangedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionEvent;
import com.smartgwt.client.widgets.layout.LayoutSpacer;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.toolbar.ToolStrip;
-import java.util.ArrayList;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
/**
* @author Greg Hinkle
@@ -58,15 +61,25 @@ public class Table extends VLayout {
* Specifies how many rows must be selected in order for a {@link TableAction} button to be enabled.
*/
public enum SelectionEnablement {
- /** Enabled no matter how many rows are selected (zero or more) */
+ /**
+ * Enabled no matter how many rows are selected (zero or more)
+ */
ALWAYS,
- /** One or more rows are selected. */
+ /**
+ * One or more rows are selected.
+ */
ANY,
- /** Exactly one row is selected. */
+ /**
+ * Exactly one row is selected.
+ */
SINGLE,
- /** Two or more rows are selected. */
+ /**
+ * Two or more rows are selected.
+ */
MULTIPLE
- };
+ }
+
+ ;
private ArrayList<TableActionInfo> tableActions = new ArrayList<TableActionInfo>();
@@ -109,6 +122,7 @@ public class Table extends VLayout {
listGrid.setAutoFetchData(true);
listGrid.setAutoFitData(Autofit.HORIZONTAL);
listGrid.setAlternateRecordStyles(true);
+ listGrid.setResizeFieldsInRealTime(false);
// Footer
footer = new ToolStrip();
@@ -174,10 +188,74 @@ public class Table extends VLayout {
listGrid.addDataArrivedHandler(new DataArrivedHandler() {
public void onDataArrived(DataArrivedEvent dataArrivedEvent) {
refreshTableInfo();
+ fieldSizes.clear();
+ totalWidth = 0;
+
+
}
});
+
+
+ // TODO GH: This doesn't yet work as desired to force the fields to fit to the table when you resize one of them.
+ if (false) { // If Force Fit
+ listGrid.addDataArrivedHandler(new DataArrivedHandler() {
+ public void onDataArrived(DataArrivedEvent dataArrivedEvent) {
+ for (ListGridField f : listGrid.getFields()) {
+
+ int size = listGrid.getFieldWidth(f.getName());
+ fieldSizes.add(size);
+ totalWidth += size;
+ }
+ }
+ });
+
+ listGrid.addFieldStateChangedHandler(new FieldStateChangedHandler() {
+ public void onFieldStateChanged(FieldStateChangedEvent fieldStateChangedEvent) {
+
+ if (autoSizing) {
+ return;
+ }
+ autoSizing = true;
+
+ ArrayList<Integer> newSizes = new ArrayList<Integer>();
+ int total = 0;
+ int resizeCol = 0;
+ int i = 0;
+ for (ListGridField f : listGrid.getFields()) {
+ int size = listGrid.getFieldWidth(f.getName());
+ newSizes.add(size);
+ total += size;
+ if (fieldSizes.get(i) != size) {
+ resizeCol = i;
+ }
+ i++;
+ System.out.println("Field " + f.getName() + " width: " + listGrid.getFieldWidth(f.getName()));
+ }
+
+ int diff = totalWidth - total;
+ int fieldsLeft = listGrid.getFields().length - resizeCol - 1;
+
+ if (fieldsLeft > 0) {
+ int perFieldSizeDiff = diff / fieldsLeft;
+ for (int j = resizeCol + 1; j < listGrid.getFields().length; j++) {
+ listGrid.resizeField(j, fieldSizes.get(j) + perFieldSizeDiff);
+ }
+ }
+
+ fieldSizes = newSizes;
+ markForRedraw();
+
+ autoSizing = false;
+ }
+ });
+ }
}
+ private int totalWidth;
+ private ArrayList<Integer> fieldSizes = new ArrayList<Integer>();
+ private boolean autoSizing = false;
+
+
public void refresh(Criteria criteria) {
this.listGrid.setCriteria(criteria);
this.listGrid.markForRedraw();
@@ -217,13 +295,22 @@ public class Table extends VLayout {
for (TableActionInfo tableAction : tableActions) {
boolean enabled;
switch (tableAction.enablement) {
- case ALWAYS: enabled = true; break;
- case ANY: enabled = (count >= 1); break;
- case SINGLE: enabled = (count == 1); break;
- case MULTIPLE: enabled = (count > 1); break;
- default: throw new IllegalStateException("Unhandled SelectionEnablement: " + tableAction.enablement.name());
+ case ALWAYS:
+ enabled = true;
+ break;
+ case ANY:
+ enabled = (count >= 1);
+ break;
+ case SINGLE:
+ enabled = (count == 1);
+ break;
+ case MULTIPLE:
+ enabled = (count > 1);
+ break;
+ default:
+ throw new IllegalStateException("Unhandled SelectionEnablement: " + tableAction.enablement.name());
}
- tableAction.actionButton.setDisabled(!enabled);
+ tableAction.actionButton.setDisabled(!enabled);
}
this.tableInfo.setContents("Total: " + listGrid.getTotalRows() + " (" + count + " selected)");
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackForm.java
new file mode 100644
index 0000000..bad2a86
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackForm.java
@@ -0,0 +1,136 @@
+package org.rhq.enterprise.gui.coregui.client.components.upload;
+
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.core.client.GWT.UncaughtExceptionHandler;
+import com.google.gwt.dom.client.Document;
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.user.client.Command;
+import com.google.gwt.user.client.DeferredCommand;
+import com.smartgwt.client.widgets.form.DynamicForm;
+
+public class DynamicCallbackForm extends DynamicForm implements DynamicCallbackFormImplHost {
+
+ private String frameName;
+ private Element synthesizedFrame;
+ private DynamicCallbackFormHandlerCollection formHandlers;
+ private static DynamicCallbackFormImpl impl = GWT
+ .create(DynamicCallbackFormImpl.class);
+
+ public DynamicCallbackForm(String frameName) {
+ super();
+ System.err.println("Hello World");
+ this.frameName = frameName;
+ setTarget(frameName);
+ init();
+ }
+
+ @Override
+ protected void onAttach() {
+ super.onAttach();
+ System.err.println("ATTACH");
+ }
+
+ private void init() {
+ if (frameName != null) {
+ // Create and attach a hidden iframe to the body element.
+ createFrame();
+ Document.get().getBody().appendChild(synthesizedFrame);
+ //
+ // Hook up the underlying iframe's onLoad event when attached to the
+ // DOM.
+ // Making this connection only when attached avoids memory-leak
+ // issues.
+ // The FormPanel cannot use the built-in GWT event-handling
+ // mechanism
+ // because there is no standard onLoad event on iframes that works
+ // across
+ // browsers.
+ impl.hookEvents(synthesizedFrame, this);
+ }
+ }
+
+ private void createFrame() {
+ // Attach a hidden IFrame to the form. This is the target iframe to
+ // which
+ // the form will be submitted. We have to create the iframe using
+ // innerHTML,
+ // because setting an iframe's 'name' property dynamically doesn't work
+ // on
+ // most browsers.
+ Element dummy = Document.get().createDivElement();
+ dummy.setInnerHTML("<iframe src=\"javascript:''\" name='" + frameName
+ + "' style='position:absolute;width:0;height:0;border:0'>");
+
+ synthesizedFrame = dummy.getFirstChildElement();
+ }
+
+ @Override
+ public void submitForm() {
+ impl.submit(getAction(), synthesizedFrame);
+ super.submitForm();
+ }
+
+ public void onFrameLoad() {
+ UncaughtExceptionHandler handler = GWT.getUncaughtExceptionHandler();
+ if (handler != null) {
+ onFrameLoadAndCatch(handler);
+ } else {
+ onFrameLoadImpl();
+ }
+ // Window.alert("Submission ready!");
+ }
+
+ private void onFrameLoadAndCatch(UncaughtExceptionHandler handler) {
+ try {
+ onFrameLoadImpl();
+ } catch (Throwable e) {
+ handler.onUncaughtException(e);
+ }
+ }
+
+ private void onFrameLoadImpl() {
+ if (formHandlers != null) {
+ // Fire onComplete events in a deferred command. This is necessary
+ // because clients that detach the form panel when submission is
+ // complete can cause some browsers (i.e. Mozilla) to go into an
+ // 'infinite loading' state. See issue 916.
+ DeferredCommand.addCommand(new Command() {
+ public void execute() {
+ formHandlers.fireOnComplete(DynamicCallbackForm.this, impl
+ .getContents(synthesizedFrame));
+ }
+ });
+ }
+ }
+
+ @Override
+ public void destroy() {
+ System.err.println("Destroy");
+ if (synthesizedFrame != null) {
+ // Unhook the iframe's onLoad when detached.
+ impl.unhookEvents(synthesizedFrame);
+
+ // And remove it from the document.
+ Document.get().getBody().removeChild(synthesizedFrame);
+ synthesizedFrame = null;
+ }
+
+ super.destroy();
+ }
+
+ public void addFormHandler(DynamicFormHandler handler) {
+ if (formHandlers == null) {
+ formHandlers = new DynamicCallbackFormHandlerCollection();
+ }
+ formHandlers.add(handler);
+ }
+
+ public void removeFormHandler(DynamicFormHandler handler) {
+ if (formHandlers != null) {
+ formHandlers.remove(handler);
+ }
+ }
+
+}
+
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackFormHandlerCollection.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackFormHandlerCollection.java
new file mode 100644
index 0000000..13cb47f
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackFormHandlerCollection.java
@@ -0,0 +1,34 @@
+
+package org.rhq.enterprise.gui.coregui.client.components.upload;
+
+import java.util.ArrayList;
+
+import com.google.gwt.user.client.ui.FormSubmitCompleteEvent;
+
+/**
+ * Helper class for widgets that accept
+ * {@link com.google.gwt.user.client.ui.FormHandler FormHandlers}. This subclass
+ * of ArrayList assumes that all items added to it will be of type
+ * {@link com.google.gwt.user.client.ui.FormHandler}.
+ */
+@SuppressWarnings("serial")
+public class DynamicCallbackFormHandlerCollection extends ArrayList<DynamicFormHandler> {
+
+ /**
+ * Fires a {@link DynamicFormHandler#onSubmitComplete(DynamicFormSubmitCompleteEvent)}
+ * on all handlers in the collection.
+ *
+ * @param sender
+ * the object sending the event
+ * @param results
+ * the results of the form submission
+ */
+ public void fireOnComplete(DynamicCallbackForm sender, String results) {
+ DynamicFormSubmitCompleteEvent event = new DynamicFormSubmitCompleteEvent(sender, results);
+
+ for (DynamicFormHandler handler : this) {
+ handler.onSubmitComplete(event);
+ }
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackFormImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackFormImpl.java
new file mode 100644
index 0000000..084d2c7
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackFormImpl.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2008 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.rhq.enterprise.gui.coregui.client.components.upload;
+
+import com.google.gwt.dom.client.Element;
+
+/**
+ * Implementation class used by {@link com.google.gwt.user.client.ui.FormPanel}.
+ */
+public class DynamicCallbackFormImpl {
+
+ /**
+ * Gets the response html from the loaded iframe.
+ *
+ * @param iframe the iframe from which the response html is to be extracted
+ * @return the response html
+ */
+ public native String getContents(Element iframe) /*-{
+ try {
+ // Make sure the iframe's window & document are loaded.
+ if (!iframe.contentWindow || !iframe.contentWindow.document)
+ return null;
+
+ // Get the body's entire inner HTML.
+ return iframe.contentWindow.document.body.innerHTML;
+ } catch (e) {
+ return null;
+ }
+ }-*/;
+
+ /**
+ * Gets the form element's encoding.
+ *
+ * @param form the form whose encoding is to be retrieved
+ * @return the form's encoding type
+ */
+ public native String getEncoding(Element form) /*-{
+ // We can always get 'enctype', no matter which browser, because we set
+ // both 'encoding' and 'enctype' in setEncoding().
+ return form.enctype;
+ }-*/;
+
+ /**
+ * Hooks the iframe's onLoad event and the form's onSubmit event.
+ *
+ * @param iframe the iframe whose onLoad event is to be hooked
+ * @param form the form whose onSubmit event is to be hooked
+ * @param listener the listener to receive notification
+ */
+ public native void hookEvents(Element iframe,
+ DynamicCallbackFormImplHost listener) /*-{
+ if (iframe) {
+ iframe.onload = function() {
+ // If there is no __formAction yet, this is a spurious onload
+ // generated when the iframe is first added to the DOM.
+ if (!iframe.__formAction)
+ return;
+
+ listener.@org.rhq.enterprise.gui.coregui.client.components.upload.DynamicCallbackFormImplHost::onFrameLoad()();
+ };
+ }
+
+ }-*/;
+
+ /**
+ * Submits a form.
+ *
+ * @param form the form to be submitted
+ * @param iframe the iframe that is targetted, or <code>null</code>
+ */
+ public native void submit(String action, Element iframe) /*-{
+ // Hang on to the form's action url, needed in the
+ // onload/onreadystatechange handler.
+ if (iframe)
+ iframe.__formAction = action;
+ }-*/;
+
+ /**
+ * Unhooks the iframe's onLoad event.
+ *
+ * @param iframe the iframe whose onLoad event is to be unhooked
+ * @param form the form whose onSubmit event is to be unhooked
+ */
+ public native void unhookEvents(Element iframe) /*-{
+ if (iframe)
+ iframe.onload = null;
+ }-*/;
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackFormImplHost.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackFormImplHost.java
new file mode 100644
index 0000000..3957ae8
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackFormImplHost.java
@@ -0,0 +1,23 @@
+/*
+ * 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.upload;
+
+public interface DynamicCallbackFormImplHost {
+ void onFrameLoad();
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackFormImplIE6.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackFormImplIE6.java
new file mode 100644
index 0000000..c8d8a03
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackFormImplIE6.java
@@ -0,0 +1,49 @@
+/*
+ * 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.upload;
+
+import com.google.gwt.dom.client.Element;
+
+public class DynamicCallbackFormImplIE6 extends DynamicCallbackFormImpl {
+ @Override
+ public native void hookEvents(Element iframe,
+ DynamicCallbackFormImplHost listener) /*-{
+ if (iframe) {
+ iframe.onreadystatechange = function() {
+ // If there is no __formAction yet, this is a spurious onreadystatechange
+ // generated when the iframe is first added to the DOM.
+ if (!iframe.__formAction)
+ return;
+
+ if (iframe.readyState == 'complete') {
+ // If the iframe's contentWindow has not navigated to the expected action
+ // url, then it must be an error, so we ignore it.
+ listener.@org.rhq.enterprise.gui.coregui.client.components.upload.DynamicCallbackFormImplHost::onFrameLoad()();
+ }
+ };
+ }
+ }-*/;
+
+ @Override
+ public native void unhookEvents(Element iframe) /*-{
+ if (iframe)
+ iframe.onreadystatechange = null;
+ form.onsubmit = null;
+ }-*/;
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicFormHandler.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicFormHandler.java
new file mode 100644
index 0000000..101acb4
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicFormHandler.java
@@ -0,0 +1,33 @@
+/*
+ * 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.upload;
+
+import java.util.EventListener;
+
+
+public interface DynamicFormHandler extends EventListener {
+ /**
+ * Fired when a form has been submitted successfully.
+ *
+ * @param event an event object containing information about the form
+ * submission
+ */
+ void onSubmitComplete(DynamicFormSubmitCompleteEvent event);
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicFormSubmitCompleteEvent.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicFormSubmitCompleteEvent.java
new file mode 100644
index 0000000..8bcc507
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicFormSubmitCompleteEvent.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2008 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.rhq.enterprise.gui.coregui.client.components.upload;
+
+
+import java.util.EventObject;
+
+/**
+ * Event object containing information about form submission events.
+ */
+@SuppressWarnings("serial")
+public class DynamicFormSubmitCompleteEvent extends EventObject {
+
+ private String resultHtml;
+
+ /**
+ * Creates a new event with information about the source and submit results.
+ *
+ * @param source
+ * the object sending the event
+ * @param resultHtml
+ * the result html returned by the server
+ */
+ public DynamicFormSubmitCompleteEvent(DynamicCallbackForm source,
+ String resultHtml) {
+ super(source);
+ this.resultHtml = resultHtml;
+ }
+
+ /**
+ * Gets the result text of the form submission.
+ *
+ * @return the result html, or <code>null</code> if there was an error
+ * reading it
+ * @tip The result html can be <code>null</code> as a result of submitting a
+ * form to a different domain.
+ */
+ public String getResults() {
+ return resultHtml;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/TextFileRetrieverForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/TextFileRetrieverForm.java
new file mode 100644
index 0000000..444ed48
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/TextFileRetrieverForm.java
@@ -0,0 +1,82 @@
+/*
+ * 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.upload;
+
+import com.google.gwt.core.client.GWT;
+import com.smartgwt.client.types.Encoding;
+import com.smartgwt.client.widgets.form.fields.ButtonItem;
+import com.smartgwt.client.widgets.form.fields.FormItemIcon;
+import com.smartgwt.client.widgets.form.fields.HiddenItem;
+import com.smartgwt.client.widgets.form.fields.UploadItem;
+import com.smartgwt.client.widgets.form.fields.events.ChangeEvent;
+import com.smartgwt.client.widgets.form.fields.events.ChangeHandler;
+import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
+import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
+
+/**
+ * @author Greg Hinkle
+ */
+public class TextFileRetrieverForm extends DynamicCallbackForm {
+
+ public TextFileRetrieverForm() {
+ super("textFileRetriever");
+ setNumCols(8);
+ setEncoding(Encoding.MULTIPART);
+ setAction(GWT.getModuleBaseURL() + "/FileUploadServlet");
+
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+ HiddenItem retrieveField = new HiddenItem("retrieve");
+ retrieveField.setValue(true);
+
+ final UploadItem textFile = new UploadItem("textFile", "Upload File");
+ textFile.setEndRow(false);
+
+ final ButtonItem uploadButton = new ButtonItem("Upload");
+ uploadButton.setDisabled(true);
+
+ textFile.addChangeHandler(new ChangeHandler() {
+ public void onChange(ChangeEvent changeEvent) {
+ uploadButton.setDisabled(false);
+ }
+ });
+
+ uploadButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ uploadButton.setShowIcons(true);
+ markForRedraw();
+ submitForm();
+ }
+ });
+
+ FormItemIcon loadingIcon = new FormItemIcon();
+ loadingIcon.setSrc("ajax-loader.gif");
+ loadingIcon.setWidth(16);
+ loadingIcon.setHeight(16);
+ uploadButton.setIcons(loadingIcon);
+ uploadButton.setShowIcons(false);
+
+ setItems(retrieveField, textFile, uploadButton);
+
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/FileUploadServlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/FileUploadServlet.java
new file mode 100644
index 0000000..4d3585c
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/FileUploadServlet.java
@@ -0,0 +1,106 @@
+/*
+ * 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.server.gwt;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.FileUploadException;
+import org.apache.commons.fileupload.disk.DiskFileItemFactory;
+import org.apache.commons.fileupload.servlet.ServletFileUpload;
+
+/**
+ * @author Heiko W. Rupp
+ */
+public class FileUploadServlet extends HttpServlet {
+
+// private final Log log = LogFactory.getLog(MigrationServlet.class);
+
+ @Override
+ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+
+ PrintWriter writer;
+ if (ServletFileUpload.isMultipartContent(req)) {
+
+ ServletFileUpload servletFileUpload = new ServletFileUpload(new DiskFileItemFactory());
+ List<FileItem> fileItemsList = null;
+ try {
+ fileItemsList = (List<FileItem>) servletFileUpload.parseRequest(req);
+ } catch (FileUploadException e) {
+
+ writer = resp.getWriter();
+ writer.write("<strong>File upload failed: </strong><br/>");
+ for (StackTraceElement elem : e.getStackTrace())
+ writer.write(elem.toString() + "br/>");
+ writer.flush();
+ return;
+ }
+
+ List<FileItem> files = new ArrayList<FileItem>();
+ boolean retrieve = false;
+
+ for (FileItem fileItem : fileItemsList) {
+ if (fileItem.isFormField()) {
+ if ("retrieve".equals(fileItem.getFieldName())) {
+ retrieve = true;
+ }
+ /* The file item contains a simple name-value pair of a form field */
+ // TODO flag as error ?
+ } else {
+ /* The file item contains an uploaded file */
+
+ files.add(fileItem);
+
+ System.out.println("Got the file: " + fileItem);
+
+
+ }
+ }
+
+
+ if (retrieve && files.size() == 1) {
+ writer = resp.getWriter();
+
+ // TODO
+// InputStream s = files.get(0).getInputStream();
+// IOUtils.copy(s,writer);
+ writer.write("<html>");
+ writer.write(new String(files.get(0).get()));
+ writer.write("</html>");
+ writer.flush();
+
+ } else {
+ writer = resp.getWriter();
+ writer.write("<strong>File received</strong><p/>");
+ writer.flush();
+
+ }
+
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml b/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
index 7edb4ee..efe75c7 100644
--- a/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
+++ b/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
@@ -49,6 +49,12 @@
<servlet-class>org.rhq.enterprise.gui.coregui.server.gwt.BundleGWTServiceImpl</servlet-class>
</servlet>
+
+ <servlet>
+ <servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI FileUploadServlet</servlet-name>
+ <servlet-class>org.rhq.enterprise.gui.coregui.server.gwt.FileUploadServlet</servlet-class>
+ </servlet>
+
<servlet-mapping>
<servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI RoleGWTService</servlet-name>
<url-pattern>/org.rhq.enterprise.gui.coregui.CoreGUI/RoleGWTService</url-pattern>
@@ -89,4 +95,11 @@
<servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI BundleGWTService</servlet-name>
<url-pattern>/org.rhq.enterprise.gui.coregui.CoreGUI/BundleGWTService</url-pattern>
</servlet-mapping>
+
+
+
+ <servlet-mapping>
+ <servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI FileUploadServlet</servlet-name>
+ <url-pattern>/org.rhq.enterprise.gui.coregui.CoreGUI/FileUploadServlet</url-pattern>
+ </servlet-mapping>
</web-app>
commit 385acd6a00a9558f7f1e3c6f967fc267bf290455
Author: Joseph Marques <joseph(a)redhat.com>
Date: Tue Mar 9 19:20:11 2010 -0500
fix PersistenceUtility import for hibernate.jsp
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/admin/test/hibernate.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/admin/test/hibernate.jsp
index 7dc7c2e..c151a34 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/admin/test/hibernate.jsp
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/admin/test/hibernate.jsp
@@ -7,7 +7,7 @@
<%@ page import="org.hibernate.type.IntegerType" %>
<%@ page import="org.hibernate.type.LongType" %>
<%@ page import="org.hibernate.type.Type" %>
-<%@ page import="org.rhq.core.domain.util.PersistenceUtility" %>
+<%@ page import="org.rhq.core.server.PersistenceUtility" %>
<%@ page import="org.rhq.enterprise.gui.legacy.util.SessionUtils" %>
<%@ page import="org.rhq.enterprise.server.util.LookupUtil" %>
<%@ page import="javax.naming.InitialContext" %>
commit ee044819eb3a5cfb916d6c2ead7b2f1c70c79cba
Author: Joseph Marques <joseph(a)redhat.com>
Date: Tue Mar 9 19:19:47 2010 -0500
fix inventory browser
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupCriteria.java
index ae99f2b..6f831ce 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupCriteria.java
@@ -41,6 +41,7 @@ public class ResourceGroupCriteria extends Criteria {
private static final long serialVersionUID = 1L;
private Integer filterId;
+ private Integer filterDownMemberCount; // required overrides
private String filterName;
private Boolean filterRecursive;
private Integer filterResourceTypeId; // requires overrides
@@ -63,6 +64,13 @@ public class ResourceGroupCriteria extends Criteria {
public ResourceGroupCriteria() {
filterOverrides.put("resourceTypeId", "resourceType.id = ?");
+ filterOverrides.put("downMemberCount", "" //
+ + "id IN ( SELECT implicitGroup.id " //
+ + " FROM Resource res " //
+ + " JOIN res.implicitGroups implicitGroup " //
+ + " WHERE res.currentAvailability.availabilityType = 0 " //
+ + " GROUP BY implicitGroup.id " //
+ + " HAVING COUNT(res) >= ? )");
filterOverrides.put("resourceTypeName", "resourceType.name like ?");
filterOverrides.put("pluginName", "resourceType.plugin like ?");
filterOverrides.put("explicitResourceIds", "" //
@@ -88,6 +96,13 @@ public class ResourceGroupCriteria extends Criteria {
this.filterId = filterId;
}
+ /**
+ * Only returns groups with at least this many downed implicit resource members
+ */
+ public void addFilterDownMemberCount(Integer filterDownMemberCount) {
+ this.filterDownMemberCount = filterDownMemberCount;
+ }
+
public void addFilterName(String filterName) {
this.filterName = filterName;
}
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 8e46217..b0d73be 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
@@ -1,16 +1,9 @@
package org.rhq.enterprise.gui.coregui.client;
-import org.rhq.core.domain.auth.Subject;
-import org.rhq.enterprise.gui.coregui.client.admin.AdministrationView;
-import org.rhq.enterprise.gui.coregui.client.bundle.BundleTopView;
-import org.rhq.enterprise.gui.coregui.client.dashboard.DashboardView;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.gwt.SubjectGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourcesView;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceView;
-import org.rhq.enterprise.gui.coregui.client.menu.MenuBarView;
-import org.rhq.enterprise.gui.coregui.client.util.ErrorHandler;
-import org.rhq.enterprise.gui.coregui.client.util.preferences.UserPreferences;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
@@ -33,11 +26,17 @@ import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.layout.VLayout;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.enterprise.gui.coregui.client.admin.AdministrationView;
+import org.rhq.enterprise.gui.coregui.client.bundle.BundleTopView;
+import org.rhq.enterprise.gui.coregui.client.dashboard.DashboardView;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.gwt.SubjectGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.InventoryView;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceView;
+import org.rhq.enterprise.gui.coregui.client.menu.MenuBarView;
+import org.rhq.enterprise.gui.coregui.client.util.ErrorHandler;
+import org.rhq.enterprise.gui.coregui.client.util.preferences.UserPreferences;
/**
* @author Greg Hinkle
@@ -82,7 +81,8 @@ public class CoreGUI implements EntryPoint {
}
});
- RequestBuilder b = new RequestBuilder(RequestBuilder.GET, "/j_security_check.do?j_username=rhqadmin&j_password=rhqadmin");
+ RequestBuilder b = new RequestBuilder(RequestBuilder.GET,
+ "/j_security_check.do?j_username=rhqadmin&j_password=rhqadmin");
try {
b.setCallback(new RequestCallback() {
public void onResponseReceived(Request request, Response response) {
@@ -95,7 +95,7 @@ public class CoreGUI implements EntryPoint {
});
b.send();
} catch (RequestException e) {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
SubjectGWTServiceAsync subjectService = SubjectGWTServiceAsync.Util.getInstance();
@@ -131,20 +131,20 @@ public class CoreGUI implements EntryPoint {
RootCanvas rootCanvas = new RootCanvas();
this.currentView = this.rootView = new View(new ViewId("", null), rootCanvas);
-// HTMLPane menuPane = new HTMLPane();
-// menuPane.setWidth100();
-// menuPane.setHeight(26);
-// menuPane.setContentsType(ContentsType.PAGE);
-// menuPane.setContentsURL("/rhq/common/menu/menu.xhtml");
-// menuPane.setZIndex(400000);
-// layout.addMember(menuPane);
+ // HTMLPane menuPane = new HTMLPane();
+ // menuPane.setWidth100();
+ // menuPane.setHeight(26);
+ // menuPane.setContentsType(ContentsType.PAGE);
+ // menuPane.setContentsURL("/rhq/common/menu/menu.xhtml");
+ // menuPane.setZIndex(400000);
+ // layout.addMember(menuPane);
MenuBarView menuBarView = new MenuBarView();
menuBarView.setWidth("100%");
-// WidgetCanvas menuCanvas = new WidgetCanvas(menuBarView);
-// menuCanvas.setTop(0);
-// menuCanvas.setWidth100();
-// menuCanvas.draw();
+ // WidgetCanvas menuCanvas = new WidgetCanvas(menuBarView);
+ // menuCanvas.setTop(0);
+ // menuCanvas.setWidth100();
+ // menuCanvas.draw();
rootCanvas.addMember(menuBarView);
breadCrumbTrailPane = new BreadcrumbTrailPane();
@@ -165,9 +165,11 @@ public class CoreGUI implements EntryPoint {
String path = historyChangeEvent.getValue();
System.out.println("History request: " + path);
- List<String> viewIdNames = path.equals("") ? Collections.<String>emptyList() : Arrays.asList(path.split("\\/"));
+ List<String> viewIdNames = path.equals("") ? Collections.<String> emptyList() : Arrays.asList(path
+ .split("\\/"));
String currentPath = CoreGUI.this.currentView.getId().getPath();
- List<String> currentViewIdNames = currentPath.equals("") ? Collections.<String>emptyList() : Arrays.asList(currentPath.split("\\/"));
+ List<String> currentViewIdNames = currentPath.equals("") ? Collections.<String> emptyList() : Arrays
+ .asList(currentPath.split("\\/"));
int commonBasePathSize = 0;
for (int i = 0; i < viewIdNames.size() && i < currentViewIdNames.size(); i++) {
@@ -247,8 +249,8 @@ public class CoreGUI implements EntryPoint {
canvas = new AdministrationView();
} else if (breadcrumbName.equals("Demo")) {
canvas = new DemoCanvas();
- } else if (breadcrumbName.equals("Resources")) {
- canvas = new ResourcesView();
+ } else if (breadcrumbName.equals("Inventory")) {
+ canvas = new InventoryView();
} else if (breadcrumbName.equals("Resource")) {
canvas = new ResourceView();
} else if (breadcrumbName.equals("Dashboard")) {
@@ -261,7 +263,6 @@ public class CoreGUI implements EntryPoint {
return canvas;
}
-
// -------------------- Static application utilities ----------------------
public static ErrorHandler getErrorHandler() {
@@ -281,8 +282,8 @@ public class CoreGUI implements EntryPoint {
// TODO this breaks because of reattach rules, bizarely even in queries. gonna switch out to non-subject include apis
// Create a minimized session object for validation on requests
-// Subject s = new Subject(subject.getName(),subject.getFactive(), subject.getFsystem());
-// s.setSessionId(subject.getSessionId());
+ // Subject s = new Subject(subject.getName(),subject.getFactive(), subject.getFsystem());
+ // s.setSessionId(subject.getSessionId());
CoreGUI.sessionSubject = subject;
}
@@ -327,12 +328,10 @@ public class CoreGUI implements EntryPoint {
currentCanvas = canvas;
setContent(canvas);
}
- ViewRenderer descendantViewRender = (currentCanvas instanceof ViewRenderer) ?
- (ViewRenderer) currentCanvas : null;
+ ViewRenderer descendantViewRender = (currentCanvas instanceof ViewRenderer) ? (ViewRenderer) currentCanvas
+ : null;
return new View(viewId, descendantViewRender);
}
}
}
-
-
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
index ea145cd..486c290 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
@@ -18,30 +18,18 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.groups;
-import org.rhq.enterprise.gui.coregui.client.components.table.Table;
-import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
-
+import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.ListGridFieldType;
import com.smartgwt.client.types.SelectionAppearance;
import com.smartgwt.client.types.SelectionStyle;
-import com.smartgwt.client.util.BooleanCallback;
-import com.smartgwt.client.util.SC;
-import com.smartgwt.client.widgets.IButton;
-import com.smartgwt.client.widgets.Label;
-import com.smartgwt.client.widgets.events.ClickEvent;
-import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.grid.CellFormatter;
-import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
-import com.smartgwt.client.widgets.grid.events.DataArrivedEvent;
-import com.smartgwt.client.widgets.grid.events.DataArrivedHandler;
-import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
-import com.smartgwt.client.widgets.grid.events.SelectionEvent;
-import com.smartgwt.client.widgets.layout.LayoutSpacer;
import com.smartgwt.client.widgets.layout.VLayout;
-import com.smartgwt.client.widgets.toolbar.ToolStrip;
+
+import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
/**
* @author Greg Hinkle
@@ -50,33 +38,38 @@ public class ResourceGroupListView extends VLayout {
private Table table;
-
public ResourceGroupListView() {
+ this(null);
+
+ }
+
+ /**
+ * Resource Group list filtered by a given criteria
+ * @param criteria
+ */
+ public ResourceGroupListView(Criteria criteria) {
setWidth100();
setHeight100();
final ResourceGroupsDataSource datasource = ResourceGroupsDataSource.getInstance();
-
- table = new Table("Resource Groups");
+ table = new Table("Resource Groups", criteria);
table.setDataSource(datasource);
table.getListGrid().setSelectionType(SelectionStyle.SIMPLE);
table.getListGrid().setSelectionAppearance(SelectionAppearance.CHECKBOX);
table.getListGrid().setResizeFieldsInRealTime(true);
-
ListGridField idField = new ListGridField("id", "Id", 55);
idField.setType(ListGridFieldType.INTEGER);
ListGridField nameField = new ListGridField("name", "Name", 250);
nameField.setCellFormatter(new CellFormatter() {
public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
- return "<a href=\"#ResourceGroup/" + listGridRecord.getAttribute("id") +"\">" + o + "</a>";
+ return "<a href=\"#ResourceGroup/" + listGridRecord.getAttribute("id") + "\">" + o + "</a>";
}
});
-
ListGridField descriptionField = new ListGridField("description", "Description");
ListGridField typeNameField = new ListGridField("typeName", "Type", 130);
ListGridField pluginNameField = new ListGridField("pluginName", "Plugin", 100);
@@ -85,18 +78,15 @@ public class ResourceGroupListView extends VLayout {
ListGridField availabilityField = new ListGridField("currentAvailability", "Availability", 55);
availabilityField.setAlign(Alignment.CENTER);
- table.getListGrid().setFields(idField, nameField, descriptionField, typeNameField, pluginNameField, categoryField, availabilityField);
-
-
- table.addTableAction(
- "Delete Groups",
- Table.SelectionEnablement.MULTIPLE,
- "Are you sure you want to delete # groups?",
- new TableAction() {
- public void executeAction(ListGridRecord[] selection) {
- // TODO: Implement this method.
- }
- });
+ table.getListGrid().setFields(idField, nameField, descriptionField, typeNameField, pluginNameField,
+ categoryField, availabilityField);
+
+ table.addTableAction("Delete Groups", Table.SelectionEnablement.MULTIPLE,
+ "Are you sure you want to delete # groups?", new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ // TODO: Implement this method.
+ }
+ });
addMember(table);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java
index ddfa206..421a66e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java
@@ -18,14 +18,6 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.groups;
-import org.rhq.core.domain.criteria.ResourceGroupCriteria;
-import org.rhq.core.domain.resource.group.ResourceGroup;
-import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGroupGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
-
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
@@ -35,6 +27,15 @@ import com.smartgwt.client.data.fields.DataSourceTextField;
import com.smartgwt.client.rpc.RPCResponse;
import com.smartgwt.client.widgets.grid.ListGridRecord;
+import org.rhq.core.domain.criteria.ResourceGroupCriteria;
+import org.rhq.core.domain.resource.group.GroupCategory;
+import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGroupGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+
/**
* @author Greg Hinkle
*/
@@ -53,7 +54,6 @@ public class ResourceGroupsDataSource extends RPCDataSource<ResourceGroup> {
return INSTANCE;
}
-
private ResourceGroupsDataSource() {
super("ResourceGroups");
@@ -70,8 +70,8 @@ public class ResourceGroupsDataSource extends RPCDataSource<ResourceGroup> {
DataSourceTextField pluginNameDataField = new DataSourceTextField("pluginName", "Plugin");
DataSourceTextField categoryDataField = new DataSourceTextField("category", "Category");
-
- setFields(idDataField, nameDataField, descriptionDataField, typeNameDataField, pluginNameDataField, categoryDataField);
+ setFields(idDataField, nameDataField, descriptionDataField, typeNameDataField, pluginNameDataField,
+ categoryDataField);
}
public void executeFetch(final DSRequest request, final DSResponse response) {
@@ -81,6 +81,15 @@ public class ResourceGroupsDataSource extends RPCDataSource<ResourceGroup> {
criteria.setPageControl(getPageControl(request));
criteria.addFilterName(query);
+ if (request.getCriteria().getValues().get("category") != null) {
+ criteria.addFilterGroupCategory(GroupCategory.valueOf(((String) request.getCriteria().getValues().get(
+ "category")).toUpperCase()));
+ }
+
+ if (request.getCriteria().getValues().get("downMemberCount") != null) {
+ criteria.addFilterDownMemberCount(Integer.parseInt((String) request.getCriteria().getValues().get(
+ "downMemberCount")));
+ }
groupService.findResourceGroupsByCriteria(criteria, new AsyncCallback<PageList<ResourceGroup>>() {
public void onFailure(Throwable caught) {
@@ -93,7 +102,7 @@ public class ResourceGroupsDataSource extends RPCDataSource<ResourceGroup> {
System.out.println("Data retrieved in: " + (System.currentTimeMillis() - start));
response.setData(buildRecords(result));
- response.setTotalRows(result.getTotalSize()); // for paging to work we have to specify size of full result set
+ response.setTotalRows(result.getTotalSize()); // for paging to work we have to specify size of full result set
processResponse(request.getRequestId(), response);
}
});
@@ -101,7 +110,7 @@ public class ResourceGroupsDataSource extends RPCDataSource<ResourceGroup> {
@Override
public ResourceGroup copyValues(ListGridRecord from) {
- return null; // TODO: Implement this method.
+ return null; // TODO: Implement this method.
}
@Override
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
new file mode 100644
index 0000000..d553b6d
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java
@@ -0,0 +1,182 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource;
+
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.types.ContentsType;
+import com.smartgwt.client.types.VisibilityMode;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.HTMLPane;
+import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
+import com.smartgwt.client.widgets.grid.events.SelectionEvent;
+import com.smartgwt.client.widgets.layout.HLayout;
+import com.smartgwt.client.widgets.layout.SectionStack;
+import com.smartgwt.client.widgets.layout.SectionStackSection;
+import com.smartgwt.client.widgets.tree.Tree;
+import com.smartgwt.client.widgets.tree.TreeGrid;
+import com.smartgwt.client.widgets.tree.TreeNode;
+
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupListView;
+import org.rhq.enterprise.gui.coregui.client.inventory.groups.definitions.GroupDefinitionListView;
+
+/**
+ * @author Greg Hinkle
+ */
+public class InventoryView extends HLayout {
+
+ public static final String VIEW_PATH = "Inventory";
+
+ private SectionStack sectionStack;
+ private Canvas contentCanvas;
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+
+ setWidth100();
+ setHeight100();
+
+ contentCanvas = new Canvas();
+ contentCanvas.setWidth("*");
+ contentCanvas.setHeight100();
+
+ sectionStack = new SectionStack();
+ sectionStack.setShowResizeBar(true);
+ sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE);
+ sectionStack.setWidth(250);
+ sectionStack.setHeight100();
+
+ sectionStack.addSection(buildResourcesSection());
+ sectionStack.addSection(buildGroupsSection());
+
+ addMember(sectionStack);
+ addMember(contentCanvas);
+
+ setContent(buildResourceSearchView());
+ }
+
+ private ResourceSearchView buildResourceSearchView() {
+ ResourceSearchView searchView = new ResourceSearchView();
+ searchView.addResourceSelectedListener(new ResourceSelectListener() {
+ public void onResourceSelected(Resource resource) {
+ //CoreGUI.setContent(new ResourceView(resource));
+ CoreGUI.goTo("Resource/" + resource.getId());
+ }
+ });
+ return searchView;
+ }
+
+ private SectionStackSection buildResourcesSection() {
+ final SectionStackSection section = new SectionStackSection("Inventory");
+ section.setExpanded(true);
+
+ final TreeNode allResources = new TreeNode("All Resources");
+ final TreeNode onlyPlatforms = new TreeNode("Platforms");
+ final TreeNode onlyServers = new TreeNode("Servers");
+ final TreeNode onlyServices = new TreeNode("Services");
+ final TreeNode inventory = new TreeNode("Inventory", allResources, onlyPlatforms, onlyServers, onlyServices);
+
+ final TreeNode downServers = new TreeNode("Down Servers");
+ final TreeNode savedSearches = new TreeNode("Saved Searches", downServers);
+
+ TreeGrid treeGrid = new TreeGrid();
+ treeGrid.setShowHeader(false);
+ Tree tree = new Tree();
+ tree.setRoot(new TreeNode("security", inventory, savedSearches));
+ treeGrid.setData(tree);
+ treeGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
+ public void onSelectionChanged(SelectionEvent selectionEvent) {
+ if (selectionEvent.getRecord() == allResources) {
+ setContent(new ResourceSearchView());
+ } else if (selectionEvent.getRecord() == onlyPlatforms) {
+ setContent(new ResourceSearchView(new Criteria("category", "platform")));
+ } else if (selectionEvent.getRecord() == onlyServers) {
+ setContent(new ResourceSearchView(new Criteria("category", "server")));
+ } else if (selectionEvent.getRecord() == onlyServices) {
+ setContent(new ResourceSearchView(new Criteria("category", "service")));
+ } else if (selectionEvent.getRecord() == downServers) {
+ setContent(new ResourceSearchView(new Criteria("availability", "down")));
+ }
+
+ }
+ });
+
+ section.addItem(treeGrid);
+
+ return section;
+ }
+
+ private SectionStackSection buildGroupsSection() {
+ final SectionStackSection section = new SectionStackSection("Groups");
+ section.setExpanded(true);
+
+ final TreeNode allGroups = new TreeNode("All Groups");
+ final TreeNode onlyCompatible = new TreeNode("Compatible");
+ final TreeNode onlyMixed = new TreeNode("Mixed");
+ final TreeNode groupGroupDefinitions = new TreeNode("Group Definitions");
+ final TreeNode inventory = new TreeNode("Inventory", allGroups, onlyCompatible, onlyMixed,
+ groupGroupDefinitions);
+
+ final TreeNode problemGroups = new TreeNode("Problem Groups");
+ final TreeNode savedSearches = new TreeNode("Saved Searches", problemGroups);
+
+ TreeGrid treeGrid = new TreeGrid();
+ treeGrid.setShowHeader(false);
+ Tree tree = new Tree();
+ tree.setRoot(new TreeNode("clustering", inventory, savedSearches));
+ treeGrid.setData(tree);
+ treeGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
+ public void onSelectionChanged(SelectionEvent selectionEvent) {
+ HTMLPane pane = new HTMLPane();
+ pane.setContentsType(ContentsType.PAGE);
+ pane.setWidth100();
+ pane.setHeight100();
+
+ String url = null;
+ if (selectionEvent.getRecord() == allGroups) {
+ setContent(new ResourceGroupListView());
+ } else if (selectionEvent.getRecord() == onlyCompatible) {
+ setContent(new ResourceGroupListView(new Criteria("category", "compatible")));
+ } else if (selectionEvent.getRecord() == onlyMixed) {
+ setContent(new ResourceGroupListView(new Criteria("category", "mixed")));
+ } else if (selectionEvent.getRecord() == groupGroupDefinitions) {
+ setContent(new GroupDefinitionListView());
+ } else if (selectionEvent.getRecord() == problemGroups) {
+ setContent(new ResourceGroupListView(new Criteria("availability", "down")));
+ }
+
+ }
+ });
+
+ section.addItem(treeGrid);
+
+ return section;
+ }
+
+ public void setContent(Canvas newContent) {
+ if (contentCanvas.getChildren().length > 0)
+ contentCanvas.getChildren()[0].destroy();
+ newContent.setWidth100();
+ newContent.setHeight100();
+ contentCanvas.addChild(newContent);
+ contentCanvas.draw();
+ }
+}
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 b692edf..f096cc2 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
@@ -18,14 +18,6 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource;
-import org.rhq.core.domain.criteria.ResourceCriteria;
-import org.rhq.core.domain.measurement.AvailabilityType;
-import org.rhq.core.domain.resource.Resource;
-import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
-
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.DSRequest;
@@ -37,6 +29,15 @@ import com.smartgwt.client.data.fields.DataSourceTextField;
import com.smartgwt.client.rpc.RPCResponse;
import com.smartgwt.client.widgets.grid.ListGridRecord;
+import org.rhq.core.domain.criteria.ResourceCriteria;
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceCategory;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+
/**
* @author Greg Hinkle
*/
@@ -46,12 +47,11 @@ public class ResourceDatasource extends RPCDataSource<Resource> {
private ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();
-
public ResourceDatasource() {
DataSourceField idDataField = new DataSourceIntegerField("id", "ID", 20);
idDataField.setPrimaryKey(true);
-
+
DataSourceTextField nameDataField = new DataSourceTextField("name", "Name", 200);
nameDataField.setCanEdit(false);
@@ -66,7 +66,8 @@ public class ResourceDatasource extends RPCDataSource<Resource> {
availabilityDataField.setCanEdit(false);
- setFields(idDataField, nameDataField, descriptionDataField, typeNameDataField, pluginNameDataField, categoryDataField, availabilityDataField);
+ setFields(idDataField, nameDataField, descriptionDataField, typeNameDataField, pluginNameDataField,
+ categoryDataField, availabilityDataField);
}
public String getQuery() {
@@ -77,7 +78,6 @@ public class ResourceDatasource extends RPCDataSource<Resource> {
this.query = query;
}
-
public void executeFetch(final DSRequest request, final DSResponse response) {
final long start = System.currentTimeMillis();
@@ -85,13 +85,24 @@ public class ResourceDatasource extends RPCDataSource<Resource> {
criteria.setPageControl(getPageControl(request));
if (request.getCriteria().getValues().get("parentId") != null) {
- criteria.addFilterParentResourceId(Integer.parseInt((String) request.getCriteria().getValues().get("parentId")));
+ criteria.addFilterParentResourceId(Integer.parseInt((String) request.getCriteria().getValues().get(
+ "parentId")));
}
if (request.getCriteria().getValues().get("name") != null) {
criteria.addFilterName((String) request.getCriteria().getValues().get("name"));
}
+ if (request.getCriteria().getValues().get("category") != null) {
+ criteria.addFilterResourceCategory(ResourceCategory.valueOf(((String) request.getCriteria().getValues()
+ .get("category")).toUpperCase()));
+ }
+
+ if (request.getCriteria().getValues().get("availability") != null) {
+ criteria.addFilterCurrentAvailability(AvailabilityType.valueOf(((String) request.getCriteria().getValues()
+ .get("availability")).toUpperCase()));
+ }
+
resourceService.findResourcesByCriteria(criteria, new AsyncCallback<PageList<Resource>>() {
public void onFailure(Throwable caught) {
Window.alert("Failed to load " + caught.getMessage());
@@ -106,7 +117,7 @@ public class ResourceDatasource extends RPCDataSource<Resource> {
ListGridRecord[] records = buildRecords(result);
response.setData(records);
- response.setTotalRows(result.getTotalSize()); // for paging to work we have to specify size of full result set
+ response.setTotalRows(result.getTotalSize()); // for paging to work we have to specify size of full result set
processResponse(request.getRequestId(), response);
}
});
@@ -114,24 +125,25 @@ public class ResourceDatasource extends RPCDataSource<Resource> {
@Override
public Resource copyValues(ListGridRecord from) {
- return null; // TODO: Implement this method.
+ return null; // TODO: Implement this method.
}
@Override
public ListGridRecord copyValues(Resource from) {
ListGridRecord record = new ListGridRecord();
- record.setAttribute("resource",from);
- record.setAttribute("id",from.getId());
- record.setAttribute("name",from.getName());
- record.setAttribute("description",from.getDescription());
- record.setAttribute("typeName",from.getResourceType().getName());
- record.setAttribute("pluginName",from.getResourceType().getPlugin());
- record.setAttribute("category",from.getResourceType().getCategory().getDisplayName());
-
- record.setAttribute("currentAvailability",
- from.getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP
- ? "/images/icons/availability_green_16.png"
- : "/images/icons/availability_red_16.png");
+ record.setAttribute("resource", from);
+ record.setAttribute("id", from.getId());
+ record.setAttribute("name", from.getName());
+ record.setAttribute("description", from.getDescription());
+ record.setAttribute("typeName", from.getResourceType().getName());
+ record.setAttribute("pluginName", from.getResourceType().getPlugin());
+ record.setAttribute("category", from.getResourceType().getCategory().getDisplayName());
+
+ record
+ .setAttribute(
+ "currentAvailability",
+ from.getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP ? "/images/icons/availability_green_16.png"
+ : "/images/icons/availability_red_16.png");
return record;
}
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 68cda78..289960a 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,8 +18,7 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource;
-import org.rhq.enterprise.gui.coregui.client.components.table.Table;
-import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
+import java.util.ArrayList;
import com.google.gwt.event.dom.client.KeyCodes;
import com.smartgwt.client.data.Criteria;
@@ -36,7 +35,8 @@ import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.layout.VLayout;
-import java.util.ArrayList;
+import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
/**
* @author Greg Hinkle
@@ -71,10 +71,8 @@ public class ResourceSearchView extends VLayout {
searchPanel.setWrapItemTitles(false);
searchPanel.setFields(searchBox);
-
addMember(searchPanel);
-
final ResourceDatasource datasource = new ResourceDatasource();
table = new Table("Resources", criteria);
table.setDataSource(datasource);
@@ -83,7 +81,6 @@ public class ResourceSearchView extends VLayout {
table.getListGrid().setSelectionAppearance(SelectionAppearance.CHECKBOX);
table.getListGrid().setResizeFieldsInRealTime(true);
-
ListGridField idField = new ListGridField("id", "Id", 55);
idField.setType(ListGridFieldType.INTEGER);
ListGridField nameField = new ListGridField("name", "Name", 250);
@@ -93,31 +90,25 @@ public class ResourceSearchView extends VLayout {
}
});
-
ListGridField descriptionField = new ListGridField("description", "Description");
ListGridField typeNameField = new ListGridField("typeName", "Type", 130);
ListGridField pluginNameField = new ListGridField("pluginName", "Plugin", 100);
ListGridField categoryField = new ListGridField("category", "Category", 60);
-
ListGridField availabilityField = new ListGridField("currentAvailability", "Availability", 55);
availabilityField.setAlign(Alignment.CENTER);
- table.getListGrid().setFields(idField, nameField, descriptionField, typeNameField, pluginNameField, categoryField, availabilityField);
+ table.getListGrid().setFields(idField, nameField, descriptionField, typeNameField, pluginNameField,
+ categoryField, availabilityField);
-
-
- table.addTableAction("Uninventory",
- Table.SelectionEnablement.MULTIPLE,
- "Are you sure you want to delete # resources?",
- new TableAction() {
- public void executeAction(ListGridRecord[] selection) {
- table.getListGrid().removeSelectedData();
- }
- });
+ table.addTableAction("Uninventory", Table.SelectionEnablement.MULTIPLE,
+ "Are you sure you want to delete # resources?", new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ table.getListGrid().removeSelectedData();
+ }
+ });
addMember(table);
-
searchBox.addKeyPressHandler(new KeyPressHandler() {
public void onKeyPress(KeyPressEvent event) {
if ((event.getCharacterValue() != null) && (event.getCharacterValue() == KeyCodes.KEY_ENTER)) {
@@ -128,7 +119,7 @@ public class ResourceSearchView extends VLayout {
c = new Criteria();
}
- c.addCriteria("name",(String) searchBox.getValue());
+ c.addCriteria("name", (String) searchBox.getValue());
long start = System.currentTimeMillis();
table.getListGrid().fetchData(c);
@@ -138,20 +129,14 @@ public class ResourceSearchView extends VLayout {
});
}
-
public void addResourceSelectedListener(ResourceSelectListener listener) {
selectListeners.add(listener);
}
-
// -------- Static Utility loaders ------------
-
public static ResourceSearchView getChildrenOf(int resourceId) {
- return new ResourceSearchView(new Criteria("parentId",String.valueOf(resourceId)));
+ return new ResourceSearchView(new Criteria("parentId", String.valueOf(resourceId)));
}
-
-
-
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourcesView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourcesView.java
deleted file mode 100644
index bb6c190..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourcesView.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.inventory.resource;
-
-import org.rhq.core.domain.resource.Resource;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupListView;
-import org.rhq.enterprise.gui.coregui.client.inventory.groups.definitions.GroupDefinitionListView;
-
-import com.smartgwt.client.types.ContentsType;
-import com.smartgwt.client.types.VisibilityMode;
-import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.HTMLPane;
-import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
-import com.smartgwt.client.widgets.grid.events.SelectionEvent;
-import com.smartgwt.client.widgets.layout.HLayout;
-import com.smartgwt.client.widgets.layout.SectionStack;
-import com.smartgwt.client.widgets.layout.SectionStackSection;
-import com.smartgwt.client.widgets.tree.Tree;
-import com.smartgwt.client.widgets.tree.TreeGrid;
-import com.smartgwt.client.widgets.tree.TreeNode;
-
-/**
- * @author Greg Hinkle
- */
-public class ResourcesView extends HLayout {
-
- public static final String VIEW_PATH = "Resources";
-
- private SectionStack sectionStack;
- private Canvas contentCanvas;
-
- @Override
- protected void onInit() {
- super.onInit();
-
- setWidth100();
- setHeight100();
-
- contentCanvas = new Canvas();
- contentCanvas.setWidth("*");
- contentCanvas.setHeight100();
-
- sectionStack = new SectionStack();
- sectionStack.setShowResizeBar(true);
- sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE);
- sectionStack.setWidth(250);
- sectionStack.setHeight100();
-
- sectionStack.addSection(buildResourcesSection());
- sectionStack.addSection(buildGroupsSection());
-
- addMember(sectionStack);
- addMember(contentCanvas);
-
- setContent(buildResourceSearchView());
- }
-
-
- private ResourceSearchView buildResourceSearchView() {
- ResourceSearchView searchView = new ResourceSearchView();
- searchView.addResourceSelectedListener(new ResourceSelectListener() {
- public void onResourceSelected(Resource resource) {
- //CoreGUI.setContent(new ResourceView(resource));
- CoreGUI.goTo("Resource/" + resource.getId());
- }
- });
- return searchView;
- }
-
-
- private SectionStackSection buildResourcesSection() {
- final SectionStackSection section = new SectionStackSection("Resources");
- section.setExpanded(true);
-
- TreeGrid treeGrid = new TreeGrid();
- treeGrid.setShowHeader(false);
-
- Tree tree = new Tree();
- final TreeNode savedSearches = new TreeNode("Saved Searches", new TreeNode("Down JBossAS (4)"));
- final TreeNode manageRolesNode = new TreeNode("Global Saved Searches");
- tree.setRoot(new TreeNode("security",
- savedSearches,
- manageRolesNode));
-
- treeGrid.setData(tree);
-
-
- treeGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
- public void onSelectionChanged(SelectionEvent selectionEvent) {
- if (selectionEvent.getRecord() == savedSearches) {
- setContent(new ResourceSearchView());
- } else if (selectionEvent.getRecord() == manageRolesNode) {
- setContent(new ResourceSearchView());
- }
- }
- });
-
-
- section.addItem(treeGrid);
-
-
- return section;
- }
-
-
- private SectionStackSection buildGroupsSection() {
- final SectionStackSection section = new SectionStackSection("Resource Groups");
- section.setExpanded(true);
-
- TreeGrid treeGrid = new TreeGrid();
- treeGrid.setShowHeader(false);
-
- Tree tree = new Tree();
- final TreeNode groupsNode = new TreeNode("Groups");
- final TreeNode groupDefinitions = new TreeNode("DynaGroups");
- final TreeNode manageAffinityGroupsNode = new TreeNode("Special Groups");
- final TreeNode managePartitionEventsNode = new TreeNode("Greg's Groups");
-
- tree.setRoot(new TreeNode("clustering",
- groupsNode,
- groupDefinitions,
- manageAffinityGroupsNode,
- managePartitionEventsNode));
-
- treeGrid.setData(tree);
-
-
- treeGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
- public void onSelectionChanged(SelectionEvent selectionEvent) {
- HTMLPane pane = new HTMLPane();
- pane.setContentsType(ContentsType.PAGE);
- pane.setWidth100();
- pane.setHeight100();
-
- String url = null;
- if (selectionEvent.getRecord() == groupsNode) {
- setContent(new ResourceGroupListView());
- return;
- } else if (selectionEvent.getRecord() == groupDefinitions) {
- setContent(new GroupDefinitionListView());
- return;
- } else if (selectionEvent.getRecord() == manageAffinityGroupsNode) {
- url = "/rhq/ha/listAffinityGroups.xhtml";
- } else if (selectionEvent.getRecord() == managePartitionEventsNode) {
- url = "/rhq/ha/listPartitionEvents.xhtml";
- }
- pane.setContentsURL(url + "?nomenu=true");
- setContent(pane);
-
- }
- });
-
- section.addItem(treeGrid);
-
- return section;
- }
-
- public void setContent(Canvas newContent) {
- if (contentCanvas.getChildren().length > 0)
- contentCanvas.getChildren()[0].destroy();
- newContent.setWidth100();
- newContent.setHeight100();
- contentCanvas.addChild(newContent);
- contentCanvas.draw();
- }
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
index 9b26ac0..162037d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
@@ -18,15 +18,10 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail;
-import org.rhq.core.domain.criteria.ResourceCriteria;
-import org.rhq.core.domain.measurement.AvailabilityType;
-import org.rhq.core.domain.resource.Resource;
-import org.rhq.core.domain.resource.ResourceCategory;
-import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.List;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
@@ -41,10 +36,15 @@ import com.smartgwt.client.types.DSDataFormat;
import com.smartgwt.client.types.DSProtocol;
import com.smartgwt.client.widgets.tree.TreeNode;
-import java.util.ArrayList;
-import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.List;
+import org.rhq.core.domain.criteria.ResourceCriteria;
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceCategory;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
/**
* This doesn't extend RPCDataSource because it is tree oriented and
@@ -53,14 +53,12 @@ import java.util.List;
*/
public class ResourceTreeDatasource extends DataSource {
-
private boolean initialized = false;
int rootId;
List<Resource> initialData;
private ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();
-
public ResourceTreeDatasource(List<Resource> initialData) {
setClientOnly(false);
setDataProtocol(DSProtocol.CLIENTCUSTOM);
@@ -84,21 +82,19 @@ public class ResourceTreeDatasource extends DataSource {
DataSourceTextField parentIdField = new DataSourceTextField("parentId", "Parent ID");
parentIdField.setForeignKey("id");
-// parentIdField.setRootValue(rootId);
-
-// DataSourceTextField parentKeyField = new DataSourceTextField("parentKey", "Parent KEY");
-// parentKeyField.setForeignKey("id");
-// parentKeyField.setRootValue(rootId);
+ // parentIdField.setRootValue(rootId);
+ // DataSourceTextField parentKeyField = new DataSourceTextField("parentKey", "Parent KEY");
+ // parentKeyField.setForeignKey("id");
+ // parentKeyField.setRootValue(rootId);
-// nameDataField.setType(FieldType.);
+ // nameDataField.setType(FieldType.);
setDropExtraFields(false);
setFields(idDataField, nameDataField, descriptionDataField, availabilityDataField);
}
-
@Override
protected Object transformRequest(DSRequest request) {
String requestId = request.getRequestId();
@@ -107,21 +103,21 @@ public class ResourceTreeDatasource extends DataSource {
// Asume success
response.setStatus(0);
switch (request.getOperationType()) {
- case ADD:
- //executeAdd(lstRec, true);
- break;
- case FETCH:
- executeFetch(requestId, request, response);
- break;
- case REMOVE:
- //executeRemove(lstRec);
- break;
- case UPDATE:
- //executeAdd(lstRec, false);
- break;
-
- default:
- break;
+ case ADD:
+ //executeAdd(lstRec, true);
+ break;
+ case FETCH:
+ executeFetch(requestId, request, response);
+ break;
+ case REMOVE:
+ //executeRemove(lstRec);
+ break;
+ case UPDATE:
+ //executeAdd(lstRec, false);
+ break;
+
+ default:
+ break;
}
return request.getData();
@@ -130,16 +126,15 @@ public class ResourceTreeDatasource extends DataSource {
public void executeFetch(final String requestId, final DSRequest request, final DSResponse response) {
final long start = System.currentTimeMillis();
-
String p = request.getCriteria().getAttribute("parentId");
-// System.out.println("All attributes: " + Arrays.toString(request.getCriteria().getAttributes()));
+ // System.out.println("All attributes: " + Arrays.toString(request.getCriteria().getAttributes()));
ResourceCriteria criteria = new ResourceCriteria();
if (p == null) {
System.out.println("DataSourceTree: Loading initial data");
-// criteria.addFilterId(rootId);
+ // criteria.addFilterId(rootId);
processIncomingData(initialData, response, requestId);
return;
@@ -153,7 +148,6 @@ public class ResourceTreeDatasource extends DataSource {
// The server is already eager fetch resource type
// * criteria.fetchResourceType(true);
-
resourceService.findResourcesByCriteria(criteria, new AsyncCallback<PageList<Resource>>() {
public void onFailure(Throwable caught) {
Window.alert("Failed to load " + caught.getMessage());
@@ -168,21 +162,19 @@ public class ResourceTreeDatasource extends DataSource {
});
}
-
private void processIncomingData(List<Resource> result, final DSResponse response, final String requestId) {
ResourceTypeRepository.Cache.getInstance().loadResourceTypes(result,
- EnumSet.of(ResourceTypeRepository.MetadataType.operations, ResourceTypeRepository.MetadataType.children),
- new ResourceTypeRepository.ResourceTypeLoadedCallback() {
- public void onResourceTypeLoaded(List<Resource> result) {
- response.setData(build(result));
- processResponse(requestId, response);
-
- }
- });
+ EnumSet.of(ResourceTypeRepository.MetadataType.operations, ResourceTypeRepository.MetadataType.children),
+ new ResourceTypeRepository.ResourceTypeLoadedCallback() {
+ public void onResourceTypeLoaded(List<Resource> result) {
+ response.setData(build(result));
+ processResponse(requestId, response);
+
+ }
+ });
}
-
/**
* Construct a set of TreeNodes from a list of resources
*
@@ -200,28 +192,26 @@ public class ResourceTreeDatasource extends DataSource {
return introduceTypeFolders(records);
}
-
private static TreeNode[] introduceTypeFolders(ResourceTreeNode[] nodes) {
ArrayList<TreeNode> built = new ArrayList<TreeNode>();
HashMap<ResourceType, TypeTreeNode> types = new HashMap<ResourceType, TypeTreeNode>();
-
for (ResourceTreeNode node : nodes) {
built.add(node);
- if (!types.containsKey(node.getResourceType()) && node.getResourceType().getCategory() != ResourceCategory.PLATFORM) {
- TypeTreeNode typeNode = new TypeTreeNode(String.valueOf(node.getResource().getParentResource().getId()), node.getResourceType().getName());
+ if (!types.containsKey(node.getResourceType())
+ && node.getResourceType().getCategory() != ResourceCategory.PLATFORM) {
+ TypeTreeNode typeNode = new TypeTreeNode(
+ String.valueOf(node.getResource().getParentResource().getId()), node.getResourceType().getName());
built.add(typeNode);
types.put(node.getResourceType(), typeNode);
}
}
-
return built.toArray(new TreeNode[built.size()]);
}
-
private static boolean sameTypes(ResourceTreeNode[] nodes) {
ResourceType first = nodes[0].getResourceType();
for (ResourceTreeNode node : nodes) {
@@ -232,23 +222,20 @@ public class ResourceTreeDatasource extends DataSource {
return true;
}
-
public static class TypeTreeNode extends TreeNode {
-
private TypeTreeNode(String parentId, String type) {
setID(parentId + "_" + type);
setParentID(parentId);
setAttribute("id", parentId + "_" + type);
setAttribute("parentId", parentId);
-// setAttribute("parentKey", parentId);
+ // setAttribute("parentKey", parentId);
setAttribute("name", type);
}
}
-
public static class ResourceTreeNode extends TreeNode {
private Resource resource;
@@ -257,9 +244,10 @@ public class ResourceTreeDatasource extends DataSource {
this.resource = resource;
String id = String.valueOf(resource.getId());
- String parentId = resource.getParentResource() == null ? null : (resource.getParentResource().getId() + "_" + resource.getResourceType().getName());
+ String parentId = resource.getParentResource() == null ? null
+ : (resource.getParentResource().getId() + "_" + resource.getResourceType().getName());
-// System.out.println(id + " / " + parentId);
+ // System.out.println(id + " / " + parentId);
setID(id);
setParentID(parentId);
@@ -267,17 +255,17 @@ public class ResourceTreeDatasource extends DataSource {
setAttribute("id", id);
setAttribute("parentId", parentId);
-// setAttribute("parentKey", resource.getParentResource() == null ? 0 : (resource.getParentResource().getId() + resource.getResourceType().getName()));
+ // setAttribute("parentKey", resource.getParentResource() == null ? 0 : (resource.getParentResource().getId() + resource.getResourceType().getName()));
setAttribute("name", resource.getName());
setAttribute("description", resource.getDescription());
- setAttribute("currentAvailability",
- resource.getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP
- ? "/images/icons/availability_green_16.png"
- : "/images/icons/availability_red_16.png");
+ setAttribute(
+ "currentAvailability",
+ resource.getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP ? "/images/icons/availability_green_16.png"
+ : "/images/icons/availability_red_16.png");
- setIsFolder((resource.getResourceType().getChildResourceTypes() != null &&
- !resource.getResourceType().getChildResourceTypes().isEmpty()));
+ setIsFolder((resource.getResourceType().getChildResourceTypes() != null && !resource.getResourceType()
+ .getChildResourceTypes().isEmpty()));
}
public Resource getResource() {
@@ -292,7 +280,6 @@ public class ResourceTreeDatasource extends DataSource {
return resource.getResourceType();
}
-
public String getParentId() {
return getAttribute("parentId");
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
index 48469cd..9bc16c0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
@@ -29,7 +29,7 @@ import org.rhq.enterprise.gui.coregui.client.ViewRenderer;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourcesView;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.InventoryView;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.util.SC;
@@ -99,7 +99,7 @@ public class ResourceView extends HLayout implements ViewRenderer {
public void onFailure(Throwable caught) {
SC.say("Failed to load Resource with id " + resourceId + ": " + caught);
// TODO: Display this error in a red box at top of page instead?
- CoreGUI.goTo(ResourcesView.VIEW_PATH);
+ CoreGUI.goTo(InventoryView.VIEW_PATH);
}
public void onSuccess(PageList<Resource> result) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
index 91c46f5..9328e5b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
@@ -18,6 +18,8 @@
*/
package org.rhq.enterprise.gui.coregui.client.menu;
+import java.util.LinkedHashMap;
+
import com.google.gwt.user.client.ui.Hyperlink;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.VerticalAlignment;
@@ -26,9 +28,8 @@ import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.menu.Menu;
import com.smartgwt.client.widgets.menu.MenuBar;
-import org.rhq.enterprise.gui.coregui.client.components.AboutModalWindow;
-import java.util.LinkedHashMap;
+import org.rhq.enterprise.gui.coregui.client.components.AboutModalWindow;
/**
* @author Greg Hinkle
@@ -45,38 +46,37 @@ public class MenuBarView extends HLayout {
setHeight(30);
setAlign(VerticalAlignment.BOTTOM);
setAlign(Alignment.LEFT);
-/*
- menuBar = new MenuBar();
- menuBar.setBackgroundColor("gray");
-
-
- Menu icon = new Menu();
- icon.setTitle("iManage");
- icon.addItem(new MenuItem("Dashboard"));
- menuBar.addMenus(new Menu[]{icon},0);
-
- Menu overview = new Menu();
- overview.setTitle("Applications");
- overview.addItem(new MenuItem("Content Configuration"));
- overview.addItem(new MenuItem("Monitoring"));
- overview.addItem(new MenuItem("Administration"));
- menuBar.addMenus(new Menu[]{overview},1);
-
- Menu views = new Menu();
- views.setTitle("Views");
- views.addItem(new MenuItem("Problems"));
- views.addItem(new MenuItem("Configuration Changes"));
- views.addItem(new MenuItem("Content Changes"));
- views.addItem(new MenuItem("Recent Administration"));
- menuBar.addMenus(new Menu[]{views},2);
-
- menuBar.setWidth100();
-
- addChild(menuBar);
- setWidth100();*/
+ /*
+ menuBar = new MenuBar();
+ menuBar.setBackgroundColor("gray");
+
+
+ Menu icon = new Menu();
+ icon.setTitle("iManage");
+ icon.addItem(new MenuItem("Dashboard"));
+ menuBar.addMenus(new Menu[]{icon},0);
+
+ Menu overview = new Menu();
+ overview.setTitle("Applications");
+ overview.addItem(new MenuItem("Content Configuration"));
+ overview.addItem(new MenuItem("Monitoring"));
+ overview.addItem(new MenuItem("Administration"));
+ menuBar.addMenus(new Menu[]{overview},1);
+
+ Menu views = new Menu();
+ views.setTitle("Views");
+ views.addItem(new MenuItem("Problems"));
+ views.addItem(new MenuItem("Configuration Changes"));
+ views.addItem(new MenuItem("Content Changes"));
+ views.addItem(new MenuItem("Recent Administration"));
+ menuBar.addMenus(new Menu[]{views},2);
+
+ menuBar.setWidth100();
+
+ addChild(menuBar);
+ setWidth100();*/
}
-
@Override
protected void onInit() {
super.onInit();
@@ -94,8 +94,6 @@ public class MenuBarView extends HLayout {
VLayout right = new VLayout();
-
-
HLayout links = new HLayout(25);
Hyperlink dashboardLink = new Hyperlink("Dashboard", "Dashboard");
@@ -107,7 +105,7 @@ public class MenuBarView extends HLayout {
demoLink.setStylePrimaryName("TopSectionLink");
links.addMember(demoLink);
- Hyperlink resourcesLink = new Hyperlink("Resources", "Resources");
+ Hyperlink resourcesLink = new Hyperlink("Inventory", "Inventory");
resourcesLink.setStylePrimaryName("TopSectionLink");
links.addMember(resourcesLink);
@@ -119,11 +117,9 @@ public class MenuBarView extends HLayout {
adminLink.setStylePrimaryName("TopSectionLink");
links.addMember(adminLink);
-
right.addMember(links);
right.addMember(new SearchBarPane());
-
addMember(right);
}
}
commit df8545235cd623dc7b1c13f86b04125055a29749
Merge: 9f3914f... 438a2f7...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Mar 9 18:58:44 2010 -0500
Merge branch 'bundle' into gwt
commit 9f3914fa2892d51036ac8b792dd425e0bada7bc5
Author: Joseph Marques <joseph(a)redhat.com>
Date: Tue Mar 9 17:00:05 2010 -0500
remove unused files
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/public/CoreGUI.css b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/public/CoreGUI.css
deleted file mode 100644
index a111f82..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/public/CoreGUI.css
+++ /dev/null
@@ -1,7 +0,0 @@
-body {
- background-color: white;
- color: black;
- font-family: Arial, sans-serif;
- font-size: small;
- margin: 8px;
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/public/CoreGUI.html b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/public/CoreGUI.html
deleted file mode 100644
index cefb38e..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/public/CoreGUI.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<html>
-<head>
- <title>CoreGUI Application</title>
- <link rel="stylesheet" href="CoreGUI.css">
-</head>
-<body>
-<script type="text/javascript" language="javascript" src="org.rhq.enterprise.gui.coregui.CoreGUI.nocache.js"></script>
-<h1>CoreGUI Application</h1>
-</body>
-</html>
commit 9d788c9b21e86de08b1fffd104465c05b4a355e1
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Tue Mar 9 14:35:08 2010 -0500
Revert "upgrade to latest version (2.3.0) of MIT Simile timeline lib", because Greg made multiple fixes to the previous version, the deltas for which were not captured anywhere
This reverts commit 146c670c44d85892c77e4759f1468d048c1c75a8.
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/content/history.html b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/content/history.html
new file mode 100644
index 0000000..a30fbd8
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/content/history.html
@@ -0,0 +1,7 @@
+<html>
+<head>
+ <title>Dummy Page for Keeping Track of History</title>
+</head>
+<body>
+</body>
+</html>
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-bottom-arrow.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-bottom-arrow.png
new file mode 100644
index 0000000..38c3917
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-bottom-arrow.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-bottom-left.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-bottom-left.png
new file mode 100644
index 0000000..6d32026
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-bottom-left.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-bottom-right.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-bottom-right.png
new file mode 100644
index 0000000..e5dc136
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-bottom-right.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-bottom.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-bottom.png
new file mode 100644
index 0000000..166b057
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-bottom.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-left-arrow.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-left-arrow.png
new file mode 100644
index 0000000..5b173cd
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-left-arrow.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-left.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-left.png
new file mode 100644
index 0000000..3826722
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-left.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-right-arrow.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-right-arrow.png
new file mode 100644
index 0000000..11e2873
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-right-arrow.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-right.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-right.png
new file mode 100644
index 0000000..f66f879
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-right.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-top-arrow.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-top-arrow.png
new file mode 100644
index 0000000..524c46e
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-top-arrow.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-top-left.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-top-left.png
new file mode 100644
index 0000000..d69841f
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-top-left.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-top-right.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-top-right.png
new file mode 100644
index 0000000..9ab219a
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-top-right.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-top.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-top.png
new file mode 100644
index 0000000..917defa
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-top.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/close-button.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/close-button.png
new file mode 100644
index 0000000..15f31b3
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/close-button.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/copy.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/copy.png
new file mode 100644
index 0000000..cf7cee4
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/copy.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/message-bottom-left.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/message-bottom-left.png
new file mode 100644
index 0000000..43a9d61
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/message-bottom-left.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/message-bottom-right.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/message-bottom-right.png
new file mode 100644
index 0000000..bfa4954
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/message-bottom-right.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/message-left.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/message-left.png
new file mode 100644
index 0000000..f354376
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/message-left.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/message-right.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/message-right.png
new file mode 100644
index 0000000..4702c28
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/message-right.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/message-top-left.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/message-top-left.png
new file mode 100644
index 0000000..b19b0ea
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/message-top-left.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/message-top-right.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/message-top-right.png
new file mode 100644
index 0000000..c092555
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/message-top-right.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/ajax.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/ajax.js
new file mode 100644
index 0000000..7172609
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/ajax.js
@@ -0,0 +1,45 @@
+/*==================================================
+ * General, miscellaneous SimileAjax stuff
+ *==================================================
+ */
+
+SimileAjax.ListenerQueue = function(wildcardHandlerName) {
+ this._listeners = [];
+ this._wildcardHandlerName = wildcardHandlerName;
+};
+
+SimileAjax.ListenerQueue.prototype.add = function(listener) {
+ this._listeners.push(listener);
+};
+
+SimileAjax.ListenerQueue.prototype.remove = function(listener) {
+ var listeners = this._listeners;
+ for (var i = 0; i < listeners.length; i++) {
+ if (listeners[i] == listener) {
+ listeners.splice(i, 1);
+ break;
+ }
+ }
+};
+
+SimileAjax.ListenerQueue.prototype.fire = function(handlerName, args) {
+ var listeners = [].concat(this._listeners);
+ for (var i = 0; i < listeners.length; i++) {
+ var listener = listeners[i];
+ if (handlerName in listener) {
+ try {
+ listener[handlerName].apply(listener, args);
+ } catch (e) {
+ SimileAjax.Debug.exception("Error firing event of name " + handlerName, e);
+ }
+ } else if (this._wildcardHandlerName != null &&
+ this._wildcardHandlerName in listener) {
+ try {
+ listener[this._wildcardHandlerName].apply(listener, [ handlerName ]);
+ } catch (e) {
+ SimileAjax.Debug.exception("Error firing event of name " + handlerName + " to wildcard handler", e);
+ }
+ }
+ }
+};
+
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/data-structure.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/data-structure.js
new file mode 100644
index 0000000..e789cb4
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/data-structure.js
@@ -0,0 +1,447 @@
+/**
+ * A basic set (in the mathematical sense) data structure
+ *
+ * @constructor
+ * @param {Array or SimileAjax.Set} [a] an initial collection
+ */
+SimileAjax.Set = function(a) {
+ this._hash = {};
+ this._count = 0;
+
+ if (a instanceof Array) {
+ for (var i = 0; i < a.length; i++) {
+ this.add(a[i]);
+ }
+ } else if (a instanceof SimileAjax.Set) {
+ this.addSet(a);
+ }
+}
+
+/**
+ * Adds the given object to this set, assuming there it does not already exist
+ *
+ * @param {Object} o the object to add
+ * @return {Boolean} true if the object was added, false if not
+ */
+SimileAjax.Set.prototype.add = function(o) {
+ if (!(o in this._hash)) {
+ this._hash[o] = true;
+ this._count++;
+ return true;
+ }
+ return false;
+}
+
+/**
+ * Adds each element in the given set to this set
+ *
+ * @param {SimileAjax.Set} set the set of elements to add
+ */
+SimileAjax.Set.prototype.addSet = function(set) {
+ for (var o in set._hash) {
+ this.add(o);
+ }
+}
+
+/**
+ * Removes the given element from this set
+ *
+ * @param {Object} o the object to remove
+ * @return {Boolean} true if the object was successfully removed,
+ * false otherwise
+ */
+SimileAjax.Set.prototype.remove = function(o) {
+ if (o in this._hash) {
+ delete this._hash[o];
+ this._count--;
+ return true;
+ }
+ return false;
+}
+
+/**
+ * Removes the elements in this set that correspond to the elements in the
+ * given set
+ *
+ * @param {SimileAjax.Set} set the set of elements to remove
+ */
+SimileAjax.Set.prototype.removeSet = function(set) {
+ for (var o in set._hash) {
+ this.remove(o);
+ }
+}
+
+/**
+ * Removes all elements in this set that are not present in the given set, i.e.
+ * modifies this set to the intersection of the two sets
+ *
+ * @param {SimileAjax.Set} set the set to intersect
+ */
+SimileAjax.Set.prototype.retainSet = function(set) {
+ for (var o in this._hash) {
+ if (!set.contains(o)) {
+ delete this._hash[o];
+ this._count--;
+ }
+ }
+}
+
+/**
+ * Returns whether or not the given element exists in this set
+ *
+ * @param {SimileAjax.Set} o the object to test for
+ * @return {Boolean} true if the object is present, false otherwise
+ */
+SimileAjax.Set.prototype.contains = function(o) {
+ return (o in this._hash);
+}
+
+/**
+ * Returns the number of elements in this set
+ *
+ * @return {Number} the number of elements in this set
+ */
+SimileAjax.Set.prototype.size = function() {
+ return this._count;
+}
+
+/**
+ * Returns the elements of this set as an array
+ *
+ * @return {Array} a new array containing the elements of this set
+ */
+SimileAjax.Set.prototype.toArray = function() {
+ var a = [];
+ for (var o in this._hash) {
+ a.push(o);
+ }
+ return a;
+}
+
+/**
+ * Iterates through the elements of this set, order unspecified, executing the
+ * given function on each element until the function returns true
+ *
+ * @param {Function} f a function of form f(element)
+ */
+SimileAjax.Set.prototype.visit = function(f) {
+ for (var o in this._hash) {
+ if (f(o) == true) {
+ break;
+ }
+ }
+}
+
+/**
+ * A sorted array data structure
+ *
+ * @constructor
+ */
+SimileAjax.SortedArray = function(compare, initialArray) {
+ this._a = (initialArray instanceof Array) ? initialArray : [];
+ this._compare = compare;
+};
+
+SimileAjax.SortedArray.prototype.add = function(elmt) {
+ var sa = this;
+ var index = this.find(function(elmt2) {
+ return sa._compare(elmt2, elmt);
+ });
+
+ if (index < this._a.length) {
+ this._a.splice(index, 0, elmt);
+ } else {
+ this._a.push(elmt);
+ }
+};
+
+SimileAjax.SortedArray.prototype.remove = function(elmt) {
+ var sa = this;
+ var index = this.find(function(elmt2) {
+ return sa._compare(elmt2, elmt);
+ });
+
+ while (index < this._a.length && this._compare(this._a[index], elmt) == 0) {
+ if (this._a[index] == elmt) {
+ this._a.splice(index, 1);
+ return true;
+ } else {
+ index++;
+ }
+ }
+ return false;
+};
+
+SimileAjax.SortedArray.prototype.removeAll = function() {
+ this._a = [];
+};
+
+SimileAjax.SortedArray.prototype.elementAt = function(index) {
+ return this._a[index];
+};
+
+SimileAjax.SortedArray.prototype.length = function() {
+ return this._a.length;
+};
+
+SimileAjax.SortedArray.prototype.find = function(compare) {
+ var a = 0;
+ var b = this._a.length;
+
+ while (a < b) {
+ var mid = Math.floor((a + b) / 2);
+ var c = compare(this._a[mid]);
+ if (mid == a) {
+ return c < 0 ? a+1 : a;
+ } else if (c < 0) {
+ a = mid;
+ } else {
+ b = mid;
+ }
+ }
+ return a;
+};
+
+SimileAjax.SortedArray.prototype.getFirst = function() {
+ return (this._a.length > 0) ? this._a[0] : null;
+};
+
+SimileAjax.SortedArray.prototype.getLast = function() {
+ return (this._a.length > 0) ? this._a[this._a.length - 1] : null;
+};
+
+/*==================================================
+ * Event Index
+ *==================================================
+ */
+
+SimileAjax.EventIndex = function(unit) {
+ var eventIndex = this;
+
+ this._unit = (unit != null) ? unit : SimileAjax.NativeDateUnit;
+ this._events = new SimileAjax.SortedArray(
+ function(event1, event2) {
+ return eventIndex._unit.compare(event1.getStart(), event2.getStart());
+ }
+ );
+ this._idToEvent = {};
+ this._indexed = true;
+};
+
+SimileAjax.EventIndex.prototype.getUnit = function() {
+ return this._unit;
+};
+
+SimileAjax.EventIndex.prototype.getEvent = function(id) {
+ return this._idToEvent[id];
+};
+
+SimileAjax.EventIndex.prototype.add = function(evt) {
+ this._events.add(evt);
+ this._idToEvent[evt.getID()] = evt;
+ this._indexed = false;
+};
+
+SimileAjax.EventIndex.prototype.removeAll = function() {
+ this._events.removeAll();
+ this._idToEvent = {};
+ this._indexed = false;
+};
+
+SimileAjax.EventIndex.prototype.getCount = function() {
+ return this._events.length();
+};
+
+SimileAjax.EventIndex.prototype.getIterator = function(startDate, endDate) {
+ if (!this._indexed) {
+ this._index();
+ }
+ return new SimileAjax.EventIndex._Iterator(this._events, startDate, endDate, this._unit);
+};
+
+SimileAjax.EventIndex.prototype.getReverseIterator = function(startDate, endDate) {
+ if (!this._indexed) {
+ this._index();
+ }
+ return new SimileAjax.EventIndex._ReverseIterator(this._events, startDate, endDate, this._unit);
+};
+
+SimileAjax.EventIndex.prototype.getAllIterator = function() {
+ return new SimileAjax.EventIndex._AllIterator(this._events);
+};
+
+SimileAjax.EventIndex.prototype.getEarliestDate = function() {
+ var evt = this._events.getFirst();
+ return (evt == null) ? null : evt.getStart();
+};
+
+SimileAjax.EventIndex.prototype.getLatestDate = function() {
+ var evt = this._events.getLast();
+ if (evt == null) {
+ return null;
+ }
+
+ if (!this._indexed) {
+ this._index();
+ }
+
+ var index = evt._earliestOverlapIndex;
+ var date = this._events.elementAt(index).getEnd();
+ for (var i = index + 1; i < this._events.length(); i++) {
+ date = this._unit.later(date, this._events.elementAt(i).getEnd());
+ }
+
+ return date;
+};
+
+SimileAjax.EventIndex.prototype._index = function() {
+ /*
+ * For each event, we want to find the earliest preceding
+ * event that overlaps with it, if any.
+ */
+
+ var l = this._events.length();
+ for (var i = 0; i < l; i++) {
+ var evt = this._events.elementAt(i);
+ evt._earliestOverlapIndex = i;
+ }
+
+ var toIndex = 1;
+ for (var i = 0; i < l; i++) {
+ var evt = this._events.elementAt(i);
+ var end = evt.getEnd();
+
+ toIndex = Math.max(toIndex, i + 1);
+ while (toIndex < l) {
+ var evt2 = this._events.elementAt(toIndex);
+ var start2 = evt2.getStart();
+
+ if (this._unit.compare(start2, end) < 0) {
+ evt2._earliestOverlapIndex = i;
+ toIndex++;
+ } else {
+ break;
+ }
+ }
+ }
+ this._indexed = true;
+};
+
+SimileAjax.EventIndex._Iterator = function(events, startDate, endDate, unit) {
+ this._events = events;
+ this._startDate = startDate;
+ this._endDate = endDate;
+ this._unit = unit;
+
+ this._currentIndex = events.find(function(evt) {
+ return unit.compare(evt.getStart(), startDate);
+ });
+ if (this._currentIndex - 1 >= 0) {
+ this._currentIndex = this._events.elementAt(this._currentIndex - 1)._earliestOverlapIndex;
+ }
+ this._currentIndex--;
+
+ this._maxIndex = events.find(function(evt) {
+ return unit.compare(evt.getStart(), endDate);
+ });
+
+ this._hasNext = false;
+ this._next = null;
+ this._findNext();
+};
+
+SimileAjax.EventIndex._Iterator.prototype = {
+ hasNext: function() { return this._hasNext; },
+ next: function() {
+ if (this._hasNext) {
+ var next = this._next;
+ this._findNext();
+
+ return next;
+ } else {
+ return null;
+ }
+ },
+ _findNext: function() {
+ var unit = this._unit;
+ while ((++this._currentIndex) < this._maxIndex) {
+ var evt = this._events.elementAt(this._currentIndex);
+ if (unit.compare(evt.getStart(), this._endDate) < 0 &&
+ unit.compare(evt.getEnd(), this._startDate) > 0) {
+
+ this._next = evt;
+ this._hasNext = true;
+ return;
+ }
+ }
+ this._next = null;
+ this._hasNext = false;
+ }
+};
+
+SimileAjax.EventIndex._ReverseIterator = function(events, startDate, endDate, unit) {
+ this._events = events;
+ this._startDate = startDate;
+ this._endDate = endDate;
+ this._unit = unit;
+
+ this._minIndex = events.find(function(evt) {
+ return unit.compare(evt.getStart(), startDate);
+ });
+ if (this._minIndex - 1 >= 0) {
+ this._minIndex = this._events.elementAt(this._minIndex - 1)._earliestOverlapIndex;
+ }
+
+ this._maxIndex = events.find(function(evt) {
+ return unit.compare(evt.getStart(), endDate);
+ });
+
+ this._currentIndex = this._maxIndex;
+ this._hasNext = false;
+ this._next = null;
+ this._findNext();
+};
+
+SimileAjax.EventIndex._ReverseIterator.prototype = {
+ hasNext: function() { return this._hasNext; },
+ next: function() {
+ if (this._hasNext) {
+ var next = this._next;
+ this._findNext();
+
+ return next;
+ } else {
+ return null;
+ }
+ },
+ _findNext: function() {
+ var unit = this._unit;
+ while ((--this._currentIndex) >= this._minIndex) {
+ var evt = this._events.elementAt(this._currentIndex);
+ if (unit.compare(evt.getStart(), this._endDate) < 0 &&
+ unit.compare(evt.getEnd(), this._startDate) > 0) {
+
+ this._next = evt;
+ this._hasNext = true;
+ return;
+ }
+ }
+ this._next = null;
+ this._hasNext = false;
+ }
+};
+
+SimileAjax.EventIndex._AllIterator = function(events) {
+ this._events = events;
+ this._index = 0;
+};
+
+SimileAjax.EventIndex._AllIterator.prototype = {
+ hasNext: function() {
+ return this._index < this._events.length();
+ },
+ next: function() {
+ return this._index < this._events.length() ?
+ this._events.elementAt(this._index++) : null;
+ }
+};
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/date-time.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/date-time.js
new file mode 100644
index 0000000..d0498bf
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/date-time.js
@@ -0,0 +1,452 @@
+/**
+ * @fileOverview A collection of date/time utility functions
+ * @name SimileAjax.DateTime
+ */
+
+SimileAjax.DateTime = new Object();
+
+SimileAjax.DateTime.MILLISECOND = 0;
+SimileAjax.DateTime.SECOND = 1;
+SimileAjax.DateTime.MINUTE = 2;
+SimileAjax.DateTime.HOUR = 3;
+SimileAjax.DateTime.DAY = 4;
+SimileAjax.DateTime.WEEK = 5;
+SimileAjax.DateTime.MONTH = 6;
+SimileAjax.DateTime.YEAR = 7;
+SimileAjax.DateTime.DECADE = 8;
+SimileAjax.DateTime.CENTURY = 9;
+SimileAjax.DateTime.MILLENNIUM = 10;
+
+SimileAjax.DateTime.EPOCH = -1;
+SimileAjax.DateTime.ERA = -2;
+
+/**
+ * An array of unit lengths, expressed in milliseconds, of various lengths of
+ * time. The array indices are predefined and stored as properties of the
+ * SimileAjax.DateTime object, e.g. SimileAjax.DateTime.YEAR.
+ * @type Array
+ */
+SimileAjax.DateTime.gregorianUnitLengths = [];
+ (function() {
+ var d = SimileAjax.DateTime;
+ var a = d.gregorianUnitLengths;
+
+ a[d.MILLISECOND] = 1;
+ a[d.SECOND] = 1000;
+ a[d.MINUTE] = a[d.SECOND] * 60;
+ a[d.HOUR] = a[d.MINUTE] * 60;
+ a[d.DAY] = a[d.HOUR] * 24;
+ a[d.WEEK] = a[d.DAY] * 7;
+ a[d.MONTH] = a[d.DAY] * 31;
+ a[d.YEAR] = a[d.DAY] * 365;
+ a[d.DECADE] = a[d.YEAR] * 10;
+ a[d.CENTURY] = a[d.YEAR] * 100;
+ a[d.MILLENNIUM] = a[d.YEAR] * 1000;
+ })();
+
+SimileAjax.DateTime._dateRegexp = new RegExp(
+ "^(-?)([0-9]{4})(" + [
+ "(-?([0-9]{2})(-?([0-9]{2}))?)", // -month-dayOfMonth
+ "(-?([0-9]{3}))", // -dayOfYear
+ "(-?W([0-9]{2})(-?([1-7]))?)" // -Wweek-dayOfWeek
+ ].join("|") + ")?$"
+);
+SimileAjax.DateTime._timezoneRegexp = new RegExp(
+ "Z|(([-+])([0-9]{2})(:?([0-9]{2}))?)$"
+);
+SimileAjax.DateTime._timeRegexp = new RegExp(
+ "^([0-9]{2})(:?([0-9]{2})(:?([0-9]{2})(\.([0-9]+))?)?)?$"
+);
+
+/**
+ * Takes a date object and a string containing an ISO 8601 date and sets the
+ * the date using information parsed from the string. Note that this method
+ * does not parse any time information.
+ *
+ * @param {Date} dateObject the date object to modify
+ * @param {String} string an ISO 8601 string to parse
+ * @return {Date} the modified date object
+ */
+SimileAjax.DateTime.setIso8601Date = function(dateObject, string) {
+ /*
+ * This function has been adapted from dojo.date, v.0.3.0
+ * http://dojotoolkit.org/.
+ */
+
+ var d = string.match(SimileAjax.DateTime._dateRegexp);
+ if(!d) {
+ throw new Error("Invalid date string: " + string);
+ }
+
+ var sign = (d[1] == "-") ? -1 : 1; // BC or AD
+ var year = sign * d[2];
+ var month = d[5];
+ var date = d[7];
+ var dayofyear = d[9];
+ var week = d[11];
+ var dayofweek = (d[13]) ? d[13] : 1;
+
+ dateObject.setUTCFullYear(year);
+ if (dayofyear) {
+ dateObject.setUTCMonth(0);
+ dateObject.setUTCDate(Number(dayofyear));
+ } else if (week) {
+ dateObject.setUTCMonth(0);
+ dateObject.setUTCDate(1);
+ var gd = dateObject.getUTCDay();
+ var day = (gd) ? gd : 7;
+ var offset = Number(dayofweek) + (7 * Number(week));
+
+ if (day <= 4) {
+ dateObject.setUTCDate(offset + 1 - day);
+ } else {
+ dateObject.setUTCDate(offset + 8 - day);
+ }
+ } else {
+ if (month) {
+ dateObject.setUTCDate(1);
+ dateObject.setUTCMonth(month - 1);
+ }
+ if (date) {
+ dateObject.setUTCDate(date);
+ }
+ }
+
+ return dateObject;
+};
+
+/**
+ * Takes a date object and a string containing an ISO 8601 time and sets the
+ * the time using information parsed from the string. Note that this method
+ * does not parse any date information.
+ *
+ * @param {Date} dateObject the date object to modify
+ * @param {String} string an ISO 8601 string to parse
+ * @return {Date} the modified date object
+ */
+SimileAjax.DateTime.setIso8601Time = function (dateObject, string) {
+ /*
+ * This function has been adapted from dojo.date, v.0.3.0
+ * http://dojotoolkit.org/.
+ */
+
+ var d = string.match(SimileAjax.DateTime._timeRegexp);
+ if(!d) {
+ SimileAjax.Debug.warn("Invalid time string: " + string);
+ return false;
+ }
+ var hours = d[1];
+ var mins = Number((d[3]) ? d[3] : 0);
+ var secs = (d[5]) ? d[5] : 0;
+ var ms = d[7] ? (Number("0." + d[7]) * 1000) : 0;
+
+ dateObject.setUTCHours(hours);
+ dateObject.setUTCMinutes(mins);
+ dateObject.setUTCSeconds(secs);
+ dateObject.setUTCMilliseconds(ms);
+
+ return dateObject;
+};
+
+/**
+ * The timezone offset in minutes in the user's browser.
+ * @type Number
+ */
+SimileAjax.DateTime.timezoneOffset = new Date().getTimezoneOffset();
+
+/**
+ * Takes a date object and a string containing an ISO 8601 date and time and
+ * sets the date object using information parsed from the string.
+ *
+ * @param {Date} dateObject the date object to modify
+ * @param {String} string an ISO 8601 string to parse
+ * @return {Date} the modified date object
+ */
+SimileAjax.DateTime.setIso8601 = function (dateObject, string){
+ /*
+ * This function has been adapted from dojo.date, v.0.3.0
+ * http://dojotoolkit.org/.
+ */
+
+ var offset = null;
+ var comps = (string.indexOf("T") == -1) ? string.split(" ") : string.split("T");
+
+ SimileAjax.DateTime.setIso8601Date(dateObject, comps[0]);
+ if (comps.length == 2) {
+ // first strip timezone info from the end
+ var d = comps[1].match(SimileAjax.DateTime._timezoneRegexp);
+ if (d) {
+ if (d[0] == 'Z') {
+ offset = 0;
+ } else {
+ offset = (Number(d[3]) * 60) + Number(d[5]);
+ offset *= ((d[2] == '-') ? 1 : -1);
+ }
+ comps[1] = comps[1].substr(0, comps[1].length - d[0].length);
+ }
+
+ SimileAjax.DateTime.setIso8601Time(dateObject, comps[1]);
+ }
+ if (offset == null) {
+ offset = dateObject.getTimezoneOffset(); // local time zone if no tz info
+ }
+ dateObject.setTime(dateObject.getTime() + offset * 60000);
+
+ return dateObject;
+};
+
+/**
+ * Takes a string containing an ISO 8601 date and returns a newly instantiated
+ * date object with the parsed date and time information from the string.
+ *
+ * @param {String} string an ISO 8601 string to parse
+ * @return {Date} a new date object created from the string
+ */
+SimileAjax.DateTime.parseIso8601DateTime = function (string) {
+ try {
+ return SimileAjax.DateTime.setIso8601(new Date(0), string);
+ } catch (e) {
+ return null;
+ }
+};
+
+/**
+ * Takes a string containing a Gregorian date and time and returns a newly
+ * instantiated date object with the parsed date and time information from the
+ * string. If the param is actually an instance of Date instead of a string,
+ * simply returns the given date instead.
+ *
+ * @param {Object} o an object, to either return or parse as a string
+ * @return {Date} the date object
+ */
+SimileAjax.DateTime.parseGregorianDateTime = function(o) {
+ if (o == null) {
+ return null;
+ } else if (o instanceof Date) {
+ return o;
+ }
+
+ var s = o.toString();
+ if (s.length > 0 && s.length < 8) {
+ var space = s.indexOf(" ");
+ if (space > 0) {
+ var year = parseInt(s.substr(0, space));
+ var suffix = s.substr(space + 1);
+ if (suffix.toLowerCase() == "bc") {
+ year = 1 - year;
+ }
+ } else {
+ var year = parseInt(s);
+ }
+
+ var d = new Date(0);
+ d.setUTCFullYear(year);
+
+ return d;
+ }
+
+ try {
+ return new Date(Date.parse(s));
+ } catch (e) {
+ return null;
+ }
+};
+
+/**
+ * Rounds date objects down to the nearest interval or multiple of an interval.
+ * This method modifies the given date object, converting it to the given
+ * timezone if specified.
+ *
+ * @param {Date} date the date object to round
+ * @param {Number} intervalUnit a constant, integer index specifying an
+ * interval, e.g. SimileAjax.DateTime.HOUR
+ * @param {Number} timeZone a timezone shift, given in hours
+ * @param {Number} multiple a multiple of the interval to round by
+ * @param {Number} firstDayOfWeek an integer specifying the first day of the
+ * week, 0 corresponds to Sunday, 1 to Monday, etc.
+ */
+SimileAjax.DateTime.roundDownToInterval = function(date, intervalUnit, timeZone, multiple, firstDayOfWeek) {
+ var timeShift = timeZone *
+ SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.HOUR];
+
+ var date2 = new Date(date.getTime() + timeShift);
+ var clearInDay = function(d) {
+ d.setUTCMilliseconds(0);
+ d.setUTCSeconds(0);
+ d.setUTCMinutes(0);
+ d.setUTCHours(0);
+ };
+ var clearInYear = function(d) {
+ clearInDay(d);
+ d.setUTCDate(1);
+ d.setUTCMonth(0);
+ };
+
+ switch(intervalUnit) {
+ case SimileAjax.DateTime.MILLISECOND:
+ var x = date2.getUTCMilliseconds();
+ date2.setUTCMilliseconds(x - (x % multiple));
+ break;
+ case SimileAjax.DateTime.SECOND:
+ date2.setUTCMilliseconds(0);
+
+ var x = date2.getUTCSeconds();
+ date2.setUTCSeconds(x - (x % multiple));
+ break;
+ case SimileAjax.DateTime.MINUTE:
+ date2.setUTCMilliseconds(0);
+ date2.setUTCSeconds(0);
+
+ var x = date2.getUTCMinutes();
+ date2.setTime(date2.getTime() -
+ (x % multiple) * SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.MINUTE]);
+ break;
+ case SimileAjax.DateTime.HOUR:
+ date2.setUTCMilliseconds(0);
+ date2.setUTCSeconds(0);
+ date2.setUTCMinutes(0);
+
+ var x = date2.getUTCHours();
+ date2.setUTCHours(x - (x % multiple));
+ break;
+ case SimileAjax.DateTime.DAY:
+ clearInDay(date2);
+ break;
+ case SimileAjax.DateTime.WEEK:
+ clearInDay(date2);
+ var d = (date2.getUTCDay() + 7 - firstDayOfWeek) % 7;
+ date2.setTime(date2.getTime() -
+ d * SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.DAY]);
+ break;
+ case SimileAjax.DateTime.MONTH:
+ clearInDay(date2);
+ date2.setUTCDate(1);
+
+ var x = date2.getUTCMonth();
+ date2.setUTCMonth(x - (x % multiple));
+ break;
+ case SimileAjax.DateTime.YEAR:
+ clearInYear(date2);
+
+ var x = date2.getUTCFullYear();
+ date2.setUTCFullYear(x - (x % multiple));
+ break;
+ case SimileAjax.DateTime.DECADE:
+ clearInYear(date2);
+ date2.setUTCFullYear(Math.floor(date2.getUTCFullYear() / 10) * 10);
+ break;
+ case SimileAjax.DateTime.CENTURY:
+ clearInYear(date2);
+ date2.setUTCFullYear(Math.floor(date2.getUTCFullYear() / 100) * 100);
+ break;
+ case SimileAjax.DateTime.MILLENNIUM:
+ clearInYear(date2);
+ date2.setUTCFullYear(Math.floor(date2.getUTCFullYear() / 1000) * 1000);
+ break;
+ }
+
+ date.setTime(date2.getTime() - timeShift);
+};
+
+/**
+ * Rounds date objects up to the nearest interval or multiple of an interval.
+ * This method modifies the given date object, converting it to the given
+ * timezone if specified.
+ *
+ * @param {Date} date the date object to round
+ * @param {Number} intervalUnit a constant, integer index specifying an
+ * interval, e.g. SimileAjax.DateTime.HOUR
+ * @param {Number} timeZone a timezone shift, given in hours
+ * @param {Number} multiple a multiple of the interval to round by
+ * @param {Number} firstDayOfWeek an integer specifying the first day of the
+ * week, 0 corresponds to Sunday, 1 to Monday, etc.
+ * @see SimileAjax.DateTime.roundDownToInterval
+ */
+SimileAjax.DateTime.roundUpToInterval = function(date, intervalUnit, timeZone, multiple, firstDayOfWeek) {
+ var originalTime = date.getTime();
+ SimileAjax.DateTime.roundDownToInterval(date, intervalUnit, timeZone, multiple, firstDayOfWeek);
+ if (date.getTime() < originalTime) {
+ date.setTime(date.getTime() +
+ SimileAjax.DateTime.gregorianUnitLengths[intervalUnit] * multiple);
+ }
+};
+
+/**
+ * Increments a date object by a specified interval, taking into
+ * consideration the timezone.
+ *
+ * @param {Date} date the date object to increment
+ * @param {Number} intervalUnit a constant, integer index specifying an
+ * interval, e.g. SimileAjax.DateTime.HOUR
+ * @param {Number} timeZone the timezone offset in hours
+ */
+SimileAjax.DateTime.incrementByInterval = function(date, intervalUnit, timeZone) {
+ timeZone = (typeof timeZone == 'undefined') ? 0 : timeZone;
+
+ var timeShift = timeZone *
+ SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.HOUR];
+
+ var date2 = new Date(date.getTime() + timeShift);
+
+ switch(intervalUnit) {
+ case SimileAjax.DateTime.MILLISECOND:
+ date2.setTime(date2.getTime() + 1)
+ break;
+ case SimileAjax.DateTime.SECOND:
+ date2.setTime(date2.getTime() + 1000);
+ break;
+ case SimileAjax.DateTime.MINUTE:
+ date2.setTime(date2.getTime() +
+ SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.MINUTE]);
+ break;
+ case SimileAjax.DateTime.HOUR:
+ date2.setTime(date2.getTime() +
+ SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.HOUR]);
+ break;
+ case SimileAjax.DateTime.DAY:
+ date2.setUTCDate(date2.getUTCDate() + 1);
+ break;
+ case SimileAjax.DateTime.WEEK:
+ date2.setUTCDate(date2.getUTCDate() + 7);
+ break;
+ case SimileAjax.DateTime.MONTH:
+ date2.setUTCMonth(date2.getUTCMonth() + 1);
+ break;
+ case SimileAjax.DateTime.YEAR:
+ date2.setUTCFullYear(date2.getUTCFullYear() + 1);
+ break;
+ case SimileAjax.DateTime.DECADE:
+ date2.setUTCFullYear(date2.getUTCFullYear() + 10);
+ break;
+ case SimileAjax.DateTime.CENTURY:
+ date2.setUTCFullYear(date2.getUTCFullYear() + 100);
+ break;
+ case SimileAjax.DateTime.MILLENNIUM:
+ date2.setUTCFullYear(date2.getUTCFullYear() + 1000);
+ break;
+ }
+
+ date.setTime(date2.getTime() - timeShift);
+};
+
+/**
+ * Returns a new date object with the given time offset removed.
+ *
+ * @param {Date} date the starting date
+ * @param {Number} timeZone a timezone specified in an hour offset to remove
+ * @return {Date} a new date object with the offset removed
+ */
+SimileAjax.DateTime.removeTimeZoneOffset = function(date, timeZone) {
+ return new Date(date.getTime() +
+ timeZone * SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.HOUR]);
+};
+
+/**
+ * Returns the timezone of the user's browser.
+ *
+ * @return {Number} the timezone in the user's locale in hours
+ */
+SimileAjax.DateTime.getTimezone = function() {
+ var d = new Date().getTimezoneOffset();
+ return d / -60;
+};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/debug.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/debug.js
new file mode 100644
index 0000000..ae3f38d
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/debug.js
@@ -0,0 +1,94 @@
+/*==================================================
+ * Debug Utility Functions
+ *==================================================
+ */
+
+SimileAjax.Debug = {
+ silent: false
+};
+
+SimileAjax.Debug.log = function(msg) {
+ var f;
+ if ("console" in window && "log" in window.console) { // FireBug installed
+ f = function(msg2) {
+ console.log(msg2);
+ }
+ } else {
+ f = function(msg2) {
+ if (!SimileAjax.Debug.silent) {
+ alert(msg2);
+ }
+ }
+ }
+ SimileAjax.Debug.log = f;
+ f(msg);
+};
+
+SimileAjax.Debug.warn = function(msg) {
+ var f;
+ if ("console" in window && "warn" in window.console) { // FireBug installed
+ f = function(msg2) {
+ console.warn(msg2);
+ }
+ } else {
+ f = function(msg2) {
+ if (!SimileAjax.Debug.silent) {
+ alert(msg2);
+ }
+ }
+ }
+ SimileAjax.Debug.warn = f;
+ f(msg);
+};
+
+SimileAjax.Debug.exception = function(e, msg) {
+ var f, params = SimileAjax.parseURLParameters();
+ if (params.errors == "throw" || SimileAjax.params.errors == "throw") {
+ f = function(e2, msg2) {
+ throw(e2); // do not hide from browser's native debugging features
+ };
+ } else if ("console" in window && "error" in window.console) { // FireBug installed
+ f = function(e2, msg2) {
+ if (msg2 != null) {
+ console.error(msg2 + " %o", e2);
+ } else {
+ console.error(e2);
+ }
+ throw(e2); // do not hide from browser's native debugging features
+ };
+ } else {
+ f = function(e2, msg2) {
+ if (!SimileAjax.Debug.silent) {
+ alert("Caught exception: " + msg2 + "\n\nDetails: " + (e2));
+ }
+ throw(e2); // do not hide from browser's native debugging features
+ };
+ }
+ SimileAjax.Debug.exception = f;
+ f(e, msg);
+};
+
+SimileAjax.Debug.objectToString = function(o) {
+ return SimileAjax.Debug._objectToString(o, "");
+};
+
+SimileAjax.Debug._objectToString = function(o, indent) {
+ var indent2 = indent + " ";
+ if (typeof o == "object") {
+ var s = "{";
+ for (n in o) {
+ s += indent2 + n + ": " + SimileAjax.Debug._objectToString(o[n], indent2) + "\n";
+ }
+ s += indent + "}";
+ return s;
+ } else if (typeof o == "array") {
+ var s = "[";
+ for (var n = 0; n < o.length; n++) {
+ s += SimileAjax.Debug._objectToString(o[n], indent2) + "\n";
+ }
+ s += indent + "]";
+ return s;
+ } else {
+ return o;
+ }
+};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/dom.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/dom.js
new file mode 100644
index 0000000..c153a32
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/dom.js
@@ -0,0 +1,344 @@
+/*==================================================
+ * DOM Utility Functions
+ *==================================================
+ */
+
+SimileAjax.DOM = new Object();
+
+SimileAjax.DOM.registerEventWithObject = function(elmt, eventName, obj, handlerName) {
+ SimileAjax.DOM.registerEvent(elmt, eventName, function(elmt2, evt, target) {
+ return obj[handlerName].call(obj, elmt2, evt, target);
+ });
+};
+
+SimileAjax.DOM.registerEvent = function(elmt, eventName, handler) {
+ var handler2 = function(evt) {
+ evt = (evt) ? evt : ((event) ? event : null);
+ if (evt) {
+ var target = (evt.target) ?
+ evt.target : ((evt.srcElement) ? evt.srcElement : null);
+ if (target) {
+ target = (target.nodeType == 1 || target.nodeType == 9) ?
+ target : target.parentNode;
+ }
+
+ return handler(elmt, evt, target);
+ }
+ return true;
+ }
+
+ if (SimileAjax.Platform.browser.isIE) {
+ elmt.attachEvent("on" + eventName, handler2);
+ } else {
+ elmt.addEventListener(eventName, handler2, false);
+ }
+};
+
+SimileAjax.DOM.getPageCoordinates = function(elmt) {
+ var left = 0;
+ var top = 0;
+
+ if (elmt.nodeType != 1) {
+ elmt = elmt.parentNode;
+ }
+
+ var elmt2 = elmt;
+ while (elmt2 != null) {
+ left += elmt2.offsetLeft;
+ top += elmt2.offsetTop;
+ elmt2 = elmt2.offsetParent;
+ }
+
+ var body = document.body;
+ while (elmt != null && elmt != body) {
+ if ("scrollLeft" in elmt) {
+ left -= elmt.scrollLeft;
+ top -= elmt.scrollTop;
+ }
+ elmt = elmt.parentNode;
+ }
+
+ return { left: left, top: top };
+};
+
+SimileAjax.DOM.getSize = function(elmt) {
+ var w = this.getStyle(elmt,"width");
+ var h = this.getStyle(elmt,"height");
+ if (w.indexOf("px") > -1) w = w.replace("px","");
+ if (h.indexOf("px") > -1) h = h.replace("px","");
+ return {
+ w: w,
+ h: h
+ }
+}
+
+SimileAjax.DOM.getStyle = function(elmt, styleProp) {
+ if (elmt.currentStyle) { // IE
+ var style = elmt.currentStyle[styleProp];
+ } else if (window.getComputedStyle) { // standard DOM
+ var style = document.defaultView.getComputedStyle(elmt, null).getPropertyValue(styleProp);
+ } else {
+ var style = "";
+ }
+ return style;
+}
+
+SimileAjax.DOM.getEventRelativeCoordinates = function(evt, elmt) {
+ if (SimileAjax.Platform.browser.isIE) {
+ if (evt.type == "mousewheel") {
+ var coords = SimileAjax.DOM.getPageCoordinates(elmt);
+ return {
+ x: evt.clientX - coords.left,
+ y: evt.clientY - coords.top
+ };
+ } else {
+ return {
+ x: evt.offsetX,
+ y: evt.offsetY
+ };
+ }
+ } else {
+ var coords = SimileAjax.DOM.getPageCoordinates(elmt);
+
+ if ((evt.type == "DOMMouseScroll") &&
+ SimileAjax.Platform.browser.isFirefox &&
+ (SimileAjax.Platform.browser.majorVersion == 2)) {
+ // Due to: https://bugzilla.mozilla.org/show_bug.cgi?id=352179
+
+ return {
+ x: evt.screenX - coords.left,
+ y: evt.screenY - coords.top
+ };
+ } else {
+ return {
+ x: evt.pageX - coords.left,
+ y: evt.pageY - coords.top
+ };
+ }
+ }
+};
+
+SimileAjax.DOM.getEventPageCoordinates = function(evt) {
+ if (SimileAjax.Platform.browser.isIE) {
+ return {
+ x: evt.clientX + document.body.scrollLeft,
+ y: evt.clientY + document.body.scrollTop
+ };
+ } else {
+ return {
+ x: evt.pageX,
+ y: evt.pageY
+ };
+ }
+};
+
+SimileAjax.DOM.hittest = function(x, y, except) {
+ return SimileAjax.DOM._hittest(document.body, x, y, except);
+};
+
+SimileAjax.DOM._hittest = function(elmt, x, y, except) {
+ var childNodes = elmt.childNodes;
+ outer: for (var i = 0; i < childNodes.length; i++) {
+ var childNode = childNodes[i];
+ for (var j = 0; j < except.length; j++) {
+ if (childNode == except[j]) {
+ continue outer;
+ }
+ }
+
+ if (childNode.offsetWidth == 0 && childNode.offsetHeight == 0) {
+ /*
+ * Sometimes SPAN elements have zero width and height but
+ * they have children like DIVs that cover non-zero areas.
+ */
+ var hitNode = SimileAjax.DOM._hittest(childNode, x, y, except);
+ if (hitNode != childNode) {
+ return hitNode;
+ }
+ } else {
+ var top = 0;
+ var left = 0;
+
+ var node = childNode;
+ while (node) {
+ top += node.offsetTop;
+ left += node.offsetLeft;
+ node = node.offsetParent;
+ }
+
+ if (left <= x && top <= y && (x - left) < childNode.offsetWidth && (y - top) < childNode.offsetHeight) {
+ return SimileAjax.DOM._hittest(childNode, x, y, except);
+ } else if (childNode.nodeType == 1 && childNode.tagName == "TR") {
+ /*
+ * Table row might have cells that span several rows.
+ */
+ var childNode2 = SimileAjax.DOM._hittest(childNode, x, y, except);
+ if (childNode2 != childNode) {
+ return childNode2;
+ }
+ }
+ }
+ }
+ return elmt;
+};
+
+SimileAjax.DOM.cancelEvent = function(evt) {
+ evt.returnValue = false;
+ evt.cancelBubble = true;
+ if ("preventDefault" in evt) {
+ evt.preventDefault();
+ }
+};
+
+SimileAjax.DOM.appendClassName = function(elmt, className) {
+ var classes = elmt.className.split(" ");
+ for (var i = 0; i < classes.length; i++) {
+ if (classes[i] == className) {
+ return;
+ }
+ }
+ classes.push(className);
+ elmt.className = classes.join(" ");
+};
+
+SimileAjax.DOM.createInputElement = function(type) {
+ var div = document.createElement("div");
+ div.innerHTML = "<input type='" + type + "' />";
+
+ return div.firstChild;
+};
+
+SimileAjax.DOM.createDOMFromTemplate = function(template) {
+ var result = {};
+ result.elmt = SimileAjax.DOM._createDOMFromTemplate(template, result, null);
+
+ return result;
+};
+
+SimileAjax.DOM._createDOMFromTemplate = function(templateNode, result, parentElmt) {
+ if (templateNode == null) {
+ /*
+ var node = doc.createTextNode("--null--");
+ if (parentElmt != null) {
+ parentElmt.appendChild(node);
+ }
+ return node;
+ */
+ return null;
+ } else if (typeof templateNode != "object") {
+ var node = document.createTextNode(templateNode);
+ if (parentElmt != null) {
+ parentElmt.appendChild(node);
+ }
+ return node;
+ } else {
+ var elmt = null;
+ if ("tag" in templateNode) {
+ var tag = templateNode.tag;
+ if (parentElmt != null) {
+ if (tag == "tr") {
+ elmt = parentElmt.insertRow(parentElmt.rows.length);
+ } else if (tag == "td") {
+ elmt = parentElmt.insertCell(parentElmt.cells.length);
+ }
+ }
+ if (elmt == null) {
+ elmt = tag == "input" ?
+ SimileAjax.DOM.createInputElement(templateNode.type) :
+ document.createElement(tag);
+
+ if (parentElmt != null) {
+ parentElmt.appendChild(elmt);
+ }
+ }
+ } else {
+ elmt = templateNode.elmt;
+ if (parentElmt != null) {
+ parentElmt.appendChild(elmt);
+ }
+ }
+
+ for (var attribute in templateNode) {
+ var value = templateNode[attribute];
+
+ if (attribute == "field") {
+ result[value] = elmt;
+
+ } else if (attribute == "className") {
+ elmt.className = value;
+ } else if (attribute == "id") {
+ elmt.id = value;
+ } else if (attribute == "title") {
+ elmt.title = value;
+ } else if (attribute == "type" && elmt.tagName == "input") {
+ // do nothing
+ } else if (attribute == "style") {
+ for (n in value) {
+ var v = value[n];
+ if (n == "float") {
+ n = SimileAjax.Platform.browser.isIE ? "styleFloat" : "cssFloat";
+ }
+ elmt.style[n] = v;
+ }
+ } else if (attribute == "children") {
+ for (var i = 0; i < value.length; i++) {
+ SimileAjax.DOM._createDOMFromTemplate(value[i], result, elmt);
+ }
+ } else if (attribute != "tag" && attribute != "elmt") {
+ elmt.setAttribute(attribute, value);
+ }
+ }
+ return elmt;
+ }
+}
+
+SimileAjax.DOM._cachedParent = null;
+SimileAjax.DOM.createElementFromString = function(s) {
+ if (SimileAjax.DOM._cachedParent == null) {
+ SimileAjax.DOM._cachedParent = document.createElement("div");
+ }
+ SimileAjax.DOM._cachedParent.innerHTML = s;
+ return SimileAjax.DOM._cachedParent.firstChild;
+};
+
+SimileAjax.DOM.createDOMFromString = function(root, s, fieldElmts) {
+ var elmt = typeof root == "string" ? document.createElement(root) : root;
+ elmt.innerHTML = s;
+
+ var dom = { elmt: elmt };
+ SimileAjax.DOM._processDOMChildrenConstructedFromString(dom, elmt, fieldElmts != null ? fieldElmts : {} );
+
+ return dom;
+};
+
+SimileAjax.DOM._processDOMConstructedFromString = function(dom, elmt, fieldElmts) {
+ var id = elmt.id;
+ if (id != null && id.length > 0) {
+ elmt.removeAttribute("id");
+ if (id in fieldElmts) {
+ var parentElmt = elmt.parentNode;
+ parentElmt.insertBefore(fieldElmts[id], elmt);
+ parentElmt.removeChild(elmt);
+
+ dom[id] = fieldElmts[id];
+ return;
+ } else {
+ dom[id] = elmt;
+ }
+ }
+
+ if (elmt.hasChildNodes()) {
+ SimileAjax.DOM._processDOMChildrenConstructedFromString(dom, elmt, fieldElmts);
+ }
+};
+
+SimileAjax.DOM._processDOMChildrenConstructedFromString = function(dom, elmt, fieldElmts) {
+ var node = elmt.firstChild;
+ while (node != null) {
+ var node2 = node.nextSibling;
+ if (node.nodeType == 1) {
+ SimileAjax.DOM._processDOMConstructedFromString(dom, node, fieldElmts);
+ }
+ node = node2;
+ }
+};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/graphics.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/graphics.js
new file mode 100644
index 0000000..0177c22
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/graphics.js
@@ -0,0 +1,572 @@
+/**
+ * @fileOverview Graphics utility functions and constants
+ * @name SimileAjax.Graphics
+ */
+
+SimileAjax.Graphics = new Object();
+
+/**
+ * A boolean value indicating whether PNG translucency is supported on the
+ * user's browser or not.
+ *
+ * @type Boolean
+ */
+SimileAjax.Graphics.pngIsTranslucent = (!SimileAjax.Platform.browser.isIE) || (SimileAjax.Platform.browser.majorVersion > 6);
+
+/*==================================================
+ * Opacity, translucency
+ *==================================================
+ */
+SimileAjax.Graphics._createTranslucentImage1 = function(url, verticalAlign) {
+ var elmt = document.createElement("img");
+ elmt.setAttribute("src", url);
+ if (verticalAlign != null) {
+ elmt.style.verticalAlign = verticalAlign;
+ }
+ return elmt;
+};
+SimileAjax.Graphics._createTranslucentImage2 = function(url, verticalAlign) {
+ var elmt = document.createElement("img");
+ elmt.style.width = "1px"; // just so that IE will calculate the size property
+ elmt.style.height = "1px";
+ elmt.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + url +"', sizingMethod='image')";
+ elmt.style.verticalAlign = (verticalAlign != null) ? verticalAlign : "middle";
+ return elmt;
+};
+
+/**
+ * Creates a DOM element for an <code>img</code> tag using the URL given. This
+ * is a convenience method that automatically includes the necessary CSS to
+ * allow for translucency, even on IE.
+ *
+ * @function
+ * @param {String} url the URL to the image
+ * @param {String} verticalAlign the CSS value for the image's vertical-align
+ * @return {Element} a DOM element containing the <code>img</code> tag
+ */
+SimileAjax.Graphics.createTranslucentImage = SimileAjax.Graphics.pngIsTranslucent ?
+ SimileAjax.Graphics._createTranslucentImage1 :
+ SimileAjax.Graphics._createTranslucentImage2;
+
+SimileAjax.Graphics._createTranslucentImageHTML1 = function(url, verticalAlign) {
+ return "<img src=\"" + url + "\"" +
+ (verticalAlign != null ? " style=\"vertical-align: " + verticalAlign + ";\"" : "") +
+ " />";
+};
+SimileAjax.Graphics._createTranslucentImageHTML2 = function(url, verticalAlign) {
+ var style =
+ "width: 1px; height: 1px; " +
+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + url +"', sizingMethod='image');" +
+ (verticalAlign != null ? " vertical-align: " + verticalAlign + ";" : "");
+
+ return "<img src='" + url + "' style=\"" + style + "\" />";
+};
+
+/**
+ * Creates an HTML string for an <code>img</code> tag using the URL given.
+ * This is a convenience method that automatically includes the necessary CSS
+ * to allow for translucency, even on IE.
+ *
+ * @function
+ * @param {String} url the URL to the image
+ * @param {String} verticalAlign the CSS value for the image's vertical-align
+ * @return {String} a string containing the <code>img</code> tag
+ */
+SimileAjax.Graphics.createTranslucentImageHTML = SimileAjax.Graphics.pngIsTranslucent ?
+ SimileAjax.Graphics._createTranslucentImageHTML1 :
+ SimileAjax.Graphics._createTranslucentImageHTML2;
+
+/**
+ * Sets the opacity on the given DOM element.
+ *
+ * @param {Element} elmt the DOM element to set the opacity on
+ * @param {Number} opacity an integer from 0 to 100 specifying the opacity
+ */
+SimileAjax.Graphics.setOpacity = function(elmt, opacity) {
+ if (SimileAjax.Platform.browser.isIE) {
+ elmt.style.filter = "progid:DXImageTransform.Microsoft.Alpha(Style=0,Opacity=" + opacity + ")";
+ } else {
+ var o = (opacity / 100).toString();
+ elmt.style.opacity = o;
+ elmt.style.MozOpacity = o;
+ }
+};
+
+/*==================================================
+ * Bubble
+ *==================================================
+ */
+SimileAjax.Graphics._bubbleMargins = {
+ top: 33,
+ bottom: 42,
+ left: 33,
+ right: 40
+}
+
+// pixels from boundary of the whole bubble div to the tip of the arrow
+SimileAjax.Graphics._arrowOffsets = {
+ top: 0,
+ bottom: 9,
+ left: 1,
+ right: 8
+}
+
+SimileAjax.Graphics._bubblePadding = 15;
+SimileAjax.Graphics._bubblePointOffset = 6;
+SimileAjax.Graphics._halfArrowWidth = 18;
+
+/**
+ * Creates a nice, rounded bubble popup with the given content in a div,
+ * page coordinates and a suggested width. The bubble will point to the
+ * location on the page as described by pageX and pageY. All measurements
+ * should be given in pixels.
+ *
+ * @param {Element} the content div
+ * @param {Number} pageX the x coordinate of the point to point to
+ * @param {Number} pageY the y coordinate of the point to point to
+ * @param {Number} contentWidth a suggested width of the content
+ * @param {String} orientation a string ("top", "bottom", "left", or "right")
+ * that describes the orientation of the arrow on the bubble
+ */
+SimileAjax.Graphics.createBubbleForContentAndPoint = function(div, pageX, pageY, contentWidth, orientation) {
+ if (typeof contentWidth != "number") {
+ contentWidth = 300;
+ }
+
+ div.style.position = "absolute";
+ div.style.left = "-5000px";
+ div.style.top = "0px";
+ div.style.width = contentWidth + "px";
+ document.body.appendChild(div);
+
+ window.setTimeout(function() {
+ var width = div.scrollWidth + 10;
+ var height = div.scrollHeight + 10;
+
+ var bubble = SimileAjax.Graphics.createBubbleForPoint(pageX, pageY, width, height, orientation);
+
+ document.body.removeChild(div);
+ div.style.position = "static";
+ div.style.left = "";
+ div.style.top = "";
+ div.style.width = width + "px";
+ bubble.content.appendChild(div);
+ }, 200);
+};
+
+/**
+ * Creates a nice, rounded bubble popup with the given page coordinates and
+ * content dimensions. The bubble will point to the location on the page
+ * as described by pageX and pageY. All measurements should be given in
+ * pixels.
+ *
+ * @param {Number} pageX the x coordinate of the point to point to
+ * @param {Number} pageY the y coordinate of the point to point to
+ * @param {Number} contentWidth the width of the content box in the bubble
+ * @param {Number} contentHeight the height of the content box in the bubble
+ * @param {String} orientation a string ("top", "bottom", "left", or "right")
+ * that describes the orientation of the arrow on the bubble
+ * @return {Element} a DOM element for the newly created bubble
+ */
+SimileAjax.Graphics.createBubbleForPoint = function(pageX, pageY, contentWidth, contentHeight, orientation) {
+ function getWindowDims() {
+ if (typeof window.innerHeight == 'number') {
+ return { w:window.innerWidth, h:window.innerHeight }; // Non-IE
+ } else if (document.documentElement && document.documentElement.clientHeight) {
+ return { // IE6+, in "standards compliant mode"
+ w:document.documentElement.clientWidth,
+ h:document.documentElement.clientHeight
+ };
+ } else if (document.body && document.body.clientHeight) {
+ return { // IE 4 compatible
+ w:document.body.clientWidth,
+ h:document.body.clientHeight
+ };
+ }
+ }
+
+ var close = function() {
+ if (!bubble._closed) {
+ document.body.removeChild(bubble._div);
+ bubble._doc = null;
+ bubble._div = null;
+ bubble._content = null;
+ bubble._closed = true;
+ }
+ }
+ var bubble = {
+ _closed: false
+ };
+
+ var dims = getWindowDims();
+ var docWidth = dims.w;
+ var docHeight = dims.h;
+
+ var margins = SimileAjax.Graphics._bubbleMargins;
+ contentWidth = parseInt(contentWidth, 10); // harden against bad input bugs
+ contentHeight = parseInt(contentHeight, 10); // getting numbers-as-strings
+ var bubbleWidth = margins.left + contentWidth + margins.right;
+ var bubbleHeight = margins.top + contentHeight + margins.bottom;
+
+ var pngIsTranslucent = SimileAjax.Graphics.pngIsTranslucent;
+ var urlPrefix = SimileAjax.urlPrefix;
+
+ var setImg = function(elmt, url, width, height) {
+ elmt.style.position = "absolute";
+ elmt.style.width = width + "px";
+ elmt.style.height = height + "px";
+ if (pngIsTranslucent) {
+ elmt.style.background = "url(" + url + ")";
+ } else {
+ elmt.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + url +"', sizingMethod='crop')";
+ }
+ }
+ var div = document.createElement("div");
+ div.style.width = bubbleWidth + "px";
+ div.style.height = bubbleHeight + "px";
+ div.style.position = "absolute";
+ div.style.zIndex = 1000;
+
+ var layer = SimileAjax.WindowManager.pushLayer(close, true, div);
+ bubble._div = div;
+ bubble.close = function() { SimileAjax.WindowManager.popLayer(layer); }
+
+ var divInner = document.createElement("div");
+ divInner.style.width = "100%";
+ divInner.style.height = "100%";
+ divInner.style.position = "relative";
+ div.appendChild(divInner);
+
+ var createImg = function(url, left, top, width, height) {
+ var divImg = document.createElement("div");
+ divImg.style.left = left + "px";
+ divImg.style.top = top + "px";
+ setImg(divImg, url, width, height);
+ divInner.appendChild(divImg);
+ }
+
+ createImg(urlPrefix + "images/bubble-top-left.png", 0, 0, margins.left, margins.top);
+ createImg(urlPrefix + "images/bubble-top.png", margins.left, 0, contentWidth, margins.top);
+ createImg(urlPrefix + "images/bubble-top-right.png", margins.left + contentWidth, 0, margins.right, margins.top);
+
+ createImg(urlPrefix + "images/bubble-left.png", 0, margins.top, margins.left, contentHeight);
+ createImg(urlPrefix + "images/bubble-right.png", margins.left + contentWidth, margins.top, margins.right, contentHeight);
+
+ createImg(urlPrefix + "images/bubble-bottom-left.png", 0, margins.top + contentHeight, margins.left, margins.bottom);
+ createImg(urlPrefix + "images/bubble-bottom.png", margins.left, margins.top + contentHeight, contentWidth, margins.bottom);
+ createImg(urlPrefix + "images/bubble-bottom-right.png", margins.left + contentWidth, margins.top + contentHeight, margins.right, margins.bottom);
+
+ var divClose = document.createElement("div");
+ divClose.style.left = (bubbleWidth - margins.right + SimileAjax.Graphics._bubblePadding - 16 - 2) + "px";
+ divClose.style.top = (margins.top - SimileAjax.Graphics._bubblePadding + 1) + "px";
+ divClose.style.cursor = "pointer";
+ setImg(divClose, urlPrefix + "images/close-button.png", 16, 16);
+ SimileAjax.WindowManager.registerEventWithObject(divClose, "click", bubble, "close");
+ divInner.appendChild(divClose);
+
+ var divContent = document.createElement("div");
+ divContent.style.position = "absolute";
+ divContent.style.left = margins.left + "px";
+ divContent.style.top = margins.top + "px";
+ divContent.style.width = contentWidth + "px";
+ divContent.style.height = contentHeight + "px";
+ divContent.style.overflow = "auto";
+ divContent.style.background = "white";
+ divInner.appendChild(divContent);
+ bubble.content = divContent;
+
+ (function() {
+ if (pageX - SimileAjax.Graphics._halfArrowWidth - SimileAjax.Graphics._bubblePadding > 0 &&
+ pageX + SimileAjax.Graphics._halfArrowWidth + SimileAjax.Graphics._bubblePadding < docWidth) {
+
+ var left = pageX - Math.round(contentWidth / 2) - margins.left;
+ left = pageX < (docWidth / 2) ?
+ Math.max(left, -(margins.left - SimileAjax.Graphics._bubblePadding)) :
+ Math.min(left, docWidth + (margins.right - SimileAjax.Graphics._bubblePadding) - bubbleWidth);
+
+ if ((orientation && orientation == "top") || (!orientation && (pageY - SimileAjax.Graphics._bubblePointOffset - bubbleHeight > 0))) { // top
+ var divImg = document.createElement("div");
+
+ divImg.style.left = (pageX - SimileAjax.Graphics._halfArrowWidth - left) + "px";
+ divImg.style.top = (margins.top + contentHeight) + "px";
+ setImg(divImg, urlPrefix + "images/bubble-bottom-arrow.png", 37, margins.bottom);
+ divInner.appendChild(divImg);
+
+ div.style.left = left + "px";
+ div.style.top = (pageY - SimileAjax.Graphics._bubblePointOffset - bubbleHeight +
+ SimileAjax.Graphics._arrowOffsets.bottom) + "px";
+
+ return;
+ } else if ((orientation && orientation == "bottom") || (!orientation && (pageY + SimileAjax.Graphics._bubblePointOffset + bubbleHeight < docHeight))) { // bottom
+ var divImg = document.createElement("div");
+
+ divImg.style.left = (pageX - SimileAjax.Graphics._halfArrowWidth - left) + "px";
+ divImg.style.top = "0px";
+ setImg(divImg, urlPrefix + "images/bubble-top-arrow.png", 37, margins.top);
+ divInner.appendChild(divImg);
+
+ div.style.left = left + "px";
+ div.style.top = (pageY + SimileAjax.Graphics._bubblePointOffset -
+ SimileAjax.Graphics._arrowOffsets.top) + "px";
+
+ return;
+ }
+ }
+
+ var top = pageY - Math.round(contentHeight / 2) - margins.top;
+ top = pageY < (docHeight / 2) ?
+ Math.max(top, -(margins.top - SimileAjax.Graphics._bubblePadding)) :
+ Math.min(top, docHeight + (margins.bottom - SimileAjax.Graphics._bubblePadding) - bubbleHeight);
+
+ if ((orientation && orientation == "left") || (!orientation && (pageX - SimileAjax.Graphics._bubblePointOffset - bubbleWidth > 0))) { // left
+ var divImg = document.createElement("div");
+
+ divImg.style.left = (margins.left + contentWidth) + "px";
+ divImg.style.top = (pageY - SimileAjax.Graphics._halfArrowWidth - top) + "px";
+ setImg(divImg, urlPrefix + "images/bubble-right-arrow.png", margins.right, 37);
+ divInner.appendChild(divImg);
+
+ div.style.left = (pageX - SimileAjax.Graphics._bubblePointOffset - bubbleWidth +
+ SimileAjax.Graphics._arrowOffsets.right) + "px";
+ div.style.top = top + "px";
+ } else if ((orientation && orientation == "right") || (!orientation && (pageX - SimileAjax.Graphics._bubblePointOffset - bubbleWidth < docWidth))) { // right
+ var divImg = document.createElement("div");
+
+ divImg.style.left = "0px";
+ divImg.style.top = (pageY - SimileAjax.Graphics._halfArrowWidth - top) + "px";
+ setImg(divImg, urlPrefix + "images/bubble-left-arrow.png", margins.left, 37);
+ divInner.appendChild(divImg);
+
+ div.style.left = (pageX + SimileAjax.Graphics._bubblePointOffset -
+ SimileAjax.Graphics._arrowOffsets.left) + "px";
+ div.style.top = top + "px";
+ }
+ })();
+
+ document.body.appendChild(div);
+
+ return bubble;
+};
+
+/**
+ * Creates a floating, rounded message bubble in the center of the window for
+ * displaying modal information, e.g. "Loading..."
+ *
+ * @param {Document} doc the root document for the page to render on
+ * @param {Object} an object with two properties, contentDiv and containerDiv,
+ * consisting of the newly created DOM elements
+ */
+SimileAjax.Graphics.createMessageBubble = function(doc) {
+ var containerDiv = doc.createElement("div");
+ if (SimileAjax.Graphics.pngIsTranslucent) {
+ var topDiv = doc.createElement("div");
+ topDiv.style.height = "33px";
+ topDiv.style.background = "url(" + SimileAjax.urlPrefix + "images/message-top-left.png) top left no-repeat";
+ topDiv.style.paddingLeft = "44px";
+ containerDiv.appendChild(topDiv);
+
+ var topRightDiv = doc.createElement("div");
+ topRightDiv.style.height = "33px";
+ topRightDiv.style.background = "url(" + SimileAjax.urlPrefix + "images/message-top-right.png) top right no-repeat";
+ topDiv.appendChild(topRightDiv);
+
+ var middleDiv = doc.createElement("div");
+ middleDiv.style.background = "url(" + SimileAjax.urlPrefix + "images/message-left.png) top left repeat-y";
+ middleDiv.style.paddingLeft = "44px";
+ containerDiv.appendChild(middleDiv);
+
+ var middleRightDiv = doc.createElement("div");
+ middleRightDiv.style.background = "url(" + SimileAjax.urlPrefix + "images/message-right.png) top right repeat-y";
+ middleRightDiv.style.paddingRight = "44px";
+ middleDiv.appendChild(middleRightDiv);
+
+ var contentDiv = doc.createElement("div");
+ middleRightDiv.appendChild(contentDiv);
+
+ var bottomDiv = doc.createElement("div");
+ bottomDiv.style.height = "55px";
+ bottomDiv.style.background = "url(" + SimileAjax.urlPrefix + "images/message-bottom-left.png) bottom left no-repeat";
+ bottomDiv.style.paddingLeft = "44px";
+ containerDiv.appendChild(bottomDiv);
+
+ var bottomRightDiv = doc.createElement("div");
+ bottomRightDiv.style.height = "55px";
+ bottomRightDiv.style.background = "url(" + SimileAjax.urlPrefix + "images/message-bottom-right.png) bottom right no-repeat";
+ bottomDiv.appendChild(bottomRightDiv);
+ } else {
+ containerDiv.style.border = "2px solid #7777AA";
+ containerDiv.style.padding = "20px";
+ containerDiv.style.background = "white";
+ SimileAjax.Graphics.setOpacity(containerDiv, 90);
+
+ var contentDiv = doc.createElement("div");
+ containerDiv.appendChild(contentDiv);
+ }
+
+ return {
+ containerDiv: containerDiv,
+ contentDiv: contentDiv
+ };
+};
+
+/*==================================================
+ * Animation
+ *==================================================
+ */
+
+/**
+ * Creates an animation for a function, and an interval of values. The word
+ * "animation" here is used in the sense of repeatedly calling a function with
+ * a current value from within an interval, and a delta value.
+ *
+ * @param {Function} f a function to be called every 50 milliseconds throughout
+ * the animation duration, of the form f(current, delta), where current is
+ * the current value within the range and delta is the current change.
+ * @param {Number} from a starting value
+ * @param {Number} to an ending value
+ * @param {Number} duration the duration of the animation in milliseconds
+ * @param {Function} [cont] an optional function that is called at the end of
+ * the animation, i.e. a continuation.
+ * @return {SimileAjax.Graphics._Animation} a new animation object
+ */
+SimileAjax.Graphics.createAnimation = function(f, from, to, duration, cont) {
+ return new SimileAjax.Graphics._Animation(f, from, to, duration, cont);
+};
+
+SimileAjax.Graphics._Animation = function(f, from, to, duration, cont) {
+ this.f = f;
+ this.cont = (typeof cont == "function") ? cont : function() {};
+
+ this.from = from;
+ this.to = to;
+ this.current = from;
+
+ this.duration = duration;
+ this.start = new Date().getTime();
+ this.timePassed = 0;
+};
+
+/**
+ * Runs this animation.
+ */
+SimileAjax.Graphics._Animation.prototype.run = function() {
+ var a = this;
+ window.setTimeout(function() { a.step(); }, 50);
+};
+
+/**
+ * Increments this animation by one step, and then continues the animation with
+ * <code>run()</code>.
+ */
+SimileAjax.Graphics._Animation.prototype.step = function() {
+ this.timePassed += 50;
+
+ var timePassedFraction = this.timePassed / this.duration;
+ var parameterFraction = -Math.cos(timePassedFraction * Math.PI) / 2 + 0.5;
+ var current = parameterFraction * (this.to - this.from) + this.from;
+
+ try {
+ this.f(current, current - this.current);
+ } catch (e) {
+ }
+ this.current = current;
+
+ if (this.timePassed < this.duration) {
+ this.run();
+ } else {
+ this.f(this.to, 0);
+ this["cont"]();
+ }
+};
+
+/*==================================================
+ * CopyPasteButton
+ *
+ * Adapted from http://spaces.live.com/editorial/rayozzie/demo/liveclip/liveclipsample/tech….
+ *==================================================
+ */
+
+/**
+ * Creates a button and textarea for displaying structured data and copying it
+ * to the clipboard. The data is dynamically generated by the given
+ * createDataFunction parameter.
+ *
+ * @param {String} image an image URL to use as the background for the
+ * generated box
+ * @param {Number} width the width in pixels of the generated box
+ * @param {Number} height the height in pixels of the generated box
+ * @param {Function} createDataFunction a function that is called with no
+ * arguments to generate the structured data
+ * @return a new DOM element
+ */
+SimileAjax.Graphics.createStructuredDataCopyButton = function(image, width, height, createDataFunction) {
+ var div = document.createElement("div");
+ div.style.position = "relative";
+ div.style.display = "inline";
+ div.style.width = width + "px";
+ div.style.height = height + "px";
+ div.style.overflow = "hidden";
+ div.style.margin = "2px";
+
+ if (SimileAjax.Graphics.pngIsTranslucent) {
+ div.style.background = "url(" + image + ") no-repeat";
+ } else {
+ div.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + image +"', sizingMethod='image')";
+ }
+
+ var style;
+ if (SimileAjax.Platform.browser.isIE) {
+ style = "filter:alpha(opacity=0)";
+ } else {
+ style = "opacity: 0";
+ }
+ div.innerHTML = "<textarea rows='1' autocomplete='off' value='none' style='" + style + "' />";
+
+ var textarea = div.firstChild;
+ textarea.style.width = width + "px";
+ textarea.style.height = height + "px";
+ textarea.onmousedown = function(evt) {
+ evt = (evt) ? evt : ((event) ? event : null);
+ if (evt.button == 2) {
+ textarea.value = createDataFunction();
+ textarea.select();
+ }
+ };
+
+ return div;
+};
+
+SimileAjax.Graphics.getFontRenderingContext = function(elmt, width) {
+ return new SimileAjax.Graphics._FontRenderingContext(elmt, width);
+};
+
+SimileAjax.Graphics._FontRenderingContext = function(elmt, width) {
+ this._elmt = elmt;
+ this._elmt.style.visibility = "hidden";
+ if (typeof width == "string") {
+ this._elmt.style.width = width;
+ } else if (typeof width == "number") {
+ this._elmt.style.width = width + "px";
+ }
+};
+
+SimileAjax.Graphics._FontRenderingContext.prototype.dispose = function() {
+ this._elmt = null;
+};
+
+SimileAjax.Graphics._FontRenderingContext.prototype.update = function() {
+ this._elmt.innerHTML = "A";
+ this._lineHeight = this._elmt.offsetHeight;
+};
+
+SimileAjax.Graphics._FontRenderingContext.prototype.computeSize = function(text) {
+ this._elmt.innerHTML = text;
+ return {
+ width: this._elmt.offsetWidth,
+ height: this._elmt.offsetHeight
+ };
+};
+
+SimileAjax.Graphics._FontRenderingContext.prototype.getLineHeight = function() {
+ return this._lineHeight;
+};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/history.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/history.js
new file mode 100644
index 0000000..678b1ec
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/history.js
@@ -0,0 +1,220 @@
+/*======================================================================
+ * History
+ *
+ * This is a singleton that keeps track of undoable user actions and
+ * performs undos and redos in response to the browser's Back and
+ * Forward buttons.
+ *
+ * Call addAction(action) to register an undoable user action. action
+ * must have 4 fields:
+ *
+ * perform: an argument-less function that carries out the action
+ * undo: an argument-less function that undos the action
+ * label: a short, user-friendly string describing the action
+ * uiLayer: the UI layer on which the action takes place
+ *
+ * By default, the history keeps track of upto 10 actions. You can
+ * configure this behavior by setting
+ * SimileAjax.History.maxHistoryLength
+ * to a different number.
+ *
+ * An iframe is inserted into the document's body element to track
+ * onload events.
+ *======================================================================
+ */
+
+SimileAjax.History = {
+ maxHistoryLength: 10,
+ historyFile: "__history__.html",
+ enabled: true,
+
+ _initialized: false,
+ _listeners: new SimileAjax.ListenerQueue(),
+
+ _actions: [],
+ _baseIndex: 0,
+ _currentIndex: 0,
+
+ _plainDocumentTitle: document.title
+};
+
+SimileAjax.History.formatHistoryEntryTitle = function(actionLabel) {
+ return SimileAjax.History._plainDocumentTitle + " {" + actionLabel + "}";
+};
+
+SimileAjax.History.initialize = function() {
+ if (SimileAjax.History._initialized) {
+ return;
+ }
+
+ if (SimileAjax.History.enabled) {
+ var iframe = document.createElement("iframe");
+ iframe.id = "simile-ajax-history";
+ iframe.style.position = "absolute";
+ iframe.style.width = "10px";
+ iframe.style.height = "10px";
+ iframe.style.top = "0px";
+ iframe.style.left = "0px";
+ iframe.style.visibility = "hidden";
+ iframe.src = SimileAjax.History.historyFile + "?0";
+
+ document.body.appendChild(iframe);
+ SimileAjax.DOM.registerEvent(iframe, "load", SimileAjax.History._handleIFrameOnLoad);
+
+ SimileAjax.History._iframe = iframe;
+ }
+ SimileAjax.History._initialized = true;
+};
+
+SimileAjax.History.addListener = function(listener) {
+ SimileAjax.History.initialize();
+
+ SimileAjax.History._listeners.add(listener);
+};
+
+SimileAjax.History.removeListener = function(listener) {
+ SimileAjax.History.initialize();
+
+ SimileAjax.History._listeners.remove(listener);
+};
+
+SimileAjax.History.addAction = function(action) {
+ SimileAjax.History.initialize();
+
+ SimileAjax.History._listeners.fire("onBeforePerform", [ action ]);
+ window.setTimeout(function() {
+ try {
+ action.perform();
+ SimileAjax.History._listeners.fire("onAfterPerform", [ action ]);
+
+ if (SimileAjax.History.enabled) {
+ SimileAjax.History._actions = SimileAjax.History._actions.slice(
+ 0, SimileAjax.History._currentIndex - SimileAjax.History._baseIndex);
+
+ SimileAjax.History._actions.push(action);
+ SimileAjax.History._currentIndex++;
+
+ var diff = SimileAjax.History._actions.length - SimileAjax.History.maxHistoryLength;
+ if (diff > 0) {
+ SimileAjax.History._actions = SimileAjax.History._actions.slice(diff);
+ SimileAjax.History._baseIndex += diff;
+ }
+
+ try {
+ SimileAjax.History._iframe.contentWindow.location.search =
+ "?" + SimileAjax.History._currentIndex;
+ } catch (e) {
+ /*
+ * We can't modify location.search most probably because it's a file:// url.
+ * We'll just going to modify the document's title.
+ */
+ var title = SimileAjax.History.formatHistoryEntryTitle(action.label);
+ document.title = title;
+ }
+ }
+ } catch (e) {
+ SimileAjax.Debug.exception(e, "Error adding action {" + action.label + "} to history");
+ }
+ }, 0);
+};
+
+SimileAjax.History.addLengthyAction = function(perform, undo, label) {
+ SimileAjax.History.addAction({
+ perform: perform,
+ undo: undo,
+ label: label,
+ uiLayer: SimileAjax.WindowManager.getBaseLayer(),
+ lengthy: true
+ });
+};
+
+SimileAjax.History._handleIFrameOnLoad = function() {
+ /*
+ * This function is invoked when the user herself
+ * navigates backward or forward. We need to adjust
+ * the application's state accordingly.
+ */
+
+ try {
+ var q = SimileAjax.History._iframe.contentWindow.location.search;
+ var c = (q.length == 0) ? 0 : Math.max(0, parseInt(q.substr(1)));
+
+ var finishUp = function() {
+ var diff = c - SimileAjax.History._currentIndex;
+ SimileAjax.History._currentIndex += diff;
+ SimileAjax.History._baseIndex += diff;
+
+ SimileAjax.History._iframe.contentWindow.location.search = "?" + c;
+ };
+
+ if (c < SimileAjax.History._currentIndex) { // need to undo
+ SimileAjax.History._listeners.fire("onBeforeUndoSeveral", []);
+ window.setTimeout(function() {
+ while (SimileAjax.History._currentIndex > c &&
+ SimileAjax.History._currentIndex > SimileAjax.History._baseIndex) {
+
+ SimileAjax.History._currentIndex--;
+
+ var action = SimileAjax.History._actions[SimileAjax.History._currentIndex - SimileAjax.History._baseIndex];
+
+ try {
+ action.undo();
+ } catch (e) {
+ SimileAjax.Debug.exception(e, "History: Failed to undo action {" + action.label + "}");
+ }
+ }
+
+ SimileAjax.History._listeners.fire("onAfterUndoSeveral", []);
+ finishUp();
+ }, 0);
+ } else if (c > SimileAjax.History._currentIndex) { // need to redo
+ SimileAjax.History._listeners.fire("onBeforeRedoSeveral", []);
+ window.setTimeout(function() {
+ while (SimileAjax.History._currentIndex < c &&
+ SimileAjax.History._currentIndex - SimileAjax.History._baseIndex < SimileAjax.History._actions.length) {
+
+ var action = SimileAjax.History._actions[SimileAjax.History._currentIndex - SimileAjax.History._baseIndex];
+
+ try {
+ action.perform();
+ } catch (e) {
+ SimileAjax.Debug.exception(e, "History: Failed to redo action {" + action.label + "}");
+ }
+
+ SimileAjax.History._currentIndex++;
+ }
+
+ SimileAjax.History._listeners.fire("onAfterRedoSeveral", []);
+ finishUp();
+ }, 0);
+ } else {
+ var index = SimileAjax.History._currentIndex - SimileAjax.History._baseIndex - 1;
+ var title = (index >= 0 && index < SimileAjax.History._actions.length) ?
+ SimileAjax.History.formatHistoryEntryTitle(SimileAjax.History._actions[index].label) :
+ SimileAjax.History._plainDocumentTitle;
+
+ SimileAjax.History._iframe.contentWindow.document.title = title;
+ document.title = title;
+ }
+ } catch (e) {
+ // silent
+ }
+};
+
+SimileAjax.History.getNextUndoAction = function() {
+ try {
+ var index = SimileAjax.History._currentIndex - SimileAjax.History._baseIndex - 1;
+ return SimileAjax.History._actions[index];
+ } catch (e) {
+ return null;
+ }
+};
+
+SimileAjax.History.getNextRedoAction = function() {
+ try {
+ var index = SimileAjax.History._currentIndex - SimileAjax.History._baseIndex;
+ return SimileAjax.History._actions[index];
+ } catch (e) {
+ return null;
+ }
+};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/html.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/html.js
new file mode 100644
index 0000000..cedeb4a
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/html.js
@@ -0,0 +1,274 @@
+/*==================================================
+ * HTML Utility Functions
+ *==================================================
+ */
+
+SimileAjax.HTML = new Object();
+
+SimileAjax.HTML._e2uHash = {};
+(function() {
+ var e2uHash = SimileAjax.HTML._e2uHash;
+ e2uHash['nbsp']= '\u00A0[space]';
+ e2uHash['iexcl']= '\u00A1';
+ e2uHash['cent']= '\u00A2';
+ e2uHash['pound']= '\u00A3';
+ e2uHash['curren']= '\u00A4';
+ e2uHash['yen']= '\u00A5';
+ e2uHash['brvbar']= '\u00A6';
+ e2uHash['sect']= '\u00A7';
+ e2uHash['uml']= '\u00A8';
+ e2uHash['copy']= '\u00A9';
+ e2uHash['ordf']= '\u00AA';
+ e2uHash['laquo']= '\u00AB';
+ e2uHash['not']= '\u00AC';
+ e2uHash['shy']= '\u00AD';
+ e2uHash['reg']= '\u00AE';
+ e2uHash['macr']= '\u00AF';
+ e2uHash['deg']= '\u00B0';
+ e2uHash['plusmn']= '\u00B1';
+ e2uHash['sup2']= '\u00B2';
+ e2uHash['sup3']= '\u00B3';
+ e2uHash['acute']= '\u00B4';
+ e2uHash['micro']= '\u00B5';
+ e2uHash['para']= '\u00B6';
+ e2uHash['middot']= '\u00B7';
+ e2uHash['cedil']= '\u00B8';
+ e2uHash['sup1']= '\u00B9';
+ e2uHash['ordm']= '\u00BA';
+ e2uHash['raquo']= '\u00BB';
+ e2uHash['frac14']= '\u00BC';
+ e2uHash['frac12']= '\u00BD';
+ e2uHash['frac34']= '\u00BE';
+ e2uHash['iquest']= '\u00BF';
+ e2uHash['Agrave']= '\u00C0';
+ e2uHash['Aacute']= '\u00C1';
+ e2uHash['Acirc']= '\u00C2';
+ e2uHash['Atilde']= '\u00C3';
+ e2uHash['Auml']= '\u00C4';
+ e2uHash['Aring']= '\u00C5';
+ e2uHash['AElig']= '\u00C6';
+ e2uHash['Ccedil']= '\u00C7';
+ e2uHash['Egrave']= '\u00C8';
+ e2uHash['Eacute']= '\u00C9';
+ e2uHash['Ecirc']= '\u00CA';
+ e2uHash['Euml']= '\u00CB';
+ e2uHash['Igrave']= '\u00CC';
+ e2uHash['Iacute']= '\u00CD';
+ e2uHash['Icirc']= '\u00CE';
+ e2uHash['Iuml']= '\u00CF';
+ e2uHash['ETH']= '\u00D0';
+ e2uHash['Ntilde']= '\u00D1';
+ e2uHash['Ograve']= '\u00D2';
+ e2uHash['Oacute']= '\u00D3';
+ e2uHash['Ocirc']= '\u00D4';
+ e2uHash['Otilde']= '\u00D5';
+ e2uHash['Ouml']= '\u00D6';
+ e2uHash['times']= '\u00D7';
+ e2uHash['Oslash']= '\u00D8';
+ e2uHash['Ugrave']= '\u00D9';
+ e2uHash['Uacute']= '\u00DA';
+ e2uHash['Ucirc']= '\u00DB';
+ e2uHash['Uuml']= '\u00DC';
+ e2uHash['Yacute']= '\u00DD';
+ e2uHash['THORN']= '\u00DE';
+ e2uHash['szlig']= '\u00DF';
+ e2uHash['agrave']= '\u00E0';
+ e2uHash['aacute']= '\u00E1';
+ e2uHash['acirc']= '\u00E2';
+ e2uHash['atilde']= '\u00E3';
+ e2uHash['auml']= '\u00E4';
+ e2uHash['aring']= '\u00E5';
+ e2uHash['aelig']= '\u00E6';
+ e2uHash['ccedil']= '\u00E7';
+ e2uHash['egrave']= '\u00E8';
+ e2uHash['eacute']= '\u00E9';
+ e2uHash['ecirc']= '\u00EA';
+ e2uHash['euml']= '\u00EB';
+ e2uHash['igrave']= '\u00EC';
+ e2uHash['iacute']= '\u00ED';
+ e2uHash['icirc']= '\u00EE';
+ e2uHash['iuml']= '\u00EF';
+ e2uHash['eth']= '\u00F0';
+ e2uHash['ntilde']= '\u00F1';
+ e2uHash['ograve']= '\u00F2';
+ e2uHash['oacute']= '\u00F3';
+ e2uHash['ocirc']= '\u00F4';
+ e2uHash['otilde']= '\u00F5';
+ e2uHash['ouml']= '\u00F6';
+ e2uHash['divide']= '\u00F7';
+ e2uHash['oslash']= '\u00F8';
+ e2uHash['ugrave']= '\u00F9';
+ e2uHash['uacute']= '\u00FA';
+ e2uHash['ucirc']= '\u00FB';
+ e2uHash['uuml']= '\u00FC';
+ e2uHash['yacute']= '\u00FD';
+ e2uHash['thorn']= '\u00FE';
+ e2uHash['yuml']= '\u00FF';
+ e2uHash['quot']= '\u0022';
+ e2uHash['amp']= '\u0026';
+ e2uHash['lt']= '\u003C';
+ e2uHash['gt']= '\u003E';
+ e2uHash['OElig']= '';
+ e2uHash['oelig']= '\u0153';
+ e2uHash['Scaron']= '\u0160';
+ e2uHash['scaron']= '\u0161';
+ e2uHash['Yuml']= '\u0178';
+ e2uHash['circ']= '\u02C6';
+ e2uHash['tilde']= '\u02DC';
+ e2uHash['ensp']= '\u2002';
+ e2uHash['emsp']= '\u2003';
+ e2uHash['thinsp']= '\u2009';
+ e2uHash['zwnj']= '\u200C';
+ e2uHash['zwj']= '\u200D';
+ e2uHash['lrm']= '\u200E';
+ e2uHash['rlm']= '\u200F';
+ e2uHash['ndash']= '\u2013';
+ e2uHash['mdash']= '\u2014';
+ e2uHash['lsquo']= '\u2018';
+ e2uHash['rsquo']= '\u2019';
+ e2uHash['sbquo']= '\u201A';
+ e2uHash['ldquo']= '\u201C';
+ e2uHash['rdquo']= '\u201D';
+ e2uHash['bdquo']= '\u201E';
+ e2uHash['dagger']= '\u2020';
+ e2uHash['Dagger']= '\u2021';
+ e2uHash['permil']= '\u2030';
+ e2uHash['lsaquo']= '\u2039';
+ e2uHash['rsaquo']= '\u203A';
+ e2uHash['euro']= '\u20AC';
+ e2uHash['fnof']= '\u0192';
+ e2uHash['Alpha']= '\u0391';
+ e2uHash['Beta']= '\u0392';
+ e2uHash['Gamma']= '\u0393';
+ e2uHash['Delta']= '\u0394';
+ e2uHash['Epsilon']= '\u0395';
+ e2uHash['Zeta']= '\u0396';
+ e2uHash['Eta']= '\u0397';
+ e2uHash['Theta']= '\u0398';
+ e2uHash['Iota']= '\u0399';
+ e2uHash['Kappa']= '\u039A';
+ e2uHash['Lambda']= '\u039B';
+ e2uHash['Mu']= '\u039C';
+ e2uHash['Nu']= '\u039D';
+ e2uHash['Xi']= '\u039E';
+ e2uHash['Omicron']= '\u039F';
+ e2uHash['Pi']= '\u03A0';
+ e2uHash['Rho']= '\u03A1';
+ e2uHash['Sigma']= '\u03A3';
+ e2uHash['Tau']= '\u03A4';
+ e2uHash['Upsilon']= '\u03A5';
+ e2uHash['Phi']= '\u03A6';
+ e2uHash['Chi']= '\u03A7';
+ e2uHash['Psi']= '\u03A8';
+ e2uHash['Omega']= '\u03A9';
+ e2uHash['alpha']= '\u03B1';
+ e2uHash['beta']= '\u03B2';
+ e2uHash['gamma']= '\u03B3';
+ e2uHash['delta']= '\u03B4';
+ e2uHash['epsilon']= '\u03B5';
+ e2uHash['zeta']= '\u03B6';
+ e2uHash['eta']= '\u03B7';
+ e2uHash['theta']= '\u03B8';
+ e2uHash['iota']= '\u03B9';
+ e2uHash['kappa']= '\u03BA';
+ e2uHash['lambda']= '\u03BB';
+ e2uHash['mu']= '\u03BC';
+ e2uHash['nu']= '\u03BD';
+ e2uHash['xi']= '\u03BE';
+ e2uHash['omicron']= '\u03BF';
+ e2uHash['pi']= '\u03C0';
+ e2uHash['rho']= '\u03C1';
+ e2uHash['sigmaf']= '\u03C2';
+ e2uHash['sigma']= '\u03C3';
+ e2uHash['tau']= '\u03C4';
+ e2uHash['upsilon']= '\u03C5';
+ e2uHash['phi']= '\u03C6';
+ e2uHash['chi']= '\u03C7';
+ e2uHash['psi']= '\u03C8';
+ e2uHash['omega']= '\u03C9';
+ e2uHash['thetasym']= '\u03D1';
+ e2uHash['upsih']= '\u03D2';
+ e2uHash['piv']= '\u03D6';
+ e2uHash['bull']= '\u2022';
+ e2uHash['hellip']= '\u2026';
+ e2uHash['prime']= '\u2032';
+ e2uHash['Prime']= '\u2033';
+ e2uHash['oline']= '\u203E';
+ e2uHash['frasl']= '\u2044';
+ e2uHash['weierp']= '\u2118';
+ e2uHash['image']= '\u2111';
+ e2uHash['real']= '\u211C';
+ e2uHash['trade']= '\u2122';
+ e2uHash['alefsym']= '\u2135';
+ e2uHash['larr']= '\u2190';
+ e2uHash['uarr']= '\u2191';
+ e2uHash['rarr']= '\u2192';
+ e2uHash['darr']= '\u2193';
+ e2uHash['harr']= '\u2194';
+ e2uHash['crarr']= '\u21B5';
+ e2uHash['lArr']= '\u21D0';
+ e2uHash['uArr']= '\u21D1';
+ e2uHash['rArr']= '\u21D2';
+ e2uHash['dArr']= '\u21D3';
+ e2uHash['hArr']= '\u21D4';
+ e2uHash['forall']= '\u2200';
+ e2uHash['part']= '\u2202';
+ e2uHash['exist']= '\u2203';
+ e2uHash['empty']= '\u2205';
+ e2uHash['nabla']= '\u2207';
+ e2uHash['isin']= '\u2208';
+ e2uHash['notin']= '\u2209';
+ e2uHash['ni']= '\u220B';
+ e2uHash['prod']= '\u220F';
+ e2uHash['sum']= '\u2211';
+ e2uHash['minus']= '\u2212';
+ e2uHash['lowast']= '\u2217';
+ e2uHash['radic']= '\u221A';
+ e2uHash['prop']= '\u221D';
+ e2uHash['infin']= '\u221E';
+ e2uHash['ang']= '\u2220';
+ e2uHash['and']= '\u2227';
+ e2uHash['or']= '\u2228';
+ e2uHash['cap']= '\u2229';
+ e2uHash['cup']= '\u222A';
+ e2uHash['int']= '\u222B';
+ e2uHash['there4']= '\u2234';
+ e2uHash['sim']= '\u223C';
+ e2uHash['cong']= '\u2245';
+ e2uHash['asymp']= '\u2248';
+ e2uHash['ne']= '\u2260';
+ e2uHash['equiv']= '\u2261';
+ e2uHash['le']= '\u2264';
+ e2uHash['ge']= '\u2265';
+ e2uHash['sub']= '\u2282';
+ e2uHash['sup']= '\u2283';
+ e2uHash['nsub']= '\u2284';
+ e2uHash['sube']= '\u2286';
+ e2uHash['supe']= '\u2287';
+ e2uHash['oplus']= '\u2295';
+ e2uHash['otimes']= '\u2297';
+ e2uHash['perp']= '\u22A5';
+ e2uHash['sdot']= '\u22C5';
+ e2uHash['lceil']= '\u2308';
+ e2uHash['rceil']= '\u2309';
+ e2uHash['lfloor']= '\u230A';
+ e2uHash['rfloor']= '\u230B';
+ e2uHash['lang']= '\u2329';
+ e2uHash['rang']= '\u232A';
+ e2uHash['loz']= '\u25CA';
+ e2uHash['spades']= '\u2660';
+ e2uHash['clubs']= '\u2663';
+ e2uHash['hearts']= '\u2665';
+ e2uHash['diams']= '\u2666';
+})();
+
+SimileAjax.HTML.deEntify = function(s) {
+ var e2uHash = SimileAjax.HTML._e2uHash;
+
+ var re = /&(\w+?);/;
+ while (re.test(s)) {
+ var m = s.match(re);
+ s = s.replace(re, e2uHash[m[1]]);
+ }
+ return s;
+};
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/jquery-1.2.3.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/jquery-1.2.3.js
new file mode 100644
index 0000000..e849d03
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/jquery-1.2.3.js
@@ -0,0 +1,32 @@
+/*
+ * jQuery 1.2.3 - New Wave Javascript
+ *
+ * Copyright (c) 2008 John Resig (jquery.com)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * $Date: 2008-02-06 00:21:25 -0500 (Wed, 06 Feb 2008) $
+ * $Rev: 4663 $
+ */
+(function(){if(window.jQuery)var _jQuery=window.jQuery;var jQuery=window.jQuery=function(selector,context){return new jQuery.prototype.init(selector,context);};if(window.$)var _$=window.$;window.$=jQuery;var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/;var isSimple=/^.[^:#\[\.]*$/;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}else if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem)if(elem.id!=match[3])return jQuery().find(selector);else{this[0]=elem;this.length=1;return this;}else
+selector=[];}}else
+return new jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return new jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(selector.constructor==Array&&selector||(selector.jquery||selector.length&&selector!=window&&!selector.nodeType&&selector[0]!=undefined&&selector[0].nodeType)&&jQuery.makeArray(selector)||[selector]);},jquery:"1.2.3",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;this.each(function(i){if(this==elem)ret=i;});return ret;},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value==undefined)return this.length&&jQuery[type||"attr"](this[0],name)||undefined;else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else
+return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else
+selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return!selector?this:this.pushStack(jQuery.merge(this.get(),selector.constructor==String?jQuery(selector).get():selector.length!=undefined&&(!selector.nodeName||jQuery.nodeName(selector,"form"))?selector:[selector]));},is:function(selector){return selector?jQuery.multiFilter(selector,this).length>0:false;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one)return value;values.push(value);}}return values;}else
+return(this[0].value||"").replace(/\r/g,"");}return undefined;}return this.each(function(){if(this.nodeType!=1)return;if(value.constructor==Array&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=value.constructor==Array?value:[value];jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else
+this.value=value;});},html:function(value){return value==undefined?(this.length?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value==null){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data==undefined&&this.length)data=jQuery.data(this[0],key);return data==null&&parts[1]?this.data(parts[0]):data;}else
+return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script")){scripts=scripts.add(elem);}else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.prototype.init.prototype=jQuery.prototype;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else
+jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==1){target=this;i=0;}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){if(target===options[name])continue;if(deep&&options[name]&&typeof options[name]=="object"&&target[name]&&!options[name].nodeType)target[name]=jQuery.extend(target[name],options[name]);else if(options[name]!=undefined)target[name]=options[name];}return target;};var expando="jQuery"+(new Date()).getTime(),uuid=0,windowData={};var exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i;jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery;},isFunction:function(fn){return!!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/function/i.test(fn+"");},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body;},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)script.text=data;else
+script.appendChild(document.createTextNode(data));head.appendChild(script);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])jQuery.cache[id]={};if(data!=undefined)jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])break;if(!name)jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)elem.removeAttribute(expando);}delete jQuery.cache[id];}},each:function(object,callback,args){if(args){if(object.length==undefined){for(var name in object)if(callback.apply(object[name],args)===false)break;}else
+for(var i=0,length=object.length;i<length;i++)if(callback.apply(object[i],args)===false)break;}else{if(object.length==undefined){for(var name in object)if(callback.call(object[name],name,object[name])===false)break;}else
+for(var i=0,length=object.length,value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))value=value.call(elem,i);return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else
+jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret;function color(elem){if(!jQuery.browser.safari)return false;var ret=document.defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(elem.style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=elem.style.outline;elem.style.outline="0 solid black";elem.style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&elem.style&&elem.style[name])ret=elem.style[name];else if(document.defaultView&&document.defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var getComputedStyle=document.defaultView.getComputedStyle(elem,null);if(getComputedStyle&&!color(elem))ret=getComputedStyle.getPropertyValue(name);else{var swap=[],stack=[];for(var a=elem;a&&color(a);a=a.parentNode)stack.unshift(a);for(var i=0;i<stack.length;i++)if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}ret=name=="display"&&swap[stack.length-1]!=null?"none":(getComputedStyle&&getComputedStyle.getPropertyValue(name))||"";for(var i=0;i<swap.length;i++)if(swap[i]!=null)stack[i].style.display=swap[i];}if(name=="opacity"&&ret=="")ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var style=elem.style.left,runtimeStyle=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;elem.style.left=ret||0;ret=elem.style.pixelLeft+"px";elem.style.left=style;elem.runtimeStyle.left=runtimeStyle;}}return ret;},clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=='undefined')context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;jQuery.each(elems,function(i,elem){if(!elem)return;if(elem.constructor==Number)elem=elem.toString();if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else
+ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var fix=jQuery.isXMLDoc(elem)?{}:jQuery.props;if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(fix[name]){if(value!=undefined)elem[fix[name]]=value;return elem[fix[name]];}else if(jQuery.browser.msie&&name=="style")return jQuery.attr(elem.style,"cssText",value);else if(value==undefined&&jQuery.browser.msie&&jQuery.nodeName(elem,"form")&&(name=="action"||name=="method"))return elem.getAttributeNode(name).nodeValue;else if(elem.tagName){if(value!=undefined){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem.setAttribute(name,""+value);}if(jQuery.browser.msie&&/href|src/.test(name)&&!jQuery.isXMLDoc(elem))return elem.getAttribute(name,2);return elem.getAttribute(name);}else{if(name=="opacity"&&jQuery.browser.msie){if(value!=undefined){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseFloat(value).toString()=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100).toString():"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(value!=undefined)elem[name]=value;return elem[name];}},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(typeof array!="array")for(var i=0,length=array.length;i<length;i++)ret.push(array[i]);else
+ret=array.slice(0);return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)if(array[i]==elem)return i;return-1;},merge:function(first,second){if(jQuery.browser.msie){for(var i=0;second[i];i++)if(second[i].nodeType!=8)first.push(second[i]);}else
+for(var i=0;second[i];i++)first.push(second[i]);return first;},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}return ret;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++)if(!inv&&callback(elems[i],i)||inv&&!callback(elems[i],i))ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!==null&&value!=undefined){if(value.constructor!=Array)value=[value];ret=ret.concat(value);}}return ret;}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,innerHTML:"innerHTML",className:"className",value:"value",disabled:"disabled",checked:"checked",readonly:"readOnly",selected:"selected",maxlength:"maxLength",selectedIndex:"selectedIndex",defaultValue:"defaultValue",tagName:"tagName",nodeName:"nodeName"}});jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)jQuery(args[i])[original](this);});};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)this.parentNode.removeChild(this);}},empty:function(){jQuery(">*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return i<m[3]-0;},gt:function(a,i,m){return i>m[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[new RegExp("^(\[) *@?([\w-]+) *([!*$^~=]*) *('?\"?)(.*?)\4 *\]"),new RegExp("^(:)([\w-]+)\(\"?'?(.*?(\(.*?\))?[^(]*?)\"?'?\)"),new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false;var re=quickChild;var m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id])break;if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~")merge[id]=true;r.push(n);}if(m=="+")break;}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])oid=jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object")tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}if(m[1]==".")r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++)if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break;}r=tmp;}ret=r;}t=t.replace(re2,"");}}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}if(t)ret=[];if(ret&&context==ret[0])ret.shift();done=jQuery.merge(done,ret);return done;},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2]))z=jQuery.attr(a,m[2])||'';if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)if(n.nodeType==1)n.nodeIndex=c++;merge[id]=true;}var add=false;if(first==0){if(node.nodeIndex==last)add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[];var cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&(!elem||n!=elem))r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval!=undefined)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=function(){return fn.apply(this,arguments);};handler.data=data;handler.guid=fn.guid;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){var val;if(typeof jQuery=="undefined"||jQuery.event.triggered)return val;val=jQuery.event.handle.apply(arguments.callee.elem,arguments);return val;});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else
+for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data||[]);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event)data.unshift(this.fix({type:type,target:elem}));data[0].type=type;if(exclusive)data[0].exclusive=true;if(jQuery.isFunction(jQuery.data(elem,"handle")))val=jQuery.data(elem,"handle").apply(elem,data);if(!fn&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val;event=jQuery.event.fix(event||window.event||{});var parts=event.type.split(".");event.type=parts[0];var handlers=jQuery.data(this,"events")&&jQuery.data(this,"events")[event.type],args=Array.prototype.slice.call(arguments,1);args.unshift(event);for(var j in handlers){var handler=handlers[j];args[0].handler=handler;args[0].data=handler.data;if(!parts[1]&&!event.exclusive||handler.type==parts[1]){var ret=handler.apply(this,args);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}if(jQuery.browser.msie)event.target=event.preventDefault=event.stopPropagation=event.handler=event.data=null;return val;},fix:function(event){var originalEvent=event;event=jQuery.extend({},originalEvent);event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=originalEvent.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;arguments[0].type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;arguments[0].type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){return this.each(function(){jQuery.event.add(this,type,function(event){jQuery(this).unbind(event);return(fn||data).apply(this,arguments);},fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){if(this[0])return jQuery.event.trigger(type,data,this[0],false,fn);return undefined;},toggle:function(){var args=arguments;return this.click(function(event){this.lastToggle=0==this.lastToggle?1:0;event.preventDefault();return args[this.lastToggle].apply(this,arguments)||false;});},hover:function(fnOver,fnOut){return this.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else
+jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.apply(document);});jQuery.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<document.styleSheets.length;i++)if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(numStyles===undefined)numStyles=jQuery("style, link[rel=stylesheet]").length;if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return;}jQuery.ready();})();}jQuery.event.add(window,"load",jQuery.ready);}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,select,"+"submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=parent.parentNode;}catch(error){parent=elem;}return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});jQuery.fn.extend({load:function(url,params,callback){if(jQuery.isFunction(url))return this.bind("load",url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=(new Date).getTime();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){var jsonp,jsre=/=\?(&|$)/g,status,data;s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(s.type.toLowerCase()=="get"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&s.type.toLowerCase()=="get"){var ts=(new Date()).getTime();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&s.type.toLowerCase()=="get"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");if((!s.url.indexOf("http")||!s.url.indexOf("//"))&&s.dataType=="script"&&s.type.toLowerCase()=="get"){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xml=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();xml.open(s.type,s.url,s.async,s.username,s.password);try{if(s.data)xml.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xml.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xml.setRequestHeader("X-Requested-With","XMLHttpRequest");xml.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend)s.beforeSend(xml);if(s.global)jQuery.event.trigger("ajaxSend",[xml,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xml&&(xml.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xml)&&"error"||s.ifModified&&jQuery.httpNotModified(xml,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xml,s.dataType);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xml.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else
+jQuery.handleError(s,xml,status);complete();if(s.async)xml=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xml){xml.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xml.send(s.data);}catch(e){jQuery.handleError(s,xml,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xml,s]);}function complete(){if(s.complete)s.complete(xml,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xml,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xml;},handleError:function(s,xml,status,e){if(s.error)s.error(xml,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xml,s,e]);},active:0,httpSuccess:function(r){try{return!r.status&&location.protocol=="file:"||(r.status>=200&&r.status<300)||r.status==304||r.status==1223||jQuery.browser.safari&&r.status==undefined;}catch(e){}return false;},httpNotModified:function(xml,url){try{var xmlRes=xml.getResponseHeader("Last-Modified");return xml.status==304||xmlRes==jQuery.lastModified[url]||jQuery.browser.safari&&xml.status==undefined;}catch(e){}return false;},httpData:function(r,type){var ct=r.getResponseHeader("content-type");var xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0;var data=xml?r.responseXML:r.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else
+for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else
+s.push(encodeURIComponent(j)+"="+encodeURIComponent(a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle(fn,fn2):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall);var hidden=jQuery(this).is(":hidden"),self=this;for(var p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return jQuery.isFunction(opt.complete)&&opt.complete.apply(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else
+e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.apply(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(!elem)return undefined;type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",array?jQuery.makeArray(array):[]);return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].apply(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:{slow:600,fast:200}[opt.duration])||400;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.apply(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.apply(this.elem,[this.now,this]);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=(new Date()).getTime();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)if(!timers[i]())timers.splice(i--,1);if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height")this.elem.style[this.prop]="1px";jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=(new Date()).getTime();if(gotoEnd||t>this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done&&jQuery.isFunction(this.options.complete))this.options.complete.apply(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.fx.step={scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}};jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),fixed=jQuery.css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&jQuery.css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(jQuery.css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&jQuery.css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||jQuery.css(offsetChild,"position")=="absolute"))||(mozilla&&jQuery.css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l)||0;top+=parseInt(t)||0;}return results;};})();
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/json.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/json.js
new file mode 100644
index 0000000..ef6dc30
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/json.js
@@ -0,0 +1,129 @@
+/*
+ * Copied directly from http://www.json.org/json.js.
+ */
+
+/*
+ json.js
+ 2006-04-28
+
+ This file adds these methods to JavaScript:
+
+ object.toJSONString()
+
+ This method produces a JSON text from an object. The
+ object must not contain any cyclical references.
+
+ array.toJSONString()
+
+ This method produces a JSON text from an array. The
+ array must not contain any cyclical references.
+
+ string.parseJSON()
+
+ This method parses a JSON text to produce an object or
+ array. It will return false if there is an error.
+*/
+
+SimileAjax.JSON = new Object();
+
+(function () {
+ var m = {
+ '\b': '\\b',
+ '\t': '\\t',
+ '\n': '\\n',
+ '\f': '\\f',
+ '\r': '\\r',
+ '"' : '\\"',
+ '\\': '\\\\'
+ };
+ var s = {
+ array: function (x) {
+ var a = ['['], b, f, i, l = x.length, v;
+ for (i = 0; i < l; i += 1) {
+ v = x[i];
+ f = s[typeof v];
+ if (f) {
+ v = f(v);
+ if (typeof v == 'string') {
+ if (b) {
+ a[a.length] = ',';
+ }
+ a[a.length] = v;
+ b = true;
+ }
+ }
+ }
+ a[a.length] = ']';
+ return a.join('');
+ },
+ 'boolean': function (x) {
+ return String(x);
+ },
+ 'null': function (x) {
+ return "null";
+ },
+ number: function (x) {
+ return isFinite(x) ? String(x) : 'null';
+ },
+ object: function (x) {
+ if (x) {
+ if (x instanceof Array) {
+ return s.array(x);
+ }
+ var a = ['{'], b, f, i, v;
+ for (i in x) {
+ v = x[i];
+ f = s[typeof v];
+ if (f) {
+ v = f(v);
+ if (typeof v == 'string') {
+ if (b) {
+ a[a.length] = ',';
+ }
+ a.push(s.string(i), ':', v);
+ b = true;
+ }
+ }
+ }
+ a[a.length] = '}';
+ return a.join('');
+ }
+ return 'null';
+ },
+ string: function (x) {
+ if (/["\\\x00-\x1f]/.test(x)) {
+ x = x.replace(/([\x00-\x1f\\"])/g, function(a, b) {
+ var c = m[b];
+ if (c) {
+ return c;
+ }
+ c = b.charCodeAt();
+ return '\\u00' +
+ Math.floor(c / 16).toString(16) +
+ (c % 16).toString(16);
+ });
+ }
+ return '"' + x + '"';
+ }
+ };
+
+ SimileAjax.JSON.toJSONString = function(o) {
+ if (o instanceof Object) {
+ return s.object(o);
+ } else if (o instanceof Array) {
+ return s.array(o);
+ } else {
+ return o.toString();
+ }
+ };
+
+ SimileAjax.JSON.parseJSON = function () {
+ try {
+ return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(
+ this.replace(/"(\\.|[^"\\])*"/g, ''))) &&
+ eval('(' + this + ')');
+ } catch (e) {
+ return false;
+ }
+ };
+})();
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/platform.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/platform.js
new file mode 100644
index 0000000..da3f7a3
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/platform.js
@@ -0,0 +1,106 @@
+/*==================================================
+ * Platform Utility Functions and Constants
+ *==================================================
+ */
+
+/* This must be called after our jQuery has been loaded
+ but before control returns to user-code.
+*/
+SimileAjax.jQuery = jQuery.noConflict(true);
+if (typeof window["$"] == "undefined") {
+ window.$ = SimileAjax.jQuery;
+}
+
+SimileAjax.Platform.os = {
+ isMac: false,
+ isWin: false,
+ isWin32: false,
+ isUnix: false
+};
+SimileAjax.Platform.browser = {
+ isIE: false,
+ isNetscape: false,
+ isMozilla: false,
+ isFirefox: false,
+ isOpera: false,
+ isSafari: false,
+
+ majorVersion: 0,
+ minorVersion: 0
+};
+
+(function() {
+ var an = navigator.appName.toLowerCase();
+ var ua = navigator.userAgent.toLowerCase();
+
+ /*
+ * Operating system
+ */
+ SimileAjax.Platform.os.isMac = (ua.indexOf('mac') != -1);
+ SimileAjax.Platform.os.isWin = (ua.indexOf('win') != -1);
+ SimileAjax.Platform.os.isWin32 = SimileAjax.Platform.isWin && (
+ ua.indexOf('95') != -1 ||
+ ua.indexOf('98') != -1 ||
+ ua.indexOf('nt') != -1 ||
+ ua.indexOf('win32') != -1 ||
+ ua.indexOf('32bit') != -1
+ );
+ SimileAjax.Platform.os.isUnix = (ua.indexOf('x11') != -1);
+
+ /*
+ * Browser
+ */
+ SimileAjax.Platform.browser.isIE = (an.indexOf("microsoft") != -1);
+ SimileAjax.Platform.browser.isNetscape = (an.indexOf("netscape") != -1);
+ SimileAjax.Platform.browser.isMozilla = (ua.indexOf("mozilla") != -1);
+ SimileAjax.Platform.browser.isFirefox = (ua.indexOf("firefox") != -1);
+ SimileAjax.Platform.browser.isOpera = (an.indexOf("opera") != -1);
+ SimileAjax.Platform.browser.isSafari = (an.indexOf("safari") != -1);
+
+ var parseVersionString = function(s) {
+ var a = s.split(".");
+ SimileAjax.Platform.browser.majorVersion = parseInt(a[0]);
+ SimileAjax.Platform.browser.minorVersion = parseInt(a[1]);
+ };
+ var indexOf = function(s, sub, start) {
+ var i = s.indexOf(sub, start);
+ return i >= 0 ? i : s.length;
+ };
+
+ if (SimileAjax.Platform.browser.isMozilla) {
+ var offset = ua.indexOf("mozilla/");
+ if (offset >= 0) {
+ parseVersionString(ua.substring(offset + 8, indexOf(ua, " ", offset)));
+ }
+ }
+ if (SimileAjax.Platform.browser.isIE) {
+ var offset = ua.indexOf("msie ");
+ if (offset >= 0) {
+ parseVersionString(ua.substring(offset + 5, indexOf(ua, ";", offset)));
+ }
+ }
+ if (SimileAjax.Platform.browser.isNetscape) {
+ var offset = ua.indexOf("rv:");
+ if (offset >= 0) {
+ parseVersionString(ua.substring(offset + 3, indexOf(ua, ")", offset)));
+ }
+ }
+ if (SimileAjax.Platform.browser.isFirefox) {
+ var offset = ua.indexOf("firefox/");
+ if (offset >= 0) {
+ parseVersionString(ua.substring(offset + 8, indexOf(ua, " ", offset)));
+ }
+ }
+
+ if (!("localeCompare" in String.prototype)) {
+ String.prototype.localeCompare = function (s) {
+ if (this < s) return -1;
+ else if (this > s) return 1;
+ else return 0;
+ };
+ }
+})();
+
+SimileAjax.Platform.getDefaultLocale = function() {
+ return SimileAjax.Platform.clientLocale;
+};
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/signal.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/signal.js
new file mode 100644
index 0000000..7bfcf2a
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/signal.js
@@ -0,0 +1,44 @@
+/*==================================================
+ * This file is used to detect that all outstanding
+ * javascript files have been loaded. You can put
+ * a function reference into SimileAjax_onLoad
+ * to have it executed once all javascript files
+ * have loaded.
+ *==================================================
+ */
+(function() {
+ var substring = SimileAjax.urlPrefix + "scripts/signal.js";
+ var heads = document.documentElement.getElementsByTagName("head");
+ for (var h = 0; h < heads.length; h++) {
+ var node = heads[h].firstChild;
+ while (node != null) {
+ if (node.nodeType == 1 && node.tagName.toLowerCase() == "script") {
+ var url = node.src;
+ var i = url.indexOf(substring);
+ if (i >= 0) {
+ heads[h].removeChild(node); // remove it so we won't hit it again
+
+ var count = parseInt(url.substr(substring.length + 1));
+ SimileAjax.loadingScriptsCount -= count;
+
+ if (SimileAjax.loadingScriptsCount == 0) {
+ var f = null;
+ if (typeof SimileAjax_onLoad == "string") {
+ f = eval(SimileAjax_onLoad);
+ SimileAjax_onLoad = null;
+ } else if (typeof SimileAjax_onLoad == "function") {
+ f = SimileAjax_onLoad;
+ SimileAjax_onLoad = null;
+ }
+
+ if (f != null) {
+ f();
+ }
+ }
+ return;
+ }
+ }
+ node = node.nextSibling;
+ }
+ }
+})();
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/string.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/string.js
new file mode 100644
index 0000000..01466d8
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/string.js
@@ -0,0 +1,43 @@
+/*==================================================
+ * String Utility Functions and Constants
+ *==================================================
+ */
+
+String.prototype.trim = function() {
+ return this.replace(/^\s+|\s+$/g, '');
+};
+
+String.prototype.startsWith = function(prefix) {
+ return this.length >= prefix.length && this.substr(0, prefix.length) == prefix;
+};
+
+String.prototype.endsWith = function(suffix) {
+ return this.length >= suffix.length && this.substr(this.length - suffix.length) == suffix;
+};
+
+String.substitute = function(s, objects) {
+ var result = "";
+ var start = 0;
+ while (start < s.length - 1) {
+ var percent = s.indexOf("%", start);
+ if (percent < 0 || percent == s.length - 1) {
+ break;
+ } else if (percent > start && s.charAt(percent - 1) == "\\") {
+ result += s.substring(start, percent - 1) + "%";
+ start = percent + 1;
+ } else {
+ var n = parseInt(s.charAt(percent + 1));
+ if (isNaN(n) || n >= objects.length) {
+ result += s.substring(start, percent + 2);
+ } else {
+ result += s.substring(start, percent) + objects[n].toString();
+ }
+ start = percent + 2;
+ }
+ }
+
+ if (start < s.length) {
+ result += s.substring(start);
+ }
+ return result;
+};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/units.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/units.js
new file mode 100644
index 0000000..54f2a5b
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/units.js
@@ -0,0 +1,64 @@
+/*==================================================
+ * Default Unit
+ *==================================================
+ */
+
+SimileAjax.NativeDateUnit = new Object();
+
+SimileAjax.NativeDateUnit.makeDefaultValue = function() {
+ return new Date();
+};
+
+SimileAjax.NativeDateUnit.cloneValue = function(v) {
+ return new Date(v.getTime());
+};
+
+SimileAjax.NativeDateUnit.getParser = function(format) {
+ if (typeof format == "string") {
+ format = format.toLowerCase();
+ }
+ return (format == "iso8601" || format == "iso 8601") ?
+ SimileAjax.DateTime.parseIso8601DateTime :
+ SimileAjax.DateTime.parseGregorianDateTime;
+};
+
+SimileAjax.NativeDateUnit.parseFromObject = function(o) {
+ return SimileAjax.DateTime.parseGregorianDateTime(o);
+};
+
+SimileAjax.NativeDateUnit.toNumber = function(v) {
+ return v.getTime();
+};
+
+SimileAjax.NativeDateUnit.fromNumber = function(n) {
+ return new Date(n);
+};
+
+SimileAjax.NativeDateUnit.compare = function(v1, v2) {
+ var n1, n2;
+ if (typeof v1 == "object") {
+ n1 = v1.getTime();
+ } else {
+ n1 = Number(v1);
+ }
+ if (typeof v2 == "object") {
+ n2 = v2.getTime();
+ } else {
+ n2 = Number(v2);
+ }
+
+ return n1 - n2;
+};
+
+SimileAjax.NativeDateUnit.earlier = function(v1, v2) {
+ return SimileAjax.NativeDateUnit.compare(v1, v2) < 0 ? v1 : v2;
+};
+
+SimileAjax.NativeDateUnit.later = function(v1, v2) {
+ return SimileAjax.NativeDateUnit.compare(v1, v2) > 0 ? v1 : v2;
+};
+
+SimileAjax.NativeDateUnit.change = function(v, n) {
+ return new Date(v.getTime() + n);
+};
+
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/window-manager.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/window-manager.js
new file mode 100644
index 0000000..0da5970
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/window-manager.js
@@ -0,0 +1,414 @@
+/**
+ * @fileOverview UI layers and window-wide dragging
+ * @name SimileAjax.WindowManager
+ */
+
+/**
+ * This is a singleton that keeps track of UI layers (modal and
+ * modeless) and enables/disables UI elements based on which layers
+ * they belong to. It also provides window-wide dragging
+ * implementation.
+ */
+SimileAjax.WindowManager = {
+ _initialized: false,
+ _listeners: [],
+
+ _draggedElement: null,
+ _draggedElementCallback: null,
+ _dropTargetHighlightElement: null,
+ _lastCoords: null,
+ _ghostCoords: null,
+ _draggingMode: "",
+ _dragging: false,
+
+ _layers: []
+};
+
+SimileAjax.WindowManager.initialize = function() {
+ if (SimileAjax.WindowManager._initialized) {
+ return;
+ }
+
+ SimileAjax.DOM.registerEvent(document.body, "mousedown", SimileAjax.WindowManager._onBodyMouseDown);
+ SimileAjax.DOM.registerEvent(document.body, "mousemove", SimileAjax.WindowManager._onBodyMouseMove);
+ SimileAjax.DOM.registerEvent(document.body, "mouseup", SimileAjax.WindowManager._onBodyMouseUp);
+ SimileAjax.DOM.registerEvent(document, "keydown", SimileAjax.WindowManager._onBodyKeyDown);
+ SimileAjax.DOM.registerEvent(document, "keyup", SimileAjax.WindowManager._onBodyKeyUp);
+
+ SimileAjax.WindowManager._layers.push({index: 0});
+
+ SimileAjax.WindowManager._historyListener = {
+ onBeforeUndoSeveral: function() {},
+ onAfterUndoSeveral: function() {},
+ onBeforeUndo: function() {},
+ onAfterUndo: function() {},
+
+ onBeforeRedoSeveral: function() {},
+ onAfterRedoSeveral: function() {},
+ onBeforeRedo: function() {},
+ onAfterRedo: function() {}
+ };
+ SimileAjax.History.addListener(SimileAjax.WindowManager._historyListener);
+
+ SimileAjax.WindowManager._initialized = true;
+};
+
+SimileAjax.WindowManager.getBaseLayer = function() {
+ SimileAjax.WindowManager.initialize();
+ return SimileAjax.WindowManager._layers[0];
+};
+
+SimileAjax.WindowManager.getHighestLayer = function() {
+ SimileAjax.WindowManager.initialize();
+ return SimileAjax.WindowManager._layers[SimileAjax.WindowManager._layers.length - 1];
+};
+
+SimileAjax.WindowManager.registerEventWithObject = function(elmt, eventName, obj, handlerName, layer) {
+ SimileAjax.WindowManager.registerEvent(
+ elmt,
+ eventName,
+ function(elmt2, evt, target) {
+ return obj[handlerName].call(obj, elmt2, evt, target);
+ },
+ layer
+ );
+};
+
+SimileAjax.WindowManager.registerEvent = function(elmt, eventName, handler, layer) {
+ if (layer == null) {
+ layer = SimileAjax.WindowManager.getHighestLayer();
+ }
+
+ var handler2 = function(elmt, evt, target) {
+ if (SimileAjax.WindowManager._canProcessEventAtLayer(layer)) {
+ SimileAjax.WindowManager._popToLayer(layer.index);
+ try {
+ handler(elmt, evt, target);
+ } catch (e) {
+ SimileAjax.Debug.exception(e);
+ }
+ }
+ SimileAjax.DOM.cancelEvent(evt);
+ return false;
+ }
+
+ SimileAjax.DOM.registerEvent(elmt, eventName, handler2);
+};
+
+SimileAjax.WindowManager.pushLayer = function(f, ephemeral, elmt) {
+ var layer = { onPop: f, index: SimileAjax.WindowManager._layers.length, ephemeral: (ephemeral), elmt: elmt };
+ SimileAjax.WindowManager._layers.push(layer);
+
+ return layer;
+};
+
+SimileAjax.WindowManager.popLayer = function(layer) {
+ for (var i = 1; i < SimileAjax.WindowManager._layers.length; i++) {
+ if (SimileAjax.WindowManager._layers[i] == layer) {
+ SimileAjax.WindowManager._popToLayer(i - 1);
+ break;
+ }
+ }
+};
+
+SimileAjax.WindowManager.popAllLayers = function() {
+ SimileAjax.WindowManager._popToLayer(0);
+};
+
+SimileAjax.WindowManager.registerForDragging = function(elmt, callback, layer) {
+ SimileAjax.WindowManager.registerEvent(
+ elmt,
+ "mousedown",
+ function(elmt, evt, target) {
+ SimileAjax.WindowManager._handleMouseDown(elmt, evt, callback);
+ },
+ layer
+ );
+};
+
+SimileAjax.WindowManager._popToLayer = function(level) {
+ while (level+1 < SimileAjax.WindowManager._layers.length) {
+ try {
+ var layer = SimileAjax.WindowManager._layers.pop();
+ if (layer.onPop != null) {
+ layer.onPop();
+ }
+ } catch (e) {
+ }
+ }
+};
+
+SimileAjax.WindowManager._canProcessEventAtLayer = function(layer) {
+ if (layer.index == (SimileAjax.WindowManager._layers.length - 1)) {
+ return true;
+ }
+ for (var i = layer.index + 1; i < SimileAjax.WindowManager._layers.length; i++) {
+ if (!SimileAjax.WindowManager._layers[i].ephemeral) {
+ return false;
+ }
+ }
+ return true;
+};
+
+SimileAjax.WindowManager.cancelPopups = function(evt) {
+ var evtCoords = (evt) ? SimileAjax.DOM.getEventPageCoordinates(evt) : { x: -1, y: -1 };
+
+ var i = SimileAjax.WindowManager._layers.length - 1;
+ while (i > 0 && SimileAjax.WindowManager._layers[i].ephemeral) {
+ var layer = SimileAjax.WindowManager._layers[i];
+ if (layer.elmt != null) { // if event falls within main element of layer then don't cancel
+ var elmt = layer.elmt;
+ var elmtCoords = SimileAjax.DOM.getPageCoordinates(elmt);
+ if (evtCoords.x >= elmtCoords.left && evtCoords.x < (elmtCoords.left + elmt.offsetWidth) &&
+ evtCoords.y >= elmtCoords.top && evtCoords.y < (elmtCoords.top + elmt.offsetHeight)) {
+ break;
+ }
+ }
+ i--;
+ }
+ SimileAjax.WindowManager._popToLayer(i);
+};
+
+SimileAjax.WindowManager._onBodyMouseDown = function(elmt, evt, target) {
+ if (!("eventPhase" in evt) || evt.eventPhase == evt.BUBBLING_PHASE) {
+ SimileAjax.WindowManager.cancelPopups(evt);
+ }
+};
+
+SimileAjax.WindowManager._handleMouseDown = function(elmt, evt, callback) {
+ SimileAjax.WindowManager._draggedElement = elmt;
+ SimileAjax.WindowManager._draggedElementCallback = callback;
+ SimileAjax.WindowManager._lastCoords = { x: evt.clientX, y: evt.clientY };
+
+ SimileAjax.DOM.cancelEvent(evt);
+ return false;
+};
+
+SimileAjax.WindowManager._onBodyKeyDown = function(elmt, evt, target) {
+ if (SimileAjax.WindowManager._dragging) {
+ if (evt.keyCode == 27) { // esc
+ SimileAjax.WindowManager._cancelDragging();
+ } else if ((evt.keyCode == 17 || evt.keyCode == 16) && SimileAjax.WindowManager._draggingMode != "copy") {
+ SimileAjax.WindowManager._draggingMode = "copy";
+
+ var img = SimileAjax.Graphics.createTranslucentImage(SimileAjax.urlPrefix + "images/copy.png");
+ img.style.position = "absolute";
+ img.style.left = (SimileAjax.WindowManager._ghostCoords.left - 16) + "px";
+ img.style.top = (SimileAjax.WindowManager._ghostCoords.top) + "px";
+ document.body.appendChild(img);
+
+ SimileAjax.WindowManager._draggingModeIndicatorElmt = img;
+ }
+ }
+};
+
+SimileAjax.WindowManager._onBodyKeyUp = function(elmt, evt, target) {
+ if (SimileAjax.WindowManager._dragging) {
+ if (evt.keyCode == 17 || evt.keyCode == 16) {
+ SimileAjax.WindowManager._draggingMode = "";
+ if (SimileAjax.WindowManager._draggingModeIndicatorElmt != null) {
+ document.body.removeChild(SimileAjax.WindowManager._draggingModeIndicatorElmt);
+ SimileAjax.WindowManager._draggingModeIndicatorElmt = null;
+ }
+ }
+ }
+};
+
+SimileAjax.WindowManager._onBodyMouseMove = function(elmt, evt, target) {
+ if (SimileAjax.WindowManager._draggedElement != null) {
+ var callback = SimileAjax.WindowManager._draggedElementCallback;
+
+ var lastCoords = SimileAjax.WindowManager._lastCoords;
+ var diffX = evt.clientX - lastCoords.x;
+ var diffY = evt.clientY - lastCoords.y;
+
+ if (!SimileAjax.WindowManager._dragging) {
+ if (Math.abs(diffX) > 5 || Math.abs(diffY) > 5) {
+ try {
+ if ("onDragStart" in callback) {
+ callback.onDragStart();
+ }
+
+ if ("ghost" in callback && callback.ghost) {
+ var draggedElmt = SimileAjax.WindowManager._draggedElement;
+
+ SimileAjax.WindowManager._ghostCoords = SimileAjax.DOM.getPageCoordinates(draggedElmt);
+ SimileAjax.WindowManager._ghostCoords.left += diffX;
+ SimileAjax.WindowManager._ghostCoords.top += diffY;
+
+ var ghostElmt = draggedElmt.cloneNode(true);
+ ghostElmt.style.position = "absolute";
+ ghostElmt.style.left = SimileAjax.WindowManager._ghostCoords.left + "px";
+ ghostElmt.style.top = SimileAjax.WindowManager._ghostCoords.top + "px";
+ ghostElmt.style.zIndex = 1000;
+ SimileAjax.Graphics.setOpacity(ghostElmt, 50);
+
+ document.body.appendChild(ghostElmt);
+ callback._ghostElmt = ghostElmt;
+ }
+
+ SimileAjax.WindowManager._dragging = true;
+ SimileAjax.WindowManager._lastCoords = { x: evt.clientX, y: evt.clientY };
+
+ document.body.focus();
+ } catch (e) {
+ SimileAjax.Debug.exception("WindowManager: Error handling mouse down", e);
+ SimileAjax.WindowManager._cancelDragging();
+ }
+ }
+ } else {
+ try {
+ SimileAjax.WindowManager._lastCoords = { x: evt.clientX, y: evt.clientY };
+
+ if ("onDragBy" in callback) {
+ callback.onDragBy(diffX, diffY);
+ }
+
+ if ("_ghostElmt" in callback) {
+ var ghostElmt = callback._ghostElmt;
+
+ SimileAjax.WindowManager._ghostCoords.left += diffX;
+ SimileAjax.WindowManager._ghostCoords.top += diffY;
+
+ ghostElmt.style.left = SimileAjax.WindowManager._ghostCoords.left + "px";
+ ghostElmt.style.top = SimileAjax.WindowManager._ghostCoords.top + "px";
+ if (SimileAjax.WindowManager._draggingModeIndicatorElmt != null) {
+ var indicatorElmt = SimileAjax.WindowManager._draggingModeIndicatorElmt;
+
+ indicatorElmt.style.left = (SimileAjax.WindowManager._ghostCoords.left - 16) + "px";
+ indicatorElmt.style.top = SimileAjax.WindowManager._ghostCoords.top + "px";
+ }
+
+ if ("droppable" in callback && callback.droppable) {
+ var coords = SimileAjax.DOM.getEventPageCoordinates(evt);
+ var target = SimileAjax.DOM.hittest(
+ coords.x, coords.y,
+ [ SimileAjax.WindowManager._ghostElmt,
+ SimileAjax.WindowManager._dropTargetHighlightElement
+ ]
+ );
+ target = SimileAjax.WindowManager._findDropTarget(target);
+
+ if (target != SimileAjax.WindowManager._potentialDropTarget) {
+ if (SimileAjax.WindowManager._dropTargetHighlightElement != null) {
+ document.body.removeChild(SimileAjax.WindowManager._dropTargetHighlightElement);
+
+ SimileAjax.WindowManager._dropTargetHighlightElement = null;
+ SimileAjax.WindowManager._potentialDropTarget = null;
+ }
+
+ var droppable = false;
+ if (target != null) {
+ if ((!("canDropOn" in callback) || callback.canDropOn(target)) &&
+ (!("canDrop" in target) || target.canDrop(SimileAjax.WindowManager._draggedElement))) {
+
+ droppable = true;
+ }
+ }
+
+ if (droppable) {
+ var border = 4;
+ var targetCoords = SimileAjax.DOM.getPageCoordinates(target);
+ var highlight = document.createElement("div");
+ highlight.style.border = border + "px solid yellow";
+ highlight.style.backgroundColor = "yellow";
+ highlight.style.position = "absolute";
+ highlight.style.left = targetCoords.left + "px";
+ highlight.style.top = targetCoords.top + "px";
+ highlight.style.width = (target.offsetWidth - border * 2) + "px";
+ highlight.style.height = (target.offsetHeight - border * 2) + "px";
+ SimileAjax.Graphics.setOpacity(highlight, 30);
+ document.body.appendChild(highlight);
+
+ SimileAjax.WindowManager._potentialDropTarget = target;
+ SimileAjax.WindowManager._dropTargetHighlightElement = highlight;
+ }
+ }
+ }
+ }
+ } catch (e) {
+ SimileAjax.Debug.exception("WindowManager: Error handling mouse move", e);
+ SimileAjax.WindowManager._cancelDragging();
+ }
+ }
+
+ SimileAjax.DOM.cancelEvent(evt);
+ return false;
+ }
+};
+
+SimileAjax.WindowManager._onBodyMouseUp = function(elmt, evt, target) {
+ if (SimileAjax.WindowManager._draggedElement != null) {
+ try {
+ if (SimileAjax.WindowManager._dragging) {
+ var callback = SimileAjax.WindowManager._draggedElementCallback;
+ if ("onDragEnd" in callback) {
+ callback.onDragEnd();
+ }
+ if ("droppable" in callback && callback.droppable) {
+ var dropped = false;
+
+ var target = SimileAjax.WindowManager._potentialDropTarget;
+ if (target != null) {
+ if ((!("canDropOn" in callback) || callback.canDropOn(target)) &&
+ (!("canDrop" in target) || target.canDrop(SimileAjax.WindowManager._draggedElement))) {
+
+ if ("onDropOn" in callback) {
+ callback.onDropOn(target);
+ }
+ target.ondrop(SimileAjax.WindowManager._draggedElement, SimileAjax.WindowManager._draggingMode);
+
+ dropped = true;
+ }
+ }
+
+ if (!dropped) {
+ // TODO: do holywood explosion here
+ }
+ }
+ }
+ } finally {
+ SimileAjax.WindowManager._cancelDragging();
+ }
+
+ SimileAjax.DOM.cancelEvent(evt);
+ return false;
+ }
+};
+
+SimileAjax.WindowManager._cancelDragging = function() {
+ var callback = SimileAjax.WindowManager._draggedElementCallback;
+ if ("_ghostElmt" in callback) {
+ var ghostElmt = callback._ghostElmt;
+ document.body.removeChild(ghostElmt);
+
+ delete callback._ghostElmt;
+ }
+ if (SimileAjax.WindowManager._dropTargetHighlightElement != null) {
+ document.body.removeChild(SimileAjax.WindowManager._dropTargetHighlightElement);
+ SimileAjax.WindowManager._dropTargetHighlightElement = null;
+ }
+ if (SimileAjax.WindowManager._draggingModeIndicatorElmt != null) {
+ document.body.removeChild(SimileAjax.WindowManager._draggingModeIndicatorElmt);
+ SimileAjax.WindowManager._draggingModeIndicatorElmt = null;
+ }
+
+ SimileAjax.WindowManager._draggedElement = null;
+ SimileAjax.WindowManager._draggedElementCallback = null;
+ SimileAjax.WindowManager._potentialDropTarget = null;
+ SimileAjax.WindowManager._dropTargetHighlightElement = null;
+ SimileAjax.WindowManager._lastCoords = null;
+ SimileAjax.WindowManager._ghostCoords = null;
+ SimileAjax.WindowManager._draggingMode = "";
+ SimileAjax.WindowManager._dragging = false;
+};
+
+SimileAjax.WindowManager._findDropTarget = function(elmt) {
+ while (elmt != null) {
+ if ("ondrop" in elmt && (typeof elmt.ondrop) == "function") {
+ break;
+ }
+ elmt = elmt.parentNode;
+ }
+ return elmt;
+};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/xmlhttp.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/xmlhttp.js
new file mode 100644
index 0000000..b6d2c0a
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/xmlhttp.js
@@ -0,0 +1,137 @@
+/**
+ * @fileOverview XmlHttp utility functions
+ * @name SimileAjax.XmlHttp
+ */
+
+SimileAjax.XmlHttp = new Object();
+
+/**
+ * Callback for XMLHttp onRequestStateChange.
+ */
+SimileAjax.XmlHttp._onReadyStateChange = function(xmlhttp, fError, fDone) {
+ switch (xmlhttp.readyState) {
+ // 1: Request not yet made
+ // 2: Contact established with server but nothing downloaded yet
+ // 3: Called multiple while downloading in progress
+
+ // Download complete
+ case 4:
+ try {
+ if (xmlhttp.status == 0 // file:// urls, works on Firefox
+ || xmlhttp.status == 200 // http:// urls
+ ) {
+ if (fDone) {
+ fDone(xmlhttp);
+ }
+ } else {
+ if (fError) {
+ fError(
+ xmlhttp.statusText,
+ xmlhttp.status,
+ xmlhttp
+ );
+ }
+ }
+ } catch (e) {
+ SimileAjax.Debug.exception("XmlHttp: Error handling onReadyStateChange", e);
+ }
+ break;
+ }
+};
+
+/**
+ * Creates an XMLHttpRequest object. On the first run, this
+ * function creates a platform-specific function for
+ * instantiating an XMLHttpRequest object and then replaces
+ * itself with that function.
+ */
+SimileAjax.XmlHttp._createRequest = function() {
+ if (SimileAjax.Platform.browser.isIE) {
+ var programIDs = [
+ "Msxml2.XMLHTTP",
+ "Microsoft.XMLHTTP",
+ "Msxml2.XMLHTTP.4.0"
+ ];
+ for (var i = 0; i < programIDs.length; i++) {
+ try {
+ var programID = programIDs[i];
+ var f = function() {
+ return new ActiveXObject(programID);
+ };
+ var o = f();
+
+ // We are replacing the SimileAjax._createXmlHttpRequest
+ // function with this inner function as we've
+ // found out that it works. This is so that we
+ // don't have to do all the testing over again
+ // on subsequent calls.
+ SimileAjax.XmlHttp._createRequest = f;
+
+ return o;
+ } catch (e) {
+ // silent
+ }
+ }
+ // fall through to try new XMLHttpRequest();
+ }
+
+ try {
+ var f = function() {
+ return new XMLHttpRequest();
+ };
+ var o = f();
+
+ // We are replacing the SimileAjax._createXmlHttpRequest
+ // function with this inner function as we've
+ // found out that it works. This is so that we
+ // don't have to do all the testing over again
+ // on subsequent calls.
+ SimileAjax.XmlHttp._createRequest = f;
+
+ return o;
+ } catch (e) {
+ throw new Error("Failed to create an XMLHttpRequest object");
+ }
+};
+
+/**
+ * Performs an asynchronous HTTP GET.
+ *
+ * @param {Function} fError a function of the form
+ function(statusText, statusCode, xmlhttp)
+ * @param {Function} fDone a function of the form function(xmlhttp)
+ */
+SimileAjax.XmlHttp.get = function(url, fError, fDone) {
+ var xmlhttp = SimileAjax.XmlHttp._createRequest();
+
+ xmlhttp.open("GET", url, true);
+ xmlhttp.onreadystatechange = function() {
+ SimileAjax.XmlHttp._onReadyStateChange(xmlhttp, fError, fDone);
+ };
+ xmlhttp.send(null);
+};
+
+/**
+ * Performs an asynchronous HTTP POST.
+ *
+ * @param {Function} fError a function of the form
+ function(statusText, statusCode, xmlhttp)
+ * @param {Function} fDone a function of the form function(xmlhttp)
+ */
+SimileAjax.XmlHttp.post = function(url, body, fError, fDone) {
+ var xmlhttp = SimileAjax.XmlHttp._createRequest();
+
+ xmlhttp.open("POST", url, true);
+ xmlhttp.onreadystatechange = function() {
+ SimileAjax.XmlHttp._onReadyStateChange(xmlhttp, fError, fDone);
+ };
+ xmlhttp.send(body);
+};
+
+SimileAjax.XmlHttp._forceXML = function(xmlhttp) {
+ try {
+ xmlhttp.overrideMimeType("text/xml");
+ } catch (e) {
+ xmlhttp.setrequestheader("Content-Type", "text/xml");
+ }
+};
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/simile-ajax-api.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/simile-ajax-api.js
new file mode 100644
index 0000000..4531116
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/simile-ajax-api.js
@@ -0,0 +1,211 @@
+/*==================================================
+ * Simile Ajax API
+ *
+ * Include this file in your HTML file as follows:
+ *
+ * <script src="http://simile.mit.edu/ajax/api/simile-ajax-api.js" type="text/javascript"></script>
+ *
+ *==================================================
+ */
+
+if (typeof SimileAjax == "undefined") {
+ var SimileAjax = {
+ loaded: false,
+ loadingScriptsCount: 0,
+ error: null,
+ params: { bundle:"true" }
+ };
+
+ SimileAjax.Platform = new Object();
+ /*
+ HACK: We need these 2 things here because we cannot simply append
+ a <script> element containing code that accesses SimileAjax.Platform
+ to initialize it because IE executes that <script> code first
+ before it loads ajax.js and platform.js.
+ */
+
+ var getHead = function(doc) {
+ return doc.getElementsByTagName("head")[0];
+ };
+
+ SimileAjax.findScript = function(doc, substring) {
+ var heads = doc.documentElement.getElementsByTagName("head");
+ for (var h = 0; h < heads.length; h++) {
+ var node = heads[h].firstChild;
+ while (node != null) {
+ if (node.nodeType == 1 && node.tagName.toLowerCase() == "script") {
+ var url = node.src;
+ var i = url.indexOf(substring);
+ if (i >= 0) {
+ return url;
+ }
+ }
+ node = node.nextSibling;
+ }
+ }
+ return null;
+ };
+ SimileAjax.includeJavascriptFile = function(doc, url, onerror, charset) {
+ onerror = onerror || "";
+ if (doc.body == null) {
+ try {
+ var q = "'" + onerror.replace( /'/g, '&apos' ) + "'"; // "
+ doc.write("<script src='" + url + "' onerror="+ q +
+ (charset ? " charset='"+ charset +"'" : "") +
+ " type='text/javascript'>"+ onerror + "</script>");
+ return;
+ } catch (e) {
+ // fall through
+ }
+ }
+
+ var script = doc.createElement("script");
+ if (onerror) {
+ try { script.innerHTML = onerror; } catch(e) {}
+ script.setAttribute("onerror", onerror);
+ }
+ if (charset) {
+ script.setAttribute("charset", charset);
+ }
+ script.type = "text/javascript";
+ script.language = "JavaScript";
+ script.src = url;
+ return getHead(doc).appendChild(script);
+ };
+ SimileAjax.includeJavascriptFiles = function(doc, urlPrefix, filenames) {
+ for (var i = 0; i < filenames.length; i++) {
+ SimileAjax.includeJavascriptFile(doc, urlPrefix + filenames[i]);
+ }
+ SimileAjax.loadingScriptsCount += filenames.length;
+ SimileAjax.includeJavascriptFile(doc, SimileAjax.urlPrefix + "scripts/signal.js?" + filenames.length);
+ };
+ SimileAjax.includeCssFile = function(doc, url) {
+ if (doc.body == null) {
+ try {
+ doc.write("<link rel='stylesheet' href='" + url + "' type='text/css'/>");
+ return;
+ } catch (e) {
+ // fall through
+ }
+ }
+
+ var link = doc.createElement("link");
+ link.setAttribute("rel", "stylesheet");
+ link.setAttribute("type", "text/css");
+ link.setAttribute("href", url);
+ getHead(doc).appendChild(link);
+ };
+ SimileAjax.includeCssFiles = function(doc, urlPrefix, filenames) {
+ for (var i = 0; i < filenames.length; i++) {
+ SimileAjax.includeCssFile(doc, urlPrefix + filenames[i]);
+ }
+ };
+
+ /**
+ * Append into urls each string in suffixes after prefixing it with urlPrefix.
+ * @param {Array} urls
+ * @param {String} urlPrefix
+ * @param {Array} suffixes
+ */
+ SimileAjax.prefixURLs = function(urls, urlPrefix, suffixes) {
+ for (var i = 0; i < suffixes.length; i++) {
+ urls.push(urlPrefix + suffixes[i]);
+ }
+ };
+
+ /**
+ * Parse out the query parameters from a URL
+ * @param {String} url the url to parse, or location.href if undefined
+ * @param {Object} to optional object to extend with the parameters
+ * @param {Object} types optional object mapping keys to value types
+ * (String, Number, Boolean or Array, String by default)
+ * @return a key/value Object whose keys are the query parameter names
+ * @type Object
+ */
+ SimileAjax.parseURLParameters = function(url, to, types) {
+ to = to || {};
+ types = types || {};
+
+ if (typeof url == "undefined") {
+ url = location.href;
+ }
+ var q = url.indexOf("?");
+ if (q < 0) {
+ return to;
+ }
+ url = (url+"#").slice(q+1, url.indexOf("#")); // toss the URL fragment
+
+ var params = url.split("&"), param, parsed = {};
+ var decode = window.decodeURIComponent || unescape;
+ for (var i = 0; param = params[i]; i++) {
+ var eq = param.indexOf("=");
+ var name = decode(param.slice(0,eq));
+ var old = parsed[name];
+ if (typeof old == "undefined") {
+ old = [];
+ } else if (!(old instanceof Array)) {
+ old = [old];
+ }
+ parsed[name] = old.concat(decode(param.slice(eq+1)));
+ }
+ for (var i in parsed) {
+ if (!parsed.hasOwnProperty(i)) continue;
+ var type = types[i] || String;
+ var data = parsed[i];
+ if (!(data instanceof Array)) {
+ data = [data];
+ }
+ if (type === Boolean && data[0] == "false") {
+ to[i] = false; // because Boolean("false") === true
+ } else {
+ to[i] = type.apply(this, data);
+ }
+ }
+ return to;
+ };
+
+ (function() {
+ var javascriptFiles = [
+ "jquery-1.2.3.js",
+ "platform.js",
+ "debug.js",
+ "xmlhttp.js",
+ "json.js",
+ "dom.js",
+ "graphics.js",
+ "date-time.js",
+ "string.js",
+ "html.js",
+ "data-structure.js",
+ "units.js",
+
+ "ajax.js",
+ "history.js",
+ "window-manager.js"
+ ];
+ var cssFiles = [
+ ];
+
+ if (typeof SimileAjax_urlPrefix == "string") {
+ SimileAjax.urlPrefix = SimileAjax_urlPrefix;
+ } else {
+ var url = SimileAjax.findScript(document, "simile-ajax-api.js");
+ if (url == null) {
+ SimileAjax.error = new Error("Failed to derive URL prefix for Simile Ajax API code files");
+ return;
+ }
+
+ SimileAjax.urlPrefix = url.substr(0, url.indexOf("simile-ajax-api.js"));
+ }
+
+ SimileAjax.parseURLParameters(url, SimileAjax.params, {bundle:Boolean});
+ if (false) { //SimileAjax.params.bundle) {
+ SimileAjax.includeJavascriptFiles(document, SimileAjax.urlPrefix, [ "simile-ajax-bundle.js" ]);
+ } else {
+ SimileAjax.includeJavascriptFiles(document, SimileAjax.urlPrefix + "scripts/", javascriptFiles);
+ }
+ SimileAjax.includeCssFiles(document, SimileAjax.urlPrefix + "styles/", cssFiles);
+
+ SimileAjax.loaded = true;
+ })();
+}
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/simile-ajax-bundle.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/simile-ajax-bundle.js
new file mode 100644
index 0000000..0250784
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/simile-ajax-bundle.js
@@ -0,0 +1,3095 @@
+
+
+/* jquery-1.2.3.js */
+
+
+(function(){if(window.jQuery)var _jQuery=window.jQuery;var jQuery=window.jQuery=function(selector,context){return new jQuery.prototype.init(selector,context);};if(window.$)var _$=window.$;window.$=jQuery;var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/;var isSimple=/^.[^:#\[\.]*$/;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}else if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem)if(elem.id!=match[3])return jQuery().find(selector);else{this[0]=elem;this.length=1;return this;}else
+selector=[];}}else
+return new jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return new jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(selector.constructor==Array&&selector||(selector.jquery||selector.length&&selector!=window&&!selector.nodeType&&selector[0]!=undefined&&selector[0].nodeType)&&jQuery.makeArray(selector)||[selector]);},jquery:"1.2.3",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;this.each(function(i){if(this==elem)ret=i;});return ret;},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value==undefined)return this.length&&jQuery[type||"attr"](this[0],name)||undefined;else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else
+return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else
+selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return!selector?this:this.pushStack(jQuery.merge(this.get(),selector.constructor==String?jQuery(selector).get():selector.length!=undefined&&(!selector.nodeName||jQuery.nodeName(selector,"form"))?selector:[selector]));},is:function(selector){return selector?jQuery.multiFilter(selector,this).length>0:false;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one)return value;values.push(value);}}return values;}else
+return(this[0].value||"").replace(/\r/g,"");}return undefined;}return this.each(function(){if(this.nodeType!=1)return;if(value.constructor==Array&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=value.constructor==Array?value:[value];jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else
+this.value=value;});},html:function(value){return value==undefined?(this.length?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value==null){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data==undefined&&this.length)data=jQuery.data(this[0],key);return data==null&&parts[1]?this.data(parts[0]):data;}else
+return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script")){scripts=scripts.add(elem);}else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.prototype.init.prototype=jQuery.prototype;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else
+jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==1){target=this;i=0;}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){if(target===options[name])continue;if(deep&&options[name]&&typeof options[name]=="object"&&target[name]&&!options[name].nodeType)target[name]=jQuery.extend(target[name],options[name]);else if(options[name]!=undefined)target[name]=options[name];}return target;};var expando="jQuery"+(new Date()).getTime(),uuid=0,windowData={};var exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i;jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery;},isFunction:function(fn){return!!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/function/i.test(fn+"");},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body;},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)script.text=data;else
+script.appendChild(document.createTextNode(data));head.appendChild(script);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])jQuery.cache[id]={};if(data!=undefined)jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])break;if(!name)jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)elem.removeAttribute(expando);}delete jQuery.cache[id];}},each:function(object,callback,args){if(args){if(object.length==undefined){for(var name in object)if(callback.apply(object[name],args)===false)break;}else
+for(var i=0,length=object.length;i<length;i++)if(callback.apply(object[i],args)===false)break;}else{if(object.length==undefined){for(var name in object)if(callback.call(object[name],name,object[name])===false)break;}else
+for(var i=0,length=object.length,value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))value=value.call(elem,i);return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else
+jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret;function color(elem){if(!jQuery.browser.safari)return false;var ret=document.defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(elem.style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=elem.style.outline;elem.style.outline="0 solid black";elem.style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&elem.style&&elem.style[name])ret=elem.style[name];else if(document.defaultView&&document.defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var getComputedStyle=document.defaultView.getComputedStyle(elem,null);if(getComputedStyle&&!color(elem))ret=getComputedStyle.getPropertyValue(name);else{var swap=[],stack=[];for(var a=elem;a&&color(a);a=a.parentNode)stack.unshift(a);for(var i=0;i<stack.length;i++)if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}ret=name=="display"&&swap[stack.length-1]!=null?"none":(getComputedStyle&&getComputedStyle.getPropertyValue(name))||"";for(var i=0;i<swap.length;i++)if(swap[i]!=null)stack[i].style.display=swap[i];}if(name=="opacity"&&ret=="")ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var style=elem.style.left,runtimeStyle=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;elem.style.left=ret||0;ret=elem.style.pixelLeft+"px";elem.style.left=style;elem.runtimeStyle.left=runtimeStyle;}}return ret;},clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=='undefined')context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;jQuery.each(elems,function(i,elem){if(!elem)return;if(elem.constructor==Number)elem=elem.toString();if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else
+ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var fix=jQuery.isXMLDoc(elem)?{}:jQuery.props;if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(fix[name]){if(value!=undefined)elem[fix[name]]=value;return elem[fix[name]];}else if(jQuery.browser.msie&&name=="style")return jQuery.attr(elem.style,"cssText",value);else if(value==undefined&&jQuery.browser.msie&&jQuery.nodeName(elem,"form")&&(name=="action"||name=="method"))return elem.getAttributeNode(name).nodeValue;else if(elem.tagName){if(value!=undefined){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem.setAttribute(name,""+value);}if(jQuery.browser.msie&&/href|src/.test(name)&&!jQuery.isXMLDoc(elem))return elem.getAttribute(name,2);return elem.getAttribute(name);}else{if(name=="opacity"&&jQuery.browser.msie){if(value!=undefined){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseFloat(value).toString()=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100).toString():"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(value!=undefined)elem[name]=value;return elem[name];}},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(typeof array!="array")for(var i=0,length=array.length;i<length;i++)ret.push(array[i]);else
+ret=array.slice(0);return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)if(array[i]==elem)return i;return-1;},merge:function(first,second){if(jQuery.browser.msie){for(var i=0;second[i];i++)if(second[i].nodeType!=8)first.push(second[i]);}else
+for(var i=0;second[i];i++)first.push(second[i]);return first;},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}return ret;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++)if(!inv&&callback(elems[i],i)||inv&&!callback(elems[i],i))ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!==null&&value!=undefined){if(value.constructor!=Array)value=[value];ret=ret.concat(value);}}return ret;}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,innerHTML:"innerHTML",className:"className",value:"value",disabled:"disabled",checked:"checked",readonly:"readOnly",selected:"selected",maxlength:"maxLength",selectedIndex:"selectedIndex",defaultValue:"defaultValue",tagName:"tagName",nodeName:"nodeName"}});jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)jQuery(args[i])[original](this);});};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)this.parentNode.removeChild(this);}},empty:function(){jQuery(">*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return i<m[3]-0;},gt:function(a,i,m){return i>m[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[new RegExp("^(\[) *@?([\w-]+) *([!*$^~=]*) *('?\"?)(.*?)\4 *\]"),new RegExp("^(:)([\w-]+)\(\"?'?(.*?(\(.*?\))?[^(]*?)\"?'?\)"),new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false;var re=quickChild;var m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id])break;if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~")merge[id]=true;r.push(n);}if(m=="+")break;}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])oid=jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object")tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}if(m[1]==".")r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++)if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break;}r=tmp;}ret=r;}t=t.replace(re2,"");}}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}if(t)ret=[];if(ret&&context==ret[0])ret.shift();done=jQuery.merge(done,ret);return done;},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2]))z=jQuery.attr(a,m[2])||'';if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)if(n.nodeType==1)n.nodeIndex=c++;merge[id]=true;}var add=false;if(first==0){if(node.nodeIndex==last)add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[];var cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&(!elem||n!=elem))r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval!=undefined)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=function(){return fn.apply(this,arguments);};handler.data=data;handler.guid=fn.guid;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){var val;if(typeof jQuery=="undefined"||jQuery.event.triggered)return val;val=jQuery.event.handle.apply(arguments.callee.elem,arguments);return val;});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else
+for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data||[]);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event)data.unshift(this.fix({type:type,target:elem}));data[0].type=type;if(exclusive)data[0].exclusive=true;if(jQuery.isFunction(jQuery.data(elem,"handle")))val=jQuery.data(elem,"handle").apply(elem,data);if(!fn&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val;event=jQuery.event.fix(event||window.event||{});var parts=event.type.split(".");event.type=parts[0];var handlers=jQuery.data(this,"events")&&jQuery.data(this,"events")[event.type],args=Array.prototype.slice.call(arguments,1);args.unshift(event);for(var j in handlers){var handler=handlers[j];args[0].handler=handler;args[0].data=handler.data;if(!parts[1]&&!event.exclusive||handler.type==parts[1]){var ret=handler.apply(this,args);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}if(jQuery.browser.msie)event.target=event.preventDefault=event.stopPropagation=event.handler=event.data=null;return val;},fix:function(event){var originalEvent=event;event=jQuery.extend({},originalEvent);event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=originalEvent.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;arguments[0].type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;arguments[0].type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){return this.each(function(){jQuery.event.add(this,type,function(event){jQuery(this).unbind(event);return(fn||data).apply(this,arguments);},fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){if(this[0])return jQuery.event.trigger(type,data,this[0],false,fn);return undefined;},toggle:function(){var args=arguments;return this.click(function(event){this.lastToggle=0==this.lastToggle?1:0;event.preventDefault();return args[this.lastToggle].apply(this,arguments)||false;});},hover:function(fnOver,fnOut){return this.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else
+jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.apply(document);});jQuery.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<document.styleSheets.length;i++)if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(numStyles===undefined)numStyles=jQuery("style, link[rel=stylesheet]").length;if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return;}jQuery.ready();})();}jQuery.event.add(window,"load",jQuery.ready);}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,select,"+"submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=parent.parentNode;}catch(error){parent=elem;}return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});jQuery.fn.extend({load:function(url,params,callback){if(jQuery.isFunction(url))return this.bind("load",url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=(new Date).getTime();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){var jsonp,jsre=/=\?(&|$)/g,status,data;s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(s.type.toLowerCase()=="get"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&s.type.toLowerCase()=="get"){var ts=(new Date()).getTime();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&s.type.toLowerCase()=="get"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");if((!s.url.indexOf("http")||!s.url.indexOf("//"))&&s.dataType=="script"&&s.type.toLowerCase()=="get"){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xml=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();xml.open(s.type,s.url,s.async,s.username,s.password);try{if(s.data)xml.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xml.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xml.setRequestHeader("X-Requested-With","XMLHttpRequest");xml.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend)s.beforeSend(xml);if(s.global)jQuery.event.trigger("ajaxSend",[xml,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xml&&(xml.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xml)&&"error"||s.ifModified&&jQuery.httpNotModified(xml,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xml,s.dataType);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xml.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else
+jQuery.handleError(s,xml,status);complete();if(s.async)xml=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xml){xml.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xml.send(s.data);}catch(e){jQuery.handleError(s,xml,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xml,s]);}function complete(){if(s.complete)s.complete(xml,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xml,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xml;},handleError:function(s,xml,status,e){if(s.error)s.error(xml,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xml,s,e]);},active:0,httpSuccess:function(r){try{return!r.status&&location.protocol=="file:"||(r.status>=200&&r.status<300)||r.status==304||r.status==1223||jQuery.browser.safari&&r.status==undefined;}catch(e){}return false;},httpNotModified:function(xml,url){try{var xmlRes=xml.getResponseHeader("Last-Modified");return xml.status==304||xmlRes==jQuery.lastModified[url]||jQuery.browser.safari&&xml.status==undefined;}catch(e){}return false;},httpData:function(r,type){var ct=r.getResponseHeader("content-type");var xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0;var data=xml?r.responseXML:r.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else
+for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else
+s.push(encodeURIComponent(j)+"="+encodeURIComponent(a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle(fn,fn2):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall);var hidden=jQuery(this).is(":hidden"),self=this;for(var p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return jQuery.isFunction(opt.complete)&&opt.complete.apply(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else
+e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.apply(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(!elem)return undefined;type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",array?jQuery.makeArray(array):[]);return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].apply(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:{slow:600,fast:200}[opt.duration])||400;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.apply(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.apply(this.elem,[this.now,this]);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=(new Date()).getTime();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)if(!timers[i]())timers.splice(i--,1);if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height")this.elem.style[this.prop]="1px";jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=(new Date()).getTime();if(gotoEnd||t>this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done&&jQuery.isFunction(this.options.complete))this.options.complete.apply(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.fx.step={scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}};jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),fixed=jQuery.css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&jQuery.css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(jQuery.css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&jQuery.css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||jQuery.css(offsetChild,"position")=="absolute"))||(mozilla&&jQuery.css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l)||0;top+=parseInt(t)||0;}return results;};})();
+
+/* platform.js */
+
+
+
+
+SimileAjax.jQuery=jQuery.noConflict(true);
+if(typeof window["$"]=="undefined"){
+window.$=SimileAjax.jQuery;
+}
+
+SimileAjax.Platform.os={
+isMac:false,
+isWin:false,
+isWin32:false,
+isUnix:false
+};
+SimileAjax.Platform.browser={
+isIE:false,
+isNetscape:false,
+isMozilla:false,
+isFirefox:false,
+isOpera:false,
+isSafari:false,
+
+majorVersion:0,
+minorVersion:0
+};
+
+(function(){
+var an=navigator.appName.toLowerCase();
+var ua=navigator.userAgent.toLowerCase();
+
+
+SimileAjax.Platform.os.isMac=(ua.indexOf('mac')!=-1);
+SimileAjax.Platform.os.isWin=(ua.indexOf('win')!=-1);
+SimileAjax.Platform.os.isWin32=SimileAjax.Platform.isWin&&(
+ua.indexOf('95')!=-1||
+ua.indexOf('98')!=-1||
+ua.indexOf('nt')!=-1||
+ua.indexOf('win32')!=-1||
+ua.indexOf('32bit')!=-1
+);
+SimileAjax.Platform.os.isUnix=(ua.indexOf('x11')!=-1);
+
+
+SimileAjax.Platform.browser.isIE=(an.indexOf("microsoft")!=-1);
+SimileAjax.Platform.browser.isNetscape=(an.indexOf("netscape")!=-1);
+SimileAjax.Platform.browser.isMozilla=(ua.indexOf("mozilla")!=-1);
+SimileAjax.Platform.browser.isFirefox=(ua.indexOf("firefox")!=-1);
+SimileAjax.Platform.browser.isOpera=(an.indexOf("opera")!=-1);
+SimileAjax.Platform.browser.isSafari=(an.indexOf("safari")!=-1);
+
+var parseVersionString=function(s){
+var a=s.split(".");
+SimileAjax.Platform.browser.majorVersion=parseInt(a[0]);
+SimileAjax.Platform.browser.minorVersion=parseInt(a[1]);
+};
+var indexOf=function(s,sub,start){
+var i=s.indexOf(sub,start);
+return i>=0?i:s.length;
+};
+
+if(SimileAjax.Platform.browser.isMozilla){
+var offset=ua.indexOf("mozilla/");
+if(offset>=0){
+parseVersionString(ua.substring(offset+8,indexOf(ua," ",offset)));
+}
+}
+if(SimileAjax.Platform.browser.isIE){
+var offset=ua.indexOf("msie ");
+if(offset>=0){
+parseVersionString(ua.substring(offset+5,indexOf(ua,";",offset)));
+}
+}
+if(SimileAjax.Platform.browser.isNetscape){
+var offset=ua.indexOf("rv:");
+if(offset>=0){
+parseVersionString(ua.substring(offset+3,indexOf(ua,")",offset)));
+}
+}
+if(SimileAjax.Platform.browser.isFirefox){
+var offset=ua.indexOf("firefox/");
+if(offset>=0){
+parseVersionString(ua.substring(offset+8,indexOf(ua," ",offset)));
+}
+}
+
+if(!("localeCompare"in String.prototype)){
+String.prototype.localeCompare=function(s){
+if(this<s)return-1;
+else if(this>s)return 1;
+else return 0;
+};
+}
+})();
+
+SimileAjax.Platform.getDefaultLocale=function(){
+return SimileAjax.Platform.clientLocale;
+};
+
+/* ajax.js */
+
+
+
+SimileAjax.ListenerQueue=function(wildcardHandlerName){
+this._listeners=[];
+this._wildcardHandlerName=wildcardHandlerName;
+};
+
+SimileAjax.ListenerQueue.prototype.add=function(listener){
+this._listeners.push(listener);
+};
+
+SimileAjax.ListenerQueue.prototype.remove=function(listener){
+var listeners=this._listeners;
+for(var i=0;i<listeners.length;i++){
+if(listeners[i]==listener){
+listeners.splice(i,1);
+break;
+}
+}
+};
+
+SimileAjax.ListenerQueue.prototype.fire=function(handlerName,args){
+var listeners=[].concat(this._listeners);
+for(var i=0;i<listeners.length;i++){
+var listener=listeners[i];
+if(handlerName in listener){
+try{
+listener[handlerName].apply(listener,args);
+}catch(e){
+SimileAjax.Debug.exception("Error firing event of name "+handlerName,e);
+}
+}else if(this._wildcardHandlerName!=null&&
+this._wildcardHandlerName in listener){
+try{
+listener[this._wildcardHandlerName].apply(listener,[handlerName]);
+}catch(e){
+SimileAjax.Debug.exception("Error firing event of name "+handlerName+" to wildcard handler",e);
+}
+}
+}
+};
+
+
+
+/* data-structure.js */
+
+
+SimileAjax.Set=function(a){
+this._hash={};
+this._count=0;
+
+if(a instanceof Array){
+for(var i=0;i<a.length;i++){
+this.add(a[i]);
+}
+}else if(a instanceof SimileAjax.Set){
+this.addSet(a);
+}
+}
+
+
+SimileAjax.Set.prototype.add=function(o){
+if(!(o in this._hash)){
+this._hash[o]=true;
+this._count++;
+return true;
+}
+return false;
+}
+
+
+SimileAjax.Set.prototype.addSet=function(set){
+for(var o in set._hash){
+this.add(o);
+}
+}
+
+
+SimileAjax.Set.prototype.remove=function(o){
+if(o in this._hash){
+delete this._hash[o];
+this._count--;
+return true;
+}
+return false;
+}
+
+
+SimileAjax.Set.prototype.removeSet=function(set){
+for(var o in set._hash){
+this.remove(o);
+}
+}
+
+
+SimileAjax.Set.prototype.retainSet=function(set){
+for(var o in this._hash){
+if(!set.contains(o)){
+delete this._hash[o];
+this._count--;
+}
+}
+}
+
+
+SimileAjax.Set.prototype.contains=function(o){
+return(o in this._hash);
+}
+
+
+SimileAjax.Set.prototype.size=function(){
+return this._count;
+}
+
+
+SimileAjax.Set.prototype.toArray=function(){
+var a=[];
+for(var o in this._hash){
+a.push(o);
+}
+return a;
+}
+
+
+SimileAjax.Set.prototype.visit=function(f){
+for(var o in this._hash){
+if(f(o)==true){
+break;
+}
+}
+}
+
+
+SimileAjax.SortedArray=function(compare,initialArray){
+this._a=(initialArray instanceof Array)?initialArray:[];
+this._compare=compare;
+};
+
+SimileAjax.SortedArray.prototype.add=function(elmt){
+var sa=this;
+var index=this.find(function(elmt2){
+return sa._compare(elmt2,elmt);
+});
+
+if(index<this._a.length){
+this._a.splice(index,0,elmt);
+}else{
+this._a.push(elmt);
+}
+};
+
+SimileAjax.SortedArray.prototype.remove=function(elmt){
+var sa=this;
+var index=this.find(function(elmt2){
+return sa._compare(elmt2,elmt);
+});
+
+while(index<this._a.length&&this._compare(this._a[index],elmt)==0){
+if(this._a[index]==elmt){
+this._a.splice(index,1);
+return true;
+}else{
+index++;
+}
+}
+return false;
+};
+
+SimileAjax.SortedArray.prototype.removeAll=function(){
+this._a=[];
+};
+
+SimileAjax.SortedArray.prototype.elementAt=function(index){
+return this._a[index];
+};
+
+SimileAjax.SortedArray.prototype.length=function(){
+return this._a.length;
+};
+
+SimileAjax.SortedArray.prototype.find=function(compare){
+var a=0;
+var b=this._a.length;
+
+while(a<b){
+var mid=Math.floor((a+b)/2);
+var c=compare(this._a[mid]);
+if(mid==a){
+return c<0?a+1:a;
+}else if(c<0){
+a=mid;
+}else{
+b=mid;
+}
+}
+return a;
+};
+
+SimileAjax.SortedArray.prototype.getFirst=function(){
+return(this._a.length>0)?this._a[0]:null;
+};
+
+SimileAjax.SortedArray.prototype.getLast=function(){
+return(this._a.length>0)?this._a[this._a.length-1]:null;
+};
+
+
+
+SimileAjax.EventIndex=function(unit){
+var eventIndex=this;
+
+this._unit=(unit!=null)?unit:SimileAjax.NativeDateUnit;
+this._events=new SimileAjax.SortedArray(
+function(event1,event2){
+return eventIndex._unit.compare(event1.getStart(),event2.getStart());
+}
+);
+this._idToEvent={};
+this._indexed=true;
+};
+
+SimileAjax.EventIndex.prototype.getUnit=function(){
+return this._unit;
+};
+
+SimileAjax.EventIndex.prototype.getEvent=function(id){
+return this._idToEvent[id];
+};
+
+SimileAjax.EventIndex.prototype.add=function(evt){
+this._events.add(evt);
+this._idToEvent[evt.getID()]=evt;
+this._indexed=false;
+};
+
+SimileAjax.EventIndex.prototype.removeAll=function(){
+this._events.removeAll();
+this._idToEvent={};
+this._indexed=false;
+};
+
+SimileAjax.EventIndex.prototype.getCount=function(){
+return this._events.length();
+};
+
+SimileAjax.EventIndex.prototype.getIterator=function(startDate,endDate){
+if(!this._indexed){
+this._index();
+}
+return new SimileAjax.EventIndex._Iterator(this._events,startDate,endDate,this._unit);
+};
+
+SimileAjax.EventIndex.prototype.getReverseIterator=function(startDate,endDate){
+if(!this._indexed){
+this._index();
+}
+return new SimileAjax.EventIndex._ReverseIterator(this._events,startDate,endDate,this._unit);
+};
+
+SimileAjax.EventIndex.prototype.getAllIterator=function(){
+return new SimileAjax.EventIndex._AllIterator(this._events);
+};
+
+SimileAjax.EventIndex.prototype.getEarliestDate=function(){
+var evt=this._events.getFirst();
+return(evt==null)?null:evt.getStart();
+};
+
+SimileAjax.EventIndex.prototype.getLatestDate=function(){
+var evt=this._events.getLast();
+if(evt==null){
+return null;
+}
+
+if(!this._indexed){
+this._index();
+}
+
+var index=evt._earliestOverlapIndex;
+var date=this._events.elementAt(index).getEnd();
+for(var i=index+1;i<this._events.length();i++){
+date=this._unit.later(date,this._events.elementAt(i).getEnd());
+}
+
+return date;
+};
+
+SimileAjax.EventIndex.prototype._index=function(){
+
+
+var l=this._events.length();
+for(var i=0;i<l;i++){
+var evt=this._events.elementAt(i);
+evt._earliestOverlapIndex=i;
+}
+
+var toIndex=1;
+for(var i=0;i<l;i++){
+var evt=this._events.elementAt(i);
+var end=evt.getEnd();
+
+toIndex=Math.max(toIndex,i+1);
+while(toIndex<l){
+var evt2=this._events.elementAt(toIndex);
+var start2=evt2.getStart();
+
+if(this._unit.compare(start2,end)<0){
+evt2._earliestOverlapIndex=i;
+toIndex++;
+}else{
+break;
+}
+}
+}
+this._indexed=true;
+};
+
+SimileAjax.EventIndex._Iterator=function(events,startDate,endDate,unit){
+this._events=events;
+this._startDate=startDate;
+this._endDate=endDate;
+this._unit=unit;
+
+this._currentIndex=events.find(function(evt){
+return unit.compare(evt.getStart(),startDate);
+});
+if(this._currentIndex-1>=0){
+this._currentIndex=this._events.elementAt(this._currentIndex-1)._earliestOverlapIndex;
+}
+this._currentIndex--;
+
+this._maxIndex=events.find(function(evt){
+return unit.compare(evt.getStart(),endDate);
+});
+
+this._hasNext=false;
+this._next=null;
+this._findNext();
+};
+
+SimileAjax.EventIndex._Iterator.prototype={
+hasNext:function(){return this._hasNext;},
+next:function(){
+if(this._hasNext){
+var next=this._next;
+this._findNext();
+
+return next;
+}else{
+return null;
+}
+},
+_findNext:function(){
+var unit=this._unit;
+while((++this._currentIndex)<this._maxIndex){
+var evt=this._events.elementAt(this._currentIndex);
+if(unit.compare(evt.getStart(),this._endDate)<0&&
+unit.compare(evt.getEnd(),this._startDate)>0){
+
+this._next=evt;
+this._hasNext=true;
+return;
+}
+}
+this._next=null;
+this._hasNext=false;
+}
+};
+
+SimileAjax.EventIndex._ReverseIterator=function(events,startDate,endDate,unit){
+this._events=events;
+this._startDate=startDate;
+this._endDate=endDate;
+this._unit=unit;
+
+this._minIndex=events.find(function(evt){
+return unit.compare(evt.getStart(),startDate);
+});
+if(this._minIndex-1>=0){
+this._minIndex=this._events.elementAt(this._minIndex-1)._earliestOverlapIndex;
+}
+
+this._maxIndex=events.find(function(evt){
+return unit.compare(evt.getStart(),endDate);
+});
+
+this._currentIndex=this._maxIndex;
+this._hasNext=false;
+this._next=null;
+this._findNext();
+};
+
+SimileAjax.EventIndex._ReverseIterator.prototype={
+hasNext:function(){return this._hasNext;},
+next:function(){
+if(this._hasNext){
+var next=this._next;
+this._findNext();
+
+return next;
+}else{
+return null;
+}
+},
+_findNext:function(){
+var unit=this._unit;
+while((--this._currentIndex)>=this._minIndex){
+var evt=this._events.elementAt(this._currentIndex);
+if(unit.compare(evt.getStart(),this._endDate)<0&&
+unit.compare(evt.getEnd(),this._startDate)>0){
+
+this._next=evt;
+this._hasNext=true;
+return;
+}
+}
+this._next=null;
+this._hasNext=false;
+}
+};
+
+SimileAjax.EventIndex._AllIterator=function(events){
+this._events=events;
+this._index=0;
+};
+
+SimileAjax.EventIndex._AllIterator.prototype={
+hasNext:function(){
+return this._index<this._events.length();
+},
+next:function(){
+return this._index<this._events.length()?
+this._events.elementAt(this._index++):null;
+}
+};
+
+/* date-time.js */
+
+
+
+SimileAjax.DateTime=new Object();
+
+SimileAjax.DateTime.MILLISECOND=0;
+SimileAjax.DateTime.SECOND=1;
+SimileAjax.DateTime.MINUTE=2;
+SimileAjax.DateTime.HOUR=3;
+SimileAjax.DateTime.DAY=4;
+SimileAjax.DateTime.WEEK=5;
+SimileAjax.DateTime.MONTH=6;
+SimileAjax.DateTime.YEAR=7;
+SimileAjax.DateTime.DECADE=8;
+SimileAjax.DateTime.CENTURY=9;
+SimileAjax.DateTime.MILLENNIUM=10;
+
+SimileAjax.DateTime.EPOCH=-1;
+SimileAjax.DateTime.ERA=-2;
+
+
+SimileAjax.DateTime.gregorianUnitLengths=[];
+(function(){
+var d=SimileAjax.DateTime;
+var a=d.gregorianUnitLengths;
+
+a[d.MILLISECOND]=1;
+a[d.SECOND]=1000;
+a[d.MINUTE]=a[d.SECOND]*60;
+a[d.HOUR]=a[d.MINUTE]*60;
+a[d.DAY]=a[d.HOUR]*24;
+a[d.WEEK]=a[d.DAY]*7;
+a[d.MONTH]=a[d.DAY]*31;
+a[d.YEAR]=a[d.DAY]*365;
+a[d.DECADE]=a[d.YEAR]*10;
+a[d.CENTURY]=a[d.YEAR]*100;
+a[d.MILLENNIUM]=a[d.YEAR]*1000;
+})();
+
+SimileAjax.DateTime._dateRegexp=new RegExp(
+"^(-?)([0-9]{4})("+[
+"(-?([0-9]{2})(-?([0-9]{2}))?)",
+"(-?([0-9]{3}))",
+"(-?W([0-9]{2})(-?([1-7]))?)"
+].join("|")+")?$"
+);
+SimileAjax.DateTime._timezoneRegexp=new RegExp(
+"Z|(([-+])([0-9]{2})(:?([0-9]{2}))?)$"
+);
+SimileAjax.DateTime._timeRegexp=new RegExp(
+"^([0-9]{2})(:?([0-9]{2})(:?([0-9]{2})(\.([0-9]+))?)?)?$"
+);
+
+
+SimileAjax.DateTime.setIso8601Date=function(dateObject,string){
+
+
+var d=string.match(SimileAjax.DateTime._dateRegexp);
+if(!d){
+throw new Error("Invalid date string: "+string);
+}
+
+var sign=(d[1]=="-")?-1:1;
+var year=sign*d[2];
+var month=d[5];
+var date=d[7];
+var dayofyear=d[9];
+var week=d[11];
+var dayofweek=(d[13])?d[13]:1;
+
+dateObject.setUTCFullYear(year);
+if(dayofyear){
+dateObject.setUTCMonth(0);
+dateObject.setUTCDate(Number(dayofyear));
+}else if(week){
+dateObject.setUTCMonth(0);
+dateObject.setUTCDate(1);
+var gd=dateObject.getUTCDay();
+var day=(gd)?gd:7;
+var offset=Number(dayofweek)+(7*Number(week));
+
+if(day<=4){
+dateObject.setUTCDate(offset+1-day);
+}else{
+dateObject.setUTCDate(offset+8-day);
+}
+}else{
+if(month){
+dateObject.setUTCDate(1);
+dateObject.setUTCMonth(month-1);
+}
+if(date){
+dateObject.setUTCDate(date);
+}
+}
+
+return dateObject;
+};
+
+
+SimileAjax.DateTime.setIso8601Time=function(dateObject,string){
+
+
+var d=string.match(SimileAjax.DateTime._timeRegexp);
+if(!d){
+SimileAjax.Debug.warn("Invalid time string: "+string);
+return false;
+}
+var hours=d[1];
+var mins=Number((d[3])?d[3]:0);
+var secs=(d[5])?d[5]:0;
+var ms=d[7]?(Number("0."+d[7])*1000):0;
+
+dateObject.setUTCHours(hours);
+dateObject.setUTCMinutes(mins);
+dateObject.setUTCSeconds(secs);
+dateObject.setUTCMilliseconds(ms);
+
+return dateObject;
+};
+
+
+SimileAjax.DateTime.timezoneOffset=new Date().getTimezoneOffset();
+
+
+SimileAjax.DateTime.setIso8601=function(dateObject,string){
+
+
+var offset=null;
+var comps=(string.indexOf("T")==-1)?string.split(" "):string.split("T");
+
+SimileAjax.DateTime.setIso8601Date(dateObject,comps[0]);
+if(comps.length==2){
+
+var d=comps[1].match(SimileAjax.DateTime._timezoneRegexp);
+if(d){
+if(d[0]=='Z'){
+offset=0;
+}else{
+offset=(Number(d[3])*60)+Number(d[5]);
+offset*=((d[2]=='-')?1:-1);
+}
+comps[1]=comps[1].substr(0,comps[1].length-d[0].length);
+}
+
+SimileAjax.DateTime.setIso8601Time(dateObject,comps[1]);
+}
+if(offset==null){
+offset=dateObject.getTimezoneOffset();
+}
+dateObject.setTime(dateObject.getTime()+offset*60000);
+
+return dateObject;
+};
+
+
+SimileAjax.DateTime.parseIso8601DateTime=function(string){
+try{
+return SimileAjax.DateTime.setIso8601(new Date(0),string);
+}catch(e){
+return null;
+}
+};
+
+
+SimileAjax.DateTime.parseGregorianDateTime=function(o){
+if(o==null){
+return null;
+}else if(o instanceof Date){
+return o;
+}
+
+var s=o.toString();
+if(s.length>0&&s.length<8){
+var space=s.indexOf(" ");
+if(space>0){
+var year=parseInt(s.substr(0,space));
+var suffix=s.substr(space+1);
+if(suffix.toLowerCase()=="bc"){
+year=1-year;
+}
+}else{
+var year=parseInt(s);
+}
+
+var d=new Date(0);
+d.setUTCFullYear(year);
+
+return d;
+}
+
+try{
+return new Date(Date.parse(s));
+}catch(e){
+return null;
+}
+};
+
+
+SimileAjax.DateTime.roundDownToInterval=function(date,intervalUnit,timeZone,multiple,firstDayOfWeek){
+var timeShift=timeZone*
+SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.HOUR];
+
+var date2=new Date(date.getTime()+timeShift);
+var clearInDay=function(d){
+d.setUTCMilliseconds(0);
+d.setUTCSeconds(0);
+d.setUTCMinutes(0);
+d.setUTCHours(0);
+};
+var clearInYear=function(d){
+clearInDay(d);
+d.setUTCDate(1);
+d.setUTCMonth(0);
+};
+
+switch(intervalUnit){
+case SimileAjax.DateTime.MILLISECOND:
+var x=date2.getUTCMilliseconds();
+date2.setUTCMilliseconds(x-(x%multiple));
+break;
+case SimileAjax.DateTime.SECOND:
+date2.setUTCMilliseconds(0);
+
+var x=date2.getUTCSeconds();
+date2.setUTCSeconds(x-(x%multiple));
+break;
+case SimileAjax.DateTime.MINUTE:
+date2.setUTCMilliseconds(0);
+date2.setUTCSeconds(0);
+
+var x=date2.getUTCMinutes();
+date2.setTime(date2.getTime()-
+(x%multiple)*SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.MINUTE]);
+break;
+case SimileAjax.DateTime.HOUR:
+date2.setUTCMilliseconds(0);
+date2.setUTCSeconds(0);
+date2.setUTCMinutes(0);
+
+var x=date2.getUTCHours();
+date2.setUTCHours(x-(x%multiple));
+break;
+case SimileAjax.DateTime.DAY:
+clearInDay(date2);
+break;
+case SimileAjax.DateTime.WEEK:
+clearInDay(date2);
+var d=(date2.getUTCDay()+7-firstDayOfWeek)%7;
+date2.setTime(date2.getTime()-
+d*SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.DAY]);
+break;
+case SimileAjax.DateTime.MONTH:
+clearInDay(date2);
+date2.setUTCDate(1);
+
+var x=date2.getUTCMonth();
+date2.setUTCMonth(x-(x%multiple));
+break;
+case SimileAjax.DateTime.YEAR:
+clearInYear(date2);
+
+var x=date2.getUTCFullYear();
+date2.setUTCFullYear(x-(x%multiple));
+break;
+case SimileAjax.DateTime.DECADE:
+clearInYear(date2);
+date2.setUTCFullYear(Math.floor(date2.getUTCFullYear()/10)*10);
+break;
+case SimileAjax.DateTime.CENTURY:
+clearInYear(date2);
+date2.setUTCFullYear(Math.floor(date2.getUTCFullYear()/100)*100);
+break;
+case SimileAjax.DateTime.MILLENNIUM:
+clearInYear(date2);
+date2.setUTCFullYear(Math.floor(date2.getUTCFullYear()/1000)*1000);
+break;
+}
+
+date.setTime(date2.getTime()-timeShift);
+};
+
+
+SimileAjax.DateTime.roundUpToInterval=function(date,intervalUnit,timeZone,multiple,firstDayOfWeek){
+var originalTime=date.getTime();
+SimileAjax.DateTime.roundDownToInterval(date,intervalUnit,timeZone,multiple,firstDayOfWeek);
+if(date.getTime()<originalTime){
+date.setTime(date.getTime()+
+SimileAjax.DateTime.gregorianUnitLengths[intervalUnit]*multiple);
+}
+};
+
+
+SimileAjax.DateTime.incrementByInterval=function(date,intervalUnit,timeZone){
+timeZone=(typeof timeZone=='undefined')?0:timeZone;
+
+var timeShift=timeZone*
+SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.HOUR];
+
+var date2=new Date(date.getTime()+timeShift);
+
+switch(intervalUnit){
+case SimileAjax.DateTime.MILLISECOND:
+date2.setTime(date2.getTime()+1)
+break;
+case SimileAjax.DateTime.SECOND:
+date2.setTime(date2.getTime()+1000);
+break;
+case SimileAjax.DateTime.MINUTE:
+date2.setTime(date2.getTime()+
+SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.MINUTE]);
+break;
+case SimileAjax.DateTime.HOUR:
+date2.setTime(date2.getTime()+
+SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.HOUR]);
+break;
+case SimileAjax.DateTime.DAY:
+date2.setUTCDate(date2.getUTCDate()+1);
+break;
+case SimileAjax.DateTime.WEEK:
+date2.setUTCDate(date2.getUTCDate()+7);
+break;
+case SimileAjax.DateTime.MONTH:
+date2.setUTCMonth(date2.getUTCMonth()+1);
+break;
+case SimileAjax.DateTime.YEAR:
+date2.setUTCFullYear(date2.getUTCFullYear()+1);
+break;
+case SimileAjax.DateTime.DECADE:
+date2.setUTCFullYear(date2.getUTCFullYear()+10);
+break;
+case SimileAjax.DateTime.CENTURY:
+date2.setUTCFullYear(date2.getUTCFullYear()+100);
+break;
+case SimileAjax.DateTime.MILLENNIUM:
+date2.setUTCFullYear(date2.getUTCFullYear()+1000);
+break;
+}
+
+date.setTime(date2.getTime()-timeShift);
+};
+
+
+SimileAjax.DateTime.removeTimeZoneOffset=function(date,timeZone){
+return new Date(date.getTime()+
+timeZone*SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.HOUR]);
+};
+
+
+SimileAjax.DateTime.getTimezone=function(){
+var d=new Date().getTimezoneOffset();
+return d/-60;
+};
+
+
+/* debug.js */
+
+
+
+SimileAjax.Debug={
+silent:false
+};
+
+SimileAjax.Debug.log=function(msg){
+var f;
+if("console"in window&&"log"in window.console){
+f=function(msg2){
+console.log(msg2);
+}
+}else{
+f=function(msg2){
+if(!SimileAjax.Debug.silent){
+alert(msg2);
+}
+}
+}
+SimileAjax.Debug.log=f;
+f(msg);
+};
+
+SimileAjax.Debug.warn=function(msg){
+var f;
+if("console"in window&&"warn"in window.console){
+f=function(msg2){
+console.warn(msg2);
+}
+}else{
+f=function(msg2){
+if(!SimileAjax.Debug.silent){
+alert(msg2);
+}
+}
+}
+SimileAjax.Debug.warn=f;
+f(msg);
+};
+
+SimileAjax.Debug.exception=function(e,msg){
+var f,params=SimileAjax.parseURLParameters();
+if(params.errors=="throw"||SimileAjax.params.errors=="throw"){
+f=function(e2,msg2){
+throw(e2);
+};
+}else if("console"in window&&"error"in window.console){
+f=function(e2,msg2){
+if(msg2!=null){
+console.error(msg2+" %o",e2);
+}else{
+console.error(e2);
+}
+throw(e2);
+};
+}else{
+f=function(e2,msg2){
+if(!SimileAjax.Debug.silent){
+alert("Caught exception: "+msg2+"\n\nDetails: "+("description"in e2?e2.description:e2));
+}
+throw(e2);
+};
+}
+SimileAjax.Debug.exception=f;
+f(e,msg);
+};
+
+SimileAjax.Debug.objectToString=function(o){
+return SimileAjax.Debug._objectToString(o,"");
+};
+
+SimileAjax.Debug._objectToString=function(o,indent){
+var indent2=indent+" ";
+if(typeof o=="object"){
+var s="{";
+for(n in o){
+s+=indent2+n+": "+SimileAjax.Debug._objectToString(o[n],indent2)+"\n";
+}
+s+=indent+"}";
+return s;
+}else if(typeof o=="array"){
+var s="[";
+for(var n=0;n<o.length;n++){
+s+=SimileAjax.Debug._objectToString(o[n],indent2)+"\n";
+}
+s+=indent+"]";
+return s;
+}else{
+return o;
+}
+};
+
+
+/* dom.js */
+
+
+
+SimileAjax.DOM=new Object();
+
+SimileAjax.DOM.registerEventWithObject=function(elmt,eventName,obj,handlerName){
+SimileAjax.DOM.registerEvent(elmt,eventName,function(elmt2,evt,target){
+return obj[handlerName].call(obj,elmt2,evt,target);
+});
+};
+
+SimileAjax.DOM.registerEvent=function(elmt,eventName,handler){
+var handler2=function(evt){
+evt=(evt)?evt:((event)?event:null);
+if(evt){
+var target=(evt.target)?
+evt.target:((evt.srcElement)?evt.srcElement:null);
+if(target){
+target=(target.nodeType==1||target.nodeType==9)?
+target:target.parentNode;
+}
+
+return handler(elmt,evt,target);
+}
+return true;
+}
+
+if(SimileAjax.Platform.browser.isIE){
+elmt.attachEvent("on"+eventName,handler2);
+}else{
+elmt.addEventListener(eventName,handler2,false);
+}
+};
+
+SimileAjax.DOM.getPageCoordinates=function(elmt){
+var left=0;
+var top=0;
+
+if(elmt.nodeType!=1){
+elmt=elmt.parentNode;
+}
+
+var elmt2=elmt;
+while(elmt2!=null){
+left+=elmt2.offsetLeft;
+top+=elmt2.offsetTop;
+elmt2=elmt2.offsetParent;
+}
+
+var body=document.body;
+while(elmt!=null&&elmt!=body){
+if("scrollLeft"in elmt){
+left-=elmt.scrollLeft;
+top-=elmt.scrollTop;
+}
+elmt=elmt.parentNode;
+}
+
+return{left:left,top:top};
+};
+
+SimileAjax.DOM.getSize=function(elmt){
+var w=this.getStyle(elmt,"width");
+var h=this.getStyle(elmt,"height");
+if(w.indexOf("px")>-1)w=w.replace("px","");
+if(h.indexOf("px")>-1)h=h.replace("px","");
+return{
+w:w,
+h:h
+}
+}
+
+SimileAjax.DOM.getStyle=function(elmt,styleProp){
+if(elmt.currentStyle){
+var style=elmt.currentStyle[styleProp];
+}else if(window.getComputedStyle){
+var style=document.defaultView.getComputedStyle(elmt,null).getPropertyValue(styleProp);
+}else{
+var style="";
+}
+return style;
+}
+
+SimileAjax.DOM.getEventRelativeCoordinates=function(evt,elmt){
+if(SimileAjax.Platform.browser.isIE){
+if(evt.type=="mousewheel"){
+var coords=SimileAjax.DOM.getPageCoordinates(elmt);
+return{
+x:evt.clientX-coords.left,
+y:evt.clientY-coords.top
+};
+}else{
+return{
+x:evt.offsetX,
+y:evt.offsetY
+};
+}
+}else{
+var coords=SimileAjax.DOM.getPageCoordinates(elmt);
+
+if((evt.type=="DOMMouseScroll")&&
+SimileAjax.Platform.browser.isFirefox&&
+(SimileAjax.Platform.browser.majorVersion==2)){
+
+
+return{
+x:evt.screenX-coords.left,
+y:evt.screenY-coords.top
+};
+}else{
+return{
+x:evt.pageX-coords.left,
+y:evt.pageY-coords.top
+};
+}
+}
+};
+
+SimileAjax.DOM.getEventPageCoordinates=function(evt){
+if(SimileAjax.Platform.browser.isIE){
+return{
+x:evt.clientX+document.body.scrollLeft,
+y:evt.clientY+document.body.scrollTop
+};
+}else{
+return{
+x:evt.pageX,
+y:evt.pageY
+};
+}
+};
+
+SimileAjax.DOM.hittest=function(x,y,except){
+return SimileAjax.DOM._hittest(document.body,x,y,except);
+};
+
+SimileAjax.DOM._hittest=function(elmt,x,y,except){
+var childNodes=elmt.childNodes;
+outer:for(var i=0;i<childNodes.length;i++){
+var childNode=childNodes[i];
+for(var j=0;j<except.length;j++){
+if(childNode==except[j]){
+continue outer;
+}
+}
+
+if(childNode.offsetWidth==0&&childNode.offsetHeight==0){
+
+var hitNode=SimileAjax.DOM._hittest(childNode,x,y,except);
+if(hitNode!=childNode){
+return hitNode;
+}
+}else{
+var top=0;
+var left=0;
+
+var node=childNode;
+while(node){
+top+=node.offsetTop;
+left+=node.offsetLeft;
+node=node.offsetParent;
+}
+
+if(left<=x&&top<=y&&(x-left)<childNode.offsetWidth&&(y-top)<childNode.offsetHeight){
+return SimileAjax.DOM._hittest(childNode,x,y,except);
+}else if(childNode.nodeType==1&&childNode.tagName=="TR"){
+
+var childNode2=SimileAjax.DOM._hittest(childNode,x,y,except);
+if(childNode2!=childNode){
+return childNode2;
+}
+}
+}
+}
+return elmt;
+};
+
+SimileAjax.DOM.cancelEvent=function(evt){
+evt.returnValue=false;
+evt.cancelBubble=true;
+if("preventDefault"in evt){
+evt.preventDefault();
+}
+};
+
+SimileAjax.DOM.appendClassName=function(elmt,className){
+var classes=elmt.className.split(" ");
+for(var i=0;i<classes.length;i++){
+if(classes[i]==className){
+return;
+}
+}
+classes.push(className);
+elmt.className=classes.join(" ");
+};
+
+SimileAjax.DOM.createInputElement=function(type){
+var div=document.createElement("div");
+div.innerHTML="<input type='"+type+"' />";
+
+return div.firstChild;
+};
+
+SimileAjax.DOM.createDOMFromTemplate=function(template){
+var result={};
+result.elmt=SimileAjax.DOM._createDOMFromTemplate(template,result,null);
+
+return result;
+};
+
+SimileAjax.DOM._createDOMFromTemplate=function(templateNode,result,parentElmt){
+if(templateNode==null){
+
+return null;
+}else if(typeof templateNode!="object"){
+var node=document.createTextNode(templateNode);
+if(parentElmt!=null){
+parentElmt.appendChild(node);
+}
+return node;
+}else{
+var elmt=null;
+if("tag"in templateNode){
+var tag=templateNode.tag;
+if(parentElmt!=null){
+if(tag=="tr"){
+elmt=parentElmt.insertRow(parentElmt.rows.length);
+}else if(tag=="td"){
+elmt=parentElmt.insertCell(parentElmt.cells.length);
+}
+}
+if(elmt==null){
+elmt=tag=="input"?
+SimileAjax.DOM.createInputElement(templateNode.type):
+document.createElement(tag);
+
+if(parentElmt!=null){
+parentElmt.appendChild(elmt);
+}
+}
+}else{
+elmt=templateNode.elmt;
+if(parentElmt!=null){
+parentElmt.appendChild(elmt);
+}
+}
+
+for(var attribute in templateNode){
+var value=templateNode[attribute];
+
+if(attribute=="field"){
+result[value]=elmt;
+
+}else if(attribute=="className"){
+elmt.className=value;
+}else if(attribute=="id"){
+elmt.id=value;
+}else if(attribute=="title"){
+elmt.title=value;
+}else if(attribute=="type"&&elmt.tagName=="input"){
+
+}else if(attribute=="style"){
+for(n in value){
+var v=value[n];
+if(n=="float"){
+n=SimileAjax.Platform.browser.isIE?"styleFloat":"cssFloat";
+}
+elmt.style[n]=v;
+}
+}else if(attribute=="children"){
+for(var i=0;i<value.length;i++){
+SimileAjax.DOM._createDOMFromTemplate(value[i],result,elmt);
+}
+}else if(attribute!="tag"&&attribute!="elmt"){
+elmt.setAttribute(attribute,value);
+}
+}
+return elmt;
+}
+}
+
+SimileAjax.DOM._cachedParent=null;
+SimileAjax.DOM.createElementFromString=function(s){
+if(SimileAjax.DOM._cachedParent==null){
+SimileAjax.DOM._cachedParent=document.createElement("div");
+}
+SimileAjax.DOM._cachedParent.innerHTML=s;
+return SimileAjax.DOM._cachedParent.firstChild;
+};
+
+SimileAjax.DOM.createDOMFromString=function(root,s,fieldElmts){
+var elmt=typeof root=="string"?document.createElement(root):root;
+elmt.innerHTML=s;
+
+var dom={elmt:elmt};
+SimileAjax.DOM._processDOMChildrenConstructedFromString(dom,elmt,fieldElmts!=null?fieldElmts:{});
+
+return dom;
+};
+
+SimileAjax.DOM._processDOMConstructedFromString=function(dom,elmt,fieldElmts){
+var id=elmt.id;
+if(id!=null&&id.length>0){
+elmt.removeAttribute("id");
+if(id in fieldElmts){
+var parentElmt=elmt.parentNode;
+parentElmt.insertBefore(fieldElmts[id],elmt);
+parentElmt.removeChild(elmt);
+
+dom[id]=fieldElmts[id];
+return;
+}else{
+dom[id]=elmt;
+}
+}
+
+if(elmt.hasChildNodes()){
+SimileAjax.DOM._processDOMChildrenConstructedFromString(dom,elmt,fieldElmts);
+}
+};
+
+SimileAjax.DOM._processDOMChildrenConstructedFromString=function(dom,elmt,fieldElmts){
+var node=elmt.firstChild;
+while(node!=null){
+var node2=node.nextSibling;
+if(node.nodeType==1){
+SimileAjax.DOM._processDOMConstructedFromString(dom,node,fieldElmts);
+}
+node=node2;
+}
+};
+
+
+/* graphics.js */
+
+
+
+SimileAjax.Graphics=new Object();
+
+
+SimileAjax.Graphics.pngIsTranslucent=(!SimileAjax.Platform.browser.isIE)||(SimileAjax.Platform.browser.majorVersion>6);
+
+
+SimileAjax.Graphics._createTranslucentImage1=function(url,verticalAlign){
+var elmt=document.createElement("img");
+elmt.setAttribute("src",url);
+if(verticalAlign!=null){
+elmt.style.verticalAlign=verticalAlign;
+}
+return elmt;
+};
+SimileAjax.Graphics._createTranslucentImage2=function(url,verticalAlign){
+var elmt=document.createElement("img");
+elmt.style.width="1px";
+elmt.style.height="1px";
+elmt.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+url+"', sizingMethod='image')";
+elmt.style.verticalAlign=(verticalAlign!=null)?verticalAlign:"middle";
+return elmt;
+};
+
+
+SimileAjax.Graphics.createTranslucentImage=SimileAjax.Graphics.pngIsTranslucent?
+SimileAjax.Graphics._createTranslucentImage1:
+SimileAjax.Graphics._createTranslucentImage2;
+
+SimileAjax.Graphics._createTranslucentImageHTML1=function(url,verticalAlign){
+return"<img src=\""+url+"\""+
+(verticalAlign!=null?" style=\"vertical-align: "+verticalAlign+";\"":"")+
+" />";
+};
+SimileAjax.Graphics._createTranslucentImageHTML2=function(url,verticalAlign){
+var style=
+"width: 1px; height: 1px; "+
+"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+url+"', sizingMethod='image');"+
+(verticalAlign!=null?" vertical-align: "+verticalAlign+";":"");
+
+return"<img src='"+url+"' style=\""+style+"\" />";
+};
+
+
+SimileAjax.Graphics.createTranslucentImageHTML=SimileAjax.Graphics.pngIsTranslucent?
+SimileAjax.Graphics._createTranslucentImageHTML1:
+SimileAjax.Graphics._createTranslucentImageHTML2;
+
+
+SimileAjax.Graphics.setOpacity=function(elmt,opacity){
+if(SimileAjax.Platform.browser.isIE){
+elmt.style.filter="progid:DXImageTransform.Microsoft.Alpha(Style=0,Opacity="+opacity+")";
+}else{
+var o=(opacity/100).toString();
+elmt.style.opacity=o;
+elmt.style.MozOpacity=o;
+}
+};
+
+
+SimileAjax.Graphics._bubbleMargins={
+top:33,
+bottom:42,
+left:33,
+right:40
+}
+
+
+SimileAjax.Graphics._arrowOffsets={
+top:0,
+bottom:9,
+left:1,
+right:8
+}
+
+SimileAjax.Graphics._bubblePadding=15;
+SimileAjax.Graphics._bubblePointOffset=6;
+SimileAjax.Graphics._halfArrowWidth=18;
+
+
+SimileAjax.Graphics.createBubbleForContentAndPoint=function(div,pageX,pageY,contentWidth,orientation){
+if(typeof contentWidth!="number"){
+contentWidth=300;
+}
+
+div.style.position="absolute";
+div.style.left="-5000px";
+div.style.top="0px";
+div.style.width=contentWidth+"px";
+document.body.appendChild(div);
+
+window.setTimeout(function(){
+var width=div.scrollWidth+10;
+var height=div.scrollHeight+10;
+
+var bubble=SimileAjax.Graphics.createBubbleForPoint(pageX,pageY,width,height,orientation);
+
+document.body.removeChild(div);
+div.style.position="static";
+div.style.left="";
+div.style.top="";
+div.style.width=width+"px";
+bubble.content.appendChild(div);
+},200);
+};
+
+
+SimileAjax.Graphics.createBubbleForPoint=function(pageX,pageY,contentWidth,contentHeight,orientation){
+function getWindowDims(){
+if(typeof window.innerHeight=='number'){
+return{w:window.innerWidth,h:window.innerHeight};
+}else if(document.documentElement&&document.documentElement.clientHeight){
+return{
+w:document.documentElement.clientWidth,
+h:document.documentElement.clientHeight
+};
+}else if(document.body&&document.body.clientHeight){
+return{
+w:document.body.clientWidth,
+h:document.body.clientHeight
+};
+}
+}
+
+var close=function(){
+if(!bubble._closed){
+document.body.removeChild(bubble._div);
+bubble._doc=null;
+bubble._div=null;
+bubble._content=null;
+bubble._closed=true;
+}
+}
+var bubble={
+_closed:false
+};
+
+var dims=getWindowDims();
+var docWidth=dims.w;
+var docHeight=dims.h;
+
+var margins=SimileAjax.Graphics._bubbleMargins;
+contentWidth=parseInt(contentWidth,10);
+contentHeight=parseInt(contentHeight,10);
+var bubbleWidth=margins.left+contentWidth+margins.right;
+var bubbleHeight=margins.top+contentHeight+margins.bottom;
+
+var pngIsTranslucent=SimileAjax.Graphics.pngIsTranslucent;
+var urlPrefix=SimileAjax.urlPrefix;
+
+var setImg=function(elmt,url,width,height){
+elmt.style.position="absolute";
+elmt.style.width=width+"px";
+elmt.style.height=height+"px";
+if(pngIsTranslucent){
+elmt.style.background="url("+url+")";
+}else{
+elmt.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+url+"', sizingMethod='crop')";
+}
+}
+var div=document.createElement("div");
+div.style.width=bubbleWidth+"px";
+div.style.height=bubbleHeight+"px";
+div.style.position="absolute";
+div.style.zIndex=1000;
+
+var layer=SimileAjax.WindowManager.pushLayer(close,true,div);
+bubble._div=div;
+bubble.close=function(){SimileAjax.WindowManager.popLayer(layer);}
+
+var divInner=document.createElement("div");
+divInner.style.width="100%";
+divInner.style.height="100%";
+divInner.style.position="relative";
+div.appendChild(divInner);
+
+var createImg=function(url,left,top,width,height){
+var divImg=document.createElement("div");
+divImg.style.left=left+"px";
+divImg.style.top=top+"px";
+setImg(divImg,url,width,height);
+divInner.appendChild(divImg);
+}
+
+createImg(urlPrefix+"images/bubble-top-left.png",0,0,margins.left,margins.top);
+createImg(urlPrefix+"images/bubble-top.png",margins.left,0,contentWidth,margins.top);
+createImg(urlPrefix+"images/bubble-top-right.png",margins.left+contentWidth,0,margins.right,margins.top);
+
+createImg(urlPrefix+"images/bubble-left.png",0,margins.top,margins.left,contentHeight);
+createImg(urlPrefix+"images/bubble-right.png",margins.left+contentWidth,margins.top,margins.right,contentHeight);
+
+createImg(urlPrefix+"images/bubble-bottom-left.png",0,margins.top+contentHeight,margins.left,margins.bottom);
+createImg(urlPrefix+"images/bubble-bottom.png",margins.left,margins.top+contentHeight,contentWidth,margins.bottom);
+createImg(urlPrefix+"images/bubble-bottom-right.png",margins.left+contentWidth,margins.top+contentHeight,margins.right,margins.bottom);
+
+var divClose=document.createElement("div");
+divClose.style.left=(bubbleWidth-margins.right+SimileAjax.Graphics._bubblePadding-16-2)+"px";
+divClose.style.top=(margins.top-SimileAjax.Graphics._bubblePadding+1)+"px";
+divClose.style.cursor="pointer";
+setImg(divClose,urlPrefix+"images/close-button.png",16,16);
+SimileAjax.WindowManager.registerEventWithObject(divClose,"click",bubble,"close");
+divInner.appendChild(divClose);
+
+var divContent=document.createElement("div");
+divContent.style.position="absolute";
+divContent.style.left=margins.left+"px";
+divContent.style.top=margins.top+"px";
+divContent.style.width=contentWidth+"px";
+divContent.style.height=contentHeight+"px";
+divContent.style.overflow="auto";
+divContent.style.background="white";
+divInner.appendChild(divContent);
+bubble.content=divContent;
+
+(function(){
+if(pageX-SimileAjax.Graphics._halfArrowWidth-SimileAjax.Graphics._bubblePadding>0&&
+pageX+SimileAjax.Graphics._halfArrowWidth+SimileAjax.Graphics._bubblePadding<docWidth){
+
+var left=pageX-Math.round(contentWidth/2)-margins.left;
+left=pageX<(docWidth/2)?
+Math.max(left,-(margins.left-SimileAjax.Graphics._bubblePadding)):
+Math.min(left,docWidth+(margins.right-SimileAjax.Graphics._bubblePadding)-bubbleWidth);
+
+if((orientation&&orientation=="top")||(!orientation&&(pageY-SimileAjax.Graphics._bubblePointOffset-bubbleHeight>0))){
+var divImg=document.createElement("div");
+
+divImg.style.left=(pageX-SimileAjax.Graphics._halfArrowWidth-left)+"px";
+divImg.style.top=(margins.top+contentHeight)+"px";
+setImg(divImg,urlPrefix+"images/bubble-bottom-arrow.png",37,margins.bottom);
+divInner.appendChild(divImg);
+
+div.style.left=left+"px";
+div.style.top=(pageY-SimileAjax.Graphics._bubblePointOffset-bubbleHeight+
+SimileAjax.Graphics._arrowOffsets.bottom)+"px";
+
+return;
+}else if((orientation&&orientation=="bottom")||(!orientation&&(pageY+SimileAjax.Graphics._bubblePointOffset+bubbleHeight<docHeight))){
+var divImg=document.createElement("div");
+
+divImg.style.left=(pageX-SimileAjax.Graphics._halfArrowWidth-left)+"px";
+divImg.style.top="0px";
+setImg(divImg,urlPrefix+"images/bubble-top-arrow.png",37,margins.top);
+divInner.appendChild(divImg);
+
+div.style.left=left+"px";
+div.style.top=(pageY+SimileAjax.Graphics._bubblePointOffset-
+SimileAjax.Graphics._arrowOffsets.top)+"px";
+
+return;
+}
+}
+
+var top=pageY-Math.round(contentHeight/2)-margins.top;
+top=pageY<(docHeight/2)?
+Math.max(top,-(margins.top-SimileAjax.Graphics._bubblePadding)):
+Math.min(top,docHeight+(margins.bottom-SimileAjax.Graphics._bubblePadding)-bubbleHeight);
+
+if((orientation&&orientation=="left")||(!orientation&&(pageX-SimileAjax.Graphics._bubblePointOffset-bubbleWidth>0))){
+var divImg=document.createElement("div");
+
+divImg.style.left=(margins.left+contentWidth)+"px";
+divImg.style.top=(pageY-SimileAjax.Graphics._halfArrowWidth-top)+"px";
+setImg(divImg,urlPrefix+"images/bubble-right-arrow.png",margins.right,37);
+divInner.appendChild(divImg);
+
+div.style.left=(pageX-SimileAjax.Graphics._bubblePointOffset-bubbleWidth+
+SimileAjax.Graphics._arrowOffsets.right)+"px";
+div.style.top=top+"px";
+}else if((orientation&&orientation=="right")||(!orientation&&(pageX-SimileAjax.Graphics._bubblePointOffset-bubbleWidth<docWidth))){
+var divImg=document.createElement("div");
+
+divImg.style.left="0px";
+divImg.style.top=(pageY-SimileAjax.Graphics._halfArrowWidth-top)+"px";
+setImg(divImg,urlPrefix+"images/bubble-left-arrow.png",margins.left,37);
+divInner.appendChild(divImg);
+
+div.style.left=(pageX+SimileAjax.Graphics._bubblePointOffset-
+SimileAjax.Graphics._arrowOffsets.left)+"px";
+div.style.top=top+"px";
+}
+})();
+
+document.body.appendChild(div);
+
+return bubble;
+};
+
+
+SimileAjax.Graphics.createMessageBubble=function(doc){
+var containerDiv=doc.createElement("div");
+if(SimileAjax.Graphics.pngIsTranslucent){
+var topDiv=doc.createElement("div");
+topDiv.style.height="33px";
+topDiv.style.background="url("+SimileAjax.urlPrefix+"images/message-top-left.png) top left no-repeat";
+topDiv.style.paddingLeft="44px";
+containerDiv.appendChild(topDiv);
+
+var topRightDiv=doc.createElement("div");
+topRightDiv.style.height="33px";
+topRightDiv.style.background="url("+SimileAjax.urlPrefix+"images/message-top-right.png) top right no-repeat";
+topDiv.appendChild(topRightDiv);
+
+var middleDiv=doc.createElement("div");
+middleDiv.style.background="url("+SimileAjax.urlPrefix+"images/message-left.png) top left repeat-y";
+middleDiv.style.paddingLeft="44px";
+containerDiv.appendChild(middleDiv);
+
+var middleRightDiv=doc.createElement("div");
+middleRightDiv.style.background="url("+SimileAjax.urlPrefix+"images/message-right.png) top right repeat-y";
+middleRightDiv.style.paddingRight="44px";
+middleDiv.appendChild(middleRightDiv);
+
+var contentDiv=doc.createElement("div");
+middleRightDiv.appendChild(contentDiv);
+
+var bottomDiv=doc.createElement("div");
+bottomDiv.style.height="55px";
+bottomDiv.style.background="url("+SimileAjax.urlPrefix+"images/message-bottom-left.png) bottom left no-repeat";
+bottomDiv.style.paddingLeft="44px";
+containerDiv.appendChild(bottomDiv);
+
+var bottomRightDiv=doc.createElement("div");
+bottomRightDiv.style.height="55px";
+bottomRightDiv.style.background="url("+SimileAjax.urlPrefix+"images/message-bottom-right.png) bottom right no-repeat";
+bottomDiv.appendChild(bottomRightDiv);
+}else{
+containerDiv.style.border="2px solid #7777AA";
+containerDiv.style.padding="20px";
+containerDiv.style.background="white";
+SimileAjax.Graphics.setOpacity(containerDiv,90);
+
+var contentDiv=doc.createElement("div");
+containerDiv.appendChild(contentDiv);
+}
+
+return{
+containerDiv:containerDiv,
+contentDiv:contentDiv
+};
+};
+
+
+
+
+SimileAjax.Graphics.createAnimation=function(f,from,to,duration,cont){
+return new SimileAjax.Graphics._Animation(f,from,to,duration,cont);
+};
+
+SimileAjax.Graphics._Animation=function(f,from,to,duration,cont){
+this.f=f;
+this.cont=(typeof cont=="function")?cont:function(){};
+
+this.from=from;
+this.to=to;
+this.current=from;
+
+this.duration=duration;
+this.start=new Date().getTime();
+this.timePassed=0;
+};
+
+
+SimileAjax.Graphics._Animation.prototype.run=function(){
+var a=this;
+window.setTimeout(function(){a.step();},50);
+};
+
+
+SimileAjax.Graphics._Animation.prototype.step=function(){
+this.timePassed+=50;
+
+var timePassedFraction=this.timePassed/this.duration;
+var parameterFraction=-Math.cos(timePassedFraction*Math.PI)/2+0.5;
+var current=parameterFraction*(this.to-this.from)+this.from;
+
+try{
+this.f(current,current-this.current);
+}catch(e){
+}
+this.current=current;
+
+if(this.timePassed<this.duration){
+this.run();
+}else{
+this.f(this.to,0);
+this["cont"]();
+}
+};
+
+
+
+
+SimileAjax.Graphics.createStructuredDataCopyButton=function(image,width,height,createDataFunction){
+var div=document.createElement("div");
+div.style.position="relative";
+div.style.display="inline";
+div.style.width=width+"px";
+div.style.height=height+"px";
+div.style.overflow="hidden";
+div.style.margin="2px";
+
+if(SimileAjax.Graphics.pngIsTranslucent){
+div.style.background="url("+image+") no-repeat";
+}else{
+div.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+image+"', sizingMethod='image')";
+}
+
+var style;
+if(SimileAjax.Platform.browser.isIE){
+style="filter:alpha(opacity=0)";
+}else{
+style="opacity: 0";
+}
+div.innerHTML="<textarea rows='1' autocomplete='off' value='none' style='"+style+"' />";
+
+var textarea=div.firstChild;
+textarea.style.width=width+"px";
+textarea.style.height=height+"px";
+textarea.onmousedown=function(evt){
+evt=(evt)?evt:((event)?event:null);
+if(evt.button==2){
+textarea.value=createDataFunction();
+textarea.select();
+}
+};
+
+return div;
+};
+
+SimileAjax.Graphics.getFontRenderingContext=function(elmt,width){
+return new SimileAjax.Graphics._FontRenderingContext(elmt,width);
+};
+
+SimileAjax.Graphics._FontRenderingContext=function(elmt,width){
+this._elmt=elmt;
+this._elmt.style.visibility="hidden";
+if(typeof width=="string"){
+this._elmt.style.width=width;
+}else if(typeof width=="number"){
+this._elmt.style.width=width+"px";
+}
+};
+
+SimileAjax.Graphics._FontRenderingContext.prototype.dispose=function(){
+this._elmt=null;
+};
+
+SimileAjax.Graphics._FontRenderingContext.prototype.update=function(){
+this._elmt.innerHTML="A";
+this._lineHeight=this._elmt.offsetHeight;
+};
+
+SimileAjax.Graphics._FontRenderingContext.prototype.computeSize=function(text){
+this._elmt.innerHTML=text;
+return{
+width:this._elmt.offsetWidth,
+height:this._elmt.offsetHeight
+};
+};
+
+SimileAjax.Graphics._FontRenderingContext.prototype.getLineHeight=function(){
+return this._lineHeight;
+};
+
+
+/* history.js */
+
+
+
+SimileAjax.History={
+maxHistoryLength:10,
+historyFile:"__history__.html",
+enabled:true,
+
+_initialized:false,
+_listeners:new SimileAjax.ListenerQueue(),
+
+_actions:[],
+_baseIndex:0,
+_currentIndex:0,
+
+_plainDocumentTitle:document.title
+};
+
+SimileAjax.History.formatHistoryEntryTitle=function(actionLabel){
+return SimileAjax.History._plainDocumentTitle+" {"+actionLabel+"}";
+};
+
+SimileAjax.History.initialize=function(){
+if(SimileAjax.History._initialized){
+return;
+}
+
+if(SimileAjax.History.enabled){
+var iframe=document.createElement("iframe");
+iframe.id="simile-ajax-history";
+iframe.style.position="absolute";
+iframe.style.width="10px";
+iframe.style.height="10px";
+iframe.style.top="0px";
+iframe.style.left="0px";
+iframe.style.visibility="hidden";
+iframe.src=SimileAjax.History.historyFile+"?0";
+
+document.body.appendChild(iframe);
+SimileAjax.DOM.registerEvent(iframe,"load",SimileAjax.History._handleIFrameOnLoad);
+
+SimileAjax.History._iframe=iframe;
+}
+SimileAjax.History._initialized=true;
+};
+
+SimileAjax.History.addListener=function(listener){
+SimileAjax.History.initialize();
+
+SimileAjax.History._listeners.add(listener);
+};
+
+SimileAjax.History.removeListener=function(listener){
+SimileAjax.History.initialize();
+
+SimileAjax.History._listeners.remove(listener);
+};
+
+SimileAjax.History.addAction=function(action){
+SimileAjax.History.initialize();
+
+SimileAjax.History._listeners.fire("onBeforePerform",[action]);
+window.setTimeout(function(){
+try{
+action.perform();
+SimileAjax.History._listeners.fire("onAfterPerform",[action]);
+
+if(SimileAjax.History.enabled){
+SimileAjax.History._actions=SimileAjax.History._actions.slice(
+0,SimileAjax.History._currentIndex-SimileAjax.History._baseIndex);
+
+SimileAjax.History._actions.push(action);
+SimileAjax.History._currentIndex++;
+
+var diff=SimileAjax.History._actions.length-SimileAjax.History.maxHistoryLength;
+if(diff>0){
+SimileAjax.History._actions=SimileAjax.History._actions.slice(diff);
+SimileAjax.History._baseIndex+=diff;
+}
+
+try{
+SimileAjax.History._iframe.contentWindow.location.search=
+"?"+SimileAjax.History._currentIndex;
+}catch(e){
+
+var title=SimileAjax.History.formatHistoryEntryTitle(action.label);
+document.title=title;
+}
+}
+}catch(e){
+SimileAjax.Debug.exception(e,"Error adding action {"+action.label+"} to history");
+}
+},0);
+};
+
+SimileAjax.History.addLengthyAction=function(perform,undo,label){
+SimileAjax.History.addAction({
+perform:perform,
+undo:undo,
+label:label,
+uiLayer:SimileAjax.WindowManager.getBaseLayer(),
+lengthy:true
+});
+};
+
+SimileAjax.History._handleIFrameOnLoad=function(){
+
+
+try{
+var q=SimileAjax.History._iframe.contentWindow.location.search;
+var c=(q.length==0)?0:Math.max(0,parseInt(q.substr(1)));
+
+var finishUp=function(){
+var diff=c-SimileAjax.History._currentIndex;
+SimileAjax.History._currentIndex+=diff;
+SimileAjax.History._baseIndex+=diff;
+
+SimileAjax.History._iframe.contentWindow.location.search="?"+c;
+};
+
+if(c<SimileAjax.History._currentIndex){
+SimileAjax.History._listeners.fire("onBeforeUndoSeveral",[]);
+window.setTimeout(function(){
+while(SimileAjax.History._currentIndex>c&&
+SimileAjax.History._currentIndex>SimileAjax.History._baseIndex){
+
+SimileAjax.History._currentIndex--;
+
+var action=SimileAjax.History._actions[SimileAjax.History._currentIndex-SimileAjax.History._baseIndex];
+
+try{
+action.undo();
+}catch(e){
+SimileAjax.Debug.exception(e,"History: Failed to undo action {"+action.label+"}");
+}
+}
+
+SimileAjax.History._listeners.fire("onAfterUndoSeveral",[]);
+finishUp();
+},0);
+}else if(c>SimileAjax.History._currentIndex){
+SimileAjax.History._listeners.fire("onBeforeRedoSeveral",[]);
+window.setTimeout(function(){
+while(SimileAjax.History._currentIndex<c&&
+SimileAjax.History._currentIndex-SimileAjax.History._baseIndex<SimileAjax.History._actions.length){
+
+var action=SimileAjax.History._actions[SimileAjax.History._currentIndex-SimileAjax.History._baseIndex];
+
+try{
+action.perform();
+}catch(e){
+SimileAjax.Debug.exception(e,"History: Failed to redo action {"+action.label+"}");
+}
+
+SimileAjax.History._currentIndex++;
+}
+
+SimileAjax.History._listeners.fire("onAfterRedoSeveral",[]);
+finishUp();
+},0);
+}else{
+var index=SimileAjax.History._currentIndex-SimileAjax.History._baseIndex-1;
+var title=(index>=0&&index<SimileAjax.History._actions.length)?
+SimileAjax.History.formatHistoryEntryTitle(SimileAjax.History._actions[index].label):
+SimileAjax.History._plainDocumentTitle;
+
+SimileAjax.History._iframe.contentWindow.document.title=title;
+document.title=title;
+}
+}catch(e){
+
+}
+};
+
+SimileAjax.History.getNextUndoAction=function(){
+try{
+var index=SimileAjax.History._currentIndex-SimileAjax.History._baseIndex-1;
+return SimileAjax.History._actions[index];
+}catch(e){
+return null;
+}
+};
+
+SimileAjax.History.getNextRedoAction=function(){
+try{
+var index=SimileAjax.History._currentIndex-SimileAjax.History._baseIndex;
+return SimileAjax.History._actions[index];
+}catch(e){
+return null;
+}
+};
+
+
+/* html.js */
+
+
+
+SimileAjax.HTML=new Object();
+
+SimileAjax.HTML._e2uHash={};
+(function(){
+var e2uHash=SimileAjax.HTML._e2uHash;
+e2uHash['nbsp']='\u00A0[space]';
+e2uHash['iexcl']='\u00A1';
+e2uHash['cent']='\u00A2';
+e2uHash['pound']='\u00A3';
+e2uHash['curren']='\u00A4';
+e2uHash['yen']='\u00A5';
+e2uHash['brvbar']='\u00A6';
+e2uHash['sect']='\u00A7';
+e2uHash['uml']='\u00A8';
+e2uHash['copy']='\u00A9';
+e2uHash['ordf']='\u00AA';
+e2uHash['laquo']='\u00AB';
+e2uHash['not']='\u00AC';
+e2uHash['shy']='\u00AD';
+e2uHash['reg']='\u00AE';
+e2uHash['macr']='\u00AF';
+e2uHash['deg']='\u00B0';
+e2uHash['plusmn']='\u00B1';
+e2uHash['sup2']='\u00B2';
+e2uHash['sup3']='\u00B3';
+e2uHash['acute']='\u00B4';
+e2uHash['micro']='\u00B5';
+e2uHash['para']='\u00B6';
+e2uHash['middot']='\u00B7';
+e2uHash['cedil']='\u00B8';
+e2uHash['sup1']='\u00B9';
+e2uHash['ordm']='\u00BA';
+e2uHash['raquo']='\u00BB';
+e2uHash['frac14']='\u00BC';
+e2uHash['frac12']='\u00BD';
+e2uHash['frac34']='\u00BE';
+e2uHash['iquest']='\u00BF';
+e2uHash['Agrave']='\u00C0';
+e2uHash['Aacute']='\u00C1';
+e2uHash['Acirc']='\u00C2';
+e2uHash['Atilde']='\u00C3';
+e2uHash['Auml']='\u00C4';
+e2uHash['Aring']='\u00C5';
+e2uHash['AElig']='\u00C6';
+e2uHash['Ccedil']='\u00C7';
+e2uHash['Egrave']='\u00C8';
+e2uHash['Eacute']='\u00C9';
+e2uHash['Ecirc']='\u00CA';
+e2uHash['Euml']='\u00CB';
+e2uHash['Igrave']='\u00CC';
+e2uHash['Iacute']='\u00CD';
+e2uHash['Icirc']='\u00CE';
+e2uHash['Iuml']='\u00CF';
+e2uHash['ETH']='\u00D0';
+e2uHash['Ntilde']='\u00D1';
+e2uHash['Ograve']='\u00D2';
+e2uHash['Oacute']='\u00D3';
+e2uHash['Ocirc']='\u00D4';
+e2uHash['Otilde']='\u00D5';
+e2uHash['Ouml']='\u00D6';
+e2uHash['times']='\u00D7';
+e2uHash['Oslash']='\u00D8';
+e2uHash['Ugrave']='\u00D9';
+e2uHash['Uacute']='\u00DA';
+e2uHash['Ucirc']='\u00DB';
+e2uHash['Uuml']='\u00DC';
+e2uHash['Yacute']='\u00DD';
+e2uHash['THORN']='\u00DE';
+e2uHash['szlig']='\u00DF';
+e2uHash['agrave']='\u00E0';
+e2uHash['aacute']='\u00E1';
+e2uHash['acirc']='\u00E2';
+e2uHash['atilde']='\u00E3';
+e2uHash['auml']='\u00E4';
+e2uHash['aring']='\u00E5';
+e2uHash['aelig']='\u00E6';
+e2uHash['ccedil']='\u00E7';
+e2uHash['egrave']='\u00E8';
+e2uHash['eacute']='\u00E9';
+e2uHash['ecirc']='\u00EA';
+e2uHash['euml']='\u00EB';
+e2uHash['igrave']='\u00EC';
+e2uHash['iacute']='\u00ED';
+e2uHash['icirc']='\u00EE';
+e2uHash['iuml']='\u00EF';
+e2uHash['eth']='\u00F0';
+e2uHash['ntilde']='\u00F1';
+e2uHash['ograve']='\u00F2';
+e2uHash['oacute']='\u00F3';
+e2uHash['ocirc']='\u00F4';
+e2uHash['otilde']='\u00F5';
+e2uHash['ouml']='\u00F6';
+e2uHash['divide']='\u00F7';
+e2uHash['oslash']='\u00F8';
+e2uHash['ugrave']='\u00F9';
+e2uHash['uacute']='\u00FA';
+e2uHash['ucirc']='\u00FB';
+e2uHash['uuml']='\u00FC';
+e2uHash['yacute']='\u00FD';
+e2uHash['thorn']='\u00FE';
+e2uHash['yuml']='\u00FF';
+e2uHash['quot']='\u0022';
+e2uHash['amp']='\u0026';
+e2uHash['lt']='\u003C';
+e2uHash['gt']='\u003E';
+e2uHash['OElig']='';
+e2uHash['oelig']='\u0153';
+e2uHash['Scaron']='\u0160';
+e2uHash['scaron']='\u0161';
+e2uHash['Yuml']='\u0178';
+e2uHash['circ']='\u02C6';
+e2uHash['tilde']='\u02DC';
+e2uHash['ensp']='\u2002';
+e2uHash['emsp']='\u2003';
+e2uHash['thinsp']='\u2009';
+e2uHash['zwnj']='\u200C';
+e2uHash['zwj']='\u200D';
+e2uHash['lrm']='\u200E';
+e2uHash['rlm']='\u200F';
+e2uHash['ndash']='\u2013';
+e2uHash['mdash']='\u2014';
+e2uHash['lsquo']='\u2018';
+e2uHash['rsquo']='\u2019';
+e2uHash['sbquo']='\u201A';
+e2uHash['ldquo']='\u201C';
+e2uHash['rdquo']='\u201D';
+e2uHash['bdquo']='\u201E';
+e2uHash['dagger']='\u2020';
+e2uHash['Dagger']='\u2021';
+e2uHash['permil']='\u2030';
+e2uHash['lsaquo']='\u2039';
+e2uHash['rsaquo']='\u203A';
+e2uHash['euro']='\u20AC';
+e2uHash['fnof']='\u0192';
+e2uHash['Alpha']='\u0391';
+e2uHash['Beta']='\u0392';
+e2uHash['Gamma']='\u0393';
+e2uHash['Delta']='\u0394';
+e2uHash['Epsilon']='\u0395';
+e2uHash['Zeta']='\u0396';
+e2uHash['Eta']='\u0397';
+e2uHash['Theta']='\u0398';
+e2uHash['Iota']='\u0399';
+e2uHash['Kappa']='\u039A';
+e2uHash['Lambda']='\u039B';
+e2uHash['Mu']='\u039C';
+e2uHash['Nu']='\u039D';
+e2uHash['Xi']='\u039E';
+e2uHash['Omicron']='\u039F';
+e2uHash['Pi']='\u03A0';
+e2uHash['Rho']='\u03A1';
+e2uHash['Sigma']='\u03A3';
+e2uHash['Tau']='\u03A4';
+e2uHash['Upsilon']='\u03A5';
+e2uHash['Phi']='\u03A6';
+e2uHash['Chi']='\u03A7';
+e2uHash['Psi']='\u03A8';
+e2uHash['Omega']='\u03A9';
+e2uHash['alpha']='\u03B1';
+e2uHash['beta']='\u03B2';
+e2uHash['gamma']='\u03B3';
+e2uHash['delta']='\u03B4';
+e2uHash['epsilon']='\u03B5';
+e2uHash['zeta']='\u03B6';
+e2uHash['eta']='\u03B7';
+e2uHash['theta']='\u03B8';
+e2uHash['iota']='\u03B9';
+e2uHash['kappa']='\u03BA';
+e2uHash['lambda']='\u03BB';
+e2uHash['mu']='\u03BC';
+e2uHash['nu']='\u03BD';
+e2uHash['xi']='\u03BE';
+e2uHash['omicron']='\u03BF';
+e2uHash['pi']='\u03C0';
+e2uHash['rho']='\u03C1';
+e2uHash['sigmaf']='\u03C2';
+e2uHash['sigma']='\u03C3';
+e2uHash['tau']='\u03C4';
+e2uHash['upsilon']='\u03C5';
+e2uHash['phi']='\u03C6';
+e2uHash['chi']='\u03C7';
+e2uHash['psi']='\u03C8';
+e2uHash['omega']='\u03C9';
+e2uHash['thetasym']='\u03D1';
+e2uHash['upsih']='\u03D2';
+e2uHash['piv']='\u03D6';
+e2uHash['bull']='\u2022';
+e2uHash['hellip']='\u2026';
+e2uHash['prime']='\u2032';
+e2uHash['Prime']='\u2033';
+e2uHash['oline']='\u203E';
+e2uHash['frasl']='\u2044';
+e2uHash['weierp']='\u2118';
+e2uHash['image']='\u2111';
+e2uHash['real']='\u211C';
+e2uHash['trade']='\u2122';
+e2uHash['alefsym']='\u2135';
+e2uHash['larr']='\u2190';
+e2uHash['uarr']='\u2191';
+e2uHash['rarr']='\u2192';
+e2uHash['darr']='\u2193';
+e2uHash['harr']='\u2194';
+e2uHash['crarr']='\u21B5';
+e2uHash['lArr']='\u21D0';
+e2uHash['uArr']='\u21D1';
+e2uHash['rArr']='\u21D2';
+e2uHash['dArr']='\u21D3';
+e2uHash['hArr']='\u21D4';
+e2uHash['forall']='\u2200';
+e2uHash['part']='\u2202';
+e2uHash['exist']='\u2203';
+e2uHash['empty']='\u2205';
+e2uHash['nabla']='\u2207';
+e2uHash['isin']='\u2208';
+e2uHash['notin']='\u2209';
+e2uHash['ni']='\u220B';
+e2uHash['prod']='\u220F';
+e2uHash['sum']='\u2211';
+e2uHash['minus']='\u2212';
+e2uHash['lowast']='\u2217';
+e2uHash['radic']='\u221A';
+e2uHash['prop']='\u221D';
+e2uHash['infin']='\u221E';
+e2uHash['ang']='\u2220';
+e2uHash['and']='\u2227';
+e2uHash['or']='\u2228';
+e2uHash['cap']='\u2229';
+e2uHash['cup']='\u222A';
+e2uHash['int']='\u222B';
+e2uHash['there4']='\u2234';
+e2uHash['sim']='\u223C';
+e2uHash['cong']='\u2245';
+e2uHash['asymp']='\u2248';
+e2uHash['ne']='\u2260';
+e2uHash['equiv']='\u2261';
+e2uHash['le']='\u2264';
+e2uHash['ge']='\u2265';
+e2uHash['sub']='\u2282';
+e2uHash['sup']='\u2283';
+e2uHash['nsub']='\u2284';
+e2uHash['sube']='\u2286';
+e2uHash['supe']='\u2287';
+e2uHash['oplus']='\u2295';
+e2uHash['otimes']='\u2297';
+e2uHash['perp']='\u22A5';
+e2uHash['sdot']='\u22C5';
+e2uHash['lceil']='\u2308';
+e2uHash['rceil']='\u2309';
+e2uHash['lfloor']='\u230A';
+e2uHash['rfloor']='\u230B';
+e2uHash['lang']='\u2329';
+e2uHash['rang']='\u232A';
+e2uHash['loz']='\u25CA';
+e2uHash['spades']='\u2660';
+e2uHash['clubs']='\u2663';
+e2uHash['hearts']='\u2665';
+e2uHash['diams']='\u2666';
+})();
+
+SimileAjax.HTML.deEntify=function(s){
+var e2uHash=SimileAjax.HTML._e2uHash;
+
+var re=/&(\w+?);/;
+while(re.test(s)){
+var m=s.match(re);
+s=s.replace(re,e2uHash[m[1]]);
+}
+return s;
+};
+
+/* json.js */
+
+
+
+
+
+SimileAjax.JSON=new Object();
+
+(function(){
+var m={
+'\b':'\\b',
+'\t':'\\t',
+'\n':'\\n',
+'\f':'\\f',
+'\r':'\\r',
+'"':'\\"',
+'\\':'\\\\'
+};
+var s={
+array:function(x){
+var a=['['],b,f,i,l=x.length,v;
+for(i=0;i<l;i+=1){
+v=x[i];
+f=s[typeof v];
+if(f){
+v=f(v);
+if(typeof v=='string'){
+if(b){
+a[a.length]=',';
+}
+a[a.length]=v;
+b=true;
+}
+}
+}
+a[a.length]=']';
+return a.join('');
+},
+'boolean':function(x){
+return String(x);
+},
+'null':function(x){
+return"null";
+},
+number:function(x){
+return isFinite(x)?String(x):'null';
+},
+object:function(x){
+if(x){
+if(x instanceof Array){
+return s.array(x);
+}
+var a=['{'],b,f,i,v;
+for(i in x){
+v=x[i];
+f=s[typeof v];
+if(f){
+v=f(v);
+if(typeof v=='string'){
+if(b){
+a[a.length]=',';
+}
+a.push(s.string(i),':',v);
+b=true;
+}
+}
+}
+a[a.length]='}';
+return a.join('');
+}
+return'null';
+},
+string:function(x){
+if(/["\\\x00-\x1f]/.test(x)){
+x=x.replace(/([\x00-\x1f\\"])/g,function(a,b){
+var c=m[b];
+if(c){
+return c;
+}
+c=b.charCodeAt();
+return'\\u00'+
+Math.floor(c/16).toString(16)+
+(c%16).toString(16);
+});
+}
+return'"'+x+'"';
+}
+};
+
+SimileAjax.JSON.toJSONString=function(o){
+if(o instanceof Object){
+return s.object(o);
+}else if(o instanceof Array){
+return s.array(o);
+}else{
+return o.toString();
+}
+};
+
+SimileAjax.JSON.parseJSON=function(){
+try{
+return!(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(
+this.replace(/"(\\.|[^"\\])*"/g,'')))&&
+eval('('+this+')');
+}catch(e){
+return false;
+}
+};
+})();
+
+
+/* string.js */
+
+
+
+String.prototype.trim=function(){
+return this.replace(/^\s+|\s+$/g,'');
+};
+
+String.prototype.startsWith=function(prefix){
+return this.length>=prefix.length&&this.substr(0,prefix.length)==prefix;
+};
+
+String.prototype.endsWith=function(suffix){
+return this.length>=suffix.length&&this.substr(this.length-suffix.length)==suffix;
+};
+
+String.substitute=function(s,objects){
+var result="";
+var start=0;
+while(start<s.length-1){
+var percent=s.indexOf("%",start);
+if(percent<0||percent==s.length-1){
+break;
+}else if(percent>start&&s.charAt(percent-1)=="\\"){
+result+=s.substring(start,percent-1)+"%";
+start=percent+1;
+}else{
+var n=parseInt(s.charAt(percent+1));
+if(isNaN(n)||n>=objects.length){
+result+=s.substring(start,percent+2);
+}else{
+result+=s.substring(start,percent)+objects[n].toString();
+}
+start=percent+2;
+}
+}
+
+if(start<s.length){
+result+=s.substring(start);
+}
+return result;
+};
+
+
+/* units.js */
+
+
+
+
+
+SimileAjax.NativeDateUnit=new Object();
+
+
+
+SimileAjax.NativeDateUnit.makeDefaultValue=function(){
+
+return new Date();
+
+};
+
+
+
+SimileAjax.NativeDateUnit.cloneValue=function(v){
+
+return new Date(v.getTime());
+
+};
+
+
+
+SimileAjax.NativeDateUnit.getParser=function(format){
+
+if(typeof format=="string"){
+
+format=format.toLowerCase();
+
+}
+
+return(format=="iso8601"||format=="iso 8601")?
+
+SimileAjax.DateTime.parseIso8601DateTime:
+
+SimileAjax.DateTime.parseGregorianDateTime;
+
+};
+
+
+
+SimileAjax.NativeDateUnit.parseFromObject=function(o){
+
+return SimileAjax.DateTime.parseGregorianDateTime(o);
+
+};
+
+
+
+SimileAjax.NativeDateUnit.toNumber=function(v){
+
+return v.getTime();
+
+};
+
+
+
+SimileAjax.NativeDateUnit.fromNumber=function(n){
+
+return new Date(n);
+
+};
+
+
+
+SimileAjax.NativeDateUnit.compare=function(v1,v2){
+
+var n1,n2;
+
+if(typeof v1=="object"){
+
+n1=v1.getTime();
+
+}else{
+
+n1=Number(v1);
+
+}
+
+if(typeof v2=="object"){
+
+n2=v2.getTime();
+
+}else{
+
+n2=Number(v2);
+
+}
+
+
+
+return n1-n2;
+
+};
+
+
+
+SimileAjax.NativeDateUnit.earlier=function(v1,v2){
+
+return SimileAjax.NativeDateUnit.compare(v1,v2)<0?v1:v2;
+
+};
+
+
+
+SimileAjax.NativeDateUnit.later=function(v1,v2){
+
+return SimileAjax.NativeDateUnit.compare(v1,v2)>0?v1:v2;
+
+};
+
+
+
+SimileAjax.NativeDateUnit.change=function(v,n){
+
+return new Date(v.getTime()+n);
+
+};
+
+
+
+
+
+/* window-manager.js */
+
+
+
+
+SimileAjax.WindowManager={
+_initialized:false,
+_listeners:[],
+
+_draggedElement:null,
+_draggedElementCallback:null,
+_dropTargetHighlightElement:null,
+_lastCoords:null,
+_ghostCoords:null,
+_draggingMode:"",
+_dragging:false,
+
+_layers:[]
+};
+
+SimileAjax.WindowManager.initialize=function(){
+if(SimileAjax.WindowManager._initialized){
+return;
+}
+
+SimileAjax.DOM.registerEvent(document.body,"mousedown",SimileAjax.WindowManager._onBodyMouseDown);
+SimileAjax.DOM.registerEvent(document.body,"mousemove",SimileAjax.WindowManager._onBodyMouseMove);
+SimileAjax.DOM.registerEvent(document.body,"mouseup",SimileAjax.WindowManager._onBodyMouseUp);
+SimileAjax.DOM.registerEvent(document,"keydown",SimileAjax.WindowManager._onBodyKeyDown);
+SimileAjax.DOM.registerEvent(document,"keyup",SimileAjax.WindowManager._onBodyKeyUp);
+
+SimileAjax.WindowManager._layers.push({index:0});
+
+SimileAjax.WindowManager._historyListener={
+onBeforeUndoSeveral:function(){},
+onAfterUndoSeveral:function(){},
+onBeforeUndo:function(){},
+onAfterUndo:function(){},
+
+onBeforeRedoSeveral:function(){},
+onAfterRedoSeveral:function(){},
+onBeforeRedo:function(){},
+onAfterRedo:function(){}
+};
+SimileAjax.History.addListener(SimileAjax.WindowManager._historyListener);
+
+SimileAjax.WindowManager._initialized=true;
+};
+
+SimileAjax.WindowManager.getBaseLayer=function(){
+SimileAjax.WindowManager.initialize();
+return SimileAjax.WindowManager._layers[0];
+};
+
+SimileAjax.WindowManager.getHighestLayer=function(){
+SimileAjax.WindowManager.initialize();
+return SimileAjax.WindowManager._layers[SimileAjax.WindowManager._layers.length-1];
+};
+
+SimileAjax.WindowManager.registerEventWithObject=function(elmt,eventName,obj,handlerName,layer){
+SimileAjax.WindowManager.registerEvent(
+elmt,
+eventName,
+function(elmt2,evt,target){
+return obj[handlerName].call(obj,elmt2,evt,target);
+},
+layer
+);
+};
+
+SimileAjax.WindowManager.registerEvent=function(elmt,eventName,handler,layer){
+if(layer==null){
+layer=SimileAjax.WindowManager.getHighestLayer();
+}
+
+var handler2=function(elmt,evt,target){
+if(SimileAjax.WindowManager._canProcessEventAtLayer(layer)){
+SimileAjax.WindowManager._popToLayer(layer.index);
+try{
+handler(elmt,evt,target);
+}catch(e){
+SimileAjax.Debug.exception(e);
+}
+}
+SimileAjax.DOM.cancelEvent(evt);
+return false;
+}
+
+SimileAjax.DOM.registerEvent(elmt,eventName,handler2);
+};
+
+SimileAjax.WindowManager.pushLayer=function(f,ephemeral,elmt){
+var layer={onPop:f,index:SimileAjax.WindowManager._layers.length,ephemeral:(ephemeral),elmt:elmt};
+SimileAjax.WindowManager._layers.push(layer);
+
+return layer;
+};
+
+SimileAjax.WindowManager.popLayer=function(layer){
+for(var i=1;i<SimileAjax.WindowManager._layers.length;i++){
+if(SimileAjax.WindowManager._layers[i]==layer){
+SimileAjax.WindowManager._popToLayer(i-1);
+break;
+}
+}
+};
+
+SimileAjax.WindowManager.popAllLayers=function(){
+SimileAjax.WindowManager._popToLayer(0);
+};
+
+SimileAjax.WindowManager.registerForDragging=function(elmt,callback,layer){
+SimileAjax.WindowManager.registerEvent(
+elmt,
+"mousedown",
+function(elmt,evt,target){
+SimileAjax.WindowManager._handleMouseDown(elmt,evt,callback);
+},
+layer
+);
+};
+
+SimileAjax.WindowManager._popToLayer=function(level){
+while(level+1<SimileAjax.WindowManager._layers.length){
+try{
+var layer=SimileAjax.WindowManager._layers.pop();
+if(layer.onPop!=null){
+layer.onPop();
+}
+}catch(e){
+}
+}
+};
+
+SimileAjax.WindowManager._canProcessEventAtLayer=function(layer){
+if(layer.index==(SimileAjax.WindowManager._layers.length-1)){
+return true;
+}
+for(var i=layer.index+1;i<SimileAjax.WindowManager._layers.length;i++){
+if(!SimileAjax.WindowManager._layers[i].ephemeral){
+return false;
+}
+}
+return true;
+};
+
+SimileAjax.WindowManager.cancelPopups=function(evt){
+var evtCoords=(evt)?SimileAjax.DOM.getEventPageCoordinates(evt):{x:-1,y:-1};
+
+var i=SimileAjax.WindowManager._layers.length-1;
+while(i>0&&SimileAjax.WindowManager._layers[i].ephemeral){
+var layer=SimileAjax.WindowManager._layers[i];
+if(layer.elmt!=null){
+var elmt=layer.elmt;
+var elmtCoords=SimileAjax.DOM.getPageCoordinates(elmt);
+if(evtCoords.x>=elmtCoords.left&&evtCoords.x<(elmtCoords.left+elmt.offsetWidth)&&
+evtCoords.y>=elmtCoords.top&&evtCoords.y<(elmtCoords.top+elmt.offsetHeight)){
+break;
+}
+}
+i--;
+}
+SimileAjax.WindowManager._popToLayer(i);
+};
+
+SimileAjax.WindowManager._onBodyMouseDown=function(elmt,evt,target){
+if(!("eventPhase"in evt)||evt.eventPhase==evt.BUBBLING_PHASE){
+SimileAjax.WindowManager.cancelPopups(evt);
+}
+};
+
+SimileAjax.WindowManager._handleMouseDown=function(elmt,evt,callback){
+SimileAjax.WindowManager._draggedElement=elmt;
+SimileAjax.WindowManager._draggedElementCallback=callback;
+SimileAjax.WindowManager._lastCoords={x:evt.clientX,y:evt.clientY};
+
+SimileAjax.DOM.cancelEvent(evt);
+return false;
+};
+
+SimileAjax.WindowManager._onBodyKeyDown=function(elmt,evt,target){
+if(SimileAjax.WindowManager._dragging){
+if(evt.keyCode==27){
+SimileAjax.WindowManager._cancelDragging();
+}else if((evt.keyCode==17||evt.keyCode==16)&&SimileAjax.WindowManager._draggingMode!="copy"){
+SimileAjax.WindowManager._draggingMode="copy";
+
+var img=SimileAjax.Graphics.createTranslucentImage(SimileAjax.urlPrefix+"images/copy.png");
+img.style.position="absolute";
+img.style.left=(SimileAjax.WindowManager._ghostCoords.left-16)+"px";
+img.style.top=(SimileAjax.WindowManager._ghostCoords.top)+"px";
+document.body.appendChild(img);
+
+SimileAjax.WindowManager._draggingModeIndicatorElmt=img;
+}
+}
+};
+
+SimileAjax.WindowManager._onBodyKeyUp=function(elmt,evt,target){
+if(SimileAjax.WindowManager._dragging){
+if(evt.keyCode==17||evt.keyCode==16){
+SimileAjax.WindowManager._draggingMode="";
+if(SimileAjax.WindowManager._draggingModeIndicatorElmt!=null){
+document.body.removeChild(SimileAjax.WindowManager._draggingModeIndicatorElmt);
+SimileAjax.WindowManager._draggingModeIndicatorElmt=null;
+}
+}
+}
+};
+
+SimileAjax.WindowManager._onBodyMouseMove=function(elmt,evt,target){
+if(SimileAjax.WindowManager._draggedElement!=null){
+var callback=SimileAjax.WindowManager._draggedElementCallback;
+
+var lastCoords=SimileAjax.WindowManager._lastCoords;
+var diffX=evt.clientX-lastCoords.x;
+var diffY=evt.clientY-lastCoords.y;
+
+if(!SimileAjax.WindowManager._dragging){
+if(Math.abs(diffX)>5||Math.abs(diffY)>5){
+try{
+if("onDragStart"in callback){
+callback.onDragStart();
+}
+
+if("ghost"in callback&&callback.ghost){
+var draggedElmt=SimileAjax.WindowManager._draggedElement;
+
+SimileAjax.WindowManager._ghostCoords=SimileAjax.DOM.getPageCoordinates(draggedElmt);
+SimileAjax.WindowManager._ghostCoords.left+=diffX;
+SimileAjax.WindowManager._ghostCoords.top+=diffY;
+
+var ghostElmt=draggedElmt.cloneNode(true);
+ghostElmt.style.position="absolute";
+ghostElmt.style.left=SimileAjax.WindowManager._ghostCoords.left+"px";
+ghostElmt.style.top=SimileAjax.WindowManager._ghostCoords.top+"px";
+ghostElmt.style.zIndex=1000;
+SimileAjax.Graphics.setOpacity(ghostElmt,50);
+
+document.body.appendChild(ghostElmt);
+callback._ghostElmt=ghostElmt;
+}
+
+SimileAjax.WindowManager._dragging=true;
+SimileAjax.WindowManager._lastCoords={x:evt.clientX,y:evt.clientY};
+
+document.body.focus();
+}catch(e){
+SimileAjax.Debug.exception("WindowManager: Error handling mouse down",e);
+SimileAjax.WindowManager._cancelDragging();
+}
+}
+}else{
+try{
+SimileAjax.WindowManager._lastCoords={x:evt.clientX,y:evt.clientY};
+
+if("onDragBy"in callback){
+callback.onDragBy(diffX,diffY);
+}
+
+if("_ghostElmt"in callback){
+var ghostElmt=callback._ghostElmt;
+
+SimileAjax.WindowManager._ghostCoords.left+=diffX;
+SimileAjax.WindowManager._ghostCoords.top+=diffY;
+
+ghostElmt.style.left=SimileAjax.WindowManager._ghostCoords.left+"px";
+ghostElmt.style.top=SimileAjax.WindowManager._ghostCoords.top+"px";
+if(SimileAjax.WindowManager._draggingModeIndicatorElmt!=null){
+var indicatorElmt=SimileAjax.WindowManager._draggingModeIndicatorElmt;
+
+indicatorElmt.style.left=(SimileAjax.WindowManager._ghostCoords.left-16)+"px";
+indicatorElmt.style.top=SimileAjax.WindowManager._ghostCoords.top+"px";
+}
+
+if("droppable"in callback&&callback.droppable){
+var coords=SimileAjax.DOM.getEventPageCoordinates(evt);
+var target=SimileAjax.DOM.hittest(
+coords.x,coords.y,
+[SimileAjax.WindowManager._ghostElmt,
+SimileAjax.WindowManager._dropTargetHighlightElement
+]
+);
+target=SimileAjax.WindowManager._findDropTarget(target);
+
+if(target!=SimileAjax.WindowManager._potentialDropTarget){
+if(SimileAjax.WindowManager._dropTargetHighlightElement!=null){
+document.body.removeChild(SimileAjax.WindowManager._dropTargetHighlightElement);
+
+SimileAjax.WindowManager._dropTargetHighlightElement=null;
+SimileAjax.WindowManager._potentialDropTarget=null;
+}
+
+var droppable=false;
+if(target!=null){
+if((!("canDropOn"in callback)||callback.canDropOn(target))&&
+(!("canDrop"in target)||target.canDrop(SimileAjax.WindowManager._draggedElement))){
+
+droppable=true;
+}
+}
+
+if(droppable){
+var border=4;
+var targetCoords=SimileAjax.DOM.getPageCoordinates(target);
+var highlight=document.createElement("div");
+highlight.style.border=border+"px solid yellow";
+highlight.style.backgroundColor="yellow";
+highlight.style.position="absolute";
+highlight.style.left=targetCoords.left+"px";
+highlight.style.top=targetCoords.top+"px";
+highlight.style.width=(target.offsetWidth-border*2)+"px";
+highlight.style.height=(target.offsetHeight-border*2)+"px";
+SimileAjax.Graphics.setOpacity(highlight,30);
+document.body.appendChild(highlight);
+
+SimileAjax.WindowManager._potentialDropTarget=target;
+SimileAjax.WindowManager._dropTargetHighlightElement=highlight;
+}
+}
+}
+}
+}catch(e){
+SimileAjax.Debug.exception("WindowManager: Error handling mouse move",e);
+SimileAjax.WindowManager._cancelDragging();
+}
+}
+
+SimileAjax.DOM.cancelEvent(evt);
+return false;
+}
+};
+
+SimileAjax.WindowManager._onBodyMouseUp=function(elmt,evt,target){
+if(SimileAjax.WindowManager._draggedElement!=null){
+try{
+if(SimileAjax.WindowManager._dragging){
+var callback=SimileAjax.WindowManager._draggedElementCallback;
+if("onDragEnd"in callback){
+callback.onDragEnd();
+}
+if("droppable"in callback&&callback.droppable){
+var dropped=false;
+
+var target=SimileAjax.WindowManager._potentialDropTarget;
+if(target!=null){
+if((!("canDropOn"in callback)||callback.canDropOn(target))&&
+(!("canDrop"in target)||target.canDrop(SimileAjax.WindowManager._draggedElement))){
+
+if("onDropOn"in callback){
+callback.onDropOn(target);
+}
+target.ondrop(SimileAjax.WindowManager._draggedElement,SimileAjax.WindowManager._draggingMode);
+
+dropped=true;
+}
+}
+
+if(!dropped){
+
+}
+}
+}
+}finally{
+SimileAjax.WindowManager._cancelDragging();
+}
+
+SimileAjax.DOM.cancelEvent(evt);
+return false;
+}
+};
+
+SimileAjax.WindowManager._cancelDragging=function(){
+var callback=SimileAjax.WindowManager._draggedElementCallback;
+if("_ghostElmt"in callback){
+var ghostElmt=callback._ghostElmt;
+document.body.removeChild(ghostElmt);
+
+delete callback._ghostElmt;
+}
+if(SimileAjax.WindowManager._dropTargetHighlightElement!=null){
+document.body.removeChild(SimileAjax.WindowManager._dropTargetHighlightElement);
+SimileAjax.WindowManager._dropTargetHighlightElement=null;
+}
+if(SimileAjax.WindowManager._draggingModeIndicatorElmt!=null){
+document.body.removeChild(SimileAjax.WindowManager._draggingModeIndicatorElmt);
+SimileAjax.WindowManager._draggingModeIndicatorElmt=null;
+}
+
+SimileAjax.WindowManager._draggedElement=null;
+SimileAjax.WindowManager._draggedElementCallback=null;
+SimileAjax.WindowManager._potentialDropTarget=null;
+SimileAjax.WindowManager._dropTargetHighlightElement=null;
+SimileAjax.WindowManager._lastCoords=null;
+SimileAjax.WindowManager._ghostCoords=null;
+SimileAjax.WindowManager._draggingMode="";
+SimileAjax.WindowManager._dragging=false;
+};
+
+SimileAjax.WindowManager._findDropTarget=function(elmt){
+while(elmt!=null){
+if("ondrop"in elmt&&(typeof elmt.ondrop)=="function"){
+break;
+}
+elmt=elmt.parentNode;
+}
+return elmt;
+};
+
+
+/* xmlhttp.js */
+
+
+
+SimileAjax.XmlHttp=new Object();
+
+
+SimileAjax.XmlHttp._onReadyStateChange=function(xmlhttp,fError,fDone){
+switch(xmlhttp.readyState){
+
+
+
+
+
+case 4:
+try{
+if(xmlhttp.status==0
+||xmlhttp.status==200
+){
+if(fDone){
+fDone(xmlhttp);
+}
+}else{
+if(fError){
+fError(
+xmlhttp.statusText,
+xmlhttp.status,
+xmlhttp
+);
+}
+}
+}catch(e){
+SimileAjax.Debug.exception("XmlHttp: Error handling onReadyStateChange",e);
+}
+break;
+}
+};
+
+
+SimileAjax.XmlHttp._createRequest=function(){
+if(SimileAjax.Platform.browser.isIE){
+var programIDs=[
+"Msxml2.XMLHTTP",
+"Microsoft.XMLHTTP",
+"Msxml2.XMLHTTP.4.0"
+];
+for(var i=0;i<programIDs.length;i++){
+try{
+var programID=programIDs[i];
+var f=function(){
+return new ActiveXObject(programID);
+};
+var o=f();
+
+
+
+
+
+
+SimileAjax.XmlHttp._createRequest=f;
+
+return o;
+}catch(e){
+
+}
+}
+
+}
+
+try{
+var f=function(){
+return new XMLHttpRequest();
+};
+var o=f();
+
+
+
+
+
+
+SimileAjax.XmlHttp._createRequest=f;
+
+return o;
+}catch(e){
+throw new Error("Failed to create an XMLHttpRequest object");
+}
+};
+
+
+SimileAjax.XmlHttp.get=function(url,fError,fDone){
+var xmlhttp=SimileAjax.XmlHttp._createRequest();
+
+xmlhttp.open("GET",url,true);
+xmlhttp.onreadystatechange=function(){
+SimileAjax.XmlHttp._onReadyStateChange(xmlhttp,fError,fDone);
+};
+xmlhttp.send(null);
+};
+
+
+SimileAjax.XmlHttp.post=function(url,body,fError,fDone){
+var xmlhttp=SimileAjax.XmlHttp._createRequest();
+
+xmlhttp.open("POST",url,true);
+xmlhttp.onreadystatechange=function(){
+SimileAjax.XmlHttp._onReadyStateChange(xmlhttp,fError,fDone);
+};
+xmlhttp.send(body);
+};
+
+SimileAjax.XmlHttp._forceXML=function(xmlhttp){
+try{
+xmlhttp.overrideMimeType("text/xml");
+}catch(e){
+xmlhttp.setrequestheader("Content-Type","text/xml");
+}
+};
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/geochrono-api.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/geochrono-api.js
new file mode 100644
index 0000000..b16a2c3
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/geochrono-api.js
@@ -0,0 +1,92 @@
+/*==================================================
+ * Geochrono Extension
+ *
+ * This file will load all the Javascript files
+ * necessary to make the extension work.
+ *
+ *==================================================
+ */
+
+(function() {
+ var javascriptFiles = [
+ "geochrono.js",
+ "units.js",
+ "ether-painters.js",
+ "labellers.js"
+ ];
+ var cssFiles = [
+ ];
+
+ var localizedJavascriptFiles = [
+ "labellers.js"
+ ];
+ var localizedCssFiles = [
+ ];
+
+ // ISO-639 language codes, ISO-3166 country codes (2 characters)
+ var supportedLocales = [
+ "en" // English
+ ];
+
+ try {
+ var includeJavascriptFile = function(filename) {
+ document.write("<script src='" + Timeline.urlPrefix + "ext/geochrono/scripts/" + filename + "' type='text/javascript'></script>");
+ };
+ var includeCssFile = function(filename) {
+ document.write("<link rel='stylesheet' href='" + Timeline.urlPrefix + "ext/geochrono/styles/" + filename + "' type='text/css'/>");
+ }
+
+ /*
+ * Include non-localized files
+ */
+ for (var i = 0; i < javascriptFiles.length; i++) {
+ includeJavascriptFile(javascriptFiles[i]);
+ }
+ for (var i = 0; i < cssFiles.length; i++) {
+ includeCssFile(cssFiles[i]);
+ }
+
+ /*
+ * Include localized files
+ */
+ var loadLocale = [];
+ var tryExactLocale = function(locale) {
+ for (var l = 0; l < supportedLocales.length; l++) {
+ if (locale == supportedLocales[l]) {
+ loadLocale[locale] = true;
+ return true;
+ }
+ }
+ return false;
+ }
+ var tryLocale = function(locale) {
+ if (tryExactLocale(locale)) {
+ return locale;
+ }
+
+ var dash = locale.indexOf("-");
+ if (dash > 0 && tryExactLocale(locale.substr(0, dash))) {
+ return locale.substr(0, dash);
+ }
+
+ return null;
+ }
+
+ tryLocale(Timeline.serverLocale);
+ tryLocale(Timeline.clientLocale);
+
+ for (var l = 0; l < supportedLocales.length; l++) {
+ var locale = supportedLocales[l];
+ if (loadLocale[locale]) {
+ for (var i = 0; i < localizedJavascriptFiles.length; i++) {
+ includeJavascriptFile("l10n/" + locale + "/" + localizedJavascriptFiles[i]);
+ }
+ for (var i = 0; i < localizedCssFiles.length; i++) {
+ includeCssFile("l10n/" + locale + "/" + localizedCssFiles[i]);
+ }
+ }
+ }
+ } catch (e) {
+ alert(e);
+ }
+})();
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/scripts/ether-painters.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/scripts/ether-painters.js
new file mode 100644
index 0000000..c9c0453
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/scripts/ether-painters.js
@@ -0,0 +1,204 @@
+/*==================================================
+ * Geochrono Ether Painter
+ *==================================================
+ */
+
+Timeline.GeochronoEtherPainter = function(params, band, timeline) {
+ this._params = params;
+ this._intervalUnit = params.intervalUnit;
+ this._multiple = ("multiple" in params) ? params.multiple : 1;
+ this._theme = params.theme;
+};
+
+Timeline.GeochronoEtherPainter.prototype.initialize = function(band, timeline) {
+ this._band = band;
+ this._timeline = timeline;
+
+ this._backgroundLayer = band.createLayerDiv(0);
+ this._backgroundLayer.setAttribute("name", "ether-background"); // for debugging
+ this._backgroundLayer.style.background = this._theme.ether.backgroundColors[band.getIndex()];
+
+ this._markerLayer = null;
+ this._lineLayer = null;
+
+ var align = ("align" in this._params && typeof this._params.align == "string") ? this._params.align :
+ this._theme.ether.interval.marker[timeline.isHorizontal() ? "hAlign" : "vAlign"];
+ var showLine = ("showLine" in this._params) ? this._params.showLine :
+ this._theme.ether.interval.line.show;
+
+ this._intervalMarkerLayout = new Timeline.GeochronoEtherMarkerLayout(
+ this._timeline, this._band, this._theme, align, showLine);
+
+ this._highlight = new Timeline.EtherHighlight(
+ this._timeline, this._band, this._theme, this._backgroundLayer);
+}
+
+Timeline.GeochronoEtherPainter.prototype.setHighlight = function(startDate, endDate) {
+ this._highlight.position(startDate, endDate);
+}
+
+Timeline.GeochronoEtherPainter.prototype.paint = function() {
+ if (this._markerLayer) {
+ this._band.removeLayerDiv(this._markerLayer);
+ }
+ this._markerLayer = this._band.createLayerDiv(100);
+ this._markerLayer.setAttribute("name", "ether-markers"); // for debugging
+ this._markerLayer.style.display = "none";
+
+ if (this._lineLayer) {
+ this._band.removeLayerDiv(this._lineLayer);
+ }
+ this._lineLayer = this._band.createLayerDiv(1);
+ this._lineLayer.setAttribute("name", "ether-lines"); // for debugging
+ this._lineLayer.style.display = "none";
+
+ var minDate = Math.ceil(Timeline.GeochronoUnit.toNumber(this._band.getMinDate()));
+ var maxDate = Math.floor(Timeline.GeochronoUnit.toNumber(this._band.getMaxDate()));
+
+ var increment;
+ var hasMore;
+ (function(intervalUnit, multiple) {
+ var dates;
+
+ switch (intervalUnit) {
+ case Timeline.GeochronoUnit.AGE:
+ dates = Timeline.Geochrono.ages; break;
+ case Timeline.GeochronoUnit.EPOCH:
+ dates = Timeline.Geochrono.epoches; break;
+ case Timeline.GeochronoUnit.PERIOD:
+ dates = Timeline.Geochrono.periods; break;
+ case Timeline.GeochronoUnit.ERA:
+ dates = Timeline.Geochrono.eras; break;
+ case Timeline.GeochronoUnit.EON:
+ dates = Timeline.Geochrono.eons; break;
+ default:
+ hasMore = function() {
+ return minDate > 0 && minDate > maxDate;
+ }
+ increment = function() {
+ minDate -= multiple;
+ };
+ return;
+ }
+
+ var startIndex = dates.length - 1;
+ while (startIndex > 0) {
+ if (minDate <= dates[startIndex].start) {
+ break;
+ }
+ startIndex--;
+ }
+
+ minDate = dates[startIndex].start;
+ hasMore = function() {
+ return startIndex < (dates.length - 1) && minDate > maxDate;
+ };
+ increment = function() {
+ startIndex++;
+ minDate = dates[startIndex].start;
+ };
+ })(this._intervalUnit, this._multiple);
+
+ var labeller = this._band.getLabeller();
+ while (true) {
+ this._intervalMarkerLayout.createIntervalMarker(
+ Timeline.GeochronoUnit.fromNumber(minDate),
+ labeller,
+ this._intervalUnit,
+ this._markerLayer,
+ this._lineLayer
+ );
+ if (hasMore()) {
+ increment();
+ } else {
+ break;
+ }
+ }
+ this._markerLayer.style.display = "block";
+ this._lineLayer.style.display = "block";
+};
+
+Timeline.GeochronoEtherPainter.prototype.softPaint = function() {
+};
+
+
+/*==================================================
+ * Geochrono Ether Marker Layout
+ *==================================================
+ */
+
+Timeline.GeochronoEtherMarkerLayout = function(timeline, band, theme, align, showLine) {
+ var horizontal = timeline.isHorizontal();
+ if (horizontal) {
+ if (align == "Top") {
+ this.positionDiv = function(div, offset) {
+ div.style.left = offset + "px";
+ div.style.top = "0px";
+ };
+ } else {
+ this.positionDiv = function(div, offset) {
+ div.style.left = offset + "px";
+ div.style.bottom = "0px";
+ };
+ }
+ } else {
+ if (align == "Left") {
+ this.positionDiv = function(div, offset) {
+ div.style.top = offset + "px";
+ div.style.left = "0px";
+ };
+ } else {
+ this.positionDiv = function(div, offset) {
+ div.style.top = offset + "px";
+ div.style.right = "0px";
+ };
+ }
+ }
+
+ var markerTheme = theme.ether.interval.marker;
+ var lineTheme = theme.ether.interval.line;
+
+ var stylePrefix = (horizontal ? "h" : "v") + align;
+ var labelStyler = markerTheme[stylePrefix + "Styler"];
+ var emphasizedLabelStyler = markerTheme[stylePrefix + "EmphasizedStyler"];
+
+ this.createIntervalMarker = function(date, labeller, unit, markerDiv, lineDiv) {
+ var offset = Math.round(band.dateToPixelOffset(date));
+
+ if (showLine) {
+ var divLine = timeline.getDocument().createElement("div");
+ divLine.style.position = "absolute";
+
+ if (lineTheme.opacity < 100) {
+ SimileAjax.Graphics.setOpacity(divLine, lineTheme.opacity);
+ }
+
+ if (horizontal) {
+ divLine.style.borderLeft = "1px solid " + lineTheme.color;
+ divLine.style.left = offset + "px";
+ divLine.style.width = "1px";
+ divLine.style.top = "0px";
+ divLine.style.height = "100%";
+ } else {
+ divLine.style.borderTop = "1px solid " + lineTheme.color;
+ divLine.style.top = offset + "px";
+ divLine.style.height = "1px";
+ divLine.style.left = "0px";
+ divLine.style.width = "100%";
+ }
+ lineDiv.appendChild(divLine);
+ }
+
+ var label = labeller.labelInterval(date, unit);
+
+ var div = timeline.getDocument().createElement("div");
+ div.innerHTML = label.text;
+ div.style.position = "absolute";
+ (label.emphasized ? emphasizedLabelStyler : labelStyler)(div);
+
+ this.positionDiv(div, offset);
+ markerDiv.appendChild(div);
+
+ return div;
+ };
+};
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/scripts/geochrono.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/scripts/geochrono.js
new file mode 100644
index 0000000..dc9716a
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/scripts/geochrono.js
@@ -0,0 +1,518 @@
+/*==================================================
+ * Geochrono
+ *==================================================
+ */
+Timeline.Geochrono = new Object();
+Timeline.Geochrono.eons = [
+ { name: "Proterozoic",
+ start: 2500.000
+ },
+ { name: "Phanerozoic",
+ start: 542.000
+ }
+];
+Timeline.Geochrono.eras = [
+ { name: "Paleoarchean",
+ start: 3600.000
+ },
+ { name: "Mesoarchean",
+ start: 3200.000
+ },
+ { name: "Neoarchean",
+ start: 2800.000
+ },
+ { name: "Paleoproterozoic",
+ start: 2500.000
+ },
+ { name: "Mesoproterozoic",
+ start: 1600.000
+ },
+ { name: "Neoproterozoic",
+ start: 1000.000
+ },
+ { name: "Paleozoic",
+ start: 542.000
+ },
+ { name: "Mesozoic",
+ start: 251.000
+ },
+ { name: "Cenozoic",
+ start: 65.500
+ }
+];
+Timeline.Geochrono.periods = [
+ { name: "Siderian",
+ start: 2500.000
+ },
+ { name: "Rhyacian",
+ start: 2300.000
+ },
+ { name: "Orosirian",
+ start: 2050.000
+ },
+ { name: "Statherian",
+ start: 1800.000
+ },
+ { name: "Calymmian",
+ start: 1600.000
+ },
+ { name: "Ectasian",
+ start: 1400.000
+ },
+ { name: "Stenian",
+ start: 1200.000
+ },
+ { name: "Tonian",
+ start: 1000.000
+ },
+ { name: "Cryogenian",
+ start: 850.000
+ },
+ { name: "Ediacaran",
+ start: 600.000
+ },
+ { name: "Cambrian",
+ start: 542.000
+ },
+ { name: "Ordovician",
+ start: 488.300
+ },
+ { name: "Silurian",
+ start: 443.700
+ },
+ { name: "Devonian",
+ start: 416.000
+ },
+ { name: "Carboniferous",
+ start: 359.200
+ },
+ { name: "Permian",
+ start: 299.000
+ },
+ { name: "Triassic",
+ start: 251.000
+ },
+ { name: "Jurassic",
+ start: 199.600
+ },
+ { name: "Cretaceous",
+ start: 145.500
+ },
+ { name: "Paleogene",
+ start: 65.500
+ },
+ { name: "Neogene",
+ start: 23.030
+ }
+];
+Timeline.Geochrono.epoches = [
+ { name: "Lower Cambrian",
+ start: 542.000
+ },
+ { name: "Middle Cambrian",
+ start: 513.000
+ },
+ { name: "Furongian",
+ start: 501.000
+ },
+ { name: "Lower Ordovician",
+ start: 488.300
+ },
+ { name: "Middle Ordovician",
+ start: 471.800
+ },
+ { name: "Upper Ordovician",
+ start: 460.900
+ },
+ { name: "Llandovery",
+ start: 443.700
+ },
+ { name: "Wenlock",
+ start: 428.200
+ },
+ { name: "Ludlow",
+ start: 422.900
+ },
+ { name: "Pridoli",
+ start: 418.700
+ },
+ { name: "Lower Devonian",
+ start: 416.000
+ },
+ { name: "Middle Devonian",
+ start: 397.500
+ },
+ { name: "Upper Devonian",
+ start: 385.300
+ },
+ { name: "Mississippian",
+ start: 359.200
+ },
+ { name: "Pennsylvanian",
+ start: 318.100
+ },
+ { name: "Cisuralian",
+ start: 299.000
+ },
+ { name: "Guadalupian",
+ start: 270.600
+ },
+ { name: "Lopingian",
+ start: 260.400
+ },
+ { name: "Lower Triassic",
+ start: 251.000
+ },
+ { name: "Middle Triassic",
+ start: 245.000
+ },
+ { name: "Upper Triassic",
+ start: 228.000
+ },
+ { name: "Lower Jurassic",
+ start: 199.600
+ },
+ { name: "Middle Jurassic",
+ start: 175.600
+ },
+ { name: "Upper Jurassic",
+ start: 161.200
+ },
+ { name: "Lower Cretaceous",
+ start: 145.500
+ },
+ { name: "Upper Cretaceous",
+ start: 99.600
+ },
+ { name: "Paleocene",
+ start: 65.500
+ },
+ { name: "Eocene",
+ start: 55.800
+ },
+ { name: "Oligocene",
+ start: 33.900
+ },
+ { name: "Miocene",
+ start: 23.030
+ },
+ { name: "Pliocene",
+ start: 5.332
+ },
+ { name: "Pleistocene",
+ start: 1.806
+ },
+ { name: "Holocene",
+ start: 0.012
+ }
+];
+Timeline.Geochrono.ages = [
+ { name: "-",
+ start: 542.000
+ },
+ { name: "-",
+ start: 513.000
+ },
+ { name: "Paibian",
+ start: 501.000
+ },
+ { name: "Tremadocian",
+ start: 488.300
+ },
+ { name: "-",
+ start: 478.600
+ },
+ { name: "-",
+ start: 471.800
+ },
+ { name: "Darriwilian",
+ start: 468.100
+ },
+ { name: "-",
+ start: 460.900
+ },
+ { name: "-",
+ start: 455.800
+ },
+ { name: "Hirnantian",
+ start: 445.600
+ },
+ { name: "Rhuddanian",
+ start: 443.700
+ },
+ { name: "Aeronian",
+ start: 439.000
+ },
+ { name: "Telychian",
+ start: 436.100
+ },
+ { name: "Sheinwoodian",
+ start: 428.200
+ },
+ { name: "Homerian",
+ start: 426.200
+ },
+ { name: "Gorstian",
+ start: 422.900
+ },
+ { name: "Ludfordian",
+ start: 421.300
+ },
+ { name: "-",
+ start: 418.700
+ },
+ { name: "Lochkovian",
+ start: 416.000
+ },
+ { name: "Pragian",
+ start: 411.200
+ },
+ { name: "Emsian",
+ start: 407.000
+ },
+ { name: "Eifelian",
+ start: 397.500
+ },
+ { name: "Givetian",
+ start: 391.800
+ },
+ { name: "Frasnian",
+ start: 385.300
+ },
+ { name: "Famennian",
+ start: 374.500
+ },
+ { name: "Tournaisian",
+ start: 359.200
+ },
+ { name: "Visean",
+ start: 345.300
+ },
+ { name: "Serpukhovian",
+ start: 326.400
+ },
+ { name: "Bashkirian",
+ start: 318.100
+ },
+ { name: "Moscovian",
+ start: 311.700
+ },
+ { name: "Kazimovian",
+ start: 306.500
+ },
+ { name: "Gzhelian",
+ start: 303.900
+ },
+ { name: "Asselian",
+ start: 299.000
+ },
+ { name: "Sakmarian",
+ start: 294.600
+ },
+ { name: "Artinskian",
+ start: 284.400
+ },
+ { name: "Kungurian",
+ start: 275.600
+ },
+ { name: "Roadian",
+ start: 270.600
+ },
+ { name: "Wordian",
+ start: 268.000
+ },
+ { name: "Capitanian",
+ start: 265.800
+ },
+ { name: "Wuchiapingian",
+ start: 260.400
+ },
+ { name: "Changhsingian",
+ start: 253.800
+ },
+ { name: "Induan",
+ start: 251.000
+ },
+ { name: "Olenekian",
+ start: 249.700
+ },
+ { name: "Anisian",
+ start: 245.000
+ },
+ { name: "Ladinian",
+ start: 237.000
+ },
+ { name: "Carnian",
+ start: 228.000
+ },
+ { name: "Norian",
+ start: 216.500
+ },
+ { name: "Rhaetian",
+ start: 203.600
+ },
+ { name: "Hettangian",
+ start: 199.600
+ },
+ { name: "Sinemurian",
+ start: 196.500
+ },
+ { name: "Pliensbachian",
+ start: 189.600
+ },
+ { name: "Toarcian",
+ start: 183.000
+ },
+ { name: "Aalenian",
+ start: 175.600
+ },
+ { name: "Bajocian",
+ start: 171.600
+ },
+ { name: "Bathonian",
+ start: 167.700
+ },
+ { name: "Callovian",
+ start: 164.700
+ },
+ { name: "Oxfordian",
+ start: 161.200
+ },
+ { name: "Kimmeridgian",
+ start: 155.000
+ },
+ { name: "Tithonian",
+ start: 150.800
+ },
+ { name: "Berriasian",
+ start: 145.500
+ },
+ { name: "Valanginian",
+ start: 140.200
+ },
+ { name: "Hauterivian",
+ start: 136.400
+ },
+ { name: "Barremian",
+ start: 130.000
+ },
+ { name: "Aptian",
+ start: 125.000
+ },
+ { name: "Albian",
+ start: 112.000
+ },
+ { name: "Cenomanian",
+ start: 99.600
+ },
+ { name: "Turonian",
+ start: 93.500
+ },
+ { name: "Coniacian",
+ start: 89.300
+ },
+ { name: "Santonian",
+ start: 85.800
+ },
+ { name: "Campanian",
+ start: 83.500
+ },
+ { name: "Maastrichtian",
+ start: 70.600
+ },
+ { name: "Danian",
+ start: 65.500
+ },
+ { name: "Selandian",
+ start: 61.700
+ },
+ { name: "Thanetian",
+ start: 58.700
+ },
+ { name: "Ypresian",
+ start: 55.800
+ },
+ { name: "Lutetian",
+ start: 48.600
+ },
+ { name: "Bartonian",
+ start: 40.400
+ },
+ { name: "Priabonian",
+ start: 37.200
+ },
+ { name: "Rupelian",
+ start: 33.900
+ },
+ { name: "Chattian",
+ start: 28.400
+ },
+ { name: "Aquitanian",
+ start: 23.030
+ },
+ { name: "Burdigalian",
+ start: 20.430
+ },
+ { name: "Langhian",
+ start: 15.970
+ },
+ { name: "Serravallian",
+ start: 13.650
+ },
+ { name: "Tortonian",
+ start: 11.608
+ },
+ { name: "Messinian",
+ start: 7.246
+ },
+ { name: "Zanclean",
+ start: 5.332
+ },
+ { name: "Piacenzian",
+ start: 3.600
+ },
+ { name: "Gelasian",
+ start: 2.588
+ }
+];
+
+Timeline.Geochrono.createBandInfo = function(params) {
+ var theme = ("theme" in params) ? params.theme : Timeline.getDefaultTheme();
+
+ var eventSource = ("eventSource" in params) ? params.eventSource : null;
+
+ var ether = new Timeline.LinearEther({
+ centersOn: ("date" in params) ? params.date : Timeline.GeochronoUnit.makeDefaultValue(),
+ interval: 1,
+ pixelsPerInterval: params.intervalPixels
+ });
+
+ var etherPainter = new Timeline.GeochronoEtherPainter({
+ intervalUnit: params.intervalUnit,
+ multiple: ("multiple" in params) ? params.multiple : 1,
+ align: params.align,
+ theme: theme
+ });
+
+ var eventPainterParams = {
+ theme: theme
+ };
+ if ("trackHeight" in params) {
+ eventPainterParams.trackHeight = params.trackHeight;
+ }
+ if ("trackGap" in params) {
+ eventPainterParams.trackGap = params.trackGap;
+ }
+ var eventPainter = ("overview" in params && params.overview) ?
+ new Timeline.OverviewEventPainter(eventPainterParams) :
+ new Timeline.DetailedEventPainter(eventPainterParams);
+
+ return {
+ width: params.width,
+ eventSource: eventSource,
+ timeZone: ("timeZone" in params) ? params.timeZone : 0,
+ ether: ether,
+ etherPainter: etherPainter,
+ eventPainter: eventPainter
+ };
+};
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/scripts/l10n/en/labellers.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/scripts/l10n/en/labellers.js
new file mode 100644
index 0000000..7e66701
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/scripts/l10n/en/labellers.js
@@ -0,0 +1,10 @@
+/*==================================================
+ * Localization of Geochrono Labeller
+ *==================================================
+ */
+
+Timeline.GeochronoLabeller.eonNames["en"] = Timeline.Geochrono.eons;
+Timeline.GeochronoLabeller.eraNames["en"] = Timeline.Geochrono.eras;
+Timeline.GeochronoLabeller.periodNames["en"] = Timeline.Geochrono.periods;
+Timeline.GeochronoLabeller.epochNames["en"] = Timeline.Geochrono.epoches;
+Timeline.GeochronoLabeller.ageNames["en"] = Timeline.Geochrono.ages;
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/scripts/labellers.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/scripts/labellers.js
new file mode 100644
index 0000000..3aabd15
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/scripts/labellers.js
@@ -0,0 +1,52 @@
+/*==================================================
+ * Geochrono Labeller
+ *==================================================
+ */
+
+Timeline.GeochronoLabeller = function(locale) {
+ this._locale = locale;
+};
+
+Timeline.GeochronoLabeller.eonNames = [];
+Timeline.GeochronoLabeller.eraNames = [];
+Timeline.GeochronoLabeller.periodNames = [];
+Timeline.GeochronoLabeller.epochNames = [];
+Timeline.GeochronoLabeller.ageNames = [];
+
+Timeline.GeochronoLabeller.prototype.labelInterval = function(date, intervalUnit) {
+ var n = Timeline.GeochronoUnit.toNumber(date);
+ var dates, names;
+ switch (intervalUnit) {
+ case Timeline.GeochronoUnit.AGE:
+ dates = Timeline.Geochrono.ages;
+ names = Timeline.GeochronoLabeller.ageNames; break;
+ case Timeline.GeochronoUnit.EPOCH:
+ dates = Timeline.Geochrono.epoches;
+ names = Timeline.GeochronoLabeller.epochNames; break;
+ case Timeline.GeochronoUnit.PERIOD:
+ dates = Timeline.Geochrono.periods;
+ names = Timeline.GeochronoLabeller.periodNames; break;
+ case Timeline.GeochronoUnit.ERA:
+ dates = Timeline.Geochrono.eras;
+ names = Timeline.GeochronoLabeller.eraNames; break;
+ case Timeline.GeochronoUnit.EON:
+ dates = Timeline.Geochrono.eons;
+ names = Timeline.GeochronoLabeller.eonNames; break;
+ default:
+ return { text: n, emphasized: false };
+ }
+
+ for (var i = dates.length - 1; i >= 0; i--) {
+ if (n <= dates[i].start) {
+ return {
+ text: names[this._locale][i].name,
+ emphasized: n == dates[i].start
+ }
+ }
+ }
+ return { text: n, emphasized: false };
+};
+
+Timeline.GeochronoLabeller.prototype.labelPrecise = function(date) {
+ return Timeline.GeochronoUnit.toNumber(date) + "ma";
+};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/scripts/units.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/scripts/units.js
new file mode 100644
index 0000000..86182ff
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/scripts/units.js
@@ -0,0 +1,86 @@
+/*==================================================
+ * Geochrono Unit
+ *==================================================
+ */
+
+Timeline.GeochronoUnit = new Object();
+
+Timeline.GeochronoUnit.MA = 0;
+Timeline.GeochronoUnit.AGE = 1;
+Timeline.GeochronoUnit.EPOCH = 2;
+Timeline.GeochronoUnit.PERIOD = 3;
+Timeline.GeochronoUnit.ERA = 4;
+Timeline.GeochronoUnit.EON = 5;
+
+Timeline.GeochronoUnit.getParser = function(format) {
+ return Timeline.GeochronoUnit.parseFromObject;
+};
+
+Timeline.GeochronoUnit.createLabeller = function(locale, timeZone) {
+ return new Timeline.GeochronoLabeller(locale);
+};
+
+Timeline.GeochronoUnit.wrapMA = function (n) {
+ return new Timeline.GeochronoUnit._MA(n);
+};
+
+Timeline.GeochronoUnit.makeDefaultValue = function () {
+ return Timeline.GeochronoUnit.wrapMA(0);
+};
+
+Timeline.GeochronoUnit.cloneValue = function (v) {
+ return new Timeline.GeochronoUnit._MA(v._n);
+};
+
+Timeline.GeochronoUnit.parseFromObject = function(o) {
+ if (o instanceof Timeline.GeochronoUnit._MA) {
+ return o;
+ } else if (typeof o == "number") {
+ return Timeline.GeochronoUnit.wrapMA(o);
+ } else if (typeof o == "string" && o.length > 0) {
+ return Timeline.GeochronoUnit.wrapMA(Number(o));
+ } else {
+ return null;
+ }
+};
+
+Timeline.GeochronoUnit.toNumber = function(v) {
+ return v._n;
+};
+
+Timeline.GeochronoUnit.fromNumber = function(n) {
+ return new Timeline.GeochronoUnit._MA(n);
+};
+
+Timeline.GeochronoUnit.compare = function(v1, v2) {
+ var n1, n2;
+ if (typeof v1 == "object") {
+ n1 = v1._n;
+ } else {
+ n1 = Number(v1);
+ }
+ if (typeof v2 == "object") {
+ n2 = v2._n;
+ } else {
+ n2 = Number(v2);
+ }
+
+ return n2 - n1;
+};
+
+Timeline.GeochronoUnit.earlier = function(v1, v2) {
+ return Timeline.GeochronoUnit.compare(v1, v2) < 0 ? v1 : v2;
+};
+
+Timeline.GeochronoUnit.later = function(v1, v2) {
+ return Timeline.GeochronoUnit.compare(v1, v2) > 0 ? v1 : v2;
+};
+
+Timeline.GeochronoUnit.change = function(v, n) {
+ return new Timeline.GeochronoUnit._MA(v._n - n);
+};
+
+Timeline.GeochronoUnit._MA = function(n) {
+ this._n = n;
+};
+
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/planning/planning-api.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/planning/planning-api.js
new file mode 100644
index 0000000..9d92681
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/planning/planning-api.js
@@ -0,0 +1,92 @@
+/*==================================================
+ * Planning Extension
+ *
+ * This file will load all the Javascript files
+ * necessary to make the extension work.
+ *
+ *==================================================
+ */
+
+(function() {
+ var javascriptFiles = [
+ "planning.js",
+ "units.js",
+ "ether-painters.js",
+ "labellers.js"
+ ];
+ var cssFiles = [
+ ];
+
+ var localizedJavascriptFiles = [
+ "labellers.js"
+ ];
+ var localizedCssFiles = [
+ ];
+
+ // ISO-639 language codes, ISO-3166 country codes (2 characters)
+ var supportedLocales = [
+ "en" // English
+ ];
+
+ try {
+ var includeJavascriptFile = function(filename) {
+ document.write("<script src='" + Timeline.urlPrefix + "ext/planning/scripts/" + filename + "' type='text/javascript'></script>");
+ };
+ var includeCssFile = function(filename) {
+ document.write("<link rel='stylesheet' href='" + Timeline.urlPrefix + "ext/planning/styles/" + filename + "' type='text/css'/>");
+ }
+
+ /*
+ * Include non-localized files
+ */
+ for (var i = 0; i < javascriptFiles.length; i++) {
+ includeJavascriptFile(javascriptFiles[i]);
+ }
+ for (var i = 0; i < cssFiles.length; i++) {
+ includeCssFile(cssFiles[i]);
+ }
+
+ /*
+ * Include localized files
+ */
+ var loadLocale = [];
+ var tryExactLocale = function(locale) {
+ for (var l = 0; l < supportedLocales.length; l++) {
+ if (locale == supportedLocales[l]) {
+ loadLocale[locale] = true;
+ return true;
+ }
+ }
+ return false;
+ }
+ var tryLocale = function(locale) {
+ if (tryExactLocale(locale)) {
+ return locale;
+ }
+
+ var dash = locale.indexOf("-");
+ if (dash > 0 && tryExactLocale(locale.substr(0, dash))) {
+ return locale.substr(0, dash);
+ }
+
+ return null;
+ }
+
+ tryLocale(Timeline.serverLocale);
+ tryLocale(Timeline.clientLocale);
+
+ for (var l = 0; l < supportedLocales.length; l++) {
+ var locale = supportedLocales[l];
+ if (loadLocale[locale]) {
+ for (var i = 0; i < localizedJavascriptFiles.length; i++) {
+ includeJavascriptFile("l10n/" + locale + "/" + localizedJavascriptFiles[i]);
+ }
+ for (var i = 0; i < localizedCssFiles.length; i++) {
+ includeCssFile("l10n/" + locale + "/" + localizedCssFiles[i]);
+ }
+ }
+ }
+ } catch (e) {
+ alert(e);
+ }
+})();
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/planning/scripts/ether-painters.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/planning/scripts/ether-painters.js
new file mode 100644
index 0000000..75c2a62
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/planning/scripts/ether-painters.js
@@ -0,0 +1,176 @@
+/*==================================================
+ * Planning Ether Painter
+ *==================================================
+ */
+
+Timeline.PlanningEtherPainter = function(params, band, timeline) {
+ this._params = params;
+ this._intervalUnit = params.intervalUnit;
+ this._multiple = ("multiple" in params) ? params.multiple : 1;
+ this._theme = params.theme;
+};
+
+Timeline.PlanningEtherPainter.prototype.initialize = function(band, timeline) {
+ this._band = band;
+ this._timeline = timeline;
+
+ this._backgroundLayer = band.createLayerDiv(0);
+ this._backgroundLayer.setAttribute("name", "ether-background"); // for debugging
+ this._backgroundLayer.style.background = this._theme.ether.backgroundColors[band.getIndex()];
+
+ this._markerLayer = null;
+ this._lineLayer = null;
+
+ var align = ("align" in this._params && typeof this._params.align == "string") ? this._params.align :
+ this._theme.ether.interval.marker[timeline.isHorizontal() ? "hAlign" : "vAlign"];
+ var showLine = ("showLine" in this._params) ? this._params.showLine :
+ this._theme.ether.interval.line.show;
+
+ this._intervalMarkerLayout = new Timeline.PlanningEtherMarkerLayout(
+ this._timeline, this._band, this._theme, align, showLine);
+
+ this._highlight = new Timeline.EtherHighlight(
+ this._timeline, this._band, this._theme, this._backgroundLayer);
+}
+
+Timeline.PlanningEtherPainter.prototype.setHighlight = function(startDate, endDate) {
+ this._highlight.position(startDate, endDate);
+}
+
+Timeline.PlanningEtherPainter.prototype.paint = function() {
+ if (this._markerLayer) {
+ this._band.removeLayerDiv(this._markerLayer);
+ }
+ this._markerLayer = this._band.createLayerDiv(100);
+ this._markerLayer.setAttribute("name", "ether-markers"); // for debugging
+ this._markerLayer.style.display = "none";
+
+ if (this._lineLayer) {
+ this._band.removeLayerDiv(this._lineLayer);
+ }
+ this._lineLayer = this._band.createLayerDiv(1);
+ this._lineLayer.setAttribute("name", "ether-lines"); // for debugging
+ this._lineLayer.style.display = "none";
+
+ var minDate = Math.max(0, Math.ceil(Timeline.PlanningUnit.toNumber(this._band.getMinDate())));
+ var maxDate = Math.floor(Timeline.PlanningUnit.toNumber(this._band.getMaxDate()));
+
+ var hasMore = function() {
+ return minDate < maxDate;
+ };
+ var change = 1;
+ var multiple = this._multiple;
+ switch (this._intervalUnit) {
+ case Timeline.PlanningUnit.DAY: change = 1; break;
+ case Timeline.PlanningUnit.WEEK: change = 7; break;
+ case Timeline.PlanningUnit.MONTH: change = 28; break;
+ case Timeline.PlanningUnit.QUARTER: change = 28 * 3; break;
+ case Timeline.PlanningUnit.YEAR: change = 28 * 12; break;
+ }
+ var increment = function() {
+ minDate += change * multiple;
+ };
+
+ var labeller = this._band.getLabeller();
+ while (true) {
+ this._intervalMarkerLayout.createIntervalMarker(
+ Timeline.PlanningUnit.fromNumber(minDate),
+ labeller,
+ this._intervalUnit,
+ this._markerLayer,
+ this._lineLayer
+ );
+ if (hasMore()) {
+ increment();
+ } else {
+ break;
+ }
+ }
+ this._markerLayer.style.display = "block";
+ this._lineLayer.style.display = "block";
+};
+
+Timeline.PlanningEtherPainter.prototype.softPaint = function() {
+};
+
+
+/*==================================================
+ * Planning Ether Marker Layout
+ *==================================================
+ */
+
+Timeline.PlanningEtherMarkerLayout = function(timeline, band, theme, align, showLine) {
+ var horizontal = timeline.isHorizontal();
+ if (horizontal) {
+ if (align == "Top") {
+ this.positionDiv = function(div, offset) {
+ div.style.left = offset + "px";
+ div.style.top = "0px";
+ };
+ } else {
+ this.positionDiv = function(div, offset) {
+ div.style.left = offset + "px";
+ div.style.bottom = "0px";
+ };
+ }
+ } else {
+ if (align == "Left") {
+ this.positionDiv = function(div, offset) {
+ div.style.top = offset + "px";
+ div.style.left = "0px";
+ };
+ } else {
+ this.positionDiv = function(div, offset) {
+ div.style.top = offset + "px";
+ div.style.right = "0px";
+ };
+ }
+ }
+
+ var markerTheme = theme.ether.interval.marker;
+ var lineTheme = theme.ether.interval.line;
+
+ var stylePrefix = (horizontal ? "h" : "v") + align;
+ var labelStyler = markerTheme[stylePrefix + "Styler"];
+ var emphasizedLabelStyler = markerTheme[stylePrefix + "EmphasizedStyler"];
+
+ this.createIntervalMarker = function(date, labeller, unit, markerDiv, lineDiv) {
+ var offset = Math.round(band.dateToPixelOffset(date));
+
+ if (showLine) {
+ var divLine = timeline.getDocument().createElement("div");
+ divLine.style.position = "absolute";
+
+ if (lineTheme.opacity < 100) {
+ Timeline.Graphics.setOpacity(divLine, lineTheme.opacity);
+ }
+
+ if (horizontal) {
+ divLine.style.borderLeft = "1px solid " + lineTheme.color;
+ divLine.style.left = offset + "px";
+ divLine.style.width = "1px";
+ divLine.style.top = "0px";
+ divLine.style.height = "100%";
+ } else {
+ divLine.style.borderTop = "1px solid " + lineTheme.color;
+ divLine.style.top = offset + "px";
+ divLine.style.height = "1px";
+ divLine.style.left = "0px";
+ divLine.style.width = "100%";
+ }
+ lineDiv.appendChild(divLine);
+ }
+
+ var label = labeller.labelInterval(date, unit);
+
+ var div = timeline.getDocument().createElement("div");
+ div.innerHTML = label.text;
+ div.style.position = "absolute";
+ (label.emphasized ? emphasizedLabelStyler : labelStyler)(div);
+
+ this.positionDiv(div, offset);
+ markerDiv.appendChild(div);
+
+ return div;
+ };
+};
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/planning/scripts/l10n/en/labellers.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/planning/scripts/l10n/en/labellers.js
new file mode 100644
index 0000000..cdbac8c
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/planning/scripts/l10n/en/labellers.js
@@ -0,0 +1,12 @@
+/*==================================================
+ * Localization of Planning Labeller
+ *==================================================
+ */
+
+Timeline.PlanningLabeller.labels["en"] = {
+ dayPrefix: "d",
+ weekPrefix: "w",
+ monthPrefix: "m",
+ quarterPrefix: "q",
+ yearPrefix: "y"
+};
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/planning/scripts/labellers.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/planning/scripts/labellers.js
new file mode 100644
index 0000000..46e5a69
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/planning/scripts/labellers.js
@@ -0,0 +1,33 @@
+/*==================================================
+ * Planning Labeller
+ *==================================================
+ */
+
+Timeline.PlanningLabeller = function(locale) {
+ this._locale = locale;
+};
+
+Timeline.PlanningLabeller.labels = [];
+
+Timeline.PlanningLabeller.prototype.labelInterval = function(date, intervalUnit) {
+ var n = Timeline.PlanningUnit.toNumber(date);
+
+ var prefix = "";
+ var divider = 1;
+ var divider2 = 7;
+ var labels = Timeline.PlanningLabeller.labels[this._locale];
+
+ switch (intervalUnit) {
+ case Timeline.PlanningUnit.DAY: prefix = labels.dayPrefix; break;
+ case Timeline.PlanningUnit.WEEK: prefix = labels.weekPrefix; divider = 7; divider2 = divider * 4; break;
+ case Timeline.PlanningUnit.MONTH: prefix = labels.monthPrefix; divider = 28; divider2 = divider * 3; break;
+ case Timeline.PlanningUnit.QUARTER: prefix = labels.quarterPrefix; divider = 28 * 3; divider2 = divider * 4; break;
+ case Timeline.PlanningUnit.YEAR: prefix = labels.yearPrefix; divider = 28 * 12; divider2 = divider * 5; break;
+ }
+ return { text: prefix + Math.floor(n / divider), emphasized: (n % divider2) == 0 };
+};
+
+Timeline.PlanningLabeller.prototype.labelPrecise = function(date) {
+ return Timeline.PlanningLabeller.labels[this._locale].dayPrefix +
+ Timeline.PlanningUnit.toNumber(date);
+};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/planning/scripts/planning.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/planning/scripts/planning.js
new file mode 100644
index 0000000..4201f92
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/planning/scripts/planning.js
@@ -0,0 +1,47 @@
+/*==================================================
+ * Planning
+ *==================================================
+ */
+
+Timeline.Planning = new Object();
+
+Timeline.Planning.createBandInfo = function(params) {
+ var theme = ("theme" in params) ? params.theme : Timeline.getDefaultTheme();
+
+ var eventSource = ("eventSource" in params) ? params.eventSource : null;
+
+ var ether = new Timeline.LinearEther({
+ centersOn: ("date" in params) ? params.date : Timeline.PlanningUnit.makeDefaultValue(),
+ interval: 1,
+ pixelsPerInterval: params.intervalPixels
+ });
+
+ var etherPainter = new Timeline.PlanningEtherPainter({
+ intervalUnit: params.intervalUnit,
+ multiple: ("multiple" in params) ? params.multiple : 1,
+ align: params.align,
+ theme: theme
+ });
+
+ var eventPainterParams = {
+ theme: theme
+ };
+ if ("trackHeight" in params) {
+ eventPainterParams.trackHeight = params.trackHeight;
+ }
+ if ("trackGap" in params) {
+ eventPainterParams.trackGap = params.trackGap;
+ }
+ var eventPainter = ("overview" in params && params.overview) ?
+ new Timeline.OverviewEventPainter(eventPainterParams) :
+ new Timeline.DetailedEventPainter(eventPainterParams);
+
+ return {
+ width: params.width,
+ eventSource: eventSource,
+ timeZone: ("timeZone" in params) ? params.timeZone : 0,
+ ether: ether,
+ etherPainter: etherPainter,
+ eventPainter: eventPainter
+ };
+};
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/planning/scripts/units.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/planning/scripts/units.js
new file mode 100644
index 0000000..13c31c1
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/planning/scripts/units.js
@@ -0,0 +1,66 @@
+/*==================================================
+ * Planning Unit
+ *==================================================
+ */
+
+Timeline.PlanningUnit = new Object();
+
+Timeline.PlanningUnit.DAY = 0;
+Timeline.PlanningUnit.WEEK = 1;
+Timeline.PlanningUnit.MONTH = 2;
+Timeline.PlanningUnit.QUARTER = 3;
+Timeline.PlanningUnit.YEAR = 4;
+
+Timeline.PlanningUnit.getParser = function(format) {
+ return Timeline.PlanningUnit.parseFromObject;
+};
+
+Timeline.PlanningUnit.createLabeller = function(locale, timeZone) {
+ return new Timeline.PlanningLabeller(locale);
+};
+
+Timeline.PlanningUnit.makeDefaultValue = function () {
+ return 0;
+};
+
+Timeline.PlanningUnit.cloneValue = function (v) {
+ return v;
+};
+
+Timeline.PlanningUnit.parseFromObject = function(o) {
+ if (o == null) {
+ return null;
+ } else if (typeof o == "number") {
+ return o;
+ } else {
+ try {
+ return parseInt(o);
+ } catch (e) {
+ return null;
+ }
+ }
+};
+
+Timeline.PlanningUnit.toNumber = function(v) {
+ return v
+};
+
+Timeline.PlanningUnit.fromNumber = function(n) {
+ return n;
+};
+
+Timeline.PlanningUnit.compare = function(v1, v2) {
+ return v1 - v2;
+};
+
+Timeline.PlanningUnit.earlier = function(v1, v2) {
+ return Timeline.PlanningUnit.compare(v1, v2) < 0 ? v1 : v2;
+};
+
+Timeline.PlanningUnit.later = function(v1, v2) {
+ return Timeline.PlanningUnit.compare(v1, v2) > 0 ? v1 : v2;
+};
+
+Timeline.PlanningUnit.change = function(v, n) {
+ return v + n;
+};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/blue-circle.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/blue-circle.png
new file mode 100644
index 0000000..9ef045c
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/blue-circle.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-bottom-arrow.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-bottom-arrow.png
new file mode 100644
index 0000000..38c3917
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-bottom-arrow.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-bottom-left.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-bottom-left.png
new file mode 100644
index 0000000..6d32026
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-bottom-left.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-bottom-right.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-bottom-right.png
new file mode 100644
index 0000000..e5dc136
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-bottom-right.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-bottom.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-bottom.png
new file mode 100644
index 0000000..166b057
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-bottom.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-left-arrow.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-left-arrow.png
new file mode 100644
index 0000000..5b173cd
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-left-arrow.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-left.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-left.png
new file mode 100644
index 0000000..3826722
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-left.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-right-arrow.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-right-arrow.png
new file mode 100644
index 0000000..11e2873
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-right-arrow.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-right.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-right.png
new file mode 100644
index 0000000..f66f879
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-right.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-top-arrow.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-top-arrow.png
new file mode 100644
index 0000000..524c46e
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-top-arrow.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-top-left.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-top-left.png
new file mode 100644
index 0000000..d69841f
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-top-left.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-top-right.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-top-right.png
new file mode 100644
index 0000000..9ab219a
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-top-right.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-top.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-top.png
new file mode 100644
index 0000000..917defa
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-top.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/close-button.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/close-button.png
new file mode 100644
index 0000000..15f31b3
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/close-button.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/copyright-vertical.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/copyright-vertical.png
new file mode 100644
index 0000000..b15197b
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/copyright-vertical.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/copyright.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/copyright.png
new file mode 100644
index 0000000..bcf69c6
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/copyright.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/dark-blue-circle.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/dark-blue-circle.png
new file mode 100644
index 0000000..2747397
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/dark-blue-circle.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/dark-green-circle.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/dark-green-circle.png
new file mode 100644
index 0000000..903f9fd
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/dark-green-circle.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/dark-red-circle.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/dark-red-circle.png
new file mode 100644
index 0000000..5cbb085
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/dark-red-circle.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/dull-blue-circle.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/dull-blue-circle.png
new file mode 100644
index 0000000..19dd0da
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/dull-blue-circle.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/dull-green-circle.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/dull-green-circle.png
new file mode 100644
index 0000000..eecf665
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/dull-green-circle.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/dull-red-circle.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/dull-red-circle.png
new file mode 100644
index 0000000..2ff0111
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/dull-red-circle.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/gray-circle.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/gray-circle.png
new file mode 100644
index 0000000..39360d7
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/gray-circle.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/green-circle.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/green-circle.png
new file mode 100644
index 0000000..a5fc15c
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/green-circle.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/message-bottom-left.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/message-bottom-left.png
new file mode 100644
index 0000000..43a9d61
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/message-bottom-left.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/message-bottom-right.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/message-bottom-right.png
new file mode 100644
index 0000000..bfa4954
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/message-bottom-right.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/message-left.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/message-left.png
new file mode 100644
index 0000000..f354376
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/message-left.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/message-right.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/message-right.png
new file mode 100644
index 0000000..4702c28
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/message-right.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/message-top-left.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/message-top-left.png
new file mode 100644
index 0000000..b19b0ea
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/message-top-left.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/message-top-right.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/message-top-right.png
new file mode 100644
index 0000000..c092555
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/message-top-right.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/progress-running.gif b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/progress-running.gif
new file mode 100644
index 0000000..f7429eb
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/progress-running.gif differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/red-circle.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/red-circle.png
new file mode 100644
index 0000000..d56e734
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/red-circle.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/top-bubble.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/top-bubble.png
new file mode 100644
index 0000000..db6c93d
Binary files /dev/null and b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/top-bubble.png differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/decorators.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/decorators.js
new file mode 100644
index 0000000..ec1f193
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/decorators.js
@@ -0,0 +1,175 @@
+/*==================================================
+ * Span Highlight Decorator
+ *==================================================
+ */
+
+Timeline.SpanHighlightDecorator = function(params) {
+ this._unit = ("unit" in params) ? params.unit : SimileAjax.NativeDateUnit;
+ this._startDate = (typeof params.startDate == "string") ?
+ this._unit.parseFromObject(params.startDate) : params.startDate;
+ this._endDate = (typeof params.endDate == "string") ?
+ this._unit.parseFromObject(params.endDate) : params.endDate;
+ this._startLabel = params.startLabel;
+
+ this._endLabel = params.endLabel;
+ this._color = params.color;
+ this._cssClass = ("cssClass" in params) ? params.cssClass : null;
+ this._opacity = ("opacity" in params) ? params.opacity : 100;
+};
+
+Timeline.SpanHighlightDecorator.prototype.initialize = function(band, timeline) {
+ this._band = band;
+ this._timeline = timeline;
+
+ this._layerDiv = null;
+};
+
+Timeline.SpanHighlightDecorator.prototype.paint = function() {
+ if (this._layerDiv != null) {
+ this._band.removeLayerDiv(this._layerDiv);
+ }
+ this._layerDiv = this._band.createLayerDiv(10);
+ this._layerDiv.setAttribute("name", "span-highlight-decorator"); // for debugging
+ this._layerDiv.style.display = "none";
+
+
+ var minDate = this._band.getMinDate();
+ var maxDate = this._band.getMaxDate();
+
+ if (this._unit.compare(this._startDate, maxDate) < 0 &&
+ this._unit.compare(this._endDate, minDate) > 0) {
+
+ minDate = this._unit.later(minDate, this._startDate);
+ maxDate = this._unit.earlier(maxDate, this._endDate);
+
+ var minPixel = this._band.dateToPixelOffset(minDate);
+ var maxPixel = this._band.dateToPixelOffset(maxDate);
+
+ var doc = this._timeline.getDocument();
+
+ var createTable = function() {
+ var table = doc.createElement("table");
+ table.insertRow(0).insertCell(0);
+ return table;
+ };
+
+ var div = doc.createElement("div");
+ div.className='timeline-highlight-decorator'
+ if(this._cssClass) div.className += ' ' + this._cssClass
+
+ if (this._opacity < 100) {
+ SimileAjax.Graphics.setOpacity(div, this._opacity);
+ }
+ this._layerDiv.appendChild(div);
+
+ // GH: They were not using the requested color
+ div.style.backgroundColor = this._color;
+
+
+ var tableStartLabel = createTable();
+ tableStartLabel.className = 'timeline-highlight-label timeline-highlight-label-start'
+ var tdStart = tableStartLabel.rows[0].cells[0]
+ tdStart.innerHTML = this._startLabel;
+ if(this._cssClass) tdStart.className = 'label_' + this._cssClass
+ this._layerDiv.appendChild(tableStartLabel);
+
+
+ var tableEndLabel = createTable();
+ tableEndLabel.className = 'timeline-highlight-label timeline-highlight-label-end'
+ var tdEnd = tableEndLabel.rows[0].cells[0]
+ tdEnd.innerHTML = this._endLabel;
+ if(this._cssClass) tdEnd.className = 'label_' + this._cssClass
+ this._layerDiv.appendChild(tableEndLabel);
+
+ if (this._timeline.isHorizontal()){
+ div.style.left = minPixel + "px";
+ div.style.width = (maxPixel - minPixel) + "px";
+
+ tableStartLabel.style.right = (this._band.getTotalViewLength() - minPixel) + "px";
+ tableStartLabel.style.width = (this._startLabel.length) + "em";
+
+ tableEndLabel.style.left = maxPixel + "px";
+ tableEndLabel.style.width = (this._endLabel.length) + "em";
+
+ } else {
+ div.style.top = minPixel + "px";
+ div.style.height = (maxPixel - minPixel) + "px";
+
+ tableStartLabel.style.bottom = minPixel + "px";
+ tableStartLabel.style.height = "1.5px";
+
+ tableEndLabel.style.top = maxPixel + "px";
+ tableEndLabel.style.height = "1.5px";
+ }
+ }
+ this._layerDiv.style.display = "block";
+};
+
+Timeline.SpanHighlightDecorator.prototype.softPaint = function() {
+};
+
+/*==================================================
+ * Point Highlight Decorator
+ *==================================================
+ */
+
+Timeline.PointHighlightDecorator = function(params) {
+ this._unit = ("unit" in params) ? params.unit : SimileAjax.NativeDateUnit;
+ this._date = (typeof params.date == "string") ?
+ this._unit.parseFromObject(params.date) : params.date;
+ this._width = ("width" in params) ? params.width : 10;
+ this._color = params.color;
+ this._cssClass = ("cssClass" in params) ? params.cssClass : '';
+ this._opacity = ("opacity" in params) ? params.opacity : 100;
+};
+
+Timeline.PointHighlightDecorator.prototype.initialize = function(band, timeline) {
+ this._band = band;
+ this._timeline = timeline;
+ this._layerDiv = null;
+};
+
+Timeline.PointHighlightDecorator.prototype.paint = function() {
+ if (this._layerDiv != null) {
+ this._band.removeLayerDiv(this._layerDiv);
+ }
+ this._layerDiv = this._band.createLayerDiv(10);
+ this._layerDiv.setAttribute("name", "span-highlight-decorator"); // for debugging
+ this._layerDiv.style.display = "none";
+
+
+ var minDate = this._band.getMinDate();
+ var maxDate = this._band.getMaxDate();
+
+ if (this._unit.compare(this._date, maxDate) < 0 &&
+ this._unit.compare(this._date, minDate) > 0) {
+
+ var pixel = this._band.dateToPixelOffset(this._date);
+ var minPixel = pixel - Math.round(this._width / 2);
+
+ var doc = this._timeline.getDocument();
+
+ var div = doc.createElement("div");
+ div.className='timeline-highlight-point-decorator'
+ div.className += ' ' + this._cssClass
+
+ // GH: This was being ignored
+ div.style.backgroundColor = this._color;
+
+ if (this._opacity < 100) {
+ SimileAjax.Graphics.setOpacity(div, this._opacity);
+ }
+ this._layerDiv.appendChild(div);
+
+ if (this._timeline.isHorizontal()) {
+ div.style.left = minPixel + "px";
+
+ } else {
+ div.style.top = minPixel + "px";
+ }
+ }
+ this._layerDiv.style.display = "block";
+};
+
+Timeline.PointHighlightDecorator.prototype.softPaint = function() {
+};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/detailed-painter.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/detailed-painter.js
new file mode 100644
index 0000000..fa1ce5d
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/detailed-painter.js
@@ -0,0 +1,679 @@
+/*==================================================
+ * Detailed Event Painter
+ *==================================================
+ */
+
+Timeline.DetailedEventPainter = function(params) {
+ this._params = params;
+ this._onSelectListeners = [];
+
+ this._filterMatcher = null;
+ this._highlightMatcher = null;
+ this._frc = null;
+
+ this._eventIdToElmt = {};
+};
+
+Timeline.DetailedEventPainter.prototype.initialize = function(band, timeline) {
+ this._band = band;
+ this._timeline = timeline;
+
+ this._backLayer = null;
+ this._eventLayer = null;
+ this._lineLayer = null;
+ this._highlightLayer = null;
+
+ this._eventIdToElmt = null;
+};
+
+Timeline.DetailedEventPainter.prototype.addOnSelectListener = function(listener) {
+ this._onSelectListeners.push(listener);
+};
+
+Timeline.DetailedEventPainter.prototype.removeOnSelectListener = function(listener) {
+ for (var i = 0; i < this._onSelectListeners.length; i++) {
+ if (this._onSelectListeners[i] == listener) {
+ this._onSelectListeners.splice(i, 1);
+ break;
+ }
+ }
+};
+
+Timeline.DetailedEventPainter.prototype.getFilterMatcher = function() {
+ return this._filterMatcher;
+};
+
+Timeline.DetailedEventPainter.prototype.setFilterMatcher = function(filterMatcher) {
+ this._filterMatcher = filterMatcher;
+};
+
+Timeline.DetailedEventPainter.prototype.getHighlightMatcher = function() {
+ return this._highlightMatcher;
+};
+
+Timeline.DetailedEventPainter.prototype.setHighlightMatcher = function(highlightMatcher) {
+ this._highlightMatcher = highlightMatcher;
+};
+
+Timeline.DetailedEventPainter.prototype.paint = function() {
+ var eventSource = this._band.getEventSource();
+ if (eventSource == null) {
+ return;
+ }
+
+ this._eventIdToElmt = {};
+ this._prepareForPainting();
+
+ var eventTheme = this._params.theme.event;
+ var trackHeight = Math.max(eventTheme.track.height, this._frc.getLineHeight());
+ var metrics = {
+ trackOffset: Math.round(this._band.getViewWidth() / 2 - trackHeight / 2),
+ trackHeight: trackHeight,
+ trackGap: eventTheme.track.gap,
+ trackIncrement: trackHeight + eventTheme.track.gap,
+ icon: eventTheme.instant.icon,
+ iconWidth: eventTheme.instant.iconWidth,
+ iconHeight: eventTheme.instant.iconHeight,
+ labelWidth: eventTheme.label.width
+ }
+
+ var minDate = this._band.getMinDate();
+ var maxDate = this._band.getMaxDate();
+
+ var filterMatcher = (this._filterMatcher != null) ?
+ this._filterMatcher :
+ function(evt) { return true; };
+ var highlightMatcher = (this._highlightMatcher != null) ?
+ this._highlightMatcher :
+ function(evt) { return -1; };
+
+ var iterator = eventSource.getEventReverseIterator(minDate, maxDate);
+ while (iterator.hasNext()) {
+ var evt = iterator.next();
+ if (filterMatcher(evt)) {
+ this.paintEvent(evt, metrics, this._params.theme, highlightMatcher(evt));
+ }
+ }
+
+ this._highlightLayer.style.display = "block";
+ this._lineLayer.style.display = "block";
+ this._eventLayer.style.display = "block";
+};
+
+Timeline.DetailedEventPainter.prototype.softPaint = function() {
+};
+
+Timeline.DetailedEventPainter.prototype._prepareForPainting = function() {
+ var band = this._band;
+
+ if (this._backLayer == null) {
+ this._backLayer = this._band.createLayerDiv(0, "timeline-band-events");
+ this._backLayer.style.visibility = "hidden";
+
+ var eventLabelPrototype = document.createElement("span");
+ eventLabelPrototype.className = "timeline-event-label";
+ this._backLayer.appendChild(eventLabelPrototype);
+ this._frc = SimileAjax.Graphics.getFontRenderingContext(eventLabelPrototype);
+ }
+ this._frc.update();
+ this._lowerTracks = [];
+ this._upperTracks = [];
+
+ if (this._highlightLayer != null) {
+ band.removeLayerDiv(this._highlightLayer);
+ }
+ this._highlightLayer = band.createLayerDiv(105, "timeline-band-highlights");
+ this._highlightLayer.style.display = "none";
+
+ if (this._lineLayer != null) {
+ band.removeLayerDiv(this._lineLayer);
+ }
+ this._lineLayer = band.createLayerDiv(110, "timeline-band-lines");
+ this._lineLayer.style.display = "none";
+
+ if (this._eventLayer != null) {
+ band.removeLayerDiv(this._eventLayer);
+ }
+ this._eventLayer = band.createLayerDiv(110, "timeline-band-events");
+ this._eventLayer.style.display = "none";
+};
+
+Timeline.DetailedEventPainter.prototype.paintEvent = function(evt, metrics, theme, highlightIndex) {
+ if (evt.isInstant()) {
+ this.paintInstantEvent(evt, metrics, theme, highlightIndex);
+ } else {
+ this.paintDurationEvent(evt, metrics, theme, highlightIndex);
+ }
+};
+
+Timeline.DetailedEventPainter.prototype.paintInstantEvent = function(evt, metrics, theme, highlightIndex) {
+ if (evt.isImprecise()) {
+ this.paintImpreciseInstantEvent(evt, metrics, theme, highlightIndex);
+ } else {
+ this.paintPreciseInstantEvent(evt, metrics, theme, highlightIndex);
+ }
+}
+
+Timeline.DetailedEventPainter.prototype.paintDurationEvent = function(evt, metrics, theme, highlightIndex) {
+ if (evt.isImprecise()) {
+ this.paintImpreciseDurationEvent(evt, metrics, theme, highlightIndex);
+ } else {
+ this.paintPreciseDurationEvent(evt, metrics, theme, highlightIndex);
+ }
+}
+
+Timeline.DetailedEventPainter.prototype.paintPreciseInstantEvent = function(evt, metrics, theme, highlightIndex) {
+ var doc = this._timeline.getDocument();
+ var text = evt.getText();
+
+ var startDate = evt.getStart();
+ var startPixel = Math.round(this._band.dateToPixelOffset(startDate));
+ var iconRightEdge = Math.round(startPixel + metrics.iconWidth / 2);
+ var iconLeftEdge = Math.round(startPixel - metrics.iconWidth / 2);
+
+ var labelSize = this._frc.computeSize(text);
+ var iconTrack = this._findFreeTrackForSolid(iconRightEdge, startPixel);
+ var iconElmtData = this._paintEventIcon(evt, iconTrack, iconLeftEdge, metrics, theme);
+
+ var labelLeft = iconRightEdge + theme.event.label.offsetFromLine;
+ var labelTrack = iconTrack;
+
+ var iconTrackData = this._getTrackData(iconTrack);
+ if (Math.min(iconTrackData.solid, iconTrackData.text) >= labelLeft + labelSize.width) { // label on the same track, to the right of icon
+ iconTrackData.solid = iconLeftEdge;
+ iconTrackData.text = labelLeft;
+ } else { // label on a different track, below icon
+ iconTrackData.solid = iconLeftEdge;
+
+ labelLeft = startPixel + theme.event.label.offsetFromLine;
+ labelTrack = this._findFreeTrackForText(iconTrack, labelLeft + labelSize.width, function(t) { t.line = startPixel - 2; });
+ this._getTrackData(labelTrack).text = iconLeftEdge;
+
+ this._paintEventLine(evt, startPixel, iconTrack, labelTrack, metrics, theme);
+ }
+
+ var labelTop = Math.round(
+ metrics.trackOffset + labelTrack * metrics.trackIncrement +
+ metrics.trackHeight / 2 - labelSize.height / 2);
+
+ var labelElmtData = this._paintEventLabel(evt, text, labelLeft, labelTop, labelSize.width, labelSize.height, theme);
+
+ var self = this;
+ var clickHandler = function(elmt, domEvt, target) {
+ return self._onClickInstantEvent(iconElmtData.elmt, domEvt, evt);
+ };
+ SimileAjax.DOM.registerEvent(iconElmtData.elmt, "mousedown", clickHandler);
+ SimileAjax.DOM.registerEvent(labelElmtData.elmt, "mousedown", clickHandler);
+
+ this._createHighlightDiv(highlightIndex, iconElmtData, theme);
+
+ this._eventIdToElmt[evt.getID()] = iconElmtData.elmt;
+};
+
+Timeline.DetailedEventPainter.prototype.paintImpreciseInstantEvent = function(evt, metrics, theme, highlightIndex) {
+ var doc = this._timeline.getDocument();
+ var text = evt.getText();
+
+ var startDate = evt.getStart();
+ var endDate = evt.getEnd();
+ var startPixel = Math.round(this._band.dateToPixelOffset(startDate));
+ var endPixel = Math.round(this._band.dateToPixelOffset(endDate));
+
+ var iconRightEdge = Math.round(startPixel + metrics.iconWidth / 2);
+ var iconLeftEdge = Math.round(startPixel - metrics.iconWidth / 2);
+
+ var labelSize = this._frc.computeSize(text);
+ var iconTrack = this._findFreeTrackForSolid(endPixel, startPixel);
+
+ var tapeElmtData = this._paintEventTape(evt, iconTrack, startPixel, endPixel,
+ theme.event.instant.impreciseColor, theme.event.instant.impreciseOpacity, metrics, theme);
+ var iconElmtData = this._paintEventIcon(evt, iconTrack, iconLeftEdge, metrics, theme);
+
+ var iconTrackData = this._getTrackData(iconTrack);
+ iconTrackData.solid = iconLeftEdge;
+
+ var labelLeft = iconRightEdge + theme.event.label.offsetFromLine;
+ var labelRight = labelLeft + labelSize.width;
+ var labelTrack;
+ if (labelRight < endPixel) {
+ labelTrack = iconTrack;
+ } else {
+ labelLeft = startPixel + theme.event.label.offsetFromLine;
+ labelRight = labelLeft + labelSize.width;
+
+ labelTrack = this._findFreeTrackForText(iconTrack, labelRight, function(t) { t.line = startPixel - 2; });
+ this._getTrackData(labelTrack).text = iconLeftEdge;
+
+ this._paintEventLine(evt, startPixel, iconTrack, labelTrack, metrics, theme);
+ }
+ var labelTop = Math.round(
+ metrics.trackOffset + labelTrack * metrics.trackIncrement +
+ metrics.trackHeight / 2 - labelSize.height / 2);
+
+ var labelElmtData = this._paintEventLabel(evt, text, labelLeft, labelTop, labelSize.width, labelSize.height, theme);
+
+ var self = this;
+ var clickHandler = function(elmt, domEvt, target) {
+ return self._onClickInstantEvent(iconElmtData.elmt, domEvt, evt);
+ };
+ SimileAjax.DOM.registerEvent(iconElmtData.elmt, "mousedown", clickHandler);
+ SimileAjax.DOM.registerEvent(tapeElmtData.elmt, "mousedown", clickHandler);
+ SimileAjax.DOM.registerEvent(labelElmtData.elmt, "mousedown", clickHandler);
+
+ this._createHighlightDiv(highlightIndex, iconElmtData, theme);
+
+ this._eventIdToElmt[evt.getID()] = iconElmtData.elmt;
+};
+
+Timeline.DetailedEventPainter.prototype.paintPreciseDurationEvent = function(evt, metrics, theme, highlightIndex) {
+ var doc = this._timeline.getDocument();
+ var text = evt.getText();
+
+ var startDate = evt.getStart();
+ var endDate = evt.getEnd();
+ var startPixel = Math.round(this._band.dateToPixelOffset(startDate));
+ var endPixel = Math.round(this._band.dateToPixelOffset(endDate));
+
+ var labelSize = this._frc.computeSize(text);
+ var tapeTrack = this._findFreeTrackForSolid(endPixel);
+ var color = evt.getColor();
+ color = color != null ? color : theme.event.duration.color;
+
+ var tapeElmtData = this._paintEventTape(evt, tapeTrack, startPixel, endPixel, color, 100, metrics, theme);
+
+ var tapeTrackData = this._getTrackData(tapeTrack);
+ tapeTrackData.solid = startPixel;
+
+ var labelLeft = startPixel + theme.event.label.offsetFromLine;
+ var labelTrack = this._findFreeTrackForText(tapeTrack, labelLeft + labelSize.width, function(t) { t.line = startPixel - 2; });
+ this._getTrackData(labelTrack).text = startPixel - 2;
+
+ this._paintEventLine(evt, startPixel, tapeTrack, labelTrack, metrics, theme);
+
+ var labelTop = Math.round(
+ metrics.trackOffset + labelTrack * metrics.trackIncrement +
+ metrics.trackHeight / 2 - labelSize.height / 2);
+
+ var labelElmtData = this._paintEventLabel(evt, text, labelLeft, labelTop, labelSize.width, labelSize.height, theme);
+
+ var self = this;
+ var clickHandler = function(elmt, domEvt, target) {
+ return self._onClickDurationEvent(tapeElmtData.elmt, domEvt, evt);
+ };
+ SimileAjax.DOM.registerEvent(tapeElmtData.elmt, "mousedown", clickHandler);
+ SimileAjax.DOM.registerEvent(labelElmtData.elmt, "mousedown", clickHandler);
+
+ this._createHighlightDiv(highlightIndex, tapeElmtData, theme);
+
+ this._eventIdToElmt[evt.getID()] = tapeElmtData.elmt;
+};
+
+Timeline.DetailedEventPainter.prototype.paintImpreciseDurationEvent = function(evt, metrics, theme, highlightIndex) {
+ var doc = this._timeline.getDocument();
+ var text = evt.getText();
+
+ var startDate = evt.getStart();
+ var latestStartDate = evt.getLatestStart();
+ var endDate = evt.getEnd();
+ var earliestEndDate = evt.getEarliestEnd();
+
+ var startPixel = Math.round(this._band.dateToPixelOffset(startDate));
+ var latestStartPixel = Math.round(this._band.dateToPixelOffset(latestStartDate));
+ var endPixel = Math.round(this._band.dateToPixelOffset(endDate));
+ var earliestEndPixel = Math.round(this._band.dateToPixelOffset(earliestEndDate));
+
+ var labelSize = this._frc.computeSize(text);
+ var tapeTrack = this._findFreeTrackForSolid(endPixel);
+ var color = evt.getColor();
+ color = color != null ? color : theme.event.duration.color;
+
+ var impreciseTapeElmtData = this._paintEventTape(evt, tapeTrack, startPixel, endPixel,
+ theme.event.duration.impreciseColor, theme.event.duration.impreciseOpacity, metrics, theme);
+ var tapeElmtData = this._paintEventTape(evt, tapeTrack, latestStartPixel, earliestEndPixel, color, 100, metrics, theme);
+
+ var tapeTrackData = this._getTrackData(tapeTrack);
+ tapeTrackData.solid = startPixel;
+
+ var labelLeft = latestStartPixel + theme.event.label.offsetFromLine;
+ var labelTrack = this._findFreeTrackForText(tapeTrack, labelLeft + labelSize.width, function(t) { t.line = latestStartPixel - 2; });
+ this._getTrackData(labelTrack).text = latestStartPixel - 2;
+
+ this._paintEventLine(evt, latestStartPixel, tapeTrack, labelTrack, metrics, theme);
+
+ var labelTop = Math.round(
+ metrics.trackOffset + labelTrack * metrics.trackIncrement +
+ metrics.trackHeight / 2 - labelSize.height / 2);
+
+ var labelElmtData = this._paintEventLabel(evt, text, labelLeft, labelTop, labelSize.width, labelSize.height, theme);
+
+ var self = this;
+ var clickHandler = function(elmt, domEvt, target) {
+ return self._onClickDurationEvent(tapeElmtData.elmt, domEvt, evt);
+ };
+ SimileAjax.DOM.registerEvent(tapeElmtData.elmt, "mousedown", clickHandler);
+ SimileAjax.DOM.registerEvent(labelElmtData.elmt, "mousedown", clickHandler);
+
+ this._createHighlightDiv(highlightIndex, tapeElmtData, theme);
+
+ this._eventIdToElmt[evt.getID()] = tapeElmtData.elmt;
+};
+
+Timeline.DetailedEventPainter.prototype._findFreeTrackForSolid = function(solidEdge, softEdge) {
+ for (var i = 0; true; i++) {
+ if (i < this._lowerTracks.length) {
+ var t = this._lowerTracks[i];
+ if (Math.min(t.solid, t.text) > solidEdge && (!(softEdge) || t.line > softEdge)) {
+ return i;
+ }
+ } else {
+ this._lowerTracks.push({
+ solid: Number.POSITIVE_INFINITY,
+ text: Number.POSITIVE_INFINITY,
+ line: Number.POSITIVE_INFINITY
+ });
+
+ return i;
+ }
+
+ if (i < this._upperTracks.length) {
+ var t = this._upperTracks[i];
+ if (Math.min(t.solid, t.text) > solidEdge && (!(softEdge) || t.line > softEdge)) {
+ return -1 - i;
+ }
+ } else {
+ this._upperTracks.push({
+ solid: Number.POSITIVE_INFINITY,
+ text: Number.POSITIVE_INFINITY,
+ line: Number.POSITIVE_INFINITY
+ });
+
+ return -1 - i;
+ }
+ }
+};
+
+Timeline.DetailedEventPainter.prototype._findFreeTrackForText = function(fromTrack, edge, occupiedTrackVisitor) {
+ var extendUp;
+ var index;
+ var firstIndex;
+ var result;
+
+ if (fromTrack < 0) {
+ extendUp = true;
+ firstIndex = -fromTrack;
+
+ index = this._findFreeUpperTrackForText(firstIndex, edge);
+ result = -1 - index;
+ } else if (fromTrack > 0) {
+ extendUp = false;
+ firstIndex = fromTrack + 1;
+
+ index = this._findFreeLowerTrackForText(firstIndex, edge);
+ result = index;
+ } else {
+ var upIndex = this._findFreeUpperTrackForText(0, edge);
+ var downIndex = this._findFreeLowerTrackForText(1, edge);
+
+ if (downIndex - 1 <= upIndex) {
+ extendUp = false;
+ firstIndex = 1;
+ index = downIndex;
+ result = index;
+ } else {
+ extendUp = true;
+ firstIndex = 0;
+ index = upIndex;
+ result = -1 - index;
+ }
+ }
+
+ if (extendUp) {
+ if (index == this._upperTracks.length) {
+ this._upperTracks.push({
+ solid: Number.POSITIVE_INFINITY,
+ text: Number.POSITIVE_INFINITY,
+ line: Number.POSITIVE_INFINITY
+ });
+ }
+ for (var i = firstIndex; i < index; i++) {
+ occupiedTrackVisitor(this._upperTracks[i]);
+ }
+ } else {
+ if (index == this._lowerTracks.length) {
+ this._lowerTracks.push({
+ solid: Number.POSITIVE_INFINITY,
+ text: Number.POSITIVE_INFINITY,
+ line: Number.POSITIVE_INFINITY
+ });
+ }
+ for (var i = firstIndex; i < index; i++) {
+ occupiedTrackVisitor(this._lowerTracks[i]);
+ }
+ }
+ return result;
+};
+
+Timeline.DetailedEventPainter.prototype._findFreeLowerTrackForText = function(index, edge) {
+ for (; index < this._lowerTracks.length; index++) {
+ var t = this._lowerTracks[index];
+ if (Math.min(t.solid, t.text) >= edge) {
+ break;
+ }
+ }
+ return index;
+};
+
+Timeline.DetailedEventPainter.prototype._findFreeUpperTrackForText = function(index, edge) {
+ for (; index < this._upperTracks.length; index++) {
+ var t = this._upperTracks[index];
+ if (Math.min(t.solid, t.text) >= edge) {
+ break;
+ }
+ }
+ return index;
+};
+
+Timeline.DetailedEventPainter.prototype._getTrackData = function(index) {
+ return (index < 0) ? this._upperTracks[-index - 1] : this._lowerTracks[index];
+};
+
+Timeline.DetailedEventPainter.prototype._paintEventLine = function(evt, left, startTrack, endTrack, metrics, theme) {
+ var top = Math.round(metrics.trackOffset + startTrack * metrics.trackIncrement + metrics.trackHeight / 2);
+ var height = Math.round(Math.abs(endTrack - startTrack) * metrics.trackIncrement);
+
+ var lineStyle = "1px solid " + theme.event.label.lineColor;
+ var lineDiv = this._timeline.getDocument().createElement("div");
+ lineDiv.style.position = "absolute";
+ lineDiv.style.left = left + "px";
+ lineDiv.style.width = theme.event.label.offsetFromLine + "px";
+ lineDiv.style.height = height + "px";
+ if (startTrack > endTrack) {
+ lineDiv.style.top = (top - height) + "px";
+ lineDiv.style.borderTop = lineStyle;
+ } else {
+ lineDiv.style.top = top + "px";
+ lineDiv.style.borderBottom = lineStyle;
+ }
+ lineDiv.style.borderLeft = lineStyle;
+ this._lineLayer.appendChild(lineDiv);
+};
+
+Timeline.DetailedEventPainter.prototype._paintEventIcon = function(evt, iconTrack, left, metrics, theme) {
+ var icon = evt.getIcon();
+ icon = icon != null ? icon : metrics.icon;
+
+ var middle = metrics.trackOffset + iconTrack * metrics.trackIncrement + metrics.trackHeight / 2;
+ var top = Math.round(middle - metrics.iconHeight / 2);
+
+ var img = SimileAjax.Graphics.createTranslucentImage(icon);
+ var iconDiv = this._timeline.getDocument().createElement("div");
+ iconDiv.style.position = "absolute";
+ iconDiv.style.left = left + "px";
+ iconDiv.style.top = top + "px";
+ iconDiv.appendChild(img);
+ iconDiv.style.cursor = "pointer";
+
+ if(evt._title != null)
+ iconDiv.title = evt._title
+
+ this._eventLayer.appendChild(iconDiv);
+
+ return {
+ left: left,
+ top: top,
+ width: metrics.iconWidth,
+ height: metrics.iconHeight,
+ elmt: iconDiv
+ };
+};
+
+Timeline.DetailedEventPainter.prototype._paintEventLabel = function(evt, text, left, top, width, height, theme) {
+ var doc = this._timeline.getDocument();
+
+ var labelBackgroundDiv = doc.createElement("div");
+ labelBackgroundDiv.style.position = "absolute";
+ labelBackgroundDiv.style.left = left + "px";
+ labelBackgroundDiv.style.width = width + "px";
+ labelBackgroundDiv.style.top = top + "px";
+ labelBackgroundDiv.style.height = height + "px";
+ labelBackgroundDiv.style.backgroundColor = theme.event.label.backgroundColor;
+ SimileAjax.Graphics.setOpacity(labelBackgroundDiv, theme.event.label.backgroundOpacity);
+ this._eventLayer.appendChild(labelBackgroundDiv);
+
+ var labelDiv = doc.createElement("div");
+ labelDiv.style.position = "absolute";
+ labelDiv.style.left = left + "px";
+ labelDiv.style.width = width + "px";
+ labelDiv.style.top = top + "px";
+ labelDiv.innerHTML = text;
+ labelDiv.style.cursor = "pointer";
+
+ if(evt._title != null)
+ labelDiv.title = evt._title;
+
+ var color = evt.getTextColor();
+ if (color == null) {
+ color = evt.getColor();
+ }
+ if (color != null) {
+ labelDiv.style.color = color;
+ }
+
+ this._eventLayer.appendChild(labelDiv);
+
+ return {
+ left: left,
+ top: top,
+ width: width,
+ height: height,
+ elmt: labelDiv
+ };
+};
+
+Timeline.DetailedEventPainter.prototype._paintEventTape = function(
+ evt, iconTrack, startPixel, endPixel, color, opacity, metrics, theme) {
+
+ var tapeWidth = endPixel - startPixel;
+ var tapeHeight = theme.event.tape.height;
+ var middle = metrics.trackOffset + iconTrack * metrics.trackIncrement + metrics.trackHeight / 2;
+ var top = Math.round(middle - tapeHeight / 2);
+
+ var tapeDiv = this._timeline.getDocument().createElement("div");
+ tapeDiv.style.position = "absolute";
+ tapeDiv.style.left = startPixel + "px";
+ tapeDiv.style.width = tapeWidth + "px";
+ tapeDiv.style.top = top + "px";
+ tapeDiv.style.height = tapeHeight + "px";
+ tapeDiv.style.backgroundColor = color;
+ tapeDiv.style.overflow = "hidden";
+ tapeDiv.style.cursor = "pointer";
+
+ if(evt._title != null)
+ tapeDiv.title = evt._title;
+
+ SimileAjax.Graphics.setOpacity(tapeDiv, opacity);
+
+ this._eventLayer.appendChild(tapeDiv);
+
+ return {
+ left: startPixel,
+ top: top,
+ width: tapeWidth,
+ height: tapeHeight,
+ elmt: tapeDiv
+ };
+}
+
+Timeline.DetailedEventPainter.prototype._createHighlightDiv = function(highlightIndex, dimensions, theme) {
+ if (highlightIndex >= 0) {
+ var doc = this._timeline.getDocument();
+ var eventTheme = theme.event;
+ alert('lksjdf');
+ // GH: They're ignoring our requested colors here
+// var color = eventTheme.highlightColors[Math.min(highlightIndex, eventTheme.highlightColors.length - 1)];
+
+ var div = doc.createElement("div");
+ div.style.position = "absolute";
+ div.style.overflow = "hidden";
+ div.style.left = (dimensions.left - 2) + "px";
+ div.style.width = (dimensions.width + 4) + "px";
+ div.style.top = (dimensions.top - 2) + "px";
+ div.style.height = (dimensions.height + 4) + "px";
+ div.style.background = color;
+
+ this._highlightLayer.appendChild(div);
+ }
+};
+
+Timeline.DetailedEventPainter.prototype._onClickInstantEvent = function(icon, domEvt, evt) {
+ var c = SimileAjax.DOM.getPageCoordinates(icon);
+ this._showBubble(
+ c.left + Math.ceil(icon.offsetWidth / 2),
+ c.top + Math.ceil(icon.offsetHeight / 2),
+ evt
+ );
+ this._fireOnSelect(evt.getID());
+
+ domEvt.cancelBubble = true;
+ SimileAjax.DOM.cancelEvent(domEvt);
+ return false;
+};
+
+Timeline.DetailedEventPainter.prototype._onClickDurationEvent = function(target, domEvt, evt) {
+ if ("pageX" in domEvt) {
+ var x = domEvt.pageX;
+ var y = domEvt.pageY;
+ } else {
+ var c = SimileAjax.DOM.getPageCoordinates(target);
+ var x = domEvt.offsetX + c.left;
+ var y = domEvt.offsetY + c.top;
+ }
+ this._showBubble(x, y, evt);
+ this._fireOnSelect(evt.getID());
+
+ domEvt.cancelBubble = true;
+ SimileAjax.DOM.cancelEvent(domEvt);
+ return false;
+};
+
+Timeline.DetailedEventPainter.prototype.showBubble = function(evt) {
+ var elmt = this._eventIdToElmt[evt.getID()];
+ if (elmt) {
+ var c = SimileAjax.DOM.getPageCoordinates(elmt);
+ this._showBubble(c.left + elmt.offsetWidth / 2, c.top + elmt.offsetHeight / 2, evt);
+ }
+};
+
+Timeline.DetailedEventPainter.prototype._showBubble = function(x, y, evt) {
+ var div = document.createElement("div");
+ evt.fillInfoBubble(div, this._params.theme, this._band.getLabeller());
+
+ SimileAjax.WindowManager.cancelPopups();
+ SimileAjax.Graphics.createBubbleForContentAndPoint(div, x, y, this._params.theme.event.bubble.width);
+};
+
+Timeline.DetailedEventPainter.prototype._fireOnSelect = function(eventID) {
+ for (var i = 0; i < this._onSelectListeners.length; i++) {
+ this._onSelectListeners[i](eventID);
+ }
+};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/ether-painters.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/ether-painters.js
new file mode 100644
index 0000000..51a0d5c
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/ether-painters.js
@@ -0,0 +1,576 @@
+/*==================================================
+ * Gregorian Ether Painter
+ *==================================================
+ */
+
+Timeline.GregorianEtherPainter = function(params) {
+ this._params = params;
+ this._theme = params.theme;
+ this._unit = params.unit;
+ this._multiple = ("multiple" in params) ? params.multiple : 1;
+};
+
+Timeline.GregorianEtherPainter.prototype.initialize = function(band, timeline) {
+ this._band = band;
+ this._timeline = timeline;
+
+ this._backgroundLayer = band.createLayerDiv(0);
+ this._backgroundLayer.setAttribute("name", "ether-background"); // for debugging
+ this._backgroundLayer.className = 'timeline-ether-bg';
+ // this._backgroundLayer.style.background = this._theme.ether.backgroundColors[band.getIndex()];
+
+
+ this._markerLayer = null;
+ this._lineLayer = null;
+
+ var align = ("align" in this._params && this._params.align != undefined) ? this._params.align :
+ this._theme.ether.interval.marker[timeline.isHorizontal() ? "hAlign" : "vAlign"];
+ var showLine = ("showLine" in this._params) ? this._params.showLine :
+ this._theme.ether.interval.line.show;
+
+ this._intervalMarkerLayout = new Timeline.EtherIntervalMarkerLayout(
+ this._timeline, this._band, this._theme, align, showLine);
+
+ this._highlight = new Timeline.EtherHighlight(
+ this._timeline, this._band, this._theme, this._backgroundLayer);
+}
+
+Timeline.GregorianEtherPainter.prototype.setHighlight = function(startDate, endDate) {
+ this._highlight.position(startDate, endDate);
+}
+
+Timeline.GregorianEtherPainter.prototype.paint = function() {
+ if (this._markerLayer) {
+ this._band.removeLayerDiv(this._markerLayer);
+ }
+ this._markerLayer = this._band.createLayerDiv(100);
+ this._markerLayer.setAttribute("name", "ether-markers"); // for debugging
+ this._markerLayer.style.display = "none";
+
+ if (this._lineLayer) {
+ this._band.removeLayerDiv(this._lineLayer);
+ }
+ this._lineLayer = this._band.createLayerDiv(1);
+ this._lineLayer.setAttribute("name", "ether-lines"); // for debugging
+ this._lineLayer.style.display = "none";
+
+ var minDate = this._band.getMinDate();
+ var maxDate = this._band.getMaxDate();
+
+ var timeZone = this._band.getTimeZone();
+ var labeller = this._band.getLabeller();
+
+ SimileAjax.DateTime.roundDownToInterval(minDate, this._unit, timeZone, this._multiple, this._theme.firstDayOfWeek);
+
+ var p = this;
+ var incrementDate = function(date) {
+ for (var i = 0; i < p._multiple; i++) {
+ SimileAjax.DateTime.incrementByInterval(date, p._unit);
+ }
+ };
+
+ while (minDate.getTime() < maxDate.getTime()) {
+ this._intervalMarkerLayout.createIntervalMarker(
+ minDate, labeller, this._unit, this._markerLayer, this._lineLayer);
+
+ incrementDate(minDate);
+ }
+ this._markerLayer.style.display = "block";
+ this._lineLayer.style.display = "block";
+};
+
+Timeline.GregorianEtherPainter.prototype.softPaint = function() {
+};
+
+Timeline.GregorianEtherPainter.prototype.zoom = function(netIntervalChange) {
+ if (netIntervalChange != 0) {
+ this._unit += netIntervalChange;
+ }
+};
+
+
+/*==================================================
+ * Hot Zone Gregorian Ether Painter
+ *==================================================
+ */
+
+Timeline.HotZoneGregorianEtherPainter = function(params) {
+ this._params = params;
+ this._theme = params.theme;
+
+ this._zones = [{
+ startTime: Number.NEGATIVE_INFINITY,
+ endTime: Number.POSITIVE_INFINITY,
+ unit: params.unit,
+ multiple: 1
+ }];
+ for (var i = 0; i < params.zones.length; i++) {
+ var zone = params.zones[i];
+ var zoneStart = SimileAjax.DateTime.parseGregorianDateTime(zone.start).getTime();
+ var zoneEnd = SimileAjax.DateTime.parseGregorianDateTime(zone.end).getTime();
+
+ for (var j = 0; j < this._zones.length && zoneEnd > zoneStart; j++) {
+ var zone2 = this._zones[j];
+
+ if (zoneStart < zone2.endTime) {
+ if (zoneStart > zone2.startTime) {
+ this._zones.splice(j, 0, {
+ startTime: zone2.startTime,
+ endTime: zoneStart,
+ unit: zone2.unit,
+ multiple: zone2.multiple
+ });
+ j++;
+
+ zone2.startTime = zoneStart;
+ }
+
+ if (zoneEnd < zone2.endTime) {
+ this._zones.splice(j, 0, {
+ startTime: zoneStart,
+ endTime: zoneEnd,
+ unit: zone.unit,
+ multiple: (zone.multiple) ? zone.multiple : 1
+ });
+ j++;
+
+ zone2.startTime = zoneEnd;
+ zoneStart = zoneEnd;
+ } else {
+ zone2.multiple = zone.multiple;
+ zone2.unit = zone.unit;
+ zoneStart = zone2.endTime;
+ }
+ } // else, try the next existing zone
+ }
+ }
+};
+
+Timeline.HotZoneGregorianEtherPainter.prototype.initialize = function(band, timeline) {
+ this._band = band;
+ this._timeline = timeline;
+
+ this._backgroundLayer = band.createLayerDiv(0);
+ this._backgroundLayer.setAttribute("name", "ether-background"); // for debugging
+ this._backgroundLayer.className ='timeline-ether-bg';
+ //this._backgroundLayer.style.background = this._theme.ether.backgroundColors[band.getIndex()];
+
+ this._markerLayer = null;
+ this._lineLayer = null;
+
+ var align = ("align" in this._params && this._params.align != undefined) ? this._params.align :
+ this._theme.ether.interval.marker[timeline.isHorizontal() ? "hAlign" : "vAlign"];
+ var showLine = ("showLine" in this._params) ? this._params.showLine :
+ this._theme.ether.interval.line.show;
+
+ this._intervalMarkerLayout = new Timeline.EtherIntervalMarkerLayout(
+ this._timeline, this._band, this._theme, align, showLine);
+
+ this._highlight = new Timeline.EtherHighlight(
+ this._timeline, this._band, this._theme, this._backgroundLayer);
+}
+
+Timeline.HotZoneGregorianEtherPainter.prototype.setHighlight = function(startDate, endDate) {
+ this._highlight.position(startDate, endDate);
+}
+
+Timeline.HotZoneGregorianEtherPainter.prototype.paint = function() {
+ if (this._markerLayer) {
+ this._band.removeLayerDiv(this._markerLayer);
+ }
+ this._markerLayer = this._band.createLayerDiv(100);
+ this._markerLayer.setAttribute("name", "ether-markers"); // for debugging
+ this._markerLayer.style.display = "none";
+
+ if (this._lineLayer) {
+ this._band.removeLayerDiv(this._lineLayer);
+ }
+ this._lineLayer = this._band.createLayerDiv(1);
+ this._lineLayer.setAttribute("name", "ether-lines"); // for debugging
+ this._lineLayer.style.display = "none";
+
+ var minDate = this._band.getMinDate();
+ var maxDate = this._band.getMaxDate();
+
+ var timeZone = this._band.getTimeZone();
+ var labeller = this._band.getLabeller();
+
+ var p = this;
+ var incrementDate = function(date, zone) {
+ for (var i = 0; i < zone.multiple; i++) {
+ SimileAjax.DateTime.incrementByInterval(date, zone.unit);
+ }
+ };
+
+ var zStart = 0;
+ while (zStart < this._zones.length) {
+ if (minDate.getTime() < this._zones[zStart].endTime) {
+ break;
+ }
+ zStart++;
+ }
+ var zEnd = this._zones.length - 1;
+ while (zEnd >= 0) {
+ if (maxDate.getTime() > this._zones[zEnd].startTime) {
+ break;
+ }
+ zEnd--;
+ }
+
+ for (var z = zStart; z <= zEnd; z++) {
+ var zone = this._zones[z];
+
+ var minDate2 = new Date(Math.max(minDate.getTime(), zone.startTime));
+ var maxDate2 = new Date(Math.min(maxDate.getTime(), zone.endTime));
+
+ SimileAjax.DateTime.roundDownToInterval(minDate2, zone.unit, timeZone, zone.multiple, this._theme.firstDayOfWeek);
+ SimileAjax.DateTime.roundUpToInterval(maxDate2, zone.unit, timeZone, zone.multiple, this._theme.firstDayOfWeek);
+
+ while (minDate2.getTime() < maxDate2.getTime()) {
+ this._intervalMarkerLayout.createIntervalMarker(
+ minDate2, labeller, zone.unit, this._markerLayer, this._lineLayer);
+
+ incrementDate(minDate2, zone);
+ }
+ }
+ this._markerLayer.style.display = "block";
+ this._lineLayer.style.display = "block";
+};
+
+Timeline.HotZoneGregorianEtherPainter.prototype.softPaint = function() {
+};
+
+Timeline.HotZoneGregorianEtherPainter.prototype.zoom = function(netIntervalChange) {
+ if (netIntervalChange != 0) {
+ for (var i = 0; i < this._zones.length; ++i) {
+ if (this._zones[i]) {
+ this._zones[i].unit += netIntervalChange;
+ }
+ }
+ }
+};
+
+/*==================================================
+ * Year Count Ether Painter
+ *==================================================
+ */
+
+Timeline.YearCountEtherPainter = function(params) {
+ this._params = params;
+ this._theme = params.theme;
+ this._startDate = SimileAjax.DateTime.parseGregorianDateTime(params.startDate);
+ this._multiple = ("multiple" in params) ? params.multiple : 1;
+};
+
+Timeline.YearCountEtherPainter.prototype.initialize = function(band, timeline) {
+ this._band = band;
+ this._timeline = timeline;
+
+ this._backgroundLayer = band.createLayerDiv(0);
+ this._backgroundLayer.setAttribute("name", "ether-background"); // for debugging
+ this._backgroundLayer.className = 'timeline-ether-bg';
+ // this._backgroundLayer.style.background = this._theme.ether.backgroundColors[band.getIndex()];
+
+ this._markerLayer = null;
+ this._lineLayer = null;
+
+ var align = ("align" in this._params) ? this._params.align :
+ this._theme.ether.interval.marker[timeline.isHorizontal() ? "hAlign" : "vAlign"];
+ var showLine = ("showLine" in this._params) ? this._params.showLine :
+ this._theme.ether.interval.line.show;
+
+ this._intervalMarkerLayout = new Timeline.EtherIntervalMarkerLayout(
+ this._timeline, this._band, this._theme, align, showLine);
+
+ this._highlight = new Timeline.EtherHighlight(
+ this._timeline, this._band, this._theme, this._backgroundLayer);
+};
+
+Timeline.YearCountEtherPainter.prototype.setHighlight = function(startDate, endDate) {
+ this._highlight.position(startDate, endDate);
+};
+
+Timeline.YearCountEtherPainter.prototype.paint = function() {
+ if (this._markerLayer) {
+ this._band.removeLayerDiv(this._markerLayer);
+ }
+ this._markerLayer = this._band.createLayerDiv(100);
+ this._markerLayer.setAttribute("name", "ether-markers"); // for debugging
+ this._markerLayer.style.display = "none";
+
+ if (this._lineLayer) {
+ this._band.removeLayerDiv(this._lineLayer);
+ }
+ this._lineLayer = this._band.createLayerDiv(1);
+ this._lineLayer.setAttribute("name", "ether-lines"); // for debugging
+ this._lineLayer.style.display = "none";
+
+ var minDate = new Date(this._startDate.getTime());
+ var maxDate = this._band.getMaxDate();
+ var yearDiff = this._band.getMinDate().getUTCFullYear() - this._startDate.getUTCFullYear();
+ minDate.setUTCFullYear(this._band.getMinDate().getUTCFullYear() - yearDiff % this._multiple);
+
+ var p = this;
+ var incrementDate = function(date) {
+ for (var i = 0; i < p._multiple; i++) {
+ SimileAjax.DateTime.incrementByInterval(date, SimileAjax.DateTime.YEAR);
+ }
+ };
+ var labeller = {
+ labelInterval: function(date, intervalUnit) {
+ var diff = date.getUTCFullYear() - p._startDate.getUTCFullYear();
+ return {
+ text: diff,
+ emphasized: diff == 0
+ };
+ }
+ };
+
+ while (minDate.getTime() < maxDate.getTime()) {
+ this._intervalMarkerLayout.createIntervalMarker(
+ minDate, labeller, SimileAjax.DateTime.YEAR, this._markerLayer, this._lineLayer);
+
+ incrementDate(minDate);
+ }
+ this._markerLayer.style.display = "block";
+ this._lineLayer.style.display = "block";
+};
+
+Timeline.YearCountEtherPainter.prototype.softPaint = function() {
+};
+
+/*==================================================
+ * Quarterly Ether Painter
+ *==================================================
+ */
+
+Timeline.QuarterlyEtherPainter = function(params) {
+ this._params = params;
+ this._theme = params.theme;
+ this._startDate = SimileAjax.DateTime.parseGregorianDateTime(params.startDate);
+};
+
+Timeline.QuarterlyEtherPainter.prototype.initialize = function(band, timeline) {
+ this._band = band;
+ this._timeline = timeline;
+
+ this._backgroundLayer = band.createLayerDiv(0);
+ this._backgroundLayer.setAttribute("name", "ether-background"); // for debugging
+ this._backgroundLayer.className = 'timeline-ether-bg';
+ // this._backgroundLayer.style.background = this._theme.ether.backgroundColors[band.getIndex()];
+
+ this._markerLayer = null;
+ this._lineLayer = null;
+
+ var align = ("align" in this._params) ? this._params.align :
+ this._theme.ether.interval.marker[timeline.isHorizontal() ? "hAlign" : "vAlign"];
+ var showLine = ("showLine" in this._params) ? this._params.showLine :
+ this._theme.ether.interval.line.show;
+
+ this._intervalMarkerLayout = new Timeline.EtherIntervalMarkerLayout(
+ this._timeline, this._band, this._theme, align, showLine);
+
+ this._highlight = new Timeline.EtherHighlight(
+ this._timeline, this._band, this._theme, this._backgroundLayer);
+};
+
+Timeline.QuarterlyEtherPainter.prototype.setHighlight = function(startDate, endDate) {
+ this._highlight.position(startDate, endDate);
+};
+
+Timeline.QuarterlyEtherPainter.prototype.paint = function() {
+ if (this._markerLayer) {
+ this._band.removeLayerDiv(this._markerLayer);
+ }
+ this._markerLayer = this._band.createLayerDiv(100);
+ this._markerLayer.setAttribute("name", "ether-markers"); // for debugging
+ this._markerLayer.style.display = "none";
+
+ if (this._lineLayer) {
+ this._band.removeLayerDiv(this._lineLayer);
+ }
+ this._lineLayer = this._band.createLayerDiv(1);
+ this._lineLayer.setAttribute("name", "ether-lines"); // for debugging
+ this._lineLayer.style.display = "none";
+
+ var minDate = new Date(0);
+ var maxDate = this._band.getMaxDate();
+
+ minDate.setUTCFullYear(Math.max(this._startDate.getUTCFullYear(), this._band.getMinDate().getUTCFullYear()));
+ minDate.setUTCMonth(this._startDate.getUTCMonth());
+
+ var p = this;
+ var incrementDate = function(date) {
+ date.setUTCMonth(date.getUTCMonth() + 3);
+ };
+ var labeller = {
+ labelInterval: function(date, intervalUnit) {
+ var quarters = (4 + (date.getUTCMonth() - p._startDate.getUTCMonth()) / 3) % 4;
+ if (quarters != 0) {
+ return { text: "Q" + (quarters + 1), emphasized: false };
+ } else {
+ return { text: "Y" + (date.getUTCFullYear() - p._startDate.getUTCFullYear() + 1), emphasized: true };
+ }
+ }
+ };
+
+ while (minDate.getTime() < maxDate.getTime()) {
+ this._intervalMarkerLayout.createIntervalMarker(
+ minDate, labeller, SimileAjax.DateTime.YEAR, this._markerLayer, this._lineLayer);
+
+ incrementDate(minDate);
+ }
+ this._markerLayer.style.display = "block";
+ this._lineLayer.style.display = "block";
+};
+
+Timeline.QuarterlyEtherPainter.prototype.softPaint = function() {
+};
+
+/*==================================================
+ * Ether Interval Marker Layout
+ *==================================================
+ */
+
+Timeline.EtherIntervalMarkerLayout = function(timeline, band, theme, align, showLine) {
+ var horizontal = timeline.isHorizontal();
+ if (horizontal) {
+ if (align == "Top") {
+ this.positionDiv = function(div, offset) {
+ div.style.left = offset + "px";
+ div.style.top = "0px";
+ };
+ } else {
+ this.positionDiv = function(div, offset) {
+ div.style.left = offset + "px";
+ div.style.bottom = "0px";
+ };
+ }
+ } else {
+ if (align == "Left") {
+ this.positionDiv = function(div, offset) {
+ div.style.top = offset + "px";
+ div.style.left = "0px";
+ };
+ } else {
+ this.positionDiv = function(div, offset) {
+ div.style.top = offset + "px";
+ div.style.right = "0px";
+ };
+ }
+ }
+
+ var markerTheme = theme.ether.interval.marker;
+ var lineTheme = theme.ether.interval.line;
+ var weekendTheme = theme.ether.interval.weekend;
+
+ var stylePrefix = (horizontal ? "h" : "v") + align;
+ var labelStyler = markerTheme[stylePrefix + "Styler"];
+ var emphasizedLabelStyler = markerTheme[stylePrefix + "EmphasizedStyler"];
+ var day = SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.DAY];
+
+ this.createIntervalMarker = function(date, labeller, unit, markerDiv, lineDiv) {
+ var offset = Math.round(band.dateToPixelOffset(date));
+
+ if (showLine && unit != SimileAjax.DateTime.WEEK) {
+ var divLine = timeline.getDocument().createElement("div");
+ divLine.className = "timeline-ether-lines";
+
+ if (lineTheme.opacity < 100) {
+ SimileAjax.Graphics.setOpacity(divLine, lineTheme.opacity);
+ }
+
+ if (horizontal) {
+ //divLine.className += " timeline-ether-lines-vertical";
+ divLine.style.left = offset + "px";
+ } else {
+ //divLine.className += " timeline-ether-lines-horizontal";
+ divLine.style.top = offset + "px";
+ }
+ lineDiv.appendChild(divLine);
+ }
+ if (unit == SimileAjax.DateTime.WEEK) {
+ var firstDayOfWeek = theme.firstDayOfWeek;
+
+ var saturday = new Date(date.getTime() + (6 - firstDayOfWeek - 7) * day);
+ var monday = new Date(saturday.getTime() + 2 * day);
+
+ var saturdayPixel = Math.round(band.dateToPixelOffset(saturday));
+ var mondayPixel = Math.round(band.dateToPixelOffset(monday));
+ var length = Math.max(1, mondayPixel - saturdayPixel);
+
+ var divWeekend = timeline.getDocument().createElement("div");
+ divWeekend.className = 'timeline-ether-weekends'
+
+ if (weekendTheme.opacity < 100) {
+ SimileAjax.Graphics.setOpacity(divWeekend, weekendTheme.opacity);
+ }
+
+ if (horizontal) {
+ divWeekend.style.left = saturdayPixel + "px";
+ divWeekend.style.width = length + "px";
+ } else {
+ divWeekend.style.top = saturdayPixel + "px";
+ divWeekend.style.height = length + "px";
+ }
+ lineDiv.appendChild(divWeekend);
+ }
+
+ var label = labeller.labelInterval(date, unit);
+
+ var div = timeline.getDocument().createElement("div");
+ div.innerHTML = label.text;
+
+
+
+ div.className = 'timeline-date-label'
+ if(label.emphasized) div.className += ' timeline-date-label-em'
+
+ this.positionDiv(div, offset);
+ markerDiv.appendChild(div);
+
+ return div;
+ };
+};
+
+/*==================================================
+ * Ether Highlight Layout
+ *==================================================
+ */
+
+Timeline.EtherHighlight = function(timeline, band, theme, backgroundLayer) {
+ var horizontal = timeline.isHorizontal();
+
+ this._highlightDiv = null;
+ this._createHighlightDiv = function() {
+ if (this._highlightDiv == null) {
+ this._highlightDiv = timeline.getDocument().createElement("div");
+ this._highlightDiv.setAttribute("name", "ether-highlight"); // for debugging
+ this._highlightDiv.className = 'timeline-ether-highlight'
+
+ var opacity = theme.ether.highlightOpacity;
+ if (opacity < 100) {
+ SimileAjax.Graphics.setOpacity(this._highlightDiv, opacity);
+ }
+
+ backgroundLayer.appendChild(this._highlightDiv);
+ }
+ }
+
+ this.position = function(startDate, endDate) {
+ this._createHighlightDiv();
+
+ var startPixel = Math.round(band.dateToPixelOffset(startDate));
+ var endPixel = Math.round(band.dateToPixelOffset(endDate));
+ var length = Math.max(endPixel - startPixel, 3);
+ if (horizontal) {
+ this._highlightDiv.style.left = startPixel + "px";
+ this._highlightDiv.style.width = length + "px";
+ this._highlightDiv.style.height = (band.getViewWidth() - 4) + "px";
+ } else {
+ this._highlightDiv.style.top = startPixel + "px";
+ this._highlightDiv.style.height = length + "px";
+ this._highlightDiv.style.width = (band.getViewWidth() - 4) + "px";
+ }
+ }
+};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/ethers.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/ethers.js
new file mode 100644
index 0000000..eda23e9
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/ethers.js
@@ -0,0 +1,300 @@
+/*==================================================
+ * Linear Ether
+ *==================================================
+ */
+
+Timeline.LinearEther = function(params) {
+ this._params = params;
+ this._interval = params.interval;
+ this._pixelsPerInterval = params.pixelsPerInterval;
+};
+
+Timeline.LinearEther.prototype.initialize = function(band, timeline) {
+ this._band = band;
+ this._timeline = timeline;
+ this._unit = timeline.getUnit();
+
+ if ("startsOn" in this._params) {
+ this._start = this._unit.parseFromObject(this._params.startsOn);
+ } else if ("endsOn" in this._params) {
+ this._start = this._unit.parseFromObject(this._params.endsOn);
+ this.shiftPixels(-this._timeline.getPixelLength());
+ } else if ("centersOn" in this._params) {
+ this._start = this._unit.parseFromObject(this._params.centersOn);
+ this.shiftPixels(-this._timeline.getPixelLength() / 2);
+ } else {
+ this._start = this._unit.makeDefaultValue();
+ this.shiftPixels(-this._timeline.getPixelLength() / 2);
+ }
+};
+
+Timeline.LinearEther.prototype.setDate = function(date) {
+ this._start = this._unit.cloneValue(date);
+};
+
+Timeline.LinearEther.prototype.shiftPixels = function(pixels) {
+ var numeric = this._interval * pixels / this._pixelsPerInterval;
+ this._start = this._unit.change(this._start, numeric);
+};
+
+Timeline.LinearEther.prototype.dateToPixelOffset = function(date) {
+ var numeric = this._unit.compare(date, this._start);
+ return this._pixelsPerInterval * numeric / this._interval;
+};
+
+Timeline.LinearEther.prototype.pixelOffsetToDate = function(pixels) {
+ var numeric = pixels * this._interval / this._pixelsPerInterval;
+ return this._unit.change(this._start, numeric);
+};
+
+Timeline.LinearEther.prototype.zoom = function(zoomIn) {
+ var netIntervalChange = 0;
+ var currentZoomIndex = this._band._zoomIndex;
+ var newZoomIndex = currentZoomIndex;
+
+ if (zoomIn && (currentZoomIndex > 0)) {
+ newZoomIndex = currentZoomIndex - 1;
+ }
+
+ if (!zoomIn && (currentZoomIndex < (this._band._zoomSteps.length - 1))) {
+ newZoomIndex = currentZoomIndex + 1;
+ }
+
+ this._band._zoomIndex = newZoomIndex;
+ this._interval =
+ SimileAjax.DateTime.gregorianUnitLengths[this._band._zoomSteps[newZoomIndex].unit];
+ this._pixelsPerInterval = this._band._zoomSteps[newZoomIndex].pixelsPerInterval;
+ netIntervalChange = this._band._zoomSteps[newZoomIndex].unit -
+ this._band._zoomSteps[currentZoomIndex].unit;
+
+ return netIntervalChange;
+};
+
+
+/*==================================================
+ * Hot Zone Ether
+ *==================================================
+ */
+
+Timeline.HotZoneEther = function(params) {
+ this._params = params;
+ this._interval = params.interval;
+ this._pixelsPerInterval = params.pixelsPerInterval;
+ this._theme = params.theme;
+};
+
+Timeline.HotZoneEther.prototype.initialize = function(band, timeline) {
+ this._band = band;
+ this._timeline = timeline;
+ this._unit = timeline.getUnit();
+
+ this._zones = [{
+ startTime: Number.NEGATIVE_INFINITY,
+ endTime: Number.POSITIVE_INFINITY,
+ magnify: 1
+ }];
+ var params = this._params;
+ for (var i = 0; i < params.zones.length; i++) {
+ var zone = params.zones[i];
+ var zoneStart = this._unit.parseFromObject(zone.start);
+ var zoneEnd = this._unit.parseFromObject(zone.end);
+
+ for (var j = 0; j < this._zones.length && this._unit.compare(zoneEnd, zoneStart) > 0; j++) {
+ var zone2 = this._zones[j];
+
+ if (this._unit.compare(zoneStart, zone2.endTime) < 0) {
+ if (this._unit.compare(zoneStart, zone2.startTime) > 0) {
+ this._zones.splice(j, 0, {
+ startTime: zone2.startTime,
+ endTime: zoneStart,
+ magnify: zone2.magnify
+ });
+ j++;
+
+ zone2.startTime = zoneStart;
+ }
+
+ if (this._unit.compare(zoneEnd, zone2.endTime) < 0) {
+ this._zones.splice(j, 0, {
+ startTime: zoneStart,
+ endTime: zoneEnd,
+ magnify: zone.magnify * zone2.magnify
+ });
+ j++;
+
+ zone2.startTime = zoneEnd;
+ zoneStart = zoneEnd;
+ } else {
+ zone2.magnify *= zone.magnify;
+ zoneStart = zone2.endTime;
+ }
+ } // else, try the next existing zone
+ }
+ }
+
+ if ("startsOn" in this._params) {
+ this._start = this._unit.parseFromObject(this._params.startsOn);
+ } else if ("endsOn" in this._params) {
+ this._start = this._unit.parseFromObject(this._params.endsOn);
+ this.shiftPixels(-this._timeline.getPixelLength());
+ } else if ("centersOn" in this._params) {
+ this._start = this._unit.parseFromObject(this._params.centersOn);
+ this.shiftPixels(-this._timeline.getPixelLength() / 2);
+ } else {
+ this._start = this._unit.makeDefaultValue();
+ this.shiftPixels(-this._timeline.getPixelLength() / 2);
+ }
+};
+
+Timeline.HotZoneEther.prototype.setDate = function(date) {
+ this._start = this._unit.cloneValue(date);
+};
+
+Timeline.HotZoneEther.prototype.shiftPixels = function(pixels) {
+ this._start = this.pixelOffsetToDate(pixels);
+};
+
+Timeline.HotZoneEther.prototype.dateToPixelOffset = function(date) {
+ return this._dateDiffToPixelOffset(this._start, date);
+};
+
+Timeline.HotZoneEther.prototype.pixelOffsetToDate = function(pixels) {
+ return this._pixelOffsetToDate(pixels, this._start);
+};
+
+Timeline.HotZoneEther.prototype.zoom = function(zoomIn) {
+ var netIntervalChange = 0;
+ var currentZoomIndex = this._band._zoomIndex;
+ var newZoomIndex = currentZoomIndex;
+
+ if (zoomIn && (currentZoomIndex > 0)) {
+ newZoomIndex = currentZoomIndex - 1;
+ }
+
+ if (!zoomIn && (currentZoomIndex < (this._band._zoomSteps.length - 1))) {
+ newZoomIndex = currentZoomIndex + 1;
+ }
+
+ this._band._zoomIndex = newZoomIndex;
+ this._interval =
+ SimileAjax.DateTime.gregorianUnitLengths[this._band._zoomSteps[newZoomIndex].unit];
+ this._pixelsPerInterval = this._band._zoomSteps[newZoomIndex].pixelsPerInterval;
+ netIntervalChange = this._band._zoomSteps[newZoomIndex].unit -
+ this._band._zoomSteps[currentZoomIndex].unit;
+
+ return netIntervalChange;
+};
+
+Timeline.HotZoneEther.prototype._dateDiffToPixelOffset = function(fromDate, toDate) {
+ var scale = this._getScale();
+ var fromTime = fromDate;
+ var toTime = toDate;
+
+ var pixels = 0;
+ if (this._unit.compare(fromTime, toTime) < 0) {
+ var z = 0;
+ while (z < this._zones.length) {
+ if (this._unit.compare(fromTime, this._zones[z].endTime) < 0) {
+ break;
+ }
+ z++;
+ }
+
+ while (this._unit.compare(fromTime, toTime) < 0) {
+ var zone = this._zones[z];
+ var toTime2 = this._unit.earlier(toTime, zone.endTime);
+
+ pixels += (this._unit.compare(toTime2, fromTime) / (scale / zone.magnify));
+
+ fromTime = toTime2;
+ z++;
+ }
+ } else {
+ var z = this._zones.length - 1;
+ while (z >= 0) {
+ if (this._unit.compare(fromTime, this._zones[z].startTime) > 0) {
+ break;
+ }
+ z--;
+ }
+
+ while (this._unit.compare(fromTime, toTime) > 0) {
+ var zone = this._zones[z];
+ var toTime2 = this._unit.later(toTime, zone.startTime);
+
+ pixels += (this._unit.compare(toTime2, fromTime) / (scale / zone.magnify));
+
+ fromTime = toTime2;
+ z--;
+ }
+ }
+ return pixels;
+};
+
+Timeline.HotZoneEther.prototype._pixelOffsetToDate = function(pixels, fromDate) {
+ var scale = this._getScale();
+ var time = fromDate;
+ if (pixels > 0) {
+ var z = 0;
+ while (z < this._zones.length) {
+ if (this._unit.compare(time, this._zones[z].endTime) < 0) {
+ break;
+ }
+ z++;
+ }
+
+ while (pixels > 0) {
+ var zone = this._zones[z];
+ var scale2 = scale / zone.magnify;
+
+ if (zone.endTime == Number.POSITIVE_INFINITY) {
+ time = this._unit.change(time, pixels * scale2);
+ pixels = 0;
+ } else {
+ var pixels2 = this._unit.compare(zone.endTime, time) / scale2;
+ if (pixels2 > pixels) {
+ time = this._unit.change(time, pixels * scale2);
+ pixels = 0;
+ } else {
+ time = zone.endTime;
+ pixels -= pixels2;
+ }
+ }
+ z++;
+ }
+ } else {
+ var z = this._zones.length - 1;
+ while (z >= 0) {
+ if (this._unit.compare(time, this._zones[z].startTime) > 0) {
+ break;
+ }
+ z--;
+ }
+
+ pixels = -pixels;
+ while (pixels > 0) {
+ var zone = this._zones[z];
+ var scale2 = scale / zone.magnify;
+
+ if (zone.startTime == Number.NEGATIVE_INFINITY) {
+ time = this._unit.change(time, -pixels * scale2);
+ pixels = 0;
+ } else {
+ var pixels2 = this._unit.compare(time, zone.startTime) / scale2;
+ if (pixels2 > pixels) {
+ time = this._unit.change(time, -pixels * scale2);
+ pixels = 0;
+ } else {
+ time = zone.startTime;
+ pixels -= pixels2;
+ }
+ }
+ z--;
+ }
+ }
+ return time;
+};
+
+Timeline.HotZoneEther.prototype._getScale = function() {
+ return this._interval / this._pixelsPerInterval;
+};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/ext/japanese-eras.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/ext/japanese-eras.js
new file mode 100644
index 0000000..92027ac
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/ext/japanese-eras.js
@@ -0,0 +1,395 @@
+/*==================================================
+ * Japanese Era Date Labeller
+ *==================================================
+ */
+
+Timeline.JapaneseEraDateLabeller = function(locale, timeZone, useRomanizedName) {
+ var o = new Timeline.GregorianDateLabeller(locale, timeZone);
+
+ o._useRomanizedName = (useRomanizedName);
+ o._oldLabelInterval = o.labelInterval;
+ o.labelInterval = Timeline.JapaneseEraDateLabeller._labelInterval;
+
+ return o;
+};
+
+Timeline.JapaneseEraDateLabeller._labelInterval = function(date, intervalUnit) {
+ var text;
+ var emphasized = false;
+
+ var date2 = Timeline.DateTime.removeTimeZoneOffset(date, this._timeZone);
+
+ switch(intervalUnit) {
+ case Timeline.DateTime.YEAR:
+ case Timeline.DateTime.DECADE:
+ case Timeline.DateTime.CENTURY:
+ case Timeline.DateTime.MILLENNIUM:
+ var y = date2.getUTCFullYear();
+ if (y >= Timeline.JapaneseEraDateLabeller._eras.elementAt(0).startingYear) {
+ var eraIndex = Timeline.JapaneseEraDateLabeller._eras.find(function(era) {
+ return era.startingYear - y;
+ }
+ );
+ if (eraIndex < Timeline.JapaneseEraDateLabeller._eras.length()) {
+ var era = Timeline.JapaneseEraDateLabeller._eras.elementAt(eraIndex);
+ if (y < era.startingYear) {
+ era = Timeline.JapaneseEraDateLabeller._eras.elementAt(eraIndex - 1);
+ }
+ } else {
+ var era = Timeline.JapaneseEraDateLabeller._eras.elementAt(eraIndex - 1);
+ }
+
+ text = (this._useRomanizedName ? era.romanizedName : era.japaneseName) + " " + (y - era.startingYear + 1);
+ emphasized = intervalUnit == Timeline.DateTime.YEAR && y == era.startingYear;
+ break;
+ } // else, fall through
+ default:
+ return this._oldLabelInterval(date, intervalUnit);
+ }
+
+ return { text: text, emphasized: emphasized };
+};
+
+/*==================================================
+ * Japanese Era Ether Painter
+ *==================================================
+ */
+
+Timeline.JapaneseEraEtherPainter = function(params, band, timeline) {
+ this._params = params;
+ this._theme = params.theme;
+};
+
+Timeline.JapaneseEraEtherPainter.prototype.initialize = function(band, timeline) {
+ this._band = band;
+ this._timeline = timeline;
+
+ this._backgroundLayer = band.createLayerDiv(0);
+ this._backgroundLayer.setAttribute("name", "ether-background"); // for debugging
+ this._backgroundLayer.style.background = this._theme.ether.backgroundColors[band.getIndex()];
+
+ this._markerLayer = null;
+ this._lineLayer = null;
+
+ var align = ("align" in this._params) ? this._params.align :
+ this._theme.ether.interval.marker[timeline.isHorizontal() ? "hAlign" : "vAlign"];
+ var showLine = ("showLine" in this._params) ? this._params.showLine :
+ this._theme.ether.interval.line.show;
+
+ this._intervalMarkerLayout = new Timeline.EtherIntervalMarkerLayout(
+ this._timeline, this._band, this._theme, align, showLine);
+
+ this._highlight = new Timeline.EtherHighlight(
+ this._timeline, this._band, this._theme, this._backgroundLayer);
+}
+
+Timeline.JapaneseEraEtherPainter.prototype.setHighlight = function(startDate, endDate) {
+ this._highlight.position(startDate, endDate);
+}
+
+Timeline.JapaneseEraEtherPainter.prototype.paint = function() {
+ if (this._markerLayer) {
+ this._band.removeLayerDiv(this._markerLayer);
+ }
+ this._markerLayer = this._band.createLayerDiv(100);
+ this._markerLayer.setAttribute("name", "ether-markers"); // for debugging
+ this._markerLayer.style.display = "none";
+
+ if (this._lineLayer) {
+ this._band.removeLayerDiv(this._lineLayer);
+ }
+ this._lineLayer = this._band.createLayerDiv(1);
+ this._lineLayer.setAttribute("name", "ether-lines"); // for debugging
+ this._lineLayer.style.display = "none";
+
+ var minYear = this._band.getMinDate().getUTCFullYear();
+ var maxYear = this._band.getMaxDate().getUTCFullYear();
+ var eraIndex = Timeline.JapaneseEraDateLabeller._eras.find(function(era) {
+ return era.startingYear - minYear;
+ }
+ );
+
+ var l = Timeline.JapaneseEraDateLabeller._eras.length();
+ for (var i = eraIndex; i < l; i++) {
+ var era = Timeline.JapaneseEraDateLabeller._eras.elementAt(i);
+ if (era.startingYear > maxYear) {
+ break;
+ }
+
+ var d = new Date(0);
+ d.setUTCFullYear(era.startingYear);
+
+ var labeller = {
+ labelInterval: function(date, intervalUnit) {
+ return {
+ text: era.japaneseName,
+ emphasized: true
+ };
+ }
+ };
+
+ this._intervalMarkerLayout.createIntervalMarker(
+ d, labeller, Timeline.DateTime.YEAR, this._markerLayer, this._lineLayer);
+ }
+ this._markerLayer.style.display = "block";
+ this._lineLayer.style.display = "block";
+};
+
+Timeline.JapaneseEraEtherPainter.prototype.softPaint = function() {
+};
+
+
+Timeline.JapaneseEraDateLabeller._eras = new Timeline.SortedArray(
+ function(e1, e2) {
+ return e1.startingYear - e2.startingYear;
+ },
+ [
+ { startingYear: 645, japaneseName: '倧å', romanizedName: "Taika" },
+ { startingYear: 650, japaneseName: 'çœé', romanizedName: "Hakuchi" },
+ { startingYear: 686, japaneseName: 'æ±é³¥', romanizedName: "ShuchÅ" },
+ { startingYear: 701, japaneseName: '倧å®', romanizedName: "TaihÅ" },
+ { startingYear: 704, japaneseName: 'æ
¶é²', romanizedName: "Keiun" },
+ { startingYear: 708, japaneseName: 'åé
', romanizedName: "WadÅ" },
+ { startingYear: 715, japaneseName: 'éäº', romanizedName: "Reiki" },
+ { startingYear: 717, japaneseName: 'é€è', romanizedName: "YÅrÅ" },
+ { startingYear: 724, japaneseName: 'ç¥äº', romanizedName: "Jinki" },
+ { startingYear: 729, japaneseName: '倩平', romanizedName: "TenpyÅ" },
+ { startingYear: 749, japaneseName: '倩平æå®', romanizedName: "TenpyÅ-kanpÅ" },
+ { startingYear: 749, japaneseName: '倩平åå®', romanizedName: "TenpyÅ-shÅhÅ" },
+ { startingYear: 757, japaneseName: '倩平å®å', romanizedName: "TenpyÅ-hÅji" },
+ { startingYear: 765, japaneseName: '倩平ç¥è·', romanizedName: "TenpyÅ-jingo" },
+ { startingYear: 767, japaneseName: 'ç¥è·æ¯é²', romanizedName: "Jingo-keiun" },
+ { startingYear: 770, japaneseName: 'å®äº', romanizedName: "HÅki" },
+ { startingYear: 781, japaneseName: '倩å¿', romanizedName: "Ten'Å" },
+ { startingYear: 782, japaneseName: 'å»¶æŠ', romanizedName: "Enryaku" },
+ { startingYear: 806, japaneseName: '倧å', romanizedName: "DaidÅ" },
+ { startingYear: 810, japaneseName: 'åŒä»', romanizedName: "KÅnin" },
+ { startingYear: 824, japaneseName: '倩é·', romanizedName: "TenchÅ" },
+ { startingYear: 834, japaneseName: 'æ¿å', romanizedName: "JÅwa" },
+ { startingYear: 848, japaneseName: 'å祥', romanizedName: "KajÅ" },
+ { startingYear: 851, japaneseName: 'ä»å¯¿', romanizedName: "Ninju" },
+ { startingYear: 854, japaneseName: 'æè¡¡', romanizedName: "SaikÅ" },
+ { startingYear: 857, japaneseName: '倩å®', romanizedName: "Tennan" },
+ { startingYear: 859, japaneseName: 'è²èг', romanizedName: "JÅgan" },
+ { startingYear: 877, japaneseName: 'å
æ
¶', romanizedName: "GangyÅ" },
+ { startingYear: 885, japaneseName: 'ä»å', romanizedName: "Ninna" },
+ { startingYear: 889, japaneseName: 'å¯å¹³', romanizedName: "KanpyÅ" },
+ { startingYear: 898, japaneseName: 'ææ³°', romanizedName: "ShÅtai" },
+ { startingYear: 901, japaneseName: 'å»¶å', romanizedName: "Engi" },
+ { startingYear: 923, japaneseName: 'å»¶é·', romanizedName: "EnchÅ" },
+ { startingYear: 931, japaneseName: 'æ¿å¹³', romanizedName: "JÅhei" },
+ { startingYear: 938, japaneseName: '倩æ
¶', romanizedName: "TengyÅ" },
+ { startingYear: 947, japaneseName: '倩æŠ', romanizedName: "Tenryaku" },
+ { startingYear: 957, japaneseName: '倩埳', romanizedName: "Tentoku" },
+ { startingYear: 961, japaneseName: 'å¿å', romanizedName: "Åwa" },
+ { startingYear: 964, japaneseName: '康ä¿', romanizedName: "KÅhÅ" },
+ { startingYear: 968, japaneseName: 'å®å', romanizedName: "Anna" },
+ { startingYear: 970, japaneseName: '倩çŠ', romanizedName: "Tenroku" },
+ { startingYear: 973, japaneseName: '倩延', romanizedName: "Ten'en" },
+ { startingYear: 976, japaneseName: 'è²å
', romanizedName: "JÅgen" },
+ { startingYear: 978, japaneseName: '倩å
', romanizedName: "Tengen" },
+ { startingYear: 983, japaneseName: '氞芳', romanizedName: "Eikan" },
+ { startingYear: 985, japaneseName: 'å¯å', romanizedName: "Kanna" },
+ { startingYear: 987, japaneseName: 'æ°žå»¶', romanizedName: "Eien" },
+ { startingYear: 988, japaneseName: 'æ°žç¥', romanizedName: "Eiso" },
+ { startingYear: 990, japaneseName: 'æ£æŠ', romanizedName: "ShÅryaku" },
+ { startingYear: 995, japaneseName: 'é·åŸ³', romanizedName: "ChÅtoku" },
+ { startingYear: 999, japaneseName: 'é·ä¿', romanizedName: "ChÅhÅ" },
+ { startingYear: 1004, japaneseName: 'å¯åŒ', romanizedName: "KankÅ" },
+ { startingYear: 1012, japaneseName: 'é·å', romanizedName: "ChÅwa" },
+ { startingYear: 1017, japaneseName: 'å¯ä»', romanizedName: "Kannin" },
+ { startingYear: 1021, japaneseName: 'æ²»å®', romanizedName: "Jian" },
+ { startingYear: 1024, japaneseName: 'äžå¯¿', romanizedName: "Manju" },
+ { startingYear: 1028, japaneseName: 'é·å
', romanizedName: "ChÅgen" },
+ { startingYear: 1037, japaneseName: 'é·æŠ', romanizedName: "ChÅryaku" },
+ { startingYear: 1040, japaneseName: 'é·ä¹
', romanizedName: "ChÅkyÅ«" },
+ { startingYear: 1044, japaneseName: 'å¯åŸ³', romanizedName: "Kantoku" },
+ { startingYear: 1046, japaneseName: 'æ°žæ¿', romanizedName: "EishÅ" },
+ { startingYear: 1053, japaneseName: '倩å', romanizedName: "Tengi" },
+ { startingYear: 1058, japaneseName: '康平', romanizedName: "KÅhei" },
+ { startingYear: 1065, japaneseName: 'æ²»æŠ', romanizedName: "Jiryaku" },
+ { startingYear: 1069, japaneseName: 'å»¶ä¹
', romanizedName: "Enkyū" },
+ { startingYear: 1074, japaneseName: 'æ¿ä¿', romanizedName: "JÅhÅ" },
+ { startingYear: 1077, japaneseName: 'æ¿æŠ', romanizedName: "JÅryaku" },
+ { startingYear: 1081, japaneseName: 'æ°žä¿', romanizedName: "EihÅ" },
+ { startingYear: 1084, japaneseName: 'å¿åŸ³', romanizedName: "Åtoku" },
+ { startingYear: 1087, japaneseName: '坿²»', romanizedName: "Kanji" },
+ { startingYear: 1094, japaneseName: 'åä¿', romanizedName: "KahÅ" },
+ { startingYear: 1096, japaneseName: 'æ°žé·', romanizedName: "EichÅ" },
+ { startingYear: 1097, japaneseName: 'æ¿åŸ³', romanizedName: "JÅtoku" },
+ { startingYear: 1099, japaneseName: '康å', romanizedName: "KÅwa" },
+ { startingYear: 1104, japaneseName: 'é·æ²»', romanizedName: "ChÅji" },
+ { startingYear: 1106, japaneseName: 'åæ¿', romanizedName: "KajÅ" },
+ { startingYear: 1108, japaneseName: '倩ä»', romanizedName: "Tennin" },
+ { startingYear: 1110, japaneseName: '倩氞', romanizedName: "Ten'ei" },
+ { startingYear: 1113, japaneseName: 'æ°žä¹
', romanizedName: "Eikyū" },
+ { startingYear: 1118, japaneseName: 'å
æ°ž', romanizedName: "Gen'ei" },
+ { startingYear: 1120, japaneseName: 'ä¿å®', romanizedName: "HÅan" },
+ { startingYear: 1124, japaneseName: '倩治', romanizedName: "Tenji" },
+ { startingYear: 1126, japaneseName: '倧治', romanizedName: "Daiji" },
+ { startingYear: 1131, japaneseName: '倩æ¿', romanizedName: "TenshÅ" },
+ { startingYear: 1132, japaneseName: 'é·æ¿', romanizedName: "ChÅshÅ" },
+ { startingYear: 1135, japaneseName: 'ä¿å»¶', romanizedName: "HÅen" },
+ { startingYear: 1141, japaneseName: 'æ°žæ²»', romanizedName: "Eiji" },
+ { startingYear: 1142, japaneseName: '康治', romanizedName: "KÅji" },
+ { startingYear: 1144, japaneseName: '倩é€', romanizedName: "Ten'yÅ" },
+ { startingYear: 1145, japaneseName: 'ä¹
å®', romanizedName: "KyÅ«an" },
+ { startingYear: 1151, japaneseName: 'ä»å¹³', romanizedName: "Ninpei" },
+ { startingYear: 1154, japaneseName: 'ä¹
寿', romanizedName: "Kyūju" },
+ { startingYear: 1156, japaneseName: 'ä¿å
', romanizedName: "HÅgen" },
+ { startingYear: 1159, japaneseName: '平治', romanizedName: "Heiji" },
+ { startingYear: 1160, japaneseName: 'æ°žæŠ', romanizedName: "Eiryaku" },
+ { startingYear: 1161, japaneseName: 'å¿ä¿', romanizedName: "ÅhÅ" },
+ { startingYear: 1163, japaneseName: 'é·å¯', romanizedName: "ChÅkan" },
+ { startingYear: 1165, japaneseName: 'æ°žäž', romanizedName: "Eiman" },
+ { startingYear: 1166, japaneseName: 'ä»å®', romanizedName: "Ninnan" },
+ { startingYear: 1169, japaneseName: 'åå¿', romanizedName: "KaÅ" },
+ { startingYear: 1171, japaneseName: 'æ¿å®', romanizedName: "JÅan" },
+ { startingYear: 1175, japaneseName: 'å®å
', romanizedName: "Angen" },
+ { startingYear: 1177, japaneseName: 'æ²»æ¿', romanizedName: "JishÅ" },
+ { startingYear: 1181, japaneseName: 'é€å', romanizedName: "YÅwa" },
+ { startingYear: 1182, japaneseName: '寿氞', romanizedName: "Juei" },
+ { startingYear: 1184, japaneseName: 'å
æŠ', romanizedName: "Genryaku" },
+ { startingYear: 1185, japaneseName: 'ææ²»', romanizedName: "Bunji" },
+ { startingYear: 1190, japaneseName: '建ä¹
', romanizedName: "Kenkyū" },
+ { startingYear: 1199, japaneseName: 'æ£æ²»', romanizedName: "ShÅji" },
+ { startingYear: 1201, japaneseName: '建ä»', romanizedName: "Kennin" },
+ { startingYear: 1204, japaneseName: 'å
ä¹
', romanizedName: "Genkyū" },
+ { startingYear: 1206, japaneseName: '建氞', romanizedName: "Ken'ei" },
+ { startingYear: 1207, japaneseName: 'æ¿å
', romanizedName: "JÅgen" },
+ { startingYear: 1211, japaneseName: '建æŠ', romanizedName: "Kenryaku" },
+ { startingYear: 1213, japaneseName: '建ä¿', romanizedName: "KenpÅ" },
+ { startingYear: 1219, japaneseName: 'æ¿ä¹
', romanizedName: "JÅkyÅ«" },
+ { startingYear: 1222, japaneseName: 'è²å¿', romanizedName: "JÅÅ" },
+ { startingYear: 1224, japaneseName: 'å
ä»', romanizedName: "Gennin" },
+ { startingYear: 1225, japaneseName: 'åçŠ', romanizedName: "Karoku" },
+ { startingYear: 1227, japaneseName: 'å®è²', romanizedName: "Antei" },
+ { startingYear: 1229, japaneseName: 'å¯å', romanizedName: "Kanki" },
+ { startingYear: 1232, japaneseName: 'è²æ°ž', romanizedName: "JÅei" },
+ { startingYear: 1233, japaneseName: '倩çŠ', romanizedName: "Tenpuku" },
+ { startingYear: 1234, japaneseName: 'ææŠ', romanizedName: "Bunryaku" },
+ { startingYear: 1235, japaneseName: 'åçŠ', romanizedName: "Katei" },
+ { startingYear: 1238, japaneseName: 'æŠä»', romanizedName: "Ryakunin" },
+ { startingYear: 1239, japaneseName: 'å»¶å¿', romanizedName: "En'Å" },
+ { startingYear: 1240, japaneseName: '仿²»', romanizedName: "Ninji" },
+ { startingYear: 1243, japaneseName: 'å¯å
', romanizedName: "Kangen" },
+ { startingYear: 1247, japaneseName: '宿²»', romanizedName: "HÅji" },
+ { startingYear: 1249, japaneseName: '建é·', romanizedName: "KenchÅ" },
+ { startingYear: 1256, japaneseName: '康å
', romanizedName: "KÅgen" },
+ { startingYear: 1257, japaneseName: 'æ£å', romanizedName: "ShÅka" },
+ { startingYear: 1259, japaneseName: 'æ£å
', romanizedName: "ShÅgen" },
+ { startingYear: 1260, japaneseName: 'æå¿', romanizedName: "Bun'Å" },
+ { startingYear: 1261, japaneseName: 'åŒé·', romanizedName: "KÅcho" },
+ { startingYear: 1264, japaneseName: 'ææ°ž', romanizedName: "Bun'ei" },
+ { startingYear: 1275, japaneseName: '建治', romanizedName: "Kenji" },
+ { startingYear: 1278, japaneseName: 'åŒå®', romanizedName: "KÅan" },
+ { startingYear: 1288, japaneseName: 'æ£å¿', romanizedName: "ShÅÅ" },
+ { startingYear: 1293, japaneseName: 'æ°žä»', romanizedName: "Einin" },
+ { startingYear: 1299, japaneseName: 'æ£å®', romanizedName: "ShÅan" },
+ { startingYear: 1302, japaneseName: '也å
', romanizedName: "Kengen" },
+ { startingYear: 1303, japaneseName: 'åå
', romanizedName: "Kagen" },
+ { startingYear: 1306, japaneseName: '埳治', romanizedName: "Tokuji" },
+ { startingYear: 1308, japaneseName: 'å»¶æ
¶', romanizedName: "Enkei" },
+ { startingYear: 1311, japaneseName: 'å¿é·', romanizedName: "ÅchÅ" },
+ { startingYear: 1312, japaneseName: 'æ£å', romanizedName: "ShÅwa" },
+ { startingYear: 1317, japaneseName: 'æä¿', romanizedName: "BunpÅ" },
+ { startingYear: 1319, japaneseName: 'å
å¿', romanizedName: "Gen'Å" },
+ { startingYear: 1321, japaneseName: 'å
亚', romanizedName: "GenkyÅ" },
+ { startingYear: 1324, japaneseName: 'æ£äž', romanizedName: "ShÅchÅ«" },
+ { startingYear: 1326, japaneseName: 'åæŠ', romanizedName: "Karyaku" },
+ { startingYear: 1329, japaneseName: 'å
埳', romanizedName: "Gentoku" },
+ { startingYear: 1331, japaneseName: 'å
åŒ', romanizedName: "GenkÅ" },
+ { startingYear: 1334, japaneseName: '建æŠ', romanizedName: "Kenmu" },
+ { startingYear: 1336, japaneseName: 'å»¶å
', romanizedName: "Engen" },
+ { startingYear: 1340, japaneseName: 'èåœ', romanizedName: "KÅkoku" },
+ { startingYear: 1346, japaneseName: 'æ£å¹³', romanizedName: "ShÅhei" },
+ { startingYear: 1370, japaneseName: '建埳', romanizedName: "Kentoku" },
+ { startingYear: 1372, japaneseName: 'æäž', romanizedName: "BunchÅ«" },
+ { startingYear: 1375, japaneseName: '倩æ', romanizedName: "Tenju" },
+ { startingYear: 1381, japaneseName: 'åŒå', romanizedName: "KÅwa" },
+ { startingYear: 1384, japaneseName: 'å
äž', romanizedName: "GenchÅ«" },
+ { startingYear: 1332, japaneseName: 'æ£æ
¶', romanizedName: "ShÅkei" },
+ { startingYear: 1338, japaneseName: 'æŠå¿', romanizedName: "RyakuÅ" },
+ { startingYear: 1342, japaneseName: '康氞', romanizedName: "KÅei" },
+ { startingYear: 1345, japaneseName: 'è²å', romanizedName: "JÅwa" },
+ { startingYear: 1350, japaneseName: '芳å¿', romanizedName: "Kan'Å" },
+ { startingYear: 1352, japaneseName: 'æå', romanizedName: "Bunna" },
+ { startingYear: 1356, japaneseName: 'å»¶æ', romanizedName: "Enbun" },
+ { startingYear: 1361, japaneseName: '康å®', romanizedName: "KÅan" },
+ { startingYear: 1362, japaneseName: 'è²æ²»', romanizedName: "JÅji" },
+ { startingYear: 1368, japaneseName: 'å¿å®', romanizedName: "Åan" },
+ { startingYear: 1375, japaneseName: 'æ°žå', romanizedName: "Eiwa" },
+ { startingYear: 1379, japaneseName: '康æŠ', romanizedName: "KÅryaku" },
+ { startingYear: 1381, japaneseName: '氞埳', romanizedName: "Eitoku" },
+ { startingYear: 1384, japaneseName: 'è³åŸ³', romanizedName: "Shitoku" },
+ { startingYear: 1387, japaneseName: 'åæ
¶', romanizedName: "Kakei" },
+ { startingYear: 1389, japaneseName: '康å¿', romanizedName: "KÅÅ" },
+ { startingYear: 1390, japaneseName: 'æåŸ³', romanizedName: "Meitoku" },
+ { startingYear: 1394, japaneseName: 'å¿æ°ž', romanizedName: "Åei" },
+ { startingYear: 1428, japaneseName: 'æ£é·', romanizedName: "ShÅchÅ" },
+ { startingYear: 1429, japaneseName: '氞享', romanizedName: "EikyÅ" },
+ { startingYear: 1441, japaneseName: 'åå', romanizedName: "Kakitsu" },
+ { startingYear: 1444, japaneseName: 'æå®', romanizedName: "Bunnan" },
+ { startingYear: 1449, japaneseName: 'å®åŸ³', romanizedName: "HÅtoku" },
+ { startingYear: 1452, japaneseName: '享埳', romanizedName: "KyÅtoku" },
+ { startingYear: 1455, japaneseName: '康æ£', romanizedName: "KÅshÅ" },
+ { startingYear: 1457, japaneseName: 'é·çŠ', romanizedName: "ChÅroku" },
+ { startingYear: 1460, japaneseName: '坿£', romanizedName: "KanshÅ" },
+ { startingYear: 1466, japaneseName: 'ææ£', romanizedName: "BunshÅ" },
+ { startingYear: 1467, japaneseName: 'å¿ä»', romanizedName: "Ånin" },
+ { startingYear: 1469, japaneseName: 'ææ', romanizedName: "Bunmei" },
+ { startingYear: 1487, japaneseName: 'é·äº«', romanizedName: "ChÅkyÅ" },
+ { startingYear: 1489, japaneseName: '延埳', romanizedName: "Entoku" },
+ { startingYear: 1492, japaneseName: 'æå¿', romanizedName: "MeiÅ" },
+ { startingYear: 1501, japaneseName: 'æäº', romanizedName: "Bunki" },
+ { startingYear: 1504, japaneseName: 'æ°žæ£', romanizedName: "EishÅ" },
+ { startingYear: 1521, japaneseName: '倧氞', romanizedName: "Daiei" },
+ { startingYear: 1528, japaneseName: '享çŠ', romanizedName: "KyÅroku" },
+ { startingYear: 1532, japaneseName: '倩æ', romanizedName: "Tenbun" },
+ { startingYear: 1555, japaneseName: 'åŒæ²»', romanizedName: "KÅji" },
+ { startingYear: 1558, japaneseName: 'æ°žçŠ', romanizedName: "Eiroku" },
+ { startingYear: 1570, japaneseName: 'å
äº', romanizedName: "Genki" },
+ { startingYear: 1573, japaneseName: '倩æ£', romanizedName: "TenshÅ" },
+ { startingYear: 1592, japaneseName: 'æçŠ', romanizedName: "Bunroku" },
+ { startingYear: 1596, japaneseName: 'æ
¶é·', romanizedName: "KeichÅ" },
+ { startingYear: 1615, japaneseName: 'å
å', romanizedName: "Genna" },
+ { startingYear: 1624, japaneseName: '坿°ž', romanizedName: "Kan'ei" },
+ { startingYear: 1644, japaneseName: 'æ£ä¿', romanizedName: "ShÅhÅ" },
+ { startingYear: 1648, japaneseName: 'æ
¶å®', romanizedName: "Keian" },
+ { startingYear: 1652, japaneseName: 'æ¿å¿', romanizedName: "JÅÅ" },
+ { startingYear: 1655, japaneseName: 'ææŠ', romanizedName: "Meireki" },
+ { startingYear: 1658, japaneseName: 'äžæ²»', romanizedName: "Manji" },
+ { startingYear: 1661, japaneseName: '坿', romanizedName: "Kanbun" },
+ { startingYear: 1673, japaneseName: 'å»¶å®', romanizedName: "EnpÅ" },
+ { startingYear: 1681, japaneseName: '倩å', romanizedName: "Tenna" },
+ { startingYear: 1684, japaneseName: 'è²äº«', romanizedName: "JÅkyÅ" },
+ { startingYear: 1688, japaneseName: 'å
çŠ', romanizedName: "Genroku" },
+ { startingYear: 1704, japaneseName: '宿°ž', romanizedName: "HÅei" },
+ { startingYear: 1711, japaneseName: 'æ£åŸ³', romanizedName: "ShÅtoku" },
+ { startingYear: 1716, japaneseName: '享ä¿', romanizedName: "KyÅhÅ" },
+ { startingYear: 1736, japaneseName: 'å
æ', romanizedName: "Genbun" },
+ { startingYear: 1741, japaneseName: 'å¯ä¿', romanizedName: "KanpÅ" },
+ { startingYear: 1744, japaneseName: '延享', romanizedName: "EnkyÅ" },
+ { startingYear: 1748, japaneseName: 'å¯å»¶', romanizedName: "Kan'en" },
+ { startingYear: 1751, japaneseName: '宿Š', romanizedName: "HÅreki" },
+ { startingYear: 1764, japaneseName: 'æå', romanizedName: "Meiwa" },
+ { startingYear: 1772, japaneseName: '宿°ž', romanizedName: "An'ei" },
+ { startingYear: 1781, japaneseName: '倩æ', romanizedName: "Tenmei" },
+ { startingYear: 1789, japaneseName: '坿¿', romanizedName: "Kansei" },
+ { startingYear: 1801, japaneseName: '享å', romanizedName: "KyÅwa" },
+ { startingYear: 1804, japaneseName: 'æå', romanizedName: "Bunka" },
+ { startingYear: 1818, japaneseName: 'ææ¿', romanizedName: "Bunsei" },
+ { startingYear: 1830, japaneseName: '倩ä¿', romanizedName: "TenpÅ" },
+ { startingYear: 1844, japaneseName: 'åŒå', romanizedName: "KÅka" },
+ { startingYear: 1848, japaneseName: 'åæ°ž', romanizedName: "Kaei" },
+ { startingYear: 1854, japaneseName: '宿¿', romanizedName: "Ansei" },
+ { startingYear: 1860, japaneseName: 'äžå»¶', romanizedName: "Man'en" },
+ { startingYear: 1861, japaneseName: 'æä¹
', romanizedName: "Bunkyū" },
+ { startingYear: 1864, japaneseName: 'å
æ²»', romanizedName: "Genji" },
+ { startingYear: 1865, japaneseName: 'æ
¶å¿', romanizedName: "KeiÅ" },
+ { startingYear: 1868, japaneseName: 'ææ²»', romanizedName: "Meiji" },
+ { startingYear: 1912, japaneseName: '倧æ£', romanizedName: "TaishÅ" },
+ { startingYear: 1926, japaneseName: 'æå', romanizedName: "ShÅwa" },
+ { startingYear: 1989, japaneseName: 'å¹³æ', romanizedName: "Heisei" }
+ ]
+);
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/cs/labellers.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/cs/labellers.js
new file mode 100644
index 0000000..954c7a8
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/cs/labellers.js
@@ -0,0 +1,30 @@
+/*==================================================
+ * Localization of labellers.js
+ *==================================================
+ */
+
+Timeline.GregorianDateLabeller.monthNames["cs"] = [
+ "Leden", "Únor", "Bøezen", "Duben", "Kvìten", "Èerven", "Èervenec", "Srpen", "Záøí", "Øíjen", "Listopad", "Prosinec"
+];
+
+Timeline.GregorianDateLabeller.dayNames["cs"] = [
+ "Ne", "Po", "Út", "St", "Èt", "Pá", "So"
+];
+
+Timeline.GregorianDateLabeller.labelIntervalFunctions["cs"] = function(date, intervalUnit) {
+ var text;
+ var emphasized = false;
+
+ var date2 = Timeline.DateTime.removeTimeZoneOffset(date, this._timeZone);
+
+ switch(intervalUnit) {
+ case Timeline.DateTime.DAY:
+ case Timeline.DateTime.WEEK:
+ text = date2.getUTCDate() + ". " + (date2.getUTCMonth() + 1) + ".";
+ break;
+ default:
+ return this.defaultLabelInterval(date, intervalUnit);
+ }
+
+ return { text: text, emphasized: emphasized };
+};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/cs/timeline.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/cs/timeline.js
new file mode 100644
index 0000000..d823a51
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/cs/timeline.js
@@ -0,0 +1,9 @@
+/*==================================================
+ * Common localization strings
+ *==================================================
+ */
+
+Timeline.strings["cs"] = {
+ wikiLinkLabel: "Diskuze"
+};
+
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/de/labellers.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/de/labellers.js
new file mode 100644
index 0000000..f0eb7df
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/de/labellers.js
@@ -0,0 +1,27 @@
+/*==================================================
+ * Localization of labellers.js
+ *==================================================
+ */
+
+Timeline.GregorianDateLabeller.monthNames["de"] = [
+ "Jan", "Feb", "Mrz", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"
+];
+
+Timeline.GregorianDateLabeller.labelIntervalFunctions["de"] = function(date, intervalUnit) {
+ var text;
+ var emphasized = false;
+
+ var date2 = Timeline.DateTime.removeTimeZoneOffset(date, this._timeZone);
+
+ switch(intervalUnit) {
+ case Timeline.DateTime.DAY:
+ case Timeline.DateTime.WEEK:
+ text = date2.getUTCDate() + ". " +
+ Timeline.GregorianDateLabeller.getMonthName(date2.getUTCMonth(), this._locale);
+ break;
+ default:
+ return this.defaultLabelInterval(date, intervalUnit);
+ }
+
+ return { text: text, emphasized: emphasized };
+};
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/de/timeline.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/de/timeline.js
new file mode 100644
index 0000000..7292cef
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/de/timeline.js
@@ -0,0 +1,8 @@
+/*==================================================
+ * Common localization strings
+ *==================================================
+ */
+
+Timeline.strings["de"] = {
+ wikiLinkLabel: "Diskutieren"
+};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/en/labellers.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/en/labellers.js
new file mode 100644
index 0000000..3f1beb6
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/en/labellers.js
@@ -0,0 +1,8 @@
+/*==================================================
+ * Localization of labellers.js
+ *==================================================
+ */
+
+Timeline.GregorianDateLabeller.monthNames["en"] = [
+ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
+];
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/en/timeline.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/en/timeline.js
new file mode 100644
index 0000000..c6b70dd
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/en/timeline.js
@@ -0,0 +1,9 @@
+/*==================================================
+ * Common localization strings
+ *==================================================
+ */
+
+Timeline.strings["en"] = {
+ wikiLinkLabel: "Discuss"
+};
+
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/es/labellers.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/es/labellers.js
new file mode 100644
index 0000000..963038e
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/es/labellers.js
@@ -0,0 +1,8 @@
+/*==================================================
+ * Localization of labellers.js
+ *==================================================
+ */
+
+Timeline.GregorianDateLabeller.monthNames["es"] = [
+ "Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic"
+];
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/es/timeline.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/es/timeline.js
new file mode 100644
index 0000000..2a5183c
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/es/timeline.js
@@ -0,0 +1,9 @@
+/*==================================================
+ * Common localization strings
+ *==================================================
+ */
+
+Timeline.strings["es"] = {
+ wikiLinkLabel: "Discute"
+};
+
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/fr/labellers.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/fr/labellers.js
new file mode 100644
index 0000000..5e7392a
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/fr/labellers.js
@@ -0,0 +1,8 @@
+/*==================================================
+ * Localization of labellers.js
+ *==================================================
+ */
+
+Timeline.GregorianDateLabeller.monthNames["fr"] = [
+ "jan", "fev", "mar", "avr", "mai", "jui", "jui", "aou", "sep", "oct", "nov", "dec"
+];
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/fr/timeline.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/fr/timeline.js
new file mode 100644
index 0000000..459cc38
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/fr/timeline.js
@@ -0,0 +1,9 @@
+/*==================================================
+ * Common localization strings
+ *==================================================
+ */
+
+Timeline.strings["fr"] = {
+ wikiLinkLabel: "Discute"
+};
+
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/it/labellers.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/it/labellers.js
new file mode 100644
index 0000000..85d50d4
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/it/labellers.js
@@ -0,0 +1,8 @@
+/*==================================================
+ * Localization of labellers.js
+ *==================================================
+ */
+
+Timeline.GregorianDateLabeller.monthNames["it"] = [
+ "Gen", "Feb", "Mar", "Apr", "Mag", "Giu", "Lug", "Ago", "Set", "Ott", "Nov", "Dic"
+];
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/it/timeline.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/it/timeline.js
new file mode 100644
index 0000000..69582dc
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/it/timeline.js
@@ -0,0 +1,9 @@
+/*==================================================
+ * Common localization strings
+ *==================================================
+ */
+
+Timeline.strings["it"] = {
+ wikiLinkLabel: "Discuti"
+};
+
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/ru/labellers.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/ru/labellers.js
new file mode 100644
index 0000000..b7545d6
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/ru/labellers.js
@@ -0,0 +1,10 @@
+/*==================================================
+ * Localization of labellers.js
+ *
+ * UTF-8 encoded
+ *==================================================
+ */
+
+Timeline.GregorianDateLabeller.monthNames["ru"] = [
+ "ЯМв", "Ѐев", "ÐаÑ", "ÐпÑ", "Ðай", "ÐÑМ", "ÐÑл", "Ðвг", "СеМ", "ÐкÑ", "ÐПÑ", "Ðек"
+];
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/ru/timeline.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/ru/timeline.js
new file mode 100644
index 0000000..af5fcc7
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/ru/timeline.js
@@ -0,0 +1,9 @@
+/*==================================================
+ * Common localization strings
+ *==================================================
+ */
+
+Timeline.strings["ru"] = {
+ wikiLinkLabel: "ПбÑÑЎОÑе"
+};
+
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/se/labellers.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/se/labellers.js
new file mode 100644
index 0000000..378cda1
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/se/labellers.js
@@ -0,0 +1,12 @@
+/*==================================================
+ * Localization of labellers.js
+ *==================================================
+ */
+
+Timeline.GregorianDateLabeller.monthNames["se"] = [
+ "Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec"
+];
+
+Timeline.GregorianDateLabeller.dayNames["se"] = [
+ "Sön", "Mån", "Tis", "Ons", "Tors", "Fre", "Lör"
+];
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/se/timeline.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/se/timeline.js
new file mode 100644
index 0000000..31751ac
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/se/timeline.js
@@ -0,0 +1,9 @@
+/*==================================================
+ * Common localization strings
+ *==================================================
+ */
+
+Timeline.strings["se"] = {
+ wikiLinkLabel: "Discuss"
+};
+
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/tr/labellers.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/tr/labellers.js
new file mode 100644
index 0000000..5d4dd72
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/tr/labellers.js
@@ -0,0 +1,8 @@
+/*==================================================
+ * Localization of labellers.js
+ *==================================================
+ */
+
+Timeline.GregorianDateLabeller.monthNames["tr"] = [
+ "Ock", "Åbt", "Mrt", "Nsn", "Mys", "Hzr", "Tem", "AÄs", "Eyl", "Ekm", "Ksm", "Arl"
+];
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/tr/timeline.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/tr/timeline.js
new file mode 100644
index 0000000..696dc34
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/tr/timeline.js
@@ -0,0 +1,9 @@
+/*==================================================
+ * Common localization strings
+ *==================================================
+ */
+
+Timeline.strings["tr"] = {
+ wikiLinkLabel: "TartıÅ"
+};
+
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/vi/labellers.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/vi/labellers.js
new file mode 100644
index 0000000..85994d0
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/vi/labellers.js
@@ -0,0 +1,26 @@
+/*==================================================
+ * Localization of labellers.js
+ *==================================================
+ */
+
+Timeline.GregorianDateLabeller.monthNames["vi"] = [
+ "Tháng 1", "Tháng 2", "Tháng 3", "Tháng 4", "Tháng 5", "Tháng 6", "Tháng 7", "Tháng 8", "Tháng 9", "Tháng 10", "Tháng 11", "Tháng 12"
+];
+
+Timeline.GregorianDateLabeller.labelIntervalFunctions["vi"] = function(date, intervalUnit) {
+ var text;
+ var emphasized = false;
+
+ var date2 = Timeline.DateTime.removeTimeZoneOffset(date, this._timeZone);
+
+ switch(intervalUnit) {
+ case Timeline.DateTime.DAY:
+ case Timeline.DateTime.WEEK:
+ text = date2.getUTCDate() + "/" + (date2.getUTCMonth() + 1);
+ break;
+ default:
+ return this.defaultLabelInterval(date, intervalUnit);
+ }
+
+ return { text: text, emphasized: emphasized };
+};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/vi/timeline.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/vi/timeline.js
new file mode 100644
index 0000000..a67befc
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/vi/timeline.js
@@ -0,0 +1,9 @@
+/*==================================================
+ * Common localization strings
+ *==================================================
+ */
+
+Timeline.strings["vi"] = {
+ wikiLinkLabel: "BaÌn luận"
+};
+
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/zh/labellers.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/zh/labellers.js
new file mode 100644
index 0000000..599f2d1
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/zh/labellers.js
@@ -0,0 +1,27 @@
+/*==================================================
+ * Localization of labellers.js
+ *==================================================
+ */
+
+Timeline.GregorianDateLabeller.monthNames["zh"] = [
+ "1æ", "2æ", "3æ", "4æ", "5æ", "6æ", "7æ", "8æ", "9æ", "10æ", "11æ", "12æ"
+];
+
+Timeline.GregorianDateLabeller.labelIntervalFunctions["zh"] = function(date, intervalUnit) {
+ var text;
+ var emphasized = false;
+
+ var date2 = Timeline.DateTime.removeTimeZoneOffset(date, this._timeZone);
+
+ switch(intervalUnit) {
+ case Timeline.DateTime.DAY:
+ case Timeline.DateTime.WEEK:
+ text = Timeline.GregorianDateLabeller.getMonthName(date2.getUTCMonth(), this._locale) +
+ date2.getUTCDate() + "æ¥";
+ break;
+ default:
+ return this.defaultLabelInterval(date, intervalUnit);
+ }
+
+ return { text: text, emphasized: emphasized };
+};
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/zh/timeline.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/zh/timeline.js
new file mode 100644
index 0000000..9488492
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/zh/timeline.js
@@ -0,0 +1,9 @@
+/*==================================================
+ * Common localization strings
+ *==================================================
+ */
+
+Timeline.strings["zh"] = {
+ wikiLinkLabel: "讚论"
+};
+
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/labellers.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/labellers.js
new file mode 100644
index 0000000..4ac874c
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/labellers.js
@@ -0,0 +1,91 @@
+/*==================================================
+ * Gregorian Date Labeller
+ *==================================================
+ */
+
+Timeline.GregorianDateLabeller = function(locale, timeZone) {
+ this._locale = locale;
+ this._timeZone = timeZone;
+};
+
+Timeline.GregorianDateLabeller.monthNames = [];
+Timeline.GregorianDateLabeller.dayNames = [];
+Timeline.GregorianDateLabeller.labelIntervalFunctions = [];
+
+Timeline.GregorianDateLabeller.getMonthName = function(month, locale) {
+ return Timeline.GregorianDateLabeller.monthNames[locale][month];
+};
+
+Timeline.GregorianDateLabeller.prototype.labelInterval = function(date, intervalUnit) {
+ var f = Timeline.GregorianDateLabeller.labelIntervalFunctions[this._locale];
+ if (f == null) {
+ f = Timeline.GregorianDateLabeller.prototype.defaultLabelInterval;
+ }
+ return f.call(this, date, intervalUnit);
+};
+
+Timeline.GregorianDateLabeller.prototype.labelPrecise = function(date) {
+ return SimileAjax.DateTime.removeTimeZoneOffset(
+ date,
+ this._timeZone //+ (new Date().getTimezoneOffset() / 60)
+ ).toUTCString();
+};
+
+Timeline.GregorianDateLabeller.prototype.defaultLabelInterval = function(date, intervalUnit) {
+ var text;
+ var emphasized = false;
+
+ date = SimileAjax.DateTime.removeTimeZoneOffset(date, this._timeZone);
+
+ switch(intervalUnit) {
+ case SimileAjax.DateTime.MILLISECOND:
+ text = date.getUTCMilliseconds();
+ break;
+ case SimileAjax.DateTime.SECOND:
+ text = date.getUTCSeconds();
+ break;
+ case SimileAjax.DateTime.MINUTE:
+ var m = date.getUTCMinutes();
+ if (m == 0) {
+ text = date.getUTCHours() + ":00";
+ emphasized = true;
+ } else {
+ text = m;
+ }
+ break;
+ case SimileAjax.DateTime.HOUR:
+ text = date.getUTCHours() + "hr";
+ break;
+ case SimileAjax.DateTime.DAY:
+ text = Timeline.GregorianDateLabeller.getMonthName(date.getUTCMonth(), this._locale) + " " + date.getUTCDate();
+ break;
+ case SimileAjax.DateTime.WEEK:
+ text = Timeline.GregorianDateLabeller.getMonthName(date.getUTCMonth(), this._locale) + " " + date.getUTCDate();
+ break;
+ case SimileAjax.DateTime.MONTH:
+ var m = date.getUTCMonth();
+ if (m != 0) {
+ text = Timeline.GregorianDateLabeller.getMonthName(m, this._locale);
+ break;
+ } // else, fall through
+ case SimileAjax.DateTime.YEAR:
+ case SimileAjax.DateTime.DECADE:
+ case SimileAjax.DateTime.CENTURY:
+ case SimileAjax.DateTime.MILLENNIUM:
+ var y = date.getUTCFullYear();
+ if (y > 0) {
+ text = date.getUTCFullYear();
+ } else {
+ text = (1 - y) + "BC";
+ }
+ emphasized =
+ (intervalUnit == SimileAjax.DateTime.MONTH) ||
+ (intervalUnit == SimileAjax.DateTime.DECADE && y % 100 == 0) ||
+ (intervalUnit == SimileAjax.DateTime.CENTURY && y % 1000 == 0);
+ break;
+ default:
+ text = date.toUTCString();
+ }
+ return { text: text, emphasized: emphasized };
+}
+
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/original-painter.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/original-painter.js
new file mode 100644
index 0000000..f91976c
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/original-painter.js
@@ -0,0 +1,501 @@
+/*==================================================
+ * Original Event Painter
+ *==================================================
+ */
+
+Timeline.OriginalEventPainter = function(params) {
+ this._params = params;
+ this._onSelectListeners = [];
+
+ this._filterMatcher = null;
+ this._highlightMatcher = null;
+ this._frc = null;
+
+ this._eventIdToElmt = {};
+};
+
+Timeline.OriginalEventPainter.prototype.initialize = function(band, timeline) {
+ this._band = band;
+ this._timeline = timeline;
+
+ this._backLayer = null;
+ this._eventLayer = null;
+ this._lineLayer = null;
+ this._highlightLayer = null;
+
+ this._eventIdToElmt = null;
+};
+
+Timeline.OriginalEventPainter.prototype.addOnSelectListener = function(listener) {
+ this._onSelectListeners.push(listener);
+};
+
+Timeline.OriginalEventPainter.prototype.removeOnSelectListener = function(listener) {
+ for (var i = 0; i < this._onSelectListeners.length; i++) {
+ if (this._onSelectListeners[i] == listener) {
+ this._onSelectListeners.splice(i, 1);
+ break;
+ }
+ }
+};
+
+Timeline.OriginalEventPainter.prototype.getFilterMatcher = function() {
+ return this._filterMatcher;
+};
+
+Timeline.OriginalEventPainter.prototype.setFilterMatcher = function(filterMatcher) {
+ this._filterMatcher = filterMatcher;
+};
+
+Timeline.OriginalEventPainter.prototype.getHighlightMatcher = function() {
+ return this._highlightMatcher;
+};
+
+Timeline.OriginalEventPainter.prototype.setHighlightMatcher = function(highlightMatcher) {
+ this._highlightMatcher = highlightMatcher;
+};
+
+Timeline.OriginalEventPainter.prototype.paint = function() {
+ var eventSource = this._band.getEventSource();
+ if (eventSource == null) {
+ return;
+ }
+
+ this._eventIdToElmt = {};
+ this._prepareForPainting();
+
+ var eventTheme = this._params.theme.event;
+ var trackHeight = Math.max(eventTheme.track.height, eventTheme.tape.height + this._frc.getLineHeight());
+ var metrics = {
+ trackOffset: eventTheme.track.gap,
+ trackHeight: trackHeight,
+ trackGap: eventTheme.track.gap,
+ trackIncrement: trackHeight + eventTheme.track.gap,
+ icon: eventTheme.instant.icon,
+ iconWidth: eventTheme.instant.iconWidth,
+ iconHeight: eventTheme.instant.iconHeight,
+ labelWidth: eventTheme.label.width
+ }
+
+ var minDate = this._band.getMinDate();
+ var maxDate = this._band.getMaxDate();
+
+ var filterMatcher = (this._filterMatcher != null) ?
+ this._filterMatcher :
+ function(evt) { return true; };
+ var highlightMatcher = (this._highlightMatcher != null) ?
+ this._highlightMatcher :
+ function(evt) { return -1; };
+
+ var iterator = eventSource.getEventReverseIterator(minDate, maxDate);
+ while (iterator.hasNext()) {
+ var evt = iterator.next();
+ if (filterMatcher(evt)) {
+ this.paintEvent(evt, metrics, this._params.theme, highlightMatcher(evt));
+ }
+ }
+
+ this._highlightLayer.style.display = "block";
+ this._lineLayer.style.display = "block";
+ this._eventLayer.style.display = "block";
+};
+
+Timeline.OriginalEventPainter.prototype.softPaint = function() {
+};
+
+Timeline.OriginalEventPainter.prototype._prepareForPainting = function() {
+ var band = this._band;
+
+ if (this._backLayer == null) {
+ this._backLayer = this._band.createLayerDiv(0, "timeline-band-events");
+ this._backLayer.style.visibility = "hidden";
+
+ var eventLabelPrototype = document.createElement("span");
+ eventLabelPrototype.className = "timeline-event-label";
+ this._backLayer.appendChild(eventLabelPrototype);
+ this._frc = SimileAjax.Graphics.getFontRenderingContext(eventLabelPrototype);
+ }
+ this._frc.update();
+ this._tracks = [];
+
+ if (this._highlightLayer != null) {
+ band.removeLayerDiv(this._highlightLayer);
+ }
+ this._highlightLayer = band.createLayerDiv(105, "timeline-band-highlights");
+ this._highlightLayer.style.display = "none";
+
+ if (this._lineLayer != null) {
+ band.removeLayerDiv(this._lineLayer);
+ }
+ this._lineLayer = band.createLayerDiv(110, "timeline-band-lines");
+ this._lineLayer.style.display = "none";
+
+ if (this._eventLayer != null) {
+ band.removeLayerDiv(this._eventLayer);
+ }
+ this._eventLayer = band.createLayerDiv(115, "timeline-band-events");
+ this._eventLayer.style.display = "none";
+};
+
+Timeline.OriginalEventPainter.prototype.paintEvent = function(evt, metrics, theme, highlightIndex) {
+ if (evt.isInstant()) {
+ this.paintInstantEvent(evt, metrics, theme, highlightIndex);
+ } else {
+ this.paintDurationEvent(evt, metrics, theme, highlightIndex);
+ }
+};
+
+Timeline.OriginalEventPainter.prototype.paintInstantEvent = function(evt, metrics, theme, highlightIndex) {
+ if (evt.isImprecise()) {
+ this.paintImpreciseInstantEvent(evt, metrics, theme, highlightIndex);
+ } else {
+ this.paintPreciseInstantEvent(evt, metrics, theme, highlightIndex);
+ }
+}
+
+Timeline.OriginalEventPainter.prototype.paintDurationEvent = function(evt, metrics, theme, highlightIndex) {
+ if (evt.isImprecise()) {
+ this.paintImpreciseDurationEvent(evt, metrics, theme, highlightIndex);
+ } else {
+ this.paintPreciseDurationEvent(evt, metrics, theme, highlightIndex);
+ }
+}
+
+Timeline.OriginalEventPainter.prototype.paintPreciseInstantEvent = function(evt, metrics, theme, highlightIndex) {
+ var doc = this._timeline.getDocument();
+ var text = evt.getText();
+
+ var startDate = evt.getStart();
+ var startPixel = Math.round(this._band.dateToPixelOffset(startDate));
+ var iconRightEdge = Math.round(startPixel + metrics.iconWidth / 2);
+ var iconLeftEdge = Math.round(startPixel - metrics.iconWidth / 2);
+
+ var labelSize = this._frc.computeSize(text);
+ var labelLeft = iconRightEdge + theme.event.label.offsetFromLine;
+ var labelRight = labelLeft + labelSize.width;
+
+ var rightEdge = labelRight;
+ var track = this._findFreeTrack(rightEdge);
+
+ var labelTop = Math.round(
+ metrics.trackOffset + track * metrics.trackIncrement +
+ metrics.trackHeight / 2 - labelSize.height / 2);
+
+ var iconElmtData = this._paintEventIcon(evt, track, iconLeftEdge, metrics, theme);
+ var labelElmtData = this._paintEventLabel(evt, text, labelLeft, labelTop, labelSize.width, labelSize.height, theme);
+
+ var self = this;
+ var clickHandler = function(elmt, domEvt, target) {
+ return self._onClickInstantEvent(iconElmtData.elmt, domEvt, evt);
+ };
+ SimileAjax.DOM.registerEvent(iconElmtData.elmt, "mousedown", clickHandler);
+ SimileAjax.DOM.registerEvent(labelElmtData.elmt, "mousedown", clickHandler);
+
+ this._createHighlightDiv(highlightIndex, iconElmtData, theme);
+
+ this._eventIdToElmt[evt.getID()] = iconElmtData.elmt;
+ this._tracks[track] = iconLeftEdge;
+};
+
+Timeline.OriginalEventPainter.prototype.paintImpreciseInstantEvent = function(evt, metrics, theme, highlightIndex) {
+ var doc = this._timeline.getDocument();
+ var text = evt.getText();
+
+ var startDate = evt.getStart();
+ var endDate = evt.getEnd();
+ var startPixel = Math.round(this._band.dateToPixelOffset(startDate));
+ var endPixel = Math.round(this._band.dateToPixelOffset(endDate));
+
+ var iconRightEdge = Math.round(startPixel + metrics.iconWidth / 2);
+ var iconLeftEdge = Math.round(startPixel - metrics.iconWidth / 2);
+
+ var labelSize = this._frc.computeSize(text);
+ var labelLeft = iconRightEdge + theme.event.label.offsetFromLine;
+ var labelRight = labelLeft + labelSize.width;
+
+ var rightEdge = Math.max(labelRight, endPixel);
+ var track = this._findFreeTrack(rightEdge);
+ var labelTop = Math.round(
+ metrics.trackOffset + track * metrics.trackIncrement +
+ metrics.trackHeight / 2 - labelSize.height / 2);
+
+ var iconElmtData = this._paintEventIcon(evt, track, iconLeftEdge, metrics, theme);
+ var labelElmtData = this._paintEventLabel(evt, text, labelLeft, labelTop, labelSize.width, labelSize.height, theme);
+ var tapeElmtData = this._paintEventTape(evt, track, startPixel, endPixel,
+ theme.event.instant.impreciseColor, theme.event.instant.impreciseOpacity, metrics, theme);
+
+ var self = this;
+ var clickHandler = function(elmt, domEvt, target) {
+ return self._onClickInstantEvent(iconElmtData.elmt, domEvt, evt);
+ };
+ SimileAjax.DOM.registerEvent(iconElmtData.elmt, "mousedown", clickHandler);
+ SimileAjax.DOM.registerEvent(tapeElmtData.elmt, "mousedown", clickHandler);
+ SimileAjax.DOM.registerEvent(labelElmtData.elmt, "mousedown", clickHandler);
+
+ this._createHighlightDiv(highlightIndex, iconElmtData, theme);
+
+ this._eventIdToElmt[evt.getID()] = iconElmtData.elmt;
+ this._tracks[track] = iconLeftEdge;
+};
+
+Timeline.OriginalEventPainter.prototype.paintPreciseDurationEvent = function(evt, metrics, theme, highlightIndex) {
+ var doc = this._timeline.getDocument();
+ var text = evt.getText();
+
+ var startDate = evt.getStart();
+ var endDate = evt.getEnd();
+ var startPixel = Math.round(this._band.dateToPixelOffset(startDate));
+ var endPixel = Math.round(this._band.dateToPixelOffset(endDate));
+
+ var labelSize = this._frc.computeSize(text);
+ var labelLeft = startPixel;
+ var labelRight = labelLeft + labelSize.width;
+
+ var rightEdge = Math.max(labelRight, endPixel);
+ var track = this._findFreeTrack(rightEdge);
+ var labelTop = Math.round(
+ metrics.trackOffset + track * metrics.trackIncrement + theme.event.tape.height);
+
+ var color = evt.getColor();
+ color = color != null ? color : theme.event.duration.color;
+
+ var tapeElmtData = this._paintEventTape(evt, track, startPixel, endPixel, color, 100, metrics, theme);
+ var labelElmtData = this._paintEventLabel(evt, text, labelLeft, labelTop, labelSize.width, labelSize.height, theme);
+
+ var self = this;
+ var clickHandler = function(elmt, domEvt, target) {
+ return self._onClickDurationEvent(tapeElmtData.elmt, domEvt, evt);
+ };
+ SimileAjax.DOM.registerEvent(tapeElmtData.elmt, "mousedown", clickHandler);
+ SimileAjax.DOM.registerEvent(labelElmtData.elmt, "mousedown", clickHandler);
+
+ this._createHighlightDiv(highlightIndex, tapeElmtData, theme);
+
+ this._eventIdToElmt[evt.getID()] = tapeElmtData.elmt;
+ this._tracks[track] = startPixel;
+};
+
+Timeline.OriginalEventPainter.prototype.paintImpreciseDurationEvent = function(evt, metrics, theme, highlightIndex) {
+ var doc = this._timeline.getDocument();
+ var text = evt.getText();
+
+ var startDate = evt.getStart();
+ var latestStartDate = evt.getLatestStart();
+ var endDate = evt.getEnd();
+ var earliestEndDate = evt.getEarliestEnd();
+
+ var startPixel = Math.round(this._band.dateToPixelOffset(startDate));
+ var latestStartPixel = Math.round(this._band.dateToPixelOffset(latestStartDate));
+ var endPixel = Math.round(this._band.dateToPixelOffset(endDate));
+ var earliestEndPixel = Math.round(this._band.dateToPixelOffset(earliestEndDate));
+
+ var labelSize = this._frc.computeSize(text);
+ var labelLeft = latestStartPixel;
+ var labelRight = labelLeft + labelSize.width;
+
+ var rightEdge = Math.max(labelRight, endPixel);
+ var track = this._findFreeTrack(rightEdge);
+ var labelTop = Math.round(
+ metrics.trackOffset + track * metrics.trackIncrement + theme.event.tape.height);
+
+ var color = evt.getColor();
+ color = color != null ? color : theme.event.duration.color;
+
+ var impreciseTapeElmtData = this._paintEventTape(evt, track, startPixel, endPixel,
+ theme.event.duration.impreciseColor, theme.event.duration.impreciseOpacity, metrics, theme);
+ var tapeElmtData = this._paintEventTape(evt, track, latestStartPixel, earliestEndPixel, color, 100, metrics, theme);
+
+ var labelElmtData = this._paintEventLabel(evt, text, labelLeft, labelTop, labelSize.width, labelSize.height, theme);
+
+ var self = this;
+ var clickHandler = function(elmt, domEvt, target) {
+ return self._onClickDurationEvent(tapeElmtData.elmt, domEvt, evt);
+ };
+ SimileAjax.DOM.registerEvent(tapeElmtData.elmt, "mousedown", clickHandler);
+ SimileAjax.DOM.registerEvent(labelElmtData.elmt, "mousedown", clickHandler);
+
+ this._createHighlightDiv(highlightIndex, tapeElmtData, theme);
+
+ this._eventIdToElmt[evt.getID()] = tapeElmtData.elmt;
+ this._tracks[track] = startPixel;
+};
+
+Timeline.OriginalEventPainter.prototype._findFreeTrack = function(rightEdge) {
+ for (var i = 0; i < this._tracks.length; i++) {
+ var t = this._tracks[i];
+ if (t > rightEdge) {
+ break;
+ }
+ }
+ return i;
+};
+
+Timeline.OriginalEventPainter.prototype._paintEventIcon = function(evt, iconTrack, left, metrics, theme) {
+ var icon = evt.getIcon();
+ icon = icon != null ? icon : metrics.icon;
+
+ var middle = metrics.trackOffset + iconTrack * metrics.trackIncrement + metrics.trackHeight / 2;
+ var top = Math.round(middle - metrics.iconHeight / 2);
+
+ var img = SimileAjax.Graphics.createTranslucentImage(icon);
+ var iconDiv = this._timeline.getDocument().createElement("div");
+ iconDiv.className = 'timeline-event-icon'
+ iconDiv.style.left = left + "px";
+ iconDiv.style.top = top + "px";
+ iconDiv.appendChild(img);
+
+ if(evt._title != null)
+ iconDiv.title = evt._title;
+
+ this._eventLayer.appendChild(iconDiv);
+
+ return {
+ left: left,
+ top: top,
+ width: metrics.iconWidth,
+ height: metrics.iconHeight,
+ elmt: iconDiv
+ };
+};
+
+Timeline.OriginalEventPainter.prototype._paintEventLabel = function(evt, text, left, top, width, height, theme) {
+ var doc = this._timeline.getDocument();
+
+ var labelDiv = doc.createElement("div");
+ labelDiv.className = 'timeline-event-label'
+
+ labelDiv.style.left = left + "px";
+ labelDiv.style.width = (width+10) + "px"; // GH: Had to make this a little bigger... the font metrics seem to be off
+ labelDiv.style.top = top + "px";
+ labelDiv.innerHTML = text;
+
+ if(evt._title != null)
+ labelDiv.title = evt._title;
+
+ var color = evt.getTextColor();
+ if (color == null) {
+ color = evt.getColor();
+ }
+ if (color != null) {
+ labelDiv.style.color = color;
+ }
+
+
+ var classname = evt.getClassName()
+ if(classname) labelDiv.className +=' ' + classname;
+
+
+
+ this._eventLayer.appendChild(labelDiv);
+
+ return {
+ left: left,
+ top: top,
+ width: width,
+ height: height,
+ elmt: labelDiv
+ };
+};
+
+Timeline.OriginalEventPainter.prototype._paintEventTape = function(
+ evt, iconTrack, startPixel, endPixel, color, opacity, metrics, theme) {
+
+ var tapeWidth = endPixel - startPixel;
+ var tapeHeight = theme.event.tape.height;
+ var top = metrics.trackOffset + iconTrack * metrics.trackIncrement;
+
+ var tapeDiv = this._timeline.getDocument().createElement("div");
+ tapeDiv.className = "timeline-event-tape"
+
+ tapeDiv.style.left = startPixel + "px";
+ tapeDiv.style.width = tapeWidth + "px";
+ tapeDiv.style.top = top + "px";
+
+ if(evt._title != null)
+ tapeDiv.title = evt._title;
+
+ SimileAjax.Graphics.setOpacity(tapeDiv, opacity);
+
+ this._eventLayer.appendChild(tapeDiv);
+
+ return {
+ left: startPixel,
+ top: top,
+ width: tapeWidth,
+ height: tapeHeight,
+ elmt: tapeDiv
+ };
+}
+
+Timeline.OriginalEventPainter.prototype._createHighlightDiv = function(highlightIndex, dimensions, theme) {
+ if (highlightIndex >= 0) {
+ var doc = this._timeline.getDocument();
+ var eventTheme = theme.event;
+
+ var color = eventTheme.highlightColors[Math.min(highlightIndex, eventTheme.highlightColors.length - 1)];
+
+ var div = doc.createElement("div");
+ div.style.position = "absolute";
+ div.style.overflow = "hidden";
+ div.style.left = (dimensions.left - 2) + "px";
+ div.style.width = (dimensions.width + 4) + "px";
+ div.style.top = (dimensions.top - 2) + "px";
+ div.style.height = (dimensions.height + 4) + "px";
+// div.style.background = color;
+
+ this._highlightLayer.appendChild(div);
+ }
+};
+
+Timeline.OriginalEventPainter.prototype._onClickInstantEvent = function(icon, domEvt, evt) {
+ var c = SimileAjax.DOM.getPageCoordinates(icon);
+ this._showBubble(
+ c.left + Math.ceil(icon.offsetWidth / 2),
+ c.top + Math.ceil(icon.offsetHeight / 2),
+ evt
+ );
+ this._fireOnSelect(evt.getID());
+
+ domEvt.cancelBubble = true;
+ SimileAjax.DOM.cancelEvent(domEvt);
+ return false;
+};
+
+Timeline.OriginalEventPainter.prototype._onClickDurationEvent = function(target, domEvt, evt) {
+ if ("pageX" in domEvt) {
+ var x = domEvt.pageX;
+ var y = domEvt.pageY;
+ } else {
+ var c = SimileAjax.DOM.getPageCoordinates(target);
+ var x = domEvt.offsetX + c.left;
+ var y = domEvt.offsetY + c.top;
+ }
+ this._showBubble(x, y, evt);
+ this._fireOnSelect(evt.getID());
+
+ domEvt.cancelBubble = true;
+ SimileAjax.DOM.cancelEvent(domEvt);
+ return false;
+};
+
+Timeline.OriginalEventPainter.prototype.showBubble = function(evt) {
+ var elmt = this._eventIdToElmt[evt.getID()];
+ if (elmt) {
+ var c = SimileAjax.DOM.getPageCoordinates(elmt);
+ this._showBubble(c.left + elmt.offsetWidth / 2, c.top + elmt.offsetHeight / 2, evt);
+ }
+};
+
+Timeline.OriginalEventPainter.prototype._showBubble = function(x, y, evt) {
+ var div = document.createElement("div");
+ evt.fillInfoBubble(div, this._params.theme, this._band.getLabeller());
+
+ SimileAjax.WindowManager.cancelPopups();
+ SimileAjax.Graphics.createBubbleForContentAndPoint(div, x, y, this._params.theme.event.bubble.width);
+};
+
+Timeline.OriginalEventPainter.prototype._fireOnSelect = function(eventID) {
+ for (var i = 0; i < this._onSelectListeners.length; i++) {
+ this._onSelectListeners[i](eventID);
+ }
+};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/overview-painter.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/overview-painter.js
new file mode 100644
index 0000000..99722c3
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/overview-painter.js
@@ -0,0 +1,238 @@
+/*==================================================
+ * Overview Event Painter
+ *==================================================
+ */
+
+Timeline.OverviewEventPainter = function(params) {
+ this._params = params;
+ this._onSelectListeners = [];
+
+ this._filterMatcher = null;
+ this._highlightMatcher = null;
+};
+
+Timeline.OverviewEventPainter.prototype.initialize = function(band, timeline) {
+ this._band = band;
+ this._timeline = timeline;
+
+ this._eventLayer = null;
+ this._highlightLayer = null;
+};
+
+Timeline.OverviewEventPainter.prototype.addOnSelectListener = function(listener) {
+ this._onSelectListeners.push(listener);
+};
+
+Timeline.OverviewEventPainter.prototype.removeOnSelectListener = function(listener) {
+ for (var i = 0; i < this._onSelectListeners.length; i++) {
+ if (this._onSelectListeners[i] == listener) {
+ this._onSelectListeners.splice(i, 1);
+ break;
+ }
+ }
+};
+
+Timeline.OverviewEventPainter.prototype.getFilterMatcher = function() {
+ return this._filterMatcher;
+};
+
+Timeline.OverviewEventPainter.prototype.setFilterMatcher = function(filterMatcher) {
+ this._filterMatcher = filterMatcher;
+};
+
+Timeline.OverviewEventPainter.prototype.getHighlightMatcher = function() {
+ return this._highlightMatcher;
+};
+
+Timeline.OverviewEventPainter.prototype.setHighlightMatcher = function(highlightMatcher) {
+ this._highlightMatcher = highlightMatcher;
+};
+
+Timeline.OverviewEventPainter.prototype.paint = function() {
+ var eventSource = this._band.getEventSource();
+ if (eventSource == null) {
+ return;
+ }
+
+ this._prepareForPainting();
+
+ var eventTheme = this._params.theme.event;
+ var metrics = {
+ trackOffset: eventTheme.overviewTrack.offset,
+ trackHeight: eventTheme.overviewTrack.height,
+ trackGap: eventTheme.overviewTrack.gap,
+ trackIncrement: eventTheme.overviewTrack.height + eventTheme.overviewTrack.gap
+ }
+
+ var minDate = this._band.getMinDate();
+ var maxDate = this._band.getMaxDate();
+
+ var filterMatcher = (this._filterMatcher != null) ?
+ this._filterMatcher :
+ function(evt) { return true; };
+ var highlightMatcher = (this._highlightMatcher != null) ?
+ this._highlightMatcher :
+ function(evt) { return -1; };
+
+ var iterator = eventSource.getEventReverseIterator(minDate, maxDate);
+ while (iterator.hasNext()) {
+ var evt = iterator.next();
+ if (filterMatcher(evt)) {
+ this.paintEvent(evt, metrics, this._params.theme, highlightMatcher(evt));
+ }
+ }
+
+ this._highlightLayer.style.display = "block";
+ this._eventLayer.style.display = "block";
+};
+
+Timeline.OverviewEventPainter.prototype.softPaint = function() {
+};
+
+Timeline.OverviewEventPainter.prototype._prepareForPainting = function() {
+ var band = this._band;
+
+ this._tracks = [];
+
+ if (this._highlightLayer != null) {
+ band.removeLayerDiv(this._highlightLayer);
+ }
+ this._highlightLayer = band.createLayerDiv(105, "timeline-band-highlights");
+ this._highlightLayer.style.display = "none";
+
+ if (this._eventLayer != null) {
+ band.removeLayerDiv(this._eventLayer);
+ }
+ this._eventLayer = band.createLayerDiv(110, "timeline-band-events");
+ this._eventLayer.style.display = "none";
+};
+
+Timeline.OverviewEventPainter.prototype.paintEvent = function(evt, metrics, theme, highlightIndex) {
+ if (evt.isInstant()) {
+ this.paintInstantEvent(evt, metrics, theme, highlightIndex);
+ } else {
+ this.paintDurationEvent(evt, metrics, theme, highlightIndex);
+ }
+};
+
+Timeline.OverviewEventPainter.prototype.paintInstantEvent = function(evt, metrics, theme, highlightIndex) {
+ var startDate = evt.getStart();
+ var startPixel = Math.round(this._band.dateToPixelOffset(startDate));
+
+ var color = evt.getColor();
+ color = color != null ? color : theme.event.duration.color;
+
+ var tickElmtData = this._paintEventTick(evt, startPixel, color, 100, metrics, theme);
+
+ this._createHighlightDiv(highlightIndex, tickElmtData, theme);
+};
+
+Timeline.OverviewEventPainter.prototype.paintDurationEvent = function(evt, metrics, theme, highlightIndex) {
+ var latestStartDate = evt.getLatestStart();
+ var earliestEndDate = evt.getEarliestEnd();
+
+ var latestStartPixel = Math.round(this._band.dateToPixelOffset(latestStartDate));
+ var earliestEndPixel = Math.round(this._band.dateToPixelOffset(earliestEndDate));
+
+ var tapeTrack = 0;
+ for (; tapeTrack < this._tracks.length; tapeTrack++) {
+ if (earliestEndPixel < this._tracks[tapeTrack]) {
+ break;
+ }
+ }
+ this._tracks[tapeTrack] = earliestEndPixel;
+
+ var color = evt.getColor();
+ color = color != null ? color : theme.event.duration.color;
+
+ var tapeElmtData = this._paintEventTape(evt, tapeTrack, latestStartPixel, earliestEndPixel, color, 100, metrics, theme);
+
+ this._createHighlightDiv(highlightIndex, tapeElmtData, theme);
+};
+
+Timeline.OverviewEventPainter.prototype._paintEventTape = function(
+ evt, track, left, right, color, opacity, metrics, theme) {
+
+ var top = metrics.trackOffset + track * metrics.trackIncrement;
+ var width = right - left;
+ var height = metrics.trackHeight;
+
+ var tapeDiv = this._timeline.getDocument().createElement("div");
+ tapeDiv.className = 'timeline-small-event-tape'
+// tapeDiv.style.position = "absolute";
+ tapeDiv.style.left = left + "px";
+ tapeDiv.style.width = width + "px";
+ tapeDiv.style.top = top + "px";
+ // tapeDiv.style.height = height + "px";
+ // tapeDiv.style.backgroundColor = color;
+ // tapeDiv.style.overflow = "hidden";
+ if(opacity<100) SimileAjax.Graphics.setOpacity(tapeDiv, opacity);
+
+ this._eventLayer.appendChild(tapeDiv);
+
+ return {
+ left: left,
+ top: top,
+ width: width,
+ height: height,
+ elmt: tapeDiv
+ };
+}
+
+Timeline.OverviewEventPainter.prototype._paintEventTick = function(
+ evt, left, color, opacity, metrics, theme) {
+
+ var height = theme.event.overviewTrack.tickHeight;
+ var top = metrics.trackOffset - height;
+ var width = 1;
+
+ var tickDiv = this._timeline.getDocument().createElement("div");
+ tickDiv.className = 'timeline-small-event-icon'
+// tickDiv.style.position = "absolute";
+ tickDiv.style.left = left + "px";
+ // tickDiv.style.width = width + "px";
+ tickDiv.style.top = top + "px";
+ // tickDiv.style.height = height + "px";
+// tickDiv.style.backgroundColor = color;
+// tickDiv.style.overflow = "hidden";
+
+ var classname = evt.getClassName()
+ if(classname) tickDiv.className +=' small-' + classname;
+
+
+ if(opacity<100) SimileAjax.Graphics.setOpacity(tickDiv, opacity);
+
+ this._eventLayer.appendChild(tickDiv);
+
+ return {
+ left: left,
+ top: top,
+ width: width,
+ height: height,
+ elmt: tickDiv
+ };
+}
+
+Timeline.OverviewEventPainter.prototype._createHighlightDiv = function(highlightIndex, dimensions, theme) {
+ if (highlightIndex >= 0) {
+ var doc = this._timeline.getDocument();
+ var eventTheme = theme.event;
+
+ var color = eventTheme.highlightColors[Math.min(highlightIndex, eventTheme.highlightColors.length - 1)];
+
+ var div = doc.createElement("div");
+ div.style.position = "absolute";
+ div.style.overflow = "hidden";
+ div.style.left = (dimensions.left - 1) + "px";
+ div.style.width = (dimensions.width + 2) + "px";
+ div.style.top = (dimensions.top - 1) + "px";
+ div.style.height = (dimensions.height + 2) + "px";
+ div.style.background = color;
+
+ this._highlightLayer.appendChild(div);
+ }
+};
+
+Timeline.OverviewEventPainter.prototype.showBubble = function(evt) {
+ // not implemented
+};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/sources.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/sources.js
new file mode 100644
index 0000000..9cddd2d
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/sources.js
@@ -0,0 +1,446 @@
+/*==================================================
+ * Default Event Source
+ *==================================================
+ */
+
+
+Timeline.DefaultEventSource = function(eventIndex) {
+ this._events = (eventIndex instanceof Object) ? eventIndex : new SimileAjax.EventIndex();
+ this._listeners = [];
+};
+
+Timeline.DefaultEventSource.prototype.addListener = function(listener) {
+ this._listeners.push(listener);
+};
+
+Timeline.DefaultEventSource.prototype.removeListener = function(listener) {
+ for (var i = 0; i < this._listeners.length; i++) {
+ if (this._listeners[i] == listener) {
+ this._listeners.splice(i, 1);
+ break;
+ }
+ }
+};
+
+Timeline.DefaultEventSource.prototype.loadXML = function(xml, url) {
+ var base = this._getBaseURL(url);
+
+ var wikiURL = xml.documentElement.getAttribute("wiki-url");
+ var wikiSection = xml.documentElement.getAttribute("wiki-section");
+
+ var dateTimeFormat = xml.documentElement.getAttribute("date-time-format");
+ var parseDateTimeFunction = this._events.getUnit().getParser(dateTimeFormat);
+
+ var node = xml.documentElement.firstChild;
+ var added = false;
+ while (node != null) {
+ if (node.nodeType == 1) {
+ var description = "";
+ if (node.firstChild != null && node.firstChild.nodeType == 3) {
+ description = node.firstChild.nodeValue;
+ }
+ var evt = new Timeline.DefaultEventSource.Event(
+ node.getAttribute("id"),
+ parseDateTimeFunction(node.getAttribute("start")),
+ parseDateTimeFunction(node.getAttribute("end")),
+ parseDateTimeFunction(node.getAttribute("latestStart")),
+ parseDateTimeFunction(node.getAttribute("earliestEnd")),
+ node.getAttribute("isDuration") != "true",
+ node.getAttribute("title"),
+ description,
+ this._resolveRelativeURL(node.getAttribute("image"), base),
+ this._resolveRelativeURL(node.getAttribute("link"), base),
+ this._resolveRelativeURL(node.getAttribute("icon"), base),
+ node.getAttribute("color"),
+ node.getAttribute("textColor"),
+ node.getAttribute("classname")
+ );
+
+ evt._node = node;
+ evt.getProperty = function(name) {
+ return this._node.getAttribute(name);
+ };
+ evt.setWikiInfo(wikiURL, wikiSection);
+
+ this._events.add(evt);
+
+ added = true;
+ }
+ node = node.nextSibling;
+ }
+
+ if (added) {
+ this._fire("onAddMany", []);
+ }
+};
+
+
+Timeline.DefaultEventSource.prototype.loadJSON = function(data, url) {
+ var base = this._getBaseURL(url);
+ var added = false;
+ if (data && data.events){
+ var wikiURL = ("wikiURL" in data) ? data.wikiURL : null;
+ var wikiSection = ("wikiSection" in data) ? data.wikiSection : null;
+
+ var dateTimeFormat = ("dateTimeFormat" in data) ? data.dateTimeFormat : null;
+ var parseDateTimeFunction = this._events.getUnit().getParser(dateTimeFormat);
+
+ for (var i=0; i < data.events.length; i++){
+ var event = data.events[i];
+ var evt = new Timeline.DefaultEventSource.Event(
+ ("id" in event) ? event.id : undefined,
+ parseDateTimeFunction(event.start),
+ parseDateTimeFunction(event.end),
+ parseDateTimeFunction(event.latestStart),
+ parseDateTimeFunction(event.earliestEnd),
+ event.isDuration || false,
+ event.title,
+ event.description,
+ this._resolveRelativeURL(event.image, base),
+ this._resolveRelativeURL(event.link, base),
+ this._resolveRelativeURL(event.icon, base),
+ event.color,
+ event.textColor,
+ event.classname
+ );
+ evt._obj = event;
+ evt.getProperty = function(name) {
+ return this._obj[name];
+ };
+ evt.setWikiInfo(wikiURL, wikiSection);
+
+ this._events.add(evt);
+ added = true;
+ }
+ }
+
+ if (added) {
+ this._fire("onAddMany", []);
+ }
+};
+
+/*
+ * Contributed by Morten Frederiksen, http://www.wasab.dk/morten/
+ */
+Timeline.DefaultEventSource.prototype.loadSPARQL = function(xml, url) {
+ var base = this._getBaseURL(url);
+
+ var dateTimeFormat = 'iso8601';
+ var parseDateTimeFunction = this._events.getUnit().getParser(dateTimeFormat);
+
+ if (xml == null) {
+ return;
+ }
+
+ /*
+ * Find <results> tag
+ */
+ var node = xml.documentElement.firstChild;
+ while (node != null && (node.nodeType != 1 || node.nodeName != 'results')) {
+ node = node.nextSibling;
+ }
+
+ var wikiURL = null;
+ var wikiSection = null;
+ if (node != null) {
+ wikiURL = node.getAttribute("wiki-url");
+ wikiSection = node.getAttribute("wiki-section");
+
+ node = node.firstChild;
+ }
+
+ var added = false;
+ while (node != null) {
+ if (node.nodeType == 1) {
+ var bindings = { };
+ var binding = node.firstChild;
+ while (binding != null) {
+ if (binding.nodeType == 1 &&
+ binding.firstChild != null &&
+ binding.firstChild.nodeType == 1 &&
+ binding.firstChild.firstChild != null &&
+ binding.firstChild.firstChild.nodeType == 3) {
+ bindings[binding.getAttribute('name')] = binding.firstChild.firstChild.nodeValue;
+ }
+ binding = binding.nextSibling;
+ }
+
+ if (bindings["start"] == null && bindings["date"] != null) {
+ bindings["start"] = bindings["date"];
+ }
+
+ var evt = new Timeline.DefaultEventSource.Event(
+ bindings["id"],
+ parseDateTimeFunction(bindings["start"]),
+ parseDateTimeFunction(bindings["end"]),
+ parseDateTimeFunction(bindings["latestStart"]),
+ parseDateTimeFunction(bindings["earliestEnd"]),
+ bindings["isDuration"] != "true",
+ bindings["title"],
+ bindings["description"],
+ this._resolveRelativeURL(bindings["image"], base),
+ this._resolveRelativeURL(bindings["link"], base),
+ this._resolveRelativeURL(bindings["icon"], base),
+ bindings["color"],
+ bindings["textColor"],
+ bindings["classname"]
+ );
+ evt._bindings = bindings;
+ evt.getProperty = function(name) {
+ return this._bindings[name];
+ };
+ evt.setWikiInfo(wikiURL, wikiSection);
+
+ this._events.add(evt);
+ added = true;
+ }
+ node = node.nextSibling;
+ }
+
+ if (added) {
+ this._fire("onAddMany", []);
+ }
+};
+
+Timeline.DefaultEventSource.prototype.add = function(evt) {
+ this._events.add(evt);
+ this._fire("onAddOne", [evt]);
+};
+
+Timeline.DefaultEventSource.prototype.addMany = function(events) {
+ for (var i = 0; i < events.length; i++) {
+ this._events.add(events[i]);
+ }
+ this._fire("onAddMany", []);
+};
+
+Timeline.DefaultEventSource.prototype.clear = function() {
+ this._events.removeAll();
+ this._fire("onClear", []);
+};
+
+Timeline.DefaultEventSource.prototype.getEvent = function(id) {
+ return this._events.getEvent(id);
+};
+
+Timeline.DefaultEventSource.prototype.getEventIterator = function(startDate, endDate) {
+ return this._events.getIterator(startDate, endDate);
+};
+
+Timeline.DefaultEventSource.prototype.getEventReverseIterator = function(startDate, endDate) {
+ return this._events.getReverseIterator(startDate, endDate);
+};
+
+Timeline.DefaultEventSource.prototype.getAllEventIterator = function() {
+ return this._events.getAllIterator();
+};
+
+Timeline.DefaultEventSource.prototype.getCount = function() {
+ return this._events.getCount();
+};
+
+Timeline.DefaultEventSource.prototype.getEarliestDate = function() {
+ return this._events.getEarliestDate();
+};
+
+Timeline.DefaultEventSource.prototype.getLatestDate = function() {
+ return this._events.getLatestDate();
+};
+
+Timeline.DefaultEventSource.prototype._fire = function(handlerName, args) {
+ for (var i = 0; i < this._listeners.length; i++) {
+ var listener = this._listeners[i];
+ if (handlerName in listener) {
+ try {
+ listener[handlerName].apply(listener, args);
+ } catch (e) {
+ SimileAjax.Debug.exception(e);
+ }
+ }
+ }
+};
+
+Timeline.DefaultEventSource.prototype._getBaseURL = function(url) {
+ if (url.indexOf("://") < 0) {
+ var url2 = this._getBaseURL(document.location.href);
+ if (url.substr(0,1) == "/") {
+ url = url2.substr(0, url2.indexOf("/", url2.indexOf("://") + 3)) + url;
+ } else {
+ url = url2 + url;
+ }
+ }
+
+ var i = url.lastIndexOf("/");
+ if (i < 0) {
+ return "";
+ } else {
+ return url.substr(0, i+1);
+ }
+};
+
+Timeline.DefaultEventSource.prototype._resolveRelativeURL = function(url, base) {
+ if (url == null || url == "") {
+ return url;
+ } else if (url.indexOf("://") > 0) {
+ return url;
+ } else if (url.substr(0,1) == "/") {
+ return base.substr(0, base.indexOf("/", base.indexOf("://") + 3)) + url;
+ } else {
+ return base + url;
+ }
+};
+
+
+Timeline.DefaultEventSource.Event = function(
+ id,
+ start, end, latestStart, earliestEnd, instant,
+ text, description, image, link,
+ icon, color, textColor, hoverText, classname) {
+
+ id = (id) ? id.trim() : "";
+ this._id = id.length > 0 ? id : ("e" + Math.floor(Math.random() * 1000000));
+
+ this._instant = instant || (end == null);
+
+ this._start = start;
+ this._end = (end != null) ? end : start;
+
+ this._latestStart = (latestStart != null) ? latestStart : (instant ? this._end : this._start);
+ this._earliestEnd = (earliestEnd != null) ? earliestEnd : (instant ? this._start : this._end);
+
+ this._text = SimileAjax.HTML.deEntify(text);
+ this._description = SimileAjax.HTML.deEntify(description);
+ this._image = (image != null && image != "") ? image : null;
+ this._link = (link != null && link != "") ? link : null;
+ this._title = (hoverText != null) ? hoverText : null;
+
+ this._icon = (icon != null && icon != "") ? icon : null;
+ this._color = (color != null && color != "") ? color : null;
+ this._textColor = (textColor != null && textColor != "") ? textColor : null;
+ this._classname = (classname != null && classname != "") ? classname : null;
+
+ this._wikiURL = null;
+ this._wikiSection = null;
+};
+
+Timeline.DefaultEventSource.Event.prototype = {
+ getID: function() { return this._id; },
+
+ isInstant: function() { return this._instant; },
+ isImprecise: function() { return this._start != this._latestStart || this._end != this._earliestEnd; },
+
+ getStart: function() { return this._start; },
+ getEnd: function() { return this._end; },
+ getLatestStart: function() { return this._latestStart; },
+ getEarliestEnd: function() { return this._earliestEnd; },
+
+ getText: function() { return this._text; },
+ getDescription: function() { return this._description; },
+ getImage: function() { return this._image; },
+ getLink: function() { return this._link; },
+
+ getIcon: function() { return this._icon; },
+ getColor: function() { return this._color; },
+ getTextColor: function() { return this._textColor; },
+ getClassName: function() {return this._classname; },
+
+ getProperty: function(name) { return null; },
+
+ getWikiURL: function() { return this._wikiURL; },
+ getWikiSection: function() { return this._wikiSection; },
+ setWikiInfo: function(wikiURL, wikiSection) {
+ this._wikiURL = wikiURL;
+ this._wikiSection = wikiSection;
+ },
+
+ fillDescription: function(elmt) {
+ elmt.innerHTML = this._description;
+ },
+ fillWikiInfo: function(elmt) {
+ if (this._wikiURL != null && this._wikiSection != null) {
+ var wikiID = this.getProperty("wikiID");
+ if (wikiID == null || wikiID.length == 0) {
+ wikiID = this.getText();
+ }
+ wikiID = wikiID.replace(/\s/g, "_");
+
+ var url = this._wikiURL + this._wikiSection.replace(/\s/g, "_") + "/" + wikiID;
+ var a = document.createElement("a");
+ a.href = url;
+ a.target = "new";
+ a.innerHTML = Timeline.strings[Timeline.clientLocale].wikiLinkLabel;
+
+ elmt.appendChild(document.createTextNode("["));
+ elmt.appendChild(a);
+ elmt.appendChild(document.createTextNode("]"));
+ } else {
+ elmt.style.display = "none";
+ }
+ },
+ fillTime: function(elmt, labeller) {
+ if (this._instant) {
+ if (this.isImprecise()) {
+ elmt.appendChild(elmt.ownerDocument.createTextNode(labeller.labelPrecise(this._start)));
+ elmt.appendChild(elmt.ownerDocument.createElement("br"));
+ elmt.appendChild(elmt.ownerDocument.createTextNode(labeller.labelPrecise(this._end)));
+ } else {
+ elmt.appendChild(elmt.ownerDocument.createTextNode(labeller.labelPrecise(this._start)));
+ }
+ } else {
+ if (this.isImprecise()) {
+ elmt.appendChild(elmt.ownerDocument.createTextNode(
+ labeller.labelPrecise(this._start) + " ~ " + labeller.labelPrecise(this._latestStart)));
+ elmt.appendChild(elmt.ownerDocument.createElement("br"));
+ elmt.appendChild(elmt.ownerDocument.createTextNode(
+ labeller.labelPrecise(this._earliestEnd) + " ~ " + labeller.labelPrecise(this._end)));
+ } else {
+ elmt.appendChild(elmt.ownerDocument.createTextNode(labeller.labelPrecise(this._start)));
+ elmt.appendChild(elmt.ownerDocument.createElement("br"));
+ elmt.appendChild(elmt.ownerDocument.createTextNode(labeller.labelPrecise(this._end)));
+ }
+ }
+ },
+ fillInfoBubble: function(elmt, theme, labeller) {
+ var doc = elmt.ownerDocument;
+
+ var title = this.getText();
+ var link = this.getLink();
+ var image = this.getImage();
+
+ if (image != null) {
+ var img = doc.createElement("img");
+ img.src = image;
+
+ theme.event.bubble.imageStyler(img);
+ elmt.appendChild(img);
+ }
+
+ var divTitle = doc.createElement("div");
+ var textTitle = doc.createTextNode(title);
+ if (link != null) {
+ var a = doc.createElement("a");
+ a.href = link;
+ a.appendChild(textTitle);
+ divTitle.appendChild(a);
+ } else {
+ divTitle.appendChild(textTitle);
+ }
+ theme.event.bubble.titleStyler(divTitle);
+ elmt.appendChild(divTitle);
+
+ var divBody = doc.createElement("div");
+ this.fillDescription(divBody);
+ theme.event.bubble.bodyStyler(divBody);
+ elmt.appendChild(divBody);
+
+ var divTime = doc.createElement("div");
+ this.fillTime(divTime, labeller);
+ theme.event.bubble.timeStyler(divTime);
+ elmt.appendChild(divTime);
+
+ var divWiki = doc.createElement("div");
+ this.fillWikiInfo(divWiki);
+ theme.event.bubble.wikiStyler(divWiki);
+ elmt.appendChild(divWiki);
+ }
+};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/themes.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/themes.js
new file mode 100644
index 0000000..f196f53
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/themes.js
@@ -0,0 +1,145 @@
+/*==================================================
+ * Classic Theme
+ *==================================================
+ */
+
+
+
+Timeline.ClassicTheme = new Object();
+
+Timeline.ClassicTheme.implementations = [];
+
+Timeline.ClassicTheme.create = function(locale) {
+ if (locale == null) {
+ locale = Timeline.getDefaultLocale();
+ }
+
+ var f = Timeline.ClassicTheme.implementations[locale];
+ if (f == null) {
+ f = Timeline.ClassicTheme._Impl;
+ }
+ return new f();
+};
+
+Timeline.ClassicTheme._Impl = function() {
+ this.firstDayOfWeek = 0; // Sunday
+
+ this.ether = {
+ backgroundColors: [
+ // "#EEE",
+ // "#DDD",
+ // "#CCC",
+ // "#AAA"
+ ],
+ // highlightColor: "white",
+ highlightOpacity: 50,
+ interval: {
+ line: {
+ show: true,
+ // color: "#aaa",
+ opacity: 25
+ },
+ weekend: {
+ // color: "#FFFFE0",
+ opacity: 30
+ },
+ marker: {
+ hAlign: "Bottom",
+ /*
+ hBottomStyler: function(elmt) {
+ elmt.className = "timeline-ether-marker-bottom";
+ },
+ hBottomEmphasizedStyler: function(elmt) {
+ elmt.className = "timeline-ether-marker-bottom-emphasized";
+ },
+ hTopStyler: function(elmt) {
+ elmt.className = "timeline-ether-marker-top";
+ },
+ hTopEmphasizedStyler: function(elmt) {
+ elmt.className = "timeline-ether-marker-top-emphasized";
+ },
+ */
+
+
+ vAlign: "Right"
+ /*
+ vRightStyler: function(elmt) {
+ elmt.className = "timeline-ether-marker-right";
+ },
+ vRightEmphasizedStyler: function(elmt) {
+ elmt.className = "timeline-ether-marker-right-emphasized";
+ },
+ vLeftStyler: function(elmt) {
+ elmt.className = "timeline-ether-marker-left";
+ },
+ vLeftEmphasizedStyler:function(elmt) {
+ elmt.className = "timeline-ether-marker-left-emphasized";
+ }
+ */
+ }
+ }
+ };
+
+ this.event = {
+ track: {
+ height: 10, // px
+ gap: 2 // px
+ },
+ overviewTrack: {
+ offset: 20, // px
+ tickHeight: 6, // px
+ height: 2, // px
+ gap: 1 // px
+ },
+ tape: {
+ height: 4 // px
+ },
+ instant: {
+ icon: Timeline.urlPrefix + "images/dull-blue-circle.png",
+ iconWidth: 20, // GH: Had to make this larger to support our grouped icons
+ iconHeight: 10,
+ // color: "#58A0DC",
+ // impreciseColor: "#58A0DC",
+ impreciseOpacity: 20
+ },
+ duration: {
+ // color: "#58A0DC",
+ // impreciseColor: "#58A0DC",
+ impreciseOpacity: 20
+ },
+ label: {
+ // backgroundColor: "white",
+ backgroundOpacity: 50,
+ // lineColor: "#58A0DC",
+ width: 200,
+ offsetFromLine: 3 // px
+ },
+ highlightColors: [
+ // "#FFFF00",
+ // "#FFC000",
+ // "#FF0000",
+ // "#0000FF"
+ ],
+ bubble: {
+ width: 250, // px
+ height: 125, // px
+ titleStyler: function(elmt) {
+ elmt.className = "timeline-event-bubble-title";
+ },
+ bodyStyler: function(elmt) {
+ elmt.className = "timeline-event-bubble-body";
+ },
+ imageStyler: function(elmt) {
+ elmt.className = "timeline-event-bubble-image";
+ },
+ wikiStyler: function(elmt) {
+ elmt.className = "timeline-event-bubble-wiki";
+ },
+ timeStyler: function(elmt) {
+ elmt.className = "timeline-event-bubble-time";
+ }
+ }
+ };
+
+ this.zoom = true; // true or false
+};
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/timeline.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/timeline.js
new file mode 100644
index 0000000..9f3e8f0
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/timeline.js
@@ -0,0 +1,1040 @@
+/*==================================================
+ * Timeline
+ *==================================================
+ */
+
+Timeline.strings = {}; // localization string tables
+
+Timeline.getDefaultLocale = function() {
+ return Timeline.clientLocale;
+};
+
+Timeline.create = function(elmt, bandInfos, orientation, unit) {
+ return new Timeline._Impl(elmt, bandInfos, orientation, unit);
+};
+
+Timeline.HORIZONTAL = 0;
+Timeline.VERTICAL = 1;
+
+Timeline._defaultTheme = null;
+
+Timeline.createBandInfo = function(params) {
+ var theme = ("theme" in params) ? params.theme : Timeline.getDefaultTheme();
+
+ var eventSource = ("eventSource" in params) ? params.eventSource : null;
+
+ var ether = new Timeline.LinearEther({
+ centersOn: ("date" in params) ? params.date : new Date(),
+ interval: SimileAjax.DateTime.gregorianUnitLengths[params.intervalUnit],
+ pixelsPerInterval: params.intervalPixels,
+ theme: theme
+ });
+
+ var etherPainter = new Timeline.GregorianEtherPainter({
+ unit: params.intervalUnit,
+ multiple: ("multiple" in params) ? params.multiple : 1,
+ theme: theme,
+ align: ("align" in params) ? params.align : undefined
+ });
+
+ var eventPainterParams = {
+ showText: ("showEventText" in params) ? params.showEventText : false,
+ theme: theme
+ };
+ // pass in custom parameters for the event painter
+ if ("eventPainterParams" in params) {
+ for (var prop in params.eventPainterParams) {
+ eventPainterParams[prop] = params.eventPainterParams[prop];
+ }
+ }
+
+ if ("trackHeight" in params) {
+ eventPainterParams.trackHeight = params.trackHeight;
+ }
+ if ("trackGap" in params) {
+ eventPainterParams.trackGap = params.trackGap;
+ }
+
+ var layout = ("overview" in params && params.overview) ? "overview" : ("layout" in params ? params.layout : "original");
+ var eventPainter;
+ if ("eventPainter" in params) {
+ eventPainter = new params.eventPainter(eventPainterParams);
+ } else {
+ switch (layout) {
+ case "overview" :
+ eventPainter = new Timeline.OverviewEventPainter(eventPainterParams);
+ break;
+ case "detailed" :
+ eventPainter = new Timeline.DetailedEventPainter(eventPainterParams);
+ break;
+ default:
+ eventPainter = new Timeline.OriginalEventPainter(eventPainterParams);
+ }
+ }
+
+ return {
+ width: params.width,
+ eventSource: eventSource,
+ timeZone: ("timeZone" in params) ? params.timeZone : 0,
+ ether: ether,
+ etherPainter: etherPainter,
+ eventPainter: eventPainter,
+ theme: theme,
+ zoomIndex: ("zoomIndex" in params) ? params.zoomIndex : 0,
+ zoomSteps: ("zoomSteps" in params) ? params.zoomSteps : null
+ };
+};
+
+Timeline.createHotZoneBandInfo = function(params) {
+ var theme = ("theme" in params) ? params.theme : Timeline.getDefaultTheme();
+
+ var eventSource = ("eventSource" in params) ? params.eventSource : null;
+
+ var ether = new Timeline.HotZoneEther({
+ centersOn: ("date" in params) ? params.date : new Date(),
+ interval: SimileAjax.DateTime.gregorianUnitLengths[params.intervalUnit],
+ pixelsPerInterval: params.intervalPixels,
+ zones: params.zones,
+ theme: theme
+ });
+
+ var etherPainter = new Timeline.HotZoneGregorianEtherPainter({
+ unit: params.intervalUnit,
+ zones: params.zones,
+ theme: theme,
+ align: ("align" in params) ? params.align : undefined
+ });
+
+ var eventPainterParams = {
+ showText: ("showEventText" in params) ? params.showEventText : true,
+ theme: theme
+ };
+ // pass in custom parameters for the event painter
+ if ("eventPainterParams" in params) {
+ for (var prop in params.eventPainterParams) {
+ eventPainterParams[prop] = params.eventPainterParams[prop];
+ }
+ }
+ if ("trackHeight" in params) {
+ eventPainterParams.trackHeight = params.trackHeight;
+ }
+ if ("trackGap" in params) {
+ eventPainterParams.trackGap = params.trackGap;
+ }
+
+ var layout = ("overview" in params && params.overview) ? "overview" : ("layout" in params ? params.layout : "original");
+ var eventPainter;
+ if ("eventPainter" in params) {
+ eventPainter = new params.eventPainter(eventPainterParams);
+ } else {
+ switch (layout) {
+ case "overview" :
+ eventPainter = new Timeline.OverviewEventPainter(eventPainterParams);
+ break;
+ case "detailed" :
+ eventPainter = new Timeline.DetailedEventPainter(eventPainterParams);
+ break;
+ default:
+ eventPainter = new Timeline.OriginalEventPainter(eventPainterParams);
+ }
+ }
+ return {
+ width: params.width,
+ eventSource: eventSource,
+ timeZone: ("timeZone" in params) ? params.timeZone : 0,
+ ether: ether,
+ etherPainter: etherPainter,
+ eventPainter: eventPainter,
+ theme: theme,
+ zoomIndex: ("zoomIndex" in params) ? params.zoomIndex : 0,
+ zoomSteps: ("zoomSteps" in params) ? params.zoomSteps : null
+ };
+};
+
+Timeline.getDefaultTheme = function() {
+ if (Timeline._defaultTheme == null) {
+ Timeline._defaultTheme = Timeline.ClassicTheme.create(Timeline.getDefaultLocale());
+ }
+ return Timeline._defaultTheme;
+};
+
+Timeline.setDefaultTheme = function(theme) {
+ Timeline._defaultTheme = theme;
+};
+
+Timeline.loadXML = function(url, f) {
+ var fError = function(statusText, status, xmlhttp) {
+ alert("Failed to load data xml from " + url + "\n" + statusText);
+ };
+ var fDone = function(xmlhttp) {
+ var xml = xmlhttp.responseXML;
+ if (!xml.documentElement && xmlhttp.responseStream) {
+ xml.load(xmlhttp.responseStream);
+ }
+ f(xml, url);
+ };
+ SimileAjax.XmlHttp.get(url, fError, fDone);
+};
+
+
+Timeline.loadJSON = function(url, f) {
+ var fError = function(statusText, status, xmlhttp) {
+ alert("Failed to load json data from " + url + "\n" + statusText);
+ };
+ var fDone = function(xmlhttp) {
+ f(eval('(' + xmlhttp.responseText + ')'), url);
+ };
+ SimileAjax.XmlHttp.get(url, fError, fDone);
+};
+
+
+Timeline._Impl = function(elmt, bandInfos, orientation, unit) {
+ SimileAjax.WindowManager.initialize();
+
+ this._containerDiv = elmt;
+
+ this._bandInfos = bandInfos;
+ this._orientation = orientation == null ? Timeline.HORIZONTAL : orientation;
+ this._unit = (unit != null) ? unit : SimileAjax.NativeDateUnit;
+
+ this._initialize();
+};
+
+Timeline._Impl.prototype.dispose = function() {
+ for (var i = 0; i < this._bands.length; i++) {
+ this._bands[i].dispose();
+ }
+ this._bands = null;
+ this._bandInfos = null;
+ this._containerDiv.innerHTML = "";
+};
+
+Timeline._Impl.prototype.getBandCount = function() {
+ return this._bands.length;
+};
+
+Timeline._Impl.prototype.getBand = function(index) {
+ return this._bands[index];
+};
+
+Timeline._Impl.prototype.layout = function() {
+ this._distributeWidths();
+};
+
+Timeline._Impl.prototype.paint = function() {
+ for (var i = 0; i < this._bands.length; i++) {
+ this._bands[i].paint();
+ }
+};
+
+Timeline._Impl.prototype.getDocument = function() {
+ return this._containerDiv.ownerDocument;
+};
+
+Timeline._Impl.prototype.addDiv = function(div) {
+ this._containerDiv.appendChild(div);
+};
+
+Timeline._Impl.prototype.removeDiv = function(div) {
+ this._containerDiv.removeChild(div);
+};
+
+Timeline._Impl.prototype.isHorizontal = function() {
+ return this._orientation == Timeline.HORIZONTAL;
+};
+
+Timeline._Impl.prototype.isVertical = function() {
+ return this._orientation == Timeline.VERTICAL;
+};
+
+Timeline._Impl.prototype.getPixelLength = function() {
+ return this._orientation == Timeline.HORIZONTAL ?
+ this._containerDiv.offsetWidth : this._containerDiv.offsetHeight;
+};
+
+Timeline._Impl.prototype.getPixelWidth = function() {
+ return this._orientation == Timeline.VERTICAL ?
+ this._containerDiv.offsetWidth : this._containerDiv.offsetHeight;
+};
+
+Timeline._Impl.prototype.getUnit = function() {
+ return this._unit;
+};
+
+Timeline._Impl.prototype.loadXML = function(url, f) {
+ var tl = this;
+
+
+ var fError = function(statusText, status, xmlhttp) {
+ alert("Failed to load data xml from " + url + "\n" + statusText);
+ tl.hideLoadingMessage();
+ };
+ var fDone = function(xmlhttp) {
+ try {
+ var xml = xmlhttp.responseXML;
+ if (!xml.documentElement && xmlhttp.responseStream) {
+ xml.load(xmlhttp.responseStream);
+ }
+ f(xml, url);
+ } finally {
+ tl.hideLoadingMessage();
+ }
+ };
+
+ this.showLoadingMessage();
+ window.setTimeout(function() { SimileAjax.XmlHttp.get(url, fError, fDone); }, 0);
+};
+
+Timeline._Impl.prototype.loadJSON = function(url, f) {
+ var tl = this;
+
+
+ var fError = function(statusText, status, xmlhttp) {
+ alert("Failed to load json data from " + url + "\n" + statusText);
+ tl.hideLoadingMessage();
+ };
+ var fDone = function(xmlhttp) {
+ try {
+ f(eval('(' + xmlhttp.responseText + ')'), url);
+ } finally {
+ tl.hideLoadingMessage();
+ }
+ };
+
+ this.showLoadingMessage();
+ window.setTimeout(function() { SimileAjax.XmlHttp.get(url, fError, fDone); }, 0);
+};
+
+Timeline._Impl.prototype._initialize = function() {
+ var containerDiv = this._containerDiv;
+ var doc = containerDiv.ownerDocument;
+
+ containerDiv.className =
+ containerDiv.className.split(" ").concat("timeline-container").join(" ");
+
+ /*
+ * Set css-class on container div that will define orientation
+ */
+ var orientation = (this.isHorizontal()) ? 'horizontal' : 'vertical'
+ containerDiv.className +=' timeline-'+orientation;
+
+
+ while (containerDiv.firstChild) {
+ containerDiv.removeChild(containerDiv.firstChild);
+ }
+
+ /*
+ * inserting copyright and link to simile
+ */
+ var elmtCopyright = SimileAjax.Graphics.createTranslucentImage(Timeline.urlPrefix + (this.isHorizontal() ? "images/copyright-vertical.png" : "images/copyright.png"));
+ elmtCopyright.className = "timeline-copyright";
+ elmtCopyright.title = "Timeline (c) SIMILE - http://simile.mit.edu/timeline/";
+ SimileAjax.DOM.registerEvent(elmtCopyright, "click", function() {
+ window.open('http://simile.mit.edu/timeline/',
+ 'Timeline (c) SIMILE',
+ 'width=800,height=600,toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,left=0,top=100,screenX=0,screenY=100');
+ });
+ containerDiv.appendChild(elmtCopyright);
+
+ /*
+ * creating bands
+ */
+ this._bands = [];
+ for (var i = 0; i < this._bandInfos.length; i++) {
+ var band = new Timeline._Band(this, this._bandInfos[i], i);
+ this._bands.push(band);
+ }
+ this._distributeWidths();
+
+ /*
+ * sync'ing bands
+ */
+ for (var i = 0; i < this._bandInfos.length; i++) {
+ var bandInfo = this._bandInfos[i];
+ if ("syncWith" in bandInfo) {
+ this._bands[i].setSyncWithBand(
+ this._bands[bandInfo.syncWith],
+ ("highlight" in bandInfo) ? bandInfo.highlight : false
+ );
+ }
+ }
+
+ /*
+ * creating loading UI
+ */
+ var message = SimileAjax.Graphics.createMessageBubble(doc);
+ message.containerDiv.className = "timeline-message-container";
+ containerDiv.appendChild(message.containerDiv);
+
+ message.contentDiv.className = "timeline-message";
+ message.contentDiv.innerHTML = "<img src='" + Timeline.urlPrefix + "images/progress-running.gif' /> Loading...";
+
+ this.showLoadingMessage = function() { message.containerDiv.style.display = "block"; };
+ this.hideLoadingMessage = function() { message.containerDiv.style.display = "none"; };
+};
+
+Timeline._Impl.prototype._distributeWidths = function() {
+ var length = this.getPixelLength();
+ var width = this.getPixelWidth();
+ var cumulativeWidth = 0;
+
+ for (var i = 0; i < this._bands.length; i++) {
+ var band = this._bands[i];
+ var bandInfos = this._bandInfos[i];
+ var widthString = bandInfos.width;
+
+ var x = widthString.indexOf("%");
+ if (x > 0) {
+ var percent = parseInt(widthString.substr(0, x));
+ var bandWidth = percent * width / 100;
+ } else {
+ var bandWidth = parseInt(widthString);
+ }
+
+ band.setBandShiftAndWidth(cumulativeWidth, bandWidth);
+ band.setViewLength(length);
+
+ cumulativeWidth += bandWidth;
+ }
+};
+
+Timeline._Impl.prototype.zoom = function (zoomIn, x, y, target) {
+ var matcher = new RegExp("^timeline-band-([0-9]+)$");
+ var bandIndex = null;
+
+ var result = matcher.exec(target.id);
+ if (result) {
+ bandIndex = parseInt(result[1]);
+ }
+
+ if (bandIndex != null) {
+ this._bands[bandIndex].zoom(zoomIn, x, y, target);
+ }
+
+ this.paint();
+};
+
+/*==================================================
+ * Band
+ *==================================================
+ */
+Timeline._Band = function(timeline, bandInfo, index) {
+ this._timeline = timeline;
+ this._bandInfo = bandInfo;
+ this._index = index;
+
+ this._locale = ("locale" in bandInfo) ? bandInfo.locale : Timeline.getDefaultLocale();
+ this._timeZone = ("timeZone" in bandInfo) ? bandInfo.timeZone : 0;
+ this._labeller = ("labeller" in bandInfo) ? bandInfo.labeller :
+ (("createLabeller" in timeline.getUnit()) ?
+ timeline.getUnit().createLabeller(this._locale, this._timeZone) :
+ new Timeline.GregorianDateLabeller(this._locale, this._timeZone));
+ this._theme = bandInfo.theme;
+ this._zoomIndex = ("zoomIndex" in bandInfo) ? bandInfo.zoomIndex : 0;
+ this._zoomSteps = ("zoomSteps" in bandInfo) ? bandInfo.zoomSteps : null;
+
+ this._dragging = false;
+ this._changing = false;
+ this._originalScrollSpeed = 5; // pixels
+ this._scrollSpeed = this._originalScrollSpeed;
+ this._onScrollListeners = [];
+
+ var b = this;
+ this._syncWithBand = null;
+ this._syncWithBandHandler = function(band) {
+ b._onHighlightBandScroll();
+ };
+ this._selectorListener = function(band) {
+ b._onHighlightBandScroll();
+ };
+
+ /*
+ * Install a textbox to capture keyboard events
+ */
+ var inputDiv = this._timeline.getDocument().createElement("div");
+ inputDiv.className = "timeline-band-input";
+ this._timeline.addDiv(inputDiv);
+
+ this._keyboardInput = document.createElement("input");
+ this._keyboardInput.type = "text";
+ inputDiv.appendChild(this._keyboardInput);
+ SimileAjax.DOM.registerEventWithObject(this._keyboardInput, "keydown", this, "_onKeyDown");
+ SimileAjax.DOM.registerEventWithObject(this._keyboardInput, "keyup", this, "_onKeyUp");
+
+ /*
+ * The band's outer most div that slides with respect to the timeline's div
+ */
+ this._div = this._timeline.getDocument().createElement("div");
+ this._div.id = "timeline-band-" + index;
+ this._div.className = "timeline-band timeline-band-" + index;
+ this._timeline.addDiv(this._div);
+
+ SimileAjax.DOM.registerEventWithObject(this._div, "mousedown", this, "_onMouseDown");
+ SimileAjax.DOM.registerEventWithObject(this._div, "mousemove", this, "_onMouseMove");
+ SimileAjax.DOM.registerEventWithObject(this._div, "mouseup", this, "_onMouseUp");
+ SimileAjax.DOM.registerEventWithObject(this._div, "mouseout", this, "_onMouseOut");
+ SimileAjax.DOM.registerEventWithObject(this._div, "dblclick", this, "_onDblClick");
+
+ if (SimileAjax.Platform.browser.isFirefox) {
+ SimileAjax.DOM.registerEventWithObject(this._div, "DOMMouseScroll", this, "_onMouseScroll");
+ } else {
+ SimileAjax.DOM.registerEventWithObject(this._div, "mousewheel", this, "_onMouseScroll");
+ }
+
+
+ /*
+ * The inner div that contains layers
+ */
+ this._innerDiv = this._timeline.getDocument().createElement("div");
+ this._innerDiv.className = "timeline-band-inner";
+ this._div.appendChild(this._innerDiv);
+
+ /*
+ * Initialize parts of the band
+ */
+ this._ether = bandInfo.ether;
+ bandInfo.ether.initialize(this, timeline);
+
+ this._etherPainter = bandInfo.etherPainter;
+ bandInfo.etherPainter.initialize(this, timeline);
+
+ this._eventSource = bandInfo.eventSource;
+ if (this._eventSource) {
+ this._eventListener = {
+ onAddMany: function() { b._onAddMany(); },
+ onClear: function() { b._onClear(); }
+ }
+ this._eventSource.addListener(this._eventListener);
+ }
+
+ this._eventPainter = bandInfo.eventPainter;
+ bandInfo.eventPainter.initialize(this, timeline);
+
+ this._decorators = ("decorators" in bandInfo) ? bandInfo.decorators : [];
+ for (var i = 0; i < this._decorators.length; i++) {
+ this._decorators[i].initialize(this, timeline);
+ }
+};
+
+Timeline._Band.SCROLL_MULTIPLES = 5;
+
+Timeline._Band.prototype.dispose = function() {
+ this.closeBubble();
+
+ if (this._eventSource) {
+ this._eventSource.removeListener(this._eventListener);
+ this._eventListener = null;
+ this._eventSource = null;
+ }
+
+ this._timeline = null;
+ this._bandInfo = null;
+
+ this._labeller = null;
+ this._ether = null;
+ this._etherPainter = null;
+ this._eventPainter = null;
+ this._decorators = null;
+
+ this._onScrollListeners = null;
+ this._syncWithBandHandler = null;
+ this._selectorListener = null;
+
+ this._div = null;
+ this._innerDiv = null;
+ this._keyboardInput = null;
+};
+
+Timeline._Band.prototype.addOnScrollListener = function(listener) {
+ this._onScrollListeners.push(listener);
+};
+
+Timeline._Band.prototype.removeOnScrollListener = function(listener) {
+ for (var i = 0; i < this._onScrollListeners.length; i++) {
+ if (this._onScrollListeners[i] == listener) {
+ this._onScrollListeners.splice(i, 1);
+ break;
+ }
+ }
+};
+
+Timeline._Band.prototype.setSyncWithBand = function(band, highlight) {
+ if (this._syncWithBand) {
+ this._syncWithBand.removeOnScrollListener(this._syncWithBandHandler);
+ }
+
+ this._syncWithBand = band;
+ this._syncWithBand.addOnScrollListener(this._syncWithBandHandler);
+ this._highlight = highlight;
+ this._positionHighlight();
+};
+
+Timeline._Band.prototype.getLocale = function() {
+ return this._locale;
+};
+
+Timeline._Band.prototype.getTimeZone = function() {
+ return this._timeZone;
+};
+
+Timeline._Band.prototype.getLabeller = function() {
+ return this._labeller;
+};
+
+Timeline._Band.prototype.getIndex = function() {
+ return this._index;
+};
+
+Timeline._Band.prototype.getEther = function() {
+ return this._ether;
+};
+
+Timeline._Band.prototype.getEtherPainter = function() {
+ return this._etherPainter;
+};
+
+Timeline._Band.prototype.getEventSource = function() {
+ return this._eventSource;
+};
+
+Timeline._Band.prototype.getEventPainter = function() {
+ return this._eventPainter;
+};
+
+Timeline._Band.prototype.layout = function() {
+ this.paint();
+};
+
+Timeline._Band.prototype.paint = function() {
+ this._etherPainter.paint();
+ this._paintDecorators();
+ this._paintEvents();
+};
+
+Timeline._Band.prototype.softLayout = function() {
+ this.softPaint();
+};
+
+Timeline._Band.prototype.softPaint = function() {
+ this._etherPainter.softPaint();
+ this._softPaintDecorators();
+ this._softPaintEvents();
+};
+
+Timeline._Band.prototype.setBandShiftAndWidth = function(shift, width) {
+ var inputDiv = this._keyboardInput.parentNode;
+ var middle = shift + Math.floor(width / 2);
+ if (this._timeline.isHorizontal()) {
+ this._div.style.top = shift + "px";
+ this._div.style.height = width + "px";
+
+ inputDiv.style.top = middle + "px";
+ inputDiv.style.left = "-1em";
+ } else {
+ this._div.style.left = shift + "px";
+ this._div.style.width = width + "px";
+
+ inputDiv.style.left = middle + "px";
+ inputDiv.style.top = "-1em";
+ }
+};
+
+Timeline._Band.prototype.getViewWidth = function() {
+ if (this._timeline.isHorizontal()) {
+ return this._div.offsetHeight;
+ } else {
+ return this._div.offsetWidth;
+ }
+};
+
+Timeline._Band.prototype.setViewLength = function(length) {
+ this._viewLength = length;
+ this._recenterDiv();
+ this._onChanging();
+};
+
+Timeline._Band.prototype.getViewLength = function() {
+ return this._viewLength;
+};
+
+Timeline._Band.prototype.getTotalViewLength = function() {
+ return Timeline._Band.SCROLL_MULTIPLES * this._viewLength;
+};
+
+Timeline._Band.prototype.getViewOffset = function() {
+ return this._viewOffset;
+};
+
+Timeline._Band.prototype.getMinDate = function() {
+ return this._ether.pixelOffsetToDate(this._viewOffset);
+};
+
+Timeline._Band.prototype.getMaxDate = function() {
+ return this._ether.pixelOffsetToDate(this._viewOffset + Timeline._Band.SCROLL_MULTIPLES * this._viewLength);
+};
+
+Timeline._Band.prototype.getMinVisibleDate = function() {
+ return this._ether.pixelOffsetToDate(0);
+};
+
+Timeline._Band.prototype.getMaxVisibleDate = function() {
+ return this._ether.pixelOffsetToDate(this._viewLength);
+};
+
+Timeline._Band.prototype.getCenterVisibleDate = function() {
+ return this._ether.pixelOffsetToDate(this._viewLength / 2);
+};
+
+Timeline._Band.prototype.setMinVisibleDate = function(date) {
+ if (!this._changing) {
+ this._moveEther(Math.round(-this._ether.dateToPixelOffset(date)));
+ }
+};
+
+Timeline._Band.prototype.setMaxVisibleDate = function(date) {
+ if (!this._changing) {
+ this._moveEther(Math.round(this._viewLength - this._ether.dateToPixelOffset(date)));
+ }
+};
+
+Timeline._Band.prototype.setCenterVisibleDate = function(date) {
+ if (!this._changing) {
+ this._moveEther(Math.round(this._viewLength / 2 - this._ether.dateToPixelOffset(date)));
+ }
+};
+
+Timeline._Band.prototype.dateToPixelOffset = function(date) {
+ return this._ether.dateToPixelOffset(date) - this._viewOffset;
+};
+
+Timeline._Band.prototype.pixelOffsetToDate = function(pixels) {
+ return this._ether.pixelOffsetToDate(pixels + this._viewOffset);
+};
+
+Timeline._Band.prototype.createLayerDiv = function(zIndex, className) {
+ var div = this._timeline.getDocument().createElement("div");
+ div.className = "timeline-band-layer" + (typeof className == "string" ? (" " + className) : "");
+ div.style.zIndex = zIndex;
+ this._innerDiv.appendChild(div);
+
+ var innerDiv = this._timeline.getDocument().createElement("div");
+ innerDiv.className = "timeline-band-layer-inner";
+ innerDiv.style.zIndex = zIndex;
+ if (SimileAjax.Platform.browser.isIE) {
+ innerDiv.style.cursor = "move";
+ } else {
+ innerDiv.style.cursor = "-moz-grab";
+ }
+ innerDiv.innerHTML = "";
+ div.appendChild(innerDiv);
+
+ return innerDiv;
+};
+
+Timeline._Band.prototype.removeLayerDiv = function(div) {
+ this._innerDiv.removeChild(div.parentNode);
+};
+
+Timeline._Band.prototype.scrollToCenter = function(date, f) {
+ var pixelOffset = this._ether.dateToPixelOffset(date);
+ if (pixelOffset < -this._viewLength / 2) {
+ this.setCenterVisibleDate(this.pixelOffsetToDate(pixelOffset + this._viewLength));
+ } else if (pixelOffset > 3 * this._viewLength / 2) {
+ this.setCenterVisibleDate(this.pixelOffsetToDate(pixelOffset - this._viewLength));
+ }
+ this._autoScroll(Math.round(this._viewLength / 2 - this._ether.dateToPixelOffset(date)), f);
+};
+
+Timeline._Band.prototype.showBubbleForEvent = function(eventID) {
+ var evt = this.getEventSource().getEvent(eventID);
+ if (evt) {
+ var self = this;
+ this.scrollToCenter(evt.getStart(), function() {
+ self._eventPainter.showBubble(evt);
+ });
+ }
+};
+
+Timeline._Band.prototype.zoom = function(zoomIn, x, y, target) {
+ if (!this._theme.zoom || !this._zoomSteps) {
+ // zoom disabled
+ return;
+ }
+
+ // shift the x value by our offset
+ x += this._viewOffset;
+
+ var zoomDate = this._ether.pixelOffsetToDate(x);
+ var netIntervalChange = this._ether.zoom(zoomIn);
+ this._etherPainter.zoom(netIntervalChange);
+
+ // shift our zoom date to the far left
+ this._moveEther(Math.round(-this._ether.dateToPixelOffset(zoomDate)));
+ // then shift it back to where the mouse was
+ this._moveEther(x);
+};
+
+Timeline._Band.prototype._onMouseDown = function(innerFrame, evt, target) {
+ this.closeBubble();
+
+ this._dragging = true;
+ this._dragX = evt.clientX;
+ this._dragY = evt.clientY;
+};
+
+Timeline._Band.prototype._onMouseMove = function(innerFrame, evt, target) {
+ if (this._dragging) {
+ var diffX = evt.clientX - this._dragX;
+ var diffY = evt.clientY - this._dragY;
+
+ this._dragX = evt.clientX;
+ this._dragY = evt.clientY;
+
+ this._moveEther(this._timeline.isHorizontal() ? diffX : diffY);
+ this._positionHighlight();
+ }
+};
+
+Timeline._Band.prototype._onMouseUp = function(innerFrame, evt, target) {
+ this._dragging = false;
+ this._keyboardInput.focus();
+};
+
+Timeline._Band.prototype._onMouseOut = function(innerFrame, evt, target) {
+ var coords = SimileAjax.DOM.getEventRelativeCoordinates(evt, innerFrame);
+ coords.x += this._viewOffset;
+ if (coords.x < 0 || coords.x > innerFrame.offsetWidth ||
+ coords.y < 0 || coords.y > innerFrame.offsetHeight) {
+ this._dragging = false;
+ }
+};
+
+Timeline._Band.prototype._onMouseScroll = function(innerFrame, evt, target) {
+ var now = new Date();
+ now = now.getTime();
+
+ if (!this._lastScrollTime || ((now - this._lastScrollTime) > 50)) {
+ // limit 1 scroll per 200ms due to FF3 sending multiple events back to back
+ this._lastScrollTime = now;
+
+ var delta = 0;
+ if (evt.wheelDelta) {
+ delta = evt.wheelDelta/120;
+ } else if (evt.detail) {
+ delta = -evt.detail/3;
+ }
+
+ var loc = SimileAjax.DOM.getEventRelativeCoordinates(evt, innerFrame);
+ if (delta != 0) {
+ var zoomIn;
+ if (delta > 0)
+ zoomIn = true;
+ if (delta < 0)
+ zoomIn = false;
+ // call zoom on the timeline so we could zoom multiple bands if desired
+ this._timeline.zoom(zoomIn, loc.x, loc.y, innerFrame);
+ }
+ }
+
+ // prevent bubble
+ if (evt.stopPropagation) {
+ evt.stopPropagation();
+ }
+ evt.cancelBubble = true;
+
+ // prevent the default action
+ if (evt.preventDefault) {
+ evt.preventDefault();
+ }
+ evt.returnValue = false;
+};
+
+Timeline._Band.prototype._onDblClick = function(innerFrame, evt, target) {
+ var coords = SimileAjax.DOM.getEventRelativeCoordinates(evt, innerFrame);
+ var distance = coords.x - (this._viewLength / 2 - this._viewOffset);
+
+ this._autoScroll(-distance);
+};
+
+Timeline._Band.prototype._onKeyDown = function(keyboardInput, evt, target) {
+ if (!this._dragging) {
+ switch (evt.keyCode) {
+ case 27: // ESC
+ break;
+ case 37: // left arrow
+ case 38: // up arrow
+ this._scrollSpeed = Math.min(50, Math.abs(this._scrollSpeed * 1.05));
+ this._moveEther(this._scrollSpeed);
+ break;
+ case 39: // right arrow
+ case 40: // down arrow
+ this._scrollSpeed = -Math.min(50, Math.abs(this._scrollSpeed * 1.05));
+ this._moveEther(this._scrollSpeed);
+ break;
+ default:
+ return true;
+ }
+ this.closeBubble();
+
+ SimileAjax.DOM.cancelEvent(evt);
+ return false;
+ }
+ return true;
+};
+
+Timeline._Band.prototype._onKeyUp = function(keyboardInput, evt, target) {
+ if (!this._dragging) {
+ this._scrollSpeed = this._originalScrollSpeed;
+
+ switch (evt.keyCode) {
+ case 35: // end
+ this.setCenterVisibleDate(this._eventSource.getLatestDate());
+ break;
+ case 36: // home
+ this.setCenterVisibleDate(this._eventSource.getEarliestDate());
+ break;
+ case 33: // page up
+ this._autoScroll(this._timeline.getPixelLength());
+ break;
+ case 34: // page down
+ this._autoScroll(-this._timeline.getPixelLength());
+ break;
+ default:
+ return true;
+ }
+
+ this.closeBubble();
+
+ SimileAjax.DOM.cancelEvent(evt);
+ return false;
+ }
+ return true;
+};
+
+Timeline._Band.prototype._autoScroll = function(distance, f) {
+ var b = this;
+ var a = SimileAjax.Graphics.createAnimation(
+ function(abs, diff) {
+ b._moveEther(diff);
+ },
+ 0,
+ distance,
+ 1000,
+ f
+ );
+ a.run();
+};
+
+Timeline._Band.prototype._moveEther = function(shift) {
+ this.closeBubble();
+
+ this._viewOffset += shift;
+ this._ether.shiftPixels(-shift);
+ if (this._timeline.isHorizontal()) {
+ this._div.style.left = this._viewOffset + "px";
+ } else {
+ this._div.style.top = this._viewOffset + "px";
+ }
+
+ if (this._viewOffset > -this._viewLength * 0.5 ||
+ this._viewOffset < -this._viewLength * (Timeline._Band.SCROLL_MULTIPLES - 1.5)) {
+
+ this._recenterDiv();
+ } else {
+ this.softLayout();
+ }
+
+ this._onChanging();
+}
+
+Timeline._Band.prototype._onChanging = function() {
+ this._changing = true;
+
+ this._fireOnScroll();
+ this._setSyncWithBandDate();
+
+ this._changing = false;
+};
+
+Timeline._Band.prototype._fireOnScroll = function() {
+ for (var i = 0; i < this._onScrollListeners.length; i++) {
+ this._onScrollListeners[i](this);
+ }
+};
+
+Timeline._Band.prototype._setSyncWithBandDate = function() {
+ if (this._syncWithBand) {
+ var centerDate = this._ether.pixelOffsetToDate(this.getViewLength() / 2);
+ this._syncWithBand.setCenterVisibleDate(centerDate);
+ }
+};
+
+Timeline._Band.prototype._onHighlightBandScroll = function() {
+ if (this._syncWithBand) {
+ var centerDate = this._syncWithBand.getCenterVisibleDate();
+ var centerPixelOffset = this._ether.dateToPixelOffset(centerDate);
+
+ this._moveEther(Math.round(this._viewLength / 2 - centerPixelOffset));
+
+ if (this._highlight) {
+ this._etherPainter.setHighlight(
+ this._syncWithBand.getMinVisibleDate(),
+ this._syncWithBand.getMaxVisibleDate());
+ }
+ }
+};
+
+Timeline._Band.prototype._onAddMany = function() {
+ this._paintEvents();
+};
+
+Timeline._Band.prototype._onClear = function() {
+ this._paintEvents();
+};
+
+Timeline._Band.prototype._positionHighlight = function() {
+ if (this._syncWithBand) {
+ var startDate = this._syncWithBand.getMinVisibleDate();
+ var endDate = this._syncWithBand.getMaxVisibleDate();
+
+ if (this._highlight) {
+ this._etherPainter.setHighlight(startDate, endDate);
+ }
+ }
+};
+
+Timeline._Band.prototype._recenterDiv = function() {
+ this._viewOffset = -this._viewLength * (Timeline._Band.SCROLL_MULTIPLES - 1) / 2;
+ if (this._timeline.isHorizontal()) {
+ this._div.style.left = this._viewOffset + "px";
+ this._div.style.width = (Timeline._Band.SCROLL_MULTIPLES * this._viewLength) + "px";
+ } else {
+ this._div.style.top = this._viewOffset + "px";
+ this._div.style.height = (Timeline._Band.SCROLL_MULTIPLES * this._viewLength) + "px";
+ }
+ this.layout();
+};
+
+Timeline._Band.prototype._paintEvents = function() {
+ this._eventPainter.paint();
+};
+
+Timeline._Band.prototype._softPaintEvents = function() {
+ this._eventPainter.softPaint();
+};
+
+Timeline._Band.prototype._paintDecorators = function() {
+ for (var i = 0; i < this._decorators.length; i++) {
+ this._decorators[i].paint();
+ }
+};
+
+Timeline._Band.prototype._softPaintDecorators = function() {
+ for (var i = 0; i < this._decorators.length; i++) {
+ this._decorators[i].softPaint();
+ }
+};
+
+Timeline._Band.prototype.closeBubble = function() {
+ SimileAjax.WindowManager.cancelPopups();
+};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/units.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/units.js
new file mode 100644
index 0000000..15ea379
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/units.js
@@ -0,0 +1,68 @@
+/*==================================================
+ * Default Unit
+ *==================================================
+ */
+
+Timeline.NativeDateUnit = new Object();
+
+Timeline.NativeDateUnit.createLabeller = function(locale, timeZone) {
+ return new Timeline.GregorianDateLabeller(locale, timeZone);
+};
+
+Timeline.NativeDateUnit.makeDefaultValue = function() {
+ return new Date();
+};
+
+Timeline.NativeDateUnit.cloneValue = function(v) {
+ return new Date(v.getTime());
+};
+
+Timeline.NativeDateUnit.getParser = function(format) {
+ if (typeof format == "string") {
+ format = format.toLowerCase();
+ }
+ return (format == "iso8601" || format == "iso 8601") ?
+ Timeline.DateTime.parseIso8601DateTime :
+ Timeline.DateTime.parseGregorianDateTime;
+};
+
+Timeline.NativeDateUnit.parseFromObject = function(o) {
+ return Timeline.DateTime.parseGregorianDateTime(o);
+};
+
+Timeline.NativeDateUnit.toNumber = function(v) {
+ return v.getTime();
+};
+
+Timeline.NativeDateUnit.fromNumber = function(n) {
+ return new Date(n);
+};
+
+Timeline.NativeDateUnit.compare = function(v1, v2) {
+ var n1, n2;
+ if (typeof v1 == "object") {
+ n1 = v1.getTime();
+ } else {
+ n1 = Number(v1);
+ }
+ if (typeof v2 == "object") {
+ n2 = v2.getTime();
+ } else {
+ n2 = Number(v2);
+ }
+
+ return n1 - n2;
+};
+
+Timeline.NativeDateUnit.earlier = function(v1, v2) {
+ return Timeline.NativeDateUnit.compare(v1, v2) < 0 ? v1 : v2;
+};
+
+Timeline.NativeDateUnit.later = function(v1, v2) {
+ return Timeline.NativeDateUnit.compare(v1, v2) > 0 ? v1 : v2;
+};
+
+Timeline.NativeDateUnit.change = function(v, n) {
+ return new Date(v.getTime() + n);
+};
+
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/styles/ethers.css b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/styles/ethers.css
new file mode 100644
index 0000000..96b59ae
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/styles/ethers.css
@@ -0,0 +1,123 @@
+
+
+/*------------------- Horizontal / Vertical lines ----------------*/
+
+/* style for ethers */
+.timeline-ether-lines{border-color:#666; border-style:dotted; position:absolute;}
+
+.timeline-horizontal .timeline-ether-lines{border-width:0 0 0 1px; height:100%; top: 0; width: 1px;}
+
+.timeline-vertical .timeline-ether-lines{border-width:1px 0 0; height:1px; left: 0; width: 100%;}
+
+
+
+
+/*---------------- Weekends ---------------------------*/
+
+.timeline-ether-weekends{
+ position:absolute;
+ background-color:#FFFFE0;
+}
+
+.timeline-vertical .timeline-ether-weekends{left:0;width:100%;}
+
+.timeline-horizontal .timeline-ether-weekends{top:0; height:100%;}
+
+
+
+/*-------------------------- HIGHLIGHT DECORATORS -------------------*/
+.timeline-highlight-decorator,
+.timeline-highlight-point-decorator{
+ position:absolute;
+ overflow:hidden;
+}
+.timeline-horizontal .timeline-highlight-point-decorator,
+.timeline-horizontal .timeline-highlight-decorator{
+ width:10px;
+ top:0;
+ height:100%;
+}
+
+.timeline-vertical .timeline-highlight-point-decorator,
+.timeline-vertical .timeline-highlight-decorator{
+ height:10px;
+ width:100%;
+ left:0;
+}
+
+.timeline-highlight-decorator{background-color:#FFC080;}
+.timeline-highlight-point-decorator{background-color:#ff5;}
+
+
+
+/*---------------------------- LABELS -------------------------*/
+.timeline-highlight-label{position:absolute;overflow:hidden;font-size:200%;font-weight:bold;color:#999;}
+
+
+/*---------------- VERTICAL LABEL -------------------*/
+.timeline-horizontal .timeline-highlight-label{top:0;height:100%;}
+.timeline-horizontal .timeline-highlight-label td{vertical-align:middle;}
+.timeline-horizontal .timeline-highlight-label-start{text-align:right;}
+.timeline-horizontal .timeline-highlight-label-end{text-align:left;}
+
+
+/*---------------- HORIZONTAL LABEL -------------------*/
+.timeline-vertical .timeline-highlight-label{left:0;width:100%;}
+.timeline-vertical .timeline-highlight-label td{vertical-align:top;}
+.timeline-vertical .timeline-highlight-label-start{text-align:center;}
+.timeline-vertical .timeline-highlight-label-end{text-align:center;}
+
+
+
+/*-------------------------------- DATE LABELS --------------------------------*/
+.timeline-date-label{position:absolute; border:solid #aaa; color:#aaa; width:5em; height:1.5em;}
+.timeline-date-label-em{color:#000;}
+
+/* horizontal */
+.timeline-horizontal .timeline-date-label{padding-left:2px;}
+.timeline-horizontal .timeline-date-label{border-width:0 0 0 1px;}
+.timeline-horizontal .timeline-date-label-em{height:2em}
+
+/* vertical */
+.timeline-vertical .timeline-date-label{padding-top:2px;}
+.timeline-vertical .timeline-date-label{border-width:1px 0 0;}
+.timeline-vertical .timeline-date-label-em{width:7em}
+
+/*------------------------------- Ether.highlight -------------------------*/
+.timeline-ether-highlight{position:absolute; background-color:#fff;}
+.timeline-horizontal .timeline-ether-highlight{top:2px;}
+.timeline-vertical .timeline-ether-highlight{left:2px;}
+
+
+
+/*------------------------------ EVENTS ------------------------------------*/
+.timeline-event-icon, .timeline-event-label,.timeline-event-tape{
+ position:absolute;
+ cursor:pointer;
+}
+
+.timeline-event-tape,
+.timeline-small-event-tape,
+.timeline-small-event-icon{
+ background-color:#58A0DC;
+ overflow:hidden;
+}
+
+.timeline-small-event-tape,
+.timeline-small-event-icon{
+ position:absolute;
+}
+
+.timeline-event-tape{height:4px;}
+
+.timeline-small-event-tape{height:2px;}
+.timeline-small-event-icon{width:1px; height:6px;}
+
+
+
+/*--------------------------------- TIMELINE-------------------------*/
+.timeline-ether-bg{width:100%; height:100%;}
+.timeline-band-0 .timeline-ether-bg{background-color:#eee}
+.timeline-band-1 .timeline-ether-bg{background-color:#ddd}
+.timeline-band-2 .timeline-ether-bg{background-color:#ccc}
+.timeline-band-3 .timeline-ether-bg{background-color:#aaa}
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/styles/events.css b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/styles/events.css
new file mode 100644
index 0000000..4ece954
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/styles/events.css
@@ -0,0 +1,47 @@
+.timeline-duration-event {
+ position: absolute;
+ overflow: hidden;
+ border: 1px solid blue;
+}
+
+.timeline-instant-event2 {
+ position: absolute;
+ overflow: hidden;
+ border-left: 1px solid blue;
+ padding-left: 2px;
+}
+
+.timeline-instant-event {
+ position: absolute;
+ overflow: hidden;
+}
+
+.timeline-event-bubble-title {
+ font-weight: bold;
+ border-bottom: 1px solid #888;
+ margin-bottom: 0.5em;
+}
+
+.timeline-event-bubble-body {
+ overflow: auto;
+ max-height: 350px;
+}
+
+.timeline-event-bubble-wiki {
+ margin: 0.5em;
+ text-align: right;
+ color: #A0A040;
+}
+.timeline-event-bubble-wiki a {
+ color: #A0A040;
+}
+
+.timeline-event-bubble-time {
+ color: #aaa;
+}
+
+.timeline-event-bubble-image {
+ float: right;
+ padding-left: 5px;
+ padding-bottom: 5px;
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/styles/timeline.css b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/styles/timeline.css
new file mode 100644
index 0000000..04ef2e4
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/styles/timeline.css
@@ -0,0 +1,65 @@
+.timeline-container {
+ position: relative;
+ overflow: hidden;
+}
+
+.timeline-copyright {
+ position: absolute;
+ bottom: 0px;
+ left: 0px;
+ z-index: 1000;
+ cursor: pointer;
+}
+
+.timeline-message-container {
+ position: absolute;
+ top: 30%;
+ left: 35%;
+ right: 35%;
+ z-index: 1000;
+ display: none;
+}
+.timeline-message {
+ font-size: 120%;
+ font-weight: bold;
+ text-align: center;
+}
+.timeline-message img {
+ vertical-align: middle;
+}
+
+.timeline-band {
+ position: absolute;
+ background: #eee;
+ z-index: 10;
+}
+
+.timeline-band-inner {
+ position: relative;
+ width: 100%;
+ height: 100%;
+}
+
+.timeline-band-input {
+ position: absolute;
+ width: 1em;
+ height: 1em;
+ overflow: hidden;
+ z-index: 0;
+}
+.timeline-band-input input{
+ width: 0;
+}
+
+.timeline-band-layer {
+ position: absolute;
+ width: 100%;
+ height: 100%;
+}
+
+.timeline-band-layer-inner {
+ position: relative;
+ width: 100%;
+ height: 100%;
+}
+
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/timeline-api.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/timeline-api.js
new file mode 100644
index 0000000..1447a26
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/timeline-api.js
@@ -0,0 +1,222 @@
+/*==================================================
+ * Timeline API
+ *
+ * This file will load all the Javascript files
+ * necessary to make the standard timeline work.
+ * It also detects the default locale.
+ *
+ * Include this file in your HTML file as follows:
+ *
+ * <script src="http://simile.mit.edu/timeline/api/scripts/timeline-api.js" type="text/javascript"></script>
+ *
+ *==================================================
+ */
+
+(function() {
+ var useLocalResources = true;
+ if (document.location.search.length > 0) {
+ var params = document.location.search.substr(1).split("&");
+ for (var i = 0; i < params.length; i++) {
+ if (params[i] == "timeline-use-local-resources") {
+ useLocalResources = true;
+ }
+ }
+ };
+
+ var loadMe = function() {
+ if ("Timeline" in window) {
+ return;
+ }
+
+ window.Timeline = new Object();
+ window.Timeline.DateTime = window.SimileAjax.DateTime; // for backward compatibility
+
+ var bundle = false;
+ var javascriptFiles = [
+ "timeline.js",
+ "themes.js",
+ "ethers.js",
+ "ether-painters.js",
+ "labellers.js",
+ "sources.js",
+ "original-painter.js",
+ "detailed-painter.js",
+ "overview-painter.js",
+ "decorators.js",
+ "units.js"
+ ];
+ var cssFiles = [
+ "timeline.css",
+ "ethers.css",
+ "events.css"
+ ];
+
+ var localizedJavascriptFiles = [
+ "timeline.js",
+ "labellers.js"
+ ];
+ var localizedCssFiles = [
+ ];
+
+ // ISO-639 language codes, ISO-3166 country codes (2 characters)
+ var supportedLocales = [
+ "cs", // Czech
+ "de", // German
+ "en", // English
+ "es", // Spanish
+ "fr", // French
+ "it", // Italian
+ "ru", // Russian
+ "se", // Swedish
+ "tr", // Turkish
+ "vi", // Vietnamese
+ "zh" // Chinese
+ ];
+
+ try {
+ var desiredLocales = [ "en" ];
+ var defaultServerLocale = "en";
+
+ var parseURLParameters = function(parameters) {
+ var params = parameters.split("&");
+ for (var p = 0; p < params.length; p++) {
+ var pair = params[p].split("=");
+ if (pair[0] == "locales") {
+ desiredLocales = desiredLocales.concat(pair[1].split(","));
+ } else if (pair[0] == "defaultLocale") {
+ defaultServerLocale = pair[1];
+ } else if (pair[0] == "bundle") {
+ bundle = pair[1] != "false";
+ }
+ }
+ };
+
+ (function() {
+ if (typeof Timeline_urlPrefix == "string") {
+ Timeline.urlPrefix = Timeline_urlPrefix;
+ if (typeof Timeline_parameters == "string") {
+ parseURLParameters(Timeline_parameters);
+ }
+ } else {
+ var heads = document.documentElement.getElementsByTagName("head");
+ for (var h = 0; h < heads.length; h++) {
+ var scripts = heads[h].getElementsByTagName("script");
+ for (var s = 0; s < scripts.length; s++) {
+ var url = scripts[s].src;
+ var i = url.indexOf("timeline-api.js");
+ if (i >= 0) {
+ Timeline.urlPrefix = url.substr(0, i);
+ var q = url.indexOf("?");
+ if (q > 0) {
+ parseURLParameters(url.substr(q + 1));
+ }
+ return;
+ }
+ }
+ }
+ throw new Error("Failed to derive URL prefix for Timeline API code files");
+ }
+ })();
+
+ var includeJavascriptFiles = function(urlPrefix, filenames) {
+ SimileAjax.includeJavascriptFiles(document, urlPrefix, filenames);
+ }
+ var includeCssFiles = function(urlPrefix, filenames) {
+ SimileAjax.includeCssFiles(document, urlPrefix, filenames);
+ }
+
+ /*
+ * Include non-localized files
+ */
+ if (bundle) {
+ includeJavascriptFiles(Timeline.urlPrefix, [ "timeline-bundle.js" ]);
+ includeCssFiles(Timeline.urlPrefix, [ "timeline-bundle.css" ]);
+ } else {
+ includeJavascriptFiles(Timeline.urlPrefix + "scripts/", javascriptFiles);
+ includeCssFiles(Timeline.urlPrefix + "styles/", cssFiles);
+ }
+
+ /*
+ * Include localized files
+ */
+ var loadLocale = [];
+ loadLocale[defaultServerLocale] = true;
+
+ var tryExactLocale = function(locale) {
+ for (var l = 0; l < supportedLocales.length; l++) {
+ if (locale == supportedLocales[l]) {
+ loadLocale[locale] = true;
+ return true;
+ }
+ }
+ return false;
+ }
+ var tryLocale = function(locale) {
+ if (tryExactLocale(locale)) {
+ return locale;
+ }
+
+ var dash = locale.indexOf("-");
+ if (dash > 0 && tryExactLocale(locale.substr(0, dash))) {
+ return locale.substr(0, dash);
+ }
+
+ return null;
+ }
+
+ for (var l = 0; l < desiredLocales.length; l++) {
+ tryLocale(desiredLocales[l]);
+ }
+
+ var defaultClientLocale = defaultServerLocale;
+ var defaultClientLocales = ("language" in navigator ? navigator.language : navigator.browserLanguage).split(";");
+ for (var l = 0; l < defaultClientLocales.length; l++) {
+ var locale = tryLocale(defaultClientLocales[l]);
+ if (locale != null) {
+ defaultClientLocale = locale;
+ break;
+ }
+ }
+
+ for (var l = 0; l < supportedLocales.length; l++) {
+ var locale = supportedLocales[l];
+ if (loadLocale[locale]) {
+ includeJavascriptFiles(Timeline.urlPrefix + "scripts/l10n/" + locale + "/", localizedJavascriptFiles);
+ includeCssFiles(Timeline.urlPrefix + "styles/l10n/" + locale + "/", localizedCssFiles);
+ }
+ }
+
+ Timeline.serverLocale = defaultServerLocale;
+ Timeline.clientLocale = defaultClientLocale;
+ } catch (e) {
+ alert(e);
+ }
+ };
+
+ /*
+ * Load SimileAjax if it's not already loaded
+ */
+ if (typeof SimileAjax == "undefined") {
+ window.SimileAjax_onLoad = loadMe;
+
+ var url = "/js/timeline/ajax/api/simile-ajax-api.js";
+ var createScriptElement = function() {
+ var script = document.createElement("script");
+ script.type = "text/javascript";
+ script.language = "JavaScript";
+ script.src = url;
+ document.getElementsByTagName("head")[0].appendChild(script);
+ }
+ if (document.body == null) {
+ try {
+ document.write("<script src='" + url + "' type='text/javascript'></script>");
+ } catch (e) {
+ createScriptElement();
+ }
+ } else {
+ createScriptElement();
+ }
+ } else {
+ loadMe();
+ }
+})();
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/timeline-bundle.css b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/timeline-bundle.css
new file mode 100644
index 0000000..7f8acdc
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/timeline-bundle.css
@@ -0,0 +1,232 @@
+
+
+/*------------------- Horizontal / Vertical lines ----------------*/
+
+/* style for ethers */
+.timeline-ether-lines{border-color:#666; border-style:dotted; position:absolute;}
+
+.timeline-horizontal .timeline-ether-lines{border-width:0 0 0 1px; height:100%; top: 0; width: 1px;}
+
+.timeline-vertical .timeline-ether-lines{border-width:1px 0 0; height:1px; left: 0; width: 100%;}
+
+
+
+
+/*---------------- Weekends ---------------------------*/
+
+.timeline-ether-weekends{
+ position:absolute;
+ background-color:#FFFFE0;
+}
+
+.timeline-vertical .timeline-ether-weekends{left:0;width:100%;}
+
+.timeline-horizontal .timeline-ether-weekends{top:0; height:100%;}
+
+
+
+/*-------------------------- HIGHLIGHT DECORATORS -------------------*/
+.timeline-highlight-decorator,
+.timeline-highlight-point-decorator{
+ position:absolute;
+ overflow:hidden;
+}
+.timeline-horizontal .timeline-highlight-point-decorator,
+.timeline-horizontal .timeline-highlight-decorator{
+ width:10px;
+ top:0;
+ height:100%;
+}
+
+.timeline-vertical .timeline-highlight-point-decorator,
+.timeline-vertical .timeline-highlight-decorator{
+ height:10px;
+ width:100%;
+ left:0;
+}
+
+.timeline-highlight-decorator{background-color:#FFC080;}
+.timeline-highlight-point-decorator{background-color:#ff5;}
+
+
+
+/*---------------------------- LABELS -------------------------*/
+.timeline-highlight-label{position:absolute;overflow:hidden;font-size:200%;font-weight:bold;color:#999;}
+
+
+/*---------------- VERTICAL LABEL -------------------*/
+.timeline-horizontal .timeline-highlight-label{top:0;height:100%;}
+.timeline-horizontal .timeline-highlight-label td{vertical-align:middle;}
+.timeline-horizontal .timeline-highlight-label-start{text-align:right;}
+.timeline-horizontal .timeline-highlight-label-end{text-align:left;}
+
+
+/*---------------- HORIZONTAL LABEL -------------------*/
+.timeline-vertical .timeline-highlight-label{left:0;width:100%;}
+.timeline-vertical .timeline-highlight-label td{vertical-align:top;}
+.timeline-vertical .timeline-highlight-label-start{text-align:center;}
+.timeline-vertical .timeline-highlight-label-end{text-align:center;}
+
+
+
+/*-------------------------------- DATE LABELS --------------------------------*/
+.timeline-date-label{position:absolute; border:solid #aaa; color:#aaa; width:5em; height:1.5em;}
+.timeline-date-label-em{color:#000;}
+
+/* horizontal */
+.timeline-horizontal .timeline-date-label{padding-left:2px;}
+.timeline-horizontal .timeline-date-label{border-width:0 0 0 1px;}
+.timeline-horizontal .timeline-date-label-em{height:2em}
+
+/* vertical */
+.timeline-vertical .timeline-date-label{padding-top:2px;}
+.timeline-vertical .timeline-date-label{border-width:1px 0 0;}
+.timeline-vertical .timeline-date-label-em{width:7em}
+
+/*------------------------------- Ether.highlight -------------------------*/
+.timeline-ether-highlight{position:absolute; background-color:#fff;}
+.timeline-horizontal .timeline-ether-highlight{top:2px;}
+.timeline-vertical .timeline-ether-highlight{left:2px;}
+
+
+
+/*------------------------------ EVENTS ------------------------------------*/
+.timeline-event-icon, .timeline-event-label,.timeline-event-tape{
+ position:absolute;
+ cursor:pointer;
+}
+
+.timeline-event-tape,
+.timeline-small-event-tape,
+.timeline-small-event-icon{
+ background-color:#58A0DC;
+ overflow:hidden;
+}
+
+.timeline-small-event-tape,
+.timeline-small-event-icon{
+ position:absolute;
+}
+
+.timeline-event-tape{height:4px;}
+
+.timeline-small-event-tape{height:2px;}
+.timeline-small-event-icon{width:1px; height:6px;}
+
+
+
+/*--------------------------------- TIMELINE-------------------------*/
+.timeline-ether-bg{width:100%; height:100%;}
+.timeline-band-0 .timeline-ether-bg{background-color:#eee}
+.timeline-band-1 .timeline-ether-bg{background-color:#ddd}
+.timeline-band-2 .timeline-ether-bg{background-color:#ccc}
+.timeline-band-3 .timeline-ether-bg{background-color:#aaa}
+.timeline-duration-event {
+ position: absolute;
+ overflow: hidden;
+ border: 1px solid blue;
+}
+
+.timeline-instant-event2 {
+ position: absolute;
+ overflow: hidden;
+ border-left: 1px solid blue;
+ padding-left: 2px;
+}
+
+.timeline-instant-event {
+ position: absolute;
+ overflow: hidden;
+}
+
+.timeline-event-bubble-title {
+ font-weight: bold;
+ border-bottom: 1px solid #888;
+ margin-bottom: 0.5em;
+}
+
+.timeline-event-bubble-body {
+}
+
+.timeline-event-bubble-wiki {
+ margin: 0.5em;
+ text-align: right;
+ color: #A0A040;
+}
+.timeline-event-bubble-wiki a {
+ color: #A0A040;
+}
+
+.timeline-event-bubble-time {
+ color: #aaa;
+}
+
+.timeline-event-bubble-image {
+ float: right;
+ padding-left: 5px;
+ padding-bottom: 5px;
+}.timeline-container {
+ position: relative;
+ overflow: hidden;
+}
+
+.timeline-copyright {
+ position: absolute;
+ bottom: 0px;
+ left: 0px;
+ z-index: 1000;
+ cursor: pointer;
+}
+
+.timeline-message-container {
+ position: absolute;
+ top: 30%;
+ left: 35%;
+ right: 35%;
+ z-index: 1000;
+ display: none;
+}
+.timeline-message {
+ font-size: 120%;
+ font-weight: bold;
+ text-align: center;
+}
+.timeline-message img {
+ vertical-align: middle;
+}
+
+.timeline-band {
+ position: absolute;
+ background: #eee;
+ z-index: 10;
+}
+
+.timeline-band-inner {
+ position: relative;
+ width: 100%;
+ height: 100%;
+}
+
+.timeline-band-input {
+ position: absolute;
+ width: 1em;
+ height: 1em;
+ overflow: hidden;
+ z-index: 0;
+}
+.timeline-band-input input{
+ width: 0;
+}
+
+.timeline-band-layer {
+ position: absolute;
+ width: 100%;
+ height: 100%;
+}
+
+.timeline-band-layer-inner {
+ position: relative;
+ width: 100%;
+ height: 100%;
+}
+
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/timeline-bundle.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/timeline-bundle.js
new file mode 100644
index 0000000..019e6a7
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/timeline-bundle.js
@@ -0,0 +1,2120 @@
+
+
+/* decorators.js */
+Timeline.SpanHighlightDecorator=function(A){this._unit=("unit" in A)?A.unit:SimileAjax.NativeDateUnit;
+this._startDate=(typeof A.startDate=="string")?this._unit.parseFromObject(A.startDate):A.startDate;
+this._endDate=(typeof A.endDate=="string")?this._unit.parseFromObject(A.endDate):A.endDate;
+this._startLabel=A.startLabel;
+this._endLabel=A.endLabel;
+this._color=A.color;
+this._cssClass=("cssClass" in A)?A.cssClass:null;
+this._opacity=("opacity" in A)?A.opacity:100;
+};
+Timeline.SpanHighlightDecorator.prototype.initialize=function(B,A){this._band=B;
+this._timeline=A;
+this._layerDiv=null;
+};
+Timeline.SpanHighlightDecorator.prototype.paint=function(){if(this._layerDiv!=null){this._band.removeLayerDiv(this._layerDiv);
+}this._layerDiv=this._band.createLayerDiv(10);
+this._layerDiv.setAttribute("name","span-highlight-decorator");
+this._layerDiv.style.display="none";
+var F=this._band.getMinDate();
+var C=this._band.getMaxDate();
+if(this._unit.compare(this._startDate,C)<0&&this._unit.compare(this._endDate,F)>0){F=this._unit.later(F,this._startDate);
+C=this._unit.earlier(C,this._endDate);
+var D=this._band.dateToPixelOffset(F);
+var K=this._band.dateToPixelOffset(C);
+var I=this._timeline.getDocument();
+var H=function(){var L=I.createElement("table");
+L.insertRow(0).insertCell(0);
+return L;
+};
+var B=I.createElement("div");
+B.className="timeline-highlight-decorator";
+if(this._cssClass){B.className+=" "+this._cssClass;
+}if(this._opacity<100){SimileAjax.Graphics.setOpacity(B,this._opacity);
+}this._layerDiv.appendChild(B);
+var J=H();
+J.className="timeline-highlight-label timeline-highlight-label-start";
+var G=J.rows[0].cells[0];
+G.innerHTML=this._startLabel;
+if(this._cssClass){G.className="label_"+this._cssClass;
+}this._layerDiv.appendChild(J);
+var A=H();
+A.className="timeline-highlight-label timeline-highlight-label-end";
+var E=A.rows[0].cells[0];
+E.innerHTML=this._endLabel;
+if(this._cssClass){E.className="label_"+this._cssClass;
+}this._layerDiv.appendChild(A);
+if(this._timeline.isHorizontal()){B.style.left=D+"px";
+B.style.width=(K-D)+"px";
+J.style.right=(this._band.getTotalViewLength()-D)+"px";
+J.style.width=(this._startLabel.length)+"em";
+A.style.left=K+"px";
+A.style.width=(this._endLabel.length)+"em";
+}else{B.style.top=D+"px";
+B.style.height=(K-D)+"px";
+J.style.bottom=D+"px";
+J.style.height="1.5px";
+A.style.top=K+"px";
+A.style.height="1.5px";
+}}this._layerDiv.style.display="block";
+};
+Timeline.SpanHighlightDecorator.prototype.softPaint=function(){};
+Timeline.PointHighlightDecorator=function(A){this._unit=("unit" in A)?A.unit:SimileAjax.NativeDateUnit;
+this._date=(typeof A.date=="string")?this._unit.parseFromObject(A.date):A.date;
+this._width=("width" in A)?A.width:10;
+this._color=A.color;
+this._cssClass=("cssClass" in A)?A.cssClass:"";
+this._opacity=("opacity" in A)?A.opacity:100;
+};
+Timeline.PointHighlightDecorator.prototype.initialize=function(B,A){this._band=B;
+this._timeline=A;
+this._layerDiv=null;
+};
+Timeline.PointHighlightDecorator.prototype.paint=function(){if(this._layerDiv!=null){this._band.removeLayerDiv(this._layerDiv);
+}this._layerDiv=this._band.createLayerDiv(10);
+this._layerDiv.setAttribute("name","span-highlight-decorator");
+this._layerDiv.style.display="none";
+var C=this._band.getMinDate();
+var E=this._band.getMaxDate();
+if(this._unit.compare(this._date,E)<0&&this._unit.compare(this._date,C)>0){var B=this._band.dateToPixelOffset(this._date);
+var A=B-Math.round(this._width/2);
+var D=this._timeline.getDocument();
+var F=D.createElement("div");
+F.className="timeline-highlight-point-decorator";
+F.className+=" "+this._cssClass;
+if(this._opacity<100){SimileAjax.Graphics.setOpacity(F,this._opacity);
+}this._layerDiv.appendChild(F);
+if(this._timeline.isHorizontal()){F.style.left=A+"px";
+}else{F.style.top=A+"px";
+}}this._layerDiv.style.display="block";
+};
+Timeline.PointHighlightDecorator.prototype.softPaint=function(){};
+
+
+/* detailed-painter.js */
+Timeline.DetailedEventPainter=function(A){this._params=A;
+this._onSelectListeners=[];
+this._filterMatcher=null;
+this._highlightMatcher=null;
+this._frc=null;
+this._eventIdToElmt={};
+};
+Timeline.DetailedEventPainter.prototype.initialize=function(B,A){this._band=B;
+this._timeline=A;
+this._backLayer=null;
+this._eventLayer=null;
+this._lineLayer=null;
+this._highlightLayer=null;
+this._eventIdToElmt=null;
+};
+Timeline.DetailedEventPainter.prototype.addOnSelectListener=function(A){this._onSelectListeners.push(A);
+};
+Timeline.DetailedEventPainter.prototype.removeOnSelectListener=function(B){for(var A=0;
+A<this._onSelectListeners.length;
+A++){if(this._onSelectListeners[A]==B){this._onSelectListeners.splice(A,1);
+break;
+}}};
+Timeline.DetailedEventPainter.prototype.getFilterMatcher=function(){return this._filterMatcher;
+};
+Timeline.DetailedEventPainter.prototype.setFilterMatcher=function(A){this._filterMatcher=A;
+};
+Timeline.DetailedEventPainter.prototype.getHighlightMatcher=function(){return this._highlightMatcher;
+};
+Timeline.DetailedEventPainter.prototype.setHighlightMatcher=function(A){this._highlightMatcher=A;
+};
+Timeline.DetailedEventPainter.prototype.paint=function(){var B=this._band.getEventSource();
+if(B==null){return ;
+}this._eventIdToElmt={};
+this._prepareForPainting();
+var I=this._params.theme.event;
+var G=Math.max(I.track.height,this._frc.getLineHeight());
+var F={trackOffset:Math.round(this._band.getViewWidth()/2-G/2),trackHeight:G,trackGap:I.track.gap,trackIncrement:G+I.track.gap,icon:I.instant.icon,iconWidth:I.instant.iconWidth,iconHeight:I.instant.iconHeight,labelWidth:I.label.width};
+var C=this._band.getMinDate();
+var A=this._band.getMaxDate();
+var J=(this._filterMatcher!=null)?this._filterMatcher:function(K){return true;
+};
+var E=(this._highlightMatcher!=null)?this._highlightMatcher:function(K){return -1;
+};
+var D=B.getEventReverseIterator(C,A);
+while(D.hasNext()){var H=D.next();
+if(J(H)){this.paintEvent(H,F,this._params.theme,E(H));
+}}this._highlightLayer.style.display="block";
+this._lineLayer.style.display="block";
+this._eventLayer.style.display="block";
+};
+Timeline.DetailedEventPainter.prototype.softPaint=function(){};
+Timeline.DetailedEventPainter.prototype._prepareForPainting=function(){var B=this._band;
+if(this._backLayer==null){this._backLayer=this._band.createLayerDiv(0,"timeline-band-events");
+this._backLayer.style.visibility="hidden";
+var A=document.createElement("span");
+A.className="timeline-event-label";
+this._backLayer.appendChild(A);
+this._frc=SimileAjax.Graphics.getFontRenderingContext(A);
+}this._frc.update();
+this._lowerTracks=[];
+this._upperTracks=[];
+if(this._highlightLayer!=null){B.removeLayerDiv(this._highlightLayer);
+}this._highlightLayer=B.createLayerDiv(105,"timeline-band-highlights");
+this._highlightLayer.style.display="none";
+if(this._lineLayer!=null){B.removeLayerDiv(this._lineLayer);
+}this._lineLayer=B.createLayerDiv(110,"timeline-band-lines");
+this._lineLayer.style.display="none";
+if(this._eventLayer!=null){B.removeLayerDiv(this._eventLayer);
+}this._eventLayer=B.createLayerDiv(110,"timeline-band-events");
+this._eventLayer.style.display="none";
+};
+Timeline.DetailedEventPainter.prototype.paintEvent=function(B,C,D,A){if(B.isInstant()){this.paintInstantEvent(B,C,D,A);
+}else{this.paintDurationEvent(B,C,D,A);
+}};
+Timeline.DetailedEventPainter.prototype.paintInstantEvent=function(B,C,D,A){if(B.isImprecise()){this.paintImpreciseInstantEvent(B,C,D,A);
+}else{this.paintPreciseInstantEvent(B,C,D,A);
+}};
+Timeline.DetailedEventPainter.prototype.paintDurationEvent=function(B,C,D,A){if(B.isImprecise()){this.paintImpreciseDurationEvent(B,C,D,A);
+}else{this.paintPreciseDurationEvent(B,C,D,A);
+}};
+Timeline.DetailedEventPainter.prototype.paintPreciseInstantEvent=function(K,N,Q,O){var S=this._timeline.getDocument();
+var J=K.getText();
+var E=K.getStart();
+var C=Math.round(this._band.dateToPixelOffset(E));
+var A=Math.round(C+N.iconWidth/2);
+var I=Math.round(C-N.iconWidth/2);
+var G=this._frc.computeSize(J);
+var D=this._findFreeTrackForSolid(A,C);
+var B=this._paintEventIcon(K,D,I,N,Q);
+var T=A+Q.event.label.offsetFromLine;
+var P=D;
+var F=this._getTrackData(D);
+if(Math.min(F.solid,F.text)>=T+G.width){F.solid=I;
+F.text=T;
+}else{F.solid=I;
+T=C+Q.event.label.offsetFromLine;
+P=this._findFreeTrackForText(D,T+G.width,function(U){U.line=C-2;
+});
+this._getTrackData(P).text=I;
+this._paintEventLine(K,C,D,P,N,Q);
+}var R=Math.round(N.trackOffset+P*N.trackIncrement+N.trackHeight/2-G.height/2);
+var M=this._paintEventLabel(K,J,T,R,G.width,G.height,Q);
+var L=this;
+var H=function(U,V,W){return L._onClickInstantEvent(B.elmt,V,K);
+};
+SimileAjax.DOM.registerEvent(B.elmt,"mousedown",H);
+SimileAjax.DOM.registerEvent(M.elmt,"mousedown",H);
+this._createHighlightDiv(O,B,Q);
+this._eventIdToElmt[K.getID()]=B.elmt;
+};
+Timeline.DetailedEventPainter.prototype.paintImpreciseInstantEvent=function(N,Q,V,R){var X=this._timeline.getDocument();
+var M=N.getText();
+var H=N.getStart();
+var S=N.getEnd();
+var E=Math.round(this._band.dateToPixelOffset(H));
+var B=Math.round(this._band.dateToPixelOffset(S));
+var A=Math.round(E+Q.iconWidth/2);
+var L=Math.round(E-Q.iconWidth/2);
+var J=this._frc.computeSize(M);
+var F=this._findFreeTrackForSolid(B,E);
+var G=this._paintEventTape(N,F,E,B,V.event.instant.impreciseColor,V.event.instant.impreciseOpacity,Q,V);
+var C=this._paintEventIcon(N,F,L,Q,V);
+var I=this._getTrackData(F);
+I.solid=L;
+var W=A+V.event.label.offsetFromLine;
+var D=W+J.width;
+var T;
+if(D<B){T=F;
+}else{W=E+V.event.label.offsetFromLine;
+D=W+J.width;
+T=this._findFreeTrackForText(F,D,function(Y){Y.line=E-2;
+});
+this._getTrackData(T).text=L;
+this._paintEventLine(N,E,F,T,Q,V);
+}var U=Math.round(Q.trackOffset+T*Q.trackIncrement+Q.trackHeight/2-J.height/2);
+var P=this._paintEventLabel(N,M,W,U,J.width,J.height,V);
+var O=this;
+var K=function(Y,Z,a){return O._onClickInstantEvent(C.elmt,Z,N);
+};
+SimileAjax.DOM.registerEvent(C.elmt,"mousedown",K);
+SimileAjax.DOM.registerEvent(G.elmt,"mousedown",K);
+SimileAjax.DOM.registerEvent(P.elmt,"mousedown",K);
+this._createHighlightDiv(R,C,V);
+this._eventIdToElmt[N.getID()]=C.elmt;
+};
+Timeline.DetailedEventPainter.prototype.paintPreciseDurationEvent=function(J,M,S,O){var T=this._timeline.getDocument();
+var I=J.getText();
+var D=J.getStart();
+var P=J.getEnd();
+var B=Math.round(this._band.dateToPixelOffset(D));
+var A=Math.round(this._band.dateToPixelOffset(P));
+var F=this._frc.computeSize(I);
+var E=this._findFreeTrackForSolid(A);
+var N=J.getColor();
+N=N!=null?N:S.event.duration.color;
+var C=this._paintEventTape(J,E,B,A,N,100,M,S);
+var H=this._getTrackData(E);
+H.solid=B;
+var U=B+S.event.label.offsetFromLine;
+var Q=this._findFreeTrackForText(E,U+F.width,function(V){V.line=B-2;
+});
+this._getTrackData(Q).text=B-2;
+this._paintEventLine(J,B,E,Q,M,S);
+var R=Math.round(M.trackOffset+Q*M.trackIncrement+M.trackHeight/2-F.height/2);
+var L=this._paintEventLabel(J,I,U,R,F.width,F.height,S);
+var K=this;
+var G=function(V,W,X){return K._onClickDurationEvent(C.elmt,W,J);
+};
+SimileAjax.DOM.registerEvent(C.elmt,"mousedown",G);
+SimileAjax.DOM.registerEvent(L.elmt,"mousedown",G);
+this._createHighlightDiv(O,C,S);
+this._eventIdToElmt[J.getID()]=C.elmt;
+};
+Timeline.DetailedEventPainter.prototype.paintImpreciseDurationEvent=function(L,P,W,S){var Z=this._timeline.getDocument();
+var K=L.getText();
+var D=L.getStart();
+var Q=L.getLatestStart();
+var T=L.getEnd();
+var X=L.getEarliestEnd();
+var B=Math.round(this._band.dateToPixelOffset(D));
+var F=Math.round(this._band.dateToPixelOffset(Q));
+var A=Math.round(this._band.dateToPixelOffset(T));
+var G=Math.round(this._band.dateToPixelOffset(X));
+var H=this._frc.computeSize(K);
+var E=this._findFreeTrackForSolid(A);
+var R=L.getColor();
+R=R!=null?R:W.event.duration.color;
+var O=this._paintEventTape(L,E,B,A,W.event.duration.impreciseColor,W.event.duration.impreciseOpacity,P,W);
+var C=this._paintEventTape(L,E,F,G,R,100,P,W);
+var J=this._getTrackData(E);
+J.solid=B;
+var Y=F+W.event.label.offsetFromLine;
+var U=this._findFreeTrackForText(E,Y+H.width,function(a){a.line=F-2;
+});
+this._getTrackData(U).text=F-2;
+this._paintEventLine(L,F,E,U,P,W);
+var V=Math.round(P.trackOffset+U*P.trackIncrement+P.trackHeight/2-H.height/2);
+var N=this._paintEventLabel(L,K,Y,V,H.width,H.height,W);
+var M=this;
+var I=function(a,b,c){return M._onClickDurationEvent(C.elmt,b,L);
+};
+SimileAjax.DOM.registerEvent(C.elmt,"mousedown",I);
+SimileAjax.DOM.registerEvent(N.elmt,"mousedown",I);
+this._createHighlightDiv(S,C,W);
+this._eventIdToElmt[L.getID()]=C.elmt;
+};
+Timeline.DetailedEventPainter.prototype._findFreeTrackForSolid=function(B,A){for(var D=0;
+true;
+D++){if(D<this._lowerTracks.length){var C=this._lowerTracks[D];
+if(Math.min(C.solid,C.text)>B&&(!(A)||C.line>A)){return D;
+}}else{this._lowerTracks.push({solid:Number.POSITIVE_INFINITY,text:Number.POSITIVE_INFINITY,line:Number.POSITIVE_INFINITY});
+return D;
+}if(D<this._upperTracks.length){var C=this._upperTracks[D];
+if(Math.min(C.solid,C.text)>B&&(!(A)||C.line>A)){return -1-D;
+}}else{this._upperTracks.push({solid:Number.POSITIVE_INFINITY,text:Number.POSITIVE_INFINITY,line:Number.POSITIVE_INFINITY});
+return -1-D;
+}}};
+Timeline.DetailedEventPainter.prototype._findFreeTrackForText=function(D,C,H){var F;
+var G;
+var B;
+var J;
+if(D<0){F=true;
+B=-D;
+G=this._findFreeUpperTrackForText(B,C);
+J=-1-G;
+}else{if(D>0){F=false;
+B=D+1;
+G=this._findFreeLowerTrackForText(B,C);
+J=G;
+}else{var A=this._findFreeUpperTrackForText(0,C);
+var I=this._findFreeLowerTrackForText(1,C);
+if(I-1<=A){F=false;
+B=1;
+G=I;
+J=G;
+}else{F=true;
+B=0;
+G=A;
+J=-1-G;
+}}}if(F){if(G==this._upperTracks.length){this._upperTracks.push({solid:Number.POSITIVE_INFINITY,text:Number.POSITIVE_INFINITY,line:Number.POSITIVE_INFINITY});
+}for(var E=B;
+E<G;
+E++){H(this._upperTracks[E]);
+}}else{if(G==this._lowerTracks.length){this._lowerTracks.push({solid:Number.POSITIVE_INFINITY,text:Number.POSITIVE_INFINITY,line:Number.POSITIVE_INFINITY});
+}for(var E=B;
+E<G;
+E++){H(this._lowerTracks[E]);
+}}return J;
+};
+Timeline.DetailedEventPainter.prototype._findFreeLowerTrackForText=function(A,C){for(;
+A<this._lowerTracks.length;
+A++){var B=this._lowerTracks[A];
+if(Math.min(B.solid,B.text)>=C){break;
+}}return A;
+};
+Timeline.DetailedEventPainter.prototype._findFreeUpperTrackForText=function(A,C){for(;
+A<this._upperTracks.length;
+A++){var B=this._upperTracks[A];
+if(Math.min(B.solid,B.text)>=C){break;
+}}return A;
+};
+Timeline.DetailedEventPainter.prototype._getTrackData=function(A){return(A<0)?this._upperTracks[-A-1]:this._lowerTracks[A];
+};
+Timeline.DetailedEventPainter.prototype._paintEventLine=function(I,C,F,A,G,D){var H=Math.round(G.trackOffset+F*G.trackIncrement+G.trackHeight/2);
+var J=Math.round(Math.abs(A-F)*G.trackIncrement);
+var E="1px solid "+D.event.label.lineColor;
+var B=this._timeline.getDocument().createElement("div");
+B.style.position="absolute";
+B.style.left=C+"px";
+B.style.width=D.event.label.offsetFromLine+"px";
+B.style.height=J+"px";
+if(F>A){B.style.top=(H-J)+"px";
+B.style.borderTop=E;
+}else{B.style.top=H+"px";
+B.style.borderBottom=E;
+}B.style.borderLeft=E;
+this._lineLayer.appendChild(B);
+};
+Timeline.DetailedEventPainter.prototype._paintEventIcon=function(I,E,B,F,D){var H=I.getIcon();
+H=H!=null?H:F.icon;
+var J=F.trackOffset+E*F.trackIncrement+F.trackHeight/2;
+var G=Math.round(J-F.iconHeight/2);
+var C=SimileAjax.Graphics.createTranslucentImage(H);
+var A=this._timeline.getDocument().createElement("div");
+A.style.position="absolute";
+A.style.left=B+"px";
+A.style.top=G+"px";
+A.appendChild(C);
+A.style.cursor="pointer";
+if(I._title!=null){A.title=I._title;
+}this._eventLayer.appendChild(A);
+return{left:B,top:G,width:F.iconWidth,height:F.iconHeight,elmt:A};
+};
+Timeline.DetailedEventPainter.prototype._paintEventLabel=function(H,I,B,F,A,J,D){var G=this._timeline.getDocument();
+var K=G.createElement("div");
+K.style.position="absolute";
+K.style.left=B+"px";
+K.style.width=A+"px";
+K.style.top=F+"px";
+K.style.height=J+"px";
+K.style.backgroundColor=D.event.label.backgroundColor;
+SimileAjax.Graphics.setOpacity(K,D.event.label.backgroundOpacity);
+this._eventLayer.appendChild(K);
+var E=G.createElement("div");
+E.style.position="absolute";
+E.style.left=B+"px";
+E.style.width=A+"px";
+E.style.top=F+"px";
+E.innerHTML=I;
+E.style.cursor="pointer";
+if(H._title!=null){E.title=H._title;
+}var C=H.getTextColor();
+if(C==null){C=H.getColor();
+}if(C!=null){E.style.color=C;
+}this._eventLayer.appendChild(E);
+return{left:B,top:F,width:A,height:J,elmt:E};
+};
+Timeline.DetailedEventPainter.prototype._paintEventTape=function(L,H,E,A,C,G,I,F){var B=A-E;
+var D=F.event.tape.height;
+var M=I.trackOffset+H*I.trackIncrement+I.trackHeight/2;
+var J=Math.round(M-D/2);
+var K=this._timeline.getDocument().createElement("div");
+K.style.position="absolute";
+K.style.left=E+"px";
+K.style.width=B+"px";
+K.style.top=J+"px";
+K.style.height=D+"px";
+K.style.backgroundColor=C;
+K.style.overflow="hidden";
+K.style.cursor="pointer";
+if(L._title!=null){K.title=L._title;
+}SimileAjax.Graphics.setOpacity(K,G);
+this._eventLayer.appendChild(K);
+return{left:E,top:J,width:B,height:D,elmt:K};
+};
+Timeline.DetailedEventPainter.prototype._createHighlightDiv=function(A,C,E){if(A>=0){var D=this._timeline.getDocument();
+var G=E.event;
+var B=G.highlightColors[Math.min(A,G.highlightColors.length-1)];
+var F=D.createElement("div");
+F.style.position="absolute";
+F.style.overflow="hidden";
+F.style.left=(C.left-2)+"px";
+F.style.width=(C.width+4)+"px";
+F.style.top=(C.top-2)+"px";
+F.style.height=(C.height+4)+"px";
+F.style.background=B;
+this._highlightLayer.appendChild(F);
+}};
+Timeline.DetailedEventPainter.prototype._onClickInstantEvent=function(B,C,A){var D=SimileAjax.DOM.getPageCoordinates(B);
+this._showBubble(D.left+Math.ceil(B.offsetWidth/2),D.top+Math.ceil(B.offsetHeight/2),A);
+this._fireOnSelect(A.getID());
+C.cancelBubble=true;
+SimileAjax.DOM.cancelEvent(C);
+return false;
+};
+Timeline.DetailedEventPainter.prototype._onClickDurationEvent=function(D,C,B){if("pageX" in C){var A=C.pageX;
+var F=C.pageY;
+}else{var E=SimileAjax.DOM.getPageCoordinates(D);
+var A=C.offsetX+E.left;
+var F=C.offsetY+E.top;
+}this._showBubble(A,F,B);
+this._fireOnSelect(B.getID());
+C.cancelBubble=true;
+SimileAjax.DOM.cancelEvent(C);
+return false;
+};
+Timeline.DetailedEventPainter.prototype.showBubble=function(A){var B=this._eventIdToElmt[A.getID()];
+if(B){var C=SimileAjax.DOM.getPageCoordinates(B);
+this._showBubble(C.left+B.offsetWidth/2,C.top+B.offsetHeight/2,A);
+}};
+Timeline.DetailedEventPainter.prototype._showBubble=function(A,D,B){var C=document.createElement("div");
+B.fillInfoBubble(C,this._params.theme,this._band.getLabeller());
+SimileAjax.WindowManager.cancelPopups();
+SimileAjax.Graphics.createBubbleForContentAndPoint(C,A,D,this._params.theme.event.bubble.width);
+};
+Timeline.DetailedEventPainter.prototype._fireOnSelect=function(B){for(var A=0;
+A<this._onSelectListeners.length;
+A++){this._onSelectListeners[A](B);
+}};
+
+
+/* ether-painters.js */
+Timeline.GregorianEtherPainter=function(A){this._params=A;
+this._theme=A.theme;
+this._unit=A.unit;
+this._multiple=("multiple" in A)?A.multiple:1;
+};
+Timeline.GregorianEtherPainter.prototype.initialize=function(C,B){this._band=C;
+this._timeline=B;
+this._backgroundLayer=C.createLayerDiv(0);
+this._backgroundLayer.setAttribute("name","ether-background");
+this._backgroundLayer.className="timeline-ether-bg";
+this._markerLayer=null;
+this._lineLayer=null;
+var D=("align" in this._params&&this._params.align!=undefined)?this._params.align:this._theme.ether.interval.marker[B.isHorizontal()?"hAlign":"vAlign"];
+var A=("showLine" in this._params)?this._params.showLine:this._theme.ether.interval.line.show;
+this._intervalMarkerLayout=new Timeline.EtherIntervalMarkerLayout(this._timeline,this._band,this._theme,D,A);
+this._highlight=new Timeline.EtherHighlight(this._timeline,this._band,this._theme,this._backgroundLayer);
+};
+Timeline.GregorianEtherPainter.prototype.setHighlight=function(A,B){this._highlight.position(A,B);
+};
+Timeline.GregorianEtherPainter.prototype.paint=function(){if(this._markerLayer){this._band.removeLayerDiv(this._markerLayer);
+}this._markerLayer=this._band.createLayerDiv(100);
+this._markerLayer.setAttribute("name","ether-markers");
+this._markerLayer.style.display="none";
+if(this._lineLayer){this._band.removeLayerDiv(this._lineLayer);
+}this._lineLayer=this._band.createLayerDiv(1);
+this._lineLayer.setAttribute("name","ether-lines");
+this._lineLayer.style.display="none";
+var C=this._band.getMinDate();
+var F=this._band.getMaxDate();
+var B=this._band.getTimeZone();
+var E=this._band.getLabeller();
+SimileAjax.DateTime.roundDownToInterval(C,this._unit,B,this._multiple,this._theme.firstDayOfWeek);
+var D=this;
+var A=function(G){for(var H=0;
+H<D._multiple;
+H++){SimileAjax.DateTime.incrementByInterval(G,D._unit);
+}};
+while(C.getTime()<F.getTime()){this._intervalMarkerLayout.createIntervalMarker(C,E,this._unit,this._markerLayer,this._lineLayer);
+A(C);
+}this._markerLayer.style.display="block";
+this._lineLayer.style.display="block";
+};
+Timeline.GregorianEtherPainter.prototype.softPaint=function(){};
+Timeline.GregorianEtherPainter.prototype.zoom=function(A){if(A!=0){this._unit+=A;
+}};
+Timeline.HotZoneGregorianEtherPainter=function(G){this._params=G;
+this._theme=G.theme;
+this._zones=[{startTime:Number.NEGATIVE_INFINITY,endTime:Number.POSITIVE_INFINITY,unit:G.unit,multiple:1}];
+for(var E=0;
+E<G.zones.length;
+E++){var B=G.zones[E];
+var D=SimileAjax.DateTime.parseGregorianDateTime(B.start).getTime();
+var F=SimileAjax.DateTime.parseGregorianDateTime(B.end).getTime();
+for(var C=0;
+C<this._zones.length&&F>D;
+C++){var A=this._zones[C];
+if(D<A.endTime){if(D>A.startTime){this._zones.splice(C,0,{startTime:A.startTime,endTime:D,unit:A.unit,multiple:A.multiple});
+C++;
+A.startTime=D;
+}if(F<A.endTime){this._zones.splice(C,0,{startTime:D,endTime:F,unit:B.unit,multiple:(B.multiple)?B.multiple:1});
+C++;
+A.startTime=F;
+D=F;
+}else{A.multiple=B.multiple;
+A.unit=B.unit;
+D=A.endTime;
+}}}}};
+Timeline.HotZoneGregorianEtherPainter.prototype.initialize=function(C,B){this._band=C;
+this._timeline=B;
+this._backgroundLayer=C.createLayerDiv(0);
+this._backgroundLayer.setAttribute("name","ether-background");
+this._backgroundLayer.className="timeline-ether-bg";
+this._markerLayer=null;
+this._lineLayer=null;
+var D=("align" in this._params&&this._params.align!=undefined)?this._params.align:this._theme.ether.interval.marker[B.isHorizontal()?"hAlign":"vAlign"];
+var A=("showLine" in this._params)?this._params.showLine:this._theme.ether.interval.line.show;
+this._intervalMarkerLayout=new Timeline.EtherIntervalMarkerLayout(this._timeline,this._band,this._theme,D,A);
+this._highlight=new Timeline.EtherHighlight(this._timeline,this._band,this._theme,this._backgroundLayer);
+};
+Timeline.HotZoneGregorianEtherPainter.prototype.setHighlight=function(A,B){this._highlight.position(A,B);
+};
+Timeline.HotZoneGregorianEtherPainter.prototype.paint=function(){if(this._markerLayer){this._band.removeLayerDiv(this._markerLayer);
+}this._markerLayer=this._band.createLayerDiv(100);
+this._markerLayer.setAttribute("name","ether-markers");
+this._markerLayer.style.display="none";
+if(this._lineLayer){this._band.removeLayerDiv(this._lineLayer);
+}this._lineLayer=this._band.createLayerDiv(1);
+this._lineLayer.setAttribute("name","ether-lines");
+this._lineLayer.style.display="none";
+var D=this._band.getMinDate();
+var A=this._band.getMaxDate();
+var K=this._band.getTimeZone();
+var I=this._band.getLabeller();
+var B=this;
+var L=function(N,M){for(var O=0;
+O<M.multiple;
+O++){SimileAjax.DateTime.incrementByInterval(N,M.unit);
+}};
+var C=0;
+while(C<this._zones.length){if(D.getTime()<this._zones[C].endTime){break;
+}C++;
+}var E=this._zones.length-1;
+while(E>=0){if(A.getTime()>this._zones[E].startTime){break;
+}E--;
+}for(var H=C;
+H<=E;
+H++){var G=this._zones[H];
+var J=new Date(Math.max(D.getTime(),G.startTime));
+var F=new Date(Math.min(A.getTime(),G.endTime));
+SimileAjax.DateTime.roundDownToInterval(J,G.unit,K,G.multiple,this._theme.firstDayOfWeek);
+SimileAjax.DateTime.roundUpToInterval(F,G.unit,K,G.multiple,this._theme.firstDayOfWeek);
+while(J.getTime()<F.getTime()){this._intervalMarkerLayout.createIntervalMarker(J,I,G.unit,this._markerLayer,this._lineLayer);
+L(J,G);
+}}this._markerLayer.style.display="block";
+this._lineLayer.style.display="block";
+};
+Timeline.HotZoneGregorianEtherPainter.prototype.softPaint=function(){};
+Timeline.HotZoneGregorianEtherPainter.prototype.zoom=function(B){if(B!=0){for(var A=0;
+A<this._zones.length;
+++A){if(this._zones[A]){this._zones[A].unit+=B;
+}}}};
+Timeline.YearCountEtherPainter=function(A){this._params=A;
+this._theme=A.theme;
+this._startDate=SimileAjax.DateTime.parseGregorianDateTime(A.startDate);
+this._multiple=("multiple" in A)?A.multiple:1;
+};
+Timeline.YearCountEtherPainter.prototype.initialize=function(C,B){this._band=C;
+this._timeline=B;
+this._backgroundLayer=C.createLayerDiv(0);
+this._backgroundLayer.setAttribute("name","ether-background");
+this._backgroundLayer.className="timeline-ether-bg";
+this._markerLayer=null;
+this._lineLayer=null;
+var D=("align" in this._params)?this._params.align:this._theme.ether.interval.marker[B.isHorizontal()?"hAlign":"vAlign"];
+var A=("showLine" in this._params)?this._params.showLine:this._theme.ether.interval.line.show;
+this._intervalMarkerLayout=new Timeline.EtherIntervalMarkerLayout(this._timeline,this._band,this._theme,D,A);
+this._highlight=new Timeline.EtherHighlight(this._timeline,this._band,this._theme,this._backgroundLayer);
+};
+Timeline.YearCountEtherPainter.prototype.setHighlight=function(A,B){this._highlight.position(A,B);
+};
+Timeline.YearCountEtherPainter.prototype.paint=function(){if(this._markerLayer){this._band.removeLayerDiv(this._markerLayer);
+}this._markerLayer=this._band.createLayerDiv(100);
+this._markerLayer.setAttribute("name","ether-markers");
+this._markerLayer.style.display="none";
+if(this._lineLayer){this._band.removeLayerDiv(this._lineLayer);
+}this._lineLayer=this._band.createLayerDiv(1);
+this._lineLayer.setAttribute("name","ether-lines");
+this._lineLayer.style.display="none";
+var B=new Date(this._startDate.getTime());
+var F=this._band.getMaxDate();
+var E=this._band.getMinDate().getUTCFullYear()-this._startDate.getUTCFullYear();
+B.setUTCFullYear(this._band.getMinDate().getUTCFullYear()-E%this._multiple);
+var C=this;
+var A=function(G){for(var H=0;
+H<C._multiple;
+H++){SimileAjax.DateTime.incrementByInterval(G,SimileAjax.DateTime.YEAR);
+}};
+var D={labelInterval:function(G,I){var H=G.getUTCFullYear()-C._startDate.getUTCFullYear();
+return{text:H,emphasized:H==0};
+}};
+while(B.getTime()<F.getTime()){this._intervalMarkerLayout.createIntervalMarker(B,D,SimileAjax.DateTime.YEAR,this._markerLayer,this._lineLayer);
+A(B);
+}this._markerLayer.style.display="block";
+this._lineLayer.style.display="block";
+};
+Timeline.YearCountEtherPainter.prototype.softPaint=function(){};
+Timeline.QuarterlyEtherPainter=function(A){this._params=A;
+this._theme=A.theme;
+this._startDate=SimileAjax.DateTime.parseGregorianDateTime(A.startDate);
+};
+Timeline.QuarterlyEtherPainter.prototype.initialize=function(C,B){this._band=C;
+this._timeline=B;
+this._backgroundLayer=C.createLayerDiv(0);
+this._backgroundLayer.setAttribute("name","ether-background");
+this._backgroundLayer.className="timeline-ether-bg";
+this._markerLayer=null;
+this._lineLayer=null;
+var D=("align" in this._params)?this._params.align:this._theme.ether.interval.marker[B.isHorizontal()?"hAlign":"vAlign"];
+var A=("showLine" in this._params)?this._params.showLine:this._theme.ether.interval.line.show;
+this._intervalMarkerLayout=new Timeline.EtherIntervalMarkerLayout(this._timeline,this._band,this._theme,D,A);
+this._highlight=new Timeline.EtherHighlight(this._timeline,this._band,this._theme,this._backgroundLayer);
+};
+Timeline.QuarterlyEtherPainter.prototype.setHighlight=function(A,B){this._highlight.position(A,B);
+};
+Timeline.QuarterlyEtherPainter.prototype.paint=function(){if(this._markerLayer){this._band.removeLayerDiv(this._markerLayer);
+}this._markerLayer=this._band.createLayerDiv(100);
+this._markerLayer.setAttribute("name","ether-markers");
+this._markerLayer.style.display="none";
+if(this._lineLayer){this._band.removeLayerDiv(this._lineLayer);
+}this._lineLayer=this._band.createLayerDiv(1);
+this._lineLayer.setAttribute("name","ether-lines");
+this._lineLayer.style.display="none";
+var B=new Date(0);
+var E=this._band.getMaxDate();
+B.setUTCFullYear(Math.max(this._startDate.getUTCFullYear(),this._band.getMinDate().getUTCFullYear()));
+B.setUTCMonth(this._startDate.getUTCMonth());
+var C=this;
+var A=function(F){F.setUTCMonth(F.getUTCMonth()+3);
+};
+var D={labelInterval:function(F,H){var G=(4+(F.getUTCMonth()-C._startDate.getUTCMonth())/3)%4;
+if(G!=0){return{text:"Q"+(G+1),emphasized:false};
+}else{return{text:"Y"+(F.getUTCFullYear()-C._startDate.getUTCFullYear()+1),emphasized:true};
+}}};
+while(B.getTime()<E.getTime()){this._intervalMarkerLayout.createIntervalMarker(B,D,SimileAjax.DateTime.YEAR,this._markerLayer,this._lineLayer);
+A(B);
+}this._markerLayer.style.display="block";
+this._lineLayer.style.display="block";
+};
+Timeline.QuarterlyEtherPainter.prototype.softPaint=function(){};
+Timeline.EtherIntervalMarkerLayout=function(M,L,C,E,H){var A=M.isHorizontal();
+if(A){if(E=="Top"){this.positionDiv=function(O,N){O.style.left=N+"px";
+O.style.top="0px";
+};
+}else{this.positionDiv=function(O,N){O.style.left=N+"px";
+O.style.bottom="0px";
+};
+}}else{if(E=="Left"){this.positionDiv=function(O,N){O.style.top=N+"px";
+O.style.left="0px";
+};
+}else{this.positionDiv=function(O,N){O.style.top=N+"px";
+O.style.right="0px";
+};
+}}var D=C.ether.interval.marker;
+var I=C.ether.interval.line;
+var B=C.ether.interval.weekend;
+var K=(A?"h":"v")+E;
+var G=D[K+"Styler"];
+var J=D[K+"EmphasizedStyler"];
+var F=SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.DAY];
+this.createIntervalMarker=function(T,a,b,c,Q){var U=Math.round(L.dateToPixelOffset(T));
+if(H&&b!=SimileAjax.DateTime.WEEK){var V=M.getDocument().createElement("div");
+V.className="timeline-ether-lines";
+if(I.opacity<100){SimileAjax.Graphics.setOpacity(V,I.opacity);
+}if(A){V.style.left=U+"px";
+}else{V.style.top=U+"px";
+}Q.appendChild(V);
+}if(b==SimileAjax.DateTime.WEEK){var N=C.firstDayOfWeek;
+var W=new Date(T.getTime()+(6-N-7)*F);
+var Z=new Date(W.getTime()+2*F);
+var X=Math.round(L.dateToPixelOffset(W));
+var S=Math.round(L.dateToPixelOffset(Z));
+var R=Math.max(1,S-X);
+var P=M.getDocument().createElement("div");
+P.className="timeline-ether-weekends";
+if(B.opacity<100){SimileAjax.Graphics.setOpacity(P,B.opacity);
+}if(A){P.style.left=X+"px";
+P.style.width=R+"px";
+}else{P.style.top=X+"px";
+P.style.height=R+"px";
+}Q.appendChild(P);
+}var Y=a.labelInterval(T,b);
+var O=M.getDocument().createElement("div");
+O.innerHTML=Y.text;
+O.className="timeline-date-label";
+if(Y.emphasized){O.className+=" timeline-date-label-em";
+}this.positionDiv(O,U);
+c.appendChild(O);
+return O;
+};
+};
+Timeline.EtherHighlight=function(C,E,D,B){var A=C.isHorizontal();
+this._highlightDiv=null;
+this._createHighlightDiv=function(){if(this._highlightDiv==null){this._highlightDiv=C.getDocument().createElement("div");
+this._highlightDiv.setAttribute("name","ether-highlight");
+this._highlightDiv.className="timeline-ether-highlight";
+var F=D.ether.highlightOpacity;
+if(F<100){SimileAjax.Graphics.setOpacity(this._highlightDiv,F);
+}B.appendChild(this._highlightDiv);
+}};
+this.position=function(F,I){this._createHighlightDiv();
+var J=Math.round(E.dateToPixelOffset(F));
+var H=Math.round(E.dateToPixelOffset(I));
+var G=Math.max(H-J,3);
+if(A){this._highlightDiv.style.left=J+"px";
+this._highlightDiv.style.width=G+"px";
+this._highlightDiv.style.height=(E.getViewWidth()-4)+"px";
+}else{this._highlightDiv.style.top=J+"px";
+this._highlightDiv.style.height=G+"px";
+this._highlightDiv.style.width=(E.getViewWidth()-4)+"px";
+}};
+};
+
+
+/* ethers.js */
+Timeline.LinearEther=function(A){this._params=A;
+this._interval=A.interval;
+this._pixelsPerInterval=A.pixelsPerInterval;
+};
+Timeline.LinearEther.prototype.initialize=function(B,A){this._band=B;
+this._timeline=A;
+this._unit=A.getUnit();
+if("startsOn" in this._params){this._start=this._unit.parseFromObject(this._params.startsOn);
+}else{if("endsOn" in this._params){this._start=this._unit.parseFromObject(this._params.endsOn);
+this.shiftPixels(-this._timeline.getPixelLength());
+}else{if("centersOn" in this._params){this._start=this._unit.parseFromObject(this._params.centersOn);
+this.shiftPixels(-this._timeline.getPixelLength()/2);
+}else{this._start=this._unit.makeDefaultValue();
+this.shiftPixels(-this._timeline.getPixelLength()/2);
+}}}};
+Timeline.LinearEther.prototype.setDate=function(A){this._start=this._unit.cloneValue(A);
+};
+Timeline.LinearEther.prototype.shiftPixels=function(B){var A=this._interval*B/this._pixelsPerInterval;
+this._start=this._unit.change(this._start,A);
+};
+Timeline.LinearEther.prototype.dateToPixelOffset=function(A){var B=this._unit.compare(A,this._start);
+return this._pixelsPerInterval*B/this._interval;
+};
+Timeline.LinearEther.prototype.pixelOffsetToDate=function(B){var A=B*this._interval/this._pixelsPerInterval;
+return this._unit.change(this._start,A);
+};
+Timeline.LinearEther.prototype.zoom=function(D){var B=0;
+var A=this._band._zoomIndex;
+var C=A;
+if(D&&(A>0)){C=A-1;
+}if(!D&&(A<(this._band._zoomSteps.length-1))){C=A+1;
+}this._band._zoomIndex=C;
+this._interval=SimileAjax.DateTime.gregorianUnitLengths[this._band._zoomSteps[C].unit];
+this._pixelsPerInterval=this._band._zoomSteps[C].pixelsPerInterval;
+B=this._band._zoomSteps[C].unit-this._band._zoomSteps[A].unit;
+return B;
+};
+Timeline.HotZoneEther=function(A){this._params=A;
+this._interval=A.interval;
+this._pixelsPerInterval=A.pixelsPerInterval;
+this._theme=A.theme;
+};
+Timeline.HotZoneEther.prototype.initialize=function(H,I){this._band=H;
+this._timeline=I;
+this._unit=I.getUnit();
+this._zones=[{startTime:Number.NEGATIVE_INFINITY,endTime:Number.POSITIVE_INFINITY,magnify:1}];
+var B=this._params;
+for(var D=0;
+D<B.zones.length;
+D++){var G=B.zones[D];
+var E=this._unit.parseFromObject(G.start);
+var F=this._unit.parseFromObject(G.end);
+for(var C=0;
+C<this._zones.length&&this._unit.compare(F,E)>0;
+C++){var A=this._zones[C];
+if(this._unit.compare(E,A.endTime)<0){if(this._unit.compare(E,A.startTime)>0){this._zones.splice(C,0,{startTime:A.startTime,endTime:E,magnify:A.magnify});
+C++;
+A.startTime=E;
+}if(this._unit.compare(F,A.endTime)<0){this._zones.splice(C,0,{startTime:E,endTime:F,magnify:G.magnify*A.magnify});
+C++;
+A.startTime=F;
+E=F;
+}else{A.magnify*=G.magnify;
+E=A.endTime;
+}}}}if("startsOn" in this._params){this._start=this._unit.parseFromObject(this._params.startsOn);
+}else{if("endsOn" in this._params){this._start=this._unit.parseFromObject(this._params.endsOn);
+this.shiftPixels(-this._timeline.getPixelLength());
+}else{if("centersOn" in this._params){this._start=this._unit.parseFromObject(this._params.centersOn);
+this.shiftPixels(-this._timeline.getPixelLength()/2);
+}else{this._start=this._unit.makeDefaultValue();
+this.shiftPixels(-this._timeline.getPixelLength()/2);
+}}}};
+Timeline.HotZoneEther.prototype.setDate=function(A){this._start=this._unit.cloneValue(A);
+};
+Timeline.HotZoneEther.prototype.shiftPixels=function(A){this._start=this.pixelOffsetToDate(A);
+};
+Timeline.HotZoneEther.prototype.dateToPixelOffset=function(A){return this._dateDiffToPixelOffset(this._start,A);
+};
+Timeline.HotZoneEther.prototype.pixelOffsetToDate=function(A){return this._pixelOffsetToDate(A,this._start);
+};
+Timeline.HotZoneEther.prototype.zoom=function(D){var B=0;
+var A=this._band._zoomIndex;
+var C=A;
+if(D&&(A>0)){C=A-1;
+}if(!D&&(A<(this._band._zoomSteps.length-1))){C=A+1;
+}this._band._zoomIndex=C;
+this._interval=SimileAjax.DateTime.gregorianUnitLengths[this._band._zoomSteps[C].unit];
+this._pixelsPerInterval=this._band._zoomSteps[C].pixelsPerInterval;
+B=this._band._zoomSteps[C].unit-this._band._zoomSteps[A].unit;
+return B;
+};
+Timeline.HotZoneEther.prototype._dateDiffToPixelOffset=function(I,D){var B=this._getScale();
+var H=I;
+var C=D;
+var A=0;
+if(this._unit.compare(H,C)<0){var G=0;
+while(G<this._zones.length){if(this._unit.compare(H,this._zones[G].endTime)<0){break;
+}G++;
+}while(this._unit.compare(H,C)<0){var E=this._zones[G];
+var F=this._unit.earlier(C,E.endTime);
+A+=(this._unit.compare(F,H)/(B/E.magnify));
+H=F;
+G++;
+}}else{var G=this._zones.length-1;
+while(G>=0){if(this._unit.compare(H,this._zones[G].startTime)>0){break;
+}G--;
+}while(this._unit.compare(H,C)>0){var E=this._zones[G];
+var F=this._unit.later(C,E.startTime);
+A+=(this._unit.compare(F,H)/(B/E.magnify));
+H=F;
+G--;
+}}return A;
+};
+Timeline.HotZoneEther.prototype._pixelOffsetToDate=function(H,C){var G=this._getScale();
+var E=C;
+if(H>0){var F=0;
+while(F<this._zones.length){if(this._unit.compare(E,this._zones[F].endTime)<0){break;
+}F++;
+}while(H>0){var A=this._zones[F];
+var D=G/A.magnify;
+if(A.endTime==Number.POSITIVE_INFINITY){E=this._unit.change(E,H*D);
+H=0;
+}else{var B=this._unit.compare(A.endTime,E)/D;
+if(B>H){E=this._unit.change(E,H*D);
+H=0;
+}else{E=A.endTime;
+H-=B;
+}}F++;
+}}else{var F=this._zones.length-1;
+while(F>=0){if(this._unit.compare(E,this._zones[F].startTime)>0){break;
+}F--;
+}H=-H;
+while(H>0){var A=this._zones[F];
+var D=G/A.magnify;
+if(A.startTime==Number.NEGATIVE_INFINITY){E=this._unit.change(E,-H*D);
+H=0;
+}else{var B=this._unit.compare(E,A.startTime)/D;
+if(B>H){E=this._unit.change(E,-H*D);
+H=0;
+}else{E=A.startTime;
+H-=B;
+}}F--;
+}}return E;
+};
+Timeline.HotZoneEther.prototype._getScale=function(){return this._interval/this._pixelsPerInterval;
+};
+
+
+/* labellers.js */
+Timeline.GregorianDateLabeller=function(A,B){this._locale=A;
+this._timeZone=B;
+};
+Timeline.GregorianDateLabeller.monthNames=[];
+Timeline.GregorianDateLabeller.dayNames=[];
+Timeline.GregorianDateLabeller.labelIntervalFunctions=[];
+Timeline.GregorianDateLabeller.getMonthName=function(B,A){return Timeline.GregorianDateLabeller.monthNames[A][B];
+};
+Timeline.GregorianDateLabeller.prototype.labelInterval=function(A,C){var B=Timeline.GregorianDateLabeller.labelIntervalFunctions[this._locale];
+if(B==null){B=Timeline.GregorianDateLabeller.prototype.defaultLabelInterval;
+}return B.call(this,A,C);
+};
+Timeline.GregorianDateLabeller.prototype.labelPrecise=function(A){return SimileAjax.DateTime.removeTimeZoneOffset(A,this._timeZone).toUTCString();
+};
+Timeline.GregorianDateLabeller.prototype.defaultLabelInterval=function(B,F){var C;
+var E=false;
+B=SimileAjax.DateTime.removeTimeZoneOffset(B,this._timeZone);
+switch(F){case SimileAjax.DateTime.MILLISECOND:C=B.getUTCMilliseconds();
+break;
+case SimileAjax.DateTime.SECOND:C=B.getUTCSeconds();
+break;
+case SimileAjax.DateTime.MINUTE:var A=B.getUTCMinutes();
+if(A==0){C=B.getUTCHours()+":00";
+E=true;
+}else{C=A;
+}break;
+case SimileAjax.DateTime.HOUR:C=B.getUTCHours()+"hr";
+break;
+case SimileAjax.DateTime.DAY:C=Timeline.GregorianDateLabeller.getMonthName(B.getUTCMonth(),this._locale)+" "+B.getUTCDate();
+break;
+case SimileAjax.DateTime.WEEK:C=Timeline.GregorianDateLabeller.getMonthName(B.getUTCMonth(),this._locale)+" "+B.getUTCDate();
+break;
+case SimileAjax.DateTime.MONTH:var A=B.getUTCMonth();
+if(A!=0){C=Timeline.GregorianDateLabeller.getMonthName(A,this._locale);
+break;
+}case SimileAjax.DateTime.YEAR:case SimileAjax.DateTime.DECADE:case SimileAjax.DateTime.CENTURY:case SimileAjax.DateTime.MILLENNIUM:var D=B.getUTCFullYear();
+if(D>0){C=B.getUTCFullYear();
+}else{C=(1-D)+"BC";
+}E=(F==SimileAjax.DateTime.MONTH)||(F==SimileAjax.DateTime.DECADE&&D%100==0)||(F==SimileAjax.DateTime.CENTURY&&D%1000==0);
+break;
+default:C=B.toUTCString();
+}return{text:C,emphasized:E};
+};
+
+
+/* original-painter.js */
+Timeline.OriginalEventPainter=function(A){this._params=A;
+this._onSelectListeners=[];
+this._filterMatcher=null;
+this._highlightMatcher=null;
+this._frc=null;
+this._eventIdToElmt={};
+};
+Timeline.OriginalEventPainter.prototype.initialize=function(B,A){this._band=B;
+this._timeline=A;
+this._backLayer=null;
+this._eventLayer=null;
+this._lineLayer=null;
+this._highlightLayer=null;
+this._eventIdToElmt=null;
+};
+Timeline.OriginalEventPainter.prototype.addOnSelectListener=function(A){this._onSelectListeners.push(A);
+};
+Timeline.OriginalEventPainter.prototype.removeOnSelectListener=function(B){for(var A=0;
+A<this._onSelectListeners.length;
+A++){if(this._onSelectListeners[A]==B){this._onSelectListeners.splice(A,1);
+break;
+}}};
+Timeline.OriginalEventPainter.prototype.getFilterMatcher=function(){return this._filterMatcher;
+};
+Timeline.OriginalEventPainter.prototype.setFilterMatcher=function(A){this._filterMatcher=A;
+};
+Timeline.OriginalEventPainter.prototype.getHighlightMatcher=function(){return this._highlightMatcher;
+};
+Timeline.OriginalEventPainter.prototype.setHighlightMatcher=function(A){this._highlightMatcher=A;
+};
+Timeline.OriginalEventPainter.prototype.paint=function(){var B=this._band.getEventSource();
+if(B==null){return ;
+}this._eventIdToElmt={};
+this._prepareForPainting();
+var I=this._params.theme.event;
+var G=Math.max(I.track.height,I.tape.height+this._frc.getLineHeight());
+var F={trackOffset:I.track.gap,trackHeight:G,trackGap:I.track.gap,trackIncrement:G+I.track.gap,icon:I.instant.icon,iconWidth:I.instant.iconWidth,iconHeight:I.instant.iconHeight,labelWidth:I.label.width};
+var C=this._band.getMinDate();
+var A=this._band.getMaxDate();
+var J=(this._filterMatcher!=null)?this._filterMatcher:function(K){return true;
+};
+var E=(this._highlightMatcher!=null)?this._highlightMatcher:function(K){return -1;
+};
+var D=B.getEventReverseIterator(C,A);
+while(D.hasNext()){var H=D.next();
+if(J(H)){this.paintEvent(H,F,this._params.theme,E(H));
+}}this._highlightLayer.style.display="block";
+this._lineLayer.style.display="block";
+this._eventLayer.style.display="block";
+};
+Timeline.OriginalEventPainter.prototype.softPaint=function(){};
+Timeline.OriginalEventPainter.prototype._prepareForPainting=function(){var B=this._band;
+if(this._backLayer==null){this._backLayer=this._band.createLayerDiv(0,"timeline-band-events");
+this._backLayer.style.visibility="hidden";
+var A=document.createElement("span");
+A.className="timeline-event-label";
+this._backLayer.appendChild(A);
+this._frc=SimileAjax.Graphics.getFontRenderingContext(A);
+}this._frc.update();
+this._tracks=[];
+if(this._highlightLayer!=null){B.removeLayerDiv(this._highlightLayer);
+}this._highlightLayer=B.createLayerDiv(105,"timeline-band-highlights");
+this._highlightLayer.style.display="none";
+if(this._lineLayer!=null){B.removeLayerDiv(this._lineLayer);
+}this._lineLayer=B.createLayerDiv(110,"timeline-band-lines");
+this._lineLayer.style.display="none";
+if(this._eventLayer!=null){B.removeLayerDiv(this._eventLayer);
+}this._eventLayer=B.createLayerDiv(115,"timeline-band-events");
+this._eventLayer.style.display="none";
+};
+Timeline.OriginalEventPainter.prototype.paintEvent=function(B,C,D,A){if(B.isInstant()){this.paintInstantEvent(B,C,D,A);
+}else{this.paintDurationEvent(B,C,D,A);
+}};
+Timeline.OriginalEventPainter.prototype.paintInstantEvent=function(B,C,D,A){if(B.isImprecise()){this.paintImpreciseInstantEvent(B,C,D,A);
+}else{this.paintPreciseInstantEvent(B,C,D,A);
+}};
+Timeline.OriginalEventPainter.prototype.paintDurationEvent=function(B,C,D,A){if(B.isImprecise()){this.paintImpreciseDurationEvent(B,C,D,A);
+}else{this.paintPreciseDurationEvent(B,C,D,A);
+}};
+Timeline.OriginalEventPainter.prototype.paintPreciseInstantEvent=function(J,N,P,O){var S=this._timeline.getDocument();
+var I=J.getText();
+var E=J.getStart();
+var C=Math.round(this._band.dateToPixelOffset(E));
+var A=Math.round(C+N.iconWidth/2);
+var H=Math.round(C-N.iconWidth/2);
+var F=this._frc.computeSize(I);
+var T=A+P.event.label.offsetFromLine;
+var D=T+F.width;
+var R=D;
+var L=this._findFreeTrack(R);
+var Q=Math.round(N.trackOffset+L*N.trackIncrement+N.trackHeight/2-F.height/2);
+var B=this._paintEventIcon(J,L,H,N,P);
+var M=this._paintEventLabel(J,I,T,Q,F.width,F.height,P);
+var K=this;
+var G=function(U,V,W){return K._onClickInstantEvent(B.elmt,V,J);
+};
+SimileAjax.DOM.registerEvent(B.elmt,"mousedown",G);
+SimileAjax.DOM.registerEvent(M.elmt,"mousedown",G);
+this._createHighlightDiv(O,B,P);
+this._eventIdToElmt[J.getID()]=B.elmt;
+this._tracks[L]=H;
+};
+Timeline.OriginalEventPainter.prototype.paintImpreciseInstantEvent=function(L,P,T,Q){var V=this._timeline.getDocument();
+var K=L.getText();
+var G=L.getStart();
+var R=L.getEnd();
+var D=Math.round(this._band.dateToPixelOffset(G));
+var B=Math.round(this._band.dateToPixelOffset(R));
+var A=Math.round(D+P.iconWidth/2);
+var J=Math.round(D-P.iconWidth/2);
+var H=this._frc.computeSize(K);
+var W=A+T.event.label.offsetFromLine;
+var E=W+H.width;
+var U=Math.max(E,B);
+var N=this._findFreeTrack(U);
+var S=Math.round(P.trackOffset+N*P.trackIncrement+P.trackHeight/2-H.height/2);
+var C=this._paintEventIcon(L,N,J,P,T);
+var O=this._paintEventLabel(L,K,W,S,H.width,H.height,T);
+var F=this._paintEventTape(L,N,D,B,T.event.instant.impreciseColor,T.event.instant.impreciseOpacity,P,T);
+var M=this;
+var I=function(X,Y,Z){return M._onClickInstantEvent(C.elmt,Y,L);
+};
+SimileAjax.DOM.registerEvent(C.elmt,"mousedown",I);
+SimileAjax.DOM.registerEvent(F.elmt,"mousedown",I);
+SimileAjax.DOM.registerEvent(O.elmt,"mousedown",I);
+this._createHighlightDiv(Q,C,T);
+this._eventIdToElmt[L.getID()]=C.elmt;
+this._tracks[N]=J;
+};
+Timeline.OriginalEventPainter.prototype.paintPreciseDurationEvent=function(I,M,Q,O){var T=this._timeline.getDocument();
+var H=I.getText();
+var E=I.getStart();
+var P=I.getEnd();
+var B=Math.round(this._band.dateToPixelOffset(E));
+var A=Math.round(this._band.dateToPixelOffset(P));
+var F=this._frc.computeSize(H);
+var U=B;
+var C=U+F.width;
+var S=Math.max(C,A);
+var K=this._findFreeTrack(S);
+var R=Math.round(M.trackOffset+K*M.trackIncrement+Q.event.tape.height);
+var N=I.getColor();
+N=N!=null?N:Q.event.duration.color;
+var D=this._paintEventTape(I,K,B,A,N,100,M,Q);
+var L=this._paintEventLabel(I,H,U,R,F.width,F.height,Q);
+var J=this;
+var G=function(V,W,X){return J._onClickDurationEvent(D.elmt,W,I);
+};
+SimileAjax.DOM.registerEvent(D.elmt,"mousedown",G);
+SimileAjax.DOM.registerEvent(L.elmt,"mousedown",G);
+this._createHighlightDiv(O,D,Q);
+this._eventIdToElmt[I.getID()]=D.elmt;
+this._tracks[K]=B;
+};
+Timeline.OriginalEventPainter.prototype.paintImpreciseDurationEvent=function(K,P,V,S){var Y=this._timeline.getDocument();
+var J=K.getText();
+var E=K.getStart();
+var Q=K.getLatestStart();
+var T=K.getEnd();
+var X=K.getEarliestEnd();
+var B=Math.round(this._band.dateToPixelOffset(E));
+var F=Math.round(this._band.dateToPixelOffset(Q));
+var A=Math.round(this._band.dateToPixelOffset(T));
+var G=Math.round(this._band.dateToPixelOffset(X));
+var H=this._frc.computeSize(J);
+var Z=F;
+var C=Z+H.width;
+var W=Math.max(C,A);
+var M=this._findFreeTrack(W);
+var U=Math.round(P.trackOffset+M*P.trackIncrement+V.event.tape.height);
+var R=K.getColor();
+R=R!=null?R:V.event.duration.color;
+var O=this._paintEventTape(K,M,B,A,V.event.duration.impreciseColor,V.event.duration.impreciseOpacity,P,V);
+var D=this._paintEventTape(K,M,F,G,R,100,P,V);
+var N=this._paintEventLabel(K,J,Z,U,H.width,H.height,V);
+var L=this;
+var I=function(a,b,c){return L._onClickDurationEvent(D.elmt,b,K);
+};
+SimileAjax.DOM.registerEvent(D.elmt,"mousedown",I);
+SimileAjax.DOM.registerEvent(N.elmt,"mousedown",I);
+this._createHighlightDiv(S,D,V);
+this._eventIdToElmt[K.getID()]=D.elmt;
+this._tracks[M]=B;
+};
+Timeline.OriginalEventPainter.prototype._findFreeTrack=function(A){for(var C=0;
+C<this._tracks.length;
+C++){var B=this._tracks[C];
+if(B>A){break;
+}}return C;
+};
+Timeline.OriginalEventPainter.prototype._paintEventIcon=function(I,E,B,F,D){var H=I.getIcon();
+H=H!=null?H:F.icon;
+var J=F.trackOffset+E*F.trackIncrement+F.trackHeight/2;
+var G=Math.round(J-F.iconHeight/2);
+var C=SimileAjax.Graphics.createTranslucentImage(H);
+var A=this._timeline.getDocument().createElement("div");
+A.className="timeline-event-icon";
+A.style.left=B+"px";
+A.style.top=G+"px";
+A.appendChild(C);
+if(I._title!=null){A.title=I._title;
+}this._eventLayer.appendChild(A);
+return{left:B,top:G,width:F.iconWidth,height:F.iconHeight,elmt:A};
+};
+Timeline.OriginalEventPainter.prototype._paintEventLabel=function(I,J,B,G,A,K,E){var H=this._timeline.getDocument();
+var F=H.createElement("div");
+F.className="timeline-event-label";
+F.style.left=B+"px";
+F.style.width=A+"px";
+F.style.top=G+"px";
+F.innerHTML=J;
+if(I._title!=null){F.title=I._title;
+}var D=I.getTextColor();
+if(D==null){D=I.getColor();
+}if(D!=null){F.style.color=D;
+}var C=I.getClassName();
+if(C){F.className+=" "+C;
+}this._eventLayer.appendChild(F);
+return{left:B,top:G,width:A,height:K,elmt:F};
+};
+Timeline.OriginalEventPainter.prototype._paintEventTape=function(L,H,E,A,C,G,I,F){var B=A-E;
+var D=F.event.tape.height;
+var J=I.trackOffset+H*I.trackIncrement;
+var K=this._timeline.getDocument().createElement("div");
+K.className="timeline-event-tape";
+K.style.left=E+"px";
+K.style.width=B+"px";
+K.style.top=J+"px";
+if(L._title!=null){K.title=L._title;
+}SimileAjax.Graphics.setOpacity(K,G);
+this._eventLayer.appendChild(K);
+return{left:E,top:J,width:B,height:D,elmt:K};
+};
+Timeline.OriginalEventPainter.prototype._createHighlightDiv=function(A,C,E){if(A>=0){var D=this._timeline.getDocument();
+var G=E.event;
+var B=G.highlightColors[Math.min(A,G.highlightColors.length-1)];
+var F=D.createElement("div");
+F.style.position="absolute";
+F.style.overflow="hidden";
+F.style.left=(C.left-2)+"px";
+F.style.width=(C.width+4)+"px";
+F.style.top=(C.top-2)+"px";
+F.style.height=(C.height+4)+"px";
+this._highlightLayer.appendChild(F);
+}};
+Timeline.OriginalEventPainter.prototype._onClickInstantEvent=function(B,C,A){var D=SimileAjax.DOM.getPageCoordinates(B);
+this._showBubble(D.left+Math.ceil(B.offsetWidth/2),D.top+Math.ceil(B.offsetHeight/2),A);
+this._fireOnSelect(A.getID());
+C.cancelBubble=true;
+SimileAjax.DOM.cancelEvent(C);
+return false;
+};
+Timeline.OriginalEventPainter.prototype._onClickDurationEvent=function(D,C,B){if("pageX" in C){var A=C.pageX;
+var F=C.pageY;
+}else{var E=SimileAjax.DOM.getPageCoordinates(D);
+var A=C.offsetX+E.left;
+var F=C.offsetY+E.top;
+}this._showBubble(A,F,B);
+this._fireOnSelect(B.getID());
+C.cancelBubble=true;
+SimileAjax.DOM.cancelEvent(C);
+return false;
+};
+Timeline.OriginalEventPainter.prototype.showBubble=function(A){var B=this._eventIdToElmt[A.getID()];
+if(B){var C=SimileAjax.DOM.getPageCoordinates(B);
+this._showBubble(C.left+B.offsetWidth/2,C.top+B.offsetHeight/2,A);
+}};
+Timeline.OriginalEventPainter.prototype._showBubble=function(A,D,B){var C=document.createElement("div");
+B.fillInfoBubble(C,this._params.theme,this._band.getLabeller());
+SimileAjax.WindowManager.cancelPopups();
+SimileAjax.Graphics.createBubbleForContentAndPoint(C,A,D,this._params.theme.event.bubble.width);
+};
+Timeline.OriginalEventPainter.prototype._fireOnSelect=function(B){for(var A=0;
+A<this._onSelectListeners.length;
+A++){this._onSelectListeners[A](B);
+}};
+
+
+/* overview-painter.js */
+Timeline.OverviewEventPainter=function(A){this._params=A;
+this._onSelectListeners=[];
+this._filterMatcher=null;
+this._highlightMatcher=null;
+};
+Timeline.OverviewEventPainter.prototype.initialize=function(B,A){this._band=B;
+this._timeline=A;
+this._eventLayer=null;
+this._highlightLayer=null;
+};
+Timeline.OverviewEventPainter.prototype.addOnSelectListener=function(A){this._onSelectListeners.push(A);
+};
+Timeline.OverviewEventPainter.prototype.removeOnSelectListener=function(B){for(var A=0;
+A<this._onSelectListeners.length;
+A++){if(this._onSelectListeners[A]==B){this._onSelectListeners.splice(A,1);
+break;
+}}};
+Timeline.OverviewEventPainter.prototype.getFilterMatcher=function(){return this._filterMatcher;
+};
+Timeline.OverviewEventPainter.prototype.setFilterMatcher=function(A){this._filterMatcher=A;
+};
+Timeline.OverviewEventPainter.prototype.getHighlightMatcher=function(){return this._highlightMatcher;
+};
+Timeline.OverviewEventPainter.prototype.setHighlightMatcher=function(A){this._highlightMatcher=A;
+};
+Timeline.OverviewEventPainter.prototype.paint=function(){var B=this._band.getEventSource();
+if(B==null){return ;
+}this._prepareForPainting();
+var H=this._params.theme.event;
+var F={trackOffset:H.overviewTrack.offset,trackHeight:H.overviewTrack.height,trackGap:H.overviewTrack.gap,trackIncrement:H.overviewTrack.height+H.overviewTrack.gap};
+var C=this._band.getMinDate();
+var A=this._band.getMaxDate();
+var I=(this._filterMatcher!=null)?this._filterMatcher:function(J){return true;
+};
+var E=(this._highlightMatcher!=null)?this._highlightMatcher:function(J){return -1;
+};
+var D=B.getEventReverseIterator(C,A);
+while(D.hasNext()){var G=D.next();
+if(I(G)){this.paintEvent(G,F,this._params.theme,E(G));
+}}this._highlightLayer.style.display="block";
+this._eventLayer.style.display="block";
+};
+Timeline.OverviewEventPainter.prototype.softPaint=function(){};
+Timeline.OverviewEventPainter.prototype._prepareForPainting=function(){var A=this._band;
+this._tracks=[];
+if(this._highlightLayer!=null){A.removeLayerDiv(this._highlightLayer);
+}this._highlightLayer=A.createLayerDiv(105,"timeline-band-highlights");
+this._highlightLayer.style.display="none";
+if(this._eventLayer!=null){A.removeLayerDiv(this._eventLayer);
+}this._eventLayer=A.createLayerDiv(110,"timeline-band-events");
+this._eventLayer.style.display="none";
+};
+Timeline.OverviewEventPainter.prototype.paintEvent=function(B,C,D,A){if(B.isInstant()){this.paintInstantEvent(B,C,D,A);
+}else{this.paintDurationEvent(B,C,D,A);
+}};
+Timeline.OverviewEventPainter.prototype.paintInstantEvent=function(C,F,G,B){var A=C.getStart();
+var H=Math.round(this._band.dateToPixelOffset(A));
+var D=C.getColor();
+D=D!=null?D:G.event.duration.color;
+var E=this._paintEventTick(C,H,D,100,F,G);
+this._createHighlightDiv(B,E,G);
+};
+Timeline.OverviewEventPainter.prototype.paintDurationEvent=function(K,J,I,D){var A=K.getLatestStart();
+var C=K.getEarliestEnd();
+var B=Math.round(this._band.dateToPixelOffset(A));
+var E=Math.round(this._band.dateToPixelOffset(C));
+var H=0;
+for(;
+H<this._tracks.length;
+H++){if(E<this._tracks[H]){break;
+}}this._tracks[H]=E;
+var G=K.getColor();
+G=G!=null?G:I.event.duration.color;
+var F=this._paintEventTape(K,H,B,E,G,100,J,I);
+this._createHighlightDiv(D,F,I);
+};
+Timeline.OverviewEventPainter.prototype._paintEventTape=function(K,B,C,J,D,F,G,E){var H=G.trackOffset+B*G.trackIncrement;
+var A=J-C;
+var L=G.trackHeight;
+var I=this._timeline.getDocument().createElement("div");
+I.className="timeline-small-event-tape";
+I.style.left=C+"px";
+I.style.width=A+"px";
+I.style.top=H+"px";
+if(F<100){SimileAjax.Graphics.setOpacity(I,F);
+}this._eventLayer.appendChild(I);
+return{left:C,top:H,width:A,height:L,elmt:I};
+};
+Timeline.OverviewEventPainter.prototype._paintEventTick=function(J,B,D,F,G,E){var K=E.event.overviewTrack.tickHeight;
+var H=G.trackOffset-K;
+var A=1;
+var I=this._timeline.getDocument().createElement("div");
+I.className="timeline-small-event-icon";
+I.style.left=B+"px";
+I.style.top=H+"px";
+var C=J.getClassName();
+if(C){I.className+=" small-"+C;
+}if(F<100){SimileAjax.Graphics.setOpacity(I,F);
+}this._eventLayer.appendChild(I);
+return{left:B,top:H,width:A,height:K,elmt:I};
+};
+Timeline.OverviewEventPainter.prototype._createHighlightDiv=function(A,C,E){if(A>=0){var D=this._timeline.getDocument();
+var G=E.event;
+var B=G.highlightColors[Math.min(A,G.highlightColors.length-1)];
+var F=D.createElement("div");
+F.style.position="absolute";
+F.style.overflow="hidden";
+F.style.left=(C.left-1)+"px";
+F.style.width=(C.width+2)+"px";
+F.style.top=(C.top-1)+"px";
+F.style.height=(C.height+2)+"px";
+F.style.background=B;
+this._highlightLayer.appendChild(F);
+}};
+Timeline.OverviewEventPainter.prototype.showBubble=function(A){};
+
+
+/* sources.js */
+Timeline.DefaultEventSource=function(A){this._events=(A instanceof Object)?A:new SimileAjax.EventIndex();
+this._listeners=[];
+};
+Timeline.DefaultEventSource.prototype.addListener=function(A){this._listeners.push(A);
+};
+Timeline.DefaultEventSource.prototype.removeListener=function(B){for(var A=0;
+A<this._listeners.length;
+A++){if(this._listeners[A]==B){this._listeners.splice(A,1);
+break;
+}}};
+Timeline.DefaultEventSource.prototype.loadXML=function(F,A){var B=this._getBaseURL(A);
+var G=F.documentElement.getAttribute("wiki-url");
+var K=F.documentElement.getAttribute("wiki-section");
+var D=F.documentElement.getAttribute("date-time-format");
+var E=this._events.getUnit().getParser(D);
+var C=F.documentElement.firstChild;
+var H=false;
+while(C!=null){if(C.nodeType==1){var J="";
+if(C.firstChild!=null&&C.firstChild.nodeType==3){J=C.firstChild.nodeValue;
+}var I=new Timeline.DefaultEventSource.Event(C.getAttribute("id"),E(C.getAttribute("start")),E(C.getAttribute("end")),E(C.getAttribute("latestStart")),E(C.getAttribute("earliestEnd")),C.getAttribute("isDuration")!="true",C.getAttribute("title"),J,this._resolveRelativeURL(C.getAttribute("image"),B),this._resolveRelativeURL(C.getAttribute("link"),B),this._resolveRelativeURL(C.getAttribute("icon"),B),C.getAttribute("color"),C.getAttribute("textColor"),C.getAttribute("classname"));
+I._node=C;
+I.getProperty=function(L){return this._node.getAttribute(L);
+};
+I.setWikiInfo(G,K);
+this._events.add(I);
+H=true;
+}C=C.nextSibling;
+}if(H){this._fire("onAddMany",[]);
+}};
+Timeline.DefaultEventSource.prototype.loadJSON=function(F,B){var C=this._getBaseURL(B);
+var I=false;
+if(F&&F.events){var H=("wikiURL" in F)?F.wikiURL:null;
+var K=("wikiSection" in F)?F.wikiSection:null;
+var D=("dateTimeFormat" in F)?F.dateTimeFormat:null;
+var G=this._events.getUnit().getParser(D);
+for(var E=0;
+E<F.events.length;
+E++){var A=F.events[E];
+var J=new Timeline.DefaultEventSource.Event(("id" in A)?A.id:undefined,G(A.start),G(A.end),G(A.latestStart),G(A.earliestEnd),A.isDuration||false,A.title,A.description,this._resolveRelativeURL(A.image,C),this._resolveRelativeURL(A.link,C),this._resolveRelativeURL(A.icon,C),A.color,A.textColor,A.classname);
+J._obj=A;
+J.getProperty=function(L){return this._obj[L];
+};
+J.setWikiInfo(H,K);
+this._events.add(J);
+I=true;
+}}if(I){this._fire("onAddMany",[]);
+}};
+Timeline.DefaultEventSource.prototype.loadSPARQL=function(G,A){var C=this._getBaseURL(A);
+var E="iso8601";
+var F=this._events.getUnit().getParser(E);
+if(G==null){return ;
+}var D=G.documentElement.firstChild;
+while(D!=null&&(D.nodeType!=1||D.nodeName!="results")){D=D.nextSibling;
+}var I=null;
+var L=null;
+if(D!=null){I=D.getAttribute("wiki-url");
+L=D.getAttribute("wiki-section");
+D=D.firstChild;
+}var J=false;
+while(D!=null){if(D.nodeType==1){var B={};
+var H=D.firstChild;
+while(H!=null){if(H.nodeType==1&&H.firstChild!=null&&H.firstChild.nodeType==1&&H.firstChild.firstChild!=null&&H.firstChild.firstChild.nodeType==3){B[H.getAttribute("name")]=H.firstChild.firstChild.nodeValue;
+}H=H.nextSibling;
+}if(B["start"]==null&&B["date"]!=null){B["start"]=B["date"];
+}var K=new Timeline.DefaultEventSource.Event(B["id"],F(B["start"]),F(B["end"]),F(B["latestStart"]),F(B["earliestEnd"]),B["isDuration"]!="true",B["title"],B["description"],this._resolveRelativeURL(B["image"],C),this._resolveRelativeURL(B["link"],C),this._resolveRelativeURL(B["icon"],C),B["color"],B["textColor"],B["classname"]);
+K._bindings=B;
+K.getProperty=function(M){return this._bindings[M];
+};
+K.setWikiInfo(I,L);
+this._events.add(K);
+J=true;
+}D=D.nextSibling;
+}if(J){this._fire("onAddMany",[]);
+}};
+Timeline.DefaultEventSource.prototype.add=function(A){this._events.add(A);
+this._fire("onAddOne",[A]);
+};
+Timeline.DefaultEventSource.prototype.addMany=function(B){for(var A=0;
+A<B.length;
+A++){this._events.add(B[A]);
+}this._fire("onAddMany",[]);
+};
+Timeline.DefaultEventSource.prototype.clear=function(){this._events.removeAll();
+this._fire("onClear",[]);
+};
+Timeline.DefaultEventSource.prototype.getEvent=function(A){return this._events.getEvent(A);
+};
+Timeline.DefaultEventSource.prototype.getEventIterator=function(A,B){return this._events.getIterator(A,B);
+};
+Timeline.DefaultEventSource.prototype.getEventReverseIterator=function(A,B){return this._events.getReverseIterator(A,B);
+};
+Timeline.DefaultEventSource.prototype.getAllEventIterator=function(){return this._events.getAllIterator();
+};
+Timeline.DefaultEventSource.prototype.getCount=function(){return this._events.getCount();
+};
+Timeline.DefaultEventSource.prototype.getEarliestDate=function(){return this._events.getEarliestDate();
+};
+Timeline.DefaultEventSource.prototype.getLatestDate=function(){return this._events.getLatestDate();
+};
+Timeline.DefaultEventSource.prototype._fire=function(B,A){for(var C=0;
+C<this._listeners.length;
+C++){var D=this._listeners[C];
+if(B in D){try{D[B].apply(D,A);
+}catch(E){SimileAjax.Debug.exception(E);
+}}}};
+Timeline.DefaultEventSource.prototype._getBaseURL=function(A){if(A.indexOf("://")<0){var C=this._getBaseURL(document.location.href);
+if(A.substr(0,1)=="/"){A=C.substr(0,C.indexOf("/",C.indexOf("://")+3))+A;
+}else{A=C+A;
+}}var B=A.lastIndexOf("/");
+if(B<0){return"";
+}else{return A.substr(0,B+1);
+}};
+Timeline.DefaultEventSource.prototype._resolveRelativeURL=function(A,B){if(A==null||A==""){return A;
+}else{if(A.indexOf("://")>0){return A;
+}else{if(A.substr(0,1)=="/"){return B.substr(0,B.indexOf("/",B.indexOf("://")+3))+A;
+}else{return B+A;
+}}}};
+Timeline.DefaultEventSource.Event=function(A,B,H,J,I,C,O,N,E,L,K,G,M,F,D){A=(A)?A.trim():"";
+this._id=A.length>0?A:("e"+Math.floor(Math.random()*1000000));
+this._instant=C||(H==null);
+this._start=B;
+this._end=(H!=null)?H:B;
+this._latestStart=(J!=null)?J:(C?this._end:this._start);
+this._earliestEnd=(I!=null)?I:(C?this._start:this._end);
+this._text=SimileAjax.HTML.deEntify(O);
+this._description=SimileAjax.HTML.deEntify(N);
+this._image=(E!=null&&E!="")?E:null;
+this._link=(L!=null&&L!="")?L:null;
+this._title=(F!=null)?F:null;
+this._icon=(K!=null&&K!="")?K:null;
+this._color=(G!=null&&G!="")?G:null;
+this._textColor=(M!=null&&M!="")?M:null;
+this._classname=(D!=null&&D!="")?D:null;
+this._wikiURL=null;
+this._wikiSection=null;
+};
+Timeline.DefaultEventSource.Event.prototype={getID:function(){return this._id;
+},isInstant:function(){return this._instant;
+},isImprecise:function(){return this._start!=this._latestStart||this._end!=this._earliestEnd;
+},getStart:function(){return this._start;
+},getEnd:function(){return this._end;
+},getLatestStart:function(){return this._latestStart;
+},getEarliestEnd:function(){return this._earliestEnd;
+},getText:function(){return this._text;
+},getDescription:function(){return this._description;
+},getImage:function(){return this._image;
+},getLink:function(){return this._link;
+},getIcon:function(){return this._icon;
+},getColor:function(){return this._color;
+},getTextColor:function(){return this._textColor;
+},getClassName:function(){return this._classname;
+},getProperty:function(A){return null;
+},getWikiURL:function(){return this._wikiURL;
+},getWikiSection:function(){return this._wikiSection;
+},setWikiInfo:function(B,A){this._wikiURL=B;
+this._wikiSection=A;
+},fillDescription:function(A){A.innerHTML=this._description;
+},fillWikiInfo:function(D){if(this._wikiURL!=null&&this._wikiSection!=null){var C=this.getProperty("wikiID");
+if(C==null||C.length==0){C=this.getText();
+}C=C.replace(/\s/g,"_");
+var B=this._wikiURL+this._wikiSection.replace(/\s/g,"_")+"/"+C;
+var A=document.createElement("a");
+A.href=B;
+A.target="new";
+A.innerHTML=Timeline.strings[Timeline.clientLocale].wikiLinkLabel;
+D.appendChild(document.createTextNode("["));
+D.appendChild(A);
+D.appendChild(document.createTextNode("]"));
+}else{D.style.display="none";
+}},fillTime:function(A,B){if(this._instant){if(this.isImprecise()){A.appendChild(A.ownerDocument.createTextNode(B.labelPrecise(this._start)));
+A.appendChild(A.ownerDocument.createElement("br"));
+A.appendChild(A.ownerDocument.createTextNode(B.labelPrecise(this._end)));
+}else{A.appendChild(A.ownerDocument.createTextNode(B.labelPrecise(this._start)));
+}}else{if(this.isImprecise()){A.appendChild(A.ownerDocument.createTextNode(B.labelPrecise(this._start)+" ~ "+B.labelPrecise(this._latestStart)));
+A.appendChild(A.ownerDocument.createElement("br"));
+A.appendChild(A.ownerDocument.createTextNode(B.labelPrecise(this._earliestEnd)+" ~ "+B.labelPrecise(this._end)));
+}else{A.appendChild(A.ownerDocument.createTextNode(B.labelPrecise(this._start)));
+A.appendChild(A.ownerDocument.createElement("br"));
+A.appendChild(A.ownerDocument.createTextNode(B.labelPrecise(this._end)));
+}}},fillInfoBubble:function(A,D,K){var L=A.ownerDocument;
+var J=this.getText();
+var H=this.getLink();
+var C=this.getImage();
+if(C!=null){var E=L.createElement("img");
+E.src=C;
+D.event.bubble.imageStyler(E);
+A.appendChild(E);
+}var M=L.createElement("div");
+var B=L.createTextNode(J);
+if(H!=null){var I=L.createElement("a");
+I.href=H;
+I.appendChild(B);
+M.appendChild(I);
+}else{M.appendChild(B);
+}D.event.bubble.titleStyler(M);
+A.appendChild(M);
+var N=L.createElement("div");
+this.fillDescription(N);
+D.event.bubble.bodyStyler(N);
+A.appendChild(N);
+var G=L.createElement("div");
+this.fillTime(G,K);
+D.event.bubble.timeStyler(G);
+A.appendChild(G);
+var F=L.createElement("div");
+this.fillWikiInfo(F);
+D.event.bubble.wikiStyler(F);
+A.appendChild(F);
+}};
+
+
+/* themes.js */
+Timeline.ClassicTheme=new Object();
+Timeline.ClassicTheme.implementations=[];
+Timeline.ClassicTheme.create=function(A){if(A==null){A=Timeline.getDefaultLocale();
+}var B=Timeline.ClassicTheme.implementations[A];
+if(B==null){B=Timeline.ClassicTheme._Impl;
+}return new B();
+};
+Timeline.ClassicTheme._Impl=function(){this.firstDayOfWeek=0;
+this.ether={backgroundColors:[],highlightOpacity:50,interval:{line:{show:true,opacity:25},weekend:{opacity:30},marker:{hAlign:"Bottom",vAlign:"Right"}}};
+this.event={track:{height:10,gap:2},overviewTrack:{offset:20,tickHeight:6,height:2,gap:1},tape:{height:4},instant:{icon:Timeline.urlPrefix+"images/dull-blue-circle.png",iconWidth:10,iconHeight:10,impreciseOpacity:20},duration:{impreciseOpacity:20},label:{backgroundOpacity:50,offsetFromLine:3},highlightColors:[],bubble:{width:250,height:125,titleStyler:function(A){A.className="timeline-event-bubble-title";
+},bodyStyler:function(A){A.className="timeline-event-bubble-body";
+},imageStyler:function(A){A.className="timeline-event-bubble-image";
+},wikiStyler:function(A){A.className="timeline-event-bubble-wiki";
+},timeStyler:function(A){A.className="timeline-event-bubble-time";
+}}};
+this.zoom=true;
+};
+
+
+/* timeline.js */
+Timeline.strings={};
+Timeline.getDefaultLocale=function(){return Timeline.clientLocale;
+};
+Timeline.create=function(C,B,A,D){return new Timeline._Impl(C,B,A,D);
+};
+Timeline.HORIZONTAL=0;
+Timeline.VERTICAL=1;
+Timeline._defaultTheme=null;
+Timeline.createBandInfo=function(D){var E=("theme" in D)?D.theme:Timeline.getDefaultTheme();
+var B=("eventSource" in D)?D.eventSource:null;
+var F=new Timeline.LinearEther({centersOn:("date" in D)?D.date:new Date(),interval:SimileAjax.DateTime.gregorianUnitLengths[D.intervalUnit],pixelsPerInterval:D.intervalPixels,theme:E});
+var G=new Timeline.GregorianEtherPainter({unit:D.intervalUnit,multiple:("multiple" in D)?D.multiple:1,theme:E,align:("align" in D)?D.align:undefined});
+var I={showText:("showEventText" in D)?D.showEventText:true,theme:E};
+if("eventPainterParams" in D){for(var A in D.eventPainterParams){I[A]=D.eventPainterParams[A];
+}}if("trackHeight" in D){I.trackHeight=D.trackHeight;
+}if("trackGap" in D){I.trackGap=D.trackGap;
+}var H=("overview" in D&&D.overview)?"overview":("layout" in D?D.layout:"original");
+var C;
+if("eventPainter" in D){C=new D.eventPainter(I);
+}else{switch(H){case"overview":C=new Timeline.OverviewEventPainter(I);
+break;
+case"detailed":C=new Timeline.DetailedEventPainter(I);
+break;
+default:C=new Timeline.OriginalEventPainter(I);
+}}return{width:D.width,eventSource:B,timeZone:("timeZone" in D)?D.timeZone:0,ether:F,etherPainter:G,eventPainter:C,theme:E,zoomIndex:("zoomIndex" in D)?D.zoomIndex:0,zoomSteps:("zoomSteps" in D)?D.zoomSteps:null};
+};
+Timeline.createHotZoneBandInfo=function(D){var E=("theme" in D)?D.theme:Timeline.getDefaultTheme();
+var B=("eventSource" in D)?D.eventSource:null;
+var F=new Timeline.HotZoneEther({centersOn:("date" in D)?D.date:new Date(),interval:SimileAjax.DateTime.gregorianUnitLengths[D.intervalUnit],pixelsPerInterval:D.intervalPixels,zones:D.zones,theme:E});
+var G=new Timeline.HotZoneGregorianEtherPainter({unit:D.intervalUnit,zones:D.zones,theme:E,align:("align" in D)?D.align:undefined});
+var I={showText:("showEventText" in D)?D.showEventText:true,theme:E};
+if("eventPainterParams" in D){for(var A in D.eventPainterParams){I[A]=D.eventPainterParams[A];
+}}if("trackHeight" in D){I.trackHeight=D.trackHeight;
+}if("trackGap" in D){I.trackGap=D.trackGap;
+}var H=("overview" in D&&D.overview)?"overview":("layout" in D?D.layout:"original");
+var C;
+if("eventPainter" in D){C=new D.eventPainter(I);
+}else{switch(H){case"overview":C=new Timeline.OverviewEventPainter(I);
+break;
+case"detailed":C=new Timeline.DetailedEventPainter(I);
+break;
+default:C=new Timeline.OriginalEventPainter(I);
+}}return{width:D.width,eventSource:B,timeZone:("timeZone" in D)?D.timeZone:0,ether:F,etherPainter:G,eventPainter:C,theme:E,zoomIndex:("zoomIndex" in D)?D.zoomIndex:0,zoomSteps:("zoomSteps" in D)?D.zoomSteps:null};
+};
+Timeline.getDefaultTheme=function(){if(Timeline._defaultTheme==null){Timeline._defaultTheme=Timeline.ClassicTheme.create(Timeline.getDefaultLocale());
+}return Timeline._defaultTheme;
+};
+Timeline.setDefaultTheme=function(A){Timeline._defaultTheme=A;
+};
+Timeline.loadXML=function(A,C){var D=function(G,E,F){alert("Failed to load data xml from "+A+"\n"+G);
+};
+var B=function(F){var E=F.responseXML;
+if(!E.documentElement&&F.responseStream){E.load(F.responseStream);
+}C(E,A);
+};
+SimileAjax.XmlHttp.get(A,D,B);
+};
+Timeline.loadJSON=function(url,f){var fError=function(statusText,status,xmlhttp){alert("Failed to load json data from "+url+"\n"+statusText);
+};
+var fDone=function(xmlhttp){f(eval("("+xmlhttp.responseText+")"),url);
+};
+SimileAjax.XmlHttp.get(url,fError,fDone);
+};
+Timeline._Impl=function(C,B,A,D){SimileAjax.WindowManager.initialize();
+this._containerDiv=C;
+this._bandInfos=B;
+this._orientation=A==null?Timeline.HORIZONTAL:A;
+this._unit=(D!=null)?D:SimileAjax.NativeDateUnit;
+this._initialize();
+};
+Timeline._Impl.prototype.dispose=function(){for(var A=0;
+A<this._bands.length;
+A++){this._bands[A].dispose();
+}this._bands=null;
+this._bandInfos=null;
+this._containerDiv.innerHTML="";
+};
+Timeline._Impl.prototype.getBandCount=function(){return this._bands.length;
+};
+Timeline._Impl.prototype.getBand=function(A){return this._bands[A];
+};
+Timeline._Impl.prototype.layout=function(){this._distributeWidths();
+};
+Timeline._Impl.prototype.paint=function(){for(var A=0;
+A<this._bands.length;
+A++){this._bands[A].paint();
+}};
+Timeline._Impl.prototype.getDocument=function(){return this._containerDiv.ownerDocument;
+};
+Timeline._Impl.prototype.addDiv=function(A){this._containerDiv.appendChild(A);
+};
+Timeline._Impl.prototype.removeDiv=function(A){this._containerDiv.removeChild(A);
+};
+Timeline._Impl.prototype.isHorizontal=function(){return this._orientation==Timeline.HORIZONTAL;
+};
+Timeline._Impl.prototype.isVertical=function(){return this._orientation==Timeline.VERTICAL;
+};
+Timeline._Impl.prototype.getPixelLength=function(){return this._orientation==Timeline.HORIZONTAL?this._containerDiv.offsetWidth:this._containerDiv.offsetHeight;
+};
+Timeline._Impl.prototype.getPixelWidth=function(){return this._orientation==Timeline.VERTICAL?this._containerDiv.offsetWidth:this._containerDiv.offsetHeight;
+};
+Timeline._Impl.prototype.getUnit=function(){return this._unit;
+};
+Timeline._Impl.prototype.loadXML=function(B,D){var A=this;
+var E=function(H,F,G){alert("Failed to load data xml from "+B+"\n"+H);
+A.hideLoadingMessage();
+};
+var C=function(G){try{var F=G.responseXML;
+if(!F.documentElement&&G.responseStream){F.load(G.responseStream);
+}D(F,B);
+}finally{A.hideLoadingMessage();
+}};
+this.showLoadingMessage();
+window.setTimeout(function(){SimileAjax.XmlHttp.get(B,E,C);
+},0);
+};
+Timeline._Impl.prototype.loadJSON=function(url,f){var tl=this;
+var fError=function(statusText,status,xmlhttp){alert("Failed to load json data from "+url+"\n"+statusText);
+tl.hideLoadingMessage();
+};
+var fDone=function(xmlhttp){try{f(eval("("+xmlhttp.responseText+")"),url);
+}finally{tl.hideLoadingMessage();
+}};
+this.showLoadingMessage();
+window.setTimeout(function(){SimileAjax.XmlHttp.get(url,fError,fDone);
+},0);
+};
+Timeline._Impl.prototype._initialize=function(){var H=this._containerDiv;
+var E=H.ownerDocument;
+H.className=H.className.split(" ").concat("timeline-container").join(" ");
+var B=(this.isHorizontal())?"horizontal":"vertical";
+H.className+=" timeline-"+B;
+while(H.firstChild){H.removeChild(H.firstChild);
+}var A=SimileAjax.Graphics.createTranslucentImage(Timeline.urlPrefix+(this.isHorizontal()?"images/copyright-vertical.png":"images/copyright.png"));
+A.className="timeline-copyright";
+A.title="Timeline (c) SIMILE - http://simile.mit.edu/timeline/";
+SimileAjax.DOM.registerEvent(A,"click",function(){window.location="http://simile.mit.edu/timeline/";
+});
+H.appendChild(A);
+this._bands=[];
+for(var C=0;
+C<this._bandInfos.length;
+C++){var G=new Timeline._Band(this,this._bandInfos[C],C);
+this._bands.push(G);
+}this._distributeWidths();
+for(var C=0;
+C<this._bandInfos.length;
+C++){var F=this._bandInfos[C];
+if("syncWith" in F){this._bands[C].setSyncWithBand(this._bands[F.syncWith],("highlight" in F)?F.highlight:false);
+}}var D=SimileAjax.Graphics.createMessageBubble(E);
+D.containerDiv.className="timeline-message-container";
+H.appendChild(D.containerDiv);
+D.contentDiv.className="timeline-message";
+D.contentDiv.innerHTML="<img src='"+Timeline.urlPrefix+"images/progress-running.gif' /> Loading...";
+this.showLoadingMessage=function(){D.containerDiv.style.display="block";
+};
+this.hideLoadingMessage=function(){D.containerDiv.style.display="none";
+};
+};
+Timeline._Impl.prototype._distributeWidths=function(){var B=this.getPixelLength();
+var A=this.getPixelWidth();
+var D=0;
+for(var E=0;
+E<this._bands.length;
+E++){var I=this._bands[E];
+var J=this._bandInfos[E];
+var F=J.width;
+var H=F.indexOf("%");
+if(H>0){var G=parseInt(F.substr(0,H));
+var C=G*A/100;
+}else{var C=parseInt(F);
+}I.setBandShiftAndWidth(D,C);
+I.setViewLength(B);
+D+=C;
+}};
+Timeline._Impl.prototype.zoom=function(G,B,F,D){var C=new RegExp("^timeline-band-([0-9]+)$");
+var E=null;
+var A=C.exec(D.id);
+if(A){E=parseInt(A[1]);
+}if(E!=null){this._bands[E].zoom(G,B,F,D);
+}this.paint();
+};
+Timeline._Band=function(E,F,B){this._timeline=E;
+this._bandInfo=F;
+this._index=B;
+this._locale=("locale" in F)?F.locale:Timeline.getDefaultLocale();
+this._timeZone=("timeZone" in F)?F.timeZone:0;
+this._labeller=("labeller" in F)?F.labeller:(("createLabeller" in E.getUnit())?E.getUnit().createLabeller(this._locale,this._timeZone):new Timeline.GregorianDateLabeller(this._locale,this._timeZone));
+this._theme=F.theme;
+this._zoomIndex=("zoomIndex" in F)?F.zoomIndex:0;
+this._zoomSteps=("zoomSteps" in F)?F.zoomSteps:null;
+this._dragging=false;
+this._changing=false;
+this._originalScrollSpeed=5;
+this._scrollSpeed=this._originalScrollSpeed;
+this._onScrollListeners=[];
+var A=this;
+this._syncWithBand=null;
+this._syncWithBandHandler=function(G){A._onHighlightBandScroll();
+};
+this._selectorListener=function(G){A._onHighlightBandScroll();
+};
+var D=this._timeline.getDocument().createElement("div");
+D.className="timeline-band-input";
+this._timeline.addDiv(D);
+this._keyboardInput=document.createElement("input");
+this._keyboardInput.type="text";
+D.appendChild(this._keyboardInput);
+SimileAjax.DOM.registerEventWithObject(this._keyboardInput,"keydown",this,"_onKeyDown");
+SimileAjax.DOM.registerEventWithObject(this._keyboardInput,"keyup",this,"_onKeyUp");
+this._div=this._timeline.getDocument().createElement("div");
+this._div.id="timeline-band-"+B;
+this._div.className="timeline-band timeline-band-"+B;
+this._timeline.addDiv(this._div);
+SimileAjax.DOM.registerEventWithObject(this._div,"mousedown",this,"_onMouseDown");
+SimileAjax.DOM.registerEventWithObject(this._div,"mousemove",this,"_onMouseMove");
+SimileAjax.DOM.registerEventWithObject(this._div,"mouseup",this,"_onMouseUp");
+SimileAjax.DOM.registerEventWithObject(this._div,"mouseout",this,"_onMouseOut");
+SimileAjax.DOM.registerEventWithObject(this._div,"dblclick",this,"_onDblClick");
+if(SimileAjax.Platform.browser.isFirefox){SimileAjax.DOM.registerEventWithObject(this._div,"DOMMouseScroll",this,"_onMouseScroll");
+}else{SimileAjax.DOM.registerEventWithObject(this._div,"mousewheel",this,"_onMouseScroll");
+}this._innerDiv=this._timeline.getDocument().createElement("div");
+this._innerDiv.className="timeline-band-inner";
+this._div.appendChild(this._innerDiv);
+this._ether=F.ether;
+F.ether.initialize(this,E);
+this._etherPainter=F.etherPainter;
+F.etherPainter.initialize(this,E);
+this._eventSource=F.eventSource;
+if(this._eventSource){this._eventListener={onAddMany:function(){A._onAddMany();
+},onClear:function(){A._onClear();
+}};
+this._eventSource.addListener(this._eventListener);
+}this._eventPainter=F.eventPainter;
+F.eventPainter.initialize(this,E);
+this._decorators=("decorators" in F)?F.decorators:[];
+for(var C=0;
+C<this._decorators.length;
+C++){this._decorators[C].initialize(this,E);
+}};
+Timeline._Band.SCROLL_MULTIPLES=5;
+Timeline._Band.prototype.dispose=function(){this.closeBubble();
+if(this._eventSource){this._eventSource.removeListener(this._eventListener);
+this._eventListener=null;
+this._eventSource=null;
+}this._timeline=null;
+this._bandInfo=null;
+this._labeller=null;
+this._ether=null;
+this._etherPainter=null;
+this._eventPainter=null;
+this._decorators=null;
+this._onScrollListeners=null;
+this._syncWithBandHandler=null;
+this._selectorListener=null;
+this._div=null;
+this._innerDiv=null;
+this._keyboardInput=null;
+};
+Timeline._Band.prototype.addOnScrollListener=function(A){this._onScrollListeners.push(A);
+};
+Timeline._Band.prototype.removeOnScrollListener=function(B){for(var A=0;
+A<this._onScrollListeners.length;
+A++){if(this._onScrollListeners[A]==B){this._onScrollListeners.splice(A,1);
+break;
+}}};
+Timeline._Band.prototype.setSyncWithBand=function(B,A){if(this._syncWithBand){this._syncWithBand.removeOnScrollListener(this._syncWithBandHandler);
+}this._syncWithBand=B;
+this._syncWithBand.addOnScrollListener(this._syncWithBandHandler);
+this._highlight=A;
+this._positionHighlight();
+};
+Timeline._Band.prototype.getLocale=function(){return this._locale;
+};
+Timeline._Band.prototype.getTimeZone=function(){return this._timeZone;
+};
+Timeline._Band.prototype.getLabeller=function(){return this._labeller;
+};
+Timeline._Band.prototype.getIndex=function(){return this._index;
+};
+Timeline._Band.prototype.getEther=function(){return this._ether;
+};
+Timeline._Band.prototype.getEtherPainter=function(){return this._etherPainter;
+};
+Timeline._Band.prototype.getEventSource=function(){return this._eventSource;
+};
+Timeline._Band.prototype.getEventPainter=function(){return this._eventPainter;
+};
+Timeline._Band.prototype.layout=function(){this.paint();
+};
+Timeline._Band.prototype.paint=function(){this._etherPainter.paint();
+this._paintDecorators();
+this._paintEvents();
+};
+Timeline._Band.prototype.softLayout=function(){this.softPaint();
+};
+Timeline._Band.prototype.softPaint=function(){this._etherPainter.softPaint();
+this._softPaintDecorators();
+this._softPaintEvents();
+};
+Timeline._Band.prototype.setBandShiftAndWidth=function(A,D){var C=this._keyboardInput.parentNode;
+var B=A+Math.floor(D/2);
+if(this._timeline.isHorizontal()){this._div.style.top=A+"px";
+this._div.style.height=D+"px";
+C.style.top=B+"px";
+C.style.left="-1em";
+}else{this._div.style.left=A+"px";
+this._div.style.width=D+"px";
+C.style.left=B+"px";
+C.style.top="-1em";
+}};
+Timeline._Band.prototype.getViewWidth=function(){if(this._timeline.isHorizontal()){return this._div.offsetHeight;
+}else{return this._div.offsetWidth;
+}};
+Timeline._Band.prototype.setViewLength=function(A){this._viewLength=A;
+this._recenterDiv();
+this._onChanging();
+};
+Timeline._Band.prototype.getViewLength=function(){return this._viewLength;
+};
+Timeline._Band.prototype.getTotalViewLength=function(){return Timeline._Band.SCROLL_MULTIPLES*this._viewLength;
+};
+Timeline._Band.prototype.getViewOffset=function(){return this._viewOffset;
+};
+Timeline._Band.prototype.getMinDate=function(){return this._ether.pixelOffsetToDate(this._viewOffset);
+};
+Timeline._Band.prototype.getMaxDate=function(){return this._ether.pixelOffsetToDate(this._viewOffset+Timeline._Band.SCROLL_MULTIPLES*this._viewLength);
+};
+Timeline._Band.prototype.getMinVisibleDate=function(){return this._ether.pixelOffsetToDate(0);
+};
+Timeline._Band.prototype.getMaxVisibleDate=function(){return this._ether.pixelOffsetToDate(this._viewLength);
+};
+Timeline._Band.prototype.getCenterVisibleDate=function(){return this._ether.pixelOffsetToDate(this._viewLength/2);
+};
+Timeline._Band.prototype.setMinVisibleDate=function(A){if(!this._changing){this._moveEther(Math.round(-this._ether.dateToPixelOffset(A)));
+}};
+Timeline._Band.prototype.setMaxVisibleDate=function(A){if(!this._changing){this._moveEther(Math.round(this._viewLength-this._ether.dateToPixelOffset(A)));
+}};
+Timeline._Band.prototype.setCenterVisibleDate=function(A){if(!this._changing){this._moveEther(Math.round(this._viewLength/2-this._ether.dateToPixelOffset(A)));
+}};
+Timeline._Band.prototype.dateToPixelOffset=function(A){return this._ether.dateToPixelOffset(A)-this._viewOffset;
+};
+Timeline._Band.prototype.pixelOffsetToDate=function(A){return this._ether.pixelOffsetToDate(A+this._viewOffset);
+};
+Timeline._Band.prototype.createLayerDiv=function(D,B){var C=this._timeline.getDocument().createElement("div");
+C.className="timeline-band-layer"+(typeof B=="string"?(" "+B):"");
+C.style.zIndex=D;
+this._innerDiv.appendChild(C);
+var A=this._timeline.getDocument().createElement("div");
+A.className="timeline-band-layer-inner";
+if(SimileAjax.Platform.browser.isIE){A.style.cursor="move";
+}else{A.style.cursor="-moz-grab";
+}C.appendChild(A);
+return A;
+};
+Timeline._Band.prototype.removeLayerDiv=function(A){this._innerDiv.removeChild(A.parentNode);
+};
+Timeline._Band.prototype.scrollToCenter=function(B,C){var A=this._ether.dateToPixelOffset(B);
+if(A<-this._viewLength/2){this.setCenterVisibleDate(this.pixelOffsetToDate(A+this._viewLength));
+}else{if(A>3*this._viewLength/2){this.setCenterVisibleDate(this.pixelOffsetToDate(A-this._viewLength));
+}}this._autoScroll(Math.round(this._viewLength/2-this._ether.dateToPixelOffset(B)),C);
+};
+Timeline._Band.prototype.showBubbleForEvent=function(C){var A=this.getEventSource().getEvent(C);
+if(A){var B=this;
+this.scrollToCenter(A.getStart(),function(){B._eventPainter.showBubble(A);
+});
+}};
+Timeline._Band.prototype.zoom=function(F,A,E,C){if(!this._theme.zoom||!this._zoomSteps){return ;
+}A+=this._viewOffset;
+var D=this._ether.pixelOffsetToDate(A);
+var B=this._ether.zoom(F);
+this._etherPainter.zoom(B);
+this._moveEther(Math.round(-this._ether.dateToPixelOffset(D)));
+this._moveEther(A);
+};
+Timeline._Band.prototype._onMouseDown=function(B,A,C){this.closeBubble();
+this._dragging=true;
+this._dragX=A.clientX;
+this._dragY=A.clientY;
+};
+Timeline._Band.prototype._onMouseMove=function(D,A,E){if(this._dragging){var C=A.clientX-this._dragX;
+var B=A.clientY-this._dragY;
+this._dragX=A.clientX;
+this._dragY=A.clientY;
+this._moveEther(this._timeline.isHorizontal()?C:B);
+this._positionHighlight();
+}};
+Timeline._Band.prototype._onMouseUp=function(B,A,C){this._dragging=false;
+this._keyboardInput.focus();
+};
+Timeline._Band.prototype._onMouseOut=function(B,A,D){var C=SimileAjax.DOM.getEventRelativeCoordinates(A,B);
+C.x+=this._viewOffset;
+if(C.x<0||C.x>B.offsetWidth||C.y<0||C.y>B.offsetHeight){this._dragging=false;
+}};
+Timeline._Band.prototype._onMouseScroll=function(C,A,D){var B=new Date();
+B=B.getTime();
+if(!this._lastScrollTime||((B-this._lastScrollTime)>50)){this._lastScrollTime=B;
+var G=0;
+if(A.wheelDelta){G=A.wheelDelta/120;
+}else{if(A.detail){G=-A.detail/3;
+}}var E=SimileAjax.DOM.getEventRelativeCoordinates(A,C);
+if(G!=0){var F;
+if(G>0){F=true;
+}if(G<0){F=false;
+}this._timeline.zoom(F,E.x,E.y,C);
+}}if(A.stopPropagation){A.stopPropagation();
+}A.cancelBubble=true;
+if(A.preventDefault){A.preventDefault();
+}A.returnValue=false;
+};
+Timeline._Band.prototype._onDblClick=function(B,A,D){var C=SimileAjax.DOM.getEventRelativeCoordinates(A,B);
+var E=C.x-(this._viewLength/2-this._viewOffset);
+this._autoScroll(-E);
+};
+Timeline._Band.prototype._onKeyDown=function(B,A,C){if(!this._dragging){switch(A.keyCode){case 27:break;
+case 37:case 38:this._scrollSpeed=Math.min(50,Math.abs(this._scrollSpeed*1.05));
+this._moveEther(this._scrollSpeed);
+break;
+case 39:case 40:this._scrollSpeed=-Math.min(50,Math.abs(this._scrollSpeed*1.05));
+this._moveEther(this._scrollSpeed);
+break;
+default:return true;
+}this.closeBubble();
+SimileAjax.DOM.cancelEvent(A);
+return false;
+}return true;
+};
+Timeline._Band.prototype._onKeyUp=function(B,A,C){if(!this._dragging){this._scrollSpeed=this._originalScrollSpeed;
+switch(A.keyCode){case 35:this.setCenterVisibleDate(this._eventSource.getLatestDate());
+break;
+case 36:this.setCenterVisibleDate(this._eventSource.getEarliestDate());
+break;
+case 33:this._autoScroll(this._timeline.getPixelLength());
+break;
+case 34:this._autoScroll(-this._timeline.getPixelLength());
+break;
+default:return true;
+}this.closeBubble();
+SimileAjax.DOM.cancelEvent(A);
+return false;
+}return true;
+};
+Timeline._Band.prototype._autoScroll=function(D,C){var A=this;
+var B=SimileAjax.Graphics.createAnimation(function(E,F){A._moveEther(F);
+},0,D,1000,C);
+B.run();
+};
+Timeline._Band.prototype._moveEther=function(A){this.closeBubble();
+this._viewOffset+=A;
+this._ether.shiftPixels(-A);
+if(this._timeline.isHorizontal()){this._div.style.left=this._viewOffset+"px";
+}else{this._div.style.top=this._viewOffset+"px";
+}if(this._viewOffset>-this._viewLength*0.5||this._viewOffset<-this._viewLength*(Timeline._Band.SCROLL_MULTIPLES-1.5)){this._recenterDiv();
+}else{this.softLayout();
+}this._onChanging();
+};
+Timeline._Band.prototype._onChanging=function(){this._changing=true;
+this._fireOnScroll();
+this._setSyncWithBandDate();
+this._changing=false;
+};
+Timeline._Band.prototype._fireOnScroll=function(){for(var A=0;
+A<this._onScrollListeners.length;
+A++){this._onScrollListeners[A](this);
+}};
+Timeline._Band.prototype._setSyncWithBandDate=function(){if(this._syncWithBand){var A=this._ether.pixelOffsetToDate(this.getViewLength()/2);
+this._syncWithBand.setCenterVisibleDate(A);
+}};
+Timeline._Band.prototype._onHighlightBandScroll=function(){if(this._syncWithBand){var A=this._syncWithBand.getCenterVisibleDate();
+var B=this._ether.dateToPixelOffset(A);
+this._moveEther(Math.round(this._viewLength/2-B));
+if(this._highlight){this._etherPainter.setHighlight(this._syncWithBand.getMinVisibleDate(),this._syncWithBand.getMaxVisibleDate());
+}}};
+Timeline._Band.prototype._onAddMany=function(){this._paintEvents();
+};
+Timeline._Band.prototype._onClear=function(){this._paintEvents();
+};
+Timeline._Band.prototype._positionHighlight=function(){if(this._syncWithBand){var A=this._syncWithBand.getMinVisibleDate();
+var B=this._syncWithBand.getMaxVisibleDate();
+if(this._highlight){this._etherPainter.setHighlight(A,B);
+}}};
+Timeline._Band.prototype._recenterDiv=function(){this._viewOffset=-this._viewLength*(Timeline._Band.SCROLL_MULTIPLES-1)/2;
+if(this._timeline.isHorizontal()){this._div.style.left=this._viewOffset+"px";
+this._div.style.width=(Timeline._Band.SCROLL_MULTIPLES*this._viewLength)+"px";
+}else{this._div.style.top=this._viewOffset+"px";
+this._div.style.height=(Timeline._Band.SCROLL_MULTIPLES*this._viewLength)+"px";
+}this.layout();
+};
+Timeline._Band.prototype._paintEvents=function(){this._eventPainter.paint();
+};
+Timeline._Band.prototype._softPaintEvents=function(){this._eventPainter.softPaint();
+};
+Timeline._Band.prototype._paintDecorators=function(){for(var A=0;
+A<this._decorators.length;
+A++){this._decorators[A].paint();
+}};
+Timeline._Band.prototype._softPaintDecorators=function(){for(var A=0;
+A<this._decorators.length;
+A++){this._decorators[A].softPaint();
+}};
+Timeline._Band.prototype.closeBubble=function(){SimileAjax.WindowManager.cancelPopups();
+};
+
+
+/* units.js */
+Timeline.NativeDateUnit=new Object();
+Timeline.NativeDateUnit.createLabeller=function(A,B){return new Timeline.GregorianDateLabeller(A,B);
+};
+Timeline.NativeDateUnit.makeDefaultValue=function(){return new Date();
+};
+Timeline.NativeDateUnit.cloneValue=function(A){return new Date(A.getTime());
+};
+Timeline.NativeDateUnit.getParser=function(A){if(typeof A=="string"){A=A.toLowerCase();
+}return(A=="iso8601"||A=="iso 8601")?Timeline.DateTime.parseIso8601DateTime:Timeline.DateTime.parseGregorianDateTime;
+};
+Timeline.NativeDateUnit.parseFromObject=function(A){return Timeline.DateTime.parseGregorianDateTime(A);
+};
+Timeline.NativeDateUnit.toNumber=function(A){return A.getTime();
+};
+Timeline.NativeDateUnit.fromNumber=function(A){return new Date(A);
+};
+Timeline.NativeDateUnit.compare=function(D,C){var B,A;
+if(typeof D=="object"){B=D.getTime();
+}else{B=Number(D);
+}if(typeof C=="object"){A=C.getTime();
+}else{A=Number(C);
+}return B-A;
+};
+Timeline.NativeDateUnit.earlier=function(B,A){return Timeline.NativeDateUnit.compare(B,A)<0?B:A;
+};
+Timeline.NativeDateUnit.later=function(B,A){return Timeline.NativeDateUnit.compare(B,A)>0?B:A;
+};
+Timeline.NativeDateUnit.change=function(A,B){return new Date(A.getTime()+B);
+};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/examples/examples.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/examples/examples.js
new file mode 100644
index 0000000..c3b4eee
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/examples/examples.js
@@ -0,0 +1,123 @@
+function centerSimileAjax(date) {
+ tl.getBand(0).setCenterVisibleDate(SimileAjax.DateTime.parseGregorianDateTime(date));
+}
+
+function setupFilterHighlightControls(div, timeline, bandIndices, theme) {
+ var table = document.createElement("table");
+ var tr = table.insertRow(0);
+
+ var td = tr.insertCell(0);
+ td.innerHTML = "Filter:";
+
+ td = tr.insertCell(1);
+ td.innerHTML = "Highlight:";
+
+ var handler = function(elmt, evt, target) {
+ onKeyPress(timeline, bandIndices, table);
+ };
+
+ tr = table.insertRow(1);
+ tr.style.verticalAlign = "top";
+
+ td = tr.insertCell(0);
+
+ var input = document.createElement("input");
+ input.type = "text";
+ SimileAjax.DOM.registerEvent(input, "keypress", handler);
+ td.appendChild(input);
+
+ for (var i = 0; i < theme.event.highlightColors.length; i++) {
+ td = tr.insertCell(i + 1);
+
+ input = document.createElement("input");
+ input.type = "text";
+ SimileAjax.DOM.registerEvent(input, "keypress", handler);
+ td.appendChild(input);
+
+ var divColor = document.createElement("div");
+ divColor.style.height = "0.5em";
+ divColor.style.background = theme.event.highlightColors[i];
+ td.appendChild(divColor);
+ }
+
+ td = tr.insertCell(tr.cells.length);
+ var button = document.createElement("button");
+ button.innerHTML = "Clear All";
+ SimileAjax.DOM.registerEvent(button, "click", function() {
+ clearAll(timeline, bandIndices, table);
+ });
+ td.appendChild(button);
+
+ div.appendChild(table);
+}
+
+var timerID = null;
+function onKeyPress(timeline, bandIndices, table) {
+ if (timerID != null) {
+ window.clearTimeout(timerID);
+ }
+ timerID = window.setTimeout(function() {
+ performFiltering(timeline, bandIndices, table);
+ }, 300);
+}
+function cleanString(s) {
+ return s.replace(/^\s+/, '').replace(/\s+$/, '');
+}
+function performFiltering(timeline, bandIndices, table) {
+ timerID = null;
+
+ var tr = table.rows[1];
+ var text = cleanString(tr.cells[0].firstChild.value);
+
+ var filterMatcher = null;
+ if (text.length > 0) {
+ var regex = new RegExp(text, "i");
+ filterMatcher = function(evt) {
+ return regex.test(evt.getText()) || regex.test(evt.getDescription());
+ };
+ }
+
+ var regexes = [];
+ var hasHighlights = false;
+ for (var x = 1; x < tr.cells.length - 1; x++) {
+ var input = tr.cells[x].firstChild;
+ var text2 = cleanString(input.value);
+ if (text2.length > 0) {
+ hasHighlights = true;
+ regexes.push(new RegExp(text2, "i"));
+ } else {
+ regexes.push(null);
+ }
+ }
+ var highlightMatcher = hasHighlights ? function(evt) {
+ var text = evt.getText();
+ var description = evt.getDescription();
+ for (var x = 0; x < regexes.length; x++) {
+ var regex = regexes[x];
+ if (regex != null && (regex.test(text) || regex.test(description))) {
+ return x;
+ }
+ }
+ return -1;
+ } : null;
+
+ for (var i = 0; i < bandIndices.length; i++) {
+ var bandIndex = bandIndices[i];
+ timeline.getBand(bandIndex).getEventPainter().setFilterMatcher(filterMatcher);
+ timeline.getBand(bandIndex).getEventPainter().setHighlightMatcher(highlightMatcher);
+ }
+ timeline.paint();
+}
+function clearAll(timeline, bandIndices, table) {
+ var tr = table.rows[1];
+ for (var x = 0; x < tr.cells.length - 1; x++) {
+ tr.cells[x].firstChild.value = "";
+ }
+
+ for (var i = 0; i < bandIndices.length; i++) {
+ var bandIndex = bandIndices[i];
+ timeline.getBand(bandIndex).getEventPainter().setFilterMatcher(null);
+ timeline.getBand(bandIndex).getEventPainter().setHighlightMatcher(null);
+ }
+ timeline.paint();
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/examples/styles.css b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/examples/styles.css
new file mode 100644
index 0000000..55fe432
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/examples/styles.css
@@ -0,0 +1,11 @@
+@import url("../styles.css");
+
+.footnotes {
+ background: #eee;
+ padding: 0.25em;
+}
+
+.controls {
+ margin: 1em 0;
+ padding: 0.5em;
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventsView.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventsView.jsp
index 34e003e..85f8696 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventsView.jsp
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventsView.jsp
@@ -21,9 +21,12 @@
<head>
<base target="_top"/>
- <script src="/js/timeline/timeline_ajax/simile-ajax-api.js?bundle=true" type="text/javascript"></script>
- <script src="/js/timeline/timeline_js/timeline-api.js?bundle=true" type="text/javascript"></script>
-
+ <script type="text/javascript">
+ SimileAjax_urlPrefix = "/js/timeline/ajax/api/";
+ </script>
+ <script src="/js/timeline/ajax/api/simile-ajax-api.js" type="text/javascript"></script>
+ <script src="/js/timeline/api/timeline-api.js" type="text/javascript"></script>
+ <script src="/js/timeline/examples/examples.js" type="text/javascript"></script>
<title>Simple jsp page</title>
<style type="text/css">
@@ -77,13 +80,13 @@
<input type="checkbox" name="content" checked="checked" onchange="onLoad()" id="contentField"/>
<label for="contentField"><img src="/images/icons/Content_grey_16.png"/> Content Changes</label>
</form>
-
<script type="text/javascript">
var tl;
function onLoad() {
+
var begin = <%= begin%>;
var end = <%= end%>;
@@ -95,7 +98,7 @@ function onLoad() {
var eventSource = new Timeline.DefaultEventSource();
- var theme = Timeline.ClassicTheme.create();
+ var theme = Timeline.ClassicTheme.create();
theme.event.bubble.width = 650;
theme.event.bubble.height = 320;
theme.event.label.width = 200;
commit c72d23630cf2309fc849187ca3832f73cf8ecc1a
Merge: 5720428... f16bdbf...
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Tue Mar 9 13:56:48 2010 -0500
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
commit 57204283c9d77fd4d170fdf7ae29316c01e652ee
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Tue Mar 9 13:56:14 2010 -0500
add log4j.xml for tests
diff --git a/modules/enterprise/gui/portal-war/src/test/resources/log4j.xml b/modules/enterprise/gui/portal-war/src/test/resources/log4j.xml
new file mode 100644
index 0000000..2aad9f8
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/test/resources/log4j.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Log4j Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml 39945 2006-01-12 02:44:07Z bill $ -->
+
+<!--
+ | For more configuration infromation and examples see the Jakarta Log4j
+ | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="true">
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out"/>
+ <param name="Threshold" value="DEBUG"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Messagen -->
+
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
+
+ <!--<param name="ConversionPattern" value="%-5p %d{dd-MM HH:mm:ss,SSS} (%F:%M:%L) -%m%n"/>-->
+ </layout>
+ </appender>
+
+ <appender name="FILE" class="org.apache.log4j.RollingFileAppender">
+ <param name="File" value="target/test.log"/>
+ <param name="Threshold" value="DEBUG"/>
+ <param name="Append" value="false"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Messagen -->
+ <!--
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
+ -->
+ <param name="ConversionPattern" value="%-5p %d{dd-MM HH:mm:ss,SSS} (%F:%M:%L) -%m%n"/>
+ </layout>
+ </appender>
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ <appender-ref ref="FILE"/>
+ </root>
+
+</log4j:configuration>
commit 146c670c44d85892c77e4759f1468d048c1c75a8
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Tue Mar 9 13:50:06 2010 -0500
upgrade to latest version (2.3.0) of MIT Simile timeline lib
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/content/history.html b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/content/history.html
deleted file mode 100644
index a30fbd8..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/content/history.html
+++ /dev/null
@@ -1,7 +0,0 @@
-<html>
-<head>
- <title>Dummy Page for Keeping Track of History</title>
-</head>
-<body>
-</body>
-</html>
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-bottom-arrow.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-bottom-arrow.png
deleted file mode 100644
index 38c3917..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-bottom-arrow.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-bottom-left.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-bottom-left.png
deleted file mode 100644
index 6d32026..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-bottom-left.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-bottom-right.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-bottom-right.png
deleted file mode 100644
index e5dc136..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-bottom-right.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-bottom.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-bottom.png
deleted file mode 100644
index 166b057..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-bottom.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-left-arrow.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-left-arrow.png
deleted file mode 100644
index 5b173cd..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-left-arrow.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-left.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-left.png
deleted file mode 100644
index 3826722..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-left.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-right-arrow.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-right-arrow.png
deleted file mode 100644
index 11e2873..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-right-arrow.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-right.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-right.png
deleted file mode 100644
index f66f879..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-right.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-top-arrow.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-top-arrow.png
deleted file mode 100644
index 524c46e..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-top-arrow.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-top-left.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-top-left.png
deleted file mode 100644
index d69841f..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-top-left.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-top-right.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-top-right.png
deleted file mode 100644
index 9ab219a..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-top-right.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-top.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-top.png
deleted file mode 100644
index 917defa..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/bubble-top.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/close-button.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/close-button.png
deleted file mode 100644
index 15f31b3..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/close-button.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/copy.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/copy.png
deleted file mode 100644
index cf7cee4..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/copy.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/message-bottom-left.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/message-bottom-left.png
deleted file mode 100644
index 43a9d61..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/message-bottom-left.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/message-bottom-right.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/message-bottom-right.png
deleted file mode 100644
index bfa4954..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/message-bottom-right.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/message-left.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/message-left.png
deleted file mode 100644
index f354376..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/message-left.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/message-right.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/message-right.png
deleted file mode 100644
index 4702c28..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/message-right.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/message-top-left.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/message-top-left.png
deleted file mode 100644
index b19b0ea..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/message-top-left.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/message-top-right.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/message-top-right.png
deleted file mode 100644
index c092555..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/images/message-top-right.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/ajax.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/ajax.js
deleted file mode 100644
index 7172609..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/ajax.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/*==================================================
- * General, miscellaneous SimileAjax stuff
- *==================================================
- */
-
-SimileAjax.ListenerQueue = function(wildcardHandlerName) {
- this._listeners = [];
- this._wildcardHandlerName = wildcardHandlerName;
-};
-
-SimileAjax.ListenerQueue.prototype.add = function(listener) {
- this._listeners.push(listener);
-};
-
-SimileAjax.ListenerQueue.prototype.remove = function(listener) {
- var listeners = this._listeners;
- for (var i = 0; i < listeners.length; i++) {
- if (listeners[i] == listener) {
- listeners.splice(i, 1);
- break;
- }
- }
-};
-
-SimileAjax.ListenerQueue.prototype.fire = function(handlerName, args) {
- var listeners = [].concat(this._listeners);
- for (var i = 0; i < listeners.length; i++) {
- var listener = listeners[i];
- if (handlerName in listener) {
- try {
- listener[handlerName].apply(listener, args);
- } catch (e) {
- SimileAjax.Debug.exception("Error firing event of name " + handlerName, e);
- }
- } else if (this._wildcardHandlerName != null &&
- this._wildcardHandlerName in listener) {
- try {
- listener[this._wildcardHandlerName].apply(listener, [ handlerName ]);
- } catch (e) {
- SimileAjax.Debug.exception("Error firing event of name " + handlerName + " to wildcard handler", e);
- }
- }
- }
-};
-
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/data-structure.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/data-structure.js
deleted file mode 100644
index e789cb4..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/data-structure.js
+++ /dev/null
@@ -1,447 +0,0 @@
-/**
- * A basic set (in the mathematical sense) data structure
- *
- * @constructor
- * @param {Array or SimileAjax.Set} [a] an initial collection
- */
-SimileAjax.Set = function(a) {
- this._hash = {};
- this._count = 0;
-
- if (a instanceof Array) {
- for (var i = 0; i < a.length; i++) {
- this.add(a[i]);
- }
- } else if (a instanceof SimileAjax.Set) {
- this.addSet(a);
- }
-}
-
-/**
- * Adds the given object to this set, assuming there it does not already exist
- *
- * @param {Object} o the object to add
- * @return {Boolean} true if the object was added, false if not
- */
-SimileAjax.Set.prototype.add = function(o) {
- if (!(o in this._hash)) {
- this._hash[o] = true;
- this._count++;
- return true;
- }
- return false;
-}
-
-/**
- * Adds each element in the given set to this set
- *
- * @param {SimileAjax.Set} set the set of elements to add
- */
-SimileAjax.Set.prototype.addSet = function(set) {
- for (var o in set._hash) {
- this.add(o);
- }
-}
-
-/**
- * Removes the given element from this set
- *
- * @param {Object} o the object to remove
- * @return {Boolean} true if the object was successfully removed,
- * false otherwise
- */
-SimileAjax.Set.prototype.remove = function(o) {
- if (o in this._hash) {
- delete this._hash[o];
- this._count--;
- return true;
- }
- return false;
-}
-
-/**
- * Removes the elements in this set that correspond to the elements in the
- * given set
- *
- * @param {SimileAjax.Set} set the set of elements to remove
- */
-SimileAjax.Set.prototype.removeSet = function(set) {
- for (var o in set._hash) {
- this.remove(o);
- }
-}
-
-/**
- * Removes all elements in this set that are not present in the given set, i.e.
- * modifies this set to the intersection of the two sets
- *
- * @param {SimileAjax.Set} set the set to intersect
- */
-SimileAjax.Set.prototype.retainSet = function(set) {
- for (var o in this._hash) {
- if (!set.contains(o)) {
- delete this._hash[o];
- this._count--;
- }
- }
-}
-
-/**
- * Returns whether or not the given element exists in this set
- *
- * @param {SimileAjax.Set} o the object to test for
- * @return {Boolean} true if the object is present, false otherwise
- */
-SimileAjax.Set.prototype.contains = function(o) {
- return (o in this._hash);
-}
-
-/**
- * Returns the number of elements in this set
- *
- * @return {Number} the number of elements in this set
- */
-SimileAjax.Set.prototype.size = function() {
- return this._count;
-}
-
-/**
- * Returns the elements of this set as an array
- *
- * @return {Array} a new array containing the elements of this set
- */
-SimileAjax.Set.prototype.toArray = function() {
- var a = [];
- for (var o in this._hash) {
- a.push(o);
- }
- return a;
-}
-
-/**
- * Iterates through the elements of this set, order unspecified, executing the
- * given function on each element until the function returns true
- *
- * @param {Function} f a function of form f(element)
- */
-SimileAjax.Set.prototype.visit = function(f) {
- for (var o in this._hash) {
- if (f(o) == true) {
- break;
- }
- }
-}
-
-/**
- * A sorted array data structure
- *
- * @constructor
- */
-SimileAjax.SortedArray = function(compare, initialArray) {
- this._a = (initialArray instanceof Array) ? initialArray : [];
- this._compare = compare;
-};
-
-SimileAjax.SortedArray.prototype.add = function(elmt) {
- var sa = this;
- var index = this.find(function(elmt2) {
- return sa._compare(elmt2, elmt);
- });
-
- if (index < this._a.length) {
- this._a.splice(index, 0, elmt);
- } else {
- this._a.push(elmt);
- }
-};
-
-SimileAjax.SortedArray.prototype.remove = function(elmt) {
- var sa = this;
- var index = this.find(function(elmt2) {
- return sa._compare(elmt2, elmt);
- });
-
- while (index < this._a.length && this._compare(this._a[index], elmt) == 0) {
- if (this._a[index] == elmt) {
- this._a.splice(index, 1);
- return true;
- } else {
- index++;
- }
- }
- return false;
-};
-
-SimileAjax.SortedArray.prototype.removeAll = function() {
- this._a = [];
-};
-
-SimileAjax.SortedArray.prototype.elementAt = function(index) {
- return this._a[index];
-};
-
-SimileAjax.SortedArray.prototype.length = function() {
- return this._a.length;
-};
-
-SimileAjax.SortedArray.prototype.find = function(compare) {
- var a = 0;
- var b = this._a.length;
-
- while (a < b) {
- var mid = Math.floor((a + b) / 2);
- var c = compare(this._a[mid]);
- if (mid == a) {
- return c < 0 ? a+1 : a;
- } else if (c < 0) {
- a = mid;
- } else {
- b = mid;
- }
- }
- return a;
-};
-
-SimileAjax.SortedArray.prototype.getFirst = function() {
- return (this._a.length > 0) ? this._a[0] : null;
-};
-
-SimileAjax.SortedArray.prototype.getLast = function() {
- return (this._a.length > 0) ? this._a[this._a.length - 1] : null;
-};
-
-/*==================================================
- * Event Index
- *==================================================
- */
-
-SimileAjax.EventIndex = function(unit) {
- var eventIndex = this;
-
- this._unit = (unit != null) ? unit : SimileAjax.NativeDateUnit;
- this._events = new SimileAjax.SortedArray(
- function(event1, event2) {
- return eventIndex._unit.compare(event1.getStart(), event2.getStart());
- }
- );
- this._idToEvent = {};
- this._indexed = true;
-};
-
-SimileAjax.EventIndex.prototype.getUnit = function() {
- return this._unit;
-};
-
-SimileAjax.EventIndex.prototype.getEvent = function(id) {
- return this._idToEvent[id];
-};
-
-SimileAjax.EventIndex.prototype.add = function(evt) {
- this._events.add(evt);
- this._idToEvent[evt.getID()] = evt;
- this._indexed = false;
-};
-
-SimileAjax.EventIndex.prototype.removeAll = function() {
- this._events.removeAll();
- this._idToEvent = {};
- this._indexed = false;
-};
-
-SimileAjax.EventIndex.prototype.getCount = function() {
- return this._events.length();
-};
-
-SimileAjax.EventIndex.prototype.getIterator = function(startDate, endDate) {
- if (!this._indexed) {
- this._index();
- }
- return new SimileAjax.EventIndex._Iterator(this._events, startDate, endDate, this._unit);
-};
-
-SimileAjax.EventIndex.prototype.getReverseIterator = function(startDate, endDate) {
- if (!this._indexed) {
- this._index();
- }
- return new SimileAjax.EventIndex._ReverseIterator(this._events, startDate, endDate, this._unit);
-};
-
-SimileAjax.EventIndex.prototype.getAllIterator = function() {
- return new SimileAjax.EventIndex._AllIterator(this._events);
-};
-
-SimileAjax.EventIndex.prototype.getEarliestDate = function() {
- var evt = this._events.getFirst();
- return (evt == null) ? null : evt.getStart();
-};
-
-SimileAjax.EventIndex.prototype.getLatestDate = function() {
- var evt = this._events.getLast();
- if (evt == null) {
- return null;
- }
-
- if (!this._indexed) {
- this._index();
- }
-
- var index = evt._earliestOverlapIndex;
- var date = this._events.elementAt(index).getEnd();
- for (var i = index + 1; i < this._events.length(); i++) {
- date = this._unit.later(date, this._events.elementAt(i).getEnd());
- }
-
- return date;
-};
-
-SimileAjax.EventIndex.prototype._index = function() {
- /*
- * For each event, we want to find the earliest preceding
- * event that overlaps with it, if any.
- */
-
- var l = this._events.length();
- for (var i = 0; i < l; i++) {
- var evt = this._events.elementAt(i);
- evt._earliestOverlapIndex = i;
- }
-
- var toIndex = 1;
- for (var i = 0; i < l; i++) {
- var evt = this._events.elementAt(i);
- var end = evt.getEnd();
-
- toIndex = Math.max(toIndex, i + 1);
- while (toIndex < l) {
- var evt2 = this._events.elementAt(toIndex);
- var start2 = evt2.getStart();
-
- if (this._unit.compare(start2, end) < 0) {
- evt2._earliestOverlapIndex = i;
- toIndex++;
- } else {
- break;
- }
- }
- }
- this._indexed = true;
-};
-
-SimileAjax.EventIndex._Iterator = function(events, startDate, endDate, unit) {
- this._events = events;
- this._startDate = startDate;
- this._endDate = endDate;
- this._unit = unit;
-
- this._currentIndex = events.find(function(evt) {
- return unit.compare(evt.getStart(), startDate);
- });
- if (this._currentIndex - 1 >= 0) {
- this._currentIndex = this._events.elementAt(this._currentIndex - 1)._earliestOverlapIndex;
- }
- this._currentIndex--;
-
- this._maxIndex = events.find(function(evt) {
- return unit.compare(evt.getStart(), endDate);
- });
-
- this._hasNext = false;
- this._next = null;
- this._findNext();
-};
-
-SimileAjax.EventIndex._Iterator.prototype = {
- hasNext: function() { return this._hasNext; },
- next: function() {
- if (this._hasNext) {
- var next = this._next;
- this._findNext();
-
- return next;
- } else {
- return null;
- }
- },
- _findNext: function() {
- var unit = this._unit;
- while ((++this._currentIndex) < this._maxIndex) {
- var evt = this._events.elementAt(this._currentIndex);
- if (unit.compare(evt.getStart(), this._endDate) < 0 &&
- unit.compare(evt.getEnd(), this._startDate) > 0) {
-
- this._next = evt;
- this._hasNext = true;
- return;
- }
- }
- this._next = null;
- this._hasNext = false;
- }
-};
-
-SimileAjax.EventIndex._ReverseIterator = function(events, startDate, endDate, unit) {
- this._events = events;
- this._startDate = startDate;
- this._endDate = endDate;
- this._unit = unit;
-
- this._minIndex = events.find(function(evt) {
- return unit.compare(evt.getStart(), startDate);
- });
- if (this._minIndex - 1 >= 0) {
- this._minIndex = this._events.elementAt(this._minIndex - 1)._earliestOverlapIndex;
- }
-
- this._maxIndex = events.find(function(evt) {
- return unit.compare(evt.getStart(), endDate);
- });
-
- this._currentIndex = this._maxIndex;
- this._hasNext = false;
- this._next = null;
- this._findNext();
-};
-
-SimileAjax.EventIndex._ReverseIterator.prototype = {
- hasNext: function() { return this._hasNext; },
- next: function() {
- if (this._hasNext) {
- var next = this._next;
- this._findNext();
-
- return next;
- } else {
- return null;
- }
- },
- _findNext: function() {
- var unit = this._unit;
- while ((--this._currentIndex) >= this._minIndex) {
- var evt = this._events.elementAt(this._currentIndex);
- if (unit.compare(evt.getStart(), this._endDate) < 0 &&
- unit.compare(evt.getEnd(), this._startDate) > 0) {
-
- this._next = evt;
- this._hasNext = true;
- return;
- }
- }
- this._next = null;
- this._hasNext = false;
- }
-};
-
-SimileAjax.EventIndex._AllIterator = function(events) {
- this._events = events;
- this._index = 0;
-};
-
-SimileAjax.EventIndex._AllIterator.prototype = {
- hasNext: function() {
- return this._index < this._events.length();
- },
- next: function() {
- return this._index < this._events.length() ?
- this._events.elementAt(this._index++) : null;
- }
-};
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/date-time.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/date-time.js
deleted file mode 100644
index d0498bf..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/date-time.js
+++ /dev/null
@@ -1,452 +0,0 @@
-/**
- * @fileOverview A collection of date/time utility functions
- * @name SimileAjax.DateTime
- */
-
-SimileAjax.DateTime = new Object();
-
-SimileAjax.DateTime.MILLISECOND = 0;
-SimileAjax.DateTime.SECOND = 1;
-SimileAjax.DateTime.MINUTE = 2;
-SimileAjax.DateTime.HOUR = 3;
-SimileAjax.DateTime.DAY = 4;
-SimileAjax.DateTime.WEEK = 5;
-SimileAjax.DateTime.MONTH = 6;
-SimileAjax.DateTime.YEAR = 7;
-SimileAjax.DateTime.DECADE = 8;
-SimileAjax.DateTime.CENTURY = 9;
-SimileAjax.DateTime.MILLENNIUM = 10;
-
-SimileAjax.DateTime.EPOCH = -1;
-SimileAjax.DateTime.ERA = -2;
-
-/**
- * An array of unit lengths, expressed in milliseconds, of various lengths of
- * time. The array indices are predefined and stored as properties of the
- * SimileAjax.DateTime object, e.g. SimileAjax.DateTime.YEAR.
- * @type Array
- */
-SimileAjax.DateTime.gregorianUnitLengths = [];
- (function() {
- var d = SimileAjax.DateTime;
- var a = d.gregorianUnitLengths;
-
- a[d.MILLISECOND] = 1;
- a[d.SECOND] = 1000;
- a[d.MINUTE] = a[d.SECOND] * 60;
- a[d.HOUR] = a[d.MINUTE] * 60;
- a[d.DAY] = a[d.HOUR] * 24;
- a[d.WEEK] = a[d.DAY] * 7;
- a[d.MONTH] = a[d.DAY] * 31;
- a[d.YEAR] = a[d.DAY] * 365;
- a[d.DECADE] = a[d.YEAR] * 10;
- a[d.CENTURY] = a[d.YEAR] * 100;
- a[d.MILLENNIUM] = a[d.YEAR] * 1000;
- })();
-
-SimileAjax.DateTime._dateRegexp = new RegExp(
- "^(-?)([0-9]{4})(" + [
- "(-?([0-9]{2})(-?([0-9]{2}))?)", // -month-dayOfMonth
- "(-?([0-9]{3}))", // -dayOfYear
- "(-?W([0-9]{2})(-?([1-7]))?)" // -Wweek-dayOfWeek
- ].join("|") + ")?$"
-);
-SimileAjax.DateTime._timezoneRegexp = new RegExp(
- "Z|(([-+])([0-9]{2})(:?([0-9]{2}))?)$"
-);
-SimileAjax.DateTime._timeRegexp = new RegExp(
- "^([0-9]{2})(:?([0-9]{2})(:?([0-9]{2})(\.([0-9]+))?)?)?$"
-);
-
-/**
- * Takes a date object and a string containing an ISO 8601 date and sets the
- * the date using information parsed from the string. Note that this method
- * does not parse any time information.
- *
- * @param {Date} dateObject the date object to modify
- * @param {String} string an ISO 8601 string to parse
- * @return {Date} the modified date object
- */
-SimileAjax.DateTime.setIso8601Date = function(dateObject, string) {
- /*
- * This function has been adapted from dojo.date, v.0.3.0
- * http://dojotoolkit.org/.
- */
-
- var d = string.match(SimileAjax.DateTime._dateRegexp);
- if(!d) {
- throw new Error("Invalid date string: " + string);
- }
-
- var sign = (d[1] == "-") ? -1 : 1; // BC or AD
- var year = sign * d[2];
- var month = d[5];
- var date = d[7];
- var dayofyear = d[9];
- var week = d[11];
- var dayofweek = (d[13]) ? d[13] : 1;
-
- dateObject.setUTCFullYear(year);
- if (dayofyear) {
- dateObject.setUTCMonth(0);
- dateObject.setUTCDate(Number(dayofyear));
- } else if (week) {
- dateObject.setUTCMonth(0);
- dateObject.setUTCDate(1);
- var gd = dateObject.getUTCDay();
- var day = (gd) ? gd : 7;
- var offset = Number(dayofweek) + (7 * Number(week));
-
- if (day <= 4) {
- dateObject.setUTCDate(offset + 1 - day);
- } else {
- dateObject.setUTCDate(offset + 8 - day);
- }
- } else {
- if (month) {
- dateObject.setUTCDate(1);
- dateObject.setUTCMonth(month - 1);
- }
- if (date) {
- dateObject.setUTCDate(date);
- }
- }
-
- return dateObject;
-};
-
-/**
- * Takes a date object and a string containing an ISO 8601 time and sets the
- * the time using information parsed from the string. Note that this method
- * does not parse any date information.
- *
- * @param {Date} dateObject the date object to modify
- * @param {String} string an ISO 8601 string to parse
- * @return {Date} the modified date object
- */
-SimileAjax.DateTime.setIso8601Time = function (dateObject, string) {
- /*
- * This function has been adapted from dojo.date, v.0.3.0
- * http://dojotoolkit.org/.
- */
-
- var d = string.match(SimileAjax.DateTime._timeRegexp);
- if(!d) {
- SimileAjax.Debug.warn("Invalid time string: " + string);
- return false;
- }
- var hours = d[1];
- var mins = Number((d[3]) ? d[3] : 0);
- var secs = (d[5]) ? d[5] : 0;
- var ms = d[7] ? (Number("0." + d[7]) * 1000) : 0;
-
- dateObject.setUTCHours(hours);
- dateObject.setUTCMinutes(mins);
- dateObject.setUTCSeconds(secs);
- dateObject.setUTCMilliseconds(ms);
-
- return dateObject;
-};
-
-/**
- * The timezone offset in minutes in the user's browser.
- * @type Number
- */
-SimileAjax.DateTime.timezoneOffset = new Date().getTimezoneOffset();
-
-/**
- * Takes a date object and a string containing an ISO 8601 date and time and
- * sets the date object using information parsed from the string.
- *
- * @param {Date} dateObject the date object to modify
- * @param {String} string an ISO 8601 string to parse
- * @return {Date} the modified date object
- */
-SimileAjax.DateTime.setIso8601 = function (dateObject, string){
- /*
- * This function has been adapted from dojo.date, v.0.3.0
- * http://dojotoolkit.org/.
- */
-
- var offset = null;
- var comps = (string.indexOf("T") == -1) ? string.split(" ") : string.split("T");
-
- SimileAjax.DateTime.setIso8601Date(dateObject, comps[0]);
- if (comps.length == 2) {
- // first strip timezone info from the end
- var d = comps[1].match(SimileAjax.DateTime._timezoneRegexp);
- if (d) {
- if (d[0] == 'Z') {
- offset = 0;
- } else {
- offset = (Number(d[3]) * 60) + Number(d[5]);
- offset *= ((d[2] == '-') ? 1 : -1);
- }
- comps[1] = comps[1].substr(0, comps[1].length - d[0].length);
- }
-
- SimileAjax.DateTime.setIso8601Time(dateObject, comps[1]);
- }
- if (offset == null) {
- offset = dateObject.getTimezoneOffset(); // local time zone if no tz info
- }
- dateObject.setTime(dateObject.getTime() + offset * 60000);
-
- return dateObject;
-};
-
-/**
- * Takes a string containing an ISO 8601 date and returns a newly instantiated
- * date object with the parsed date and time information from the string.
- *
- * @param {String} string an ISO 8601 string to parse
- * @return {Date} a new date object created from the string
- */
-SimileAjax.DateTime.parseIso8601DateTime = function (string) {
- try {
- return SimileAjax.DateTime.setIso8601(new Date(0), string);
- } catch (e) {
- return null;
- }
-};
-
-/**
- * Takes a string containing a Gregorian date and time and returns a newly
- * instantiated date object with the parsed date and time information from the
- * string. If the param is actually an instance of Date instead of a string,
- * simply returns the given date instead.
- *
- * @param {Object} o an object, to either return or parse as a string
- * @return {Date} the date object
- */
-SimileAjax.DateTime.parseGregorianDateTime = function(o) {
- if (o == null) {
- return null;
- } else if (o instanceof Date) {
- return o;
- }
-
- var s = o.toString();
- if (s.length > 0 && s.length < 8) {
- var space = s.indexOf(" ");
- if (space > 0) {
- var year = parseInt(s.substr(0, space));
- var suffix = s.substr(space + 1);
- if (suffix.toLowerCase() == "bc") {
- year = 1 - year;
- }
- } else {
- var year = parseInt(s);
- }
-
- var d = new Date(0);
- d.setUTCFullYear(year);
-
- return d;
- }
-
- try {
- return new Date(Date.parse(s));
- } catch (e) {
- return null;
- }
-};
-
-/**
- * Rounds date objects down to the nearest interval or multiple of an interval.
- * This method modifies the given date object, converting it to the given
- * timezone if specified.
- *
- * @param {Date} date the date object to round
- * @param {Number} intervalUnit a constant, integer index specifying an
- * interval, e.g. SimileAjax.DateTime.HOUR
- * @param {Number} timeZone a timezone shift, given in hours
- * @param {Number} multiple a multiple of the interval to round by
- * @param {Number} firstDayOfWeek an integer specifying the first day of the
- * week, 0 corresponds to Sunday, 1 to Monday, etc.
- */
-SimileAjax.DateTime.roundDownToInterval = function(date, intervalUnit, timeZone, multiple, firstDayOfWeek) {
- var timeShift = timeZone *
- SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.HOUR];
-
- var date2 = new Date(date.getTime() + timeShift);
- var clearInDay = function(d) {
- d.setUTCMilliseconds(0);
- d.setUTCSeconds(0);
- d.setUTCMinutes(0);
- d.setUTCHours(0);
- };
- var clearInYear = function(d) {
- clearInDay(d);
- d.setUTCDate(1);
- d.setUTCMonth(0);
- };
-
- switch(intervalUnit) {
- case SimileAjax.DateTime.MILLISECOND:
- var x = date2.getUTCMilliseconds();
- date2.setUTCMilliseconds(x - (x % multiple));
- break;
- case SimileAjax.DateTime.SECOND:
- date2.setUTCMilliseconds(0);
-
- var x = date2.getUTCSeconds();
- date2.setUTCSeconds(x - (x % multiple));
- break;
- case SimileAjax.DateTime.MINUTE:
- date2.setUTCMilliseconds(0);
- date2.setUTCSeconds(0);
-
- var x = date2.getUTCMinutes();
- date2.setTime(date2.getTime() -
- (x % multiple) * SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.MINUTE]);
- break;
- case SimileAjax.DateTime.HOUR:
- date2.setUTCMilliseconds(0);
- date2.setUTCSeconds(0);
- date2.setUTCMinutes(0);
-
- var x = date2.getUTCHours();
- date2.setUTCHours(x - (x % multiple));
- break;
- case SimileAjax.DateTime.DAY:
- clearInDay(date2);
- break;
- case SimileAjax.DateTime.WEEK:
- clearInDay(date2);
- var d = (date2.getUTCDay() + 7 - firstDayOfWeek) % 7;
- date2.setTime(date2.getTime() -
- d * SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.DAY]);
- break;
- case SimileAjax.DateTime.MONTH:
- clearInDay(date2);
- date2.setUTCDate(1);
-
- var x = date2.getUTCMonth();
- date2.setUTCMonth(x - (x % multiple));
- break;
- case SimileAjax.DateTime.YEAR:
- clearInYear(date2);
-
- var x = date2.getUTCFullYear();
- date2.setUTCFullYear(x - (x % multiple));
- break;
- case SimileAjax.DateTime.DECADE:
- clearInYear(date2);
- date2.setUTCFullYear(Math.floor(date2.getUTCFullYear() / 10) * 10);
- break;
- case SimileAjax.DateTime.CENTURY:
- clearInYear(date2);
- date2.setUTCFullYear(Math.floor(date2.getUTCFullYear() / 100) * 100);
- break;
- case SimileAjax.DateTime.MILLENNIUM:
- clearInYear(date2);
- date2.setUTCFullYear(Math.floor(date2.getUTCFullYear() / 1000) * 1000);
- break;
- }
-
- date.setTime(date2.getTime() - timeShift);
-};
-
-/**
- * Rounds date objects up to the nearest interval or multiple of an interval.
- * This method modifies the given date object, converting it to the given
- * timezone if specified.
- *
- * @param {Date} date the date object to round
- * @param {Number} intervalUnit a constant, integer index specifying an
- * interval, e.g. SimileAjax.DateTime.HOUR
- * @param {Number} timeZone a timezone shift, given in hours
- * @param {Number} multiple a multiple of the interval to round by
- * @param {Number} firstDayOfWeek an integer specifying the first day of the
- * week, 0 corresponds to Sunday, 1 to Monday, etc.
- * @see SimileAjax.DateTime.roundDownToInterval
- */
-SimileAjax.DateTime.roundUpToInterval = function(date, intervalUnit, timeZone, multiple, firstDayOfWeek) {
- var originalTime = date.getTime();
- SimileAjax.DateTime.roundDownToInterval(date, intervalUnit, timeZone, multiple, firstDayOfWeek);
- if (date.getTime() < originalTime) {
- date.setTime(date.getTime() +
- SimileAjax.DateTime.gregorianUnitLengths[intervalUnit] * multiple);
- }
-};
-
-/**
- * Increments a date object by a specified interval, taking into
- * consideration the timezone.
- *
- * @param {Date} date the date object to increment
- * @param {Number} intervalUnit a constant, integer index specifying an
- * interval, e.g. SimileAjax.DateTime.HOUR
- * @param {Number} timeZone the timezone offset in hours
- */
-SimileAjax.DateTime.incrementByInterval = function(date, intervalUnit, timeZone) {
- timeZone = (typeof timeZone == 'undefined') ? 0 : timeZone;
-
- var timeShift = timeZone *
- SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.HOUR];
-
- var date2 = new Date(date.getTime() + timeShift);
-
- switch(intervalUnit) {
- case SimileAjax.DateTime.MILLISECOND:
- date2.setTime(date2.getTime() + 1)
- break;
- case SimileAjax.DateTime.SECOND:
- date2.setTime(date2.getTime() + 1000);
- break;
- case SimileAjax.DateTime.MINUTE:
- date2.setTime(date2.getTime() +
- SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.MINUTE]);
- break;
- case SimileAjax.DateTime.HOUR:
- date2.setTime(date2.getTime() +
- SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.HOUR]);
- break;
- case SimileAjax.DateTime.DAY:
- date2.setUTCDate(date2.getUTCDate() + 1);
- break;
- case SimileAjax.DateTime.WEEK:
- date2.setUTCDate(date2.getUTCDate() + 7);
- break;
- case SimileAjax.DateTime.MONTH:
- date2.setUTCMonth(date2.getUTCMonth() + 1);
- break;
- case SimileAjax.DateTime.YEAR:
- date2.setUTCFullYear(date2.getUTCFullYear() + 1);
- break;
- case SimileAjax.DateTime.DECADE:
- date2.setUTCFullYear(date2.getUTCFullYear() + 10);
- break;
- case SimileAjax.DateTime.CENTURY:
- date2.setUTCFullYear(date2.getUTCFullYear() + 100);
- break;
- case SimileAjax.DateTime.MILLENNIUM:
- date2.setUTCFullYear(date2.getUTCFullYear() + 1000);
- break;
- }
-
- date.setTime(date2.getTime() - timeShift);
-};
-
-/**
- * Returns a new date object with the given time offset removed.
- *
- * @param {Date} date the starting date
- * @param {Number} timeZone a timezone specified in an hour offset to remove
- * @return {Date} a new date object with the offset removed
- */
-SimileAjax.DateTime.removeTimeZoneOffset = function(date, timeZone) {
- return new Date(date.getTime() +
- timeZone * SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.HOUR]);
-};
-
-/**
- * Returns the timezone of the user's browser.
- *
- * @return {Number} the timezone in the user's locale in hours
- */
-SimileAjax.DateTime.getTimezone = function() {
- var d = new Date().getTimezoneOffset();
- return d / -60;
-};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/debug.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/debug.js
deleted file mode 100644
index ae3f38d..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/debug.js
+++ /dev/null
@@ -1,94 +0,0 @@
-/*==================================================
- * Debug Utility Functions
- *==================================================
- */
-
-SimileAjax.Debug = {
- silent: false
-};
-
-SimileAjax.Debug.log = function(msg) {
- var f;
- if ("console" in window && "log" in window.console) { // FireBug installed
- f = function(msg2) {
- console.log(msg2);
- }
- } else {
- f = function(msg2) {
- if (!SimileAjax.Debug.silent) {
- alert(msg2);
- }
- }
- }
- SimileAjax.Debug.log = f;
- f(msg);
-};
-
-SimileAjax.Debug.warn = function(msg) {
- var f;
- if ("console" in window && "warn" in window.console) { // FireBug installed
- f = function(msg2) {
- console.warn(msg2);
- }
- } else {
- f = function(msg2) {
- if (!SimileAjax.Debug.silent) {
- alert(msg2);
- }
- }
- }
- SimileAjax.Debug.warn = f;
- f(msg);
-};
-
-SimileAjax.Debug.exception = function(e, msg) {
- var f, params = SimileAjax.parseURLParameters();
- if (params.errors == "throw" || SimileAjax.params.errors == "throw") {
- f = function(e2, msg2) {
- throw(e2); // do not hide from browser's native debugging features
- };
- } else if ("console" in window && "error" in window.console) { // FireBug installed
- f = function(e2, msg2) {
- if (msg2 != null) {
- console.error(msg2 + " %o", e2);
- } else {
- console.error(e2);
- }
- throw(e2); // do not hide from browser's native debugging features
- };
- } else {
- f = function(e2, msg2) {
- if (!SimileAjax.Debug.silent) {
- alert("Caught exception: " + msg2 + "\n\nDetails: " + (e2));
- }
- throw(e2); // do not hide from browser's native debugging features
- };
- }
- SimileAjax.Debug.exception = f;
- f(e, msg);
-};
-
-SimileAjax.Debug.objectToString = function(o) {
- return SimileAjax.Debug._objectToString(o, "");
-};
-
-SimileAjax.Debug._objectToString = function(o, indent) {
- var indent2 = indent + " ";
- if (typeof o == "object") {
- var s = "{";
- for (n in o) {
- s += indent2 + n + ": " + SimileAjax.Debug._objectToString(o[n], indent2) + "\n";
- }
- s += indent + "}";
- return s;
- } else if (typeof o == "array") {
- var s = "[";
- for (var n = 0; n < o.length; n++) {
- s += SimileAjax.Debug._objectToString(o[n], indent2) + "\n";
- }
- s += indent + "]";
- return s;
- } else {
- return o;
- }
-};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/dom.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/dom.js
deleted file mode 100644
index c153a32..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/dom.js
+++ /dev/null
@@ -1,344 +0,0 @@
-/*==================================================
- * DOM Utility Functions
- *==================================================
- */
-
-SimileAjax.DOM = new Object();
-
-SimileAjax.DOM.registerEventWithObject = function(elmt, eventName, obj, handlerName) {
- SimileAjax.DOM.registerEvent(elmt, eventName, function(elmt2, evt, target) {
- return obj[handlerName].call(obj, elmt2, evt, target);
- });
-};
-
-SimileAjax.DOM.registerEvent = function(elmt, eventName, handler) {
- var handler2 = function(evt) {
- evt = (evt) ? evt : ((event) ? event : null);
- if (evt) {
- var target = (evt.target) ?
- evt.target : ((evt.srcElement) ? evt.srcElement : null);
- if (target) {
- target = (target.nodeType == 1 || target.nodeType == 9) ?
- target : target.parentNode;
- }
-
- return handler(elmt, evt, target);
- }
- return true;
- }
-
- if (SimileAjax.Platform.browser.isIE) {
- elmt.attachEvent("on" + eventName, handler2);
- } else {
- elmt.addEventListener(eventName, handler2, false);
- }
-};
-
-SimileAjax.DOM.getPageCoordinates = function(elmt) {
- var left = 0;
- var top = 0;
-
- if (elmt.nodeType != 1) {
- elmt = elmt.parentNode;
- }
-
- var elmt2 = elmt;
- while (elmt2 != null) {
- left += elmt2.offsetLeft;
- top += elmt2.offsetTop;
- elmt2 = elmt2.offsetParent;
- }
-
- var body = document.body;
- while (elmt != null && elmt != body) {
- if ("scrollLeft" in elmt) {
- left -= elmt.scrollLeft;
- top -= elmt.scrollTop;
- }
- elmt = elmt.parentNode;
- }
-
- return { left: left, top: top };
-};
-
-SimileAjax.DOM.getSize = function(elmt) {
- var w = this.getStyle(elmt,"width");
- var h = this.getStyle(elmt,"height");
- if (w.indexOf("px") > -1) w = w.replace("px","");
- if (h.indexOf("px") > -1) h = h.replace("px","");
- return {
- w: w,
- h: h
- }
-}
-
-SimileAjax.DOM.getStyle = function(elmt, styleProp) {
- if (elmt.currentStyle) { // IE
- var style = elmt.currentStyle[styleProp];
- } else if (window.getComputedStyle) { // standard DOM
- var style = document.defaultView.getComputedStyle(elmt, null).getPropertyValue(styleProp);
- } else {
- var style = "";
- }
- return style;
-}
-
-SimileAjax.DOM.getEventRelativeCoordinates = function(evt, elmt) {
- if (SimileAjax.Platform.browser.isIE) {
- if (evt.type == "mousewheel") {
- var coords = SimileAjax.DOM.getPageCoordinates(elmt);
- return {
- x: evt.clientX - coords.left,
- y: evt.clientY - coords.top
- };
- } else {
- return {
- x: evt.offsetX,
- y: evt.offsetY
- };
- }
- } else {
- var coords = SimileAjax.DOM.getPageCoordinates(elmt);
-
- if ((evt.type == "DOMMouseScroll") &&
- SimileAjax.Platform.browser.isFirefox &&
- (SimileAjax.Platform.browser.majorVersion == 2)) {
- // Due to: https://bugzilla.mozilla.org/show_bug.cgi?id=352179
-
- return {
- x: evt.screenX - coords.left,
- y: evt.screenY - coords.top
- };
- } else {
- return {
- x: evt.pageX - coords.left,
- y: evt.pageY - coords.top
- };
- }
- }
-};
-
-SimileAjax.DOM.getEventPageCoordinates = function(evt) {
- if (SimileAjax.Platform.browser.isIE) {
- return {
- x: evt.clientX + document.body.scrollLeft,
- y: evt.clientY + document.body.scrollTop
- };
- } else {
- return {
- x: evt.pageX,
- y: evt.pageY
- };
- }
-};
-
-SimileAjax.DOM.hittest = function(x, y, except) {
- return SimileAjax.DOM._hittest(document.body, x, y, except);
-};
-
-SimileAjax.DOM._hittest = function(elmt, x, y, except) {
- var childNodes = elmt.childNodes;
- outer: for (var i = 0; i < childNodes.length; i++) {
- var childNode = childNodes[i];
- for (var j = 0; j < except.length; j++) {
- if (childNode == except[j]) {
- continue outer;
- }
- }
-
- if (childNode.offsetWidth == 0 && childNode.offsetHeight == 0) {
- /*
- * Sometimes SPAN elements have zero width and height but
- * they have children like DIVs that cover non-zero areas.
- */
- var hitNode = SimileAjax.DOM._hittest(childNode, x, y, except);
- if (hitNode != childNode) {
- return hitNode;
- }
- } else {
- var top = 0;
- var left = 0;
-
- var node = childNode;
- while (node) {
- top += node.offsetTop;
- left += node.offsetLeft;
- node = node.offsetParent;
- }
-
- if (left <= x && top <= y && (x - left) < childNode.offsetWidth && (y - top) < childNode.offsetHeight) {
- return SimileAjax.DOM._hittest(childNode, x, y, except);
- } else if (childNode.nodeType == 1 && childNode.tagName == "TR") {
- /*
- * Table row might have cells that span several rows.
- */
- var childNode2 = SimileAjax.DOM._hittest(childNode, x, y, except);
- if (childNode2 != childNode) {
- return childNode2;
- }
- }
- }
- }
- return elmt;
-};
-
-SimileAjax.DOM.cancelEvent = function(evt) {
- evt.returnValue = false;
- evt.cancelBubble = true;
- if ("preventDefault" in evt) {
- evt.preventDefault();
- }
-};
-
-SimileAjax.DOM.appendClassName = function(elmt, className) {
- var classes = elmt.className.split(" ");
- for (var i = 0; i < classes.length; i++) {
- if (classes[i] == className) {
- return;
- }
- }
- classes.push(className);
- elmt.className = classes.join(" ");
-};
-
-SimileAjax.DOM.createInputElement = function(type) {
- var div = document.createElement("div");
- div.innerHTML = "<input type='" + type + "' />";
-
- return div.firstChild;
-};
-
-SimileAjax.DOM.createDOMFromTemplate = function(template) {
- var result = {};
- result.elmt = SimileAjax.DOM._createDOMFromTemplate(template, result, null);
-
- return result;
-};
-
-SimileAjax.DOM._createDOMFromTemplate = function(templateNode, result, parentElmt) {
- if (templateNode == null) {
- /*
- var node = doc.createTextNode("--null--");
- if (parentElmt != null) {
- parentElmt.appendChild(node);
- }
- return node;
- */
- return null;
- } else if (typeof templateNode != "object") {
- var node = document.createTextNode(templateNode);
- if (parentElmt != null) {
- parentElmt.appendChild(node);
- }
- return node;
- } else {
- var elmt = null;
- if ("tag" in templateNode) {
- var tag = templateNode.tag;
- if (parentElmt != null) {
- if (tag == "tr") {
- elmt = parentElmt.insertRow(parentElmt.rows.length);
- } else if (tag == "td") {
- elmt = parentElmt.insertCell(parentElmt.cells.length);
- }
- }
- if (elmt == null) {
- elmt = tag == "input" ?
- SimileAjax.DOM.createInputElement(templateNode.type) :
- document.createElement(tag);
-
- if (parentElmt != null) {
- parentElmt.appendChild(elmt);
- }
- }
- } else {
- elmt = templateNode.elmt;
- if (parentElmt != null) {
- parentElmt.appendChild(elmt);
- }
- }
-
- for (var attribute in templateNode) {
- var value = templateNode[attribute];
-
- if (attribute == "field") {
- result[value] = elmt;
-
- } else if (attribute == "className") {
- elmt.className = value;
- } else if (attribute == "id") {
- elmt.id = value;
- } else if (attribute == "title") {
- elmt.title = value;
- } else if (attribute == "type" && elmt.tagName == "input") {
- // do nothing
- } else if (attribute == "style") {
- for (n in value) {
- var v = value[n];
- if (n == "float") {
- n = SimileAjax.Platform.browser.isIE ? "styleFloat" : "cssFloat";
- }
- elmt.style[n] = v;
- }
- } else if (attribute == "children") {
- for (var i = 0; i < value.length; i++) {
- SimileAjax.DOM._createDOMFromTemplate(value[i], result, elmt);
- }
- } else if (attribute != "tag" && attribute != "elmt") {
- elmt.setAttribute(attribute, value);
- }
- }
- return elmt;
- }
-}
-
-SimileAjax.DOM._cachedParent = null;
-SimileAjax.DOM.createElementFromString = function(s) {
- if (SimileAjax.DOM._cachedParent == null) {
- SimileAjax.DOM._cachedParent = document.createElement("div");
- }
- SimileAjax.DOM._cachedParent.innerHTML = s;
- return SimileAjax.DOM._cachedParent.firstChild;
-};
-
-SimileAjax.DOM.createDOMFromString = function(root, s, fieldElmts) {
- var elmt = typeof root == "string" ? document.createElement(root) : root;
- elmt.innerHTML = s;
-
- var dom = { elmt: elmt };
- SimileAjax.DOM._processDOMChildrenConstructedFromString(dom, elmt, fieldElmts != null ? fieldElmts : {} );
-
- return dom;
-};
-
-SimileAjax.DOM._processDOMConstructedFromString = function(dom, elmt, fieldElmts) {
- var id = elmt.id;
- if (id != null && id.length > 0) {
- elmt.removeAttribute("id");
- if (id in fieldElmts) {
- var parentElmt = elmt.parentNode;
- parentElmt.insertBefore(fieldElmts[id], elmt);
- parentElmt.removeChild(elmt);
-
- dom[id] = fieldElmts[id];
- return;
- } else {
- dom[id] = elmt;
- }
- }
-
- if (elmt.hasChildNodes()) {
- SimileAjax.DOM._processDOMChildrenConstructedFromString(dom, elmt, fieldElmts);
- }
-};
-
-SimileAjax.DOM._processDOMChildrenConstructedFromString = function(dom, elmt, fieldElmts) {
- var node = elmt.firstChild;
- while (node != null) {
- var node2 = node.nextSibling;
- if (node.nodeType == 1) {
- SimileAjax.DOM._processDOMConstructedFromString(dom, node, fieldElmts);
- }
- node = node2;
- }
-};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/graphics.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/graphics.js
deleted file mode 100644
index 0177c22..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/graphics.js
+++ /dev/null
@@ -1,572 +0,0 @@
-/**
- * @fileOverview Graphics utility functions and constants
- * @name SimileAjax.Graphics
- */
-
-SimileAjax.Graphics = new Object();
-
-/**
- * A boolean value indicating whether PNG translucency is supported on the
- * user's browser or not.
- *
- * @type Boolean
- */
-SimileAjax.Graphics.pngIsTranslucent = (!SimileAjax.Platform.browser.isIE) || (SimileAjax.Platform.browser.majorVersion > 6);
-
-/*==================================================
- * Opacity, translucency
- *==================================================
- */
-SimileAjax.Graphics._createTranslucentImage1 = function(url, verticalAlign) {
- var elmt = document.createElement("img");
- elmt.setAttribute("src", url);
- if (verticalAlign != null) {
- elmt.style.verticalAlign = verticalAlign;
- }
- return elmt;
-};
-SimileAjax.Graphics._createTranslucentImage2 = function(url, verticalAlign) {
- var elmt = document.createElement("img");
- elmt.style.width = "1px"; // just so that IE will calculate the size property
- elmt.style.height = "1px";
- elmt.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + url +"', sizingMethod='image')";
- elmt.style.verticalAlign = (verticalAlign != null) ? verticalAlign : "middle";
- return elmt;
-};
-
-/**
- * Creates a DOM element for an <code>img</code> tag using the URL given. This
- * is a convenience method that automatically includes the necessary CSS to
- * allow for translucency, even on IE.
- *
- * @function
- * @param {String} url the URL to the image
- * @param {String} verticalAlign the CSS value for the image's vertical-align
- * @return {Element} a DOM element containing the <code>img</code> tag
- */
-SimileAjax.Graphics.createTranslucentImage = SimileAjax.Graphics.pngIsTranslucent ?
- SimileAjax.Graphics._createTranslucentImage1 :
- SimileAjax.Graphics._createTranslucentImage2;
-
-SimileAjax.Graphics._createTranslucentImageHTML1 = function(url, verticalAlign) {
- return "<img src=\"" + url + "\"" +
- (verticalAlign != null ? " style=\"vertical-align: " + verticalAlign + ";\"" : "") +
- " />";
-};
-SimileAjax.Graphics._createTranslucentImageHTML2 = function(url, verticalAlign) {
- var style =
- "width: 1px; height: 1px; " +
- "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + url +"', sizingMethod='image');" +
- (verticalAlign != null ? " vertical-align: " + verticalAlign + ";" : "");
-
- return "<img src='" + url + "' style=\"" + style + "\" />";
-};
-
-/**
- * Creates an HTML string for an <code>img</code> tag using the URL given.
- * This is a convenience method that automatically includes the necessary CSS
- * to allow for translucency, even on IE.
- *
- * @function
- * @param {String} url the URL to the image
- * @param {String} verticalAlign the CSS value for the image's vertical-align
- * @return {String} a string containing the <code>img</code> tag
- */
-SimileAjax.Graphics.createTranslucentImageHTML = SimileAjax.Graphics.pngIsTranslucent ?
- SimileAjax.Graphics._createTranslucentImageHTML1 :
- SimileAjax.Graphics._createTranslucentImageHTML2;
-
-/**
- * Sets the opacity on the given DOM element.
- *
- * @param {Element} elmt the DOM element to set the opacity on
- * @param {Number} opacity an integer from 0 to 100 specifying the opacity
- */
-SimileAjax.Graphics.setOpacity = function(elmt, opacity) {
- if (SimileAjax.Platform.browser.isIE) {
- elmt.style.filter = "progid:DXImageTransform.Microsoft.Alpha(Style=0,Opacity=" + opacity + ")";
- } else {
- var o = (opacity / 100).toString();
- elmt.style.opacity = o;
- elmt.style.MozOpacity = o;
- }
-};
-
-/*==================================================
- * Bubble
- *==================================================
- */
-SimileAjax.Graphics._bubbleMargins = {
- top: 33,
- bottom: 42,
- left: 33,
- right: 40
-}
-
-// pixels from boundary of the whole bubble div to the tip of the arrow
-SimileAjax.Graphics._arrowOffsets = {
- top: 0,
- bottom: 9,
- left: 1,
- right: 8
-}
-
-SimileAjax.Graphics._bubblePadding = 15;
-SimileAjax.Graphics._bubblePointOffset = 6;
-SimileAjax.Graphics._halfArrowWidth = 18;
-
-/**
- * Creates a nice, rounded bubble popup with the given content in a div,
- * page coordinates and a suggested width. The bubble will point to the
- * location on the page as described by pageX and pageY. All measurements
- * should be given in pixels.
- *
- * @param {Element} the content div
- * @param {Number} pageX the x coordinate of the point to point to
- * @param {Number} pageY the y coordinate of the point to point to
- * @param {Number} contentWidth a suggested width of the content
- * @param {String} orientation a string ("top", "bottom", "left", or "right")
- * that describes the orientation of the arrow on the bubble
- */
-SimileAjax.Graphics.createBubbleForContentAndPoint = function(div, pageX, pageY, contentWidth, orientation) {
- if (typeof contentWidth != "number") {
- contentWidth = 300;
- }
-
- div.style.position = "absolute";
- div.style.left = "-5000px";
- div.style.top = "0px";
- div.style.width = contentWidth + "px";
- document.body.appendChild(div);
-
- window.setTimeout(function() {
- var width = div.scrollWidth + 10;
- var height = div.scrollHeight + 10;
-
- var bubble = SimileAjax.Graphics.createBubbleForPoint(pageX, pageY, width, height, orientation);
-
- document.body.removeChild(div);
- div.style.position = "static";
- div.style.left = "";
- div.style.top = "";
- div.style.width = width + "px";
- bubble.content.appendChild(div);
- }, 200);
-};
-
-/**
- * Creates a nice, rounded bubble popup with the given page coordinates and
- * content dimensions. The bubble will point to the location on the page
- * as described by pageX and pageY. All measurements should be given in
- * pixels.
- *
- * @param {Number} pageX the x coordinate of the point to point to
- * @param {Number} pageY the y coordinate of the point to point to
- * @param {Number} contentWidth the width of the content box in the bubble
- * @param {Number} contentHeight the height of the content box in the bubble
- * @param {String} orientation a string ("top", "bottom", "left", or "right")
- * that describes the orientation of the arrow on the bubble
- * @return {Element} a DOM element for the newly created bubble
- */
-SimileAjax.Graphics.createBubbleForPoint = function(pageX, pageY, contentWidth, contentHeight, orientation) {
- function getWindowDims() {
- if (typeof window.innerHeight == 'number') {
- return { w:window.innerWidth, h:window.innerHeight }; // Non-IE
- } else if (document.documentElement && document.documentElement.clientHeight) {
- return { // IE6+, in "standards compliant mode"
- w:document.documentElement.clientWidth,
- h:document.documentElement.clientHeight
- };
- } else if (document.body && document.body.clientHeight) {
- return { // IE 4 compatible
- w:document.body.clientWidth,
- h:document.body.clientHeight
- };
- }
- }
-
- var close = function() {
- if (!bubble._closed) {
- document.body.removeChild(bubble._div);
- bubble._doc = null;
- bubble._div = null;
- bubble._content = null;
- bubble._closed = true;
- }
- }
- var bubble = {
- _closed: false
- };
-
- var dims = getWindowDims();
- var docWidth = dims.w;
- var docHeight = dims.h;
-
- var margins = SimileAjax.Graphics._bubbleMargins;
- contentWidth = parseInt(contentWidth, 10); // harden against bad input bugs
- contentHeight = parseInt(contentHeight, 10); // getting numbers-as-strings
- var bubbleWidth = margins.left + contentWidth + margins.right;
- var bubbleHeight = margins.top + contentHeight + margins.bottom;
-
- var pngIsTranslucent = SimileAjax.Graphics.pngIsTranslucent;
- var urlPrefix = SimileAjax.urlPrefix;
-
- var setImg = function(elmt, url, width, height) {
- elmt.style.position = "absolute";
- elmt.style.width = width + "px";
- elmt.style.height = height + "px";
- if (pngIsTranslucent) {
- elmt.style.background = "url(" + url + ")";
- } else {
- elmt.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + url +"', sizingMethod='crop')";
- }
- }
- var div = document.createElement("div");
- div.style.width = bubbleWidth + "px";
- div.style.height = bubbleHeight + "px";
- div.style.position = "absolute";
- div.style.zIndex = 1000;
-
- var layer = SimileAjax.WindowManager.pushLayer(close, true, div);
- bubble._div = div;
- bubble.close = function() { SimileAjax.WindowManager.popLayer(layer); }
-
- var divInner = document.createElement("div");
- divInner.style.width = "100%";
- divInner.style.height = "100%";
- divInner.style.position = "relative";
- div.appendChild(divInner);
-
- var createImg = function(url, left, top, width, height) {
- var divImg = document.createElement("div");
- divImg.style.left = left + "px";
- divImg.style.top = top + "px";
- setImg(divImg, url, width, height);
- divInner.appendChild(divImg);
- }
-
- createImg(urlPrefix + "images/bubble-top-left.png", 0, 0, margins.left, margins.top);
- createImg(urlPrefix + "images/bubble-top.png", margins.left, 0, contentWidth, margins.top);
- createImg(urlPrefix + "images/bubble-top-right.png", margins.left + contentWidth, 0, margins.right, margins.top);
-
- createImg(urlPrefix + "images/bubble-left.png", 0, margins.top, margins.left, contentHeight);
- createImg(urlPrefix + "images/bubble-right.png", margins.left + contentWidth, margins.top, margins.right, contentHeight);
-
- createImg(urlPrefix + "images/bubble-bottom-left.png", 0, margins.top + contentHeight, margins.left, margins.bottom);
- createImg(urlPrefix + "images/bubble-bottom.png", margins.left, margins.top + contentHeight, contentWidth, margins.bottom);
- createImg(urlPrefix + "images/bubble-bottom-right.png", margins.left + contentWidth, margins.top + contentHeight, margins.right, margins.bottom);
-
- var divClose = document.createElement("div");
- divClose.style.left = (bubbleWidth - margins.right + SimileAjax.Graphics._bubblePadding - 16 - 2) + "px";
- divClose.style.top = (margins.top - SimileAjax.Graphics._bubblePadding + 1) + "px";
- divClose.style.cursor = "pointer";
- setImg(divClose, urlPrefix + "images/close-button.png", 16, 16);
- SimileAjax.WindowManager.registerEventWithObject(divClose, "click", bubble, "close");
- divInner.appendChild(divClose);
-
- var divContent = document.createElement("div");
- divContent.style.position = "absolute";
- divContent.style.left = margins.left + "px";
- divContent.style.top = margins.top + "px";
- divContent.style.width = contentWidth + "px";
- divContent.style.height = contentHeight + "px";
- divContent.style.overflow = "auto";
- divContent.style.background = "white";
- divInner.appendChild(divContent);
- bubble.content = divContent;
-
- (function() {
- if (pageX - SimileAjax.Graphics._halfArrowWidth - SimileAjax.Graphics._bubblePadding > 0 &&
- pageX + SimileAjax.Graphics._halfArrowWidth + SimileAjax.Graphics._bubblePadding < docWidth) {
-
- var left = pageX - Math.round(contentWidth / 2) - margins.left;
- left = pageX < (docWidth / 2) ?
- Math.max(left, -(margins.left - SimileAjax.Graphics._bubblePadding)) :
- Math.min(left, docWidth + (margins.right - SimileAjax.Graphics._bubblePadding) - bubbleWidth);
-
- if ((orientation && orientation == "top") || (!orientation && (pageY - SimileAjax.Graphics._bubblePointOffset - bubbleHeight > 0))) { // top
- var divImg = document.createElement("div");
-
- divImg.style.left = (pageX - SimileAjax.Graphics._halfArrowWidth - left) + "px";
- divImg.style.top = (margins.top + contentHeight) + "px";
- setImg(divImg, urlPrefix + "images/bubble-bottom-arrow.png", 37, margins.bottom);
- divInner.appendChild(divImg);
-
- div.style.left = left + "px";
- div.style.top = (pageY - SimileAjax.Graphics._bubblePointOffset - bubbleHeight +
- SimileAjax.Graphics._arrowOffsets.bottom) + "px";
-
- return;
- } else if ((orientation && orientation == "bottom") || (!orientation && (pageY + SimileAjax.Graphics._bubblePointOffset + bubbleHeight < docHeight))) { // bottom
- var divImg = document.createElement("div");
-
- divImg.style.left = (pageX - SimileAjax.Graphics._halfArrowWidth - left) + "px";
- divImg.style.top = "0px";
- setImg(divImg, urlPrefix + "images/bubble-top-arrow.png", 37, margins.top);
- divInner.appendChild(divImg);
-
- div.style.left = left + "px";
- div.style.top = (pageY + SimileAjax.Graphics._bubblePointOffset -
- SimileAjax.Graphics._arrowOffsets.top) + "px";
-
- return;
- }
- }
-
- var top = pageY - Math.round(contentHeight / 2) - margins.top;
- top = pageY < (docHeight / 2) ?
- Math.max(top, -(margins.top - SimileAjax.Graphics._bubblePadding)) :
- Math.min(top, docHeight + (margins.bottom - SimileAjax.Graphics._bubblePadding) - bubbleHeight);
-
- if ((orientation && orientation == "left") || (!orientation && (pageX - SimileAjax.Graphics._bubblePointOffset - bubbleWidth > 0))) { // left
- var divImg = document.createElement("div");
-
- divImg.style.left = (margins.left + contentWidth) + "px";
- divImg.style.top = (pageY - SimileAjax.Graphics._halfArrowWidth - top) + "px";
- setImg(divImg, urlPrefix + "images/bubble-right-arrow.png", margins.right, 37);
- divInner.appendChild(divImg);
-
- div.style.left = (pageX - SimileAjax.Graphics._bubblePointOffset - bubbleWidth +
- SimileAjax.Graphics._arrowOffsets.right) + "px";
- div.style.top = top + "px";
- } else if ((orientation && orientation == "right") || (!orientation && (pageX - SimileAjax.Graphics._bubblePointOffset - bubbleWidth < docWidth))) { // right
- var divImg = document.createElement("div");
-
- divImg.style.left = "0px";
- divImg.style.top = (pageY - SimileAjax.Graphics._halfArrowWidth - top) + "px";
- setImg(divImg, urlPrefix + "images/bubble-left-arrow.png", margins.left, 37);
- divInner.appendChild(divImg);
-
- div.style.left = (pageX + SimileAjax.Graphics._bubblePointOffset -
- SimileAjax.Graphics._arrowOffsets.left) + "px";
- div.style.top = top + "px";
- }
- })();
-
- document.body.appendChild(div);
-
- return bubble;
-};
-
-/**
- * Creates a floating, rounded message bubble in the center of the window for
- * displaying modal information, e.g. "Loading..."
- *
- * @param {Document} doc the root document for the page to render on
- * @param {Object} an object with two properties, contentDiv and containerDiv,
- * consisting of the newly created DOM elements
- */
-SimileAjax.Graphics.createMessageBubble = function(doc) {
- var containerDiv = doc.createElement("div");
- if (SimileAjax.Graphics.pngIsTranslucent) {
- var topDiv = doc.createElement("div");
- topDiv.style.height = "33px";
- topDiv.style.background = "url(" + SimileAjax.urlPrefix + "images/message-top-left.png) top left no-repeat";
- topDiv.style.paddingLeft = "44px";
- containerDiv.appendChild(topDiv);
-
- var topRightDiv = doc.createElement("div");
- topRightDiv.style.height = "33px";
- topRightDiv.style.background = "url(" + SimileAjax.urlPrefix + "images/message-top-right.png) top right no-repeat";
- topDiv.appendChild(topRightDiv);
-
- var middleDiv = doc.createElement("div");
- middleDiv.style.background = "url(" + SimileAjax.urlPrefix + "images/message-left.png) top left repeat-y";
- middleDiv.style.paddingLeft = "44px";
- containerDiv.appendChild(middleDiv);
-
- var middleRightDiv = doc.createElement("div");
- middleRightDiv.style.background = "url(" + SimileAjax.urlPrefix + "images/message-right.png) top right repeat-y";
- middleRightDiv.style.paddingRight = "44px";
- middleDiv.appendChild(middleRightDiv);
-
- var contentDiv = doc.createElement("div");
- middleRightDiv.appendChild(contentDiv);
-
- var bottomDiv = doc.createElement("div");
- bottomDiv.style.height = "55px";
- bottomDiv.style.background = "url(" + SimileAjax.urlPrefix + "images/message-bottom-left.png) bottom left no-repeat";
- bottomDiv.style.paddingLeft = "44px";
- containerDiv.appendChild(bottomDiv);
-
- var bottomRightDiv = doc.createElement("div");
- bottomRightDiv.style.height = "55px";
- bottomRightDiv.style.background = "url(" + SimileAjax.urlPrefix + "images/message-bottom-right.png) bottom right no-repeat";
- bottomDiv.appendChild(bottomRightDiv);
- } else {
- containerDiv.style.border = "2px solid #7777AA";
- containerDiv.style.padding = "20px";
- containerDiv.style.background = "white";
- SimileAjax.Graphics.setOpacity(containerDiv, 90);
-
- var contentDiv = doc.createElement("div");
- containerDiv.appendChild(contentDiv);
- }
-
- return {
- containerDiv: containerDiv,
- contentDiv: contentDiv
- };
-};
-
-/*==================================================
- * Animation
- *==================================================
- */
-
-/**
- * Creates an animation for a function, and an interval of values. The word
- * "animation" here is used in the sense of repeatedly calling a function with
- * a current value from within an interval, and a delta value.
- *
- * @param {Function} f a function to be called every 50 milliseconds throughout
- * the animation duration, of the form f(current, delta), where current is
- * the current value within the range and delta is the current change.
- * @param {Number} from a starting value
- * @param {Number} to an ending value
- * @param {Number} duration the duration of the animation in milliseconds
- * @param {Function} [cont] an optional function that is called at the end of
- * the animation, i.e. a continuation.
- * @return {SimileAjax.Graphics._Animation} a new animation object
- */
-SimileAjax.Graphics.createAnimation = function(f, from, to, duration, cont) {
- return new SimileAjax.Graphics._Animation(f, from, to, duration, cont);
-};
-
-SimileAjax.Graphics._Animation = function(f, from, to, duration, cont) {
- this.f = f;
- this.cont = (typeof cont == "function") ? cont : function() {};
-
- this.from = from;
- this.to = to;
- this.current = from;
-
- this.duration = duration;
- this.start = new Date().getTime();
- this.timePassed = 0;
-};
-
-/**
- * Runs this animation.
- */
-SimileAjax.Graphics._Animation.prototype.run = function() {
- var a = this;
- window.setTimeout(function() { a.step(); }, 50);
-};
-
-/**
- * Increments this animation by one step, and then continues the animation with
- * <code>run()</code>.
- */
-SimileAjax.Graphics._Animation.prototype.step = function() {
- this.timePassed += 50;
-
- var timePassedFraction = this.timePassed / this.duration;
- var parameterFraction = -Math.cos(timePassedFraction * Math.PI) / 2 + 0.5;
- var current = parameterFraction * (this.to - this.from) + this.from;
-
- try {
- this.f(current, current - this.current);
- } catch (e) {
- }
- this.current = current;
-
- if (this.timePassed < this.duration) {
- this.run();
- } else {
- this.f(this.to, 0);
- this["cont"]();
- }
-};
-
-/*==================================================
- * CopyPasteButton
- *
- * Adapted from http://spaces.live.com/editorial/rayozzie/demo/liveclip/liveclipsample/tech….
- *==================================================
- */
-
-/**
- * Creates a button and textarea for displaying structured data and copying it
- * to the clipboard. The data is dynamically generated by the given
- * createDataFunction parameter.
- *
- * @param {String} image an image URL to use as the background for the
- * generated box
- * @param {Number} width the width in pixels of the generated box
- * @param {Number} height the height in pixels of the generated box
- * @param {Function} createDataFunction a function that is called with no
- * arguments to generate the structured data
- * @return a new DOM element
- */
-SimileAjax.Graphics.createStructuredDataCopyButton = function(image, width, height, createDataFunction) {
- var div = document.createElement("div");
- div.style.position = "relative";
- div.style.display = "inline";
- div.style.width = width + "px";
- div.style.height = height + "px";
- div.style.overflow = "hidden";
- div.style.margin = "2px";
-
- if (SimileAjax.Graphics.pngIsTranslucent) {
- div.style.background = "url(" + image + ") no-repeat";
- } else {
- div.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + image +"', sizingMethod='image')";
- }
-
- var style;
- if (SimileAjax.Platform.browser.isIE) {
- style = "filter:alpha(opacity=0)";
- } else {
- style = "opacity: 0";
- }
- div.innerHTML = "<textarea rows='1' autocomplete='off' value='none' style='" + style + "' />";
-
- var textarea = div.firstChild;
- textarea.style.width = width + "px";
- textarea.style.height = height + "px";
- textarea.onmousedown = function(evt) {
- evt = (evt) ? evt : ((event) ? event : null);
- if (evt.button == 2) {
- textarea.value = createDataFunction();
- textarea.select();
- }
- };
-
- return div;
-};
-
-SimileAjax.Graphics.getFontRenderingContext = function(elmt, width) {
- return new SimileAjax.Graphics._FontRenderingContext(elmt, width);
-};
-
-SimileAjax.Graphics._FontRenderingContext = function(elmt, width) {
- this._elmt = elmt;
- this._elmt.style.visibility = "hidden";
- if (typeof width == "string") {
- this._elmt.style.width = width;
- } else if (typeof width == "number") {
- this._elmt.style.width = width + "px";
- }
-};
-
-SimileAjax.Graphics._FontRenderingContext.prototype.dispose = function() {
- this._elmt = null;
-};
-
-SimileAjax.Graphics._FontRenderingContext.prototype.update = function() {
- this._elmt.innerHTML = "A";
- this._lineHeight = this._elmt.offsetHeight;
-};
-
-SimileAjax.Graphics._FontRenderingContext.prototype.computeSize = function(text) {
- this._elmt.innerHTML = text;
- return {
- width: this._elmt.offsetWidth,
- height: this._elmt.offsetHeight
- };
-};
-
-SimileAjax.Graphics._FontRenderingContext.prototype.getLineHeight = function() {
- return this._lineHeight;
-};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/history.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/history.js
deleted file mode 100644
index 678b1ec..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/history.js
+++ /dev/null
@@ -1,220 +0,0 @@
-/*======================================================================
- * History
- *
- * This is a singleton that keeps track of undoable user actions and
- * performs undos and redos in response to the browser's Back and
- * Forward buttons.
- *
- * Call addAction(action) to register an undoable user action. action
- * must have 4 fields:
- *
- * perform: an argument-less function that carries out the action
- * undo: an argument-less function that undos the action
- * label: a short, user-friendly string describing the action
- * uiLayer: the UI layer on which the action takes place
- *
- * By default, the history keeps track of upto 10 actions. You can
- * configure this behavior by setting
- * SimileAjax.History.maxHistoryLength
- * to a different number.
- *
- * An iframe is inserted into the document's body element to track
- * onload events.
- *======================================================================
- */
-
-SimileAjax.History = {
- maxHistoryLength: 10,
- historyFile: "__history__.html",
- enabled: true,
-
- _initialized: false,
- _listeners: new SimileAjax.ListenerQueue(),
-
- _actions: [],
- _baseIndex: 0,
- _currentIndex: 0,
-
- _plainDocumentTitle: document.title
-};
-
-SimileAjax.History.formatHistoryEntryTitle = function(actionLabel) {
- return SimileAjax.History._plainDocumentTitle + " {" + actionLabel + "}";
-};
-
-SimileAjax.History.initialize = function() {
- if (SimileAjax.History._initialized) {
- return;
- }
-
- if (SimileAjax.History.enabled) {
- var iframe = document.createElement("iframe");
- iframe.id = "simile-ajax-history";
- iframe.style.position = "absolute";
- iframe.style.width = "10px";
- iframe.style.height = "10px";
- iframe.style.top = "0px";
- iframe.style.left = "0px";
- iframe.style.visibility = "hidden";
- iframe.src = SimileAjax.History.historyFile + "?0";
-
- document.body.appendChild(iframe);
- SimileAjax.DOM.registerEvent(iframe, "load", SimileAjax.History._handleIFrameOnLoad);
-
- SimileAjax.History._iframe = iframe;
- }
- SimileAjax.History._initialized = true;
-};
-
-SimileAjax.History.addListener = function(listener) {
- SimileAjax.History.initialize();
-
- SimileAjax.History._listeners.add(listener);
-};
-
-SimileAjax.History.removeListener = function(listener) {
- SimileAjax.History.initialize();
-
- SimileAjax.History._listeners.remove(listener);
-};
-
-SimileAjax.History.addAction = function(action) {
- SimileAjax.History.initialize();
-
- SimileAjax.History._listeners.fire("onBeforePerform", [ action ]);
- window.setTimeout(function() {
- try {
- action.perform();
- SimileAjax.History._listeners.fire("onAfterPerform", [ action ]);
-
- if (SimileAjax.History.enabled) {
- SimileAjax.History._actions = SimileAjax.History._actions.slice(
- 0, SimileAjax.History._currentIndex - SimileAjax.History._baseIndex);
-
- SimileAjax.History._actions.push(action);
- SimileAjax.History._currentIndex++;
-
- var diff = SimileAjax.History._actions.length - SimileAjax.History.maxHistoryLength;
- if (diff > 0) {
- SimileAjax.History._actions = SimileAjax.History._actions.slice(diff);
- SimileAjax.History._baseIndex += diff;
- }
-
- try {
- SimileAjax.History._iframe.contentWindow.location.search =
- "?" + SimileAjax.History._currentIndex;
- } catch (e) {
- /*
- * We can't modify location.search most probably because it's a file:// url.
- * We'll just going to modify the document's title.
- */
- var title = SimileAjax.History.formatHistoryEntryTitle(action.label);
- document.title = title;
- }
- }
- } catch (e) {
- SimileAjax.Debug.exception(e, "Error adding action {" + action.label + "} to history");
- }
- }, 0);
-};
-
-SimileAjax.History.addLengthyAction = function(perform, undo, label) {
- SimileAjax.History.addAction({
- perform: perform,
- undo: undo,
- label: label,
- uiLayer: SimileAjax.WindowManager.getBaseLayer(),
- lengthy: true
- });
-};
-
-SimileAjax.History._handleIFrameOnLoad = function() {
- /*
- * This function is invoked when the user herself
- * navigates backward or forward. We need to adjust
- * the application's state accordingly.
- */
-
- try {
- var q = SimileAjax.History._iframe.contentWindow.location.search;
- var c = (q.length == 0) ? 0 : Math.max(0, parseInt(q.substr(1)));
-
- var finishUp = function() {
- var diff = c - SimileAjax.History._currentIndex;
- SimileAjax.History._currentIndex += diff;
- SimileAjax.History._baseIndex += diff;
-
- SimileAjax.History._iframe.contentWindow.location.search = "?" + c;
- };
-
- if (c < SimileAjax.History._currentIndex) { // need to undo
- SimileAjax.History._listeners.fire("onBeforeUndoSeveral", []);
- window.setTimeout(function() {
- while (SimileAjax.History._currentIndex > c &&
- SimileAjax.History._currentIndex > SimileAjax.History._baseIndex) {
-
- SimileAjax.History._currentIndex--;
-
- var action = SimileAjax.History._actions[SimileAjax.History._currentIndex - SimileAjax.History._baseIndex];
-
- try {
- action.undo();
- } catch (e) {
- SimileAjax.Debug.exception(e, "History: Failed to undo action {" + action.label + "}");
- }
- }
-
- SimileAjax.History._listeners.fire("onAfterUndoSeveral", []);
- finishUp();
- }, 0);
- } else if (c > SimileAjax.History._currentIndex) { // need to redo
- SimileAjax.History._listeners.fire("onBeforeRedoSeveral", []);
- window.setTimeout(function() {
- while (SimileAjax.History._currentIndex < c &&
- SimileAjax.History._currentIndex - SimileAjax.History._baseIndex < SimileAjax.History._actions.length) {
-
- var action = SimileAjax.History._actions[SimileAjax.History._currentIndex - SimileAjax.History._baseIndex];
-
- try {
- action.perform();
- } catch (e) {
- SimileAjax.Debug.exception(e, "History: Failed to redo action {" + action.label + "}");
- }
-
- SimileAjax.History._currentIndex++;
- }
-
- SimileAjax.History._listeners.fire("onAfterRedoSeveral", []);
- finishUp();
- }, 0);
- } else {
- var index = SimileAjax.History._currentIndex - SimileAjax.History._baseIndex - 1;
- var title = (index >= 0 && index < SimileAjax.History._actions.length) ?
- SimileAjax.History.formatHistoryEntryTitle(SimileAjax.History._actions[index].label) :
- SimileAjax.History._plainDocumentTitle;
-
- SimileAjax.History._iframe.contentWindow.document.title = title;
- document.title = title;
- }
- } catch (e) {
- // silent
- }
-};
-
-SimileAjax.History.getNextUndoAction = function() {
- try {
- var index = SimileAjax.History._currentIndex - SimileAjax.History._baseIndex - 1;
- return SimileAjax.History._actions[index];
- } catch (e) {
- return null;
- }
-};
-
-SimileAjax.History.getNextRedoAction = function() {
- try {
- var index = SimileAjax.History._currentIndex - SimileAjax.History._baseIndex;
- return SimileAjax.History._actions[index];
- } catch (e) {
- return null;
- }
-};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/html.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/html.js
deleted file mode 100644
index cedeb4a..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/html.js
+++ /dev/null
@@ -1,274 +0,0 @@
-/*==================================================
- * HTML Utility Functions
- *==================================================
- */
-
-SimileAjax.HTML = new Object();
-
-SimileAjax.HTML._e2uHash = {};
-(function() {
- var e2uHash = SimileAjax.HTML._e2uHash;
- e2uHash['nbsp']= '\u00A0[space]';
- e2uHash['iexcl']= '\u00A1';
- e2uHash['cent']= '\u00A2';
- e2uHash['pound']= '\u00A3';
- e2uHash['curren']= '\u00A4';
- e2uHash['yen']= '\u00A5';
- e2uHash['brvbar']= '\u00A6';
- e2uHash['sect']= '\u00A7';
- e2uHash['uml']= '\u00A8';
- e2uHash['copy']= '\u00A9';
- e2uHash['ordf']= '\u00AA';
- e2uHash['laquo']= '\u00AB';
- e2uHash['not']= '\u00AC';
- e2uHash['shy']= '\u00AD';
- e2uHash['reg']= '\u00AE';
- e2uHash['macr']= '\u00AF';
- e2uHash['deg']= '\u00B0';
- e2uHash['plusmn']= '\u00B1';
- e2uHash['sup2']= '\u00B2';
- e2uHash['sup3']= '\u00B3';
- e2uHash['acute']= '\u00B4';
- e2uHash['micro']= '\u00B5';
- e2uHash['para']= '\u00B6';
- e2uHash['middot']= '\u00B7';
- e2uHash['cedil']= '\u00B8';
- e2uHash['sup1']= '\u00B9';
- e2uHash['ordm']= '\u00BA';
- e2uHash['raquo']= '\u00BB';
- e2uHash['frac14']= '\u00BC';
- e2uHash['frac12']= '\u00BD';
- e2uHash['frac34']= '\u00BE';
- e2uHash['iquest']= '\u00BF';
- e2uHash['Agrave']= '\u00C0';
- e2uHash['Aacute']= '\u00C1';
- e2uHash['Acirc']= '\u00C2';
- e2uHash['Atilde']= '\u00C3';
- e2uHash['Auml']= '\u00C4';
- e2uHash['Aring']= '\u00C5';
- e2uHash['AElig']= '\u00C6';
- e2uHash['Ccedil']= '\u00C7';
- e2uHash['Egrave']= '\u00C8';
- e2uHash['Eacute']= '\u00C9';
- e2uHash['Ecirc']= '\u00CA';
- e2uHash['Euml']= '\u00CB';
- e2uHash['Igrave']= '\u00CC';
- e2uHash['Iacute']= '\u00CD';
- e2uHash['Icirc']= '\u00CE';
- e2uHash['Iuml']= '\u00CF';
- e2uHash['ETH']= '\u00D0';
- e2uHash['Ntilde']= '\u00D1';
- e2uHash['Ograve']= '\u00D2';
- e2uHash['Oacute']= '\u00D3';
- e2uHash['Ocirc']= '\u00D4';
- e2uHash['Otilde']= '\u00D5';
- e2uHash['Ouml']= '\u00D6';
- e2uHash['times']= '\u00D7';
- e2uHash['Oslash']= '\u00D8';
- e2uHash['Ugrave']= '\u00D9';
- e2uHash['Uacute']= '\u00DA';
- e2uHash['Ucirc']= '\u00DB';
- e2uHash['Uuml']= '\u00DC';
- e2uHash['Yacute']= '\u00DD';
- e2uHash['THORN']= '\u00DE';
- e2uHash['szlig']= '\u00DF';
- e2uHash['agrave']= '\u00E0';
- e2uHash['aacute']= '\u00E1';
- e2uHash['acirc']= '\u00E2';
- e2uHash['atilde']= '\u00E3';
- e2uHash['auml']= '\u00E4';
- e2uHash['aring']= '\u00E5';
- e2uHash['aelig']= '\u00E6';
- e2uHash['ccedil']= '\u00E7';
- e2uHash['egrave']= '\u00E8';
- e2uHash['eacute']= '\u00E9';
- e2uHash['ecirc']= '\u00EA';
- e2uHash['euml']= '\u00EB';
- e2uHash['igrave']= '\u00EC';
- e2uHash['iacute']= '\u00ED';
- e2uHash['icirc']= '\u00EE';
- e2uHash['iuml']= '\u00EF';
- e2uHash['eth']= '\u00F0';
- e2uHash['ntilde']= '\u00F1';
- e2uHash['ograve']= '\u00F2';
- e2uHash['oacute']= '\u00F3';
- e2uHash['ocirc']= '\u00F4';
- e2uHash['otilde']= '\u00F5';
- e2uHash['ouml']= '\u00F6';
- e2uHash['divide']= '\u00F7';
- e2uHash['oslash']= '\u00F8';
- e2uHash['ugrave']= '\u00F9';
- e2uHash['uacute']= '\u00FA';
- e2uHash['ucirc']= '\u00FB';
- e2uHash['uuml']= '\u00FC';
- e2uHash['yacute']= '\u00FD';
- e2uHash['thorn']= '\u00FE';
- e2uHash['yuml']= '\u00FF';
- e2uHash['quot']= '\u0022';
- e2uHash['amp']= '\u0026';
- e2uHash['lt']= '\u003C';
- e2uHash['gt']= '\u003E';
- e2uHash['OElig']= '';
- e2uHash['oelig']= '\u0153';
- e2uHash['Scaron']= '\u0160';
- e2uHash['scaron']= '\u0161';
- e2uHash['Yuml']= '\u0178';
- e2uHash['circ']= '\u02C6';
- e2uHash['tilde']= '\u02DC';
- e2uHash['ensp']= '\u2002';
- e2uHash['emsp']= '\u2003';
- e2uHash['thinsp']= '\u2009';
- e2uHash['zwnj']= '\u200C';
- e2uHash['zwj']= '\u200D';
- e2uHash['lrm']= '\u200E';
- e2uHash['rlm']= '\u200F';
- e2uHash['ndash']= '\u2013';
- e2uHash['mdash']= '\u2014';
- e2uHash['lsquo']= '\u2018';
- e2uHash['rsquo']= '\u2019';
- e2uHash['sbquo']= '\u201A';
- e2uHash['ldquo']= '\u201C';
- e2uHash['rdquo']= '\u201D';
- e2uHash['bdquo']= '\u201E';
- e2uHash['dagger']= '\u2020';
- e2uHash['Dagger']= '\u2021';
- e2uHash['permil']= '\u2030';
- e2uHash['lsaquo']= '\u2039';
- e2uHash['rsaquo']= '\u203A';
- e2uHash['euro']= '\u20AC';
- e2uHash['fnof']= '\u0192';
- e2uHash['Alpha']= '\u0391';
- e2uHash['Beta']= '\u0392';
- e2uHash['Gamma']= '\u0393';
- e2uHash['Delta']= '\u0394';
- e2uHash['Epsilon']= '\u0395';
- e2uHash['Zeta']= '\u0396';
- e2uHash['Eta']= '\u0397';
- e2uHash['Theta']= '\u0398';
- e2uHash['Iota']= '\u0399';
- e2uHash['Kappa']= '\u039A';
- e2uHash['Lambda']= '\u039B';
- e2uHash['Mu']= '\u039C';
- e2uHash['Nu']= '\u039D';
- e2uHash['Xi']= '\u039E';
- e2uHash['Omicron']= '\u039F';
- e2uHash['Pi']= '\u03A0';
- e2uHash['Rho']= '\u03A1';
- e2uHash['Sigma']= '\u03A3';
- e2uHash['Tau']= '\u03A4';
- e2uHash['Upsilon']= '\u03A5';
- e2uHash['Phi']= '\u03A6';
- e2uHash['Chi']= '\u03A7';
- e2uHash['Psi']= '\u03A8';
- e2uHash['Omega']= '\u03A9';
- e2uHash['alpha']= '\u03B1';
- e2uHash['beta']= '\u03B2';
- e2uHash['gamma']= '\u03B3';
- e2uHash['delta']= '\u03B4';
- e2uHash['epsilon']= '\u03B5';
- e2uHash['zeta']= '\u03B6';
- e2uHash['eta']= '\u03B7';
- e2uHash['theta']= '\u03B8';
- e2uHash['iota']= '\u03B9';
- e2uHash['kappa']= '\u03BA';
- e2uHash['lambda']= '\u03BB';
- e2uHash['mu']= '\u03BC';
- e2uHash['nu']= '\u03BD';
- e2uHash['xi']= '\u03BE';
- e2uHash['omicron']= '\u03BF';
- e2uHash['pi']= '\u03C0';
- e2uHash['rho']= '\u03C1';
- e2uHash['sigmaf']= '\u03C2';
- e2uHash['sigma']= '\u03C3';
- e2uHash['tau']= '\u03C4';
- e2uHash['upsilon']= '\u03C5';
- e2uHash['phi']= '\u03C6';
- e2uHash['chi']= '\u03C7';
- e2uHash['psi']= '\u03C8';
- e2uHash['omega']= '\u03C9';
- e2uHash['thetasym']= '\u03D1';
- e2uHash['upsih']= '\u03D2';
- e2uHash['piv']= '\u03D6';
- e2uHash['bull']= '\u2022';
- e2uHash['hellip']= '\u2026';
- e2uHash['prime']= '\u2032';
- e2uHash['Prime']= '\u2033';
- e2uHash['oline']= '\u203E';
- e2uHash['frasl']= '\u2044';
- e2uHash['weierp']= '\u2118';
- e2uHash['image']= '\u2111';
- e2uHash['real']= '\u211C';
- e2uHash['trade']= '\u2122';
- e2uHash['alefsym']= '\u2135';
- e2uHash['larr']= '\u2190';
- e2uHash['uarr']= '\u2191';
- e2uHash['rarr']= '\u2192';
- e2uHash['darr']= '\u2193';
- e2uHash['harr']= '\u2194';
- e2uHash['crarr']= '\u21B5';
- e2uHash['lArr']= '\u21D0';
- e2uHash['uArr']= '\u21D1';
- e2uHash['rArr']= '\u21D2';
- e2uHash['dArr']= '\u21D3';
- e2uHash['hArr']= '\u21D4';
- e2uHash['forall']= '\u2200';
- e2uHash['part']= '\u2202';
- e2uHash['exist']= '\u2203';
- e2uHash['empty']= '\u2205';
- e2uHash['nabla']= '\u2207';
- e2uHash['isin']= '\u2208';
- e2uHash['notin']= '\u2209';
- e2uHash['ni']= '\u220B';
- e2uHash['prod']= '\u220F';
- e2uHash['sum']= '\u2211';
- e2uHash['minus']= '\u2212';
- e2uHash['lowast']= '\u2217';
- e2uHash['radic']= '\u221A';
- e2uHash['prop']= '\u221D';
- e2uHash['infin']= '\u221E';
- e2uHash['ang']= '\u2220';
- e2uHash['and']= '\u2227';
- e2uHash['or']= '\u2228';
- e2uHash['cap']= '\u2229';
- e2uHash['cup']= '\u222A';
- e2uHash['int']= '\u222B';
- e2uHash['there4']= '\u2234';
- e2uHash['sim']= '\u223C';
- e2uHash['cong']= '\u2245';
- e2uHash['asymp']= '\u2248';
- e2uHash['ne']= '\u2260';
- e2uHash['equiv']= '\u2261';
- e2uHash['le']= '\u2264';
- e2uHash['ge']= '\u2265';
- e2uHash['sub']= '\u2282';
- e2uHash['sup']= '\u2283';
- e2uHash['nsub']= '\u2284';
- e2uHash['sube']= '\u2286';
- e2uHash['supe']= '\u2287';
- e2uHash['oplus']= '\u2295';
- e2uHash['otimes']= '\u2297';
- e2uHash['perp']= '\u22A5';
- e2uHash['sdot']= '\u22C5';
- e2uHash['lceil']= '\u2308';
- e2uHash['rceil']= '\u2309';
- e2uHash['lfloor']= '\u230A';
- e2uHash['rfloor']= '\u230B';
- e2uHash['lang']= '\u2329';
- e2uHash['rang']= '\u232A';
- e2uHash['loz']= '\u25CA';
- e2uHash['spades']= '\u2660';
- e2uHash['clubs']= '\u2663';
- e2uHash['hearts']= '\u2665';
- e2uHash['diams']= '\u2666';
-})();
-
-SimileAjax.HTML.deEntify = function(s) {
- var e2uHash = SimileAjax.HTML._e2uHash;
-
- var re = /&(\w+?);/;
- while (re.test(s)) {
- var m = s.match(re);
- s = s.replace(re, e2uHash[m[1]]);
- }
- return s;
-};
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/jquery-1.2.3.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/jquery-1.2.3.js
deleted file mode 100644
index e849d03..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/jquery-1.2.3.js
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * jQuery 1.2.3 - New Wave Javascript
- *
- * Copyright (c) 2008 John Resig (jquery.com)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * $Date: 2008-02-06 00:21:25 -0500 (Wed, 06 Feb 2008) $
- * $Rev: 4663 $
- */
-(function(){if(window.jQuery)var _jQuery=window.jQuery;var jQuery=window.jQuery=function(selector,context){return new jQuery.prototype.init(selector,context);};if(window.$)var _$=window.$;window.$=jQuery;var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/;var isSimple=/^.[^:#\[\.]*$/;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}else if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem)if(elem.id!=match[3])return jQuery().find(selector);else{this[0]=elem;this.length=1;return this;}else
-selector=[];}}else
-return new jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return new jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(selector.constructor==Array&&selector||(selector.jquery||selector.length&&selector!=window&&!selector.nodeType&&selector[0]!=undefined&&selector[0].nodeType)&&jQuery.makeArray(selector)||[selector]);},jquery:"1.2.3",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;this.each(function(i){if(this==elem)ret=i;});return ret;},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value==undefined)return this.length&&jQuery[type||"attr"](this[0],name)||undefined;else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else
-return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else
-selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return!selector?this:this.pushStack(jQuery.merge(this.get(),selector.constructor==String?jQuery(selector).get():selector.length!=undefined&&(!selector.nodeName||jQuery.nodeName(selector,"form"))?selector:[selector]));},is:function(selector){return selector?jQuery.multiFilter(selector,this).length>0:false;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one)return value;values.push(value);}}return values;}else
-return(this[0].value||"").replace(/\r/g,"");}return undefined;}return this.each(function(){if(this.nodeType!=1)return;if(value.constructor==Array&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=value.constructor==Array?value:[value];jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else
-this.value=value;});},html:function(value){return value==undefined?(this.length?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value==null){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data==undefined&&this.length)data=jQuery.data(this[0],key);return data==null&&parts[1]?this.data(parts[0]):data;}else
-return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script")){scripts=scripts.add(elem);}else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.prototype.init.prototype=jQuery.prototype;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else
-jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==1){target=this;i=0;}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){if(target===options[name])continue;if(deep&&options[name]&&typeof options[name]=="object"&&target[name]&&!options[name].nodeType)target[name]=jQuery.extend(target[name],options[name]);else if(options[name]!=undefined)target[name]=options[name];}return target;};var expando="jQuery"+(new Date()).getTime(),uuid=0,windowData={};var exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i;jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery;},isFunction:function(fn){return!!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/function/i.test(fn+"");},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body;},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)script.text=data;else
-script.appendChild(document.createTextNode(data));head.appendChild(script);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])jQuery.cache[id]={};if(data!=undefined)jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])break;if(!name)jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)elem.removeAttribute(expando);}delete jQuery.cache[id];}},each:function(object,callback,args){if(args){if(object.length==undefined){for(var name in object)if(callback.apply(object[name],args)===false)break;}else
-for(var i=0,length=object.length;i<length;i++)if(callback.apply(object[i],args)===false)break;}else{if(object.length==undefined){for(var name in object)if(callback.call(object[name],name,object[name])===false)break;}else
-for(var i=0,length=object.length,value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))value=value.call(elem,i);return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else
-jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret;function color(elem){if(!jQuery.browser.safari)return false;var ret=document.defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(elem.style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=elem.style.outline;elem.style.outline="0 solid black";elem.style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&elem.style&&elem.style[name])ret=elem.style[name];else if(document.defaultView&&document.defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var getComputedStyle=document.defaultView.getComputedStyle(elem,null);if(getComputedStyle&&!color(elem))ret=getComputedStyle.getPropertyValue(name);else{var swap=[],stack=[];for(var a=elem;a&&color(a);a=a.parentNode)stack.unshift(a);for(var i=0;i<stack.length;i++)if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}ret=name=="display"&&swap[stack.length-1]!=null?"none":(getComputedStyle&&getComputedStyle.getPropertyValue(name))||"";for(var i=0;i<swap.length;i++)if(swap[i]!=null)stack[i].style.display=swap[i];}if(name=="opacity"&&ret=="")ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var style=elem.style.left,runtimeStyle=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;elem.style.left=ret||0;ret=elem.style.pixelLeft+"px";elem.style.left=style;elem.runtimeStyle.left=runtimeStyle;}}return ret;},clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=='undefined')context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;jQuery.each(elems,function(i,elem){if(!elem)return;if(elem.constructor==Number)elem=elem.toString();if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else
-ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var fix=jQuery.isXMLDoc(elem)?{}:jQuery.props;if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(fix[name]){if(value!=undefined)elem[fix[name]]=value;return elem[fix[name]];}else if(jQuery.browser.msie&&name=="style")return jQuery.attr(elem.style,"cssText",value);else if(value==undefined&&jQuery.browser.msie&&jQuery.nodeName(elem,"form")&&(name=="action"||name=="method"))return elem.getAttributeNode(name).nodeValue;else if(elem.tagName){if(value!=undefined){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem.setAttribute(name,""+value);}if(jQuery.browser.msie&&/href|src/.test(name)&&!jQuery.isXMLDoc(elem))return elem.getAttribute(name,2);return elem.getAttribute(name);}else{if(name=="opacity"&&jQuery.browser.msie){if(value!=undefined){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseFloat(value).toString()=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100).toString():"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(value!=undefined)elem[name]=value;return elem[name];}},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(typeof array!="array")for(var i=0,length=array.length;i<length;i++)ret.push(array[i]);else
-ret=array.slice(0);return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)if(array[i]==elem)return i;return-1;},merge:function(first,second){if(jQuery.browser.msie){for(var i=0;second[i];i++)if(second[i].nodeType!=8)first.push(second[i]);}else
-for(var i=0;second[i];i++)first.push(second[i]);return first;},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}return ret;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++)if(!inv&&callback(elems[i],i)||inv&&!callback(elems[i],i))ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!==null&&value!=undefined){if(value.constructor!=Array)value=[value];ret=ret.concat(value);}}return ret;}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,innerHTML:"innerHTML",className:"className",value:"value",disabled:"disabled",checked:"checked",readonly:"readOnly",selected:"selected",maxlength:"maxLength",selectedIndex:"selectedIndex",defaultValue:"defaultValue",tagName:"tagName",nodeName:"nodeName"}});jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)jQuery(args[i])[original](this);});};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)this.parentNode.removeChild(this);}},empty:function(){jQuery(">*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return i<m[3]-0;},gt:function(a,i,m){return i>m[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[new RegExp("^(\[) *@?([\w-]+) *([!*$^~=]*) *('?\"?)(.*?)\4 *\]"),new RegExp("^(:)([\w-]+)\(\"?'?(.*?(\(.*?\))?[^(]*?)\"?'?\)"),new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false;var re=quickChild;var m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id])break;if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~")merge[id]=true;r.push(n);}if(m=="+")break;}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])oid=jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object")tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}if(m[1]==".")r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++)if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break;}r=tmp;}ret=r;}t=t.replace(re2,"");}}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}if(t)ret=[];if(ret&&context==ret[0])ret.shift();done=jQuery.merge(done,ret);return done;},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2]))z=jQuery.attr(a,m[2])||'';if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)if(n.nodeType==1)n.nodeIndex=c++;merge[id]=true;}var add=false;if(first==0){if(node.nodeIndex==last)add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[];var cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&(!elem||n!=elem))r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval!=undefined)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=function(){return fn.apply(this,arguments);};handler.data=data;handler.guid=fn.guid;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){var val;if(typeof jQuery=="undefined"||jQuery.event.triggered)return val;val=jQuery.event.handle.apply(arguments.callee.elem,arguments);return val;});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else
-for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data||[]);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event)data.unshift(this.fix({type:type,target:elem}));data[0].type=type;if(exclusive)data[0].exclusive=true;if(jQuery.isFunction(jQuery.data(elem,"handle")))val=jQuery.data(elem,"handle").apply(elem,data);if(!fn&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val;event=jQuery.event.fix(event||window.event||{});var parts=event.type.split(".");event.type=parts[0];var handlers=jQuery.data(this,"events")&&jQuery.data(this,"events")[event.type],args=Array.prototype.slice.call(arguments,1);args.unshift(event);for(var j in handlers){var handler=handlers[j];args[0].handler=handler;args[0].data=handler.data;if(!parts[1]&&!event.exclusive||handler.type==parts[1]){var ret=handler.apply(this,args);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}if(jQuery.browser.msie)event.target=event.preventDefault=event.stopPropagation=event.handler=event.data=null;return val;},fix:function(event){var originalEvent=event;event=jQuery.extend({},originalEvent);event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=originalEvent.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;arguments[0].type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;arguments[0].type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){return this.each(function(){jQuery.event.add(this,type,function(event){jQuery(this).unbind(event);return(fn||data).apply(this,arguments);},fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){if(this[0])return jQuery.event.trigger(type,data,this[0],false,fn);return undefined;},toggle:function(){var args=arguments;return this.click(function(event){this.lastToggle=0==this.lastToggle?1:0;event.preventDefault();return args[this.lastToggle].apply(this,arguments)||false;});},hover:function(fnOver,fnOut){return this.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else
-jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.apply(document);});jQuery.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<document.styleSheets.length;i++)if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(numStyles===undefined)numStyles=jQuery("style, link[rel=stylesheet]").length;if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return;}jQuery.ready();})();}jQuery.event.add(window,"load",jQuery.ready);}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,select,"+"submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=parent.parentNode;}catch(error){parent=elem;}return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});jQuery.fn.extend({load:function(url,params,callback){if(jQuery.isFunction(url))return this.bind("load",url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=(new Date).getTime();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){var jsonp,jsre=/=\?(&|$)/g,status,data;s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(s.type.toLowerCase()=="get"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&s.type.toLowerCase()=="get"){var ts=(new Date()).getTime();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&s.type.toLowerCase()=="get"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");if((!s.url.indexOf("http")||!s.url.indexOf("//"))&&s.dataType=="script"&&s.type.toLowerCase()=="get"){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xml=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();xml.open(s.type,s.url,s.async,s.username,s.password);try{if(s.data)xml.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xml.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xml.setRequestHeader("X-Requested-With","XMLHttpRequest");xml.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend)s.beforeSend(xml);if(s.global)jQuery.event.trigger("ajaxSend",[xml,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xml&&(xml.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xml)&&"error"||s.ifModified&&jQuery.httpNotModified(xml,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xml,s.dataType);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xml.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else
-jQuery.handleError(s,xml,status);complete();if(s.async)xml=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xml){xml.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xml.send(s.data);}catch(e){jQuery.handleError(s,xml,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xml,s]);}function complete(){if(s.complete)s.complete(xml,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xml,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xml;},handleError:function(s,xml,status,e){if(s.error)s.error(xml,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xml,s,e]);},active:0,httpSuccess:function(r){try{return!r.status&&location.protocol=="file:"||(r.status>=200&&r.status<300)||r.status==304||r.status==1223||jQuery.browser.safari&&r.status==undefined;}catch(e){}return false;},httpNotModified:function(xml,url){try{var xmlRes=xml.getResponseHeader("Last-Modified");return xml.status==304||xmlRes==jQuery.lastModified[url]||jQuery.browser.safari&&xml.status==undefined;}catch(e){}return false;},httpData:function(r,type){var ct=r.getResponseHeader("content-type");var xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0;var data=xml?r.responseXML:r.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else
-for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else
-s.push(encodeURIComponent(j)+"="+encodeURIComponent(a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle(fn,fn2):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall);var hidden=jQuery(this).is(":hidden"),self=this;for(var p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return jQuery.isFunction(opt.complete)&&opt.complete.apply(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else
-e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.apply(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(!elem)return undefined;type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",array?jQuery.makeArray(array):[]);return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].apply(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:{slow:600,fast:200}[opt.duration])||400;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.apply(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.apply(this.elem,[this.now,this]);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=(new Date()).getTime();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)if(!timers[i]())timers.splice(i--,1);if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height")this.elem.style[this.prop]="1px";jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=(new Date()).getTime();if(gotoEnd||t>this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done&&jQuery.isFunction(this.options.complete))this.options.complete.apply(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.fx.step={scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}};jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),fixed=jQuery.css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&jQuery.css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(jQuery.css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&jQuery.css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||jQuery.css(offsetChild,"position")=="absolute"))||(mozilla&&jQuery.css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l)||0;top+=parseInt(t)||0;}return results;};})();
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/json.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/json.js
deleted file mode 100644
index ef6dc30..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/json.js
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copied directly from http://www.json.org/json.js.
- */
-
-/*
- json.js
- 2006-04-28
-
- This file adds these methods to JavaScript:
-
- object.toJSONString()
-
- This method produces a JSON text from an object. The
- object must not contain any cyclical references.
-
- array.toJSONString()
-
- This method produces a JSON text from an array. The
- array must not contain any cyclical references.
-
- string.parseJSON()
-
- This method parses a JSON text to produce an object or
- array. It will return false if there is an error.
-*/
-
-SimileAjax.JSON = new Object();
-
-(function () {
- var m = {
- '\b': '\\b',
- '\t': '\\t',
- '\n': '\\n',
- '\f': '\\f',
- '\r': '\\r',
- '"' : '\\"',
- '\\': '\\\\'
- };
- var s = {
- array: function (x) {
- var a = ['['], b, f, i, l = x.length, v;
- for (i = 0; i < l; i += 1) {
- v = x[i];
- f = s[typeof v];
- if (f) {
- v = f(v);
- if (typeof v == 'string') {
- if (b) {
- a[a.length] = ',';
- }
- a[a.length] = v;
- b = true;
- }
- }
- }
- a[a.length] = ']';
- return a.join('');
- },
- 'boolean': function (x) {
- return String(x);
- },
- 'null': function (x) {
- return "null";
- },
- number: function (x) {
- return isFinite(x) ? String(x) : 'null';
- },
- object: function (x) {
- if (x) {
- if (x instanceof Array) {
- return s.array(x);
- }
- var a = ['{'], b, f, i, v;
- for (i in x) {
- v = x[i];
- f = s[typeof v];
- if (f) {
- v = f(v);
- if (typeof v == 'string') {
- if (b) {
- a[a.length] = ',';
- }
- a.push(s.string(i), ':', v);
- b = true;
- }
- }
- }
- a[a.length] = '}';
- return a.join('');
- }
- return 'null';
- },
- string: function (x) {
- if (/["\\\x00-\x1f]/.test(x)) {
- x = x.replace(/([\x00-\x1f\\"])/g, function(a, b) {
- var c = m[b];
- if (c) {
- return c;
- }
- c = b.charCodeAt();
- return '\\u00' +
- Math.floor(c / 16).toString(16) +
- (c % 16).toString(16);
- });
- }
- return '"' + x + '"';
- }
- };
-
- SimileAjax.JSON.toJSONString = function(o) {
- if (o instanceof Object) {
- return s.object(o);
- } else if (o instanceof Array) {
- return s.array(o);
- } else {
- return o.toString();
- }
- };
-
- SimileAjax.JSON.parseJSON = function () {
- try {
- return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(
- this.replace(/"(\\.|[^"\\])*"/g, ''))) &&
- eval('(' + this + ')');
- } catch (e) {
- return false;
- }
- };
-})();
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/platform.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/platform.js
deleted file mode 100644
index da3f7a3..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/platform.js
+++ /dev/null
@@ -1,106 +0,0 @@
-/*==================================================
- * Platform Utility Functions and Constants
- *==================================================
- */
-
-/* This must be called after our jQuery has been loaded
- but before control returns to user-code.
-*/
-SimileAjax.jQuery = jQuery.noConflict(true);
-if (typeof window["$"] == "undefined") {
- window.$ = SimileAjax.jQuery;
-}
-
-SimileAjax.Platform.os = {
- isMac: false,
- isWin: false,
- isWin32: false,
- isUnix: false
-};
-SimileAjax.Platform.browser = {
- isIE: false,
- isNetscape: false,
- isMozilla: false,
- isFirefox: false,
- isOpera: false,
- isSafari: false,
-
- majorVersion: 0,
- minorVersion: 0
-};
-
-(function() {
- var an = navigator.appName.toLowerCase();
- var ua = navigator.userAgent.toLowerCase();
-
- /*
- * Operating system
- */
- SimileAjax.Platform.os.isMac = (ua.indexOf('mac') != -1);
- SimileAjax.Platform.os.isWin = (ua.indexOf('win') != -1);
- SimileAjax.Platform.os.isWin32 = SimileAjax.Platform.isWin && (
- ua.indexOf('95') != -1 ||
- ua.indexOf('98') != -1 ||
- ua.indexOf('nt') != -1 ||
- ua.indexOf('win32') != -1 ||
- ua.indexOf('32bit') != -1
- );
- SimileAjax.Platform.os.isUnix = (ua.indexOf('x11') != -1);
-
- /*
- * Browser
- */
- SimileAjax.Platform.browser.isIE = (an.indexOf("microsoft") != -1);
- SimileAjax.Platform.browser.isNetscape = (an.indexOf("netscape") != -1);
- SimileAjax.Platform.browser.isMozilla = (ua.indexOf("mozilla") != -1);
- SimileAjax.Platform.browser.isFirefox = (ua.indexOf("firefox") != -1);
- SimileAjax.Platform.browser.isOpera = (an.indexOf("opera") != -1);
- SimileAjax.Platform.browser.isSafari = (an.indexOf("safari") != -1);
-
- var parseVersionString = function(s) {
- var a = s.split(".");
- SimileAjax.Platform.browser.majorVersion = parseInt(a[0]);
- SimileAjax.Platform.browser.minorVersion = parseInt(a[1]);
- };
- var indexOf = function(s, sub, start) {
- var i = s.indexOf(sub, start);
- return i >= 0 ? i : s.length;
- };
-
- if (SimileAjax.Platform.browser.isMozilla) {
- var offset = ua.indexOf("mozilla/");
- if (offset >= 0) {
- parseVersionString(ua.substring(offset + 8, indexOf(ua, " ", offset)));
- }
- }
- if (SimileAjax.Platform.browser.isIE) {
- var offset = ua.indexOf("msie ");
- if (offset >= 0) {
- parseVersionString(ua.substring(offset + 5, indexOf(ua, ";", offset)));
- }
- }
- if (SimileAjax.Platform.browser.isNetscape) {
- var offset = ua.indexOf("rv:");
- if (offset >= 0) {
- parseVersionString(ua.substring(offset + 3, indexOf(ua, ")", offset)));
- }
- }
- if (SimileAjax.Platform.browser.isFirefox) {
- var offset = ua.indexOf("firefox/");
- if (offset >= 0) {
- parseVersionString(ua.substring(offset + 8, indexOf(ua, " ", offset)));
- }
- }
-
- if (!("localeCompare" in String.prototype)) {
- String.prototype.localeCompare = function (s) {
- if (this < s) return -1;
- else if (this > s) return 1;
- else return 0;
- };
- }
-})();
-
-SimileAjax.Platform.getDefaultLocale = function() {
- return SimileAjax.Platform.clientLocale;
-};
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/signal.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/signal.js
deleted file mode 100644
index 7bfcf2a..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/signal.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/*==================================================
- * This file is used to detect that all outstanding
- * javascript files have been loaded. You can put
- * a function reference into SimileAjax_onLoad
- * to have it executed once all javascript files
- * have loaded.
- *==================================================
- */
-(function() {
- var substring = SimileAjax.urlPrefix + "scripts/signal.js";
- var heads = document.documentElement.getElementsByTagName("head");
- for (var h = 0; h < heads.length; h++) {
- var node = heads[h].firstChild;
- while (node != null) {
- if (node.nodeType == 1 && node.tagName.toLowerCase() == "script") {
- var url = node.src;
- var i = url.indexOf(substring);
- if (i >= 0) {
- heads[h].removeChild(node); // remove it so we won't hit it again
-
- var count = parseInt(url.substr(substring.length + 1));
- SimileAjax.loadingScriptsCount -= count;
-
- if (SimileAjax.loadingScriptsCount == 0) {
- var f = null;
- if (typeof SimileAjax_onLoad == "string") {
- f = eval(SimileAjax_onLoad);
- SimileAjax_onLoad = null;
- } else if (typeof SimileAjax_onLoad == "function") {
- f = SimileAjax_onLoad;
- SimileAjax_onLoad = null;
- }
-
- if (f != null) {
- f();
- }
- }
- return;
- }
- }
- node = node.nextSibling;
- }
- }
-})();
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/string.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/string.js
deleted file mode 100644
index 01466d8..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/string.js
+++ /dev/null
@@ -1,43 +0,0 @@
-/*==================================================
- * String Utility Functions and Constants
- *==================================================
- */
-
-String.prototype.trim = function() {
- return this.replace(/^\s+|\s+$/g, '');
-};
-
-String.prototype.startsWith = function(prefix) {
- return this.length >= prefix.length && this.substr(0, prefix.length) == prefix;
-};
-
-String.prototype.endsWith = function(suffix) {
- return this.length >= suffix.length && this.substr(this.length - suffix.length) == suffix;
-};
-
-String.substitute = function(s, objects) {
- var result = "";
- var start = 0;
- while (start < s.length - 1) {
- var percent = s.indexOf("%", start);
- if (percent < 0 || percent == s.length - 1) {
- break;
- } else if (percent > start && s.charAt(percent - 1) == "\\") {
- result += s.substring(start, percent - 1) + "%";
- start = percent + 1;
- } else {
- var n = parseInt(s.charAt(percent + 1));
- if (isNaN(n) || n >= objects.length) {
- result += s.substring(start, percent + 2);
- } else {
- result += s.substring(start, percent) + objects[n].toString();
- }
- start = percent + 2;
- }
- }
-
- if (start < s.length) {
- result += s.substring(start);
- }
- return result;
-};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/units.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/units.js
deleted file mode 100644
index 54f2a5b..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/units.js
+++ /dev/null
@@ -1,64 +0,0 @@
-/*==================================================
- * Default Unit
- *==================================================
- */
-
-SimileAjax.NativeDateUnit = new Object();
-
-SimileAjax.NativeDateUnit.makeDefaultValue = function() {
- return new Date();
-};
-
-SimileAjax.NativeDateUnit.cloneValue = function(v) {
- return new Date(v.getTime());
-};
-
-SimileAjax.NativeDateUnit.getParser = function(format) {
- if (typeof format == "string") {
- format = format.toLowerCase();
- }
- return (format == "iso8601" || format == "iso 8601") ?
- SimileAjax.DateTime.parseIso8601DateTime :
- SimileAjax.DateTime.parseGregorianDateTime;
-};
-
-SimileAjax.NativeDateUnit.parseFromObject = function(o) {
- return SimileAjax.DateTime.parseGregorianDateTime(o);
-};
-
-SimileAjax.NativeDateUnit.toNumber = function(v) {
- return v.getTime();
-};
-
-SimileAjax.NativeDateUnit.fromNumber = function(n) {
- return new Date(n);
-};
-
-SimileAjax.NativeDateUnit.compare = function(v1, v2) {
- var n1, n2;
- if (typeof v1 == "object") {
- n1 = v1.getTime();
- } else {
- n1 = Number(v1);
- }
- if (typeof v2 == "object") {
- n2 = v2.getTime();
- } else {
- n2 = Number(v2);
- }
-
- return n1 - n2;
-};
-
-SimileAjax.NativeDateUnit.earlier = function(v1, v2) {
- return SimileAjax.NativeDateUnit.compare(v1, v2) < 0 ? v1 : v2;
-};
-
-SimileAjax.NativeDateUnit.later = function(v1, v2) {
- return SimileAjax.NativeDateUnit.compare(v1, v2) > 0 ? v1 : v2;
-};
-
-SimileAjax.NativeDateUnit.change = function(v, n) {
- return new Date(v.getTime() + n);
-};
-
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/window-manager.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/window-manager.js
deleted file mode 100644
index 0da5970..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/window-manager.js
+++ /dev/null
@@ -1,414 +0,0 @@
-/**
- * @fileOverview UI layers and window-wide dragging
- * @name SimileAjax.WindowManager
- */
-
-/**
- * This is a singleton that keeps track of UI layers (modal and
- * modeless) and enables/disables UI elements based on which layers
- * they belong to. It also provides window-wide dragging
- * implementation.
- */
-SimileAjax.WindowManager = {
- _initialized: false,
- _listeners: [],
-
- _draggedElement: null,
- _draggedElementCallback: null,
- _dropTargetHighlightElement: null,
- _lastCoords: null,
- _ghostCoords: null,
- _draggingMode: "",
- _dragging: false,
-
- _layers: []
-};
-
-SimileAjax.WindowManager.initialize = function() {
- if (SimileAjax.WindowManager._initialized) {
- return;
- }
-
- SimileAjax.DOM.registerEvent(document.body, "mousedown", SimileAjax.WindowManager._onBodyMouseDown);
- SimileAjax.DOM.registerEvent(document.body, "mousemove", SimileAjax.WindowManager._onBodyMouseMove);
- SimileAjax.DOM.registerEvent(document.body, "mouseup", SimileAjax.WindowManager._onBodyMouseUp);
- SimileAjax.DOM.registerEvent(document, "keydown", SimileAjax.WindowManager._onBodyKeyDown);
- SimileAjax.DOM.registerEvent(document, "keyup", SimileAjax.WindowManager._onBodyKeyUp);
-
- SimileAjax.WindowManager._layers.push({index: 0});
-
- SimileAjax.WindowManager._historyListener = {
- onBeforeUndoSeveral: function() {},
- onAfterUndoSeveral: function() {},
- onBeforeUndo: function() {},
- onAfterUndo: function() {},
-
- onBeforeRedoSeveral: function() {},
- onAfterRedoSeveral: function() {},
- onBeforeRedo: function() {},
- onAfterRedo: function() {}
- };
- SimileAjax.History.addListener(SimileAjax.WindowManager._historyListener);
-
- SimileAjax.WindowManager._initialized = true;
-};
-
-SimileAjax.WindowManager.getBaseLayer = function() {
- SimileAjax.WindowManager.initialize();
- return SimileAjax.WindowManager._layers[0];
-};
-
-SimileAjax.WindowManager.getHighestLayer = function() {
- SimileAjax.WindowManager.initialize();
- return SimileAjax.WindowManager._layers[SimileAjax.WindowManager._layers.length - 1];
-};
-
-SimileAjax.WindowManager.registerEventWithObject = function(elmt, eventName, obj, handlerName, layer) {
- SimileAjax.WindowManager.registerEvent(
- elmt,
- eventName,
- function(elmt2, evt, target) {
- return obj[handlerName].call(obj, elmt2, evt, target);
- },
- layer
- );
-};
-
-SimileAjax.WindowManager.registerEvent = function(elmt, eventName, handler, layer) {
- if (layer == null) {
- layer = SimileAjax.WindowManager.getHighestLayer();
- }
-
- var handler2 = function(elmt, evt, target) {
- if (SimileAjax.WindowManager._canProcessEventAtLayer(layer)) {
- SimileAjax.WindowManager._popToLayer(layer.index);
- try {
- handler(elmt, evt, target);
- } catch (e) {
- SimileAjax.Debug.exception(e);
- }
- }
- SimileAjax.DOM.cancelEvent(evt);
- return false;
- }
-
- SimileAjax.DOM.registerEvent(elmt, eventName, handler2);
-};
-
-SimileAjax.WindowManager.pushLayer = function(f, ephemeral, elmt) {
- var layer = { onPop: f, index: SimileAjax.WindowManager._layers.length, ephemeral: (ephemeral), elmt: elmt };
- SimileAjax.WindowManager._layers.push(layer);
-
- return layer;
-};
-
-SimileAjax.WindowManager.popLayer = function(layer) {
- for (var i = 1; i < SimileAjax.WindowManager._layers.length; i++) {
- if (SimileAjax.WindowManager._layers[i] == layer) {
- SimileAjax.WindowManager._popToLayer(i - 1);
- break;
- }
- }
-};
-
-SimileAjax.WindowManager.popAllLayers = function() {
- SimileAjax.WindowManager._popToLayer(0);
-};
-
-SimileAjax.WindowManager.registerForDragging = function(elmt, callback, layer) {
- SimileAjax.WindowManager.registerEvent(
- elmt,
- "mousedown",
- function(elmt, evt, target) {
- SimileAjax.WindowManager._handleMouseDown(elmt, evt, callback);
- },
- layer
- );
-};
-
-SimileAjax.WindowManager._popToLayer = function(level) {
- while (level+1 < SimileAjax.WindowManager._layers.length) {
- try {
- var layer = SimileAjax.WindowManager._layers.pop();
- if (layer.onPop != null) {
- layer.onPop();
- }
- } catch (e) {
- }
- }
-};
-
-SimileAjax.WindowManager._canProcessEventAtLayer = function(layer) {
- if (layer.index == (SimileAjax.WindowManager._layers.length - 1)) {
- return true;
- }
- for (var i = layer.index + 1; i < SimileAjax.WindowManager._layers.length; i++) {
- if (!SimileAjax.WindowManager._layers[i].ephemeral) {
- return false;
- }
- }
- return true;
-};
-
-SimileAjax.WindowManager.cancelPopups = function(evt) {
- var evtCoords = (evt) ? SimileAjax.DOM.getEventPageCoordinates(evt) : { x: -1, y: -1 };
-
- var i = SimileAjax.WindowManager._layers.length - 1;
- while (i > 0 && SimileAjax.WindowManager._layers[i].ephemeral) {
- var layer = SimileAjax.WindowManager._layers[i];
- if (layer.elmt != null) { // if event falls within main element of layer then don't cancel
- var elmt = layer.elmt;
- var elmtCoords = SimileAjax.DOM.getPageCoordinates(elmt);
- if (evtCoords.x >= elmtCoords.left && evtCoords.x < (elmtCoords.left + elmt.offsetWidth) &&
- evtCoords.y >= elmtCoords.top && evtCoords.y < (elmtCoords.top + elmt.offsetHeight)) {
- break;
- }
- }
- i--;
- }
- SimileAjax.WindowManager._popToLayer(i);
-};
-
-SimileAjax.WindowManager._onBodyMouseDown = function(elmt, evt, target) {
- if (!("eventPhase" in evt) || evt.eventPhase == evt.BUBBLING_PHASE) {
- SimileAjax.WindowManager.cancelPopups(evt);
- }
-};
-
-SimileAjax.WindowManager._handleMouseDown = function(elmt, evt, callback) {
- SimileAjax.WindowManager._draggedElement = elmt;
- SimileAjax.WindowManager._draggedElementCallback = callback;
- SimileAjax.WindowManager._lastCoords = { x: evt.clientX, y: evt.clientY };
-
- SimileAjax.DOM.cancelEvent(evt);
- return false;
-};
-
-SimileAjax.WindowManager._onBodyKeyDown = function(elmt, evt, target) {
- if (SimileAjax.WindowManager._dragging) {
- if (evt.keyCode == 27) { // esc
- SimileAjax.WindowManager._cancelDragging();
- } else if ((evt.keyCode == 17 || evt.keyCode == 16) && SimileAjax.WindowManager._draggingMode != "copy") {
- SimileAjax.WindowManager._draggingMode = "copy";
-
- var img = SimileAjax.Graphics.createTranslucentImage(SimileAjax.urlPrefix + "images/copy.png");
- img.style.position = "absolute";
- img.style.left = (SimileAjax.WindowManager._ghostCoords.left - 16) + "px";
- img.style.top = (SimileAjax.WindowManager._ghostCoords.top) + "px";
- document.body.appendChild(img);
-
- SimileAjax.WindowManager._draggingModeIndicatorElmt = img;
- }
- }
-};
-
-SimileAjax.WindowManager._onBodyKeyUp = function(elmt, evt, target) {
- if (SimileAjax.WindowManager._dragging) {
- if (evt.keyCode == 17 || evt.keyCode == 16) {
- SimileAjax.WindowManager._draggingMode = "";
- if (SimileAjax.WindowManager._draggingModeIndicatorElmt != null) {
- document.body.removeChild(SimileAjax.WindowManager._draggingModeIndicatorElmt);
- SimileAjax.WindowManager._draggingModeIndicatorElmt = null;
- }
- }
- }
-};
-
-SimileAjax.WindowManager._onBodyMouseMove = function(elmt, evt, target) {
- if (SimileAjax.WindowManager._draggedElement != null) {
- var callback = SimileAjax.WindowManager._draggedElementCallback;
-
- var lastCoords = SimileAjax.WindowManager._lastCoords;
- var diffX = evt.clientX - lastCoords.x;
- var diffY = evt.clientY - lastCoords.y;
-
- if (!SimileAjax.WindowManager._dragging) {
- if (Math.abs(diffX) > 5 || Math.abs(diffY) > 5) {
- try {
- if ("onDragStart" in callback) {
- callback.onDragStart();
- }
-
- if ("ghost" in callback && callback.ghost) {
- var draggedElmt = SimileAjax.WindowManager._draggedElement;
-
- SimileAjax.WindowManager._ghostCoords = SimileAjax.DOM.getPageCoordinates(draggedElmt);
- SimileAjax.WindowManager._ghostCoords.left += diffX;
- SimileAjax.WindowManager._ghostCoords.top += diffY;
-
- var ghostElmt = draggedElmt.cloneNode(true);
- ghostElmt.style.position = "absolute";
- ghostElmt.style.left = SimileAjax.WindowManager._ghostCoords.left + "px";
- ghostElmt.style.top = SimileAjax.WindowManager._ghostCoords.top + "px";
- ghostElmt.style.zIndex = 1000;
- SimileAjax.Graphics.setOpacity(ghostElmt, 50);
-
- document.body.appendChild(ghostElmt);
- callback._ghostElmt = ghostElmt;
- }
-
- SimileAjax.WindowManager._dragging = true;
- SimileAjax.WindowManager._lastCoords = { x: evt.clientX, y: evt.clientY };
-
- document.body.focus();
- } catch (e) {
- SimileAjax.Debug.exception("WindowManager: Error handling mouse down", e);
- SimileAjax.WindowManager._cancelDragging();
- }
- }
- } else {
- try {
- SimileAjax.WindowManager._lastCoords = { x: evt.clientX, y: evt.clientY };
-
- if ("onDragBy" in callback) {
- callback.onDragBy(diffX, diffY);
- }
-
- if ("_ghostElmt" in callback) {
- var ghostElmt = callback._ghostElmt;
-
- SimileAjax.WindowManager._ghostCoords.left += diffX;
- SimileAjax.WindowManager._ghostCoords.top += diffY;
-
- ghostElmt.style.left = SimileAjax.WindowManager._ghostCoords.left + "px";
- ghostElmt.style.top = SimileAjax.WindowManager._ghostCoords.top + "px";
- if (SimileAjax.WindowManager._draggingModeIndicatorElmt != null) {
- var indicatorElmt = SimileAjax.WindowManager._draggingModeIndicatorElmt;
-
- indicatorElmt.style.left = (SimileAjax.WindowManager._ghostCoords.left - 16) + "px";
- indicatorElmt.style.top = SimileAjax.WindowManager._ghostCoords.top + "px";
- }
-
- if ("droppable" in callback && callback.droppable) {
- var coords = SimileAjax.DOM.getEventPageCoordinates(evt);
- var target = SimileAjax.DOM.hittest(
- coords.x, coords.y,
- [ SimileAjax.WindowManager._ghostElmt,
- SimileAjax.WindowManager._dropTargetHighlightElement
- ]
- );
- target = SimileAjax.WindowManager._findDropTarget(target);
-
- if (target != SimileAjax.WindowManager._potentialDropTarget) {
- if (SimileAjax.WindowManager._dropTargetHighlightElement != null) {
- document.body.removeChild(SimileAjax.WindowManager._dropTargetHighlightElement);
-
- SimileAjax.WindowManager._dropTargetHighlightElement = null;
- SimileAjax.WindowManager._potentialDropTarget = null;
- }
-
- var droppable = false;
- if (target != null) {
- if ((!("canDropOn" in callback) || callback.canDropOn(target)) &&
- (!("canDrop" in target) || target.canDrop(SimileAjax.WindowManager._draggedElement))) {
-
- droppable = true;
- }
- }
-
- if (droppable) {
- var border = 4;
- var targetCoords = SimileAjax.DOM.getPageCoordinates(target);
- var highlight = document.createElement("div");
- highlight.style.border = border + "px solid yellow";
- highlight.style.backgroundColor = "yellow";
- highlight.style.position = "absolute";
- highlight.style.left = targetCoords.left + "px";
- highlight.style.top = targetCoords.top + "px";
- highlight.style.width = (target.offsetWidth - border * 2) + "px";
- highlight.style.height = (target.offsetHeight - border * 2) + "px";
- SimileAjax.Graphics.setOpacity(highlight, 30);
- document.body.appendChild(highlight);
-
- SimileAjax.WindowManager._potentialDropTarget = target;
- SimileAjax.WindowManager._dropTargetHighlightElement = highlight;
- }
- }
- }
- }
- } catch (e) {
- SimileAjax.Debug.exception("WindowManager: Error handling mouse move", e);
- SimileAjax.WindowManager._cancelDragging();
- }
- }
-
- SimileAjax.DOM.cancelEvent(evt);
- return false;
- }
-};
-
-SimileAjax.WindowManager._onBodyMouseUp = function(elmt, evt, target) {
- if (SimileAjax.WindowManager._draggedElement != null) {
- try {
- if (SimileAjax.WindowManager._dragging) {
- var callback = SimileAjax.WindowManager._draggedElementCallback;
- if ("onDragEnd" in callback) {
- callback.onDragEnd();
- }
- if ("droppable" in callback && callback.droppable) {
- var dropped = false;
-
- var target = SimileAjax.WindowManager._potentialDropTarget;
- if (target != null) {
- if ((!("canDropOn" in callback) || callback.canDropOn(target)) &&
- (!("canDrop" in target) || target.canDrop(SimileAjax.WindowManager._draggedElement))) {
-
- if ("onDropOn" in callback) {
- callback.onDropOn(target);
- }
- target.ondrop(SimileAjax.WindowManager._draggedElement, SimileAjax.WindowManager._draggingMode);
-
- dropped = true;
- }
- }
-
- if (!dropped) {
- // TODO: do holywood explosion here
- }
- }
- }
- } finally {
- SimileAjax.WindowManager._cancelDragging();
- }
-
- SimileAjax.DOM.cancelEvent(evt);
- return false;
- }
-};
-
-SimileAjax.WindowManager._cancelDragging = function() {
- var callback = SimileAjax.WindowManager._draggedElementCallback;
- if ("_ghostElmt" in callback) {
- var ghostElmt = callback._ghostElmt;
- document.body.removeChild(ghostElmt);
-
- delete callback._ghostElmt;
- }
- if (SimileAjax.WindowManager._dropTargetHighlightElement != null) {
- document.body.removeChild(SimileAjax.WindowManager._dropTargetHighlightElement);
- SimileAjax.WindowManager._dropTargetHighlightElement = null;
- }
- if (SimileAjax.WindowManager._draggingModeIndicatorElmt != null) {
- document.body.removeChild(SimileAjax.WindowManager._draggingModeIndicatorElmt);
- SimileAjax.WindowManager._draggingModeIndicatorElmt = null;
- }
-
- SimileAjax.WindowManager._draggedElement = null;
- SimileAjax.WindowManager._draggedElementCallback = null;
- SimileAjax.WindowManager._potentialDropTarget = null;
- SimileAjax.WindowManager._dropTargetHighlightElement = null;
- SimileAjax.WindowManager._lastCoords = null;
- SimileAjax.WindowManager._ghostCoords = null;
- SimileAjax.WindowManager._draggingMode = "";
- SimileAjax.WindowManager._dragging = false;
-};
-
-SimileAjax.WindowManager._findDropTarget = function(elmt) {
- while (elmt != null) {
- if ("ondrop" in elmt && (typeof elmt.ondrop) == "function") {
- break;
- }
- elmt = elmt.parentNode;
- }
- return elmt;
-};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/xmlhttp.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/xmlhttp.js
deleted file mode 100644
index b6d2c0a..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/scripts/xmlhttp.js
+++ /dev/null
@@ -1,137 +0,0 @@
-/**
- * @fileOverview XmlHttp utility functions
- * @name SimileAjax.XmlHttp
- */
-
-SimileAjax.XmlHttp = new Object();
-
-/**
- * Callback for XMLHttp onRequestStateChange.
- */
-SimileAjax.XmlHttp._onReadyStateChange = function(xmlhttp, fError, fDone) {
- switch (xmlhttp.readyState) {
- // 1: Request not yet made
- // 2: Contact established with server but nothing downloaded yet
- // 3: Called multiple while downloading in progress
-
- // Download complete
- case 4:
- try {
- if (xmlhttp.status == 0 // file:// urls, works on Firefox
- || xmlhttp.status == 200 // http:// urls
- ) {
- if (fDone) {
- fDone(xmlhttp);
- }
- } else {
- if (fError) {
- fError(
- xmlhttp.statusText,
- xmlhttp.status,
- xmlhttp
- );
- }
- }
- } catch (e) {
- SimileAjax.Debug.exception("XmlHttp: Error handling onReadyStateChange", e);
- }
- break;
- }
-};
-
-/**
- * Creates an XMLHttpRequest object. On the first run, this
- * function creates a platform-specific function for
- * instantiating an XMLHttpRequest object and then replaces
- * itself with that function.
- */
-SimileAjax.XmlHttp._createRequest = function() {
- if (SimileAjax.Platform.browser.isIE) {
- var programIDs = [
- "Msxml2.XMLHTTP",
- "Microsoft.XMLHTTP",
- "Msxml2.XMLHTTP.4.0"
- ];
- for (var i = 0; i < programIDs.length; i++) {
- try {
- var programID = programIDs[i];
- var f = function() {
- return new ActiveXObject(programID);
- };
- var o = f();
-
- // We are replacing the SimileAjax._createXmlHttpRequest
- // function with this inner function as we've
- // found out that it works. This is so that we
- // don't have to do all the testing over again
- // on subsequent calls.
- SimileAjax.XmlHttp._createRequest = f;
-
- return o;
- } catch (e) {
- // silent
- }
- }
- // fall through to try new XMLHttpRequest();
- }
-
- try {
- var f = function() {
- return new XMLHttpRequest();
- };
- var o = f();
-
- // We are replacing the SimileAjax._createXmlHttpRequest
- // function with this inner function as we've
- // found out that it works. This is so that we
- // don't have to do all the testing over again
- // on subsequent calls.
- SimileAjax.XmlHttp._createRequest = f;
-
- return o;
- } catch (e) {
- throw new Error("Failed to create an XMLHttpRequest object");
- }
-};
-
-/**
- * Performs an asynchronous HTTP GET.
- *
- * @param {Function} fError a function of the form
- function(statusText, statusCode, xmlhttp)
- * @param {Function} fDone a function of the form function(xmlhttp)
- */
-SimileAjax.XmlHttp.get = function(url, fError, fDone) {
- var xmlhttp = SimileAjax.XmlHttp._createRequest();
-
- xmlhttp.open("GET", url, true);
- xmlhttp.onreadystatechange = function() {
- SimileAjax.XmlHttp._onReadyStateChange(xmlhttp, fError, fDone);
- };
- xmlhttp.send(null);
-};
-
-/**
- * Performs an asynchronous HTTP POST.
- *
- * @param {Function} fError a function of the form
- function(statusText, statusCode, xmlhttp)
- * @param {Function} fDone a function of the form function(xmlhttp)
- */
-SimileAjax.XmlHttp.post = function(url, body, fError, fDone) {
- var xmlhttp = SimileAjax.XmlHttp._createRequest();
-
- xmlhttp.open("POST", url, true);
- xmlhttp.onreadystatechange = function() {
- SimileAjax.XmlHttp._onReadyStateChange(xmlhttp, fError, fDone);
- };
- xmlhttp.send(body);
-};
-
-SimileAjax.XmlHttp._forceXML = function(xmlhttp) {
- try {
- xmlhttp.overrideMimeType("text/xml");
- } catch (e) {
- xmlhttp.setrequestheader("Content-Type", "text/xml");
- }
-};
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/simile-ajax-api.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/simile-ajax-api.js
deleted file mode 100644
index 4531116..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/simile-ajax-api.js
+++ /dev/null
@@ -1,211 +0,0 @@
-/*==================================================
- * Simile Ajax API
- *
- * Include this file in your HTML file as follows:
- *
- * <script src="http://simile.mit.edu/ajax/api/simile-ajax-api.js" type="text/javascript"></script>
- *
- *==================================================
- */
-
-if (typeof SimileAjax == "undefined") {
- var SimileAjax = {
- loaded: false,
- loadingScriptsCount: 0,
- error: null,
- params: { bundle:"true" }
- };
-
- SimileAjax.Platform = new Object();
- /*
- HACK: We need these 2 things here because we cannot simply append
- a <script> element containing code that accesses SimileAjax.Platform
- to initialize it because IE executes that <script> code first
- before it loads ajax.js and platform.js.
- */
-
- var getHead = function(doc) {
- return doc.getElementsByTagName("head")[0];
- };
-
- SimileAjax.findScript = function(doc, substring) {
- var heads = doc.documentElement.getElementsByTagName("head");
- for (var h = 0; h < heads.length; h++) {
- var node = heads[h].firstChild;
- while (node != null) {
- if (node.nodeType == 1 && node.tagName.toLowerCase() == "script") {
- var url = node.src;
- var i = url.indexOf(substring);
- if (i >= 0) {
- return url;
- }
- }
- node = node.nextSibling;
- }
- }
- return null;
- };
- SimileAjax.includeJavascriptFile = function(doc, url, onerror, charset) {
- onerror = onerror || "";
- if (doc.body == null) {
- try {
- var q = "'" + onerror.replace( /'/g, '&apos' ) + "'"; // "
- doc.write("<script src='" + url + "' onerror="+ q +
- (charset ? " charset='"+ charset +"'" : "") +
- " type='text/javascript'>"+ onerror + "</script>");
- return;
- } catch (e) {
- // fall through
- }
- }
-
- var script = doc.createElement("script");
- if (onerror) {
- try { script.innerHTML = onerror; } catch(e) {}
- script.setAttribute("onerror", onerror);
- }
- if (charset) {
- script.setAttribute("charset", charset);
- }
- script.type = "text/javascript";
- script.language = "JavaScript";
- script.src = url;
- return getHead(doc).appendChild(script);
- };
- SimileAjax.includeJavascriptFiles = function(doc, urlPrefix, filenames) {
- for (var i = 0; i < filenames.length; i++) {
- SimileAjax.includeJavascriptFile(doc, urlPrefix + filenames[i]);
- }
- SimileAjax.loadingScriptsCount += filenames.length;
- SimileAjax.includeJavascriptFile(doc, SimileAjax.urlPrefix + "scripts/signal.js?" + filenames.length);
- };
- SimileAjax.includeCssFile = function(doc, url) {
- if (doc.body == null) {
- try {
- doc.write("<link rel='stylesheet' href='" + url + "' type='text/css'/>");
- return;
- } catch (e) {
- // fall through
- }
- }
-
- var link = doc.createElement("link");
- link.setAttribute("rel", "stylesheet");
- link.setAttribute("type", "text/css");
- link.setAttribute("href", url);
- getHead(doc).appendChild(link);
- };
- SimileAjax.includeCssFiles = function(doc, urlPrefix, filenames) {
- for (var i = 0; i < filenames.length; i++) {
- SimileAjax.includeCssFile(doc, urlPrefix + filenames[i]);
- }
- };
-
- /**
- * Append into urls each string in suffixes after prefixing it with urlPrefix.
- * @param {Array} urls
- * @param {String} urlPrefix
- * @param {Array} suffixes
- */
- SimileAjax.prefixURLs = function(urls, urlPrefix, suffixes) {
- for (var i = 0; i < suffixes.length; i++) {
- urls.push(urlPrefix + suffixes[i]);
- }
- };
-
- /**
- * Parse out the query parameters from a URL
- * @param {String} url the url to parse, or location.href if undefined
- * @param {Object} to optional object to extend with the parameters
- * @param {Object} types optional object mapping keys to value types
- * (String, Number, Boolean or Array, String by default)
- * @return a key/value Object whose keys are the query parameter names
- * @type Object
- */
- SimileAjax.parseURLParameters = function(url, to, types) {
- to = to || {};
- types = types || {};
-
- if (typeof url == "undefined") {
- url = location.href;
- }
- var q = url.indexOf("?");
- if (q < 0) {
- return to;
- }
- url = (url+"#").slice(q+1, url.indexOf("#")); // toss the URL fragment
-
- var params = url.split("&"), param, parsed = {};
- var decode = window.decodeURIComponent || unescape;
- for (var i = 0; param = params[i]; i++) {
- var eq = param.indexOf("=");
- var name = decode(param.slice(0,eq));
- var old = parsed[name];
- if (typeof old == "undefined") {
- old = [];
- } else if (!(old instanceof Array)) {
- old = [old];
- }
- parsed[name] = old.concat(decode(param.slice(eq+1)));
- }
- for (var i in parsed) {
- if (!parsed.hasOwnProperty(i)) continue;
- var type = types[i] || String;
- var data = parsed[i];
- if (!(data instanceof Array)) {
- data = [data];
- }
- if (type === Boolean && data[0] == "false") {
- to[i] = false; // because Boolean("false") === true
- } else {
- to[i] = type.apply(this, data);
- }
- }
- return to;
- };
-
- (function() {
- var javascriptFiles = [
- "jquery-1.2.3.js",
- "platform.js",
- "debug.js",
- "xmlhttp.js",
- "json.js",
- "dom.js",
- "graphics.js",
- "date-time.js",
- "string.js",
- "html.js",
- "data-structure.js",
- "units.js",
-
- "ajax.js",
- "history.js",
- "window-manager.js"
- ];
- var cssFiles = [
- ];
-
- if (typeof SimileAjax_urlPrefix == "string") {
- SimileAjax.urlPrefix = SimileAjax_urlPrefix;
- } else {
- var url = SimileAjax.findScript(document, "simile-ajax-api.js");
- if (url == null) {
- SimileAjax.error = new Error("Failed to derive URL prefix for Simile Ajax API code files");
- return;
- }
-
- SimileAjax.urlPrefix = url.substr(0, url.indexOf("simile-ajax-api.js"));
- }
-
- SimileAjax.parseURLParameters(url, SimileAjax.params, {bundle:Boolean});
- if (false) { //SimileAjax.params.bundle) {
- SimileAjax.includeJavascriptFiles(document, SimileAjax.urlPrefix, [ "simile-ajax-bundle.js" ]);
- } else {
- SimileAjax.includeJavascriptFiles(document, SimileAjax.urlPrefix + "scripts/", javascriptFiles);
- }
- SimileAjax.includeCssFiles(document, SimileAjax.urlPrefix + "styles/", cssFiles);
-
- SimileAjax.loaded = true;
- })();
-}
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/simile-ajax-bundle.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/simile-ajax-bundle.js
deleted file mode 100644
index 0250784..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/ajax/api/simile-ajax-bundle.js
+++ /dev/null
@@ -1,3095 +0,0 @@
-
-
-/* jquery-1.2.3.js */
-
-
-(function(){if(window.jQuery)var _jQuery=window.jQuery;var jQuery=window.jQuery=function(selector,context){return new jQuery.prototype.init(selector,context);};if(window.$)var _$=window.$;window.$=jQuery;var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/;var isSimple=/^.[^:#\[\.]*$/;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}else if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem)if(elem.id!=match[3])return jQuery().find(selector);else{this[0]=elem;this.length=1;return this;}else
-selector=[];}}else
-return new jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return new jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(selector.constructor==Array&&selector||(selector.jquery||selector.length&&selector!=window&&!selector.nodeType&&selector[0]!=undefined&&selector[0].nodeType)&&jQuery.makeArray(selector)||[selector]);},jquery:"1.2.3",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;this.each(function(i){if(this==elem)ret=i;});return ret;},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value==undefined)return this.length&&jQuery[type||"attr"](this[0],name)||undefined;else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else
-return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else
-selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return!selector?this:this.pushStack(jQuery.merge(this.get(),selector.constructor==String?jQuery(selector).get():selector.length!=undefined&&(!selector.nodeName||jQuery.nodeName(selector,"form"))?selector:[selector]));},is:function(selector){return selector?jQuery.multiFilter(selector,this).length>0:false;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one)return value;values.push(value);}}return values;}else
-return(this[0].value||"").replace(/\r/g,"");}return undefined;}return this.each(function(){if(this.nodeType!=1)return;if(value.constructor==Array&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=value.constructor==Array?value:[value];jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else
-this.value=value;});},html:function(value){return value==undefined?(this.length?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value==null){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data==undefined&&this.length)data=jQuery.data(this[0],key);return data==null&&parts[1]?this.data(parts[0]):data;}else
-return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script")){scripts=scripts.add(elem);}else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.prototype.init.prototype=jQuery.prototype;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else
-jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==1){target=this;i=0;}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){if(target===options[name])continue;if(deep&&options[name]&&typeof options[name]=="object"&&target[name]&&!options[name].nodeType)target[name]=jQuery.extend(target[name],options[name]);else if(options[name]!=undefined)target[name]=options[name];}return target;};var expando="jQuery"+(new Date()).getTime(),uuid=0,windowData={};var exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i;jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery;},isFunction:function(fn){return!!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/function/i.test(fn+"");},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body;},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)script.text=data;else
-script.appendChild(document.createTextNode(data));head.appendChild(script);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])jQuery.cache[id]={};if(data!=undefined)jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])break;if(!name)jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)elem.removeAttribute(expando);}delete jQuery.cache[id];}},each:function(object,callback,args){if(args){if(object.length==undefined){for(var name in object)if(callback.apply(object[name],args)===false)break;}else
-for(var i=0,length=object.length;i<length;i++)if(callback.apply(object[i],args)===false)break;}else{if(object.length==undefined){for(var name in object)if(callback.call(object[name],name,object[name])===false)break;}else
-for(var i=0,length=object.length,value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))value=value.call(elem,i);return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else
-jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret;function color(elem){if(!jQuery.browser.safari)return false;var ret=document.defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(elem.style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=elem.style.outline;elem.style.outline="0 solid black";elem.style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&elem.style&&elem.style[name])ret=elem.style[name];else if(document.defaultView&&document.defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var getComputedStyle=document.defaultView.getComputedStyle(elem,null);if(getComputedStyle&&!color(elem))ret=getComputedStyle.getPropertyValue(name);else{var swap=[],stack=[];for(var a=elem;a&&color(a);a=a.parentNode)stack.unshift(a);for(var i=0;i<stack.length;i++)if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}ret=name=="display"&&swap[stack.length-1]!=null?"none":(getComputedStyle&&getComputedStyle.getPropertyValue(name))||"";for(var i=0;i<swap.length;i++)if(swap[i]!=null)stack[i].style.display=swap[i];}if(name=="opacity"&&ret=="")ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var style=elem.style.left,runtimeStyle=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;elem.style.left=ret||0;ret=elem.style.pixelLeft+"px";elem.style.left=style;elem.runtimeStyle.left=runtimeStyle;}}return ret;},clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=='undefined')context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;jQuery.each(elems,function(i,elem){if(!elem)return;if(elem.constructor==Number)elem=elem.toString();if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else
-ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var fix=jQuery.isXMLDoc(elem)?{}:jQuery.props;if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(fix[name]){if(value!=undefined)elem[fix[name]]=value;return elem[fix[name]];}else if(jQuery.browser.msie&&name=="style")return jQuery.attr(elem.style,"cssText",value);else if(value==undefined&&jQuery.browser.msie&&jQuery.nodeName(elem,"form")&&(name=="action"||name=="method"))return elem.getAttributeNode(name).nodeValue;else if(elem.tagName){if(value!=undefined){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem.setAttribute(name,""+value);}if(jQuery.browser.msie&&/href|src/.test(name)&&!jQuery.isXMLDoc(elem))return elem.getAttribute(name,2);return elem.getAttribute(name);}else{if(name=="opacity"&&jQuery.browser.msie){if(value!=undefined){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseFloat(value).toString()=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100).toString():"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(value!=undefined)elem[name]=value;return elem[name];}},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(typeof array!="array")for(var i=0,length=array.length;i<length;i++)ret.push(array[i]);else
-ret=array.slice(0);return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)if(array[i]==elem)return i;return-1;},merge:function(first,second){if(jQuery.browser.msie){for(var i=0;second[i];i++)if(second[i].nodeType!=8)first.push(second[i]);}else
-for(var i=0;second[i];i++)first.push(second[i]);return first;},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}return ret;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++)if(!inv&&callback(elems[i],i)||inv&&!callback(elems[i],i))ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!==null&&value!=undefined){if(value.constructor!=Array)value=[value];ret=ret.concat(value);}}return ret;}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,innerHTML:"innerHTML",className:"className",value:"value",disabled:"disabled",checked:"checked",readonly:"readOnly",selected:"selected",maxlength:"maxLength",selectedIndex:"selectedIndex",defaultValue:"defaultValue",tagName:"tagName",nodeName:"nodeName"}});jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)jQuery(args[i])[original](this);});};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)this.parentNode.removeChild(this);}},empty:function(){jQuery(">*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return i<m[3]-0;},gt:function(a,i,m){return i>m[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[new RegExp("^(\[) *@?([\w-]+) *([!*$^~=]*) *('?\"?)(.*?)\4 *\]"),new RegExp("^(:)([\w-]+)\(\"?'?(.*?(\(.*?\))?[^(]*?)\"?'?\)"),new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false;var re=quickChild;var m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id])break;if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~")merge[id]=true;r.push(n);}if(m=="+")break;}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])oid=jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object")tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}if(m[1]==".")r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++)if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break;}r=tmp;}ret=r;}t=t.replace(re2,"");}}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}if(t)ret=[];if(ret&&context==ret[0])ret.shift();done=jQuery.merge(done,ret);return done;},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2]))z=jQuery.attr(a,m[2])||'';if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)if(n.nodeType==1)n.nodeIndex=c++;merge[id]=true;}var add=false;if(first==0){if(node.nodeIndex==last)add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[];var cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&(!elem||n!=elem))r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval!=undefined)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=function(){return fn.apply(this,arguments);};handler.data=data;handler.guid=fn.guid;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){var val;if(typeof jQuery=="undefined"||jQuery.event.triggered)return val;val=jQuery.event.handle.apply(arguments.callee.elem,arguments);return val;});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else
-for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data||[]);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event)data.unshift(this.fix({type:type,target:elem}));data[0].type=type;if(exclusive)data[0].exclusive=true;if(jQuery.isFunction(jQuery.data(elem,"handle")))val=jQuery.data(elem,"handle").apply(elem,data);if(!fn&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val;event=jQuery.event.fix(event||window.event||{});var parts=event.type.split(".");event.type=parts[0];var handlers=jQuery.data(this,"events")&&jQuery.data(this,"events")[event.type],args=Array.prototype.slice.call(arguments,1);args.unshift(event);for(var j in handlers){var handler=handlers[j];args[0].handler=handler;args[0].data=handler.data;if(!parts[1]&&!event.exclusive||handler.type==parts[1]){var ret=handler.apply(this,args);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}if(jQuery.browser.msie)event.target=event.preventDefault=event.stopPropagation=event.handler=event.data=null;return val;},fix:function(event){var originalEvent=event;event=jQuery.extend({},originalEvent);event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=originalEvent.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;arguments[0].type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;arguments[0].type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){return this.each(function(){jQuery.event.add(this,type,function(event){jQuery(this).unbind(event);return(fn||data).apply(this,arguments);},fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){if(this[0])return jQuery.event.trigger(type,data,this[0],false,fn);return undefined;},toggle:function(){var args=arguments;return this.click(function(event){this.lastToggle=0==this.lastToggle?1:0;event.preventDefault();return args[this.lastToggle].apply(this,arguments)||false;});},hover:function(fnOver,fnOut){return this.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else
-jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.apply(document);});jQuery.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<document.styleSheets.length;i++)if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(numStyles===undefined)numStyles=jQuery("style, link[rel=stylesheet]").length;if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return;}jQuery.ready();})();}jQuery.event.add(window,"load",jQuery.ready);}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,select,"+"submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=parent.parentNode;}catch(error){parent=elem;}return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});jQuery.fn.extend({load:function(url,params,callback){if(jQuery.isFunction(url))return this.bind("load",url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=(new Date).getTime();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){var jsonp,jsre=/=\?(&|$)/g,status,data;s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(s.type.toLowerCase()=="get"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&s.type.toLowerCase()=="get"){var ts=(new Date()).getTime();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&s.type.toLowerCase()=="get"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");if((!s.url.indexOf("http")||!s.url.indexOf("//"))&&s.dataType=="script"&&s.type.toLowerCase()=="get"){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xml=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();xml.open(s.type,s.url,s.async,s.username,s.password);try{if(s.data)xml.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xml.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xml.setRequestHeader("X-Requested-With","XMLHttpRequest");xml.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend)s.beforeSend(xml);if(s.global)jQuery.event.trigger("ajaxSend",[xml,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xml&&(xml.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xml)&&"error"||s.ifModified&&jQuery.httpNotModified(xml,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xml,s.dataType);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xml.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else
-jQuery.handleError(s,xml,status);complete();if(s.async)xml=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xml){xml.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xml.send(s.data);}catch(e){jQuery.handleError(s,xml,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xml,s]);}function complete(){if(s.complete)s.complete(xml,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xml,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xml;},handleError:function(s,xml,status,e){if(s.error)s.error(xml,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xml,s,e]);},active:0,httpSuccess:function(r){try{return!r.status&&location.protocol=="file:"||(r.status>=200&&r.status<300)||r.status==304||r.status==1223||jQuery.browser.safari&&r.status==undefined;}catch(e){}return false;},httpNotModified:function(xml,url){try{var xmlRes=xml.getResponseHeader("Last-Modified");return xml.status==304||xmlRes==jQuery.lastModified[url]||jQuery.browser.safari&&xml.status==undefined;}catch(e){}return false;},httpData:function(r,type){var ct=r.getResponseHeader("content-type");var xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0;var data=xml?r.responseXML:r.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else
-for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else
-s.push(encodeURIComponent(j)+"="+encodeURIComponent(a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle(fn,fn2):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall);var hidden=jQuery(this).is(":hidden"),self=this;for(var p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return jQuery.isFunction(opt.complete)&&opt.complete.apply(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else
-e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.apply(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(!elem)return undefined;type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",array?jQuery.makeArray(array):[]);return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].apply(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:{slow:600,fast:200}[opt.duration])||400;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.apply(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.apply(this.elem,[this.now,this]);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=(new Date()).getTime();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)if(!timers[i]())timers.splice(i--,1);if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height")this.elem.style[this.prop]="1px";jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=(new Date()).getTime();if(gotoEnd||t>this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done&&jQuery.isFunction(this.options.complete))this.options.complete.apply(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.fx.step={scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}};jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),fixed=jQuery.css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&jQuery.css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(jQuery.css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&jQuery.css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||jQuery.css(offsetChild,"position")=="absolute"))||(mozilla&&jQuery.css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l)||0;top+=parseInt(t)||0;}return results;};})();
-
-/* platform.js */
-
-
-
-
-SimileAjax.jQuery=jQuery.noConflict(true);
-if(typeof window["$"]=="undefined"){
-window.$=SimileAjax.jQuery;
-}
-
-SimileAjax.Platform.os={
-isMac:false,
-isWin:false,
-isWin32:false,
-isUnix:false
-};
-SimileAjax.Platform.browser={
-isIE:false,
-isNetscape:false,
-isMozilla:false,
-isFirefox:false,
-isOpera:false,
-isSafari:false,
-
-majorVersion:0,
-minorVersion:0
-};
-
-(function(){
-var an=navigator.appName.toLowerCase();
-var ua=navigator.userAgent.toLowerCase();
-
-
-SimileAjax.Platform.os.isMac=(ua.indexOf('mac')!=-1);
-SimileAjax.Platform.os.isWin=(ua.indexOf('win')!=-1);
-SimileAjax.Platform.os.isWin32=SimileAjax.Platform.isWin&&(
-ua.indexOf('95')!=-1||
-ua.indexOf('98')!=-1||
-ua.indexOf('nt')!=-1||
-ua.indexOf('win32')!=-1||
-ua.indexOf('32bit')!=-1
-);
-SimileAjax.Platform.os.isUnix=(ua.indexOf('x11')!=-1);
-
-
-SimileAjax.Platform.browser.isIE=(an.indexOf("microsoft")!=-1);
-SimileAjax.Platform.browser.isNetscape=(an.indexOf("netscape")!=-1);
-SimileAjax.Platform.browser.isMozilla=(ua.indexOf("mozilla")!=-1);
-SimileAjax.Platform.browser.isFirefox=(ua.indexOf("firefox")!=-1);
-SimileAjax.Platform.browser.isOpera=(an.indexOf("opera")!=-1);
-SimileAjax.Platform.browser.isSafari=(an.indexOf("safari")!=-1);
-
-var parseVersionString=function(s){
-var a=s.split(".");
-SimileAjax.Platform.browser.majorVersion=parseInt(a[0]);
-SimileAjax.Platform.browser.minorVersion=parseInt(a[1]);
-};
-var indexOf=function(s,sub,start){
-var i=s.indexOf(sub,start);
-return i>=0?i:s.length;
-};
-
-if(SimileAjax.Platform.browser.isMozilla){
-var offset=ua.indexOf("mozilla/");
-if(offset>=0){
-parseVersionString(ua.substring(offset+8,indexOf(ua," ",offset)));
-}
-}
-if(SimileAjax.Platform.browser.isIE){
-var offset=ua.indexOf("msie ");
-if(offset>=0){
-parseVersionString(ua.substring(offset+5,indexOf(ua,";",offset)));
-}
-}
-if(SimileAjax.Platform.browser.isNetscape){
-var offset=ua.indexOf("rv:");
-if(offset>=0){
-parseVersionString(ua.substring(offset+3,indexOf(ua,")",offset)));
-}
-}
-if(SimileAjax.Platform.browser.isFirefox){
-var offset=ua.indexOf("firefox/");
-if(offset>=0){
-parseVersionString(ua.substring(offset+8,indexOf(ua," ",offset)));
-}
-}
-
-if(!("localeCompare"in String.prototype)){
-String.prototype.localeCompare=function(s){
-if(this<s)return-1;
-else if(this>s)return 1;
-else return 0;
-};
-}
-})();
-
-SimileAjax.Platform.getDefaultLocale=function(){
-return SimileAjax.Platform.clientLocale;
-};
-
-/* ajax.js */
-
-
-
-SimileAjax.ListenerQueue=function(wildcardHandlerName){
-this._listeners=[];
-this._wildcardHandlerName=wildcardHandlerName;
-};
-
-SimileAjax.ListenerQueue.prototype.add=function(listener){
-this._listeners.push(listener);
-};
-
-SimileAjax.ListenerQueue.prototype.remove=function(listener){
-var listeners=this._listeners;
-for(var i=0;i<listeners.length;i++){
-if(listeners[i]==listener){
-listeners.splice(i,1);
-break;
-}
-}
-};
-
-SimileAjax.ListenerQueue.prototype.fire=function(handlerName,args){
-var listeners=[].concat(this._listeners);
-for(var i=0;i<listeners.length;i++){
-var listener=listeners[i];
-if(handlerName in listener){
-try{
-listener[handlerName].apply(listener,args);
-}catch(e){
-SimileAjax.Debug.exception("Error firing event of name "+handlerName,e);
-}
-}else if(this._wildcardHandlerName!=null&&
-this._wildcardHandlerName in listener){
-try{
-listener[this._wildcardHandlerName].apply(listener,[handlerName]);
-}catch(e){
-SimileAjax.Debug.exception("Error firing event of name "+handlerName+" to wildcard handler",e);
-}
-}
-}
-};
-
-
-
-/* data-structure.js */
-
-
-SimileAjax.Set=function(a){
-this._hash={};
-this._count=0;
-
-if(a instanceof Array){
-for(var i=0;i<a.length;i++){
-this.add(a[i]);
-}
-}else if(a instanceof SimileAjax.Set){
-this.addSet(a);
-}
-}
-
-
-SimileAjax.Set.prototype.add=function(o){
-if(!(o in this._hash)){
-this._hash[o]=true;
-this._count++;
-return true;
-}
-return false;
-}
-
-
-SimileAjax.Set.prototype.addSet=function(set){
-for(var o in set._hash){
-this.add(o);
-}
-}
-
-
-SimileAjax.Set.prototype.remove=function(o){
-if(o in this._hash){
-delete this._hash[o];
-this._count--;
-return true;
-}
-return false;
-}
-
-
-SimileAjax.Set.prototype.removeSet=function(set){
-for(var o in set._hash){
-this.remove(o);
-}
-}
-
-
-SimileAjax.Set.prototype.retainSet=function(set){
-for(var o in this._hash){
-if(!set.contains(o)){
-delete this._hash[o];
-this._count--;
-}
-}
-}
-
-
-SimileAjax.Set.prototype.contains=function(o){
-return(o in this._hash);
-}
-
-
-SimileAjax.Set.prototype.size=function(){
-return this._count;
-}
-
-
-SimileAjax.Set.prototype.toArray=function(){
-var a=[];
-for(var o in this._hash){
-a.push(o);
-}
-return a;
-}
-
-
-SimileAjax.Set.prototype.visit=function(f){
-for(var o in this._hash){
-if(f(o)==true){
-break;
-}
-}
-}
-
-
-SimileAjax.SortedArray=function(compare,initialArray){
-this._a=(initialArray instanceof Array)?initialArray:[];
-this._compare=compare;
-};
-
-SimileAjax.SortedArray.prototype.add=function(elmt){
-var sa=this;
-var index=this.find(function(elmt2){
-return sa._compare(elmt2,elmt);
-});
-
-if(index<this._a.length){
-this._a.splice(index,0,elmt);
-}else{
-this._a.push(elmt);
-}
-};
-
-SimileAjax.SortedArray.prototype.remove=function(elmt){
-var sa=this;
-var index=this.find(function(elmt2){
-return sa._compare(elmt2,elmt);
-});
-
-while(index<this._a.length&&this._compare(this._a[index],elmt)==0){
-if(this._a[index]==elmt){
-this._a.splice(index,1);
-return true;
-}else{
-index++;
-}
-}
-return false;
-};
-
-SimileAjax.SortedArray.prototype.removeAll=function(){
-this._a=[];
-};
-
-SimileAjax.SortedArray.prototype.elementAt=function(index){
-return this._a[index];
-};
-
-SimileAjax.SortedArray.prototype.length=function(){
-return this._a.length;
-};
-
-SimileAjax.SortedArray.prototype.find=function(compare){
-var a=0;
-var b=this._a.length;
-
-while(a<b){
-var mid=Math.floor((a+b)/2);
-var c=compare(this._a[mid]);
-if(mid==a){
-return c<0?a+1:a;
-}else if(c<0){
-a=mid;
-}else{
-b=mid;
-}
-}
-return a;
-};
-
-SimileAjax.SortedArray.prototype.getFirst=function(){
-return(this._a.length>0)?this._a[0]:null;
-};
-
-SimileAjax.SortedArray.prototype.getLast=function(){
-return(this._a.length>0)?this._a[this._a.length-1]:null;
-};
-
-
-
-SimileAjax.EventIndex=function(unit){
-var eventIndex=this;
-
-this._unit=(unit!=null)?unit:SimileAjax.NativeDateUnit;
-this._events=new SimileAjax.SortedArray(
-function(event1,event2){
-return eventIndex._unit.compare(event1.getStart(),event2.getStart());
-}
-);
-this._idToEvent={};
-this._indexed=true;
-};
-
-SimileAjax.EventIndex.prototype.getUnit=function(){
-return this._unit;
-};
-
-SimileAjax.EventIndex.prototype.getEvent=function(id){
-return this._idToEvent[id];
-};
-
-SimileAjax.EventIndex.prototype.add=function(evt){
-this._events.add(evt);
-this._idToEvent[evt.getID()]=evt;
-this._indexed=false;
-};
-
-SimileAjax.EventIndex.prototype.removeAll=function(){
-this._events.removeAll();
-this._idToEvent={};
-this._indexed=false;
-};
-
-SimileAjax.EventIndex.prototype.getCount=function(){
-return this._events.length();
-};
-
-SimileAjax.EventIndex.prototype.getIterator=function(startDate,endDate){
-if(!this._indexed){
-this._index();
-}
-return new SimileAjax.EventIndex._Iterator(this._events,startDate,endDate,this._unit);
-};
-
-SimileAjax.EventIndex.prototype.getReverseIterator=function(startDate,endDate){
-if(!this._indexed){
-this._index();
-}
-return new SimileAjax.EventIndex._ReverseIterator(this._events,startDate,endDate,this._unit);
-};
-
-SimileAjax.EventIndex.prototype.getAllIterator=function(){
-return new SimileAjax.EventIndex._AllIterator(this._events);
-};
-
-SimileAjax.EventIndex.prototype.getEarliestDate=function(){
-var evt=this._events.getFirst();
-return(evt==null)?null:evt.getStart();
-};
-
-SimileAjax.EventIndex.prototype.getLatestDate=function(){
-var evt=this._events.getLast();
-if(evt==null){
-return null;
-}
-
-if(!this._indexed){
-this._index();
-}
-
-var index=evt._earliestOverlapIndex;
-var date=this._events.elementAt(index).getEnd();
-for(var i=index+1;i<this._events.length();i++){
-date=this._unit.later(date,this._events.elementAt(i).getEnd());
-}
-
-return date;
-};
-
-SimileAjax.EventIndex.prototype._index=function(){
-
-
-var l=this._events.length();
-for(var i=0;i<l;i++){
-var evt=this._events.elementAt(i);
-evt._earliestOverlapIndex=i;
-}
-
-var toIndex=1;
-for(var i=0;i<l;i++){
-var evt=this._events.elementAt(i);
-var end=evt.getEnd();
-
-toIndex=Math.max(toIndex,i+1);
-while(toIndex<l){
-var evt2=this._events.elementAt(toIndex);
-var start2=evt2.getStart();
-
-if(this._unit.compare(start2,end)<0){
-evt2._earliestOverlapIndex=i;
-toIndex++;
-}else{
-break;
-}
-}
-}
-this._indexed=true;
-};
-
-SimileAjax.EventIndex._Iterator=function(events,startDate,endDate,unit){
-this._events=events;
-this._startDate=startDate;
-this._endDate=endDate;
-this._unit=unit;
-
-this._currentIndex=events.find(function(evt){
-return unit.compare(evt.getStart(),startDate);
-});
-if(this._currentIndex-1>=0){
-this._currentIndex=this._events.elementAt(this._currentIndex-1)._earliestOverlapIndex;
-}
-this._currentIndex--;
-
-this._maxIndex=events.find(function(evt){
-return unit.compare(evt.getStart(),endDate);
-});
-
-this._hasNext=false;
-this._next=null;
-this._findNext();
-};
-
-SimileAjax.EventIndex._Iterator.prototype={
-hasNext:function(){return this._hasNext;},
-next:function(){
-if(this._hasNext){
-var next=this._next;
-this._findNext();
-
-return next;
-}else{
-return null;
-}
-},
-_findNext:function(){
-var unit=this._unit;
-while((++this._currentIndex)<this._maxIndex){
-var evt=this._events.elementAt(this._currentIndex);
-if(unit.compare(evt.getStart(),this._endDate)<0&&
-unit.compare(evt.getEnd(),this._startDate)>0){
-
-this._next=evt;
-this._hasNext=true;
-return;
-}
-}
-this._next=null;
-this._hasNext=false;
-}
-};
-
-SimileAjax.EventIndex._ReverseIterator=function(events,startDate,endDate,unit){
-this._events=events;
-this._startDate=startDate;
-this._endDate=endDate;
-this._unit=unit;
-
-this._minIndex=events.find(function(evt){
-return unit.compare(evt.getStart(),startDate);
-});
-if(this._minIndex-1>=0){
-this._minIndex=this._events.elementAt(this._minIndex-1)._earliestOverlapIndex;
-}
-
-this._maxIndex=events.find(function(evt){
-return unit.compare(evt.getStart(),endDate);
-});
-
-this._currentIndex=this._maxIndex;
-this._hasNext=false;
-this._next=null;
-this._findNext();
-};
-
-SimileAjax.EventIndex._ReverseIterator.prototype={
-hasNext:function(){return this._hasNext;},
-next:function(){
-if(this._hasNext){
-var next=this._next;
-this._findNext();
-
-return next;
-}else{
-return null;
-}
-},
-_findNext:function(){
-var unit=this._unit;
-while((--this._currentIndex)>=this._minIndex){
-var evt=this._events.elementAt(this._currentIndex);
-if(unit.compare(evt.getStart(),this._endDate)<0&&
-unit.compare(evt.getEnd(),this._startDate)>0){
-
-this._next=evt;
-this._hasNext=true;
-return;
-}
-}
-this._next=null;
-this._hasNext=false;
-}
-};
-
-SimileAjax.EventIndex._AllIterator=function(events){
-this._events=events;
-this._index=0;
-};
-
-SimileAjax.EventIndex._AllIterator.prototype={
-hasNext:function(){
-return this._index<this._events.length();
-},
-next:function(){
-return this._index<this._events.length()?
-this._events.elementAt(this._index++):null;
-}
-};
-
-/* date-time.js */
-
-
-
-SimileAjax.DateTime=new Object();
-
-SimileAjax.DateTime.MILLISECOND=0;
-SimileAjax.DateTime.SECOND=1;
-SimileAjax.DateTime.MINUTE=2;
-SimileAjax.DateTime.HOUR=3;
-SimileAjax.DateTime.DAY=4;
-SimileAjax.DateTime.WEEK=5;
-SimileAjax.DateTime.MONTH=6;
-SimileAjax.DateTime.YEAR=7;
-SimileAjax.DateTime.DECADE=8;
-SimileAjax.DateTime.CENTURY=9;
-SimileAjax.DateTime.MILLENNIUM=10;
-
-SimileAjax.DateTime.EPOCH=-1;
-SimileAjax.DateTime.ERA=-2;
-
-
-SimileAjax.DateTime.gregorianUnitLengths=[];
-(function(){
-var d=SimileAjax.DateTime;
-var a=d.gregorianUnitLengths;
-
-a[d.MILLISECOND]=1;
-a[d.SECOND]=1000;
-a[d.MINUTE]=a[d.SECOND]*60;
-a[d.HOUR]=a[d.MINUTE]*60;
-a[d.DAY]=a[d.HOUR]*24;
-a[d.WEEK]=a[d.DAY]*7;
-a[d.MONTH]=a[d.DAY]*31;
-a[d.YEAR]=a[d.DAY]*365;
-a[d.DECADE]=a[d.YEAR]*10;
-a[d.CENTURY]=a[d.YEAR]*100;
-a[d.MILLENNIUM]=a[d.YEAR]*1000;
-})();
-
-SimileAjax.DateTime._dateRegexp=new RegExp(
-"^(-?)([0-9]{4})("+[
-"(-?([0-9]{2})(-?([0-9]{2}))?)",
-"(-?([0-9]{3}))",
-"(-?W([0-9]{2})(-?([1-7]))?)"
-].join("|")+")?$"
-);
-SimileAjax.DateTime._timezoneRegexp=new RegExp(
-"Z|(([-+])([0-9]{2})(:?([0-9]{2}))?)$"
-);
-SimileAjax.DateTime._timeRegexp=new RegExp(
-"^([0-9]{2})(:?([0-9]{2})(:?([0-9]{2})(\.([0-9]+))?)?)?$"
-);
-
-
-SimileAjax.DateTime.setIso8601Date=function(dateObject,string){
-
-
-var d=string.match(SimileAjax.DateTime._dateRegexp);
-if(!d){
-throw new Error("Invalid date string: "+string);
-}
-
-var sign=(d[1]=="-")?-1:1;
-var year=sign*d[2];
-var month=d[5];
-var date=d[7];
-var dayofyear=d[9];
-var week=d[11];
-var dayofweek=(d[13])?d[13]:1;
-
-dateObject.setUTCFullYear(year);
-if(dayofyear){
-dateObject.setUTCMonth(0);
-dateObject.setUTCDate(Number(dayofyear));
-}else if(week){
-dateObject.setUTCMonth(0);
-dateObject.setUTCDate(1);
-var gd=dateObject.getUTCDay();
-var day=(gd)?gd:7;
-var offset=Number(dayofweek)+(7*Number(week));
-
-if(day<=4){
-dateObject.setUTCDate(offset+1-day);
-}else{
-dateObject.setUTCDate(offset+8-day);
-}
-}else{
-if(month){
-dateObject.setUTCDate(1);
-dateObject.setUTCMonth(month-1);
-}
-if(date){
-dateObject.setUTCDate(date);
-}
-}
-
-return dateObject;
-};
-
-
-SimileAjax.DateTime.setIso8601Time=function(dateObject,string){
-
-
-var d=string.match(SimileAjax.DateTime._timeRegexp);
-if(!d){
-SimileAjax.Debug.warn("Invalid time string: "+string);
-return false;
-}
-var hours=d[1];
-var mins=Number((d[3])?d[3]:0);
-var secs=(d[5])?d[5]:0;
-var ms=d[7]?(Number("0."+d[7])*1000):0;
-
-dateObject.setUTCHours(hours);
-dateObject.setUTCMinutes(mins);
-dateObject.setUTCSeconds(secs);
-dateObject.setUTCMilliseconds(ms);
-
-return dateObject;
-};
-
-
-SimileAjax.DateTime.timezoneOffset=new Date().getTimezoneOffset();
-
-
-SimileAjax.DateTime.setIso8601=function(dateObject,string){
-
-
-var offset=null;
-var comps=(string.indexOf("T")==-1)?string.split(" "):string.split("T");
-
-SimileAjax.DateTime.setIso8601Date(dateObject,comps[0]);
-if(comps.length==2){
-
-var d=comps[1].match(SimileAjax.DateTime._timezoneRegexp);
-if(d){
-if(d[0]=='Z'){
-offset=0;
-}else{
-offset=(Number(d[3])*60)+Number(d[5]);
-offset*=((d[2]=='-')?1:-1);
-}
-comps[1]=comps[1].substr(0,comps[1].length-d[0].length);
-}
-
-SimileAjax.DateTime.setIso8601Time(dateObject,comps[1]);
-}
-if(offset==null){
-offset=dateObject.getTimezoneOffset();
-}
-dateObject.setTime(dateObject.getTime()+offset*60000);
-
-return dateObject;
-};
-
-
-SimileAjax.DateTime.parseIso8601DateTime=function(string){
-try{
-return SimileAjax.DateTime.setIso8601(new Date(0),string);
-}catch(e){
-return null;
-}
-};
-
-
-SimileAjax.DateTime.parseGregorianDateTime=function(o){
-if(o==null){
-return null;
-}else if(o instanceof Date){
-return o;
-}
-
-var s=o.toString();
-if(s.length>0&&s.length<8){
-var space=s.indexOf(" ");
-if(space>0){
-var year=parseInt(s.substr(0,space));
-var suffix=s.substr(space+1);
-if(suffix.toLowerCase()=="bc"){
-year=1-year;
-}
-}else{
-var year=parseInt(s);
-}
-
-var d=new Date(0);
-d.setUTCFullYear(year);
-
-return d;
-}
-
-try{
-return new Date(Date.parse(s));
-}catch(e){
-return null;
-}
-};
-
-
-SimileAjax.DateTime.roundDownToInterval=function(date,intervalUnit,timeZone,multiple,firstDayOfWeek){
-var timeShift=timeZone*
-SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.HOUR];
-
-var date2=new Date(date.getTime()+timeShift);
-var clearInDay=function(d){
-d.setUTCMilliseconds(0);
-d.setUTCSeconds(0);
-d.setUTCMinutes(0);
-d.setUTCHours(0);
-};
-var clearInYear=function(d){
-clearInDay(d);
-d.setUTCDate(1);
-d.setUTCMonth(0);
-};
-
-switch(intervalUnit){
-case SimileAjax.DateTime.MILLISECOND:
-var x=date2.getUTCMilliseconds();
-date2.setUTCMilliseconds(x-(x%multiple));
-break;
-case SimileAjax.DateTime.SECOND:
-date2.setUTCMilliseconds(0);
-
-var x=date2.getUTCSeconds();
-date2.setUTCSeconds(x-(x%multiple));
-break;
-case SimileAjax.DateTime.MINUTE:
-date2.setUTCMilliseconds(0);
-date2.setUTCSeconds(0);
-
-var x=date2.getUTCMinutes();
-date2.setTime(date2.getTime()-
-(x%multiple)*SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.MINUTE]);
-break;
-case SimileAjax.DateTime.HOUR:
-date2.setUTCMilliseconds(0);
-date2.setUTCSeconds(0);
-date2.setUTCMinutes(0);
-
-var x=date2.getUTCHours();
-date2.setUTCHours(x-(x%multiple));
-break;
-case SimileAjax.DateTime.DAY:
-clearInDay(date2);
-break;
-case SimileAjax.DateTime.WEEK:
-clearInDay(date2);
-var d=(date2.getUTCDay()+7-firstDayOfWeek)%7;
-date2.setTime(date2.getTime()-
-d*SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.DAY]);
-break;
-case SimileAjax.DateTime.MONTH:
-clearInDay(date2);
-date2.setUTCDate(1);
-
-var x=date2.getUTCMonth();
-date2.setUTCMonth(x-(x%multiple));
-break;
-case SimileAjax.DateTime.YEAR:
-clearInYear(date2);
-
-var x=date2.getUTCFullYear();
-date2.setUTCFullYear(x-(x%multiple));
-break;
-case SimileAjax.DateTime.DECADE:
-clearInYear(date2);
-date2.setUTCFullYear(Math.floor(date2.getUTCFullYear()/10)*10);
-break;
-case SimileAjax.DateTime.CENTURY:
-clearInYear(date2);
-date2.setUTCFullYear(Math.floor(date2.getUTCFullYear()/100)*100);
-break;
-case SimileAjax.DateTime.MILLENNIUM:
-clearInYear(date2);
-date2.setUTCFullYear(Math.floor(date2.getUTCFullYear()/1000)*1000);
-break;
-}
-
-date.setTime(date2.getTime()-timeShift);
-};
-
-
-SimileAjax.DateTime.roundUpToInterval=function(date,intervalUnit,timeZone,multiple,firstDayOfWeek){
-var originalTime=date.getTime();
-SimileAjax.DateTime.roundDownToInterval(date,intervalUnit,timeZone,multiple,firstDayOfWeek);
-if(date.getTime()<originalTime){
-date.setTime(date.getTime()+
-SimileAjax.DateTime.gregorianUnitLengths[intervalUnit]*multiple);
-}
-};
-
-
-SimileAjax.DateTime.incrementByInterval=function(date,intervalUnit,timeZone){
-timeZone=(typeof timeZone=='undefined')?0:timeZone;
-
-var timeShift=timeZone*
-SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.HOUR];
-
-var date2=new Date(date.getTime()+timeShift);
-
-switch(intervalUnit){
-case SimileAjax.DateTime.MILLISECOND:
-date2.setTime(date2.getTime()+1)
-break;
-case SimileAjax.DateTime.SECOND:
-date2.setTime(date2.getTime()+1000);
-break;
-case SimileAjax.DateTime.MINUTE:
-date2.setTime(date2.getTime()+
-SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.MINUTE]);
-break;
-case SimileAjax.DateTime.HOUR:
-date2.setTime(date2.getTime()+
-SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.HOUR]);
-break;
-case SimileAjax.DateTime.DAY:
-date2.setUTCDate(date2.getUTCDate()+1);
-break;
-case SimileAjax.DateTime.WEEK:
-date2.setUTCDate(date2.getUTCDate()+7);
-break;
-case SimileAjax.DateTime.MONTH:
-date2.setUTCMonth(date2.getUTCMonth()+1);
-break;
-case SimileAjax.DateTime.YEAR:
-date2.setUTCFullYear(date2.getUTCFullYear()+1);
-break;
-case SimileAjax.DateTime.DECADE:
-date2.setUTCFullYear(date2.getUTCFullYear()+10);
-break;
-case SimileAjax.DateTime.CENTURY:
-date2.setUTCFullYear(date2.getUTCFullYear()+100);
-break;
-case SimileAjax.DateTime.MILLENNIUM:
-date2.setUTCFullYear(date2.getUTCFullYear()+1000);
-break;
-}
-
-date.setTime(date2.getTime()-timeShift);
-};
-
-
-SimileAjax.DateTime.removeTimeZoneOffset=function(date,timeZone){
-return new Date(date.getTime()+
-timeZone*SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.HOUR]);
-};
-
-
-SimileAjax.DateTime.getTimezone=function(){
-var d=new Date().getTimezoneOffset();
-return d/-60;
-};
-
-
-/* debug.js */
-
-
-
-SimileAjax.Debug={
-silent:false
-};
-
-SimileAjax.Debug.log=function(msg){
-var f;
-if("console"in window&&"log"in window.console){
-f=function(msg2){
-console.log(msg2);
-}
-}else{
-f=function(msg2){
-if(!SimileAjax.Debug.silent){
-alert(msg2);
-}
-}
-}
-SimileAjax.Debug.log=f;
-f(msg);
-};
-
-SimileAjax.Debug.warn=function(msg){
-var f;
-if("console"in window&&"warn"in window.console){
-f=function(msg2){
-console.warn(msg2);
-}
-}else{
-f=function(msg2){
-if(!SimileAjax.Debug.silent){
-alert(msg2);
-}
-}
-}
-SimileAjax.Debug.warn=f;
-f(msg);
-};
-
-SimileAjax.Debug.exception=function(e,msg){
-var f,params=SimileAjax.parseURLParameters();
-if(params.errors=="throw"||SimileAjax.params.errors=="throw"){
-f=function(e2,msg2){
-throw(e2);
-};
-}else if("console"in window&&"error"in window.console){
-f=function(e2,msg2){
-if(msg2!=null){
-console.error(msg2+" %o",e2);
-}else{
-console.error(e2);
-}
-throw(e2);
-};
-}else{
-f=function(e2,msg2){
-if(!SimileAjax.Debug.silent){
-alert("Caught exception: "+msg2+"\n\nDetails: "+("description"in e2?e2.description:e2));
-}
-throw(e2);
-};
-}
-SimileAjax.Debug.exception=f;
-f(e,msg);
-};
-
-SimileAjax.Debug.objectToString=function(o){
-return SimileAjax.Debug._objectToString(o,"");
-};
-
-SimileAjax.Debug._objectToString=function(o,indent){
-var indent2=indent+" ";
-if(typeof o=="object"){
-var s="{";
-for(n in o){
-s+=indent2+n+": "+SimileAjax.Debug._objectToString(o[n],indent2)+"\n";
-}
-s+=indent+"}";
-return s;
-}else if(typeof o=="array"){
-var s="[";
-for(var n=0;n<o.length;n++){
-s+=SimileAjax.Debug._objectToString(o[n],indent2)+"\n";
-}
-s+=indent+"]";
-return s;
-}else{
-return o;
-}
-};
-
-
-/* dom.js */
-
-
-
-SimileAjax.DOM=new Object();
-
-SimileAjax.DOM.registerEventWithObject=function(elmt,eventName,obj,handlerName){
-SimileAjax.DOM.registerEvent(elmt,eventName,function(elmt2,evt,target){
-return obj[handlerName].call(obj,elmt2,evt,target);
-});
-};
-
-SimileAjax.DOM.registerEvent=function(elmt,eventName,handler){
-var handler2=function(evt){
-evt=(evt)?evt:((event)?event:null);
-if(evt){
-var target=(evt.target)?
-evt.target:((evt.srcElement)?evt.srcElement:null);
-if(target){
-target=(target.nodeType==1||target.nodeType==9)?
-target:target.parentNode;
-}
-
-return handler(elmt,evt,target);
-}
-return true;
-}
-
-if(SimileAjax.Platform.browser.isIE){
-elmt.attachEvent("on"+eventName,handler2);
-}else{
-elmt.addEventListener(eventName,handler2,false);
-}
-};
-
-SimileAjax.DOM.getPageCoordinates=function(elmt){
-var left=0;
-var top=0;
-
-if(elmt.nodeType!=1){
-elmt=elmt.parentNode;
-}
-
-var elmt2=elmt;
-while(elmt2!=null){
-left+=elmt2.offsetLeft;
-top+=elmt2.offsetTop;
-elmt2=elmt2.offsetParent;
-}
-
-var body=document.body;
-while(elmt!=null&&elmt!=body){
-if("scrollLeft"in elmt){
-left-=elmt.scrollLeft;
-top-=elmt.scrollTop;
-}
-elmt=elmt.parentNode;
-}
-
-return{left:left,top:top};
-};
-
-SimileAjax.DOM.getSize=function(elmt){
-var w=this.getStyle(elmt,"width");
-var h=this.getStyle(elmt,"height");
-if(w.indexOf("px")>-1)w=w.replace("px","");
-if(h.indexOf("px")>-1)h=h.replace("px","");
-return{
-w:w,
-h:h
-}
-}
-
-SimileAjax.DOM.getStyle=function(elmt,styleProp){
-if(elmt.currentStyle){
-var style=elmt.currentStyle[styleProp];
-}else if(window.getComputedStyle){
-var style=document.defaultView.getComputedStyle(elmt,null).getPropertyValue(styleProp);
-}else{
-var style="";
-}
-return style;
-}
-
-SimileAjax.DOM.getEventRelativeCoordinates=function(evt,elmt){
-if(SimileAjax.Platform.browser.isIE){
-if(evt.type=="mousewheel"){
-var coords=SimileAjax.DOM.getPageCoordinates(elmt);
-return{
-x:evt.clientX-coords.left,
-y:evt.clientY-coords.top
-};
-}else{
-return{
-x:evt.offsetX,
-y:evt.offsetY
-};
-}
-}else{
-var coords=SimileAjax.DOM.getPageCoordinates(elmt);
-
-if((evt.type=="DOMMouseScroll")&&
-SimileAjax.Platform.browser.isFirefox&&
-(SimileAjax.Platform.browser.majorVersion==2)){
-
-
-return{
-x:evt.screenX-coords.left,
-y:evt.screenY-coords.top
-};
-}else{
-return{
-x:evt.pageX-coords.left,
-y:evt.pageY-coords.top
-};
-}
-}
-};
-
-SimileAjax.DOM.getEventPageCoordinates=function(evt){
-if(SimileAjax.Platform.browser.isIE){
-return{
-x:evt.clientX+document.body.scrollLeft,
-y:evt.clientY+document.body.scrollTop
-};
-}else{
-return{
-x:evt.pageX,
-y:evt.pageY
-};
-}
-};
-
-SimileAjax.DOM.hittest=function(x,y,except){
-return SimileAjax.DOM._hittest(document.body,x,y,except);
-};
-
-SimileAjax.DOM._hittest=function(elmt,x,y,except){
-var childNodes=elmt.childNodes;
-outer:for(var i=0;i<childNodes.length;i++){
-var childNode=childNodes[i];
-for(var j=0;j<except.length;j++){
-if(childNode==except[j]){
-continue outer;
-}
-}
-
-if(childNode.offsetWidth==0&&childNode.offsetHeight==0){
-
-var hitNode=SimileAjax.DOM._hittest(childNode,x,y,except);
-if(hitNode!=childNode){
-return hitNode;
-}
-}else{
-var top=0;
-var left=0;
-
-var node=childNode;
-while(node){
-top+=node.offsetTop;
-left+=node.offsetLeft;
-node=node.offsetParent;
-}
-
-if(left<=x&&top<=y&&(x-left)<childNode.offsetWidth&&(y-top)<childNode.offsetHeight){
-return SimileAjax.DOM._hittest(childNode,x,y,except);
-}else if(childNode.nodeType==1&&childNode.tagName=="TR"){
-
-var childNode2=SimileAjax.DOM._hittest(childNode,x,y,except);
-if(childNode2!=childNode){
-return childNode2;
-}
-}
-}
-}
-return elmt;
-};
-
-SimileAjax.DOM.cancelEvent=function(evt){
-evt.returnValue=false;
-evt.cancelBubble=true;
-if("preventDefault"in evt){
-evt.preventDefault();
-}
-};
-
-SimileAjax.DOM.appendClassName=function(elmt,className){
-var classes=elmt.className.split(" ");
-for(var i=0;i<classes.length;i++){
-if(classes[i]==className){
-return;
-}
-}
-classes.push(className);
-elmt.className=classes.join(" ");
-};
-
-SimileAjax.DOM.createInputElement=function(type){
-var div=document.createElement("div");
-div.innerHTML="<input type='"+type+"' />";
-
-return div.firstChild;
-};
-
-SimileAjax.DOM.createDOMFromTemplate=function(template){
-var result={};
-result.elmt=SimileAjax.DOM._createDOMFromTemplate(template,result,null);
-
-return result;
-};
-
-SimileAjax.DOM._createDOMFromTemplate=function(templateNode,result,parentElmt){
-if(templateNode==null){
-
-return null;
-}else if(typeof templateNode!="object"){
-var node=document.createTextNode(templateNode);
-if(parentElmt!=null){
-parentElmt.appendChild(node);
-}
-return node;
-}else{
-var elmt=null;
-if("tag"in templateNode){
-var tag=templateNode.tag;
-if(parentElmt!=null){
-if(tag=="tr"){
-elmt=parentElmt.insertRow(parentElmt.rows.length);
-}else if(tag=="td"){
-elmt=parentElmt.insertCell(parentElmt.cells.length);
-}
-}
-if(elmt==null){
-elmt=tag=="input"?
-SimileAjax.DOM.createInputElement(templateNode.type):
-document.createElement(tag);
-
-if(parentElmt!=null){
-parentElmt.appendChild(elmt);
-}
-}
-}else{
-elmt=templateNode.elmt;
-if(parentElmt!=null){
-parentElmt.appendChild(elmt);
-}
-}
-
-for(var attribute in templateNode){
-var value=templateNode[attribute];
-
-if(attribute=="field"){
-result[value]=elmt;
-
-}else if(attribute=="className"){
-elmt.className=value;
-}else if(attribute=="id"){
-elmt.id=value;
-}else if(attribute=="title"){
-elmt.title=value;
-}else if(attribute=="type"&&elmt.tagName=="input"){
-
-}else if(attribute=="style"){
-for(n in value){
-var v=value[n];
-if(n=="float"){
-n=SimileAjax.Platform.browser.isIE?"styleFloat":"cssFloat";
-}
-elmt.style[n]=v;
-}
-}else if(attribute=="children"){
-for(var i=0;i<value.length;i++){
-SimileAjax.DOM._createDOMFromTemplate(value[i],result,elmt);
-}
-}else if(attribute!="tag"&&attribute!="elmt"){
-elmt.setAttribute(attribute,value);
-}
-}
-return elmt;
-}
-}
-
-SimileAjax.DOM._cachedParent=null;
-SimileAjax.DOM.createElementFromString=function(s){
-if(SimileAjax.DOM._cachedParent==null){
-SimileAjax.DOM._cachedParent=document.createElement("div");
-}
-SimileAjax.DOM._cachedParent.innerHTML=s;
-return SimileAjax.DOM._cachedParent.firstChild;
-};
-
-SimileAjax.DOM.createDOMFromString=function(root,s,fieldElmts){
-var elmt=typeof root=="string"?document.createElement(root):root;
-elmt.innerHTML=s;
-
-var dom={elmt:elmt};
-SimileAjax.DOM._processDOMChildrenConstructedFromString(dom,elmt,fieldElmts!=null?fieldElmts:{});
-
-return dom;
-};
-
-SimileAjax.DOM._processDOMConstructedFromString=function(dom,elmt,fieldElmts){
-var id=elmt.id;
-if(id!=null&&id.length>0){
-elmt.removeAttribute("id");
-if(id in fieldElmts){
-var parentElmt=elmt.parentNode;
-parentElmt.insertBefore(fieldElmts[id],elmt);
-parentElmt.removeChild(elmt);
-
-dom[id]=fieldElmts[id];
-return;
-}else{
-dom[id]=elmt;
-}
-}
-
-if(elmt.hasChildNodes()){
-SimileAjax.DOM._processDOMChildrenConstructedFromString(dom,elmt,fieldElmts);
-}
-};
-
-SimileAjax.DOM._processDOMChildrenConstructedFromString=function(dom,elmt,fieldElmts){
-var node=elmt.firstChild;
-while(node!=null){
-var node2=node.nextSibling;
-if(node.nodeType==1){
-SimileAjax.DOM._processDOMConstructedFromString(dom,node,fieldElmts);
-}
-node=node2;
-}
-};
-
-
-/* graphics.js */
-
-
-
-SimileAjax.Graphics=new Object();
-
-
-SimileAjax.Graphics.pngIsTranslucent=(!SimileAjax.Platform.browser.isIE)||(SimileAjax.Platform.browser.majorVersion>6);
-
-
-SimileAjax.Graphics._createTranslucentImage1=function(url,verticalAlign){
-var elmt=document.createElement("img");
-elmt.setAttribute("src",url);
-if(verticalAlign!=null){
-elmt.style.verticalAlign=verticalAlign;
-}
-return elmt;
-};
-SimileAjax.Graphics._createTranslucentImage2=function(url,verticalAlign){
-var elmt=document.createElement("img");
-elmt.style.width="1px";
-elmt.style.height="1px";
-elmt.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+url+"', sizingMethod='image')";
-elmt.style.verticalAlign=(verticalAlign!=null)?verticalAlign:"middle";
-return elmt;
-};
-
-
-SimileAjax.Graphics.createTranslucentImage=SimileAjax.Graphics.pngIsTranslucent?
-SimileAjax.Graphics._createTranslucentImage1:
-SimileAjax.Graphics._createTranslucentImage2;
-
-SimileAjax.Graphics._createTranslucentImageHTML1=function(url,verticalAlign){
-return"<img src=\""+url+"\""+
-(verticalAlign!=null?" style=\"vertical-align: "+verticalAlign+";\"":"")+
-" />";
-};
-SimileAjax.Graphics._createTranslucentImageHTML2=function(url,verticalAlign){
-var style=
-"width: 1px; height: 1px; "+
-"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+url+"', sizingMethod='image');"+
-(verticalAlign!=null?" vertical-align: "+verticalAlign+";":"");
-
-return"<img src='"+url+"' style=\""+style+"\" />";
-};
-
-
-SimileAjax.Graphics.createTranslucentImageHTML=SimileAjax.Graphics.pngIsTranslucent?
-SimileAjax.Graphics._createTranslucentImageHTML1:
-SimileAjax.Graphics._createTranslucentImageHTML2;
-
-
-SimileAjax.Graphics.setOpacity=function(elmt,opacity){
-if(SimileAjax.Platform.browser.isIE){
-elmt.style.filter="progid:DXImageTransform.Microsoft.Alpha(Style=0,Opacity="+opacity+")";
-}else{
-var o=(opacity/100).toString();
-elmt.style.opacity=o;
-elmt.style.MozOpacity=o;
-}
-};
-
-
-SimileAjax.Graphics._bubbleMargins={
-top:33,
-bottom:42,
-left:33,
-right:40
-}
-
-
-SimileAjax.Graphics._arrowOffsets={
-top:0,
-bottom:9,
-left:1,
-right:8
-}
-
-SimileAjax.Graphics._bubblePadding=15;
-SimileAjax.Graphics._bubblePointOffset=6;
-SimileAjax.Graphics._halfArrowWidth=18;
-
-
-SimileAjax.Graphics.createBubbleForContentAndPoint=function(div,pageX,pageY,contentWidth,orientation){
-if(typeof contentWidth!="number"){
-contentWidth=300;
-}
-
-div.style.position="absolute";
-div.style.left="-5000px";
-div.style.top="0px";
-div.style.width=contentWidth+"px";
-document.body.appendChild(div);
-
-window.setTimeout(function(){
-var width=div.scrollWidth+10;
-var height=div.scrollHeight+10;
-
-var bubble=SimileAjax.Graphics.createBubbleForPoint(pageX,pageY,width,height,orientation);
-
-document.body.removeChild(div);
-div.style.position="static";
-div.style.left="";
-div.style.top="";
-div.style.width=width+"px";
-bubble.content.appendChild(div);
-},200);
-};
-
-
-SimileAjax.Graphics.createBubbleForPoint=function(pageX,pageY,contentWidth,contentHeight,orientation){
-function getWindowDims(){
-if(typeof window.innerHeight=='number'){
-return{w:window.innerWidth,h:window.innerHeight};
-}else if(document.documentElement&&document.documentElement.clientHeight){
-return{
-w:document.documentElement.clientWidth,
-h:document.documentElement.clientHeight
-};
-}else if(document.body&&document.body.clientHeight){
-return{
-w:document.body.clientWidth,
-h:document.body.clientHeight
-};
-}
-}
-
-var close=function(){
-if(!bubble._closed){
-document.body.removeChild(bubble._div);
-bubble._doc=null;
-bubble._div=null;
-bubble._content=null;
-bubble._closed=true;
-}
-}
-var bubble={
-_closed:false
-};
-
-var dims=getWindowDims();
-var docWidth=dims.w;
-var docHeight=dims.h;
-
-var margins=SimileAjax.Graphics._bubbleMargins;
-contentWidth=parseInt(contentWidth,10);
-contentHeight=parseInt(contentHeight,10);
-var bubbleWidth=margins.left+contentWidth+margins.right;
-var bubbleHeight=margins.top+contentHeight+margins.bottom;
-
-var pngIsTranslucent=SimileAjax.Graphics.pngIsTranslucent;
-var urlPrefix=SimileAjax.urlPrefix;
-
-var setImg=function(elmt,url,width,height){
-elmt.style.position="absolute";
-elmt.style.width=width+"px";
-elmt.style.height=height+"px";
-if(pngIsTranslucent){
-elmt.style.background="url("+url+")";
-}else{
-elmt.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+url+"', sizingMethod='crop')";
-}
-}
-var div=document.createElement("div");
-div.style.width=bubbleWidth+"px";
-div.style.height=bubbleHeight+"px";
-div.style.position="absolute";
-div.style.zIndex=1000;
-
-var layer=SimileAjax.WindowManager.pushLayer(close,true,div);
-bubble._div=div;
-bubble.close=function(){SimileAjax.WindowManager.popLayer(layer);}
-
-var divInner=document.createElement("div");
-divInner.style.width="100%";
-divInner.style.height="100%";
-divInner.style.position="relative";
-div.appendChild(divInner);
-
-var createImg=function(url,left,top,width,height){
-var divImg=document.createElement("div");
-divImg.style.left=left+"px";
-divImg.style.top=top+"px";
-setImg(divImg,url,width,height);
-divInner.appendChild(divImg);
-}
-
-createImg(urlPrefix+"images/bubble-top-left.png",0,0,margins.left,margins.top);
-createImg(urlPrefix+"images/bubble-top.png",margins.left,0,contentWidth,margins.top);
-createImg(urlPrefix+"images/bubble-top-right.png",margins.left+contentWidth,0,margins.right,margins.top);
-
-createImg(urlPrefix+"images/bubble-left.png",0,margins.top,margins.left,contentHeight);
-createImg(urlPrefix+"images/bubble-right.png",margins.left+contentWidth,margins.top,margins.right,contentHeight);
-
-createImg(urlPrefix+"images/bubble-bottom-left.png",0,margins.top+contentHeight,margins.left,margins.bottom);
-createImg(urlPrefix+"images/bubble-bottom.png",margins.left,margins.top+contentHeight,contentWidth,margins.bottom);
-createImg(urlPrefix+"images/bubble-bottom-right.png",margins.left+contentWidth,margins.top+contentHeight,margins.right,margins.bottom);
-
-var divClose=document.createElement("div");
-divClose.style.left=(bubbleWidth-margins.right+SimileAjax.Graphics._bubblePadding-16-2)+"px";
-divClose.style.top=(margins.top-SimileAjax.Graphics._bubblePadding+1)+"px";
-divClose.style.cursor="pointer";
-setImg(divClose,urlPrefix+"images/close-button.png",16,16);
-SimileAjax.WindowManager.registerEventWithObject(divClose,"click",bubble,"close");
-divInner.appendChild(divClose);
-
-var divContent=document.createElement("div");
-divContent.style.position="absolute";
-divContent.style.left=margins.left+"px";
-divContent.style.top=margins.top+"px";
-divContent.style.width=contentWidth+"px";
-divContent.style.height=contentHeight+"px";
-divContent.style.overflow="auto";
-divContent.style.background="white";
-divInner.appendChild(divContent);
-bubble.content=divContent;
-
-(function(){
-if(pageX-SimileAjax.Graphics._halfArrowWidth-SimileAjax.Graphics._bubblePadding>0&&
-pageX+SimileAjax.Graphics._halfArrowWidth+SimileAjax.Graphics._bubblePadding<docWidth){
-
-var left=pageX-Math.round(contentWidth/2)-margins.left;
-left=pageX<(docWidth/2)?
-Math.max(left,-(margins.left-SimileAjax.Graphics._bubblePadding)):
-Math.min(left,docWidth+(margins.right-SimileAjax.Graphics._bubblePadding)-bubbleWidth);
-
-if((orientation&&orientation=="top")||(!orientation&&(pageY-SimileAjax.Graphics._bubblePointOffset-bubbleHeight>0))){
-var divImg=document.createElement("div");
-
-divImg.style.left=(pageX-SimileAjax.Graphics._halfArrowWidth-left)+"px";
-divImg.style.top=(margins.top+contentHeight)+"px";
-setImg(divImg,urlPrefix+"images/bubble-bottom-arrow.png",37,margins.bottom);
-divInner.appendChild(divImg);
-
-div.style.left=left+"px";
-div.style.top=(pageY-SimileAjax.Graphics._bubblePointOffset-bubbleHeight+
-SimileAjax.Graphics._arrowOffsets.bottom)+"px";
-
-return;
-}else if((orientation&&orientation=="bottom")||(!orientation&&(pageY+SimileAjax.Graphics._bubblePointOffset+bubbleHeight<docHeight))){
-var divImg=document.createElement("div");
-
-divImg.style.left=(pageX-SimileAjax.Graphics._halfArrowWidth-left)+"px";
-divImg.style.top="0px";
-setImg(divImg,urlPrefix+"images/bubble-top-arrow.png",37,margins.top);
-divInner.appendChild(divImg);
-
-div.style.left=left+"px";
-div.style.top=(pageY+SimileAjax.Graphics._bubblePointOffset-
-SimileAjax.Graphics._arrowOffsets.top)+"px";
-
-return;
-}
-}
-
-var top=pageY-Math.round(contentHeight/2)-margins.top;
-top=pageY<(docHeight/2)?
-Math.max(top,-(margins.top-SimileAjax.Graphics._bubblePadding)):
-Math.min(top,docHeight+(margins.bottom-SimileAjax.Graphics._bubblePadding)-bubbleHeight);
-
-if((orientation&&orientation=="left")||(!orientation&&(pageX-SimileAjax.Graphics._bubblePointOffset-bubbleWidth>0))){
-var divImg=document.createElement("div");
-
-divImg.style.left=(margins.left+contentWidth)+"px";
-divImg.style.top=(pageY-SimileAjax.Graphics._halfArrowWidth-top)+"px";
-setImg(divImg,urlPrefix+"images/bubble-right-arrow.png",margins.right,37);
-divInner.appendChild(divImg);
-
-div.style.left=(pageX-SimileAjax.Graphics._bubblePointOffset-bubbleWidth+
-SimileAjax.Graphics._arrowOffsets.right)+"px";
-div.style.top=top+"px";
-}else if((orientation&&orientation=="right")||(!orientation&&(pageX-SimileAjax.Graphics._bubblePointOffset-bubbleWidth<docWidth))){
-var divImg=document.createElement("div");
-
-divImg.style.left="0px";
-divImg.style.top=(pageY-SimileAjax.Graphics._halfArrowWidth-top)+"px";
-setImg(divImg,urlPrefix+"images/bubble-left-arrow.png",margins.left,37);
-divInner.appendChild(divImg);
-
-div.style.left=(pageX+SimileAjax.Graphics._bubblePointOffset-
-SimileAjax.Graphics._arrowOffsets.left)+"px";
-div.style.top=top+"px";
-}
-})();
-
-document.body.appendChild(div);
-
-return bubble;
-};
-
-
-SimileAjax.Graphics.createMessageBubble=function(doc){
-var containerDiv=doc.createElement("div");
-if(SimileAjax.Graphics.pngIsTranslucent){
-var topDiv=doc.createElement("div");
-topDiv.style.height="33px";
-topDiv.style.background="url("+SimileAjax.urlPrefix+"images/message-top-left.png) top left no-repeat";
-topDiv.style.paddingLeft="44px";
-containerDiv.appendChild(topDiv);
-
-var topRightDiv=doc.createElement("div");
-topRightDiv.style.height="33px";
-topRightDiv.style.background="url("+SimileAjax.urlPrefix+"images/message-top-right.png) top right no-repeat";
-topDiv.appendChild(topRightDiv);
-
-var middleDiv=doc.createElement("div");
-middleDiv.style.background="url("+SimileAjax.urlPrefix+"images/message-left.png) top left repeat-y";
-middleDiv.style.paddingLeft="44px";
-containerDiv.appendChild(middleDiv);
-
-var middleRightDiv=doc.createElement("div");
-middleRightDiv.style.background="url("+SimileAjax.urlPrefix+"images/message-right.png) top right repeat-y";
-middleRightDiv.style.paddingRight="44px";
-middleDiv.appendChild(middleRightDiv);
-
-var contentDiv=doc.createElement("div");
-middleRightDiv.appendChild(contentDiv);
-
-var bottomDiv=doc.createElement("div");
-bottomDiv.style.height="55px";
-bottomDiv.style.background="url("+SimileAjax.urlPrefix+"images/message-bottom-left.png) bottom left no-repeat";
-bottomDiv.style.paddingLeft="44px";
-containerDiv.appendChild(bottomDiv);
-
-var bottomRightDiv=doc.createElement("div");
-bottomRightDiv.style.height="55px";
-bottomRightDiv.style.background="url("+SimileAjax.urlPrefix+"images/message-bottom-right.png) bottom right no-repeat";
-bottomDiv.appendChild(bottomRightDiv);
-}else{
-containerDiv.style.border="2px solid #7777AA";
-containerDiv.style.padding="20px";
-containerDiv.style.background="white";
-SimileAjax.Graphics.setOpacity(containerDiv,90);
-
-var contentDiv=doc.createElement("div");
-containerDiv.appendChild(contentDiv);
-}
-
-return{
-containerDiv:containerDiv,
-contentDiv:contentDiv
-};
-};
-
-
-
-
-SimileAjax.Graphics.createAnimation=function(f,from,to,duration,cont){
-return new SimileAjax.Graphics._Animation(f,from,to,duration,cont);
-};
-
-SimileAjax.Graphics._Animation=function(f,from,to,duration,cont){
-this.f=f;
-this.cont=(typeof cont=="function")?cont:function(){};
-
-this.from=from;
-this.to=to;
-this.current=from;
-
-this.duration=duration;
-this.start=new Date().getTime();
-this.timePassed=0;
-};
-
-
-SimileAjax.Graphics._Animation.prototype.run=function(){
-var a=this;
-window.setTimeout(function(){a.step();},50);
-};
-
-
-SimileAjax.Graphics._Animation.prototype.step=function(){
-this.timePassed+=50;
-
-var timePassedFraction=this.timePassed/this.duration;
-var parameterFraction=-Math.cos(timePassedFraction*Math.PI)/2+0.5;
-var current=parameterFraction*(this.to-this.from)+this.from;
-
-try{
-this.f(current,current-this.current);
-}catch(e){
-}
-this.current=current;
-
-if(this.timePassed<this.duration){
-this.run();
-}else{
-this.f(this.to,0);
-this["cont"]();
-}
-};
-
-
-
-
-SimileAjax.Graphics.createStructuredDataCopyButton=function(image,width,height,createDataFunction){
-var div=document.createElement("div");
-div.style.position="relative";
-div.style.display="inline";
-div.style.width=width+"px";
-div.style.height=height+"px";
-div.style.overflow="hidden";
-div.style.margin="2px";
-
-if(SimileAjax.Graphics.pngIsTranslucent){
-div.style.background="url("+image+") no-repeat";
-}else{
-div.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+image+"', sizingMethod='image')";
-}
-
-var style;
-if(SimileAjax.Platform.browser.isIE){
-style="filter:alpha(opacity=0)";
-}else{
-style="opacity: 0";
-}
-div.innerHTML="<textarea rows='1' autocomplete='off' value='none' style='"+style+"' />";
-
-var textarea=div.firstChild;
-textarea.style.width=width+"px";
-textarea.style.height=height+"px";
-textarea.onmousedown=function(evt){
-evt=(evt)?evt:((event)?event:null);
-if(evt.button==2){
-textarea.value=createDataFunction();
-textarea.select();
-}
-};
-
-return div;
-};
-
-SimileAjax.Graphics.getFontRenderingContext=function(elmt,width){
-return new SimileAjax.Graphics._FontRenderingContext(elmt,width);
-};
-
-SimileAjax.Graphics._FontRenderingContext=function(elmt,width){
-this._elmt=elmt;
-this._elmt.style.visibility="hidden";
-if(typeof width=="string"){
-this._elmt.style.width=width;
-}else if(typeof width=="number"){
-this._elmt.style.width=width+"px";
-}
-};
-
-SimileAjax.Graphics._FontRenderingContext.prototype.dispose=function(){
-this._elmt=null;
-};
-
-SimileAjax.Graphics._FontRenderingContext.prototype.update=function(){
-this._elmt.innerHTML="A";
-this._lineHeight=this._elmt.offsetHeight;
-};
-
-SimileAjax.Graphics._FontRenderingContext.prototype.computeSize=function(text){
-this._elmt.innerHTML=text;
-return{
-width:this._elmt.offsetWidth,
-height:this._elmt.offsetHeight
-};
-};
-
-SimileAjax.Graphics._FontRenderingContext.prototype.getLineHeight=function(){
-return this._lineHeight;
-};
-
-
-/* history.js */
-
-
-
-SimileAjax.History={
-maxHistoryLength:10,
-historyFile:"__history__.html",
-enabled:true,
-
-_initialized:false,
-_listeners:new SimileAjax.ListenerQueue(),
-
-_actions:[],
-_baseIndex:0,
-_currentIndex:0,
-
-_plainDocumentTitle:document.title
-};
-
-SimileAjax.History.formatHistoryEntryTitle=function(actionLabel){
-return SimileAjax.History._plainDocumentTitle+" {"+actionLabel+"}";
-};
-
-SimileAjax.History.initialize=function(){
-if(SimileAjax.History._initialized){
-return;
-}
-
-if(SimileAjax.History.enabled){
-var iframe=document.createElement("iframe");
-iframe.id="simile-ajax-history";
-iframe.style.position="absolute";
-iframe.style.width="10px";
-iframe.style.height="10px";
-iframe.style.top="0px";
-iframe.style.left="0px";
-iframe.style.visibility="hidden";
-iframe.src=SimileAjax.History.historyFile+"?0";
-
-document.body.appendChild(iframe);
-SimileAjax.DOM.registerEvent(iframe,"load",SimileAjax.History._handleIFrameOnLoad);
-
-SimileAjax.History._iframe=iframe;
-}
-SimileAjax.History._initialized=true;
-};
-
-SimileAjax.History.addListener=function(listener){
-SimileAjax.History.initialize();
-
-SimileAjax.History._listeners.add(listener);
-};
-
-SimileAjax.History.removeListener=function(listener){
-SimileAjax.History.initialize();
-
-SimileAjax.History._listeners.remove(listener);
-};
-
-SimileAjax.History.addAction=function(action){
-SimileAjax.History.initialize();
-
-SimileAjax.History._listeners.fire("onBeforePerform",[action]);
-window.setTimeout(function(){
-try{
-action.perform();
-SimileAjax.History._listeners.fire("onAfterPerform",[action]);
-
-if(SimileAjax.History.enabled){
-SimileAjax.History._actions=SimileAjax.History._actions.slice(
-0,SimileAjax.History._currentIndex-SimileAjax.History._baseIndex);
-
-SimileAjax.History._actions.push(action);
-SimileAjax.History._currentIndex++;
-
-var diff=SimileAjax.History._actions.length-SimileAjax.History.maxHistoryLength;
-if(diff>0){
-SimileAjax.History._actions=SimileAjax.History._actions.slice(diff);
-SimileAjax.History._baseIndex+=diff;
-}
-
-try{
-SimileAjax.History._iframe.contentWindow.location.search=
-"?"+SimileAjax.History._currentIndex;
-}catch(e){
-
-var title=SimileAjax.History.formatHistoryEntryTitle(action.label);
-document.title=title;
-}
-}
-}catch(e){
-SimileAjax.Debug.exception(e,"Error adding action {"+action.label+"} to history");
-}
-},0);
-};
-
-SimileAjax.History.addLengthyAction=function(perform,undo,label){
-SimileAjax.History.addAction({
-perform:perform,
-undo:undo,
-label:label,
-uiLayer:SimileAjax.WindowManager.getBaseLayer(),
-lengthy:true
-});
-};
-
-SimileAjax.History._handleIFrameOnLoad=function(){
-
-
-try{
-var q=SimileAjax.History._iframe.contentWindow.location.search;
-var c=(q.length==0)?0:Math.max(0,parseInt(q.substr(1)));
-
-var finishUp=function(){
-var diff=c-SimileAjax.History._currentIndex;
-SimileAjax.History._currentIndex+=diff;
-SimileAjax.History._baseIndex+=diff;
-
-SimileAjax.History._iframe.contentWindow.location.search="?"+c;
-};
-
-if(c<SimileAjax.History._currentIndex){
-SimileAjax.History._listeners.fire("onBeforeUndoSeveral",[]);
-window.setTimeout(function(){
-while(SimileAjax.History._currentIndex>c&&
-SimileAjax.History._currentIndex>SimileAjax.History._baseIndex){
-
-SimileAjax.History._currentIndex--;
-
-var action=SimileAjax.History._actions[SimileAjax.History._currentIndex-SimileAjax.History._baseIndex];
-
-try{
-action.undo();
-}catch(e){
-SimileAjax.Debug.exception(e,"History: Failed to undo action {"+action.label+"}");
-}
-}
-
-SimileAjax.History._listeners.fire("onAfterUndoSeveral",[]);
-finishUp();
-},0);
-}else if(c>SimileAjax.History._currentIndex){
-SimileAjax.History._listeners.fire("onBeforeRedoSeveral",[]);
-window.setTimeout(function(){
-while(SimileAjax.History._currentIndex<c&&
-SimileAjax.History._currentIndex-SimileAjax.History._baseIndex<SimileAjax.History._actions.length){
-
-var action=SimileAjax.History._actions[SimileAjax.History._currentIndex-SimileAjax.History._baseIndex];
-
-try{
-action.perform();
-}catch(e){
-SimileAjax.Debug.exception(e,"History: Failed to redo action {"+action.label+"}");
-}
-
-SimileAjax.History._currentIndex++;
-}
-
-SimileAjax.History._listeners.fire("onAfterRedoSeveral",[]);
-finishUp();
-},0);
-}else{
-var index=SimileAjax.History._currentIndex-SimileAjax.History._baseIndex-1;
-var title=(index>=0&&index<SimileAjax.History._actions.length)?
-SimileAjax.History.formatHistoryEntryTitle(SimileAjax.History._actions[index].label):
-SimileAjax.History._plainDocumentTitle;
-
-SimileAjax.History._iframe.contentWindow.document.title=title;
-document.title=title;
-}
-}catch(e){
-
-}
-};
-
-SimileAjax.History.getNextUndoAction=function(){
-try{
-var index=SimileAjax.History._currentIndex-SimileAjax.History._baseIndex-1;
-return SimileAjax.History._actions[index];
-}catch(e){
-return null;
-}
-};
-
-SimileAjax.History.getNextRedoAction=function(){
-try{
-var index=SimileAjax.History._currentIndex-SimileAjax.History._baseIndex;
-return SimileAjax.History._actions[index];
-}catch(e){
-return null;
-}
-};
-
-
-/* html.js */
-
-
-
-SimileAjax.HTML=new Object();
-
-SimileAjax.HTML._e2uHash={};
-(function(){
-var e2uHash=SimileAjax.HTML._e2uHash;
-e2uHash['nbsp']='\u00A0[space]';
-e2uHash['iexcl']='\u00A1';
-e2uHash['cent']='\u00A2';
-e2uHash['pound']='\u00A3';
-e2uHash['curren']='\u00A4';
-e2uHash['yen']='\u00A5';
-e2uHash['brvbar']='\u00A6';
-e2uHash['sect']='\u00A7';
-e2uHash['uml']='\u00A8';
-e2uHash['copy']='\u00A9';
-e2uHash['ordf']='\u00AA';
-e2uHash['laquo']='\u00AB';
-e2uHash['not']='\u00AC';
-e2uHash['shy']='\u00AD';
-e2uHash['reg']='\u00AE';
-e2uHash['macr']='\u00AF';
-e2uHash['deg']='\u00B0';
-e2uHash['plusmn']='\u00B1';
-e2uHash['sup2']='\u00B2';
-e2uHash['sup3']='\u00B3';
-e2uHash['acute']='\u00B4';
-e2uHash['micro']='\u00B5';
-e2uHash['para']='\u00B6';
-e2uHash['middot']='\u00B7';
-e2uHash['cedil']='\u00B8';
-e2uHash['sup1']='\u00B9';
-e2uHash['ordm']='\u00BA';
-e2uHash['raquo']='\u00BB';
-e2uHash['frac14']='\u00BC';
-e2uHash['frac12']='\u00BD';
-e2uHash['frac34']='\u00BE';
-e2uHash['iquest']='\u00BF';
-e2uHash['Agrave']='\u00C0';
-e2uHash['Aacute']='\u00C1';
-e2uHash['Acirc']='\u00C2';
-e2uHash['Atilde']='\u00C3';
-e2uHash['Auml']='\u00C4';
-e2uHash['Aring']='\u00C5';
-e2uHash['AElig']='\u00C6';
-e2uHash['Ccedil']='\u00C7';
-e2uHash['Egrave']='\u00C8';
-e2uHash['Eacute']='\u00C9';
-e2uHash['Ecirc']='\u00CA';
-e2uHash['Euml']='\u00CB';
-e2uHash['Igrave']='\u00CC';
-e2uHash['Iacute']='\u00CD';
-e2uHash['Icirc']='\u00CE';
-e2uHash['Iuml']='\u00CF';
-e2uHash['ETH']='\u00D0';
-e2uHash['Ntilde']='\u00D1';
-e2uHash['Ograve']='\u00D2';
-e2uHash['Oacute']='\u00D3';
-e2uHash['Ocirc']='\u00D4';
-e2uHash['Otilde']='\u00D5';
-e2uHash['Ouml']='\u00D6';
-e2uHash['times']='\u00D7';
-e2uHash['Oslash']='\u00D8';
-e2uHash['Ugrave']='\u00D9';
-e2uHash['Uacute']='\u00DA';
-e2uHash['Ucirc']='\u00DB';
-e2uHash['Uuml']='\u00DC';
-e2uHash['Yacute']='\u00DD';
-e2uHash['THORN']='\u00DE';
-e2uHash['szlig']='\u00DF';
-e2uHash['agrave']='\u00E0';
-e2uHash['aacute']='\u00E1';
-e2uHash['acirc']='\u00E2';
-e2uHash['atilde']='\u00E3';
-e2uHash['auml']='\u00E4';
-e2uHash['aring']='\u00E5';
-e2uHash['aelig']='\u00E6';
-e2uHash['ccedil']='\u00E7';
-e2uHash['egrave']='\u00E8';
-e2uHash['eacute']='\u00E9';
-e2uHash['ecirc']='\u00EA';
-e2uHash['euml']='\u00EB';
-e2uHash['igrave']='\u00EC';
-e2uHash['iacute']='\u00ED';
-e2uHash['icirc']='\u00EE';
-e2uHash['iuml']='\u00EF';
-e2uHash['eth']='\u00F0';
-e2uHash['ntilde']='\u00F1';
-e2uHash['ograve']='\u00F2';
-e2uHash['oacute']='\u00F3';
-e2uHash['ocirc']='\u00F4';
-e2uHash['otilde']='\u00F5';
-e2uHash['ouml']='\u00F6';
-e2uHash['divide']='\u00F7';
-e2uHash['oslash']='\u00F8';
-e2uHash['ugrave']='\u00F9';
-e2uHash['uacute']='\u00FA';
-e2uHash['ucirc']='\u00FB';
-e2uHash['uuml']='\u00FC';
-e2uHash['yacute']='\u00FD';
-e2uHash['thorn']='\u00FE';
-e2uHash['yuml']='\u00FF';
-e2uHash['quot']='\u0022';
-e2uHash['amp']='\u0026';
-e2uHash['lt']='\u003C';
-e2uHash['gt']='\u003E';
-e2uHash['OElig']='';
-e2uHash['oelig']='\u0153';
-e2uHash['Scaron']='\u0160';
-e2uHash['scaron']='\u0161';
-e2uHash['Yuml']='\u0178';
-e2uHash['circ']='\u02C6';
-e2uHash['tilde']='\u02DC';
-e2uHash['ensp']='\u2002';
-e2uHash['emsp']='\u2003';
-e2uHash['thinsp']='\u2009';
-e2uHash['zwnj']='\u200C';
-e2uHash['zwj']='\u200D';
-e2uHash['lrm']='\u200E';
-e2uHash['rlm']='\u200F';
-e2uHash['ndash']='\u2013';
-e2uHash['mdash']='\u2014';
-e2uHash['lsquo']='\u2018';
-e2uHash['rsquo']='\u2019';
-e2uHash['sbquo']='\u201A';
-e2uHash['ldquo']='\u201C';
-e2uHash['rdquo']='\u201D';
-e2uHash['bdquo']='\u201E';
-e2uHash['dagger']='\u2020';
-e2uHash['Dagger']='\u2021';
-e2uHash['permil']='\u2030';
-e2uHash['lsaquo']='\u2039';
-e2uHash['rsaquo']='\u203A';
-e2uHash['euro']='\u20AC';
-e2uHash['fnof']='\u0192';
-e2uHash['Alpha']='\u0391';
-e2uHash['Beta']='\u0392';
-e2uHash['Gamma']='\u0393';
-e2uHash['Delta']='\u0394';
-e2uHash['Epsilon']='\u0395';
-e2uHash['Zeta']='\u0396';
-e2uHash['Eta']='\u0397';
-e2uHash['Theta']='\u0398';
-e2uHash['Iota']='\u0399';
-e2uHash['Kappa']='\u039A';
-e2uHash['Lambda']='\u039B';
-e2uHash['Mu']='\u039C';
-e2uHash['Nu']='\u039D';
-e2uHash['Xi']='\u039E';
-e2uHash['Omicron']='\u039F';
-e2uHash['Pi']='\u03A0';
-e2uHash['Rho']='\u03A1';
-e2uHash['Sigma']='\u03A3';
-e2uHash['Tau']='\u03A4';
-e2uHash['Upsilon']='\u03A5';
-e2uHash['Phi']='\u03A6';
-e2uHash['Chi']='\u03A7';
-e2uHash['Psi']='\u03A8';
-e2uHash['Omega']='\u03A9';
-e2uHash['alpha']='\u03B1';
-e2uHash['beta']='\u03B2';
-e2uHash['gamma']='\u03B3';
-e2uHash['delta']='\u03B4';
-e2uHash['epsilon']='\u03B5';
-e2uHash['zeta']='\u03B6';
-e2uHash['eta']='\u03B7';
-e2uHash['theta']='\u03B8';
-e2uHash['iota']='\u03B9';
-e2uHash['kappa']='\u03BA';
-e2uHash['lambda']='\u03BB';
-e2uHash['mu']='\u03BC';
-e2uHash['nu']='\u03BD';
-e2uHash['xi']='\u03BE';
-e2uHash['omicron']='\u03BF';
-e2uHash['pi']='\u03C0';
-e2uHash['rho']='\u03C1';
-e2uHash['sigmaf']='\u03C2';
-e2uHash['sigma']='\u03C3';
-e2uHash['tau']='\u03C4';
-e2uHash['upsilon']='\u03C5';
-e2uHash['phi']='\u03C6';
-e2uHash['chi']='\u03C7';
-e2uHash['psi']='\u03C8';
-e2uHash['omega']='\u03C9';
-e2uHash['thetasym']='\u03D1';
-e2uHash['upsih']='\u03D2';
-e2uHash['piv']='\u03D6';
-e2uHash['bull']='\u2022';
-e2uHash['hellip']='\u2026';
-e2uHash['prime']='\u2032';
-e2uHash['Prime']='\u2033';
-e2uHash['oline']='\u203E';
-e2uHash['frasl']='\u2044';
-e2uHash['weierp']='\u2118';
-e2uHash['image']='\u2111';
-e2uHash['real']='\u211C';
-e2uHash['trade']='\u2122';
-e2uHash['alefsym']='\u2135';
-e2uHash['larr']='\u2190';
-e2uHash['uarr']='\u2191';
-e2uHash['rarr']='\u2192';
-e2uHash['darr']='\u2193';
-e2uHash['harr']='\u2194';
-e2uHash['crarr']='\u21B5';
-e2uHash['lArr']='\u21D0';
-e2uHash['uArr']='\u21D1';
-e2uHash['rArr']='\u21D2';
-e2uHash['dArr']='\u21D3';
-e2uHash['hArr']='\u21D4';
-e2uHash['forall']='\u2200';
-e2uHash['part']='\u2202';
-e2uHash['exist']='\u2203';
-e2uHash['empty']='\u2205';
-e2uHash['nabla']='\u2207';
-e2uHash['isin']='\u2208';
-e2uHash['notin']='\u2209';
-e2uHash['ni']='\u220B';
-e2uHash['prod']='\u220F';
-e2uHash['sum']='\u2211';
-e2uHash['minus']='\u2212';
-e2uHash['lowast']='\u2217';
-e2uHash['radic']='\u221A';
-e2uHash['prop']='\u221D';
-e2uHash['infin']='\u221E';
-e2uHash['ang']='\u2220';
-e2uHash['and']='\u2227';
-e2uHash['or']='\u2228';
-e2uHash['cap']='\u2229';
-e2uHash['cup']='\u222A';
-e2uHash['int']='\u222B';
-e2uHash['there4']='\u2234';
-e2uHash['sim']='\u223C';
-e2uHash['cong']='\u2245';
-e2uHash['asymp']='\u2248';
-e2uHash['ne']='\u2260';
-e2uHash['equiv']='\u2261';
-e2uHash['le']='\u2264';
-e2uHash['ge']='\u2265';
-e2uHash['sub']='\u2282';
-e2uHash['sup']='\u2283';
-e2uHash['nsub']='\u2284';
-e2uHash['sube']='\u2286';
-e2uHash['supe']='\u2287';
-e2uHash['oplus']='\u2295';
-e2uHash['otimes']='\u2297';
-e2uHash['perp']='\u22A5';
-e2uHash['sdot']='\u22C5';
-e2uHash['lceil']='\u2308';
-e2uHash['rceil']='\u2309';
-e2uHash['lfloor']='\u230A';
-e2uHash['rfloor']='\u230B';
-e2uHash['lang']='\u2329';
-e2uHash['rang']='\u232A';
-e2uHash['loz']='\u25CA';
-e2uHash['spades']='\u2660';
-e2uHash['clubs']='\u2663';
-e2uHash['hearts']='\u2665';
-e2uHash['diams']='\u2666';
-})();
-
-SimileAjax.HTML.deEntify=function(s){
-var e2uHash=SimileAjax.HTML._e2uHash;
-
-var re=/&(\w+?);/;
-while(re.test(s)){
-var m=s.match(re);
-s=s.replace(re,e2uHash[m[1]]);
-}
-return s;
-};
-
-/* json.js */
-
-
-
-
-
-SimileAjax.JSON=new Object();
-
-(function(){
-var m={
-'\b':'\\b',
-'\t':'\\t',
-'\n':'\\n',
-'\f':'\\f',
-'\r':'\\r',
-'"':'\\"',
-'\\':'\\\\'
-};
-var s={
-array:function(x){
-var a=['['],b,f,i,l=x.length,v;
-for(i=0;i<l;i+=1){
-v=x[i];
-f=s[typeof v];
-if(f){
-v=f(v);
-if(typeof v=='string'){
-if(b){
-a[a.length]=',';
-}
-a[a.length]=v;
-b=true;
-}
-}
-}
-a[a.length]=']';
-return a.join('');
-},
-'boolean':function(x){
-return String(x);
-},
-'null':function(x){
-return"null";
-},
-number:function(x){
-return isFinite(x)?String(x):'null';
-},
-object:function(x){
-if(x){
-if(x instanceof Array){
-return s.array(x);
-}
-var a=['{'],b,f,i,v;
-for(i in x){
-v=x[i];
-f=s[typeof v];
-if(f){
-v=f(v);
-if(typeof v=='string'){
-if(b){
-a[a.length]=',';
-}
-a.push(s.string(i),':',v);
-b=true;
-}
-}
-}
-a[a.length]='}';
-return a.join('');
-}
-return'null';
-},
-string:function(x){
-if(/["\\\x00-\x1f]/.test(x)){
-x=x.replace(/([\x00-\x1f\\"])/g,function(a,b){
-var c=m[b];
-if(c){
-return c;
-}
-c=b.charCodeAt();
-return'\\u00'+
-Math.floor(c/16).toString(16)+
-(c%16).toString(16);
-});
-}
-return'"'+x+'"';
-}
-};
-
-SimileAjax.JSON.toJSONString=function(o){
-if(o instanceof Object){
-return s.object(o);
-}else if(o instanceof Array){
-return s.array(o);
-}else{
-return o.toString();
-}
-};
-
-SimileAjax.JSON.parseJSON=function(){
-try{
-return!(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(
-this.replace(/"(\\.|[^"\\])*"/g,'')))&&
-eval('('+this+')');
-}catch(e){
-return false;
-}
-};
-})();
-
-
-/* string.js */
-
-
-
-String.prototype.trim=function(){
-return this.replace(/^\s+|\s+$/g,'');
-};
-
-String.prototype.startsWith=function(prefix){
-return this.length>=prefix.length&&this.substr(0,prefix.length)==prefix;
-};
-
-String.prototype.endsWith=function(suffix){
-return this.length>=suffix.length&&this.substr(this.length-suffix.length)==suffix;
-};
-
-String.substitute=function(s,objects){
-var result="";
-var start=0;
-while(start<s.length-1){
-var percent=s.indexOf("%",start);
-if(percent<0||percent==s.length-1){
-break;
-}else if(percent>start&&s.charAt(percent-1)=="\\"){
-result+=s.substring(start,percent-1)+"%";
-start=percent+1;
-}else{
-var n=parseInt(s.charAt(percent+1));
-if(isNaN(n)||n>=objects.length){
-result+=s.substring(start,percent+2);
-}else{
-result+=s.substring(start,percent)+objects[n].toString();
-}
-start=percent+2;
-}
-}
-
-if(start<s.length){
-result+=s.substring(start);
-}
-return result;
-};
-
-
-/* units.js */
-
-
-
-
-
-SimileAjax.NativeDateUnit=new Object();
-
-
-
-SimileAjax.NativeDateUnit.makeDefaultValue=function(){
-
-return new Date();
-
-};
-
-
-
-SimileAjax.NativeDateUnit.cloneValue=function(v){
-
-return new Date(v.getTime());
-
-};
-
-
-
-SimileAjax.NativeDateUnit.getParser=function(format){
-
-if(typeof format=="string"){
-
-format=format.toLowerCase();
-
-}
-
-return(format=="iso8601"||format=="iso 8601")?
-
-SimileAjax.DateTime.parseIso8601DateTime:
-
-SimileAjax.DateTime.parseGregorianDateTime;
-
-};
-
-
-
-SimileAjax.NativeDateUnit.parseFromObject=function(o){
-
-return SimileAjax.DateTime.parseGregorianDateTime(o);
-
-};
-
-
-
-SimileAjax.NativeDateUnit.toNumber=function(v){
-
-return v.getTime();
-
-};
-
-
-
-SimileAjax.NativeDateUnit.fromNumber=function(n){
-
-return new Date(n);
-
-};
-
-
-
-SimileAjax.NativeDateUnit.compare=function(v1,v2){
-
-var n1,n2;
-
-if(typeof v1=="object"){
-
-n1=v1.getTime();
-
-}else{
-
-n1=Number(v1);
-
-}
-
-if(typeof v2=="object"){
-
-n2=v2.getTime();
-
-}else{
-
-n2=Number(v2);
-
-}
-
-
-
-return n1-n2;
-
-};
-
-
-
-SimileAjax.NativeDateUnit.earlier=function(v1,v2){
-
-return SimileAjax.NativeDateUnit.compare(v1,v2)<0?v1:v2;
-
-};
-
-
-
-SimileAjax.NativeDateUnit.later=function(v1,v2){
-
-return SimileAjax.NativeDateUnit.compare(v1,v2)>0?v1:v2;
-
-};
-
-
-
-SimileAjax.NativeDateUnit.change=function(v,n){
-
-return new Date(v.getTime()+n);
-
-};
-
-
-
-
-
-/* window-manager.js */
-
-
-
-
-SimileAjax.WindowManager={
-_initialized:false,
-_listeners:[],
-
-_draggedElement:null,
-_draggedElementCallback:null,
-_dropTargetHighlightElement:null,
-_lastCoords:null,
-_ghostCoords:null,
-_draggingMode:"",
-_dragging:false,
-
-_layers:[]
-};
-
-SimileAjax.WindowManager.initialize=function(){
-if(SimileAjax.WindowManager._initialized){
-return;
-}
-
-SimileAjax.DOM.registerEvent(document.body,"mousedown",SimileAjax.WindowManager._onBodyMouseDown);
-SimileAjax.DOM.registerEvent(document.body,"mousemove",SimileAjax.WindowManager._onBodyMouseMove);
-SimileAjax.DOM.registerEvent(document.body,"mouseup",SimileAjax.WindowManager._onBodyMouseUp);
-SimileAjax.DOM.registerEvent(document,"keydown",SimileAjax.WindowManager._onBodyKeyDown);
-SimileAjax.DOM.registerEvent(document,"keyup",SimileAjax.WindowManager._onBodyKeyUp);
-
-SimileAjax.WindowManager._layers.push({index:0});
-
-SimileAjax.WindowManager._historyListener={
-onBeforeUndoSeveral:function(){},
-onAfterUndoSeveral:function(){},
-onBeforeUndo:function(){},
-onAfterUndo:function(){},
-
-onBeforeRedoSeveral:function(){},
-onAfterRedoSeveral:function(){},
-onBeforeRedo:function(){},
-onAfterRedo:function(){}
-};
-SimileAjax.History.addListener(SimileAjax.WindowManager._historyListener);
-
-SimileAjax.WindowManager._initialized=true;
-};
-
-SimileAjax.WindowManager.getBaseLayer=function(){
-SimileAjax.WindowManager.initialize();
-return SimileAjax.WindowManager._layers[0];
-};
-
-SimileAjax.WindowManager.getHighestLayer=function(){
-SimileAjax.WindowManager.initialize();
-return SimileAjax.WindowManager._layers[SimileAjax.WindowManager._layers.length-1];
-};
-
-SimileAjax.WindowManager.registerEventWithObject=function(elmt,eventName,obj,handlerName,layer){
-SimileAjax.WindowManager.registerEvent(
-elmt,
-eventName,
-function(elmt2,evt,target){
-return obj[handlerName].call(obj,elmt2,evt,target);
-},
-layer
-);
-};
-
-SimileAjax.WindowManager.registerEvent=function(elmt,eventName,handler,layer){
-if(layer==null){
-layer=SimileAjax.WindowManager.getHighestLayer();
-}
-
-var handler2=function(elmt,evt,target){
-if(SimileAjax.WindowManager._canProcessEventAtLayer(layer)){
-SimileAjax.WindowManager._popToLayer(layer.index);
-try{
-handler(elmt,evt,target);
-}catch(e){
-SimileAjax.Debug.exception(e);
-}
-}
-SimileAjax.DOM.cancelEvent(evt);
-return false;
-}
-
-SimileAjax.DOM.registerEvent(elmt,eventName,handler2);
-};
-
-SimileAjax.WindowManager.pushLayer=function(f,ephemeral,elmt){
-var layer={onPop:f,index:SimileAjax.WindowManager._layers.length,ephemeral:(ephemeral),elmt:elmt};
-SimileAjax.WindowManager._layers.push(layer);
-
-return layer;
-};
-
-SimileAjax.WindowManager.popLayer=function(layer){
-for(var i=1;i<SimileAjax.WindowManager._layers.length;i++){
-if(SimileAjax.WindowManager._layers[i]==layer){
-SimileAjax.WindowManager._popToLayer(i-1);
-break;
-}
-}
-};
-
-SimileAjax.WindowManager.popAllLayers=function(){
-SimileAjax.WindowManager._popToLayer(0);
-};
-
-SimileAjax.WindowManager.registerForDragging=function(elmt,callback,layer){
-SimileAjax.WindowManager.registerEvent(
-elmt,
-"mousedown",
-function(elmt,evt,target){
-SimileAjax.WindowManager._handleMouseDown(elmt,evt,callback);
-},
-layer
-);
-};
-
-SimileAjax.WindowManager._popToLayer=function(level){
-while(level+1<SimileAjax.WindowManager._layers.length){
-try{
-var layer=SimileAjax.WindowManager._layers.pop();
-if(layer.onPop!=null){
-layer.onPop();
-}
-}catch(e){
-}
-}
-};
-
-SimileAjax.WindowManager._canProcessEventAtLayer=function(layer){
-if(layer.index==(SimileAjax.WindowManager._layers.length-1)){
-return true;
-}
-for(var i=layer.index+1;i<SimileAjax.WindowManager._layers.length;i++){
-if(!SimileAjax.WindowManager._layers[i].ephemeral){
-return false;
-}
-}
-return true;
-};
-
-SimileAjax.WindowManager.cancelPopups=function(evt){
-var evtCoords=(evt)?SimileAjax.DOM.getEventPageCoordinates(evt):{x:-1,y:-1};
-
-var i=SimileAjax.WindowManager._layers.length-1;
-while(i>0&&SimileAjax.WindowManager._layers[i].ephemeral){
-var layer=SimileAjax.WindowManager._layers[i];
-if(layer.elmt!=null){
-var elmt=layer.elmt;
-var elmtCoords=SimileAjax.DOM.getPageCoordinates(elmt);
-if(evtCoords.x>=elmtCoords.left&&evtCoords.x<(elmtCoords.left+elmt.offsetWidth)&&
-evtCoords.y>=elmtCoords.top&&evtCoords.y<(elmtCoords.top+elmt.offsetHeight)){
-break;
-}
-}
-i--;
-}
-SimileAjax.WindowManager._popToLayer(i);
-};
-
-SimileAjax.WindowManager._onBodyMouseDown=function(elmt,evt,target){
-if(!("eventPhase"in evt)||evt.eventPhase==evt.BUBBLING_PHASE){
-SimileAjax.WindowManager.cancelPopups(evt);
-}
-};
-
-SimileAjax.WindowManager._handleMouseDown=function(elmt,evt,callback){
-SimileAjax.WindowManager._draggedElement=elmt;
-SimileAjax.WindowManager._draggedElementCallback=callback;
-SimileAjax.WindowManager._lastCoords={x:evt.clientX,y:evt.clientY};
-
-SimileAjax.DOM.cancelEvent(evt);
-return false;
-};
-
-SimileAjax.WindowManager._onBodyKeyDown=function(elmt,evt,target){
-if(SimileAjax.WindowManager._dragging){
-if(evt.keyCode==27){
-SimileAjax.WindowManager._cancelDragging();
-}else if((evt.keyCode==17||evt.keyCode==16)&&SimileAjax.WindowManager._draggingMode!="copy"){
-SimileAjax.WindowManager._draggingMode="copy";
-
-var img=SimileAjax.Graphics.createTranslucentImage(SimileAjax.urlPrefix+"images/copy.png");
-img.style.position="absolute";
-img.style.left=(SimileAjax.WindowManager._ghostCoords.left-16)+"px";
-img.style.top=(SimileAjax.WindowManager._ghostCoords.top)+"px";
-document.body.appendChild(img);
-
-SimileAjax.WindowManager._draggingModeIndicatorElmt=img;
-}
-}
-};
-
-SimileAjax.WindowManager._onBodyKeyUp=function(elmt,evt,target){
-if(SimileAjax.WindowManager._dragging){
-if(evt.keyCode==17||evt.keyCode==16){
-SimileAjax.WindowManager._draggingMode="";
-if(SimileAjax.WindowManager._draggingModeIndicatorElmt!=null){
-document.body.removeChild(SimileAjax.WindowManager._draggingModeIndicatorElmt);
-SimileAjax.WindowManager._draggingModeIndicatorElmt=null;
-}
-}
-}
-};
-
-SimileAjax.WindowManager._onBodyMouseMove=function(elmt,evt,target){
-if(SimileAjax.WindowManager._draggedElement!=null){
-var callback=SimileAjax.WindowManager._draggedElementCallback;
-
-var lastCoords=SimileAjax.WindowManager._lastCoords;
-var diffX=evt.clientX-lastCoords.x;
-var diffY=evt.clientY-lastCoords.y;
-
-if(!SimileAjax.WindowManager._dragging){
-if(Math.abs(diffX)>5||Math.abs(diffY)>5){
-try{
-if("onDragStart"in callback){
-callback.onDragStart();
-}
-
-if("ghost"in callback&&callback.ghost){
-var draggedElmt=SimileAjax.WindowManager._draggedElement;
-
-SimileAjax.WindowManager._ghostCoords=SimileAjax.DOM.getPageCoordinates(draggedElmt);
-SimileAjax.WindowManager._ghostCoords.left+=diffX;
-SimileAjax.WindowManager._ghostCoords.top+=diffY;
-
-var ghostElmt=draggedElmt.cloneNode(true);
-ghostElmt.style.position="absolute";
-ghostElmt.style.left=SimileAjax.WindowManager._ghostCoords.left+"px";
-ghostElmt.style.top=SimileAjax.WindowManager._ghostCoords.top+"px";
-ghostElmt.style.zIndex=1000;
-SimileAjax.Graphics.setOpacity(ghostElmt,50);
-
-document.body.appendChild(ghostElmt);
-callback._ghostElmt=ghostElmt;
-}
-
-SimileAjax.WindowManager._dragging=true;
-SimileAjax.WindowManager._lastCoords={x:evt.clientX,y:evt.clientY};
-
-document.body.focus();
-}catch(e){
-SimileAjax.Debug.exception("WindowManager: Error handling mouse down",e);
-SimileAjax.WindowManager._cancelDragging();
-}
-}
-}else{
-try{
-SimileAjax.WindowManager._lastCoords={x:evt.clientX,y:evt.clientY};
-
-if("onDragBy"in callback){
-callback.onDragBy(diffX,diffY);
-}
-
-if("_ghostElmt"in callback){
-var ghostElmt=callback._ghostElmt;
-
-SimileAjax.WindowManager._ghostCoords.left+=diffX;
-SimileAjax.WindowManager._ghostCoords.top+=diffY;
-
-ghostElmt.style.left=SimileAjax.WindowManager._ghostCoords.left+"px";
-ghostElmt.style.top=SimileAjax.WindowManager._ghostCoords.top+"px";
-if(SimileAjax.WindowManager._draggingModeIndicatorElmt!=null){
-var indicatorElmt=SimileAjax.WindowManager._draggingModeIndicatorElmt;
-
-indicatorElmt.style.left=(SimileAjax.WindowManager._ghostCoords.left-16)+"px";
-indicatorElmt.style.top=SimileAjax.WindowManager._ghostCoords.top+"px";
-}
-
-if("droppable"in callback&&callback.droppable){
-var coords=SimileAjax.DOM.getEventPageCoordinates(evt);
-var target=SimileAjax.DOM.hittest(
-coords.x,coords.y,
-[SimileAjax.WindowManager._ghostElmt,
-SimileAjax.WindowManager._dropTargetHighlightElement
-]
-);
-target=SimileAjax.WindowManager._findDropTarget(target);
-
-if(target!=SimileAjax.WindowManager._potentialDropTarget){
-if(SimileAjax.WindowManager._dropTargetHighlightElement!=null){
-document.body.removeChild(SimileAjax.WindowManager._dropTargetHighlightElement);
-
-SimileAjax.WindowManager._dropTargetHighlightElement=null;
-SimileAjax.WindowManager._potentialDropTarget=null;
-}
-
-var droppable=false;
-if(target!=null){
-if((!("canDropOn"in callback)||callback.canDropOn(target))&&
-(!("canDrop"in target)||target.canDrop(SimileAjax.WindowManager._draggedElement))){
-
-droppable=true;
-}
-}
-
-if(droppable){
-var border=4;
-var targetCoords=SimileAjax.DOM.getPageCoordinates(target);
-var highlight=document.createElement("div");
-highlight.style.border=border+"px solid yellow";
-highlight.style.backgroundColor="yellow";
-highlight.style.position="absolute";
-highlight.style.left=targetCoords.left+"px";
-highlight.style.top=targetCoords.top+"px";
-highlight.style.width=(target.offsetWidth-border*2)+"px";
-highlight.style.height=(target.offsetHeight-border*2)+"px";
-SimileAjax.Graphics.setOpacity(highlight,30);
-document.body.appendChild(highlight);
-
-SimileAjax.WindowManager._potentialDropTarget=target;
-SimileAjax.WindowManager._dropTargetHighlightElement=highlight;
-}
-}
-}
-}
-}catch(e){
-SimileAjax.Debug.exception("WindowManager: Error handling mouse move",e);
-SimileAjax.WindowManager._cancelDragging();
-}
-}
-
-SimileAjax.DOM.cancelEvent(evt);
-return false;
-}
-};
-
-SimileAjax.WindowManager._onBodyMouseUp=function(elmt,evt,target){
-if(SimileAjax.WindowManager._draggedElement!=null){
-try{
-if(SimileAjax.WindowManager._dragging){
-var callback=SimileAjax.WindowManager._draggedElementCallback;
-if("onDragEnd"in callback){
-callback.onDragEnd();
-}
-if("droppable"in callback&&callback.droppable){
-var dropped=false;
-
-var target=SimileAjax.WindowManager._potentialDropTarget;
-if(target!=null){
-if((!("canDropOn"in callback)||callback.canDropOn(target))&&
-(!("canDrop"in target)||target.canDrop(SimileAjax.WindowManager._draggedElement))){
-
-if("onDropOn"in callback){
-callback.onDropOn(target);
-}
-target.ondrop(SimileAjax.WindowManager._draggedElement,SimileAjax.WindowManager._draggingMode);
-
-dropped=true;
-}
-}
-
-if(!dropped){
-
-}
-}
-}
-}finally{
-SimileAjax.WindowManager._cancelDragging();
-}
-
-SimileAjax.DOM.cancelEvent(evt);
-return false;
-}
-};
-
-SimileAjax.WindowManager._cancelDragging=function(){
-var callback=SimileAjax.WindowManager._draggedElementCallback;
-if("_ghostElmt"in callback){
-var ghostElmt=callback._ghostElmt;
-document.body.removeChild(ghostElmt);
-
-delete callback._ghostElmt;
-}
-if(SimileAjax.WindowManager._dropTargetHighlightElement!=null){
-document.body.removeChild(SimileAjax.WindowManager._dropTargetHighlightElement);
-SimileAjax.WindowManager._dropTargetHighlightElement=null;
-}
-if(SimileAjax.WindowManager._draggingModeIndicatorElmt!=null){
-document.body.removeChild(SimileAjax.WindowManager._draggingModeIndicatorElmt);
-SimileAjax.WindowManager._draggingModeIndicatorElmt=null;
-}
-
-SimileAjax.WindowManager._draggedElement=null;
-SimileAjax.WindowManager._draggedElementCallback=null;
-SimileAjax.WindowManager._potentialDropTarget=null;
-SimileAjax.WindowManager._dropTargetHighlightElement=null;
-SimileAjax.WindowManager._lastCoords=null;
-SimileAjax.WindowManager._ghostCoords=null;
-SimileAjax.WindowManager._draggingMode="";
-SimileAjax.WindowManager._dragging=false;
-};
-
-SimileAjax.WindowManager._findDropTarget=function(elmt){
-while(elmt!=null){
-if("ondrop"in elmt&&(typeof elmt.ondrop)=="function"){
-break;
-}
-elmt=elmt.parentNode;
-}
-return elmt;
-};
-
-
-/* xmlhttp.js */
-
-
-
-SimileAjax.XmlHttp=new Object();
-
-
-SimileAjax.XmlHttp._onReadyStateChange=function(xmlhttp,fError,fDone){
-switch(xmlhttp.readyState){
-
-
-
-
-
-case 4:
-try{
-if(xmlhttp.status==0
-||xmlhttp.status==200
-){
-if(fDone){
-fDone(xmlhttp);
-}
-}else{
-if(fError){
-fError(
-xmlhttp.statusText,
-xmlhttp.status,
-xmlhttp
-);
-}
-}
-}catch(e){
-SimileAjax.Debug.exception("XmlHttp: Error handling onReadyStateChange",e);
-}
-break;
-}
-};
-
-
-SimileAjax.XmlHttp._createRequest=function(){
-if(SimileAjax.Platform.browser.isIE){
-var programIDs=[
-"Msxml2.XMLHTTP",
-"Microsoft.XMLHTTP",
-"Msxml2.XMLHTTP.4.0"
-];
-for(var i=0;i<programIDs.length;i++){
-try{
-var programID=programIDs[i];
-var f=function(){
-return new ActiveXObject(programID);
-};
-var o=f();
-
-
-
-
-
-
-SimileAjax.XmlHttp._createRequest=f;
-
-return o;
-}catch(e){
-
-}
-}
-
-}
-
-try{
-var f=function(){
-return new XMLHttpRequest();
-};
-var o=f();
-
-
-
-
-
-
-SimileAjax.XmlHttp._createRequest=f;
-
-return o;
-}catch(e){
-throw new Error("Failed to create an XMLHttpRequest object");
-}
-};
-
-
-SimileAjax.XmlHttp.get=function(url,fError,fDone){
-var xmlhttp=SimileAjax.XmlHttp._createRequest();
-
-xmlhttp.open("GET",url,true);
-xmlhttp.onreadystatechange=function(){
-SimileAjax.XmlHttp._onReadyStateChange(xmlhttp,fError,fDone);
-};
-xmlhttp.send(null);
-};
-
-
-SimileAjax.XmlHttp.post=function(url,body,fError,fDone){
-var xmlhttp=SimileAjax.XmlHttp._createRequest();
-
-xmlhttp.open("POST",url,true);
-xmlhttp.onreadystatechange=function(){
-SimileAjax.XmlHttp._onReadyStateChange(xmlhttp,fError,fDone);
-};
-xmlhttp.send(body);
-};
-
-SimileAjax.XmlHttp._forceXML=function(xmlhttp){
-try{
-xmlhttp.overrideMimeType("text/xml");
-}catch(e){
-xmlhttp.setrequestheader("Content-Type","text/xml");
-}
-};
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/geochrono-api.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/geochrono-api.js
deleted file mode 100644
index b16a2c3..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/geochrono-api.js
+++ /dev/null
@@ -1,92 +0,0 @@
-/*==================================================
- * Geochrono Extension
- *
- * This file will load all the Javascript files
- * necessary to make the extension work.
- *
- *==================================================
- */
-
-(function() {
- var javascriptFiles = [
- "geochrono.js",
- "units.js",
- "ether-painters.js",
- "labellers.js"
- ];
- var cssFiles = [
- ];
-
- var localizedJavascriptFiles = [
- "labellers.js"
- ];
- var localizedCssFiles = [
- ];
-
- // ISO-639 language codes, ISO-3166 country codes (2 characters)
- var supportedLocales = [
- "en" // English
- ];
-
- try {
- var includeJavascriptFile = function(filename) {
- document.write("<script src='" + Timeline.urlPrefix + "ext/geochrono/scripts/" + filename + "' type='text/javascript'></script>");
- };
- var includeCssFile = function(filename) {
- document.write("<link rel='stylesheet' href='" + Timeline.urlPrefix + "ext/geochrono/styles/" + filename + "' type='text/css'/>");
- }
-
- /*
- * Include non-localized files
- */
- for (var i = 0; i < javascriptFiles.length; i++) {
- includeJavascriptFile(javascriptFiles[i]);
- }
- for (var i = 0; i < cssFiles.length; i++) {
- includeCssFile(cssFiles[i]);
- }
-
- /*
- * Include localized files
- */
- var loadLocale = [];
- var tryExactLocale = function(locale) {
- for (var l = 0; l < supportedLocales.length; l++) {
- if (locale == supportedLocales[l]) {
- loadLocale[locale] = true;
- return true;
- }
- }
- return false;
- }
- var tryLocale = function(locale) {
- if (tryExactLocale(locale)) {
- return locale;
- }
-
- var dash = locale.indexOf("-");
- if (dash > 0 && tryExactLocale(locale.substr(0, dash))) {
- return locale.substr(0, dash);
- }
-
- return null;
- }
-
- tryLocale(Timeline.serverLocale);
- tryLocale(Timeline.clientLocale);
-
- for (var l = 0; l < supportedLocales.length; l++) {
- var locale = supportedLocales[l];
- if (loadLocale[locale]) {
- for (var i = 0; i < localizedJavascriptFiles.length; i++) {
- includeJavascriptFile("l10n/" + locale + "/" + localizedJavascriptFiles[i]);
- }
- for (var i = 0; i < localizedCssFiles.length; i++) {
- includeCssFile("l10n/" + locale + "/" + localizedCssFiles[i]);
- }
- }
- }
- } catch (e) {
- alert(e);
- }
-})();
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/scripts/ether-painters.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/scripts/ether-painters.js
deleted file mode 100644
index c9c0453..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/scripts/ether-painters.js
+++ /dev/null
@@ -1,204 +0,0 @@
-/*==================================================
- * Geochrono Ether Painter
- *==================================================
- */
-
-Timeline.GeochronoEtherPainter = function(params, band, timeline) {
- this._params = params;
- this._intervalUnit = params.intervalUnit;
- this._multiple = ("multiple" in params) ? params.multiple : 1;
- this._theme = params.theme;
-};
-
-Timeline.GeochronoEtherPainter.prototype.initialize = function(band, timeline) {
- this._band = band;
- this._timeline = timeline;
-
- this._backgroundLayer = band.createLayerDiv(0);
- this._backgroundLayer.setAttribute("name", "ether-background"); // for debugging
- this._backgroundLayer.style.background = this._theme.ether.backgroundColors[band.getIndex()];
-
- this._markerLayer = null;
- this._lineLayer = null;
-
- var align = ("align" in this._params && typeof this._params.align == "string") ? this._params.align :
- this._theme.ether.interval.marker[timeline.isHorizontal() ? "hAlign" : "vAlign"];
- var showLine = ("showLine" in this._params) ? this._params.showLine :
- this._theme.ether.interval.line.show;
-
- this._intervalMarkerLayout = new Timeline.GeochronoEtherMarkerLayout(
- this._timeline, this._band, this._theme, align, showLine);
-
- this._highlight = new Timeline.EtherHighlight(
- this._timeline, this._band, this._theme, this._backgroundLayer);
-}
-
-Timeline.GeochronoEtherPainter.prototype.setHighlight = function(startDate, endDate) {
- this._highlight.position(startDate, endDate);
-}
-
-Timeline.GeochronoEtherPainter.prototype.paint = function() {
- if (this._markerLayer) {
- this._band.removeLayerDiv(this._markerLayer);
- }
- this._markerLayer = this._band.createLayerDiv(100);
- this._markerLayer.setAttribute("name", "ether-markers"); // for debugging
- this._markerLayer.style.display = "none";
-
- if (this._lineLayer) {
- this._band.removeLayerDiv(this._lineLayer);
- }
- this._lineLayer = this._band.createLayerDiv(1);
- this._lineLayer.setAttribute("name", "ether-lines"); // for debugging
- this._lineLayer.style.display = "none";
-
- var minDate = Math.ceil(Timeline.GeochronoUnit.toNumber(this._band.getMinDate()));
- var maxDate = Math.floor(Timeline.GeochronoUnit.toNumber(this._band.getMaxDate()));
-
- var increment;
- var hasMore;
- (function(intervalUnit, multiple) {
- var dates;
-
- switch (intervalUnit) {
- case Timeline.GeochronoUnit.AGE:
- dates = Timeline.Geochrono.ages; break;
- case Timeline.GeochronoUnit.EPOCH:
- dates = Timeline.Geochrono.epoches; break;
- case Timeline.GeochronoUnit.PERIOD:
- dates = Timeline.Geochrono.periods; break;
- case Timeline.GeochronoUnit.ERA:
- dates = Timeline.Geochrono.eras; break;
- case Timeline.GeochronoUnit.EON:
- dates = Timeline.Geochrono.eons; break;
- default:
- hasMore = function() {
- return minDate > 0 && minDate > maxDate;
- }
- increment = function() {
- minDate -= multiple;
- };
- return;
- }
-
- var startIndex = dates.length - 1;
- while (startIndex > 0) {
- if (minDate <= dates[startIndex].start) {
- break;
- }
- startIndex--;
- }
-
- minDate = dates[startIndex].start;
- hasMore = function() {
- return startIndex < (dates.length - 1) && minDate > maxDate;
- };
- increment = function() {
- startIndex++;
- minDate = dates[startIndex].start;
- };
- })(this._intervalUnit, this._multiple);
-
- var labeller = this._band.getLabeller();
- while (true) {
- this._intervalMarkerLayout.createIntervalMarker(
- Timeline.GeochronoUnit.fromNumber(minDate),
- labeller,
- this._intervalUnit,
- this._markerLayer,
- this._lineLayer
- );
- if (hasMore()) {
- increment();
- } else {
- break;
- }
- }
- this._markerLayer.style.display = "block";
- this._lineLayer.style.display = "block";
-};
-
-Timeline.GeochronoEtherPainter.prototype.softPaint = function() {
-};
-
-
-/*==================================================
- * Geochrono Ether Marker Layout
- *==================================================
- */
-
-Timeline.GeochronoEtherMarkerLayout = function(timeline, band, theme, align, showLine) {
- var horizontal = timeline.isHorizontal();
- if (horizontal) {
- if (align == "Top") {
- this.positionDiv = function(div, offset) {
- div.style.left = offset + "px";
- div.style.top = "0px";
- };
- } else {
- this.positionDiv = function(div, offset) {
- div.style.left = offset + "px";
- div.style.bottom = "0px";
- };
- }
- } else {
- if (align == "Left") {
- this.positionDiv = function(div, offset) {
- div.style.top = offset + "px";
- div.style.left = "0px";
- };
- } else {
- this.positionDiv = function(div, offset) {
- div.style.top = offset + "px";
- div.style.right = "0px";
- };
- }
- }
-
- var markerTheme = theme.ether.interval.marker;
- var lineTheme = theme.ether.interval.line;
-
- var stylePrefix = (horizontal ? "h" : "v") + align;
- var labelStyler = markerTheme[stylePrefix + "Styler"];
- var emphasizedLabelStyler = markerTheme[stylePrefix + "EmphasizedStyler"];
-
- this.createIntervalMarker = function(date, labeller, unit, markerDiv, lineDiv) {
- var offset = Math.round(band.dateToPixelOffset(date));
-
- if (showLine) {
- var divLine = timeline.getDocument().createElement("div");
- divLine.style.position = "absolute";
-
- if (lineTheme.opacity < 100) {
- SimileAjax.Graphics.setOpacity(divLine, lineTheme.opacity);
- }
-
- if (horizontal) {
- divLine.style.borderLeft = "1px solid " + lineTheme.color;
- divLine.style.left = offset + "px";
- divLine.style.width = "1px";
- divLine.style.top = "0px";
- divLine.style.height = "100%";
- } else {
- divLine.style.borderTop = "1px solid " + lineTheme.color;
- divLine.style.top = offset + "px";
- divLine.style.height = "1px";
- divLine.style.left = "0px";
- divLine.style.width = "100%";
- }
- lineDiv.appendChild(divLine);
- }
-
- var label = labeller.labelInterval(date, unit);
-
- var div = timeline.getDocument().createElement("div");
- div.innerHTML = label.text;
- div.style.position = "absolute";
- (label.emphasized ? emphasizedLabelStyler : labelStyler)(div);
-
- this.positionDiv(div, offset);
- markerDiv.appendChild(div);
-
- return div;
- };
-};
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/scripts/geochrono.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/scripts/geochrono.js
deleted file mode 100644
index dc9716a..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/scripts/geochrono.js
+++ /dev/null
@@ -1,518 +0,0 @@
-/*==================================================
- * Geochrono
- *==================================================
- */
-Timeline.Geochrono = new Object();
-Timeline.Geochrono.eons = [
- { name: "Proterozoic",
- start: 2500.000
- },
- { name: "Phanerozoic",
- start: 542.000
- }
-];
-Timeline.Geochrono.eras = [
- { name: "Paleoarchean",
- start: 3600.000
- },
- { name: "Mesoarchean",
- start: 3200.000
- },
- { name: "Neoarchean",
- start: 2800.000
- },
- { name: "Paleoproterozoic",
- start: 2500.000
- },
- { name: "Mesoproterozoic",
- start: 1600.000
- },
- { name: "Neoproterozoic",
- start: 1000.000
- },
- { name: "Paleozoic",
- start: 542.000
- },
- { name: "Mesozoic",
- start: 251.000
- },
- { name: "Cenozoic",
- start: 65.500
- }
-];
-Timeline.Geochrono.periods = [
- { name: "Siderian",
- start: 2500.000
- },
- { name: "Rhyacian",
- start: 2300.000
- },
- { name: "Orosirian",
- start: 2050.000
- },
- { name: "Statherian",
- start: 1800.000
- },
- { name: "Calymmian",
- start: 1600.000
- },
- { name: "Ectasian",
- start: 1400.000
- },
- { name: "Stenian",
- start: 1200.000
- },
- { name: "Tonian",
- start: 1000.000
- },
- { name: "Cryogenian",
- start: 850.000
- },
- { name: "Ediacaran",
- start: 600.000
- },
- { name: "Cambrian",
- start: 542.000
- },
- { name: "Ordovician",
- start: 488.300
- },
- { name: "Silurian",
- start: 443.700
- },
- { name: "Devonian",
- start: 416.000
- },
- { name: "Carboniferous",
- start: 359.200
- },
- { name: "Permian",
- start: 299.000
- },
- { name: "Triassic",
- start: 251.000
- },
- { name: "Jurassic",
- start: 199.600
- },
- { name: "Cretaceous",
- start: 145.500
- },
- { name: "Paleogene",
- start: 65.500
- },
- { name: "Neogene",
- start: 23.030
- }
-];
-Timeline.Geochrono.epoches = [
- { name: "Lower Cambrian",
- start: 542.000
- },
- { name: "Middle Cambrian",
- start: 513.000
- },
- { name: "Furongian",
- start: 501.000
- },
- { name: "Lower Ordovician",
- start: 488.300
- },
- { name: "Middle Ordovician",
- start: 471.800
- },
- { name: "Upper Ordovician",
- start: 460.900
- },
- { name: "Llandovery",
- start: 443.700
- },
- { name: "Wenlock",
- start: 428.200
- },
- { name: "Ludlow",
- start: 422.900
- },
- { name: "Pridoli",
- start: 418.700
- },
- { name: "Lower Devonian",
- start: 416.000
- },
- { name: "Middle Devonian",
- start: 397.500
- },
- { name: "Upper Devonian",
- start: 385.300
- },
- { name: "Mississippian",
- start: 359.200
- },
- { name: "Pennsylvanian",
- start: 318.100
- },
- { name: "Cisuralian",
- start: 299.000
- },
- { name: "Guadalupian",
- start: 270.600
- },
- { name: "Lopingian",
- start: 260.400
- },
- { name: "Lower Triassic",
- start: 251.000
- },
- { name: "Middle Triassic",
- start: 245.000
- },
- { name: "Upper Triassic",
- start: 228.000
- },
- { name: "Lower Jurassic",
- start: 199.600
- },
- { name: "Middle Jurassic",
- start: 175.600
- },
- { name: "Upper Jurassic",
- start: 161.200
- },
- { name: "Lower Cretaceous",
- start: 145.500
- },
- { name: "Upper Cretaceous",
- start: 99.600
- },
- { name: "Paleocene",
- start: 65.500
- },
- { name: "Eocene",
- start: 55.800
- },
- { name: "Oligocene",
- start: 33.900
- },
- { name: "Miocene",
- start: 23.030
- },
- { name: "Pliocene",
- start: 5.332
- },
- { name: "Pleistocene",
- start: 1.806
- },
- { name: "Holocene",
- start: 0.012
- }
-];
-Timeline.Geochrono.ages = [
- { name: "-",
- start: 542.000
- },
- { name: "-",
- start: 513.000
- },
- { name: "Paibian",
- start: 501.000
- },
- { name: "Tremadocian",
- start: 488.300
- },
- { name: "-",
- start: 478.600
- },
- { name: "-",
- start: 471.800
- },
- { name: "Darriwilian",
- start: 468.100
- },
- { name: "-",
- start: 460.900
- },
- { name: "-",
- start: 455.800
- },
- { name: "Hirnantian",
- start: 445.600
- },
- { name: "Rhuddanian",
- start: 443.700
- },
- { name: "Aeronian",
- start: 439.000
- },
- { name: "Telychian",
- start: 436.100
- },
- { name: "Sheinwoodian",
- start: 428.200
- },
- { name: "Homerian",
- start: 426.200
- },
- { name: "Gorstian",
- start: 422.900
- },
- { name: "Ludfordian",
- start: 421.300
- },
- { name: "-",
- start: 418.700
- },
- { name: "Lochkovian",
- start: 416.000
- },
- { name: "Pragian",
- start: 411.200
- },
- { name: "Emsian",
- start: 407.000
- },
- { name: "Eifelian",
- start: 397.500
- },
- { name: "Givetian",
- start: 391.800
- },
- { name: "Frasnian",
- start: 385.300
- },
- { name: "Famennian",
- start: 374.500
- },
- { name: "Tournaisian",
- start: 359.200
- },
- { name: "Visean",
- start: 345.300
- },
- { name: "Serpukhovian",
- start: 326.400
- },
- { name: "Bashkirian",
- start: 318.100
- },
- { name: "Moscovian",
- start: 311.700
- },
- { name: "Kazimovian",
- start: 306.500
- },
- { name: "Gzhelian",
- start: 303.900
- },
- { name: "Asselian",
- start: 299.000
- },
- { name: "Sakmarian",
- start: 294.600
- },
- { name: "Artinskian",
- start: 284.400
- },
- { name: "Kungurian",
- start: 275.600
- },
- { name: "Roadian",
- start: 270.600
- },
- { name: "Wordian",
- start: 268.000
- },
- { name: "Capitanian",
- start: 265.800
- },
- { name: "Wuchiapingian",
- start: 260.400
- },
- { name: "Changhsingian",
- start: 253.800
- },
- { name: "Induan",
- start: 251.000
- },
- { name: "Olenekian",
- start: 249.700
- },
- { name: "Anisian",
- start: 245.000
- },
- { name: "Ladinian",
- start: 237.000
- },
- { name: "Carnian",
- start: 228.000
- },
- { name: "Norian",
- start: 216.500
- },
- { name: "Rhaetian",
- start: 203.600
- },
- { name: "Hettangian",
- start: 199.600
- },
- { name: "Sinemurian",
- start: 196.500
- },
- { name: "Pliensbachian",
- start: 189.600
- },
- { name: "Toarcian",
- start: 183.000
- },
- { name: "Aalenian",
- start: 175.600
- },
- { name: "Bajocian",
- start: 171.600
- },
- { name: "Bathonian",
- start: 167.700
- },
- { name: "Callovian",
- start: 164.700
- },
- { name: "Oxfordian",
- start: 161.200
- },
- { name: "Kimmeridgian",
- start: 155.000
- },
- { name: "Tithonian",
- start: 150.800
- },
- { name: "Berriasian",
- start: 145.500
- },
- { name: "Valanginian",
- start: 140.200
- },
- { name: "Hauterivian",
- start: 136.400
- },
- { name: "Barremian",
- start: 130.000
- },
- { name: "Aptian",
- start: 125.000
- },
- { name: "Albian",
- start: 112.000
- },
- { name: "Cenomanian",
- start: 99.600
- },
- { name: "Turonian",
- start: 93.500
- },
- { name: "Coniacian",
- start: 89.300
- },
- { name: "Santonian",
- start: 85.800
- },
- { name: "Campanian",
- start: 83.500
- },
- { name: "Maastrichtian",
- start: 70.600
- },
- { name: "Danian",
- start: 65.500
- },
- { name: "Selandian",
- start: 61.700
- },
- { name: "Thanetian",
- start: 58.700
- },
- { name: "Ypresian",
- start: 55.800
- },
- { name: "Lutetian",
- start: 48.600
- },
- { name: "Bartonian",
- start: 40.400
- },
- { name: "Priabonian",
- start: 37.200
- },
- { name: "Rupelian",
- start: 33.900
- },
- { name: "Chattian",
- start: 28.400
- },
- { name: "Aquitanian",
- start: 23.030
- },
- { name: "Burdigalian",
- start: 20.430
- },
- { name: "Langhian",
- start: 15.970
- },
- { name: "Serravallian",
- start: 13.650
- },
- { name: "Tortonian",
- start: 11.608
- },
- { name: "Messinian",
- start: 7.246
- },
- { name: "Zanclean",
- start: 5.332
- },
- { name: "Piacenzian",
- start: 3.600
- },
- { name: "Gelasian",
- start: 2.588
- }
-];
-
-Timeline.Geochrono.createBandInfo = function(params) {
- var theme = ("theme" in params) ? params.theme : Timeline.getDefaultTheme();
-
- var eventSource = ("eventSource" in params) ? params.eventSource : null;
-
- var ether = new Timeline.LinearEther({
- centersOn: ("date" in params) ? params.date : Timeline.GeochronoUnit.makeDefaultValue(),
- interval: 1,
- pixelsPerInterval: params.intervalPixels
- });
-
- var etherPainter = new Timeline.GeochronoEtherPainter({
- intervalUnit: params.intervalUnit,
- multiple: ("multiple" in params) ? params.multiple : 1,
- align: params.align,
- theme: theme
- });
-
- var eventPainterParams = {
- theme: theme
- };
- if ("trackHeight" in params) {
- eventPainterParams.trackHeight = params.trackHeight;
- }
- if ("trackGap" in params) {
- eventPainterParams.trackGap = params.trackGap;
- }
- var eventPainter = ("overview" in params && params.overview) ?
- new Timeline.OverviewEventPainter(eventPainterParams) :
- new Timeline.DetailedEventPainter(eventPainterParams);
-
- return {
- width: params.width,
- eventSource: eventSource,
- timeZone: ("timeZone" in params) ? params.timeZone : 0,
- ether: ether,
- etherPainter: etherPainter,
- eventPainter: eventPainter
- };
-};
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/scripts/l10n/en/labellers.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/scripts/l10n/en/labellers.js
deleted file mode 100644
index 7e66701..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/scripts/l10n/en/labellers.js
+++ /dev/null
@@ -1,10 +0,0 @@
-/*==================================================
- * Localization of Geochrono Labeller
- *==================================================
- */
-
-Timeline.GeochronoLabeller.eonNames["en"] = Timeline.Geochrono.eons;
-Timeline.GeochronoLabeller.eraNames["en"] = Timeline.Geochrono.eras;
-Timeline.GeochronoLabeller.periodNames["en"] = Timeline.Geochrono.periods;
-Timeline.GeochronoLabeller.epochNames["en"] = Timeline.Geochrono.epoches;
-Timeline.GeochronoLabeller.ageNames["en"] = Timeline.Geochrono.ages;
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/scripts/labellers.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/scripts/labellers.js
deleted file mode 100644
index 3aabd15..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/scripts/labellers.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/*==================================================
- * Geochrono Labeller
- *==================================================
- */
-
-Timeline.GeochronoLabeller = function(locale) {
- this._locale = locale;
-};
-
-Timeline.GeochronoLabeller.eonNames = [];
-Timeline.GeochronoLabeller.eraNames = [];
-Timeline.GeochronoLabeller.periodNames = [];
-Timeline.GeochronoLabeller.epochNames = [];
-Timeline.GeochronoLabeller.ageNames = [];
-
-Timeline.GeochronoLabeller.prototype.labelInterval = function(date, intervalUnit) {
- var n = Timeline.GeochronoUnit.toNumber(date);
- var dates, names;
- switch (intervalUnit) {
- case Timeline.GeochronoUnit.AGE:
- dates = Timeline.Geochrono.ages;
- names = Timeline.GeochronoLabeller.ageNames; break;
- case Timeline.GeochronoUnit.EPOCH:
- dates = Timeline.Geochrono.epoches;
- names = Timeline.GeochronoLabeller.epochNames; break;
- case Timeline.GeochronoUnit.PERIOD:
- dates = Timeline.Geochrono.periods;
- names = Timeline.GeochronoLabeller.periodNames; break;
- case Timeline.GeochronoUnit.ERA:
- dates = Timeline.Geochrono.eras;
- names = Timeline.GeochronoLabeller.eraNames; break;
- case Timeline.GeochronoUnit.EON:
- dates = Timeline.Geochrono.eons;
- names = Timeline.GeochronoLabeller.eonNames; break;
- default:
- return { text: n, emphasized: false };
- }
-
- for (var i = dates.length - 1; i >= 0; i--) {
- if (n <= dates[i].start) {
- return {
- text: names[this._locale][i].name,
- emphasized: n == dates[i].start
- }
- }
- }
- return { text: n, emphasized: false };
-};
-
-Timeline.GeochronoLabeller.prototype.labelPrecise = function(date) {
- return Timeline.GeochronoUnit.toNumber(date) + "ma";
-};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/scripts/units.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/scripts/units.js
deleted file mode 100644
index 86182ff..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/geochrono/scripts/units.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/*==================================================
- * Geochrono Unit
- *==================================================
- */
-
-Timeline.GeochronoUnit = new Object();
-
-Timeline.GeochronoUnit.MA = 0;
-Timeline.GeochronoUnit.AGE = 1;
-Timeline.GeochronoUnit.EPOCH = 2;
-Timeline.GeochronoUnit.PERIOD = 3;
-Timeline.GeochronoUnit.ERA = 4;
-Timeline.GeochronoUnit.EON = 5;
-
-Timeline.GeochronoUnit.getParser = function(format) {
- return Timeline.GeochronoUnit.parseFromObject;
-};
-
-Timeline.GeochronoUnit.createLabeller = function(locale, timeZone) {
- return new Timeline.GeochronoLabeller(locale);
-};
-
-Timeline.GeochronoUnit.wrapMA = function (n) {
- return new Timeline.GeochronoUnit._MA(n);
-};
-
-Timeline.GeochronoUnit.makeDefaultValue = function () {
- return Timeline.GeochronoUnit.wrapMA(0);
-};
-
-Timeline.GeochronoUnit.cloneValue = function (v) {
- return new Timeline.GeochronoUnit._MA(v._n);
-};
-
-Timeline.GeochronoUnit.parseFromObject = function(o) {
- if (o instanceof Timeline.GeochronoUnit._MA) {
- return o;
- } else if (typeof o == "number") {
- return Timeline.GeochronoUnit.wrapMA(o);
- } else if (typeof o == "string" && o.length > 0) {
- return Timeline.GeochronoUnit.wrapMA(Number(o));
- } else {
- return null;
- }
-};
-
-Timeline.GeochronoUnit.toNumber = function(v) {
- return v._n;
-};
-
-Timeline.GeochronoUnit.fromNumber = function(n) {
- return new Timeline.GeochronoUnit._MA(n);
-};
-
-Timeline.GeochronoUnit.compare = function(v1, v2) {
- var n1, n2;
- if (typeof v1 == "object") {
- n1 = v1._n;
- } else {
- n1 = Number(v1);
- }
- if (typeof v2 == "object") {
- n2 = v2._n;
- } else {
- n2 = Number(v2);
- }
-
- return n2 - n1;
-};
-
-Timeline.GeochronoUnit.earlier = function(v1, v2) {
- return Timeline.GeochronoUnit.compare(v1, v2) < 0 ? v1 : v2;
-};
-
-Timeline.GeochronoUnit.later = function(v1, v2) {
- return Timeline.GeochronoUnit.compare(v1, v2) > 0 ? v1 : v2;
-};
-
-Timeline.GeochronoUnit.change = function(v, n) {
- return new Timeline.GeochronoUnit._MA(v._n - n);
-};
-
-Timeline.GeochronoUnit._MA = function(n) {
- this._n = n;
-};
-
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/planning/planning-api.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/planning/planning-api.js
deleted file mode 100644
index 9d92681..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/planning/planning-api.js
+++ /dev/null
@@ -1,92 +0,0 @@
-/*==================================================
- * Planning Extension
- *
- * This file will load all the Javascript files
- * necessary to make the extension work.
- *
- *==================================================
- */
-
-(function() {
- var javascriptFiles = [
- "planning.js",
- "units.js",
- "ether-painters.js",
- "labellers.js"
- ];
- var cssFiles = [
- ];
-
- var localizedJavascriptFiles = [
- "labellers.js"
- ];
- var localizedCssFiles = [
- ];
-
- // ISO-639 language codes, ISO-3166 country codes (2 characters)
- var supportedLocales = [
- "en" // English
- ];
-
- try {
- var includeJavascriptFile = function(filename) {
- document.write("<script src='" + Timeline.urlPrefix + "ext/planning/scripts/" + filename + "' type='text/javascript'></script>");
- };
- var includeCssFile = function(filename) {
- document.write("<link rel='stylesheet' href='" + Timeline.urlPrefix + "ext/planning/styles/" + filename + "' type='text/css'/>");
- }
-
- /*
- * Include non-localized files
- */
- for (var i = 0; i < javascriptFiles.length; i++) {
- includeJavascriptFile(javascriptFiles[i]);
- }
- for (var i = 0; i < cssFiles.length; i++) {
- includeCssFile(cssFiles[i]);
- }
-
- /*
- * Include localized files
- */
- var loadLocale = [];
- var tryExactLocale = function(locale) {
- for (var l = 0; l < supportedLocales.length; l++) {
- if (locale == supportedLocales[l]) {
- loadLocale[locale] = true;
- return true;
- }
- }
- return false;
- }
- var tryLocale = function(locale) {
- if (tryExactLocale(locale)) {
- return locale;
- }
-
- var dash = locale.indexOf("-");
- if (dash > 0 && tryExactLocale(locale.substr(0, dash))) {
- return locale.substr(0, dash);
- }
-
- return null;
- }
-
- tryLocale(Timeline.serverLocale);
- tryLocale(Timeline.clientLocale);
-
- for (var l = 0; l < supportedLocales.length; l++) {
- var locale = supportedLocales[l];
- if (loadLocale[locale]) {
- for (var i = 0; i < localizedJavascriptFiles.length; i++) {
- includeJavascriptFile("l10n/" + locale + "/" + localizedJavascriptFiles[i]);
- }
- for (var i = 0; i < localizedCssFiles.length; i++) {
- includeCssFile("l10n/" + locale + "/" + localizedCssFiles[i]);
- }
- }
- }
- } catch (e) {
- alert(e);
- }
-})();
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/planning/scripts/ether-painters.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/planning/scripts/ether-painters.js
deleted file mode 100644
index 75c2a62..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/planning/scripts/ether-painters.js
+++ /dev/null
@@ -1,176 +0,0 @@
-/*==================================================
- * Planning Ether Painter
- *==================================================
- */
-
-Timeline.PlanningEtherPainter = function(params, band, timeline) {
- this._params = params;
- this._intervalUnit = params.intervalUnit;
- this._multiple = ("multiple" in params) ? params.multiple : 1;
- this._theme = params.theme;
-};
-
-Timeline.PlanningEtherPainter.prototype.initialize = function(band, timeline) {
- this._band = band;
- this._timeline = timeline;
-
- this._backgroundLayer = band.createLayerDiv(0);
- this._backgroundLayer.setAttribute("name", "ether-background"); // for debugging
- this._backgroundLayer.style.background = this._theme.ether.backgroundColors[band.getIndex()];
-
- this._markerLayer = null;
- this._lineLayer = null;
-
- var align = ("align" in this._params && typeof this._params.align == "string") ? this._params.align :
- this._theme.ether.interval.marker[timeline.isHorizontal() ? "hAlign" : "vAlign"];
- var showLine = ("showLine" in this._params) ? this._params.showLine :
- this._theme.ether.interval.line.show;
-
- this._intervalMarkerLayout = new Timeline.PlanningEtherMarkerLayout(
- this._timeline, this._band, this._theme, align, showLine);
-
- this._highlight = new Timeline.EtherHighlight(
- this._timeline, this._band, this._theme, this._backgroundLayer);
-}
-
-Timeline.PlanningEtherPainter.prototype.setHighlight = function(startDate, endDate) {
- this._highlight.position(startDate, endDate);
-}
-
-Timeline.PlanningEtherPainter.prototype.paint = function() {
- if (this._markerLayer) {
- this._band.removeLayerDiv(this._markerLayer);
- }
- this._markerLayer = this._band.createLayerDiv(100);
- this._markerLayer.setAttribute("name", "ether-markers"); // for debugging
- this._markerLayer.style.display = "none";
-
- if (this._lineLayer) {
- this._band.removeLayerDiv(this._lineLayer);
- }
- this._lineLayer = this._band.createLayerDiv(1);
- this._lineLayer.setAttribute("name", "ether-lines"); // for debugging
- this._lineLayer.style.display = "none";
-
- var minDate = Math.max(0, Math.ceil(Timeline.PlanningUnit.toNumber(this._band.getMinDate())));
- var maxDate = Math.floor(Timeline.PlanningUnit.toNumber(this._band.getMaxDate()));
-
- var hasMore = function() {
- return minDate < maxDate;
- };
- var change = 1;
- var multiple = this._multiple;
- switch (this._intervalUnit) {
- case Timeline.PlanningUnit.DAY: change = 1; break;
- case Timeline.PlanningUnit.WEEK: change = 7; break;
- case Timeline.PlanningUnit.MONTH: change = 28; break;
- case Timeline.PlanningUnit.QUARTER: change = 28 * 3; break;
- case Timeline.PlanningUnit.YEAR: change = 28 * 12; break;
- }
- var increment = function() {
- minDate += change * multiple;
- };
-
- var labeller = this._band.getLabeller();
- while (true) {
- this._intervalMarkerLayout.createIntervalMarker(
- Timeline.PlanningUnit.fromNumber(minDate),
- labeller,
- this._intervalUnit,
- this._markerLayer,
- this._lineLayer
- );
- if (hasMore()) {
- increment();
- } else {
- break;
- }
- }
- this._markerLayer.style.display = "block";
- this._lineLayer.style.display = "block";
-};
-
-Timeline.PlanningEtherPainter.prototype.softPaint = function() {
-};
-
-
-/*==================================================
- * Planning Ether Marker Layout
- *==================================================
- */
-
-Timeline.PlanningEtherMarkerLayout = function(timeline, band, theme, align, showLine) {
- var horizontal = timeline.isHorizontal();
- if (horizontal) {
- if (align == "Top") {
- this.positionDiv = function(div, offset) {
- div.style.left = offset + "px";
- div.style.top = "0px";
- };
- } else {
- this.positionDiv = function(div, offset) {
- div.style.left = offset + "px";
- div.style.bottom = "0px";
- };
- }
- } else {
- if (align == "Left") {
- this.positionDiv = function(div, offset) {
- div.style.top = offset + "px";
- div.style.left = "0px";
- };
- } else {
- this.positionDiv = function(div, offset) {
- div.style.top = offset + "px";
- div.style.right = "0px";
- };
- }
- }
-
- var markerTheme = theme.ether.interval.marker;
- var lineTheme = theme.ether.interval.line;
-
- var stylePrefix = (horizontal ? "h" : "v") + align;
- var labelStyler = markerTheme[stylePrefix + "Styler"];
- var emphasizedLabelStyler = markerTheme[stylePrefix + "EmphasizedStyler"];
-
- this.createIntervalMarker = function(date, labeller, unit, markerDiv, lineDiv) {
- var offset = Math.round(band.dateToPixelOffset(date));
-
- if (showLine) {
- var divLine = timeline.getDocument().createElement("div");
- divLine.style.position = "absolute";
-
- if (lineTheme.opacity < 100) {
- Timeline.Graphics.setOpacity(divLine, lineTheme.opacity);
- }
-
- if (horizontal) {
- divLine.style.borderLeft = "1px solid " + lineTheme.color;
- divLine.style.left = offset + "px";
- divLine.style.width = "1px";
- divLine.style.top = "0px";
- divLine.style.height = "100%";
- } else {
- divLine.style.borderTop = "1px solid " + lineTheme.color;
- divLine.style.top = offset + "px";
- divLine.style.height = "1px";
- divLine.style.left = "0px";
- divLine.style.width = "100%";
- }
- lineDiv.appendChild(divLine);
- }
-
- var label = labeller.labelInterval(date, unit);
-
- var div = timeline.getDocument().createElement("div");
- div.innerHTML = label.text;
- div.style.position = "absolute";
- (label.emphasized ? emphasizedLabelStyler : labelStyler)(div);
-
- this.positionDiv(div, offset);
- markerDiv.appendChild(div);
-
- return div;
- };
-};
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/planning/scripts/l10n/en/labellers.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/planning/scripts/l10n/en/labellers.js
deleted file mode 100644
index cdbac8c..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/planning/scripts/l10n/en/labellers.js
+++ /dev/null
@@ -1,12 +0,0 @@
-/*==================================================
- * Localization of Planning Labeller
- *==================================================
- */
-
-Timeline.PlanningLabeller.labels["en"] = {
- dayPrefix: "d",
- weekPrefix: "w",
- monthPrefix: "m",
- quarterPrefix: "q",
- yearPrefix: "y"
-};
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/planning/scripts/labellers.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/planning/scripts/labellers.js
deleted file mode 100644
index 46e5a69..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/planning/scripts/labellers.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/*==================================================
- * Planning Labeller
- *==================================================
- */
-
-Timeline.PlanningLabeller = function(locale) {
- this._locale = locale;
-};
-
-Timeline.PlanningLabeller.labels = [];
-
-Timeline.PlanningLabeller.prototype.labelInterval = function(date, intervalUnit) {
- var n = Timeline.PlanningUnit.toNumber(date);
-
- var prefix = "";
- var divider = 1;
- var divider2 = 7;
- var labels = Timeline.PlanningLabeller.labels[this._locale];
-
- switch (intervalUnit) {
- case Timeline.PlanningUnit.DAY: prefix = labels.dayPrefix; break;
- case Timeline.PlanningUnit.WEEK: prefix = labels.weekPrefix; divider = 7; divider2 = divider * 4; break;
- case Timeline.PlanningUnit.MONTH: prefix = labels.monthPrefix; divider = 28; divider2 = divider * 3; break;
- case Timeline.PlanningUnit.QUARTER: prefix = labels.quarterPrefix; divider = 28 * 3; divider2 = divider * 4; break;
- case Timeline.PlanningUnit.YEAR: prefix = labels.yearPrefix; divider = 28 * 12; divider2 = divider * 5; break;
- }
- return { text: prefix + Math.floor(n / divider), emphasized: (n % divider2) == 0 };
-};
-
-Timeline.PlanningLabeller.prototype.labelPrecise = function(date) {
- return Timeline.PlanningLabeller.labels[this._locale].dayPrefix +
- Timeline.PlanningUnit.toNumber(date);
-};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/planning/scripts/planning.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/planning/scripts/planning.js
deleted file mode 100644
index 4201f92..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/planning/scripts/planning.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/*==================================================
- * Planning
- *==================================================
- */
-
-Timeline.Planning = new Object();
-
-Timeline.Planning.createBandInfo = function(params) {
- var theme = ("theme" in params) ? params.theme : Timeline.getDefaultTheme();
-
- var eventSource = ("eventSource" in params) ? params.eventSource : null;
-
- var ether = new Timeline.LinearEther({
- centersOn: ("date" in params) ? params.date : Timeline.PlanningUnit.makeDefaultValue(),
- interval: 1,
- pixelsPerInterval: params.intervalPixels
- });
-
- var etherPainter = new Timeline.PlanningEtherPainter({
- intervalUnit: params.intervalUnit,
- multiple: ("multiple" in params) ? params.multiple : 1,
- align: params.align,
- theme: theme
- });
-
- var eventPainterParams = {
- theme: theme
- };
- if ("trackHeight" in params) {
- eventPainterParams.trackHeight = params.trackHeight;
- }
- if ("trackGap" in params) {
- eventPainterParams.trackGap = params.trackGap;
- }
- var eventPainter = ("overview" in params && params.overview) ?
- new Timeline.OverviewEventPainter(eventPainterParams) :
- new Timeline.DetailedEventPainter(eventPainterParams);
-
- return {
- width: params.width,
- eventSource: eventSource,
- timeZone: ("timeZone" in params) ? params.timeZone : 0,
- ether: ether,
- etherPainter: etherPainter,
- eventPainter: eventPainter
- };
-};
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/planning/scripts/units.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/planning/scripts/units.js
deleted file mode 100644
index 13c31c1..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/ext/planning/scripts/units.js
+++ /dev/null
@@ -1,66 +0,0 @@
-/*==================================================
- * Planning Unit
- *==================================================
- */
-
-Timeline.PlanningUnit = new Object();
-
-Timeline.PlanningUnit.DAY = 0;
-Timeline.PlanningUnit.WEEK = 1;
-Timeline.PlanningUnit.MONTH = 2;
-Timeline.PlanningUnit.QUARTER = 3;
-Timeline.PlanningUnit.YEAR = 4;
-
-Timeline.PlanningUnit.getParser = function(format) {
- return Timeline.PlanningUnit.parseFromObject;
-};
-
-Timeline.PlanningUnit.createLabeller = function(locale, timeZone) {
- return new Timeline.PlanningLabeller(locale);
-};
-
-Timeline.PlanningUnit.makeDefaultValue = function () {
- return 0;
-};
-
-Timeline.PlanningUnit.cloneValue = function (v) {
- return v;
-};
-
-Timeline.PlanningUnit.parseFromObject = function(o) {
- if (o == null) {
- return null;
- } else if (typeof o == "number") {
- return o;
- } else {
- try {
- return parseInt(o);
- } catch (e) {
- return null;
- }
- }
-};
-
-Timeline.PlanningUnit.toNumber = function(v) {
- return v
-};
-
-Timeline.PlanningUnit.fromNumber = function(n) {
- return n;
-};
-
-Timeline.PlanningUnit.compare = function(v1, v2) {
- return v1 - v2;
-};
-
-Timeline.PlanningUnit.earlier = function(v1, v2) {
- return Timeline.PlanningUnit.compare(v1, v2) < 0 ? v1 : v2;
-};
-
-Timeline.PlanningUnit.later = function(v1, v2) {
- return Timeline.PlanningUnit.compare(v1, v2) > 0 ? v1 : v2;
-};
-
-Timeline.PlanningUnit.change = function(v, n) {
- return v + n;
-};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/blue-circle.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/blue-circle.png
deleted file mode 100644
index 9ef045c..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/blue-circle.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-bottom-arrow.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-bottom-arrow.png
deleted file mode 100644
index 38c3917..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-bottom-arrow.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-bottom-left.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-bottom-left.png
deleted file mode 100644
index 6d32026..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-bottom-left.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-bottom-right.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-bottom-right.png
deleted file mode 100644
index e5dc136..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-bottom-right.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-bottom.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-bottom.png
deleted file mode 100644
index 166b057..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-bottom.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-left-arrow.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-left-arrow.png
deleted file mode 100644
index 5b173cd..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-left-arrow.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-left.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-left.png
deleted file mode 100644
index 3826722..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-left.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-right-arrow.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-right-arrow.png
deleted file mode 100644
index 11e2873..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-right-arrow.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-right.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-right.png
deleted file mode 100644
index f66f879..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-right.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-top-arrow.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-top-arrow.png
deleted file mode 100644
index 524c46e..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-top-arrow.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-top-left.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-top-left.png
deleted file mode 100644
index d69841f..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-top-left.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-top-right.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-top-right.png
deleted file mode 100644
index 9ab219a..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-top-right.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-top.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-top.png
deleted file mode 100644
index 917defa..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/bubble-top.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/close-button.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/close-button.png
deleted file mode 100644
index 15f31b3..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/close-button.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/copyright-vertical.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/copyright-vertical.png
deleted file mode 100644
index b15197b..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/copyright-vertical.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/copyright.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/copyright.png
deleted file mode 100644
index bcf69c6..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/copyright.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/dark-blue-circle.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/dark-blue-circle.png
deleted file mode 100644
index 2747397..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/dark-blue-circle.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/dark-green-circle.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/dark-green-circle.png
deleted file mode 100644
index 903f9fd..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/dark-green-circle.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/dark-red-circle.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/dark-red-circle.png
deleted file mode 100644
index 5cbb085..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/dark-red-circle.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/dull-blue-circle.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/dull-blue-circle.png
deleted file mode 100644
index 19dd0da..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/dull-blue-circle.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/dull-green-circle.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/dull-green-circle.png
deleted file mode 100644
index eecf665..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/dull-green-circle.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/dull-red-circle.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/dull-red-circle.png
deleted file mode 100644
index 2ff0111..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/dull-red-circle.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/gray-circle.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/gray-circle.png
deleted file mode 100644
index 39360d7..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/gray-circle.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/green-circle.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/green-circle.png
deleted file mode 100644
index a5fc15c..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/green-circle.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/message-bottom-left.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/message-bottom-left.png
deleted file mode 100644
index 43a9d61..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/message-bottom-left.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/message-bottom-right.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/message-bottom-right.png
deleted file mode 100644
index bfa4954..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/message-bottom-right.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/message-left.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/message-left.png
deleted file mode 100644
index f354376..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/message-left.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/message-right.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/message-right.png
deleted file mode 100644
index 4702c28..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/message-right.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/message-top-left.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/message-top-left.png
deleted file mode 100644
index b19b0ea..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/message-top-left.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/message-top-right.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/message-top-right.png
deleted file mode 100644
index c092555..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/message-top-right.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/progress-running.gif b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/progress-running.gif
deleted file mode 100644
index f7429eb..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/progress-running.gif and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/red-circle.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/red-circle.png
deleted file mode 100644
index d56e734..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/red-circle.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/top-bubble.png b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/top-bubble.png
deleted file mode 100644
index db6c93d..0000000
Binary files a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/images/top-bubble.png and /dev/null differ
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/decorators.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/decorators.js
deleted file mode 100644
index ec1f193..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/decorators.js
+++ /dev/null
@@ -1,175 +0,0 @@
-/*==================================================
- * Span Highlight Decorator
- *==================================================
- */
-
-Timeline.SpanHighlightDecorator = function(params) {
- this._unit = ("unit" in params) ? params.unit : SimileAjax.NativeDateUnit;
- this._startDate = (typeof params.startDate == "string") ?
- this._unit.parseFromObject(params.startDate) : params.startDate;
- this._endDate = (typeof params.endDate == "string") ?
- this._unit.parseFromObject(params.endDate) : params.endDate;
- this._startLabel = params.startLabel;
-
- this._endLabel = params.endLabel;
- this._color = params.color;
- this._cssClass = ("cssClass" in params) ? params.cssClass : null;
- this._opacity = ("opacity" in params) ? params.opacity : 100;
-};
-
-Timeline.SpanHighlightDecorator.prototype.initialize = function(band, timeline) {
- this._band = band;
- this._timeline = timeline;
-
- this._layerDiv = null;
-};
-
-Timeline.SpanHighlightDecorator.prototype.paint = function() {
- if (this._layerDiv != null) {
- this._band.removeLayerDiv(this._layerDiv);
- }
- this._layerDiv = this._band.createLayerDiv(10);
- this._layerDiv.setAttribute("name", "span-highlight-decorator"); // for debugging
- this._layerDiv.style.display = "none";
-
-
- var minDate = this._band.getMinDate();
- var maxDate = this._band.getMaxDate();
-
- if (this._unit.compare(this._startDate, maxDate) < 0 &&
- this._unit.compare(this._endDate, minDate) > 0) {
-
- minDate = this._unit.later(minDate, this._startDate);
- maxDate = this._unit.earlier(maxDate, this._endDate);
-
- var minPixel = this._band.dateToPixelOffset(minDate);
- var maxPixel = this._band.dateToPixelOffset(maxDate);
-
- var doc = this._timeline.getDocument();
-
- var createTable = function() {
- var table = doc.createElement("table");
- table.insertRow(0).insertCell(0);
- return table;
- };
-
- var div = doc.createElement("div");
- div.className='timeline-highlight-decorator'
- if(this._cssClass) div.className += ' ' + this._cssClass
-
- if (this._opacity < 100) {
- SimileAjax.Graphics.setOpacity(div, this._opacity);
- }
- this._layerDiv.appendChild(div);
-
- // GH: They were not using the requested color
- div.style.backgroundColor = this._color;
-
-
- var tableStartLabel = createTable();
- tableStartLabel.className = 'timeline-highlight-label timeline-highlight-label-start'
- var tdStart = tableStartLabel.rows[0].cells[0]
- tdStart.innerHTML = this._startLabel;
- if(this._cssClass) tdStart.className = 'label_' + this._cssClass
- this._layerDiv.appendChild(tableStartLabel);
-
-
- var tableEndLabel = createTable();
- tableEndLabel.className = 'timeline-highlight-label timeline-highlight-label-end'
- var tdEnd = tableEndLabel.rows[0].cells[0]
- tdEnd.innerHTML = this._endLabel;
- if(this._cssClass) tdEnd.className = 'label_' + this._cssClass
- this._layerDiv.appendChild(tableEndLabel);
-
- if (this._timeline.isHorizontal()){
- div.style.left = minPixel + "px";
- div.style.width = (maxPixel - minPixel) + "px";
-
- tableStartLabel.style.right = (this._band.getTotalViewLength() - minPixel) + "px";
- tableStartLabel.style.width = (this._startLabel.length) + "em";
-
- tableEndLabel.style.left = maxPixel + "px";
- tableEndLabel.style.width = (this._endLabel.length) + "em";
-
- } else {
- div.style.top = minPixel + "px";
- div.style.height = (maxPixel - minPixel) + "px";
-
- tableStartLabel.style.bottom = minPixel + "px";
- tableStartLabel.style.height = "1.5px";
-
- tableEndLabel.style.top = maxPixel + "px";
- tableEndLabel.style.height = "1.5px";
- }
- }
- this._layerDiv.style.display = "block";
-};
-
-Timeline.SpanHighlightDecorator.prototype.softPaint = function() {
-};
-
-/*==================================================
- * Point Highlight Decorator
- *==================================================
- */
-
-Timeline.PointHighlightDecorator = function(params) {
- this._unit = ("unit" in params) ? params.unit : SimileAjax.NativeDateUnit;
- this._date = (typeof params.date == "string") ?
- this._unit.parseFromObject(params.date) : params.date;
- this._width = ("width" in params) ? params.width : 10;
- this._color = params.color;
- this._cssClass = ("cssClass" in params) ? params.cssClass : '';
- this._opacity = ("opacity" in params) ? params.opacity : 100;
-};
-
-Timeline.PointHighlightDecorator.prototype.initialize = function(band, timeline) {
- this._band = band;
- this._timeline = timeline;
- this._layerDiv = null;
-};
-
-Timeline.PointHighlightDecorator.prototype.paint = function() {
- if (this._layerDiv != null) {
- this._band.removeLayerDiv(this._layerDiv);
- }
- this._layerDiv = this._band.createLayerDiv(10);
- this._layerDiv.setAttribute("name", "span-highlight-decorator"); // for debugging
- this._layerDiv.style.display = "none";
-
-
- var minDate = this._band.getMinDate();
- var maxDate = this._band.getMaxDate();
-
- if (this._unit.compare(this._date, maxDate) < 0 &&
- this._unit.compare(this._date, minDate) > 0) {
-
- var pixel = this._band.dateToPixelOffset(this._date);
- var minPixel = pixel - Math.round(this._width / 2);
-
- var doc = this._timeline.getDocument();
-
- var div = doc.createElement("div");
- div.className='timeline-highlight-point-decorator'
- div.className += ' ' + this._cssClass
-
- // GH: This was being ignored
- div.style.backgroundColor = this._color;
-
- if (this._opacity < 100) {
- SimileAjax.Graphics.setOpacity(div, this._opacity);
- }
- this._layerDiv.appendChild(div);
-
- if (this._timeline.isHorizontal()) {
- div.style.left = minPixel + "px";
-
- } else {
- div.style.top = minPixel + "px";
- }
- }
- this._layerDiv.style.display = "block";
-};
-
-Timeline.PointHighlightDecorator.prototype.softPaint = function() {
-};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/detailed-painter.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/detailed-painter.js
deleted file mode 100644
index fa1ce5d..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/detailed-painter.js
+++ /dev/null
@@ -1,679 +0,0 @@
-/*==================================================
- * Detailed Event Painter
- *==================================================
- */
-
-Timeline.DetailedEventPainter = function(params) {
- this._params = params;
- this._onSelectListeners = [];
-
- this._filterMatcher = null;
- this._highlightMatcher = null;
- this._frc = null;
-
- this._eventIdToElmt = {};
-};
-
-Timeline.DetailedEventPainter.prototype.initialize = function(band, timeline) {
- this._band = band;
- this._timeline = timeline;
-
- this._backLayer = null;
- this._eventLayer = null;
- this._lineLayer = null;
- this._highlightLayer = null;
-
- this._eventIdToElmt = null;
-};
-
-Timeline.DetailedEventPainter.prototype.addOnSelectListener = function(listener) {
- this._onSelectListeners.push(listener);
-};
-
-Timeline.DetailedEventPainter.prototype.removeOnSelectListener = function(listener) {
- for (var i = 0; i < this._onSelectListeners.length; i++) {
- if (this._onSelectListeners[i] == listener) {
- this._onSelectListeners.splice(i, 1);
- break;
- }
- }
-};
-
-Timeline.DetailedEventPainter.prototype.getFilterMatcher = function() {
- return this._filterMatcher;
-};
-
-Timeline.DetailedEventPainter.prototype.setFilterMatcher = function(filterMatcher) {
- this._filterMatcher = filterMatcher;
-};
-
-Timeline.DetailedEventPainter.prototype.getHighlightMatcher = function() {
- return this._highlightMatcher;
-};
-
-Timeline.DetailedEventPainter.prototype.setHighlightMatcher = function(highlightMatcher) {
- this._highlightMatcher = highlightMatcher;
-};
-
-Timeline.DetailedEventPainter.prototype.paint = function() {
- var eventSource = this._band.getEventSource();
- if (eventSource == null) {
- return;
- }
-
- this._eventIdToElmt = {};
- this._prepareForPainting();
-
- var eventTheme = this._params.theme.event;
- var trackHeight = Math.max(eventTheme.track.height, this._frc.getLineHeight());
- var metrics = {
- trackOffset: Math.round(this._band.getViewWidth() / 2 - trackHeight / 2),
- trackHeight: trackHeight,
- trackGap: eventTheme.track.gap,
- trackIncrement: trackHeight + eventTheme.track.gap,
- icon: eventTheme.instant.icon,
- iconWidth: eventTheme.instant.iconWidth,
- iconHeight: eventTheme.instant.iconHeight,
- labelWidth: eventTheme.label.width
- }
-
- var minDate = this._band.getMinDate();
- var maxDate = this._band.getMaxDate();
-
- var filterMatcher = (this._filterMatcher != null) ?
- this._filterMatcher :
- function(evt) { return true; };
- var highlightMatcher = (this._highlightMatcher != null) ?
- this._highlightMatcher :
- function(evt) { return -1; };
-
- var iterator = eventSource.getEventReverseIterator(minDate, maxDate);
- while (iterator.hasNext()) {
- var evt = iterator.next();
- if (filterMatcher(evt)) {
- this.paintEvent(evt, metrics, this._params.theme, highlightMatcher(evt));
- }
- }
-
- this._highlightLayer.style.display = "block";
- this._lineLayer.style.display = "block";
- this._eventLayer.style.display = "block";
-};
-
-Timeline.DetailedEventPainter.prototype.softPaint = function() {
-};
-
-Timeline.DetailedEventPainter.prototype._prepareForPainting = function() {
- var band = this._band;
-
- if (this._backLayer == null) {
- this._backLayer = this._band.createLayerDiv(0, "timeline-band-events");
- this._backLayer.style.visibility = "hidden";
-
- var eventLabelPrototype = document.createElement("span");
- eventLabelPrototype.className = "timeline-event-label";
- this._backLayer.appendChild(eventLabelPrototype);
- this._frc = SimileAjax.Graphics.getFontRenderingContext(eventLabelPrototype);
- }
- this._frc.update();
- this._lowerTracks = [];
- this._upperTracks = [];
-
- if (this._highlightLayer != null) {
- band.removeLayerDiv(this._highlightLayer);
- }
- this._highlightLayer = band.createLayerDiv(105, "timeline-band-highlights");
- this._highlightLayer.style.display = "none";
-
- if (this._lineLayer != null) {
- band.removeLayerDiv(this._lineLayer);
- }
- this._lineLayer = band.createLayerDiv(110, "timeline-band-lines");
- this._lineLayer.style.display = "none";
-
- if (this._eventLayer != null) {
- band.removeLayerDiv(this._eventLayer);
- }
- this._eventLayer = band.createLayerDiv(110, "timeline-band-events");
- this._eventLayer.style.display = "none";
-};
-
-Timeline.DetailedEventPainter.prototype.paintEvent = function(evt, metrics, theme, highlightIndex) {
- if (evt.isInstant()) {
- this.paintInstantEvent(evt, metrics, theme, highlightIndex);
- } else {
- this.paintDurationEvent(evt, metrics, theme, highlightIndex);
- }
-};
-
-Timeline.DetailedEventPainter.prototype.paintInstantEvent = function(evt, metrics, theme, highlightIndex) {
- if (evt.isImprecise()) {
- this.paintImpreciseInstantEvent(evt, metrics, theme, highlightIndex);
- } else {
- this.paintPreciseInstantEvent(evt, metrics, theme, highlightIndex);
- }
-}
-
-Timeline.DetailedEventPainter.prototype.paintDurationEvent = function(evt, metrics, theme, highlightIndex) {
- if (evt.isImprecise()) {
- this.paintImpreciseDurationEvent(evt, metrics, theme, highlightIndex);
- } else {
- this.paintPreciseDurationEvent(evt, metrics, theme, highlightIndex);
- }
-}
-
-Timeline.DetailedEventPainter.prototype.paintPreciseInstantEvent = function(evt, metrics, theme, highlightIndex) {
- var doc = this._timeline.getDocument();
- var text = evt.getText();
-
- var startDate = evt.getStart();
- var startPixel = Math.round(this._band.dateToPixelOffset(startDate));
- var iconRightEdge = Math.round(startPixel + metrics.iconWidth / 2);
- var iconLeftEdge = Math.round(startPixel - metrics.iconWidth / 2);
-
- var labelSize = this._frc.computeSize(text);
- var iconTrack = this._findFreeTrackForSolid(iconRightEdge, startPixel);
- var iconElmtData = this._paintEventIcon(evt, iconTrack, iconLeftEdge, metrics, theme);
-
- var labelLeft = iconRightEdge + theme.event.label.offsetFromLine;
- var labelTrack = iconTrack;
-
- var iconTrackData = this._getTrackData(iconTrack);
- if (Math.min(iconTrackData.solid, iconTrackData.text) >= labelLeft + labelSize.width) { // label on the same track, to the right of icon
- iconTrackData.solid = iconLeftEdge;
- iconTrackData.text = labelLeft;
- } else { // label on a different track, below icon
- iconTrackData.solid = iconLeftEdge;
-
- labelLeft = startPixel + theme.event.label.offsetFromLine;
- labelTrack = this._findFreeTrackForText(iconTrack, labelLeft + labelSize.width, function(t) { t.line = startPixel - 2; });
- this._getTrackData(labelTrack).text = iconLeftEdge;
-
- this._paintEventLine(evt, startPixel, iconTrack, labelTrack, metrics, theme);
- }
-
- var labelTop = Math.round(
- metrics.trackOffset + labelTrack * metrics.trackIncrement +
- metrics.trackHeight / 2 - labelSize.height / 2);
-
- var labelElmtData = this._paintEventLabel(evt, text, labelLeft, labelTop, labelSize.width, labelSize.height, theme);
-
- var self = this;
- var clickHandler = function(elmt, domEvt, target) {
- return self._onClickInstantEvent(iconElmtData.elmt, domEvt, evt);
- };
- SimileAjax.DOM.registerEvent(iconElmtData.elmt, "mousedown", clickHandler);
- SimileAjax.DOM.registerEvent(labelElmtData.elmt, "mousedown", clickHandler);
-
- this._createHighlightDiv(highlightIndex, iconElmtData, theme);
-
- this._eventIdToElmt[evt.getID()] = iconElmtData.elmt;
-};
-
-Timeline.DetailedEventPainter.prototype.paintImpreciseInstantEvent = function(evt, metrics, theme, highlightIndex) {
- var doc = this._timeline.getDocument();
- var text = evt.getText();
-
- var startDate = evt.getStart();
- var endDate = evt.getEnd();
- var startPixel = Math.round(this._band.dateToPixelOffset(startDate));
- var endPixel = Math.round(this._band.dateToPixelOffset(endDate));
-
- var iconRightEdge = Math.round(startPixel + metrics.iconWidth / 2);
- var iconLeftEdge = Math.round(startPixel - metrics.iconWidth / 2);
-
- var labelSize = this._frc.computeSize(text);
- var iconTrack = this._findFreeTrackForSolid(endPixel, startPixel);
-
- var tapeElmtData = this._paintEventTape(evt, iconTrack, startPixel, endPixel,
- theme.event.instant.impreciseColor, theme.event.instant.impreciseOpacity, metrics, theme);
- var iconElmtData = this._paintEventIcon(evt, iconTrack, iconLeftEdge, metrics, theme);
-
- var iconTrackData = this._getTrackData(iconTrack);
- iconTrackData.solid = iconLeftEdge;
-
- var labelLeft = iconRightEdge + theme.event.label.offsetFromLine;
- var labelRight = labelLeft + labelSize.width;
- var labelTrack;
- if (labelRight < endPixel) {
- labelTrack = iconTrack;
- } else {
- labelLeft = startPixel + theme.event.label.offsetFromLine;
- labelRight = labelLeft + labelSize.width;
-
- labelTrack = this._findFreeTrackForText(iconTrack, labelRight, function(t) { t.line = startPixel - 2; });
- this._getTrackData(labelTrack).text = iconLeftEdge;
-
- this._paintEventLine(evt, startPixel, iconTrack, labelTrack, metrics, theme);
- }
- var labelTop = Math.round(
- metrics.trackOffset + labelTrack * metrics.trackIncrement +
- metrics.trackHeight / 2 - labelSize.height / 2);
-
- var labelElmtData = this._paintEventLabel(evt, text, labelLeft, labelTop, labelSize.width, labelSize.height, theme);
-
- var self = this;
- var clickHandler = function(elmt, domEvt, target) {
- return self._onClickInstantEvent(iconElmtData.elmt, domEvt, evt);
- };
- SimileAjax.DOM.registerEvent(iconElmtData.elmt, "mousedown", clickHandler);
- SimileAjax.DOM.registerEvent(tapeElmtData.elmt, "mousedown", clickHandler);
- SimileAjax.DOM.registerEvent(labelElmtData.elmt, "mousedown", clickHandler);
-
- this._createHighlightDiv(highlightIndex, iconElmtData, theme);
-
- this._eventIdToElmt[evt.getID()] = iconElmtData.elmt;
-};
-
-Timeline.DetailedEventPainter.prototype.paintPreciseDurationEvent = function(evt, metrics, theme, highlightIndex) {
- var doc = this._timeline.getDocument();
- var text = evt.getText();
-
- var startDate = evt.getStart();
- var endDate = evt.getEnd();
- var startPixel = Math.round(this._band.dateToPixelOffset(startDate));
- var endPixel = Math.round(this._band.dateToPixelOffset(endDate));
-
- var labelSize = this._frc.computeSize(text);
- var tapeTrack = this._findFreeTrackForSolid(endPixel);
- var color = evt.getColor();
- color = color != null ? color : theme.event.duration.color;
-
- var tapeElmtData = this._paintEventTape(evt, tapeTrack, startPixel, endPixel, color, 100, metrics, theme);
-
- var tapeTrackData = this._getTrackData(tapeTrack);
- tapeTrackData.solid = startPixel;
-
- var labelLeft = startPixel + theme.event.label.offsetFromLine;
- var labelTrack = this._findFreeTrackForText(tapeTrack, labelLeft + labelSize.width, function(t) { t.line = startPixel - 2; });
- this._getTrackData(labelTrack).text = startPixel - 2;
-
- this._paintEventLine(evt, startPixel, tapeTrack, labelTrack, metrics, theme);
-
- var labelTop = Math.round(
- metrics.trackOffset + labelTrack * metrics.trackIncrement +
- metrics.trackHeight / 2 - labelSize.height / 2);
-
- var labelElmtData = this._paintEventLabel(evt, text, labelLeft, labelTop, labelSize.width, labelSize.height, theme);
-
- var self = this;
- var clickHandler = function(elmt, domEvt, target) {
- return self._onClickDurationEvent(tapeElmtData.elmt, domEvt, evt);
- };
- SimileAjax.DOM.registerEvent(tapeElmtData.elmt, "mousedown", clickHandler);
- SimileAjax.DOM.registerEvent(labelElmtData.elmt, "mousedown", clickHandler);
-
- this._createHighlightDiv(highlightIndex, tapeElmtData, theme);
-
- this._eventIdToElmt[evt.getID()] = tapeElmtData.elmt;
-};
-
-Timeline.DetailedEventPainter.prototype.paintImpreciseDurationEvent = function(evt, metrics, theme, highlightIndex) {
- var doc = this._timeline.getDocument();
- var text = evt.getText();
-
- var startDate = evt.getStart();
- var latestStartDate = evt.getLatestStart();
- var endDate = evt.getEnd();
- var earliestEndDate = evt.getEarliestEnd();
-
- var startPixel = Math.round(this._band.dateToPixelOffset(startDate));
- var latestStartPixel = Math.round(this._band.dateToPixelOffset(latestStartDate));
- var endPixel = Math.round(this._band.dateToPixelOffset(endDate));
- var earliestEndPixel = Math.round(this._band.dateToPixelOffset(earliestEndDate));
-
- var labelSize = this._frc.computeSize(text);
- var tapeTrack = this._findFreeTrackForSolid(endPixel);
- var color = evt.getColor();
- color = color != null ? color : theme.event.duration.color;
-
- var impreciseTapeElmtData = this._paintEventTape(evt, tapeTrack, startPixel, endPixel,
- theme.event.duration.impreciseColor, theme.event.duration.impreciseOpacity, metrics, theme);
- var tapeElmtData = this._paintEventTape(evt, tapeTrack, latestStartPixel, earliestEndPixel, color, 100, metrics, theme);
-
- var tapeTrackData = this._getTrackData(tapeTrack);
- tapeTrackData.solid = startPixel;
-
- var labelLeft = latestStartPixel + theme.event.label.offsetFromLine;
- var labelTrack = this._findFreeTrackForText(tapeTrack, labelLeft + labelSize.width, function(t) { t.line = latestStartPixel - 2; });
- this._getTrackData(labelTrack).text = latestStartPixel - 2;
-
- this._paintEventLine(evt, latestStartPixel, tapeTrack, labelTrack, metrics, theme);
-
- var labelTop = Math.round(
- metrics.trackOffset + labelTrack * metrics.trackIncrement +
- metrics.trackHeight / 2 - labelSize.height / 2);
-
- var labelElmtData = this._paintEventLabel(evt, text, labelLeft, labelTop, labelSize.width, labelSize.height, theme);
-
- var self = this;
- var clickHandler = function(elmt, domEvt, target) {
- return self._onClickDurationEvent(tapeElmtData.elmt, domEvt, evt);
- };
- SimileAjax.DOM.registerEvent(tapeElmtData.elmt, "mousedown", clickHandler);
- SimileAjax.DOM.registerEvent(labelElmtData.elmt, "mousedown", clickHandler);
-
- this._createHighlightDiv(highlightIndex, tapeElmtData, theme);
-
- this._eventIdToElmt[evt.getID()] = tapeElmtData.elmt;
-};
-
-Timeline.DetailedEventPainter.prototype._findFreeTrackForSolid = function(solidEdge, softEdge) {
- for (var i = 0; true; i++) {
- if (i < this._lowerTracks.length) {
- var t = this._lowerTracks[i];
- if (Math.min(t.solid, t.text) > solidEdge && (!(softEdge) || t.line > softEdge)) {
- return i;
- }
- } else {
- this._lowerTracks.push({
- solid: Number.POSITIVE_INFINITY,
- text: Number.POSITIVE_INFINITY,
- line: Number.POSITIVE_INFINITY
- });
-
- return i;
- }
-
- if (i < this._upperTracks.length) {
- var t = this._upperTracks[i];
- if (Math.min(t.solid, t.text) > solidEdge && (!(softEdge) || t.line > softEdge)) {
- return -1 - i;
- }
- } else {
- this._upperTracks.push({
- solid: Number.POSITIVE_INFINITY,
- text: Number.POSITIVE_INFINITY,
- line: Number.POSITIVE_INFINITY
- });
-
- return -1 - i;
- }
- }
-};
-
-Timeline.DetailedEventPainter.prototype._findFreeTrackForText = function(fromTrack, edge, occupiedTrackVisitor) {
- var extendUp;
- var index;
- var firstIndex;
- var result;
-
- if (fromTrack < 0) {
- extendUp = true;
- firstIndex = -fromTrack;
-
- index = this._findFreeUpperTrackForText(firstIndex, edge);
- result = -1 - index;
- } else if (fromTrack > 0) {
- extendUp = false;
- firstIndex = fromTrack + 1;
-
- index = this._findFreeLowerTrackForText(firstIndex, edge);
- result = index;
- } else {
- var upIndex = this._findFreeUpperTrackForText(0, edge);
- var downIndex = this._findFreeLowerTrackForText(1, edge);
-
- if (downIndex - 1 <= upIndex) {
- extendUp = false;
- firstIndex = 1;
- index = downIndex;
- result = index;
- } else {
- extendUp = true;
- firstIndex = 0;
- index = upIndex;
- result = -1 - index;
- }
- }
-
- if (extendUp) {
- if (index == this._upperTracks.length) {
- this._upperTracks.push({
- solid: Number.POSITIVE_INFINITY,
- text: Number.POSITIVE_INFINITY,
- line: Number.POSITIVE_INFINITY
- });
- }
- for (var i = firstIndex; i < index; i++) {
- occupiedTrackVisitor(this._upperTracks[i]);
- }
- } else {
- if (index == this._lowerTracks.length) {
- this._lowerTracks.push({
- solid: Number.POSITIVE_INFINITY,
- text: Number.POSITIVE_INFINITY,
- line: Number.POSITIVE_INFINITY
- });
- }
- for (var i = firstIndex; i < index; i++) {
- occupiedTrackVisitor(this._lowerTracks[i]);
- }
- }
- return result;
-};
-
-Timeline.DetailedEventPainter.prototype._findFreeLowerTrackForText = function(index, edge) {
- for (; index < this._lowerTracks.length; index++) {
- var t = this._lowerTracks[index];
- if (Math.min(t.solid, t.text) >= edge) {
- break;
- }
- }
- return index;
-};
-
-Timeline.DetailedEventPainter.prototype._findFreeUpperTrackForText = function(index, edge) {
- for (; index < this._upperTracks.length; index++) {
- var t = this._upperTracks[index];
- if (Math.min(t.solid, t.text) >= edge) {
- break;
- }
- }
- return index;
-};
-
-Timeline.DetailedEventPainter.prototype._getTrackData = function(index) {
- return (index < 0) ? this._upperTracks[-index - 1] : this._lowerTracks[index];
-};
-
-Timeline.DetailedEventPainter.prototype._paintEventLine = function(evt, left, startTrack, endTrack, metrics, theme) {
- var top = Math.round(metrics.trackOffset + startTrack * metrics.trackIncrement + metrics.trackHeight / 2);
- var height = Math.round(Math.abs(endTrack - startTrack) * metrics.trackIncrement);
-
- var lineStyle = "1px solid " + theme.event.label.lineColor;
- var lineDiv = this._timeline.getDocument().createElement("div");
- lineDiv.style.position = "absolute";
- lineDiv.style.left = left + "px";
- lineDiv.style.width = theme.event.label.offsetFromLine + "px";
- lineDiv.style.height = height + "px";
- if (startTrack > endTrack) {
- lineDiv.style.top = (top - height) + "px";
- lineDiv.style.borderTop = lineStyle;
- } else {
- lineDiv.style.top = top + "px";
- lineDiv.style.borderBottom = lineStyle;
- }
- lineDiv.style.borderLeft = lineStyle;
- this._lineLayer.appendChild(lineDiv);
-};
-
-Timeline.DetailedEventPainter.prototype._paintEventIcon = function(evt, iconTrack, left, metrics, theme) {
- var icon = evt.getIcon();
- icon = icon != null ? icon : metrics.icon;
-
- var middle = metrics.trackOffset + iconTrack * metrics.trackIncrement + metrics.trackHeight / 2;
- var top = Math.round(middle - metrics.iconHeight / 2);
-
- var img = SimileAjax.Graphics.createTranslucentImage(icon);
- var iconDiv = this._timeline.getDocument().createElement("div");
- iconDiv.style.position = "absolute";
- iconDiv.style.left = left + "px";
- iconDiv.style.top = top + "px";
- iconDiv.appendChild(img);
- iconDiv.style.cursor = "pointer";
-
- if(evt._title != null)
- iconDiv.title = evt._title
-
- this._eventLayer.appendChild(iconDiv);
-
- return {
- left: left,
- top: top,
- width: metrics.iconWidth,
- height: metrics.iconHeight,
- elmt: iconDiv
- };
-};
-
-Timeline.DetailedEventPainter.prototype._paintEventLabel = function(evt, text, left, top, width, height, theme) {
- var doc = this._timeline.getDocument();
-
- var labelBackgroundDiv = doc.createElement("div");
- labelBackgroundDiv.style.position = "absolute";
- labelBackgroundDiv.style.left = left + "px";
- labelBackgroundDiv.style.width = width + "px";
- labelBackgroundDiv.style.top = top + "px";
- labelBackgroundDiv.style.height = height + "px";
- labelBackgroundDiv.style.backgroundColor = theme.event.label.backgroundColor;
- SimileAjax.Graphics.setOpacity(labelBackgroundDiv, theme.event.label.backgroundOpacity);
- this._eventLayer.appendChild(labelBackgroundDiv);
-
- var labelDiv = doc.createElement("div");
- labelDiv.style.position = "absolute";
- labelDiv.style.left = left + "px";
- labelDiv.style.width = width + "px";
- labelDiv.style.top = top + "px";
- labelDiv.innerHTML = text;
- labelDiv.style.cursor = "pointer";
-
- if(evt._title != null)
- labelDiv.title = evt._title;
-
- var color = evt.getTextColor();
- if (color == null) {
- color = evt.getColor();
- }
- if (color != null) {
- labelDiv.style.color = color;
- }
-
- this._eventLayer.appendChild(labelDiv);
-
- return {
- left: left,
- top: top,
- width: width,
- height: height,
- elmt: labelDiv
- };
-};
-
-Timeline.DetailedEventPainter.prototype._paintEventTape = function(
- evt, iconTrack, startPixel, endPixel, color, opacity, metrics, theme) {
-
- var tapeWidth = endPixel - startPixel;
- var tapeHeight = theme.event.tape.height;
- var middle = metrics.trackOffset + iconTrack * metrics.trackIncrement + metrics.trackHeight / 2;
- var top = Math.round(middle - tapeHeight / 2);
-
- var tapeDiv = this._timeline.getDocument().createElement("div");
- tapeDiv.style.position = "absolute";
- tapeDiv.style.left = startPixel + "px";
- tapeDiv.style.width = tapeWidth + "px";
- tapeDiv.style.top = top + "px";
- tapeDiv.style.height = tapeHeight + "px";
- tapeDiv.style.backgroundColor = color;
- tapeDiv.style.overflow = "hidden";
- tapeDiv.style.cursor = "pointer";
-
- if(evt._title != null)
- tapeDiv.title = evt._title;
-
- SimileAjax.Graphics.setOpacity(tapeDiv, opacity);
-
- this._eventLayer.appendChild(tapeDiv);
-
- return {
- left: startPixel,
- top: top,
- width: tapeWidth,
- height: tapeHeight,
- elmt: tapeDiv
- };
-}
-
-Timeline.DetailedEventPainter.prototype._createHighlightDiv = function(highlightIndex, dimensions, theme) {
- if (highlightIndex >= 0) {
- var doc = this._timeline.getDocument();
- var eventTheme = theme.event;
- alert('lksjdf');
- // GH: They're ignoring our requested colors here
-// var color = eventTheme.highlightColors[Math.min(highlightIndex, eventTheme.highlightColors.length - 1)];
-
- var div = doc.createElement("div");
- div.style.position = "absolute";
- div.style.overflow = "hidden";
- div.style.left = (dimensions.left - 2) + "px";
- div.style.width = (dimensions.width + 4) + "px";
- div.style.top = (dimensions.top - 2) + "px";
- div.style.height = (dimensions.height + 4) + "px";
- div.style.background = color;
-
- this._highlightLayer.appendChild(div);
- }
-};
-
-Timeline.DetailedEventPainter.prototype._onClickInstantEvent = function(icon, domEvt, evt) {
- var c = SimileAjax.DOM.getPageCoordinates(icon);
- this._showBubble(
- c.left + Math.ceil(icon.offsetWidth / 2),
- c.top + Math.ceil(icon.offsetHeight / 2),
- evt
- );
- this._fireOnSelect(evt.getID());
-
- domEvt.cancelBubble = true;
- SimileAjax.DOM.cancelEvent(domEvt);
- return false;
-};
-
-Timeline.DetailedEventPainter.prototype._onClickDurationEvent = function(target, domEvt, evt) {
- if ("pageX" in domEvt) {
- var x = domEvt.pageX;
- var y = domEvt.pageY;
- } else {
- var c = SimileAjax.DOM.getPageCoordinates(target);
- var x = domEvt.offsetX + c.left;
- var y = domEvt.offsetY + c.top;
- }
- this._showBubble(x, y, evt);
- this._fireOnSelect(evt.getID());
-
- domEvt.cancelBubble = true;
- SimileAjax.DOM.cancelEvent(domEvt);
- return false;
-};
-
-Timeline.DetailedEventPainter.prototype.showBubble = function(evt) {
- var elmt = this._eventIdToElmt[evt.getID()];
- if (elmt) {
- var c = SimileAjax.DOM.getPageCoordinates(elmt);
- this._showBubble(c.left + elmt.offsetWidth / 2, c.top + elmt.offsetHeight / 2, evt);
- }
-};
-
-Timeline.DetailedEventPainter.prototype._showBubble = function(x, y, evt) {
- var div = document.createElement("div");
- evt.fillInfoBubble(div, this._params.theme, this._band.getLabeller());
-
- SimileAjax.WindowManager.cancelPopups();
- SimileAjax.Graphics.createBubbleForContentAndPoint(div, x, y, this._params.theme.event.bubble.width);
-};
-
-Timeline.DetailedEventPainter.prototype._fireOnSelect = function(eventID) {
- for (var i = 0; i < this._onSelectListeners.length; i++) {
- this._onSelectListeners[i](eventID);
- }
-};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/ether-painters.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/ether-painters.js
deleted file mode 100644
index 51a0d5c..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/ether-painters.js
+++ /dev/null
@@ -1,576 +0,0 @@
-/*==================================================
- * Gregorian Ether Painter
- *==================================================
- */
-
-Timeline.GregorianEtherPainter = function(params) {
- this._params = params;
- this._theme = params.theme;
- this._unit = params.unit;
- this._multiple = ("multiple" in params) ? params.multiple : 1;
-};
-
-Timeline.GregorianEtherPainter.prototype.initialize = function(band, timeline) {
- this._band = band;
- this._timeline = timeline;
-
- this._backgroundLayer = band.createLayerDiv(0);
- this._backgroundLayer.setAttribute("name", "ether-background"); // for debugging
- this._backgroundLayer.className = 'timeline-ether-bg';
- // this._backgroundLayer.style.background = this._theme.ether.backgroundColors[band.getIndex()];
-
-
- this._markerLayer = null;
- this._lineLayer = null;
-
- var align = ("align" in this._params && this._params.align != undefined) ? this._params.align :
- this._theme.ether.interval.marker[timeline.isHorizontal() ? "hAlign" : "vAlign"];
- var showLine = ("showLine" in this._params) ? this._params.showLine :
- this._theme.ether.interval.line.show;
-
- this._intervalMarkerLayout = new Timeline.EtherIntervalMarkerLayout(
- this._timeline, this._band, this._theme, align, showLine);
-
- this._highlight = new Timeline.EtherHighlight(
- this._timeline, this._band, this._theme, this._backgroundLayer);
-}
-
-Timeline.GregorianEtherPainter.prototype.setHighlight = function(startDate, endDate) {
- this._highlight.position(startDate, endDate);
-}
-
-Timeline.GregorianEtherPainter.prototype.paint = function() {
- if (this._markerLayer) {
- this._band.removeLayerDiv(this._markerLayer);
- }
- this._markerLayer = this._band.createLayerDiv(100);
- this._markerLayer.setAttribute("name", "ether-markers"); // for debugging
- this._markerLayer.style.display = "none";
-
- if (this._lineLayer) {
- this._band.removeLayerDiv(this._lineLayer);
- }
- this._lineLayer = this._band.createLayerDiv(1);
- this._lineLayer.setAttribute("name", "ether-lines"); // for debugging
- this._lineLayer.style.display = "none";
-
- var minDate = this._band.getMinDate();
- var maxDate = this._band.getMaxDate();
-
- var timeZone = this._band.getTimeZone();
- var labeller = this._band.getLabeller();
-
- SimileAjax.DateTime.roundDownToInterval(minDate, this._unit, timeZone, this._multiple, this._theme.firstDayOfWeek);
-
- var p = this;
- var incrementDate = function(date) {
- for (var i = 0; i < p._multiple; i++) {
- SimileAjax.DateTime.incrementByInterval(date, p._unit);
- }
- };
-
- while (minDate.getTime() < maxDate.getTime()) {
- this._intervalMarkerLayout.createIntervalMarker(
- minDate, labeller, this._unit, this._markerLayer, this._lineLayer);
-
- incrementDate(minDate);
- }
- this._markerLayer.style.display = "block";
- this._lineLayer.style.display = "block";
-};
-
-Timeline.GregorianEtherPainter.prototype.softPaint = function() {
-};
-
-Timeline.GregorianEtherPainter.prototype.zoom = function(netIntervalChange) {
- if (netIntervalChange != 0) {
- this._unit += netIntervalChange;
- }
-};
-
-
-/*==================================================
- * Hot Zone Gregorian Ether Painter
- *==================================================
- */
-
-Timeline.HotZoneGregorianEtherPainter = function(params) {
- this._params = params;
- this._theme = params.theme;
-
- this._zones = [{
- startTime: Number.NEGATIVE_INFINITY,
- endTime: Number.POSITIVE_INFINITY,
- unit: params.unit,
- multiple: 1
- }];
- for (var i = 0; i < params.zones.length; i++) {
- var zone = params.zones[i];
- var zoneStart = SimileAjax.DateTime.parseGregorianDateTime(zone.start).getTime();
- var zoneEnd = SimileAjax.DateTime.parseGregorianDateTime(zone.end).getTime();
-
- for (var j = 0; j < this._zones.length && zoneEnd > zoneStart; j++) {
- var zone2 = this._zones[j];
-
- if (zoneStart < zone2.endTime) {
- if (zoneStart > zone2.startTime) {
- this._zones.splice(j, 0, {
- startTime: zone2.startTime,
- endTime: zoneStart,
- unit: zone2.unit,
- multiple: zone2.multiple
- });
- j++;
-
- zone2.startTime = zoneStart;
- }
-
- if (zoneEnd < zone2.endTime) {
- this._zones.splice(j, 0, {
- startTime: zoneStart,
- endTime: zoneEnd,
- unit: zone.unit,
- multiple: (zone.multiple) ? zone.multiple : 1
- });
- j++;
-
- zone2.startTime = zoneEnd;
- zoneStart = zoneEnd;
- } else {
- zone2.multiple = zone.multiple;
- zone2.unit = zone.unit;
- zoneStart = zone2.endTime;
- }
- } // else, try the next existing zone
- }
- }
-};
-
-Timeline.HotZoneGregorianEtherPainter.prototype.initialize = function(band, timeline) {
- this._band = band;
- this._timeline = timeline;
-
- this._backgroundLayer = band.createLayerDiv(0);
- this._backgroundLayer.setAttribute("name", "ether-background"); // for debugging
- this._backgroundLayer.className ='timeline-ether-bg';
- //this._backgroundLayer.style.background = this._theme.ether.backgroundColors[band.getIndex()];
-
- this._markerLayer = null;
- this._lineLayer = null;
-
- var align = ("align" in this._params && this._params.align != undefined) ? this._params.align :
- this._theme.ether.interval.marker[timeline.isHorizontal() ? "hAlign" : "vAlign"];
- var showLine = ("showLine" in this._params) ? this._params.showLine :
- this._theme.ether.interval.line.show;
-
- this._intervalMarkerLayout = new Timeline.EtherIntervalMarkerLayout(
- this._timeline, this._band, this._theme, align, showLine);
-
- this._highlight = new Timeline.EtherHighlight(
- this._timeline, this._band, this._theme, this._backgroundLayer);
-}
-
-Timeline.HotZoneGregorianEtherPainter.prototype.setHighlight = function(startDate, endDate) {
- this._highlight.position(startDate, endDate);
-}
-
-Timeline.HotZoneGregorianEtherPainter.prototype.paint = function() {
- if (this._markerLayer) {
- this._band.removeLayerDiv(this._markerLayer);
- }
- this._markerLayer = this._band.createLayerDiv(100);
- this._markerLayer.setAttribute("name", "ether-markers"); // for debugging
- this._markerLayer.style.display = "none";
-
- if (this._lineLayer) {
- this._band.removeLayerDiv(this._lineLayer);
- }
- this._lineLayer = this._band.createLayerDiv(1);
- this._lineLayer.setAttribute("name", "ether-lines"); // for debugging
- this._lineLayer.style.display = "none";
-
- var minDate = this._band.getMinDate();
- var maxDate = this._band.getMaxDate();
-
- var timeZone = this._band.getTimeZone();
- var labeller = this._band.getLabeller();
-
- var p = this;
- var incrementDate = function(date, zone) {
- for (var i = 0; i < zone.multiple; i++) {
- SimileAjax.DateTime.incrementByInterval(date, zone.unit);
- }
- };
-
- var zStart = 0;
- while (zStart < this._zones.length) {
- if (minDate.getTime() < this._zones[zStart].endTime) {
- break;
- }
- zStart++;
- }
- var zEnd = this._zones.length - 1;
- while (zEnd >= 0) {
- if (maxDate.getTime() > this._zones[zEnd].startTime) {
- break;
- }
- zEnd--;
- }
-
- for (var z = zStart; z <= zEnd; z++) {
- var zone = this._zones[z];
-
- var minDate2 = new Date(Math.max(minDate.getTime(), zone.startTime));
- var maxDate2 = new Date(Math.min(maxDate.getTime(), zone.endTime));
-
- SimileAjax.DateTime.roundDownToInterval(minDate2, zone.unit, timeZone, zone.multiple, this._theme.firstDayOfWeek);
- SimileAjax.DateTime.roundUpToInterval(maxDate2, zone.unit, timeZone, zone.multiple, this._theme.firstDayOfWeek);
-
- while (minDate2.getTime() < maxDate2.getTime()) {
- this._intervalMarkerLayout.createIntervalMarker(
- minDate2, labeller, zone.unit, this._markerLayer, this._lineLayer);
-
- incrementDate(minDate2, zone);
- }
- }
- this._markerLayer.style.display = "block";
- this._lineLayer.style.display = "block";
-};
-
-Timeline.HotZoneGregorianEtherPainter.prototype.softPaint = function() {
-};
-
-Timeline.HotZoneGregorianEtherPainter.prototype.zoom = function(netIntervalChange) {
- if (netIntervalChange != 0) {
- for (var i = 0; i < this._zones.length; ++i) {
- if (this._zones[i]) {
- this._zones[i].unit += netIntervalChange;
- }
- }
- }
-};
-
-/*==================================================
- * Year Count Ether Painter
- *==================================================
- */
-
-Timeline.YearCountEtherPainter = function(params) {
- this._params = params;
- this._theme = params.theme;
- this._startDate = SimileAjax.DateTime.parseGregorianDateTime(params.startDate);
- this._multiple = ("multiple" in params) ? params.multiple : 1;
-};
-
-Timeline.YearCountEtherPainter.prototype.initialize = function(band, timeline) {
- this._band = band;
- this._timeline = timeline;
-
- this._backgroundLayer = band.createLayerDiv(0);
- this._backgroundLayer.setAttribute("name", "ether-background"); // for debugging
- this._backgroundLayer.className = 'timeline-ether-bg';
- // this._backgroundLayer.style.background = this._theme.ether.backgroundColors[band.getIndex()];
-
- this._markerLayer = null;
- this._lineLayer = null;
-
- var align = ("align" in this._params) ? this._params.align :
- this._theme.ether.interval.marker[timeline.isHorizontal() ? "hAlign" : "vAlign"];
- var showLine = ("showLine" in this._params) ? this._params.showLine :
- this._theme.ether.interval.line.show;
-
- this._intervalMarkerLayout = new Timeline.EtherIntervalMarkerLayout(
- this._timeline, this._band, this._theme, align, showLine);
-
- this._highlight = new Timeline.EtherHighlight(
- this._timeline, this._band, this._theme, this._backgroundLayer);
-};
-
-Timeline.YearCountEtherPainter.prototype.setHighlight = function(startDate, endDate) {
- this._highlight.position(startDate, endDate);
-};
-
-Timeline.YearCountEtherPainter.prototype.paint = function() {
- if (this._markerLayer) {
- this._band.removeLayerDiv(this._markerLayer);
- }
- this._markerLayer = this._band.createLayerDiv(100);
- this._markerLayer.setAttribute("name", "ether-markers"); // for debugging
- this._markerLayer.style.display = "none";
-
- if (this._lineLayer) {
- this._band.removeLayerDiv(this._lineLayer);
- }
- this._lineLayer = this._band.createLayerDiv(1);
- this._lineLayer.setAttribute("name", "ether-lines"); // for debugging
- this._lineLayer.style.display = "none";
-
- var minDate = new Date(this._startDate.getTime());
- var maxDate = this._band.getMaxDate();
- var yearDiff = this._band.getMinDate().getUTCFullYear() - this._startDate.getUTCFullYear();
- minDate.setUTCFullYear(this._band.getMinDate().getUTCFullYear() - yearDiff % this._multiple);
-
- var p = this;
- var incrementDate = function(date) {
- for (var i = 0; i < p._multiple; i++) {
- SimileAjax.DateTime.incrementByInterval(date, SimileAjax.DateTime.YEAR);
- }
- };
- var labeller = {
- labelInterval: function(date, intervalUnit) {
- var diff = date.getUTCFullYear() - p._startDate.getUTCFullYear();
- return {
- text: diff,
- emphasized: diff == 0
- };
- }
- };
-
- while (minDate.getTime() < maxDate.getTime()) {
- this._intervalMarkerLayout.createIntervalMarker(
- minDate, labeller, SimileAjax.DateTime.YEAR, this._markerLayer, this._lineLayer);
-
- incrementDate(minDate);
- }
- this._markerLayer.style.display = "block";
- this._lineLayer.style.display = "block";
-};
-
-Timeline.YearCountEtherPainter.prototype.softPaint = function() {
-};
-
-/*==================================================
- * Quarterly Ether Painter
- *==================================================
- */
-
-Timeline.QuarterlyEtherPainter = function(params) {
- this._params = params;
- this._theme = params.theme;
- this._startDate = SimileAjax.DateTime.parseGregorianDateTime(params.startDate);
-};
-
-Timeline.QuarterlyEtherPainter.prototype.initialize = function(band, timeline) {
- this._band = band;
- this._timeline = timeline;
-
- this._backgroundLayer = band.createLayerDiv(0);
- this._backgroundLayer.setAttribute("name", "ether-background"); // for debugging
- this._backgroundLayer.className = 'timeline-ether-bg';
- // this._backgroundLayer.style.background = this._theme.ether.backgroundColors[band.getIndex()];
-
- this._markerLayer = null;
- this._lineLayer = null;
-
- var align = ("align" in this._params) ? this._params.align :
- this._theme.ether.interval.marker[timeline.isHorizontal() ? "hAlign" : "vAlign"];
- var showLine = ("showLine" in this._params) ? this._params.showLine :
- this._theme.ether.interval.line.show;
-
- this._intervalMarkerLayout = new Timeline.EtherIntervalMarkerLayout(
- this._timeline, this._band, this._theme, align, showLine);
-
- this._highlight = new Timeline.EtherHighlight(
- this._timeline, this._band, this._theme, this._backgroundLayer);
-};
-
-Timeline.QuarterlyEtherPainter.prototype.setHighlight = function(startDate, endDate) {
- this._highlight.position(startDate, endDate);
-};
-
-Timeline.QuarterlyEtherPainter.prototype.paint = function() {
- if (this._markerLayer) {
- this._band.removeLayerDiv(this._markerLayer);
- }
- this._markerLayer = this._band.createLayerDiv(100);
- this._markerLayer.setAttribute("name", "ether-markers"); // for debugging
- this._markerLayer.style.display = "none";
-
- if (this._lineLayer) {
- this._band.removeLayerDiv(this._lineLayer);
- }
- this._lineLayer = this._band.createLayerDiv(1);
- this._lineLayer.setAttribute("name", "ether-lines"); // for debugging
- this._lineLayer.style.display = "none";
-
- var minDate = new Date(0);
- var maxDate = this._band.getMaxDate();
-
- minDate.setUTCFullYear(Math.max(this._startDate.getUTCFullYear(), this._band.getMinDate().getUTCFullYear()));
- minDate.setUTCMonth(this._startDate.getUTCMonth());
-
- var p = this;
- var incrementDate = function(date) {
- date.setUTCMonth(date.getUTCMonth() + 3);
- };
- var labeller = {
- labelInterval: function(date, intervalUnit) {
- var quarters = (4 + (date.getUTCMonth() - p._startDate.getUTCMonth()) / 3) % 4;
- if (quarters != 0) {
- return { text: "Q" + (quarters + 1), emphasized: false };
- } else {
- return { text: "Y" + (date.getUTCFullYear() - p._startDate.getUTCFullYear() + 1), emphasized: true };
- }
- }
- };
-
- while (minDate.getTime() < maxDate.getTime()) {
- this._intervalMarkerLayout.createIntervalMarker(
- minDate, labeller, SimileAjax.DateTime.YEAR, this._markerLayer, this._lineLayer);
-
- incrementDate(minDate);
- }
- this._markerLayer.style.display = "block";
- this._lineLayer.style.display = "block";
-};
-
-Timeline.QuarterlyEtherPainter.prototype.softPaint = function() {
-};
-
-/*==================================================
- * Ether Interval Marker Layout
- *==================================================
- */
-
-Timeline.EtherIntervalMarkerLayout = function(timeline, band, theme, align, showLine) {
- var horizontal = timeline.isHorizontal();
- if (horizontal) {
- if (align == "Top") {
- this.positionDiv = function(div, offset) {
- div.style.left = offset + "px";
- div.style.top = "0px";
- };
- } else {
- this.positionDiv = function(div, offset) {
- div.style.left = offset + "px";
- div.style.bottom = "0px";
- };
- }
- } else {
- if (align == "Left") {
- this.positionDiv = function(div, offset) {
- div.style.top = offset + "px";
- div.style.left = "0px";
- };
- } else {
- this.positionDiv = function(div, offset) {
- div.style.top = offset + "px";
- div.style.right = "0px";
- };
- }
- }
-
- var markerTheme = theme.ether.interval.marker;
- var lineTheme = theme.ether.interval.line;
- var weekendTheme = theme.ether.interval.weekend;
-
- var stylePrefix = (horizontal ? "h" : "v") + align;
- var labelStyler = markerTheme[stylePrefix + "Styler"];
- var emphasizedLabelStyler = markerTheme[stylePrefix + "EmphasizedStyler"];
- var day = SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.DAY];
-
- this.createIntervalMarker = function(date, labeller, unit, markerDiv, lineDiv) {
- var offset = Math.round(band.dateToPixelOffset(date));
-
- if (showLine && unit != SimileAjax.DateTime.WEEK) {
- var divLine = timeline.getDocument().createElement("div");
- divLine.className = "timeline-ether-lines";
-
- if (lineTheme.opacity < 100) {
- SimileAjax.Graphics.setOpacity(divLine, lineTheme.opacity);
- }
-
- if (horizontal) {
- //divLine.className += " timeline-ether-lines-vertical";
- divLine.style.left = offset + "px";
- } else {
- //divLine.className += " timeline-ether-lines-horizontal";
- divLine.style.top = offset + "px";
- }
- lineDiv.appendChild(divLine);
- }
- if (unit == SimileAjax.DateTime.WEEK) {
- var firstDayOfWeek = theme.firstDayOfWeek;
-
- var saturday = new Date(date.getTime() + (6 - firstDayOfWeek - 7) * day);
- var monday = new Date(saturday.getTime() + 2 * day);
-
- var saturdayPixel = Math.round(band.dateToPixelOffset(saturday));
- var mondayPixel = Math.round(band.dateToPixelOffset(monday));
- var length = Math.max(1, mondayPixel - saturdayPixel);
-
- var divWeekend = timeline.getDocument().createElement("div");
- divWeekend.className = 'timeline-ether-weekends'
-
- if (weekendTheme.opacity < 100) {
- SimileAjax.Graphics.setOpacity(divWeekend, weekendTheme.opacity);
- }
-
- if (horizontal) {
- divWeekend.style.left = saturdayPixel + "px";
- divWeekend.style.width = length + "px";
- } else {
- divWeekend.style.top = saturdayPixel + "px";
- divWeekend.style.height = length + "px";
- }
- lineDiv.appendChild(divWeekend);
- }
-
- var label = labeller.labelInterval(date, unit);
-
- var div = timeline.getDocument().createElement("div");
- div.innerHTML = label.text;
-
-
-
- div.className = 'timeline-date-label'
- if(label.emphasized) div.className += ' timeline-date-label-em'
-
- this.positionDiv(div, offset);
- markerDiv.appendChild(div);
-
- return div;
- };
-};
-
-/*==================================================
- * Ether Highlight Layout
- *==================================================
- */
-
-Timeline.EtherHighlight = function(timeline, band, theme, backgroundLayer) {
- var horizontal = timeline.isHorizontal();
-
- this._highlightDiv = null;
- this._createHighlightDiv = function() {
- if (this._highlightDiv == null) {
- this._highlightDiv = timeline.getDocument().createElement("div");
- this._highlightDiv.setAttribute("name", "ether-highlight"); // for debugging
- this._highlightDiv.className = 'timeline-ether-highlight'
-
- var opacity = theme.ether.highlightOpacity;
- if (opacity < 100) {
- SimileAjax.Graphics.setOpacity(this._highlightDiv, opacity);
- }
-
- backgroundLayer.appendChild(this._highlightDiv);
- }
- }
-
- this.position = function(startDate, endDate) {
- this._createHighlightDiv();
-
- var startPixel = Math.round(band.dateToPixelOffset(startDate));
- var endPixel = Math.round(band.dateToPixelOffset(endDate));
- var length = Math.max(endPixel - startPixel, 3);
- if (horizontal) {
- this._highlightDiv.style.left = startPixel + "px";
- this._highlightDiv.style.width = length + "px";
- this._highlightDiv.style.height = (band.getViewWidth() - 4) + "px";
- } else {
- this._highlightDiv.style.top = startPixel + "px";
- this._highlightDiv.style.height = length + "px";
- this._highlightDiv.style.width = (band.getViewWidth() - 4) + "px";
- }
- }
-};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/ethers.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/ethers.js
deleted file mode 100644
index eda23e9..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/ethers.js
+++ /dev/null
@@ -1,300 +0,0 @@
-/*==================================================
- * Linear Ether
- *==================================================
- */
-
-Timeline.LinearEther = function(params) {
- this._params = params;
- this._interval = params.interval;
- this._pixelsPerInterval = params.pixelsPerInterval;
-};
-
-Timeline.LinearEther.prototype.initialize = function(band, timeline) {
- this._band = band;
- this._timeline = timeline;
- this._unit = timeline.getUnit();
-
- if ("startsOn" in this._params) {
- this._start = this._unit.parseFromObject(this._params.startsOn);
- } else if ("endsOn" in this._params) {
- this._start = this._unit.parseFromObject(this._params.endsOn);
- this.shiftPixels(-this._timeline.getPixelLength());
- } else if ("centersOn" in this._params) {
- this._start = this._unit.parseFromObject(this._params.centersOn);
- this.shiftPixels(-this._timeline.getPixelLength() / 2);
- } else {
- this._start = this._unit.makeDefaultValue();
- this.shiftPixels(-this._timeline.getPixelLength() / 2);
- }
-};
-
-Timeline.LinearEther.prototype.setDate = function(date) {
- this._start = this._unit.cloneValue(date);
-};
-
-Timeline.LinearEther.prototype.shiftPixels = function(pixels) {
- var numeric = this._interval * pixels / this._pixelsPerInterval;
- this._start = this._unit.change(this._start, numeric);
-};
-
-Timeline.LinearEther.prototype.dateToPixelOffset = function(date) {
- var numeric = this._unit.compare(date, this._start);
- return this._pixelsPerInterval * numeric / this._interval;
-};
-
-Timeline.LinearEther.prototype.pixelOffsetToDate = function(pixels) {
- var numeric = pixels * this._interval / this._pixelsPerInterval;
- return this._unit.change(this._start, numeric);
-};
-
-Timeline.LinearEther.prototype.zoom = function(zoomIn) {
- var netIntervalChange = 0;
- var currentZoomIndex = this._band._zoomIndex;
- var newZoomIndex = currentZoomIndex;
-
- if (zoomIn && (currentZoomIndex > 0)) {
- newZoomIndex = currentZoomIndex - 1;
- }
-
- if (!zoomIn && (currentZoomIndex < (this._band._zoomSteps.length - 1))) {
- newZoomIndex = currentZoomIndex + 1;
- }
-
- this._band._zoomIndex = newZoomIndex;
- this._interval =
- SimileAjax.DateTime.gregorianUnitLengths[this._band._zoomSteps[newZoomIndex].unit];
- this._pixelsPerInterval = this._band._zoomSteps[newZoomIndex].pixelsPerInterval;
- netIntervalChange = this._band._zoomSteps[newZoomIndex].unit -
- this._band._zoomSteps[currentZoomIndex].unit;
-
- return netIntervalChange;
-};
-
-
-/*==================================================
- * Hot Zone Ether
- *==================================================
- */
-
-Timeline.HotZoneEther = function(params) {
- this._params = params;
- this._interval = params.interval;
- this._pixelsPerInterval = params.pixelsPerInterval;
- this._theme = params.theme;
-};
-
-Timeline.HotZoneEther.prototype.initialize = function(band, timeline) {
- this._band = band;
- this._timeline = timeline;
- this._unit = timeline.getUnit();
-
- this._zones = [{
- startTime: Number.NEGATIVE_INFINITY,
- endTime: Number.POSITIVE_INFINITY,
- magnify: 1
- }];
- var params = this._params;
- for (var i = 0; i < params.zones.length; i++) {
- var zone = params.zones[i];
- var zoneStart = this._unit.parseFromObject(zone.start);
- var zoneEnd = this._unit.parseFromObject(zone.end);
-
- for (var j = 0; j < this._zones.length && this._unit.compare(zoneEnd, zoneStart) > 0; j++) {
- var zone2 = this._zones[j];
-
- if (this._unit.compare(zoneStart, zone2.endTime) < 0) {
- if (this._unit.compare(zoneStart, zone2.startTime) > 0) {
- this._zones.splice(j, 0, {
- startTime: zone2.startTime,
- endTime: zoneStart,
- magnify: zone2.magnify
- });
- j++;
-
- zone2.startTime = zoneStart;
- }
-
- if (this._unit.compare(zoneEnd, zone2.endTime) < 0) {
- this._zones.splice(j, 0, {
- startTime: zoneStart,
- endTime: zoneEnd,
- magnify: zone.magnify * zone2.magnify
- });
- j++;
-
- zone2.startTime = zoneEnd;
- zoneStart = zoneEnd;
- } else {
- zone2.magnify *= zone.magnify;
- zoneStart = zone2.endTime;
- }
- } // else, try the next existing zone
- }
- }
-
- if ("startsOn" in this._params) {
- this._start = this._unit.parseFromObject(this._params.startsOn);
- } else if ("endsOn" in this._params) {
- this._start = this._unit.parseFromObject(this._params.endsOn);
- this.shiftPixels(-this._timeline.getPixelLength());
- } else if ("centersOn" in this._params) {
- this._start = this._unit.parseFromObject(this._params.centersOn);
- this.shiftPixels(-this._timeline.getPixelLength() / 2);
- } else {
- this._start = this._unit.makeDefaultValue();
- this.shiftPixels(-this._timeline.getPixelLength() / 2);
- }
-};
-
-Timeline.HotZoneEther.prototype.setDate = function(date) {
- this._start = this._unit.cloneValue(date);
-};
-
-Timeline.HotZoneEther.prototype.shiftPixels = function(pixels) {
- this._start = this.pixelOffsetToDate(pixels);
-};
-
-Timeline.HotZoneEther.prototype.dateToPixelOffset = function(date) {
- return this._dateDiffToPixelOffset(this._start, date);
-};
-
-Timeline.HotZoneEther.prototype.pixelOffsetToDate = function(pixels) {
- return this._pixelOffsetToDate(pixels, this._start);
-};
-
-Timeline.HotZoneEther.prototype.zoom = function(zoomIn) {
- var netIntervalChange = 0;
- var currentZoomIndex = this._band._zoomIndex;
- var newZoomIndex = currentZoomIndex;
-
- if (zoomIn && (currentZoomIndex > 0)) {
- newZoomIndex = currentZoomIndex - 1;
- }
-
- if (!zoomIn && (currentZoomIndex < (this._band._zoomSteps.length - 1))) {
- newZoomIndex = currentZoomIndex + 1;
- }
-
- this._band._zoomIndex = newZoomIndex;
- this._interval =
- SimileAjax.DateTime.gregorianUnitLengths[this._band._zoomSteps[newZoomIndex].unit];
- this._pixelsPerInterval = this._band._zoomSteps[newZoomIndex].pixelsPerInterval;
- netIntervalChange = this._band._zoomSteps[newZoomIndex].unit -
- this._band._zoomSteps[currentZoomIndex].unit;
-
- return netIntervalChange;
-};
-
-Timeline.HotZoneEther.prototype._dateDiffToPixelOffset = function(fromDate, toDate) {
- var scale = this._getScale();
- var fromTime = fromDate;
- var toTime = toDate;
-
- var pixels = 0;
- if (this._unit.compare(fromTime, toTime) < 0) {
- var z = 0;
- while (z < this._zones.length) {
- if (this._unit.compare(fromTime, this._zones[z].endTime) < 0) {
- break;
- }
- z++;
- }
-
- while (this._unit.compare(fromTime, toTime) < 0) {
- var zone = this._zones[z];
- var toTime2 = this._unit.earlier(toTime, zone.endTime);
-
- pixels += (this._unit.compare(toTime2, fromTime) / (scale / zone.magnify));
-
- fromTime = toTime2;
- z++;
- }
- } else {
- var z = this._zones.length - 1;
- while (z >= 0) {
- if (this._unit.compare(fromTime, this._zones[z].startTime) > 0) {
- break;
- }
- z--;
- }
-
- while (this._unit.compare(fromTime, toTime) > 0) {
- var zone = this._zones[z];
- var toTime2 = this._unit.later(toTime, zone.startTime);
-
- pixels += (this._unit.compare(toTime2, fromTime) / (scale / zone.magnify));
-
- fromTime = toTime2;
- z--;
- }
- }
- return pixels;
-};
-
-Timeline.HotZoneEther.prototype._pixelOffsetToDate = function(pixels, fromDate) {
- var scale = this._getScale();
- var time = fromDate;
- if (pixels > 0) {
- var z = 0;
- while (z < this._zones.length) {
- if (this._unit.compare(time, this._zones[z].endTime) < 0) {
- break;
- }
- z++;
- }
-
- while (pixels > 0) {
- var zone = this._zones[z];
- var scale2 = scale / zone.magnify;
-
- if (zone.endTime == Number.POSITIVE_INFINITY) {
- time = this._unit.change(time, pixels * scale2);
- pixels = 0;
- } else {
- var pixels2 = this._unit.compare(zone.endTime, time) / scale2;
- if (pixels2 > pixels) {
- time = this._unit.change(time, pixels * scale2);
- pixels = 0;
- } else {
- time = zone.endTime;
- pixels -= pixels2;
- }
- }
- z++;
- }
- } else {
- var z = this._zones.length - 1;
- while (z >= 0) {
- if (this._unit.compare(time, this._zones[z].startTime) > 0) {
- break;
- }
- z--;
- }
-
- pixels = -pixels;
- while (pixels > 0) {
- var zone = this._zones[z];
- var scale2 = scale / zone.magnify;
-
- if (zone.startTime == Number.NEGATIVE_INFINITY) {
- time = this._unit.change(time, -pixels * scale2);
- pixels = 0;
- } else {
- var pixels2 = this._unit.compare(time, zone.startTime) / scale2;
- if (pixels2 > pixels) {
- time = this._unit.change(time, -pixels * scale2);
- pixels = 0;
- } else {
- time = zone.startTime;
- pixels -= pixels2;
- }
- }
- z--;
- }
- }
- return time;
-};
-
-Timeline.HotZoneEther.prototype._getScale = function() {
- return this._interval / this._pixelsPerInterval;
-};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/ext/japanese-eras.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/ext/japanese-eras.js
deleted file mode 100644
index 92027ac..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/ext/japanese-eras.js
+++ /dev/null
@@ -1,395 +0,0 @@
-/*==================================================
- * Japanese Era Date Labeller
- *==================================================
- */
-
-Timeline.JapaneseEraDateLabeller = function(locale, timeZone, useRomanizedName) {
- var o = new Timeline.GregorianDateLabeller(locale, timeZone);
-
- o._useRomanizedName = (useRomanizedName);
- o._oldLabelInterval = o.labelInterval;
- o.labelInterval = Timeline.JapaneseEraDateLabeller._labelInterval;
-
- return o;
-};
-
-Timeline.JapaneseEraDateLabeller._labelInterval = function(date, intervalUnit) {
- var text;
- var emphasized = false;
-
- var date2 = Timeline.DateTime.removeTimeZoneOffset(date, this._timeZone);
-
- switch(intervalUnit) {
- case Timeline.DateTime.YEAR:
- case Timeline.DateTime.DECADE:
- case Timeline.DateTime.CENTURY:
- case Timeline.DateTime.MILLENNIUM:
- var y = date2.getUTCFullYear();
- if (y >= Timeline.JapaneseEraDateLabeller._eras.elementAt(0).startingYear) {
- var eraIndex = Timeline.JapaneseEraDateLabeller._eras.find(function(era) {
- return era.startingYear - y;
- }
- );
- if (eraIndex < Timeline.JapaneseEraDateLabeller._eras.length()) {
- var era = Timeline.JapaneseEraDateLabeller._eras.elementAt(eraIndex);
- if (y < era.startingYear) {
- era = Timeline.JapaneseEraDateLabeller._eras.elementAt(eraIndex - 1);
- }
- } else {
- var era = Timeline.JapaneseEraDateLabeller._eras.elementAt(eraIndex - 1);
- }
-
- text = (this._useRomanizedName ? era.romanizedName : era.japaneseName) + " " + (y - era.startingYear + 1);
- emphasized = intervalUnit == Timeline.DateTime.YEAR && y == era.startingYear;
- break;
- } // else, fall through
- default:
- return this._oldLabelInterval(date, intervalUnit);
- }
-
- return { text: text, emphasized: emphasized };
-};
-
-/*==================================================
- * Japanese Era Ether Painter
- *==================================================
- */
-
-Timeline.JapaneseEraEtherPainter = function(params, band, timeline) {
- this._params = params;
- this._theme = params.theme;
-};
-
-Timeline.JapaneseEraEtherPainter.prototype.initialize = function(band, timeline) {
- this._band = band;
- this._timeline = timeline;
-
- this._backgroundLayer = band.createLayerDiv(0);
- this._backgroundLayer.setAttribute("name", "ether-background"); // for debugging
- this._backgroundLayer.style.background = this._theme.ether.backgroundColors[band.getIndex()];
-
- this._markerLayer = null;
- this._lineLayer = null;
-
- var align = ("align" in this._params) ? this._params.align :
- this._theme.ether.interval.marker[timeline.isHorizontal() ? "hAlign" : "vAlign"];
- var showLine = ("showLine" in this._params) ? this._params.showLine :
- this._theme.ether.interval.line.show;
-
- this._intervalMarkerLayout = new Timeline.EtherIntervalMarkerLayout(
- this._timeline, this._band, this._theme, align, showLine);
-
- this._highlight = new Timeline.EtherHighlight(
- this._timeline, this._band, this._theme, this._backgroundLayer);
-}
-
-Timeline.JapaneseEraEtherPainter.prototype.setHighlight = function(startDate, endDate) {
- this._highlight.position(startDate, endDate);
-}
-
-Timeline.JapaneseEraEtherPainter.prototype.paint = function() {
- if (this._markerLayer) {
- this._band.removeLayerDiv(this._markerLayer);
- }
- this._markerLayer = this._band.createLayerDiv(100);
- this._markerLayer.setAttribute("name", "ether-markers"); // for debugging
- this._markerLayer.style.display = "none";
-
- if (this._lineLayer) {
- this._band.removeLayerDiv(this._lineLayer);
- }
- this._lineLayer = this._band.createLayerDiv(1);
- this._lineLayer.setAttribute("name", "ether-lines"); // for debugging
- this._lineLayer.style.display = "none";
-
- var minYear = this._band.getMinDate().getUTCFullYear();
- var maxYear = this._band.getMaxDate().getUTCFullYear();
- var eraIndex = Timeline.JapaneseEraDateLabeller._eras.find(function(era) {
- return era.startingYear - minYear;
- }
- );
-
- var l = Timeline.JapaneseEraDateLabeller._eras.length();
- for (var i = eraIndex; i < l; i++) {
- var era = Timeline.JapaneseEraDateLabeller._eras.elementAt(i);
- if (era.startingYear > maxYear) {
- break;
- }
-
- var d = new Date(0);
- d.setUTCFullYear(era.startingYear);
-
- var labeller = {
- labelInterval: function(date, intervalUnit) {
- return {
- text: era.japaneseName,
- emphasized: true
- };
- }
- };
-
- this._intervalMarkerLayout.createIntervalMarker(
- d, labeller, Timeline.DateTime.YEAR, this._markerLayer, this._lineLayer);
- }
- this._markerLayer.style.display = "block";
- this._lineLayer.style.display = "block";
-};
-
-Timeline.JapaneseEraEtherPainter.prototype.softPaint = function() {
-};
-
-
-Timeline.JapaneseEraDateLabeller._eras = new Timeline.SortedArray(
- function(e1, e2) {
- return e1.startingYear - e2.startingYear;
- },
- [
- { startingYear: 645, japaneseName: '倧å', romanizedName: "Taika" },
- { startingYear: 650, japaneseName: 'çœé', romanizedName: "Hakuchi" },
- { startingYear: 686, japaneseName: 'æ±é³¥', romanizedName: "ShuchÅ" },
- { startingYear: 701, japaneseName: '倧å®', romanizedName: "TaihÅ" },
- { startingYear: 704, japaneseName: 'æ
¶é²', romanizedName: "Keiun" },
- { startingYear: 708, japaneseName: 'åé
', romanizedName: "WadÅ" },
- { startingYear: 715, japaneseName: 'éäº', romanizedName: "Reiki" },
- { startingYear: 717, japaneseName: 'é€è', romanizedName: "YÅrÅ" },
- { startingYear: 724, japaneseName: 'ç¥äº', romanizedName: "Jinki" },
- { startingYear: 729, japaneseName: '倩平', romanizedName: "TenpyÅ" },
- { startingYear: 749, japaneseName: '倩平æå®', romanizedName: "TenpyÅ-kanpÅ" },
- { startingYear: 749, japaneseName: '倩平åå®', romanizedName: "TenpyÅ-shÅhÅ" },
- { startingYear: 757, japaneseName: '倩平å®å', romanizedName: "TenpyÅ-hÅji" },
- { startingYear: 765, japaneseName: '倩平ç¥è·', romanizedName: "TenpyÅ-jingo" },
- { startingYear: 767, japaneseName: 'ç¥è·æ¯é²', romanizedName: "Jingo-keiun" },
- { startingYear: 770, japaneseName: 'å®äº', romanizedName: "HÅki" },
- { startingYear: 781, japaneseName: '倩å¿', romanizedName: "Ten'Å" },
- { startingYear: 782, japaneseName: 'å»¶æŠ', romanizedName: "Enryaku" },
- { startingYear: 806, japaneseName: '倧å', romanizedName: "DaidÅ" },
- { startingYear: 810, japaneseName: 'åŒä»', romanizedName: "KÅnin" },
- { startingYear: 824, japaneseName: '倩é·', romanizedName: "TenchÅ" },
- { startingYear: 834, japaneseName: 'æ¿å', romanizedName: "JÅwa" },
- { startingYear: 848, japaneseName: 'å祥', romanizedName: "KajÅ" },
- { startingYear: 851, japaneseName: 'ä»å¯¿', romanizedName: "Ninju" },
- { startingYear: 854, japaneseName: 'æè¡¡', romanizedName: "SaikÅ" },
- { startingYear: 857, japaneseName: '倩å®', romanizedName: "Tennan" },
- { startingYear: 859, japaneseName: 'è²èг', romanizedName: "JÅgan" },
- { startingYear: 877, japaneseName: 'å
æ
¶', romanizedName: "GangyÅ" },
- { startingYear: 885, japaneseName: 'ä»å', romanizedName: "Ninna" },
- { startingYear: 889, japaneseName: 'å¯å¹³', romanizedName: "KanpyÅ" },
- { startingYear: 898, japaneseName: 'ææ³°', romanizedName: "ShÅtai" },
- { startingYear: 901, japaneseName: 'å»¶å', romanizedName: "Engi" },
- { startingYear: 923, japaneseName: 'å»¶é·', romanizedName: "EnchÅ" },
- { startingYear: 931, japaneseName: 'æ¿å¹³', romanizedName: "JÅhei" },
- { startingYear: 938, japaneseName: '倩æ
¶', romanizedName: "TengyÅ" },
- { startingYear: 947, japaneseName: '倩æŠ', romanizedName: "Tenryaku" },
- { startingYear: 957, japaneseName: '倩埳', romanizedName: "Tentoku" },
- { startingYear: 961, japaneseName: 'å¿å', romanizedName: "Åwa" },
- { startingYear: 964, japaneseName: '康ä¿', romanizedName: "KÅhÅ" },
- { startingYear: 968, japaneseName: 'å®å', romanizedName: "Anna" },
- { startingYear: 970, japaneseName: '倩çŠ', romanizedName: "Tenroku" },
- { startingYear: 973, japaneseName: '倩延', romanizedName: "Ten'en" },
- { startingYear: 976, japaneseName: 'è²å
', romanizedName: "JÅgen" },
- { startingYear: 978, japaneseName: '倩å
', romanizedName: "Tengen" },
- { startingYear: 983, japaneseName: '氞芳', romanizedName: "Eikan" },
- { startingYear: 985, japaneseName: 'å¯å', romanizedName: "Kanna" },
- { startingYear: 987, japaneseName: 'æ°žå»¶', romanizedName: "Eien" },
- { startingYear: 988, japaneseName: 'æ°žç¥', romanizedName: "Eiso" },
- { startingYear: 990, japaneseName: 'æ£æŠ', romanizedName: "ShÅryaku" },
- { startingYear: 995, japaneseName: 'é·åŸ³', romanizedName: "ChÅtoku" },
- { startingYear: 999, japaneseName: 'é·ä¿', romanizedName: "ChÅhÅ" },
- { startingYear: 1004, japaneseName: 'å¯åŒ', romanizedName: "KankÅ" },
- { startingYear: 1012, japaneseName: 'é·å', romanizedName: "ChÅwa" },
- { startingYear: 1017, japaneseName: 'å¯ä»', romanizedName: "Kannin" },
- { startingYear: 1021, japaneseName: 'æ²»å®', romanizedName: "Jian" },
- { startingYear: 1024, japaneseName: 'äžå¯¿', romanizedName: "Manju" },
- { startingYear: 1028, japaneseName: 'é·å
', romanizedName: "ChÅgen" },
- { startingYear: 1037, japaneseName: 'é·æŠ', romanizedName: "ChÅryaku" },
- { startingYear: 1040, japaneseName: 'é·ä¹
', romanizedName: "ChÅkyÅ«" },
- { startingYear: 1044, japaneseName: 'å¯åŸ³', romanizedName: "Kantoku" },
- { startingYear: 1046, japaneseName: 'æ°žæ¿', romanizedName: "EishÅ" },
- { startingYear: 1053, japaneseName: '倩å', romanizedName: "Tengi" },
- { startingYear: 1058, japaneseName: '康平', romanizedName: "KÅhei" },
- { startingYear: 1065, japaneseName: 'æ²»æŠ', romanizedName: "Jiryaku" },
- { startingYear: 1069, japaneseName: 'å»¶ä¹
', romanizedName: "Enkyū" },
- { startingYear: 1074, japaneseName: 'æ¿ä¿', romanizedName: "JÅhÅ" },
- { startingYear: 1077, japaneseName: 'æ¿æŠ', romanizedName: "JÅryaku" },
- { startingYear: 1081, japaneseName: 'æ°žä¿', romanizedName: "EihÅ" },
- { startingYear: 1084, japaneseName: 'å¿åŸ³', romanizedName: "Åtoku" },
- { startingYear: 1087, japaneseName: '坿²»', romanizedName: "Kanji" },
- { startingYear: 1094, japaneseName: 'åä¿', romanizedName: "KahÅ" },
- { startingYear: 1096, japaneseName: 'æ°žé·', romanizedName: "EichÅ" },
- { startingYear: 1097, japaneseName: 'æ¿åŸ³', romanizedName: "JÅtoku" },
- { startingYear: 1099, japaneseName: '康å', romanizedName: "KÅwa" },
- { startingYear: 1104, japaneseName: 'é·æ²»', romanizedName: "ChÅji" },
- { startingYear: 1106, japaneseName: 'åæ¿', romanizedName: "KajÅ" },
- { startingYear: 1108, japaneseName: '倩ä»', romanizedName: "Tennin" },
- { startingYear: 1110, japaneseName: '倩氞', romanizedName: "Ten'ei" },
- { startingYear: 1113, japaneseName: 'æ°žä¹
', romanizedName: "Eikyū" },
- { startingYear: 1118, japaneseName: 'å
æ°ž', romanizedName: "Gen'ei" },
- { startingYear: 1120, japaneseName: 'ä¿å®', romanizedName: "HÅan" },
- { startingYear: 1124, japaneseName: '倩治', romanizedName: "Tenji" },
- { startingYear: 1126, japaneseName: '倧治', romanizedName: "Daiji" },
- { startingYear: 1131, japaneseName: '倩æ¿', romanizedName: "TenshÅ" },
- { startingYear: 1132, japaneseName: 'é·æ¿', romanizedName: "ChÅshÅ" },
- { startingYear: 1135, japaneseName: 'ä¿å»¶', romanizedName: "HÅen" },
- { startingYear: 1141, japaneseName: 'æ°žæ²»', romanizedName: "Eiji" },
- { startingYear: 1142, japaneseName: '康治', romanizedName: "KÅji" },
- { startingYear: 1144, japaneseName: '倩é€', romanizedName: "Ten'yÅ" },
- { startingYear: 1145, japaneseName: 'ä¹
å®', romanizedName: "KyÅ«an" },
- { startingYear: 1151, japaneseName: 'ä»å¹³', romanizedName: "Ninpei" },
- { startingYear: 1154, japaneseName: 'ä¹
寿', romanizedName: "Kyūju" },
- { startingYear: 1156, japaneseName: 'ä¿å
', romanizedName: "HÅgen" },
- { startingYear: 1159, japaneseName: '平治', romanizedName: "Heiji" },
- { startingYear: 1160, japaneseName: 'æ°žæŠ', romanizedName: "Eiryaku" },
- { startingYear: 1161, japaneseName: 'å¿ä¿', romanizedName: "ÅhÅ" },
- { startingYear: 1163, japaneseName: 'é·å¯', romanizedName: "ChÅkan" },
- { startingYear: 1165, japaneseName: 'æ°žäž', romanizedName: "Eiman" },
- { startingYear: 1166, japaneseName: 'ä»å®', romanizedName: "Ninnan" },
- { startingYear: 1169, japaneseName: 'åå¿', romanizedName: "KaÅ" },
- { startingYear: 1171, japaneseName: 'æ¿å®', romanizedName: "JÅan" },
- { startingYear: 1175, japaneseName: 'å®å
', romanizedName: "Angen" },
- { startingYear: 1177, japaneseName: 'æ²»æ¿', romanizedName: "JishÅ" },
- { startingYear: 1181, japaneseName: 'é€å', romanizedName: "YÅwa" },
- { startingYear: 1182, japaneseName: '寿氞', romanizedName: "Juei" },
- { startingYear: 1184, japaneseName: 'å
æŠ', romanizedName: "Genryaku" },
- { startingYear: 1185, japaneseName: 'ææ²»', romanizedName: "Bunji" },
- { startingYear: 1190, japaneseName: '建ä¹
', romanizedName: "Kenkyū" },
- { startingYear: 1199, japaneseName: 'æ£æ²»', romanizedName: "ShÅji" },
- { startingYear: 1201, japaneseName: '建ä»', romanizedName: "Kennin" },
- { startingYear: 1204, japaneseName: 'å
ä¹
', romanizedName: "Genkyū" },
- { startingYear: 1206, japaneseName: '建氞', romanizedName: "Ken'ei" },
- { startingYear: 1207, japaneseName: 'æ¿å
', romanizedName: "JÅgen" },
- { startingYear: 1211, japaneseName: '建æŠ', romanizedName: "Kenryaku" },
- { startingYear: 1213, japaneseName: '建ä¿', romanizedName: "KenpÅ" },
- { startingYear: 1219, japaneseName: 'æ¿ä¹
', romanizedName: "JÅkyÅ«" },
- { startingYear: 1222, japaneseName: 'è²å¿', romanizedName: "JÅÅ" },
- { startingYear: 1224, japaneseName: 'å
ä»', romanizedName: "Gennin" },
- { startingYear: 1225, japaneseName: 'åçŠ', romanizedName: "Karoku" },
- { startingYear: 1227, japaneseName: 'å®è²', romanizedName: "Antei" },
- { startingYear: 1229, japaneseName: 'å¯å', romanizedName: "Kanki" },
- { startingYear: 1232, japaneseName: 'è²æ°ž', romanizedName: "JÅei" },
- { startingYear: 1233, japaneseName: '倩çŠ', romanizedName: "Tenpuku" },
- { startingYear: 1234, japaneseName: 'ææŠ', romanizedName: "Bunryaku" },
- { startingYear: 1235, japaneseName: 'åçŠ', romanizedName: "Katei" },
- { startingYear: 1238, japaneseName: 'æŠä»', romanizedName: "Ryakunin" },
- { startingYear: 1239, japaneseName: 'å»¶å¿', romanizedName: "En'Å" },
- { startingYear: 1240, japaneseName: '仿²»', romanizedName: "Ninji" },
- { startingYear: 1243, japaneseName: 'å¯å
', romanizedName: "Kangen" },
- { startingYear: 1247, japaneseName: '宿²»', romanizedName: "HÅji" },
- { startingYear: 1249, japaneseName: '建é·', romanizedName: "KenchÅ" },
- { startingYear: 1256, japaneseName: '康å
', romanizedName: "KÅgen" },
- { startingYear: 1257, japaneseName: 'æ£å', romanizedName: "ShÅka" },
- { startingYear: 1259, japaneseName: 'æ£å
', romanizedName: "ShÅgen" },
- { startingYear: 1260, japaneseName: 'æå¿', romanizedName: "Bun'Å" },
- { startingYear: 1261, japaneseName: 'åŒé·', romanizedName: "KÅcho" },
- { startingYear: 1264, japaneseName: 'ææ°ž', romanizedName: "Bun'ei" },
- { startingYear: 1275, japaneseName: '建治', romanizedName: "Kenji" },
- { startingYear: 1278, japaneseName: 'åŒå®', romanizedName: "KÅan" },
- { startingYear: 1288, japaneseName: 'æ£å¿', romanizedName: "ShÅÅ" },
- { startingYear: 1293, japaneseName: 'æ°žä»', romanizedName: "Einin" },
- { startingYear: 1299, japaneseName: 'æ£å®', romanizedName: "ShÅan" },
- { startingYear: 1302, japaneseName: '也å
', romanizedName: "Kengen" },
- { startingYear: 1303, japaneseName: 'åå
', romanizedName: "Kagen" },
- { startingYear: 1306, japaneseName: '埳治', romanizedName: "Tokuji" },
- { startingYear: 1308, japaneseName: 'å»¶æ
¶', romanizedName: "Enkei" },
- { startingYear: 1311, japaneseName: 'å¿é·', romanizedName: "ÅchÅ" },
- { startingYear: 1312, japaneseName: 'æ£å', romanizedName: "ShÅwa" },
- { startingYear: 1317, japaneseName: 'æä¿', romanizedName: "BunpÅ" },
- { startingYear: 1319, japaneseName: 'å
å¿', romanizedName: "Gen'Å" },
- { startingYear: 1321, japaneseName: 'å
亚', romanizedName: "GenkyÅ" },
- { startingYear: 1324, japaneseName: 'æ£äž', romanizedName: "ShÅchÅ«" },
- { startingYear: 1326, japaneseName: 'åæŠ', romanizedName: "Karyaku" },
- { startingYear: 1329, japaneseName: 'å
埳', romanizedName: "Gentoku" },
- { startingYear: 1331, japaneseName: 'å
åŒ', romanizedName: "GenkÅ" },
- { startingYear: 1334, japaneseName: '建æŠ', romanizedName: "Kenmu" },
- { startingYear: 1336, japaneseName: 'å»¶å
', romanizedName: "Engen" },
- { startingYear: 1340, japaneseName: 'èåœ', romanizedName: "KÅkoku" },
- { startingYear: 1346, japaneseName: 'æ£å¹³', romanizedName: "ShÅhei" },
- { startingYear: 1370, japaneseName: '建埳', romanizedName: "Kentoku" },
- { startingYear: 1372, japaneseName: 'æäž', romanizedName: "BunchÅ«" },
- { startingYear: 1375, japaneseName: '倩æ', romanizedName: "Tenju" },
- { startingYear: 1381, japaneseName: 'åŒå', romanizedName: "KÅwa" },
- { startingYear: 1384, japaneseName: 'å
äž', romanizedName: "GenchÅ«" },
- { startingYear: 1332, japaneseName: 'æ£æ
¶', romanizedName: "ShÅkei" },
- { startingYear: 1338, japaneseName: 'æŠå¿', romanizedName: "RyakuÅ" },
- { startingYear: 1342, japaneseName: '康氞', romanizedName: "KÅei" },
- { startingYear: 1345, japaneseName: 'è²å', romanizedName: "JÅwa" },
- { startingYear: 1350, japaneseName: '芳å¿', romanizedName: "Kan'Å" },
- { startingYear: 1352, japaneseName: 'æå', romanizedName: "Bunna" },
- { startingYear: 1356, japaneseName: 'å»¶æ', romanizedName: "Enbun" },
- { startingYear: 1361, japaneseName: '康å®', romanizedName: "KÅan" },
- { startingYear: 1362, japaneseName: 'è²æ²»', romanizedName: "JÅji" },
- { startingYear: 1368, japaneseName: 'å¿å®', romanizedName: "Åan" },
- { startingYear: 1375, japaneseName: 'æ°žå', romanizedName: "Eiwa" },
- { startingYear: 1379, japaneseName: '康æŠ', romanizedName: "KÅryaku" },
- { startingYear: 1381, japaneseName: '氞埳', romanizedName: "Eitoku" },
- { startingYear: 1384, japaneseName: 'è³åŸ³', romanizedName: "Shitoku" },
- { startingYear: 1387, japaneseName: 'åæ
¶', romanizedName: "Kakei" },
- { startingYear: 1389, japaneseName: '康å¿', romanizedName: "KÅÅ" },
- { startingYear: 1390, japaneseName: 'æåŸ³', romanizedName: "Meitoku" },
- { startingYear: 1394, japaneseName: 'å¿æ°ž', romanizedName: "Åei" },
- { startingYear: 1428, japaneseName: 'æ£é·', romanizedName: "ShÅchÅ" },
- { startingYear: 1429, japaneseName: '氞享', romanizedName: "EikyÅ" },
- { startingYear: 1441, japaneseName: 'åå', romanizedName: "Kakitsu" },
- { startingYear: 1444, japaneseName: 'æå®', romanizedName: "Bunnan" },
- { startingYear: 1449, japaneseName: 'å®åŸ³', romanizedName: "HÅtoku" },
- { startingYear: 1452, japaneseName: '享埳', romanizedName: "KyÅtoku" },
- { startingYear: 1455, japaneseName: '康æ£', romanizedName: "KÅshÅ" },
- { startingYear: 1457, japaneseName: 'é·çŠ', romanizedName: "ChÅroku" },
- { startingYear: 1460, japaneseName: '坿£', romanizedName: "KanshÅ" },
- { startingYear: 1466, japaneseName: 'ææ£', romanizedName: "BunshÅ" },
- { startingYear: 1467, japaneseName: 'å¿ä»', romanizedName: "Ånin" },
- { startingYear: 1469, japaneseName: 'ææ', romanizedName: "Bunmei" },
- { startingYear: 1487, japaneseName: 'é·äº«', romanizedName: "ChÅkyÅ" },
- { startingYear: 1489, japaneseName: '延埳', romanizedName: "Entoku" },
- { startingYear: 1492, japaneseName: 'æå¿', romanizedName: "MeiÅ" },
- { startingYear: 1501, japaneseName: 'æäº', romanizedName: "Bunki" },
- { startingYear: 1504, japaneseName: 'æ°žæ£', romanizedName: "EishÅ" },
- { startingYear: 1521, japaneseName: '倧氞', romanizedName: "Daiei" },
- { startingYear: 1528, japaneseName: '享çŠ', romanizedName: "KyÅroku" },
- { startingYear: 1532, japaneseName: '倩æ', romanizedName: "Tenbun" },
- { startingYear: 1555, japaneseName: 'åŒæ²»', romanizedName: "KÅji" },
- { startingYear: 1558, japaneseName: 'æ°žçŠ', romanizedName: "Eiroku" },
- { startingYear: 1570, japaneseName: 'å
äº', romanizedName: "Genki" },
- { startingYear: 1573, japaneseName: '倩æ£', romanizedName: "TenshÅ" },
- { startingYear: 1592, japaneseName: 'æçŠ', romanizedName: "Bunroku" },
- { startingYear: 1596, japaneseName: 'æ
¶é·', romanizedName: "KeichÅ" },
- { startingYear: 1615, japaneseName: 'å
å', romanizedName: "Genna" },
- { startingYear: 1624, japaneseName: '坿°ž', romanizedName: "Kan'ei" },
- { startingYear: 1644, japaneseName: 'æ£ä¿', romanizedName: "ShÅhÅ" },
- { startingYear: 1648, japaneseName: 'æ
¶å®', romanizedName: "Keian" },
- { startingYear: 1652, japaneseName: 'æ¿å¿', romanizedName: "JÅÅ" },
- { startingYear: 1655, japaneseName: 'ææŠ', romanizedName: "Meireki" },
- { startingYear: 1658, japaneseName: 'äžæ²»', romanizedName: "Manji" },
- { startingYear: 1661, japaneseName: '坿', romanizedName: "Kanbun" },
- { startingYear: 1673, japaneseName: 'å»¶å®', romanizedName: "EnpÅ" },
- { startingYear: 1681, japaneseName: '倩å', romanizedName: "Tenna" },
- { startingYear: 1684, japaneseName: 'è²äº«', romanizedName: "JÅkyÅ" },
- { startingYear: 1688, japaneseName: 'å
çŠ', romanizedName: "Genroku" },
- { startingYear: 1704, japaneseName: '宿°ž', romanizedName: "HÅei" },
- { startingYear: 1711, japaneseName: 'æ£åŸ³', romanizedName: "ShÅtoku" },
- { startingYear: 1716, japaneseName: '享ä¿', romanizedName: "KyÅhÅ" },
- { startingYear: 1736, japaneseName: 'å
æ', romanizedName: "Genbun" },
- { startingYear: 1741, japaneseName: 'å¯ä¿', romanizedName: "KanpÅ" },
- { startingYear: 1744, japaneseName: '延享', romanizedName: "EnkyÅ" },
- { startingYear: 1748, japaneseName: 'å¯å»¶', romanizedName: "Kan'en" },
- { startingYear: 1751, japaneseName: '宿Š', romanizedName: "HÅreki" },
- { startingYear: 1764, japaneseName: 'æå', romanizedName: "Meiwa" },
- { startingYear: 1772, japaneseName: '宿°ž', romanizedName: "An'ei" },
- { startingYear: 1781, japaneseName: '倩æ', romanizedName: "Tenmei" },
- { startingYear: 1789, japaneseName: '坿¿', romanizedName: "Kansei" },
- { startingYear: 1801, japaneseName: '享å', romanizedName: "KyÅwa" },
- { startingYear: 1804, japaneseName: 'æå', romanizedName: "Bunka" },
- { startingYear: 1818, japaneseName: 'ææ¿', romanizedName: "Bunsei" },
- { startingYear: 1830, japaneseName: '倩ä¿', romanizedName: "TenpÅ" },
- { startingYear: 1844, japaneseName: 'åŒå', romanizedName: "KÅka" },
- { startingYear: 1848, japaneseName: 'åæ°ž', romanizedName: "Kaei" },
- { startingYear: 1854, japaneseName: '宿¿', romanizedName: "Ansei" },
- { startingYear: 1860, japaneseName: 'äžå»¶', romanizedName: "Man'en" },
- { startingYear: 1861, japaneseName: 'æä¹
', romanizedName: "Bunkyū" },
- { startingYear: 1864, japaneseName: 'å
æ²»', romanizedName: "Genji" },
- { startingYear: 1865, japaneseName: 'æ
¶å¿', romanizedName: "KeiÅ" },
- { startingYear: 1868, japaneseName: 'ææ²»', romanizedName: "Meiji" },
- { startingYear: 1912, japaneseName: '倧æ£', romanizedName: "TaishÅ" },
- { startingYear: 1926, japaneseName: 'æå', romanizedName: "ShÅwa" },
- { startingYear: 1989, japaneseName: 'å¹³æ', romanizedName: "Heisei" }
- ]
-);
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/cs/labellers.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/cs/labellers.js
deleted file mode 100644
index 954c7a8..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/cs/labellers.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/*==================================================
- * Localization of labellers.js
- *==================================================
- */
-
-Timeline.GregorianDateLabeller.monthNames["cs"] = [
- "Leden", "Únor", "Bøezen", "Duben", "Kvìten", "Èerven", "Èervenec", "Srpen", "Záøí", "Øíjen", "Listopad", "Prosinec"
-];
-
-Timeline.GregorianDateLabeller.dayNames["cs"] = [
- "Ne", "Po", "Út", "St", "Èt", "Pá", "So"
-];
-
-Timeline.GregorianDateLabeller.labelIntervalFunctions["cs"] = function(date, intervalUnit) {
- var text;
- var emphasized = false;
-
- var date2 = Timeline.DateTime.removeTimeZoneOffset(date, this._timeZone);
-
- switch(intervalUnit) {
- case Timeline.DateTime.DAY:
- case Timeline.DateTime.WEEK:
- text = date2.getUTCDate() + ". " + (date2.getUTCMonth() + 1) + ".";
- break;
- default:
- return this.defaultLabelInterval(date, intervalUnit);
- }
-
- return { text: text, emphasized: emphasized };
-};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/cs/timeline.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/cs/timeline.js
deleted file mode 100644
index d823a51..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/cs/timeline.js
+++ /dev/null
@@ -1,9 +0,0 @@
-/*==================================================
- * Common localization strings
- *==================================================
- */
-
-Timeline.strings["cs"] = {
- wikiLinkLabel: "Diskuze"
-};
-
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/de/labellers.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/de/labellers.js
deleted file mode 100644
index f0eb7df..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/de/labellers.js
+++ /dev/null
@@ -1,27 +0,0 @@
-/*==================================================
- * Localization of labellers.js
- *==================================================
- */
-
-Timeline.GregorianDateLabeller.monthNames["de"] = [
- "Jan", "Feb", "Mrz", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"
-];
-
-Timeline.GregorianDateLabeller.labelIntervalFunctions["de"] = function(date, intervalUnit) {
- var text;
- var emphasized = false;
-
- var date2 = Timeline.DateTime.removeTimeZoneOffset(date, this._timeZone);
-
- switch(intervalUnit) {
- case Timeline.DateTime.DAY:
- case Timeline.DateTime.WEEK:
- text = date2.getUTCDate() + ". " +
- Timeline.GregorianDateLabeller.getMonthName(date2.getUTCMonth(), this._locale);
- break;
- default:
- return this.defaultLabelInterval(date, intervalUnit);
- }
-
- return { text: text, emphasized: emphasized };
-};
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/de/timeline.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/de/timeline.js
deleted file mode 100644
index 7292cef..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/de/timeline.js
+++ /dev/null
@@ -1,8 +0,0 @@
-/*==================================================
- * Common localization strings
- *==================================================
- */
-
-Timeline.strings["de"] = {
- wikiLinkLabel: "Diskutieren"
-};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/en/labellers.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/en/labellers.js
deleted file mode 100644
index 3f1beb6..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/en/labellers.js
+++ /dev/null
@@ -1,8 +0,0 @@
-/*==================================================
- * Localization of labellers.js
- *==================================================
- */
-
-Timeline.GregorianDateLabeller.monthNames["en"] = [
- "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
-];
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/en/timeline.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/en/timeline.js
deleted file mode 100644
index c6b70dd..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/en/timeline.js
+++ /dev/null
@@ -1,9 +0,0 @@
-/*==================================================
- * Common localization strings
- *==================================================
- */
-
-Timeline.strings["en"] = {
- wikiLinkLabel: "Discuss"
-};
-
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/es/labellers.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/es/labellers.js
deleted file mode 100644
index 963038e..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/es/labellers.js
+++ /dev/null
@@ -1,8 +0,0 @@
-/*==================================================
- * Localization of labellers.js
- *==================================================
- */
-
-Timeline.GregorianDateLabeller.monthNames["es"] = [
- "Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic"
-];
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/es/timeline.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/es/timeline.js
deleted file mode 100644
index 2a5183c..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/es/timeline.js
+++ /dev/null
@@ -1,9 +0,0 @@
-/*==================================================
- * Common localization strings
- *==================================================
- */
-
-Timeline.strings["es"] = {
- wikiLinkLabel: "Discute"
-};
-
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/fr/labellers.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/fr/labellers.js
deleted file mode 100644
index 5e7392a..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/fr/labellers.js
+++ /dev/null
@@ -1,8 +0,0 @@
-/*==================================================
- * Localization of labellers.js
- *==================================================
- */
-
-Timeline.GregorianDateLabeller.monthNames["fr"] = [
- "jan", "fev", "mar", "avr", "mai", "jui", "jui", "aou", "sep", "oct", "nov", "dec"
-];
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/fr/timeline.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/fr/timeline.js
deleted file mode 100644
index 459cc38..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/fr/timeline.js
+++ /dev/null
@@ -1,9 +0,0 @@
-/*==================================================
- * Common localization strings
- *==================================================
- */
-
-Timeline.strings["fr"] = {
- wikiLinkLabel: "Discute"
-};
-
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/it/labellers.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/it/labellers.js
deleted file mode 100644
index 85d50d4..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/it/labellers.js
+++ /dev/null
@@ -1,8 +0,0 @@
-/*==================================================
- * Localization of labellers.js
- *==================================================
- */
-
-Timeline.GregorianDateLabeller.monthNames["it"] = [
- "Gen", "Feb", "Mar", "Apr", "Mag", "Giu", "Lug", "Ago", "Set", "Ott", "Nov", "Dic"
-];
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/it/timeline.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/it/timeline.js
deleted file mode 100644
index 69582dc..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/it/timeline.js
+++ /dev/null
@@ -1,9 +0,0 @@
-/*==================================================
- * Common localization strings
- *==================================================
- */
-
-Timeline.strings["it"] = {
- wikiLinkLabel: "Discuti"
-};
-
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/ru/labellers.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/ru/labellers.js
deleted file mode 100644
index b7545d6..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/ru/labellers.js
+++ /dev/null
@@ -1,10 +0,0 @@
-/*==================================================
- * Localization of labellers.js
- *
- * UTF-8 encoded
- *==================================================
- */
-
-Timeline.GregorianDateLabeller.monthNames["ru"] = [
- "ЯМв", "Ѐев", "ÐаÑ", "ÐпÑ", "Ðай", "ÐÑМ", "ÐÑл", "Ðвг", "СеМ", "ÐкÑ", "ÐПÑ", "Ðек"
-];
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/ru/timeline.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/ru/timeline.js
deleted file mode 100644
index af5fcc7..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/ru/timeline.js
+++ /dev/null
@@ -1,9 +0,0 @@
-/*==================================================
- * Common localization strings
- *==================================================
- */
-
-Timeline.strings["ru"] = {
- wikiLinkLabel: "ПбÑÑЎОÑе"
-};
-
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/se/labellers.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/se/labellers.js
deleted file mode 100644
index 378cda1..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/se/labellers.js
+++ /dev/null
@@ -1,12 +0,0 @@
-/*==================================================
- * Localization of labellers.js
- *==================================================
- */
-
-Timeline.GregorianDateLabeller.monthNames["se"] = [
- "Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec"
-];
-
-Timeline.GregorianDateLabeller.dayNames["se"] = [
- "Sön", "Mån", "Tis", "Ons", "Tors", "Fre", "Lör"
-];
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/se/timeline.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/se/timeline.js
deleted file mode 100644
index 31751ac..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/se/timeline.js
+++ /dev/null
@@ -1,9 +0,0 @@
-/*==================================================
- * Common localization strings
- *==================================================
- */
-
-Timeline.strings["se"] = {
- wikiLinkLabel: "Discuss"
-};
-
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/tr/labellers.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/tr/labellers.js
deleted file mode 100644
index 5d4dd72..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/tr/labellers.js
+++ /dev/null
@@ -1,8 +0,0 @@
-/*==================================================
- * Localization of labellers.js
- *==================================================
- */
-
-Timeline.GregorianDateLabeller.monthNames["tr"] = [
- "Ock", "Åbt", "Mrt", "Nsn", "Mys", "Hzr", "Tem", "AÄs", "Eyl", "Ekm", "Ksm", "Arl"
-];
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/tr/timeline.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/tr/timeline.js
deleted file mode 100644
index 696dc34..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/tr/timeline.js
+++ /dev/null
@@ -1,9 +0,0 @@
-/*==================================================
- * Common localization strings
- *==================================================
- */
-
-Timeline.strings["tr"] = {
- wikiLinkLabel: "TartıÅ"
-};
-
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/vi/labellers.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/vi/labellers.js
deleted file mode 100644
index 85994d0..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/vi/labellers.js
+++ /dev/null
@@ -1,26 +0,0 @@
-/*==================================================
- * Localization of labellers.js
- *==================================================
- */
-
-Timeline.GregorianDateLabeller.monthNames["vi"] = [
- "Tháng 1", "Tháng 2", "Tháng 3", "Tháng 4", "Tháng 5", "Tháng 6", "Tháng 7", "Tháng 8", "Tháng 9", "Tháng 10", "Tháng 11", "Tháng 12"
-];
-
-Timeline.GregorianDateLabeller.labelIntervalFunctions["vi"] = function(date, intervalUnit) {
- var text;
- var emphasized = false;
-
- var date2 = Timeline.DateTime.removeTimeZoneOffset(date, this._timeZone);
-
- switch(intervalUnit) {
- case Timeline.DateTime.DAY:
- case Timeline.DateTime.WEEK:
- text = date2.getUTCDate() + "/" + (date2.getUTCMonth() + 1);
- break;
- default:
- return this.defaultLabelInterval(date, intervalUnit);
- }
-
- return { text: text, emphasized: emphasized };
-};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/vi/timeline.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/vi/timeline.js
deleted file mode 100644
index a67befc..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/vi/timeline.js
+++ /dev/null
@@ -1,9 +0,0 @@
-/*==================================================
- * Common localization strings
- *==================================================
- */
-
-Timeline.strings["vi"] = {
- wikiLinkLabel: "BaÌn luận"
-};
-
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/zh/labellers.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/zh/labellers.js
deleted file mode 100644
index 599f2d1..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/zh/labellers.js
+++ /dev/null
@@ -1,27 +0,0 @@
-/*==================================================
- * Localization of labellers.js
- *==================================================
- */
-
-Timeline.GregorianDateLabeller.monthNames["zh"] = [
- "1æ", "2æ", "3æ", "4æ", "5æ", "6æ", "7æ", "8æ", "9æ", "10æ", "11æ", "12æ"
-];
-
-Timeline.GregorianDateLabeller.labelIntervalFunctions["zh"] = function(date, intervalUnit) {
- var text;
- var emphasized = false;
-
- var date2 = Timeline.DateTime.removeTimeZoneOffset(date, this._timeZone);
-
- switch(intervalUnit) {
- case Timeline.DateTime.DAY:
- case Timeline.DateTime.WEEK:
- text = Timeline.GregorianDateLabeller.getMonthName(date2.getUTCMonth(), this._locale) +
- date2.getUTCDate() + "æ¥";
- break;
- default:
- return this.defaultLabelInterval(date, intervalUnit);
- }
-
- return { text: text, emphasized: emphasized };
-};
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/zh/timeline.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/zh/timeline.js
deleted file mode 100644
index 9488492..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/l10n/zh/timeline.js
+++ /dev/null
@@ -1,9 +0,0 @@
-/*==================================================
- * Common localization strings
- *==================================================
- */
-
-Timeline.strings["zh"] = {
- wikiLinkLabel: "讚论"
-};
-
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/labellers.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/labellers.js
deleted file mode 100644
index 4ac874c..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/labellers.js
+++ /dev/null
@@ -1,91 +0,0 @@
-/*==================================================
- * Gregorian Date Labeller
- *==================================================
- */
-
-Timeline.GregorianDateLabeller = function(locale, timeZone) {
- this._locale = locale;
- this._timeZone = timeZone;
-};
-
-Timeline.GregorianDateLabeller.monthNames = [];
-Timeline.GregorianDateLabeller.dayNames = [];
-Timeline.GregorianDateLabeller.labelIntervalFunctions = [];
-
-Timeline.GregorianDateLabeller.getMonthName = function(month, locale) {
- return Timeline.GregorianDateLabeller.monthNames[locale][month];
-};
-
-Timeline.GregorianDateLabeller.prototype.labelInterval = function(date, intervalUnit) {
- var f = Timeline.GregorianDateLabeller.labelIntervalFunctions[this._locale];
- if (f == null) {
- f = Timeline.GregorianDateLabeller.prototype.defaultLabelInterval;
- }
- return f.call(this, date, intervalUnit);
-};
-
-Timeline.GregorianDateLabeller.prototype.labelPrecise = function(date) {
- return SimileAjax.DateTime.removeTimeZoneOffset(
- date,
- this._timeZone //+ (new Date().getTimezoneOffset() / 60)
- ).toUTCString();
-};
-
-Timeline.GregorianDateLabeller.prototype.defaultLabelInterval = function(date, intervalUnit) {
- var text;
- var emphasized = false;
-
- date = SimileAjax.DateTime.removeTimeZoneOffset(date, this._timeZone);
-
- switch(intervalUnit) {
- case SimileAjax.DateTime.MILLISECOND:
- text = date.getUTCMilliseconds();
- break;
- case SimileAjax.DateTime.SECOND:
- text = date.getUTCSeconds();
- break;
- case SimileAjax.DateTime.MINUTE:
- var m = date.getUTCMinutes();
- if (m == 0) {
- text = date.getUTCHours() + ":00";
- emphasized = true;
- } else {
- text = m;
- }
- break;
- case SimileAjax.DateTime.HOUR:
- text = date.getUTCHours() + "hr";
- break;
- case SimileAjax.DateTime.DAY:
- text = Timeline.GregorianDateLabeller.getMonthName(date.getUTCMonth(), this._locale) + " " + date.getUTCDate();
- break;
- case SimileAjax.DateTime.WEEK:
- text = Timeline.GregorianDateLabeller.getMonthName(date.getUTCMonth(), this._locale) + " " + date.getUTCDate();
- break;
- case SimileAjax.DateTime.MONTH:
- var m = date.getUTCMonth();
- if (m != 0) {
- text = Timeline.GregorianDateLabeller.getMonthName(m, this._locale);
- break;
- } // else, fall through
- case SimileAjax.DateTime.YEAR:
- case SimileAjax.DateTime.DECADE:
- case SimileAjax.DateTime.CENTURY:
- case SimileAjax.DateTime.MILLENNIUM:
- var y = date.getUTCFullYear();
- if (y > 0) {
- text = date.getUTCFullYear();
- } else {
- text = (1 - y) + "BC";
- }
- emphasized =
- (intervalUnit == SimileAjax.DateTime.MONTH) ||
- (intervalUnit == SimileAjax.DateTime.DECADE && y % 100 == 0) ||
- (intervalUnit == SimileAjax.DateTime.CENTURY && y % 1000 == 0);
- break;
- default:
- text = date.toUTCString();
- }
- return { text: text, emphasized: emphasized };
-}
-
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/original-painter.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/original-painter.js
deleted file mode 100644
index f91976c..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/original-painter.js
+++ /dev/null
@@ -1,501 +0,0 @@
-/*==================================================
- * Original Event Painter
- *==================================================
- */
-
-Timeline.OriginalEventPainter = function(params) {
- this._params = params;
- this._onSelectListeners = [];
-
- this._filterMatcher = null;
- this._highlightMatcher = null;
- this._frc = null;
-
- this._eventIdToElmt = {};
-};
-
-Timeline.OriginalEventPainter.prototype.initialize = function(band, timeline) {
- this._band = band;
- this._timeline = timeline;
-
- this._backLayer = null;
- this._eventLayer = null;
- this._lineLayer = null;
- this._highlightLayer = null;
-
- this._eventIdToElmt = null;
-};
-
-Timeline.OriginalEventPainter.prototype.addOnSelectListener = function(listener) {
- this._onSelectListeners.push(listener);
-};
-
-Timeline.OriginalEventPainter.prototype.removeOnSelectListener = function(listener) {
- for (var i = 0; i < this._onSelectListeners.length; i++) {
- if (this._onSelectListeners[i] == listener) {
- this._onSelectListeners.splice(i, 1);
- break;
- }
- }
-};
-
-Timeline.OriginalEventPainter.prototype.getFilterMatcher = function() {
- return this._filterMatcher;
-};
-
-Timeline.OriginalEventPainter.prototype.setFilterMatcher = function(filterMatcher) {
- this._filterMatcher = filterMatcher;
-};
-
-Timeline.OriginalEventPainter.prototype.getHighlightMatcher = function() {
- return this._highlightMatcher;
-};
-
-Timeline.OriginalEventPainter.prototype.setHighlightMatcher = function(highlightMatcher) {
- this._highlightMatcher = highlightMatcher;
-};
-
-Timeline.OriginalEventPainter.prototype.paint = function() {
- var eventSource = this._band.getEventSource();
- if (eventSource == null) {
- return;
- }
-
- this._eventIdToElmt = {};
- this._prepareForPainting();
-
- var eventTheme = this._params.theme.event;
- var trackHeight = Math.max(eventTheme.track.height, eventTheme.tape.height + this._frc.getLineHeight());
- var metrics = {
- trackOffset: eventTheme.track.gap,
- trackHeight: trackHeight,
- trackGap: eventTheme.track.gap,
- trackIncrement: trackHeight + eventTheme.track.gap,
- icon: eventTheme.instant.icon,
- iconWidth: eventTheme.instant.iconWidth,
- iconHeight: eventTheme.instant.iconHeight,
- labelWidth: eventTheme.label.width
- }
-
- var minDate = this._band.getMinDate();
- var maxDate = this._band.getMaxDate();
-
- var filterMatcher = (this._filterMatcher != null) ?
- this._filterMatcher :
- function(evt) { return true; };
- var highlightMatcher = (this._highlightMatcher != null) ?
- this._highlightMatcher :
- function(evt) { return -1; };
-
- var iterator = eventSource.getEventReverseIterator(minDate, maxDate);
- while (iterator.hasNext()) {
- var evt = iterator.next();
- if (filterMatcher(evt)) {
- this.paintEvent(evt, metrics, this._params.theme, highlightMatcher(evt));
- }
- }
-
- this._highlightLayer.style.display = "block";
- this._lineLayer.style.display = "block";
- this._eventLayer.style.display = "block";
-};
-
-Timeline.OriginalEventPainter.prototype.softPaint = function() {
-};
-
-Timeline.OriginalEventPainter.prototype._prepareForPainting = function() {
- var band = this._band;
-
- if (this._backLayer == null) {
- this._backLayer = this._band.createLayerDiv(0, "timeline-band-events");
- this._backLayer.style.visibility = "hidden";
-
- var eventLabelPrototype = document.createElement("span");
- eventLabelPrototype.className = "timeline-event-label";
- this._backLayer.appendChild(eventLabelPrototype);
- this._frc = SimileAjax.Graphics.getFontRenderingContext(eventLabelPrototype);
- }
- this._frc.update();
- this._tracks = [];
-
- if (this._highlightLayer != null) {
- band.removeLayerDiv(this._highlightLayer);
- }
- this._highlightLayer = band.createLayerDiv(105, "timeline-band-highlights");
- this._highlightLayer.style.display = "none";
-
- if (this._lineLayer != null) {
- band.removeLayerDiv(this._lineLayer);
- }
- this._lineLayer = band.createLayerDiv(110, "timeline-band-lines");
- this._lineLayer.style.display = "none";
-
- if (this._eventLayer != null) {
- band.removeLayerDiv(this._eventLayer);
- }
- this._eventLayer = band.createLayerDiv(115, "timeline-band-events");
- this._eventLayer.style.display = "none";
-};
-
-Timeline.OriginalEventPainter.prototype.paintEvent = function(evt, metrics, theme, highlightIndex) {
- if (evt.isInstant()) {
- this.paintInstantEvent(evt, metrics, theme, highlightIndex);
- } else {
- this.paintDurationEvent(evt, metrics, theme, highlightIndex);
- }
-};
-
-Timeline.OriginalEventPainter.prototype.paintInstantEvent = function(evt, metrics, theme, highlightIndex) {
- if (evt.isImprecise()) {
- this.paintImpreciseInstantEvent(evt, metrics, theme, highlightIndex);
- } else {
- this.paintPreciseInstantEvent(evt, metrics, theme, highlightIndex);
- }
-}
-
-Timeline.OriginalEventPainter.prototype.paintDurationEvent = function(evt, metrics, theme, highlightIndex) {
- if (evt.isImprecise()) {
- this.paintImpreciseDurationEvent(evt, metrics, theme, highlightIndex);
- } else {
- this.paintPreciseDurationEvent(evt, metrics, theme, highlightIndex);
- }
-}
-
-Timeline.OriginalEventPainter.prototype.paintPreciseInstantEvent = function(evt, metrics, theme, highlightIndex) {
- var doc = this._timeline.getDocument();
- var text = evt.getText();
-
- var startDate = evt.getStart();
- var startPixel = Math.round(this._band.dateToPixelOffset(startDate));
- var iconRightEdge = Math.round(startPixel + metrics.iconWidth / 2);
- var iconLeftEdge = Math.round(startPixel - metrics.iconWidth / 2);
-
- var labelSize = this._frc.computeSize(text);
- var labelLeft = iconRightEdge + theme.event.label.offsetFromLine;
- var labelRight = labelLeft + labelSize.width;
-
- var rightEdge = labelRight;
- var track = this._findFreeTrack(rightEdge);
-
- var labelTop = Math.round(
- metrics.trackOffset + track * metrics.trackIncrement +
- metrics.trackHeight / 2 - labelSize.height / 2);
-
- var iconElmtData = this._paintEventIcon(evt, track, iconLeftEdge, metrics, theme);
- var labelElmtData = this._paintEventLabel(evt, text, labelLeft, labelTop, labelSize.width, labelSize.height, theme);
-
- var self = this;
- var clickHandler = function(elmt, domEvt, target) {
- return self._onClickInstantEvent(iconElmtData.elmt, domEvt, evt);
- };
- SimileAjax.DOM.registerEvent(iconElmtData.elmt, "mousedown", clickHandler);
- SimileAjax.DOM.registerEvent(labelElmtData.elmt, "mousedown", clickHandler);
-
- this._createHighlightDiv(highlightIndex, iconElmtData, theme);
-
- this._eventIdToElmt[evt.getID()] = iconElmtData.elmt;
- this._tracks[track] = iconLeftEdge;
-};
-
-Timeline.OriginalEventPainter.prototype.paintImpreciseInstantEvent = function(evt, metrics, theme, highlightIndex) {
- var doc = this._timeline.getDocument();
- var text = evt.getText();
-
- var startDate = evt.getStart();
- var endDate = evt.getEnd();
- var startPixel = Math.round(this._band.dateToPixelOffset(startDate));
- var endPixel = Math.round(this._band.dateToPixelOffset(endDate));
-
- var iconRightEdge = Math.round(startPixel + metrics.iconWidth / 2);
- var iconLeftEdge = Math.round(startPixel - metrics.iconWidth / 2);
-
- var labelSize = this._frc.computeSize(text);
- var labelLeft = iconRightEdge + theme.event.label.offsetFromLine;
- var labelRight = labelLeft + labelSize.width;
-
- var rightEdge = Math.max(labelRight, endPixel);
- var track = this._findFreeTrack(rightEdge);
- var labelTop = Math.round(
- metrics.trackOffset + track * metrics.trackIncrement +
- metrics.trackHeight / 2 - labelSize.height / 2);
-
- var iconElmtData = this._paintEventIcon(evt, track, iconLeftEdge, metrics, theme);
- var labelElmtData = this._paintEventLabel(evt, text, labelLeft, labelTop, labelSize.width, labelSize.height, theme);
- var tapeElmtData = this._paintEventTape(evt, track, startPixel, endPixel,
- theme.event.instant.impreciseColor, theme.event.instant.impreciseOpacity, metrics, theme);
-
- var self = this;
- var clickHandler = function(elmt, domEvt, target) {
- return self._onClickInstantEvent(iconElmtData.elmt, domEvt, evt);
- };
- SimileAjax.DOM.registerEvent(iconElmtData.elmt, "mousedown", clickHandler);
- SimileAjax.DOM.registerEvent(tapeElmtData.elmt, "mousedown", clickHandler);
- SimileAjax.DOM.registerEvent(labelElmtData.elmt, "mousedown", clickHandler);
-
- this._createHighlightDiv(highlightIndex, iconElmtData, theme);
-
- this._eventIdToElmt[evt.getID()] = iconElmtData.elmt;
- this._tracks[track] = iconLeftEdge;
-};
-
-Timeline.OriginalEventPainter.prototype.paintPreciseDurationEvent = function(evt, metrics, theme, highlightIndex) {
- var doc = this._timeline.getDocument();
- var text = evt.getText();
-
- var startDate = evt.getStart();
- var endDate = evt.getEnd();
- var startPixel = Math.round(this._band.dateToPixelOffset(startDate));
- var endPixel = Math.round(this._band.dateToPixelOffset(endDate));
-
- var labelSize = this._frc.computeSize(text);
- var labelLeft = startPixel;
- var labelRight = labelLeft + labelSize.width;
-
- var rightEdge = Math.max(labelRight, endPixel);
- var track = this._findFreeTrack(rightEdge);
- var labelTop = Math.round(
- metrics.trackOffset + track * metrics.trackIncrement + theme.event.tape.height);
-
- var color = evt.getColor();
- color = color != null ? color : theme.event.duration.color;
-
- var tapeElmtData = this._paintEventTape(evt, track, startPixel, endPixel, color, 100, metrics, theme);
- var labelElmtData = this._paintEventLabel(evt, text, labelLeft, labelTop, labelSize.width, labelSize.height, theme);
-
- var self = this;
- var clickHandler = function(elmt, domEvt, target) {
- return self._onClickDurationEvent(tapeElmtData.elmt, domEvt, evt);
- };
- SimileAjax.DOM.registerEvent(tapeElmtData.elmt, "mousedown", clickHandler);
- SimileAjax.DOM.registerEvent(labelElmtData.elmt, "mousedown", clickHandler);
-
- this._createHighlightDiv(highlightIndex, tapeElmtData, theme);
-
- this._eventIdToElmt[evt.getID()] = tapeElmtData.elmt;
- this._tracks[track] = startPixel;
-};
-
-Timeline.OriginalEventPainter.prototype.paintImpreciseDurationEvent = function(evt, metrics, theme, highlightIndex) {
- var doc = this._timeline.getDocument();
- var text = evt.getText();
-
- var startDate = evt.getStart();
- var latestStartDate = evt.getLatestStart();
- var endDate = evt.getEnd();
- var earliestEndDate = evt.getEarliestEnd();
-
- var startPixel = Math.round(this._band.dateToPixelOffset(startDate));
- var latestStartPixel = Math.round(this._band.dateToPixelOffset(latestStartDate));
- var endPixel = Math.round(this._band.dateToPixelOffset(endDate));
- var earliestEndPixel = Math.round(this._band.dateToPixelOffset(earliestEndDate));
-
- var labelSize = this._frc.computeSize(text);
- var labelLeft = latestStartPixel;
- var labelRight = labelLeft + labelSize.width;
-
- var rightEdge = Math.max(labelRight, endPixel);
- var track = this._findFreeTrack(rightEdge);
- var labelTop = Math.round(
- metrics.trackOffset + track * metrics.trackIncrement + theme.event.tape.height);
-
- var color = evt.getColor();
- color = color != null ? color : theme.event.duration.color;
-
- var impreciseTapeElmtData = this._paintEventTape(evt, track, startPixel, endPixel,
- theme.event.duration.impreciseColor, theme.event.duration.impreciseOpacity, metrics, theme);
- var tapeElmtData = this._paintEventTape(evt, track, latestStartPixel, earliestEndPixel, color, 100, metrics, theme);
-
- var labelElmtData = this._paintEventLabel(evt, text, labelLeft, labelTop, labelSize.width, labelSize.height, theme);
-
- var self = this;
- var clickHandler = function(elmt, domEvt, target) {
- return self._onClickDurationEvent(tapeElmtData.elmt, domEvt, evt);
- };
- SimileAjax.DOM.registerEvent(tapeElmtData.elmt, "mousedown", clickHandler);
- SimileAjax.DOM.registerEvent(labelElmtData.elmt, "mousedown", clickHandler);
-
- this._createHighlightDiv(highlightIndex, tapeElmtData, theme);
-
- this._eventIdToElmt[evt.getID()] = tapeElmtData.elmt;
- this._tracks[track] = startPixel;
-};
-
-Timeline.OriginalEventPainter.prototype._findFreeTrack = function(rightEdge) {
- for (var i = 0; i < this._tracks.length; i++) {
- var t = this._tracks[i];
- if (t > rightEdge) {
- break;
- }
- }
- return i;
-};
-
-Timeline.OriginalEventPainter.prototype._paintEventIcon = function(evt, iconTrack, left, metrics, theme) {
- var icon = evt.getIcon();
- icon = icon != null ? icon : metrics.icon;
-
- var middle = metrics.trackOffset + iconTrack * metrics.trackIncrement + metrics.trackHeight / 2;
- var top = Math.round(middle - metrics.iconHeight / 2);
-
- var img = SimileAjax.Graphics.createTranslucentImage(icon);
- var iconDiv = this._timeline.getDocument().createElement("div");
- iconDiv.className = 'timeline-event-icon'
- iconDiv.style.left = left + "px";
- iconDiv.style.top = top + "px";
- iconDiv.appendChild(img);
-
- if(evt._title != null)
- iconDiv.title = evt._title;
-
- this._eventLayer.appendChild(iconDiv);
-
- return {
- left: left,
- top: top,
- width: metrics.iconWidth,
- height: metrics.iconHeight,
- elmt: iconDiv
- };
-};
-
-Timeline.OriginalEventPainter.prototype._paintEventLabel = function(evt, text, left, top, width, height, theme) {
- var doc = this._timeline.getDocument();
-
- var labelDiv = doc.createElement("div");
- labelDiv.className = 'timeline-event-label'
-
- labelDiv.style.left = left + "px";
- labelDiv.style.width = (width+10) + "px"; // GH: Had to make this a little bigger... the font metrics seem to be off
- labelDiv.style.top = top + "px";
- labelDiv.innerHTML = text;
-
- if(evt._title != null)
- labelDiv.title = evt._title;
-
- var color = evt.getTextColor();
- if (color == null) {
- color = evt.getColor();
- }
- if (color != null) {
- labelDiv.style.color = color;
- }
-
-
- var classname = evt.getClassName()
- if(classname) labelDiv.className +=' ' + classname;
-
-
-
- this._eventLayer.appendChild(labelDiv);
-
- return {
- left: left,
- top: top,
- width: width,
- height: height,
- elmt: labelDiv
- };
-};
-
-Timeline.OriginalEventPainter.prototype._paintEventTape = function(
- evt, iconTrack, startPixel, endPixel, color, opacity, metrics, theme) {
-
- var tapeWidth = endPixel - startPixel;
- var tapeHeight = theme.event.tape.height;
- var top = metrics.trackOffset + iconTrack * metrics.trackIncrement;
-
- var tapeDiv = this._timeline.getDocument().createElement("div");
- tapeDiv.className = "timeline-event-tape"
-
- tapeDiv.style.left = startPixel + "px";
- tapeDiv.style.width = tapeWidth + "px";
- tapeDiv.style.top = top + "px";
-
- if(evt._title != null)
- tapeDiv.title = evt._title;
-
- SimileAjax.Graphics.setOpacity(tapeDiv, opacity);
-
- this._eventLayer.appendChild(tapeDiv);
-
- return {
- left: startPixel,
- top: top,
- width: tapeWidth,
- height: tapeHeight,
- elmt: tapeDiv
- };
-}
-
-Timeline.OriginalEventPainter.prototype._createHighlightDiv = function(highlightIndex, dimensions, theme) {
- if (highlightIndex >= 0) {
- var doc = this._timeline.getDocument();
- var eventTheme = theme.event;
-
- var color = eventTheme.highlightColors[Math.min(highlightIndex, eventTheme.highlightColors.length - 1)];
-
- var div = doc.createElement("div");
- div.style.position = "absolute";
- div.style.overflow = "hidden";
- div.style.left = (dimensions.left - 2) + "px";
- div.style.width = (dimensions.width + 4) + "px";
- div.style.top = (dimensions.top - 2) + "px";
- div.style.height = (dimensions.height + 4) + "px";
-// div.style.background = color;
-
- this._highlightLayer.appendChild(div);
- }
-};
-
-Timeline.OriginalEventPainter.prototype._onClickInstantEvent = function(icon, domEvt, evt) {
- var c = SimileAjax.DOM.getPageCoordinates(icon);
- this._showBubble(
- c.left + Math.ceil(icon.offsetWidth / 2),
- c.top + Math.ceil(icon.offsetHeight / 2),
- evt
- );
- this._fireOnSelect(evt.getID());
-
- domEvt.cancelBubble = true;
- SimileAjax.DOM.cancelEvent(domEvt);
- return false;
-};
-
-Timeline.OriginalEventPainter.prototype._onClickDurationEvent = function(target, domEvt, evt) {
- if ("pageX" in domEvt) {
- var x = domEvt.pageX;
- var y = domEvt.pageY;
- } else {
- var c = SimileAjax.DOM.getPageCoordinates(target);
- var x = domEvt.offsetX + c.left;
- var y = domEvt.offsetY + c.top;
- }
- this._showBubble(x, y, evt);
- this._fireOnSelect(evt.getID());
-
- domEvt.cancelBubble = true;
- SimileAjax.DOM.cancelEvent(domEvt);
- return false;
-};
-
-Timeline.OriginalEventPainter.prototype.showBubble = function(evt) {
- var elmt = this._eventIdToElmt[evt.getID()];
- if (elmt) {
- var c = SimileAjax.DOM.getPageCoordinates(elmt);
- this._showBubble(c.left + elmt.offsetWidth / 2, c.top + elmt.offsetHeight / 2, evt);
- }
-};
-
-Timeline.OriginalEventPainter.prototype._showBubble = function(x, y, evt) {
- var div = document.createElement("div");
- evt.fillInfoBubble(div, this._params.theme, this._band.getLabeller());
-
- SimileAjax.WindowManager.cancelPopups();
- SimileAjax.Graphics.createBubbleForContentAndPoint(div, x, y, this._params.theme.event.bubble.width);
-};
-
-Timeline.OriginalEventPainter.prototype._fireOnSelect = function(eventID) {
- for (var i = 0; i < this._onSelectListeners.length; i++) {
- this._onSelectListeners[i](eventID);
- }
-};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/overview-painter.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/overview-painter.js
deleted file mode 100644
index 99722c3..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/overview-painter.js
+++ /dev/null
@@ -1,238 +0,0 @@
-/*==================================================
- * Overview Event Painter
- *==================================================
- */
-
-Timeline.OverviewEventPainter = function(params) {
- this._params = params;
- this._onSelectListeners = [];
-
- this._filterMatcher = null;
- this._highlightMatcher = null;
-};
-
-Timeline.OverviewEventPainter.prototype.initialize = function(band, timeline) {
- this._band = band;
- this._timeline = timeline;
-
- this._eventLayer = null;
- this._highlightLayer = null;
-};
-
-Timeline.OverviewEventPainter.prototype.addOnSelectListener = function(listener) {
- this._onSelectListeners.push(listener);
-};
-
-Timeline.OverviewEventPainter.prototype.removeOnSelectListener = function(listener) {
- for (var i = 0; i < this._onSelectListeners.length; i++) {
- if (this._onSelectListeners[i] == listener) {
- this._onSelectListeners.splice(i, 1);
- break;
- }
- }
-};
-
-Timeline.OverviewEventPainter.prototype.getFilterMatcher = function() {
- return this._filterMatcher;
-};
-
-Timeline.OverviewEventPainter.prototype.setFilterMatcher = function(filterMatcher) {
- this._filterMatcher = filterMatcher;
-};
-
-Timeline.OverviewEventPainter.prototype.getHighlightMatcher = function() {
- return this._highlightMatcher;
-};
-
-Timeline.OverviewEventPainter.prototype.setHighlightMatcher = function(highlightMatcher) {
- this._highlightMatcher = highlightMatcher;
-};
-
-Timeline.OverviewEventPainter.prototype.paint = function() {
- var eventSource = this._band.getEventSource();
- if (eventSource == null) {
- return;
- }
-
- this._prepareForPainting();
-
- var eventTheme = this._params.theme.event;
- var metrics = {
- trackOffset: eventTheme.overviewTrack.offset,
- trackHeight: eventTheme.overviewTrack.height,
- trackGap: eventTheme.overviewTrack.gap,
- trackIncrement: eventTheme.overviewTrack.height + eventTheme.overviewTrack.gap
- }
-
- var minDate = this._band.getMinDate();
- var maxDate = this._band.getMaxDate();
-
- var filterMatcher = (this._filterMatcher != null) ?
- this._filterMatcher :
- function(evt) { return true; };
- var highlightMatcher = (this._highlightMatcher != null) ?
- this._highlightMatcher :
- function(evt) { return -1; };
-
- var iterator = eventSource.getEventReverseIterator(minDate, maxDate);
- while (iterator.hasNext()) {
- var evt = iterator.next();
- if (filterMatcher(evt)) {
- this.paintEvent(evt, metrics, this._params.theme, highlightMatcher(evt));
- }
- }
-
- this._highlightLayer.style.display = "block";
- this._eventLayer.style.display = "block";
-};
-
-Timeline.OverviewEventPainter.prototype.softPaint = function() {
-};
-
-Timeline.OverviewEventPainter.prototype._prepareForPainting = function() {
- var band = this._band;
-
- this._tracks = [];
-
- if (this._highlightLayer != null) {
- band.removeLayerDiv(this._highlightLayer);
- }
- this._highlightLayer = band.createLayerDiv(105, "timeline-band-highlights");
- this._highlightLayer.style.display = "none";
-
- if (this._eventLayer != null) {
- band.removeLayerDiv(this._eventLayer);
- }
- this._eventLayer = band.createLayerDiv(110, "timeline-band-events");
- this._eventLayer.style.display = "none";
-};
-
-Timeline.OverviewEventPainter.prototype.paintEvent = function(evt, metrics, theme, highlightIndex) {
- if (evt.isInstant()) {
- this.paintInstantEvent(evt, metrics, theme, highlightIndex);
- } else {
- this.paintDurationEvent(evt, metrics, theme, highlightIndex);
- }
-};
-
-Timeline.OverviewEventPainter.prototype.paintInstantEvent = function(evt, metrics, theme, highlightIndex) {
- var startDate = evt.getStart();
- var startPixel = Math.round(this._band.dateToPixelOffset(startDate));
-
- var color = evt.getColor();
- color = color != null ? color : theme.event.duration.color;
-
- var tickElmtData = this._paintEventTick(evt, startPixel, color, 100, metrics, theme);
-
- this._createHighlightDiv(highlightIndex, tickElmtData, theme);
-};
-
-Timeline.OverviewEventPainter.prototype.paintDurationEvent = function(evt, metrics, theme, highlightIndex) {
- var latestStartDate = evt.getLatestStart();
- var earliestEndDate = evt.getEarliestEnd();
-
- var latestStartPixel = Math.round(this._band.dateToPixelOffset(latestStartDate));
- var earliestEndPixel = Math.round(this._band.dateToPixelOffset(earliestEndDate));
-
- var tapeTrack = 0;
- for (; tapeTrack < this._tracks.length; tapeTrack++) {
- if (earliestEndPixel < this._tracks[tapeTrack]) {
- break;
- }
- }
- this._tracks[tapeTrack] = earliestEndPixel;
-
- var color = evt.getColor();
- color = color != null ? color : theme.event.duration.color;
-
- var tapeElmtData = this._paintEventTape(evt, tapeTrack, latestStartPixel, earliestEndPixel, color, 100, metrics, theme);
-
- this._createHighlightDiv(highlightIndex, tapeElmtData, theme);
-};
-
-Timeline.OverviewEventPainter.prototype._paintEventTape = function(
- evt, track, left, right, color, opacity, metrics, theme) {
-
- var top = metrics.trackOffset + track * metrics.trackIncrement;
- var width = right - left;
- var height = metrics.trackHeight;
-
- var tapeDiv = this._timeline.getDocument().createElement("div");
- tapeDiv.className = 'timeline-small-event-tape'
-// tapeDiv.style.position = "absolute";
- tapeDiv.style.left = left + "px";
- tapeDiv.style.width = width + "px";
- tapeDiv.style.top = top + "px";
- // tapeDiv.style.height = height + "px";
- // tapeDiv.style.backgroundColor = color;
- // tapeDiv.style.overflow = "hidden";
- if(opacity<100) SimileAjax.Graphics.setOpacity(tapeDiv, opacity);
-
- this._eventLayer.appendChild(tapeDiv);
-
- return {
- left: left,
- top: top,
- width: width,
- height: height,
- elmt: tapeDiv
- };
-}
-
-Timeline.OverviewEventPainter.prototype._paintEventTick = function(
- evt, left, color, opacity, metrics, theme) {
-
- var height = theme.event.overviewTrack.tickHeight;
- var top = metrics.trackOffset - height;
- var width = 1;
-
- var tickDiv = this._timeline.getDocument().createElement("div");
- tickDiv.className = 'timeline-small-event-icon'
-// tickDiv.style.position = "absolute";
- tickDiv.style.left = left + "px";
- // tickDiv.style.width = width + "px";
- tickDiv.style.top = top + "px";
- // tickDiv.style.height = height + "px";
-// tickDiv.style.backgroundColor = color;
-// tickDiv.style.overflow = "hidden";
-
- var classname = evt.getClassName()
- if(classname) tickDiv.className +=' small-' + classname;
-
-
- if(opacity<100) SimileAjax.Graphics.setOpacity(tickDiv, opacity);
-
- this._eventLayer.appendChild(tickDiv);
-
- return {
- left: left,
- top: top,
- width: width,
- height: height,
- elmt: tickDiv
- };
-}
-
-Timeline.OverviewEventPainter.prototype._createHighlightDiv = function(highlightIndex, dimensions, theme) {
- if (highlightIndex >= 0) {
- var doc = this._timeline.getDocument();
- var eventTheme = theme.event;
-
- var color = eventTheme.highlightColors[Math.min(highlightIndex, eventTheme.highlightColors.length - 1)];
-
- var div = doc.createElement("div");
- div.style.position = "absolute";
- div.style.overflow = "hidden";
- div.style.left = (dimensions.left - 1) + "px";
- div.style.width = (dimensions.width + 2) + "px";
- div.style.top = (dimensions.top - 1) + "px";
- div.style.height = (dimensions.height + 2) + "px";
- div.style.background = color;
-
- this._highlightLayer.appendChild(div);
- }
-};
-
-Timeline.OverviewEventPainter.prototype.showBubble = function(evt) {
- // not implemented
-};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/sources.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/sources.js
deleted file mode 100644
index 9cddd2d..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/sources.js
+++ /dev/null
@@ -1,446 +0,0 @@
-/*==================================================
- * Default Event Source
- *==================================================
- */
-
-
-Timeline.DefaultEventSource = function(eventIndex) {
- this._events = (eventIndex instanceof Object) ? eventIndex : new SimileAjax.EventIndex();
- this._listeners = [];
-};
-
-Timeline.DefaultEventSource.prototype.addListener = function(listener) {
- this._listeners.push(listener);
-};
-
-Timeline.DefaultEventSource.prototype.removeListener = function(listener) {
- for (var i = 0; i < this._listeners.length; i++) {
- if (this._listeners[i] == listener) {
- this._listeners.splice(i, 1);
- break;
- }
- }
-};
-
-Timeline.DefaultEventSource.prototype.loadXML = function(xml, url) {
- var base = this._getBaseURL(url);
-
- var wikiURL = xml.documentElement.getAttribute("wiki-url");
- var wikiSection = xml.documentElement.getAttribute("wiki-section");
-
- var dateTimeFormat = xml.documentElement.getAttribute("date-time-format");
- var parseDateTimeFunction = this._events.getUnit().getParser(dateTimeFormat);
-
- var node = xml.documentElement.firstChild;
- var added = false;
- while (node != null) {
- if (node.nodeType == 1) {
- var description = "";
- if (node.firstChild != null && node.firstChild.nodeType == 3) {
- description = node.firstChild.nodeValue;
- }
- var evt = new Timeline.DefaultEventSource.Event(
- node.getAttribute("id"),
- parseDateTimeFunction(node.getAttribute("start")),
- parseDateTimeFunction(node.getAttribute("end")),
- parseDateTimeFunction(node.getAttribute("latestStart")),
- parseDateTimeFunction(node.getAttribute("earliestEnd")),
- node.getAttribute("isDuration") != "true",
- node.getAttribute("title"),
- description,
- this._resolveRelativeURL(node.getAttribute("image"), base),
- this._resolveRelativeURL(node.getAttribute("link"), base),
- this._resolveRelativeURL(node.getAttribute("icon"), base),
- node.getAttribute("color"),
- node.getAttribute("textColor"),
- node.getAttribute("classname")
- );
-
- evt._node = node;
- evt.getProperty = function(name) {
- return this._node.getAttribute(name);
- };
- evt.setWikiInfo(wikiURL, wikiSection);
-
- this._events.add(evt);
-
- added = true;
- }
- node = node.nextSibling;
- }
-
- if (added) {
- this._fire("onAddMany", []);
- }
-};
-
-
-Timeline.DefaultEventSource.prototype.loadJSON = function(data, url) {
- var base = this._getBaseURL(url);
- var added = false;
- if (data && data.events){
- var wikiURL = ("wikiURL" in data) ? data.wikiURL : null;
- var wikiSection = ("wikiSection" in data) ? data.wikiSection : null;
-
- var dateTimeFormat = ("dateTimeFormat" in data) ? data.dateTimeFormat : null;
- var parseDateTimeFunction = this._events.getUnit().getParser(dateTimeFormat);
-
- for (var i=0; i < data.events.length; i++){
- var event = data.events[i];
- var evt = new Timeline.DefaultEventSource.Event(
- ("id" in event) ? event.id : undefined,
- parseDateTimeFunction(event.start),
- parseDateTimeFunction(event.end),
- parseDateTimeFunction(event.latestStart),
- parseDateTimeFunction(event.earliestEnd),
- event.isDuration || false,
- event.title,
- event.description,
- this._resolveRelativeURL(event.image, base),
- this._resolveRelativeURL(event.link, base),
- this._resolveRelativeURL(event.icon, base),
- event.color,
- event.textColor,
- event.classname
- );
- evt._obj = event;
- evt.getProperty = function(name) {
- return this._obj[name];
- };
- evt.setWikiInfo(wikiURL, wikiSection);
-
- this._events.add(evt);
- added = true;
- }
- }
-
- if (added) {
- this._fire("onAddMany", []);
- }
-};
-
-/*
- * Contributed by Morten Frederiksen, http://www.wasab.dk/morten/
- */
-Timeline.DefaultEventSource.prototype.loadSPARQL = function(xml, url) {
- var base = this._getBaseURL(url);
-
- var dateTimeFormat = 'iso8601';
- var parseDateTimeFunction = this._events.getUnit().getParser(dateTimeFormat);
-
- if (xml == null) {
- return;
- }
-
- /*
- * Find <results> tag
- */
- var node = xml.documentElement.firstChild;
- while (node != null && (node.nodeType != 1 || node.nodeName != 'results')) {
- node = node.nextSibling;
- }
-
- var wikiURL = null;
- var wikiSection = null;
- if (node != null) {
- wikiURL = node.getAttribute("wiki-url");
- wikiSection = node.getAttribute("wiki-section");
-
- node = node.firstChild;
- }
-
- var added = false;
- while (node != null) {
- if (node.nodeType == 1) {
- var bindings = { };
- var binding = node.firstChild;
- while (binding != null) {
- if (binding.nodeType == 1 &&
- binding.firstChild != null &&
- binding.firstChild.nodeType == 1 &&
- binding.firstChild.firstChild != null &&
- binding.firstChild.firstChild.nodeType == 3) {
- bindings[binding.getAttribute('name')] = binding.firstChild.firstChild.nodeValue;
- }
- binding = binding.nextSibling;
- }
-
- if (bindings["start"] == null && bindings["date"] != null) {
- bindings["start"] = bindings["date"];
- }
-
- var evt = new Timeline.DefaultEventSource.Event(
- bindings["id"],
- parseDateTimeFunction(bindings["start"]),
- parseDateTimeFunction(bindings["end"]),
- parseDateTimeFunction(bindings["latestStart"]),
- parseDateTimeFunction(bindings["earliestEnd"]),
- bindings["isDuration"] != "true",
- bindings["title"],
- bindings["description"],
- this._resolveRelativeURL(bindings["image"], base),
- this._resolveRelativeURL(bindings["link"], base),
- this._resolveRelativeURL(bindings["icon"], base),
- bindings["color"],
- bindings["textColor"],
- bindings["classname"]
- );
- evt._bindings = bindings;
- evt.getProperty = function(name) {
- return this._bindings[name];
- };
- evt.setWikiInfo(wikiURL, wikiSection);
-
- this._events.add(evt);
- added = true;
- }
- node = node.nextSibling;
- }
-
- if (added) {
- this._fire("onAddMany", []);
- }
-};
-
-Timeline.DefaultEventSource.prototype.add = function(evt) {
- this._events.add(evt);
- this._fire("onAddOne", [evt]);
-};
-
-Timeline.DefaultEventSource.prototype.addMany = function(events) {
- for (var i = 0; i < events.length; i++) {
- this._events.add(events[i]);
- }
- this._fire("onAddMany", []);
-};
-
-Timeline.DefaultEventSource.prototype.clear = function() {
- this._events.removeAll();
- this._fire("onClear", []);
-};
-
-Timeline.DefaultEventSource.prototype.getEvent = function(id) {
- return this._events.getEvent(id);
-};
-
-Timeline.DefaultEventSource.prototype.getEventIterator = function(startDate, endDate) {
- return this._events.getIterator(startDate, endDate);
-};
-
-Timeline.DefaultEventSource.prototype.getEventReverseIterator = function(startDate, endDate) {
- return this._events.getReverseIterator(startDate, endDate);
-};
-
-Timeline.DefaultEventSource.prototype.getAllEventIterator = function() {
- return this._events.getAllIterator();
-};
-
-Timeline.DefaultEventSource.prototype.getCount = function() {
- return this._events.getCount();
-};
-
-Timeline.DefaultEventSource.prototype.getEarliestDate = function() {
- return this._events.getEarliestDate();
-};
-
-Timeline.DefaultEventSource.prototype.getLatestDate = function() {
- return this._events.getLatestDate();
-};
-
-Timeline.DefaultEventSource.prototype._fire = function(handlerName, args) {
- for (var i = 0; i < this._listeners.length; i++) {
- var listener = this._listeners[i];
- if (handlerName in listener) {
- try {
- listener[handlerName].apply(listener, args);
- } catch (e) {
- SimileAjax.Debug.exception(e);
- }
- }
- }
-};
-
-Timeline.DefaultEventSource.prototype._getBaseURL = function(url) {
- if (url.indexOf("://") < 0) {
- var url2 = this._getBaseURL(document.location.href);
- if (url.substr(0,1) == "/") {
- url = url2.substr(0, url2.indexOf("/", url2.indexOf("://") + 3)) + url;
- } else {
- url = url2 + url;
- }
- }
-
- var i = url.lastIndexOf("/");
- if (i < 0) {
- return "";
- } else {
- return url.substr(0, i+1);
- }
-};
-
-Timeline.DefaultEventSource.prototype._resolveRelativeURL = function(url, base) {
- if (url == null || url == "") {
- return url;
- } else if (url.indexOf("://") > 0) {
- return url;
- } else if (url.substr(0,1) == "/") {
- return base.substr(0, base.indexOf("/", base.indexOf("://") + 3)) + url;
- } else {
- return base + url;
- }
-};
-
-
-Timeline.DefaultEventSource.Event = function(
- id,
- start, end, latestStart, earliestEnd, instant,
- text, description, image, link,
- icon, color, textColor, hoverText, classname) {
-
- id = (id) ? id.trim() : "";
- this._id = id.length > 0 ? id : ("e" + Math.floor(Math.random() * 1000000));
-
- this._instant = instant || (end == null);
-
- this._start = start;
- this._end = (end != null) ? end : start;
-
- this._latestStart = (latestStart != null) ? latestStart : (instant ? this._end : this._start);
- this._earliestEnd = (earliestEnd != null) ? earliestEnd : (instant ? this._start : this._end);
-
- this._text = SimileAjax.HTML.deEntify(text);
- this._description = SimileAjax.HTML.deEntify(description);
- this._image = (image != null && image != "") ? image : null;
- this._link = (link != null && link != "") ? link : null;
- this._title = (hoverText != null) ? hoverText : null;
-
- this._icon = (icon != null && icon != "") ? icon : null;
- this._color = (color != null && color != "") ? color : null;
- this._textColor = (textColor != null && textColor != "") ? textColor : null;
- this._classname = (classname != null && classname != "") ? classname : null;
-
- this._wikiURL = null;
- this._wikiSection = null;
-};
-
-Timeline.DefaultEventSource.Event.prototype = {
- getID: function() { return this._id; },
-
- isInstant: function() { return this._instant; },
- isImprecise: function() { return this._start != this._latestStart || this._end != this._earliestEnd; },
-
- getStart: function() { return this._start; },
- getEnd: function() { return this._end; },
- getLatestStart: function() { return this._latestStart; },
- getEarliestEnd: function() { return this._earliestEnd; },
-
- getText: function() { return this._text; },
- getDescription: function() { return this._description; },
- getImage: function() { return this._image; },
- getLink: function() { return this._link; },
-
- getIcon: function() { return this._icon; },
- getColor: function() { return this._color; },
- getTextColor: function() { return this._textColor; },
- getClassName: function() {return this._classname; },
-
- getProperty: function(name) { return null; },
-
- getWikiURL: function() { return this._wikiURL; },
- getWikiSection: function() { return this._wikiSection; },
- setWikiInfo: function(wikiURL, wikiSection) {
- this._wikiURL = wikiURL;
- this._wikiSection = wikiSection;
- },
-
- fillDescription: function(elmt) {
- elmt.innerHTML = this._description;
- },
- fillWikiInfo: function(elmt) {
- if (this._wikiURL != null && this._wikiSection != null) {
- var wikiID = this.getProperty("wikiID");
- if (wikiID == null || wikiID.length == 0) {
- wikiID = this.getText();
- }
- wikiID = wikiID.replace(/\s/g, "_");
-
- var url = this._wikiURL + this._wikiSection.replace(/\s/g, "_") + "/" + wikiID;
- var a = document.createElement("a");
- a.href = url;
- a.target = "new";
- a.innerHTML = Timeline.strings[Timeline.clientLocale].wikiLinkLabel;
-
- elmt.appendChild(document.createTextNode("["));
- elmt.appendChild(a);
- elmt.appendChild(document.createTextNode("]"));
- } else {
- elmt.style.display = "none";
- }
- },
- fillTime: function(elmt, labeller) {
- if (this._instant) {
- if (this.isImprecise()) {
- elmt.appendChild(elmt.ownerDocument.createTextNode(labeller.labelPrecise(this._start)));
- elmt.appendChild(elmt.ownerDocument.createElement("br"));
- elmt.appendChild(elmt.ownerDocument.createTextNode(labeller.labelPrecise(this._end)));
- } else {
- elmt.appendChild(elmt.ownerDocument.createTextNode(labeller.labelPrecise(this._start)));
- }
- } else {
- if (this.isImprecise()) {
- elmt.appendChild(elmt.ownerDocument.createTextNode(
- labeller.labelPrecise(this._start) + " ~ " + labeller.labelPrecise(this._latestStart)));
- elmt.appendChild(elmt.ownerDocument.createElement("br"));
- elmt.appendChild(elmt.ownerDocument.createTextNode(
- labeller.labelPrecise(this._earliestEnd) + " ~ " + labeller.labelPrecise(this._end)));
- } else {
- elmt.appendChild(elmt.ownerDocument.createTextNode(labeller.labelPrecise(this._start)));
- elmt.appendChild(elmt.ownerDocument.createElement("br"));
- elmt.appendChild(elmt.ownerDocument.createTextNode(labeller.labelPrecise(this._end)));
- }
- }
- },
- fillInfoBubble: function(elmt, theme, labeller) {
- var doc = elmt.ownerDocument;
-
- var title = this.getText();
- var link = this.getLink();
- var image = this.getImage();
-
- if (image != null) {
- var img = doc.createElement("img");
- img.src = image;
-
- theme.event.bubble.imageStyler(img);
- elmt.appendChild(img);
- }
-
- var divTitle = doc.createElement("div");
- var textTitle = doc.createTextNode(title);
- if (link != null) {
- var a = doc.createElement("a");
- a.href = link;
- a.appendChild(textTitle);
- divTitle.appendChild(a);
- } else {
- divTitle.appendChild(textTitle);
- }
- theme.event.bubble.titleStyler(divTitle);
- elmt.appendChild(divTitle);
-
- var divBody = doc.createElement("div");
- this.fillDescription(divBody);
- theme.event.bubble.bodyStyler(divBody);
- elmt.appendChild(divBody);
-
- var divTime = doc.createElement("div");
- this.fillTime(divTime, labeller);
- theme.event.bubble.timeStyler(divTime);
- elmt.appendChild(divTime);
-
- var divWiki = doc.createElement("div");
- this.fillWikiInfo(divWiki);
- theme.event.bubble.wikiStyler(divWiki);
- elmt.appendChild(divWiki);
- }
-};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/themes.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/themes.js
deleted file mode 100644
index f196f53..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/themes.js
+++ /dev/null
@@ -1,145 +0,0 @@
-/*==================================================
- * Classic Theme
- *==================================================
- */
-
-
-
-Timeline.ClassicTheme = new Object();
-
-Timeline.ClassicTheme.implementations = [];
-
-Timeline.ClassicTheme.create = function(locale) {
- if (locale == null) {
- locale = Timeline.getDefaultLocale();
- }
-
- var f = Timeline.ClassicTheme.implementations[locale];
- if (f == null) {
- f = Timeline.ClassicTheme._Impl;
- }
- return new f();
-};
-
-Timeline.ClassicTheme._Impl = function() {
- this.firstDayOfWeek = 0; // Sunday
-
- this.ether = {
- backgroundColors: [
- // "#EEE",
- // "#DDD",
- // "#CCC",
- // "#AAA"
- ],
- // highlightColor: "white",
- highlightOpacity: 50,
- interval: {
- line: {
- show: true,
- // color: "#aaa",
- opacity: 25
- },
- weekend: {
- // color: "#FFFFE0",
- opacity: 30
- },
- marker: {
- hAlign: "Bottom",
- /*
- hBottomStyler: function(elmt) {
- elmt.className = "timeline-ether-marker-bottom";
- },
- hBottomEmphasizedStyler: function(elmt) {
- elmt.className = "timeline-ether-marker-bottom-emphasized";
- },
- hTopStyler: function(elmt) {
- elmt.className = "timeline-ether-marker-top";
- },
- hTopEmphasizedStyler: function(elmt) {
- elmt.className = "timeline-ether-marker-top-emphasized";
- },
- */
-
-
- vAlign: "Right"
- /*
- vRightStyler: function(elmt) {
- elmt.className = "timeline-ether-marker-right";
- },
- vRightEmphasizedStyler: function(elmt) {
- elmt.className = "timeline-ether-marker-right-emphasized";
- },
- vLeftStyler: function(elmt) {
- elmt.className = "timeline-ether-marker-left";
- },
- vLeftEmphasizedStyler:function(elmt) {
- elmt.className = "timeline-ether-marker-left-emphasized";
- }
- */
- }
- }
- };
-
- this.event = {
- track: {
- height: 10, // px
- gap: 2 // px
- },
- overviewTrack: {
- offset: 20, // px
- tickHeight: 6, // px
- height: 2, // px
- gap: 1 // px
- },
- tape: {
- height: 4 // px
- },
- instant: {
- icon: Timeline.urlPrefix + "images/dull-blue-circle.png",
- iconWidth: 20, // GH: Had to make this larger to support our grouped icons
- iconHeight: 10,
- // color: "#58A0DC",
- // impreciseColor: "#58A0DC",
- impreciseOpacity: 20
- },
- duration: {
- // color: "#58A0DC",
- // impreciseColor: "#58A0DC",
- impreciseOpacity: 20
- },
- label: {
- // backgroundColor: "white",
- backgroundOpacity: 50,
- // lineColor: "#58A0DC",
- width: 200,
- offsetFromLine: 3 // px
- },
- highlightColors: [
- // "#FFFF00",
- // "#FFC000",
- // "#FF0000",
- // "#0000FF"
- ],
- bubble: {
- width: 250, // px
- height: 125, // px
- titleStyler: function(elmt) {
- elmt.className = "timeline-event-bubble-title";
- },
- bodyStyler: function(elmt) {
- elmt.className = "timeline-event-bubble-body";
- },
- imageStyler: function(elmt) {
- elmt.className = "timeline-event-bubble-image";
- },
- wikiStyler: function(elmt) {
- elmt.className = "timeline-event-bubble-wiki";
- },
- timeStyler: function(elmt) {
- elmt.className = "timeline-event-bubble-time";
- }
- }
- };
-
- this.zoom = true; // true or false
-};
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/timeline.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/timeline.js
deleted file mode 100644
index 9f3e8f0..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/timeline.js
+++ /dev/null
@@ -1,1040 +0,0 @@
-/*==================================================
- * Timeline
- *==================================================
- */
-
-Timeline.strings = {}; // localization string tables
-
-Timeline.getDefaultLocale = function() {
- return Timeline.clientLocale;
-};
-
-Timeline.create = function(elmt, bandInfos, orientation, unit) {
- return new Timeline._Impl(elmt, bandInfos, orientation, unit);
-};
-
-Timeline.HORIZONTAL = 0;
-Timeline.VERTICAL = 1;
-
-Timeline._defaultTheme = null;
-
-Timeline.createBandInfo = function(params) {
- var theme = ("theme" in params) ? params.theme : Timeline.getDefaultTheme();
-
- var eventSource = ("eventSource" in params) ? params.eventSource : null;
-
- var ether = new Timeline.LinearEther({
- centersOn: ("date" in params) ? params.date : new Date(),
- interval: SimileAjax.DateTime.gregorianUnitLengths[params.intervalUnit],
- pixelsPerInterval: params.intervalPixels,
- theme: theme
- });
-
- var etherPainter = new Timeline.GregorianEtherPainter({
- unit: params.intervalUnit,
- multiple: ("multiple" in params) ? params.multiple : 1,
- theme: theme,
- align: ("align" in params) ? params.align : undefined
- });
-
- var eventPainterParams = {
- showText: ("showEventText" in params) ? params.showEventText : false,
- theme: theme
- };
- // pass in custom parameters for the event painter
- if ("eventPainterParams" in params) {
- for (var prop in params.eventPainterParams) {
- eventPainterParams[prop] = params.eventPainterParams[prop];
- }
- }
-
- if ("trackHeight" in params) {
- eventPainterParams.trackHeight = params.trackHeight;
- }
- if ("trackGap" in params) {
- eventPainterParams.trackGap = params.trackGap;
- }
-
- var layout = ("overview" in params && params.overview) ? "overview" : ("layout" in params ? params.layout : "original");
- var eventPainter;
- if ("eventPainter" in params) {
- eventPainter = new params.eventPainter(eventPainterParams);
- } else {
- switch (layout) {
- case "overview" :
- eventPainter = new Timeline.OverviewEventPainter(eventPainterParams);
- break;
- case "detailed" :
- eventPainter = new Timeline.DetailedEventPainter(eventPainterParams);
- break;
- default:
- eventPainter = new Timeline.OriginalEventPainter(eventPainterParams);
- }
- }
-
- return {
- width: params.width,
- eventSource: eventSource,
- timeZone: ("timeZone" in params) ? params.timeZone : 0,
- ether: ether,
- etherPainter: etherPainter,
- eventPainter: eventPainter,
- theme: theme,
- zoomIndex: ("zoomIndex" in params) ? params.zoomIndex : 0,
- zoomSteps: ("zoomSteps" in params) ? params.zoomSteps : null
- };
-};
-
-Timeline.createHotZoneBandInfo = function(params) {
- var theme = ("theme" in params) ? params.theme : Timeline.getDefaultTheme();
-
- var eventSource = ("eventSource" in params) ? params.eventSource : null;
-
- var ether = new Timeline.HotZoneEther({
- centersOn: ("date" in params) ? params.date : new Date(),
- interval: SimileAjax.DateTime.gregorianUnitLengths[params.intervalUnit],
- pixelsPerInterval: params.intervalPixels,
- zones: params.zones,
- theme: theme
- });
-
- var etherPainter = new Timeline.HotZoneGregorianEtherPainter({
- unit: params.intervalUnit,
- zones: params.zones,
- theme: theme,
- align: ("align" in params) ? params.align : undefined
- });
-
- var eventPainterParams = {
- showText: ("showEventText" in params) ? params.showEventText : true,
- theme: theme
- };
- // pass in custom parameters for the event painter
- if ("eventPainterParams" in params) {
- for (var prop in params.eventPainterParams) {
- eventPainterParams[prop] = params.eventPainterParams[prop];
- }
- }
- if ("trackHeight" in params) {
- eventPainterParams.trackHeight = params.trackHeight;
- }
- if ("trackGap" in params) {
- eventPainterParams.trackGap = params.trackGap;
- }
-
- var layout = ("overview" in params && params.overview) ? "overview" : ("layout" in params ? params.layout : "original");
- var eventPainter;
- if ("eventPainter" in params) {
- eventPainter = new params.eventPainter(eventPainterParams);
- } else {
- switch (layout) {
- case "overview" :
- eventPainter = new Timeline.OverviewEventPainter(eventPainterParams);
- break;
- case "detailed" :
- eventPainter = new Timeline.DetailedEventPainter(eventPainterParams);
- break;
- default:
- eventPainter = new Timeline.OriginalEventPainter(eventPainterParams);
- }
- }
- return {
- width: params.width,
- eventSource: eventSource,
- timeZone: ("timeZone" in params) ? params.timeZone : 0,
- ether: ether,
- etherPainter: etherPainter,
- eventPainter: eventPainter,
- theme: theme,
- zoomIndex: ("zoomIndex" in params) ? params.zoomIndex : 0,
- zoomSteps: ("zoomSteps" in params) ? params.zoomSteps : null
- };
-};
-
-Timeline.getDefaultTheme = function() {
- if (Timeline._defaultTheme == null) {
- Timeline._defaultTheme = Timeline.ClassicTheme.create(Timeline.getDefaultLocale());
- }
- return Timeline._defaultTheme;
-};
-
-Timeline.setDefaultTheme = function(theme) {
- Timeline._defaultTheme = theme;
-};
-
-Timeline.loadXML = function(url, f) {
- var fError = function(statusText, status, xmlhttp) {
- alert("Failed to load data xml from " + url + "\n" + statusText);
- };
- var fDone = function(xmlhttp) {
- var xml = xmlhttp.responseXML;
- if (!xml.documentElement && xmlhttp.responseStream) {
- xml.load(xmlhttp.responseStream);
- }
- f(xml, url);
- };
- SimileAjax.XmlHttp.get(url, fError, fDone);
-};
-
-
-Timeline.loadJSON = function(url, f) {
- var fError = function(statusText, status, xmlhttp) {
- alert("Failed to load json data from " + url + "\n" + statusText);
- };
- var fDone = function(xmlhttp) {
- f(eval('(' + xmlhttp.responseText + ')'), url);
- };
- SimileAjax.XmlHttp.get(url, fError, fDone);
-};
-
-
-Timeline._Impl = function(elmt, bandInfos, orientation, unit) {
- SimileAjax.WindowManager.initialize();
-
- this._containerDiv = elmt;
-
- this._bandInfos = bandInfos;
- this._orientation = orientation == null ? Timeline.HORIZONTAL : orientation;
- this._unit = (unit != null) ? unit : SimileAjax.NativeDateUnit;
-
- this._initialize();
-};
-
-Timeline._Impl.prototype.dispose = function() {
- for (var i = 0; i < this._bands.length; i++) {
- this._bands[i].dispose();
- }
- this._bands = null;
- this._bandInfos = null;
- this._containerDiv.innerHTML = "";
-};
-
-Timeline._Impl.prototype.getBandCount = function() {
- return this._bands.length;
-};
-
-Timeline._Impl.prototype.getBand = function(index) {
- return this._bands[index];
-};
-
-Timeline._Impl.prototype.layout = function() {
- this._distributeWidths();
-};
-
-Timeline._Impl.prototype.paint = function() {
- for (var i = 0; i < this._bands.length; i++) {
- this._bands[i].paint();
- }
-};
-
-Timeline._Impl.prototype.getDocument = function() {
- return this._containerDiv.ownerDocument;
-};
-
-Timeline._Impl.prototype.addDiv = function(div) {
- this._containerDiv.appendChild(div);
-};
-
-Timeline._Impl.prototype.removeDiv = function(div) {
- this._containerDiv.removeChild(div);
-};
-
-Timeline._Impl.prototype.isHorizontal = function() {
- return this._orientation == Timeline.HORIZONTAL;
-};
-
-Timeline._Impl.prototype.isVertical = function() {
- return this._orientation == Timeline.VERTICAL;
-};
-
-Timeline._Impl.prototype.getPixelLength = function() {
- return this._orientation == Timeline.HORIZONTAL ?
- this._containerDiv.offsetWidth : this._containerDiv.offsetHeight;
-};
-
-Timeline._Impl.prototype.getPixelWidth = function() {
- return this._orientation == Timeline.VERTICAL ?
- this._containerDiv.offsetWidth : this._containerDiv.offsetHeight;
-};
-
-Timeline._Impl.prototype.getUnit = function() {
- return this._unit;
-};
-
-Timeline._Impl.prototype.loadXML = function(url, f) {
- var tl = this;
-
-
- var fError = function(statusText, status, xmlhttp) {
- alert("Failed to load data xml from " + url + "\n" + statusText);
- tl.hideLoadingMessage();
- };
- var fDone = function(xmlhttp) {
- try {
- var xml = xmlhttp.responseXML;
- if (!xml.documentElement && xmlhttp.responseStream) {
- xml.load(xmlhttp.responseStream);
- }
- f(xml, url);
- } finally {
- tl.hideLoadingMessage();
- }
- };
-
- this.showLoadingMessage();
- window.setTimeout(function() { SimileAjax.XmlHttp.get(url, fError, fDone); }, 0);
-};
-
-Timeline._Impl.prototype.loadJSON = function(url, f) {
- var tl = this;
-
-
- var fError = function(statusText, status, xmlhttp) {
- alert("Failed to load json data from " + url + "\n" + statusText);
- tl.hideLoadingMessage();
- };
- var fDone = function(xmlhttp) {
- try {
- f(eval('(' + xmlhttp.responseText + ')'), url);
- } finally {
- tl.hideLoadingMessage();
- }
- };
-
- this.showLoadingMessage();
- window.setTimeout(function() { SimileAjax.XmlHttp.get(url, fError, fDone); }, 0);
-};
-
-Timeline._Impl.prototype._initialize = function() {
- var containerDiv = this._containerDiv;
- var doc = containerDiv.ownerDocument;
-
- containerDiv.className =
- containerDiv.className.split(" ").concat("timeline-container").join(" ");
-
- /*
- * Set css-class on container div that will define orientation
- */
- var orientation = (this.isHorizontal()) ? 'horizontal' : 'vertical'
- containerDiv.className +=' timeline-'+orientation;
-
-
- while (containerDiv.firstChild) {
- containerDiv.removeChild(containerDiv.firstChild);
- }
-
- /*
- * inserting copyright and link to simile
- */
- var elmtCopyright = SimileAjax.Graphics.createTranslucentImage(Timeline.urlPrefix + (this.isHorizontal() ? "images/copyright-vertical.png" : "images/copyright.png"));
- elmtCopyright.className = "timeline-copyright";
- elmtCopyright.title = "Timeline (c) SIMILE - http://simile.mit.edu/timeline/";
- SimileAjax.DOM.registerEvent(elmtCopyright, "click", function() {
- window.open('http://simile.mit.edu/timeline/',
- 'Timeline (c) SIMILE',
- 'width=800,height=600,toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,left=0,top=100,screenX=0,screenY=100');
- });
- containerDiv.appendChild(elmtCopyright);
-
- /*
- * creating bands
- */
- this._bands = [];
- for (var i = 0; i < this._bandInfos.length; i++) {
- var band = new Timeline._Band(this, this._bandInfos[i], i);
- this._bands.push(band);
- }
- this._distributeWidths();
-
- /*
- * sync'ing bands
- */
- for (var i = 0; i < this._bandInfos.length; i++) {
- var bandInfo = this._bandInfos[i];
- if ("syncWith" in bandInfo) {
- this._bands[i].setSyncWithBand(
- this._bands[bandInfo.syncWith],
- ("highlight" in bandInfo) ? bandInfo.highlight : false
- );
- }
- }
-
- /*
- * creating loading UI
- */
- var message = SimileAjax.Graphics.createMessageBubble(doc);
- message.containerDiv.className = "timeline-message-container";
- containerDiv.appendChild(message.containerDiv);
-
- message.contentDiv.className = "timeline-message";
- message.contentDiv.innerHTML = "<img src='" + Timeline.urlPrefix + "images/progress-running.gif' /> Loading...";
-
- this.showLoadingMessage = function() { message.containerDiv.style.display = "block"; };
- this.hideLoadingMessage = function() { message.containerDiv.style.display = "none"; };
-};
-
-Timeline._Impl.prototype._distributeWidths = function() {
- var length = this.getPixelLength();
- var width = this.getPixelWidth();
- var cumulativeWidth = 0;
-
- for (var i = 0; i < this._bands.length; i++) {
- var band = this._bands[i];
- var bandInfos = this._bandInfos[i];
- var widthString = bandInfos.width;
-
- var x = widthString.indexOf("%");
- if (x > 0) {
- var percent = parseInt(widthString.substr(0, x));
- var bandWidth = percent * width / 100;
- } else {
- var bandWidth = parseInt(widthString);
- }
-
- band.setBandShiftAndWidth(cumulativeWidth, bandWidth);
- band.setViewLength(length);
-
- cumulativeWidth += bandWidth;
- }
-};
-
-Timeline._Impl.prototype.zoom = function (zoomIn, x, y, target) {
- var matcher = new RegExp("^timeline-band-([0-9]+)$");
- var bandIndex = null;
-
- var result = matcher.exec(target.id);
- if (result) {
- bandIndex = parseInt(result[1]);
- }
-
- if (bandIndex != null) {
- this._bands[bandIndex].zoom(zoomIn, x, y, target);
- }
-
- this.paint();
-};
-
-/*==================================================
- * Band
- *==================================================
- */
-Timeline._Band = function(timeline, bandInfo, index) {
- this._timeline = timeline;
- this._bandInfo = bandInfo;
- this._index = index;
-
- this._locale = ("locale" in bandInfo) ? bandInfo.locale : Timeline.getDefaultLocale();
- this._timeZone = ("timeZone" in bandInfo) ? bandInfo.timeZone : 0;
- this._labeller = ("labeller" in bandInfo) ? bandInfo.labeller :
- (("createLabeller" in timeline.getUnit()) ?
- timeline.getUnit().createLabeller(this._locale, this._timeZone) :
- new Timeline.GregorianDateLabeller(this._locale, this._timeZone));
- this._theme = bandInfo.theme;
- this._zoomIndex = ("zoomIndex" in bandInfo) ? bandInfo.zoomIndex : 0;
- this._zoomSteps = ("zoomSteps" in bandInfo) ? bandInfo.zoomSteps : null;
-
- this._dragging = false;
- this._changing = false;
- this._originalScrollSpeed = 5; // pixels
- this._scrollSpeed = this._originalScrollSpeed;
- this._onScrollListeners = [];
-
- var b = this;
- this._syncWithBand = null;
- this._syncWithBandHandler = function(band) {
- b._onHighlightBandScroll();
- };
- this._selectorListener = function(band) {
- b._onHighlightBandScroll();
- };
-
- /*
- * Install a textbox to capture keyboard events
- */
- var inputDiv = this._timeline.getDocument().createElement("div");
- inputDiv.className = "timeline-band-input";
- this._timeline.addDiv(inputDiv);
-
- this._keyboardInput = document.createElement("input");
- this._keyboardInput.type = "text";
- inputDiv.appendChild(this._keyboardInput);
- SimileAjax.DOM.registerEventWithObject(this._keyboardInput, "keydown", this, "_onKeyDown");
- SimileAjax.DOM.registerEventWithObject(this._keyboardInput, "keyup", this, "_onKeyUp");
-
- /*
- * The band's outer most div that slides with respect to the timeline's div
- */
- this._div = this._timeline.getDocument().createElement("div");
- this._div.id = "timeline-band-" + index;
- this._div.className = "timeline-band timeline-band-" + index;
- this._timeline.addDiv(this._div);
-
- SimileAjax.DOM.registerEventWithObject(this._div, "mousedown", this, "_onMouseDown");
- SimileAjax.DOM.registerEventWithObject(this._div, "mousemove", this, "_onMouseMove");
- SimileAjax.DOM.registerEventWithObject(this._div, "mouseup", this, "_onMouseUp");
- SimileAjax.DOM.registerEventWithObject(this._div, "mouseout", this, "_onMouseOut");
- SimileAjax.DOM.registerEventWithObject(this._div, "dblclick", this, "_onDblClick");
-
- if (SimileAjax.Platform.browser.isFirefox) {
- SimileAjax.DOM.registerEventWithObject(this._div, "DOMMouseScroll", this, "_onMouseScroll");
- } else {
- SimileAjax.DOM.registerEventWithObject(this._div, "mousewheel", this, "_onMouseScroll");
- }
-
-
- /*
- * The inner div that contains layers
- */
- this._innerDiv = this._timeline.getDocument().createElement("div");
- this._innerDiv.className = "timeline-band-inner";
- this._div.appendChild(this._innerDiv);
-
- /*
- * Initialize parts of the band
- */
- this._ether = bandInfo.ether;
- bandInfo.ether.initialize(this, timeline);
-
- this._etherPainter = bandInfo.etherPainter;
- bandInfo.etherPainter.initialize(this, timeline);
-
- this._eventSource = bandInfo.eventSource;
- if (this._eventSource) {
- this._eventListener = {
- onAddMany: function() { b._onAddMany(); },
- onClear: function() { b._onClear(); }
- }
- this._eventSource.addListener(this._eventListener);
- }
-
- this._eventPainter = bandInfo.eventPainter;
- bandInfo.eventPainter.initialize(this, timeline);
-
- this._decorators = ("decorators" in bandInfo) ? bandInfo.decorators : [];
- for (var i = 0; i < this._decorators.length; i++) {
- this._decorators[i].initialize(this, timeline);
- }
-};
-
-Timeline._Band.SCROLL_MULTIPLES = 5;
-
-Timeline._Band.prototype.dispose = function() {
- this.closeBubble();
-
- if (this._eventSource) {
- this._eventSource.removeListener(this._eventListener);
- this._eventListener = null;
- this._eventSource = null;
- }
-
- this._timeline = null;
- this._bandInfo = null;
-
- this._labeller = null;
- this._ether = null;
- this._etherPainter = null;
- this._eventPainter = null;
- this._decorators = null;
-
- this._onScrollListeners = null;
- this._syncWithBandHandler = null;
- this._selectorListener = null;
-
- this._div = null;
- this._innerDiv = null;
- this._keyboardInput = null;
-};
-
-Timeline._Band.prototype.addOnScrollListener = function(listener) {
- this._onScrollListeners.push(listener);
-};
-
-Timeline._Band.prototype.removeOnScrollListener = function(listener) {
- for (var i = 0; i < this._onScrollListeners.length; i++) {
- if (this._onScrollListeners[i] == listener) {
- this._onScrollListeners.splice(i, 1);
- break;
- }
- }
-};
-
-Timeline._Band.prototype.setSyncWithBand = function(band, highlight) {
- if (this._syncWithBand) {
- this._syncWithBand.removeOnScrollListener(this._syncWithBandHandler);
- }
-
- this._syncWithBand = band;
- this._syncWithBand.addOnScrollListener(this._syncWithBandHandler);
- this._highlight = highlight;
- this._positionHighlight();
-};
-
-Timeline._Band.prototype.getLocale = function() {
- return this._locale;
-};
-
-Timeline._Band.prototype.getTimeZone = function() {
- return this._timeZone;
-};
-
-Timeline._Band.prototype.getLabeller = function() {
- return this._labeller;
-};
-
-Timeline._Band.prototype.getIndex = function() {
- return this._index;
-};
-
-Timeline._Band.prototype.getEther = function() {
- return this._ether;
-};
-
-Timeline._Band.prototype.getEtherPainter = function() {
- return this._etherPainter;
-};
-
-Timeline._Band.prototype.getEventSource = function() {
- return this._eventSource;
-};
-
-Timeline._Band.prototype.getEventPainter = function() {
- return this._eventPainter;
-};
-
-Timeline._Band.prototype.layout = function() {
- this.paint();
-};
-
-Timeline._Band.prototype.paint = function() {
- this._etherPainter.paint();
- this._paintDecorators();
- this._paintEvents();
-};
-
-Timeline._Band.prototype.softLayout = function() {
- this.softPaint();
-};
-
-Timeline._Band.prototype.softPaint = function() {
- this._etherPainter.softPaint();
- this._softPaintDecorators();
- this._softPaintEvents();
-};
-
-Timeline._Band.prototype.setBandShiftAndWidth = function(shift, width) {
- var inputDiv = this._keyboardInput.parentNode;
- var middle = shift + Math.floor(width / 2);
- if (this._timeline.isHorizontal()) {
- this._div.style.top = shift + "px";
- this._div.style.height = width + "px";
-
- inputDiv.style.top = middle + "px";
- inputDiv.style.left = "-1em";
- } else {
- this._div.style.left = shift + "px";
- this._div.style.width = width + "px";
-
- inputDiv.style.left = middle + "px";
- inputDiv.style.top = "-1em";
- }
-};
-
-Timeline._Band.prototype.getViewWidth = function() {
- if (this._timeline.isHorizontal()) {
- return this._div.offsetHeight;
- } else {
- return this._div.offsetWidth;
- }
-};
-
-Timeline._Band.prototype.setViewLength = function(length) {
- this._viewLength = length;
- this._recenterDiv();
- this._onChanging();
-};
-
-Timeline._Band.prototype.getViewLength = function() {
- return this._viewLength;
-};
-
-Timeline._Band.prototype.getTotalViewLength = function() {
- return Timeline._Band.SCROLL_MULTIPLES * this._viewLength;
-};
-
-Timeline._Band.prototype.getViewOffset = function() {
- return this._viewOffset;
-};
-
-Timeline._Band.prototype.getMinDate = function() {
- return this._ether.pixelOffsetToDate(this._viewOffset);
-};
-
-Timeline._Band.prototype.getMaxDate = function() {
- return this._ether.pixelOffsetToDate(this._viewOffset + Timeline._Band.SCROLL_MULTIPLES * this._viewLength);
-};
-
-Timeline._Band.prototype.getMinVisibleDate = function() {
- return this._ether.pixelOffsetToDate(0);
-};
-
-Timeline._Band.prototype.getMaxVisibleDate = function() {
- return this._ether.pixelOffsetToDate(this._viewLength);
-};
-
-Timeline._Band.prototype.getCenterVisibleDate = function() {
- return this._ether.pixelOffsetToDate(this._viewLength / 2);
-};
-
-Timeline._Band.prototype.setMinVisibleDate = function(date) {
- if (!this._changing) {
- this._moveEther(Math.round(-this._ether.dateToPixelOffset(date)));
- }
-};
-
-Timeline._Band.prototype.setMaxVisibleDate = function(date) {
- if (!this._changing) {
- this._moveEther(Math.round(this._viewLength - this._ether.dateToPixelOffset(date)));
- }
-};
-
-Timeline._Band.prototype.setCenterVisibleDate = function(date) {
- if (!this._changing) {
- this._moveEther(Math.round(this._viewLength / 2 - this._ether.dateToPixelOffset(date)));
- }
-};
-
-Timeline._Band.prototype.dateToPixelOffset = function(date) {
- return this._ether.dateToPixelOffset(date) - this._viewOffset;
-};
-
-Timeline._Band.prototype.pixelOffsetToDate = function(pixels) {
- return this._ether.pixelOffsetToDate(pixels + this._viewOffset);
-};
-
-Timeline._Band.prototype.createLayerDiv = function(zIndex, className) {
- var div = this._timeline.getDocument().createElement("div");
- div.className = "timeline-band-layer" + (typeof className == "string" ? (" " + className) : "");
- div.style.zIndex = zIndex;
- this._innerDiv.appendChild(div);
-
- var innerDiv = this._timeline.getDocument().createElement("div");
- innerDiv.className = "timeline-band-layer-inner";
- innerDiv.style.zIndex = zIndex;
- if (SimileAjax.Platform.browser.isIE) {
- innerDiv.style.cursor = "move";
- } else {
- innerDiv.style.cursor = "-moz-grab";
- }
- innerDiv.innerHTML = "";
- div.appendChild(innerDiv);
-
- return innerDiv;
-};
-
-Timeline._Band.prototype.removeLayerDiv = function(div) {
- this._innerDiv.removeChild(div.parentNode);
-};
-
-Timeline._Band.prototype.scrollToCenter = function(date, f) {
- var pixelOffset = this._ether.dateToPixelOffset(date);
- if (pixelOffset < -this._viewLength / 2) {
- this.setCenterVisibleDate(this.pixelOffsetToDate(pixelOffset + this._viewLength));
- } else if (pixelOffset > 3 * this._viewLength / 2) {
- this.setCenterVisibleDate(this.pixelOffsetToDate(pixelOffset - this._viewLength));
- }
- this._autoScroll(Math.round(this._viewLength / 2 - this._ether.dateToPixelOffset(date)), f);
-};
-
-Timeline._Band.prototype.showBubbleForEvent = function(eventID) {
- var evt = this.getEventSource().getEvent(eventID);
- if (evt) {
- var self = this;
- this.scrollToCenter(evt.getStart(), function() {
- self._eventPainter.showBubble(evt);
- });
- }
-};
-
-Timeline._Band.prototype.zoom = function(zoomIn, x, y, target) {
- if (!this._theme.zoom || !this._zoomSteps) {
- // zoom disabled
- return;
- }
-
- // shift the x value by our offset
- x += this._viewOffset;
-
- var zoomDate = this._ether.pixelOffsetToDate(x);
- var netIntervalChange = this._ether.zoom(zoomIn);
- this._etherPainter.zoom(netIntervalChange);
-
- // shift our zoom date to the far left
- this._moveEther(Math.round(-this._ether.dateToPixelOffset(zoomDate)));
- // then shift it back to where the mouse was
- this._moveEther(x);
-};
-
-Timeline._Band.prototype._onMouseDown = function(innerFrame, evt, target) {
- this.closeBubble();
-
- this._dragging = true;
- this._dragX = evt.clientX;
- this._dragY = evt.clientY;
-};
-
-Timeline._Band.prototype._onMouseMove = function(innerFrame, evt, target) {
- if (this._dragging) {
- var diffX = evt.clientX - this._dragX;
- var diffY = evt.clientY - this._dragY;
-
- this._dragX = evt.clientX;
- this._dragY = evt.clientY;
-
- this._moveEther(this._timeline.isHorizontal() ? diffX : diffY);
- this._positionHighlight();
- }
-};
-
-Timeline._Band.prototype._onMouseUp = function(innerFrame, evt, target) {
- this._dragging = false;
- this._keyboardInput.focus();
-};
-
-Timeline._Band.prototype._onMouseOut = function(innerFrame, evt, target) {
- var coords = SimileAjax.DOM.getEventRelativeCoordinates(evt, innerFrame);
- coords.x += this._viewOffset;
- if (coords.x < 0 || coords.x > innerFrame.offsetWidth ||
- coords.y < 0 || coords.y > innerFrame.offsetHeight) {
- this._dragging = false;
- }
-};
-
-Timeline._Band.prototype._onMouseScroll = function(innerFrame, evt, target) {
- var now = new Date();
- now = now.getTime();
-
- if (!this._lastScrollTime || ((now - this._lastScrollTime) > 50)) {
- // limit 1 scroll per 200ms due to FF3 sending multiple events back to back
- this._lastScrollTime = now;
-
- var delta = 0;
- if (evt.wheelDelta) {
- delta = evt.wheelDelta/120;
- } else if (evt.detail) {
- delta = -evt.detail/3;
- }
-
- var loc = SimileAjax.DOM.getEventRelativeCoordinates(evt, innerFrame);
- if (delta != 0) {
- var zoomIn;
- if (delta > 0)
- zoomIn = true;
- if (delta < 0)
- zoomIn = false;
- // call zoom on the timeline so we could zoom multiple bands if desired
- this._timeline.zoom(zoomIn, loc.x, loc.y, innerFrame);
- }
- }
-
- // prevent bubble
- if (evt.stopPropagation) {
- evt.stopPropagation();
- }
- evt.cancelBubble = true;
-
- // prevent the default action
- if (evt.preventDefault) {
- evt.preventDefault();
- }
- evt.returnValue = false;
-};
-
-Timeline._Band.prototype._onDblClick = function(innerFrame, evt, target) {
- var coords = SimileAjax.DOM.getEventRelativeCoordinates(evt, innerFrame);
- var distance = coords.x - (this._viewLength / 2 - this._viewOffset);
-
- this._autoScroll(-distance);
-};
-
-Timeline._Band.prototype._onKeyDown = function(keyboardInput, evt, target) {
- if (!this._dragging) {
- switch (evt.keyCode) {
- case 27: // ESC
- break;
- case 37: // left arrow
- case 38: // up arrow
- this._scrollSpeed = Math.min(50, Math.abs(this._scrollSpeed * 1.05));
- this._moveEther(this._scrollSpeed);
- break;
- case 39: // right arrow
- case 40: // down arrow
- this._scrollSpeed = -Math.min(50, Math.abs(this._scrollSpeed * 1.05));
- this._moveEther(this._scrollSpeed);
- break;
- default:
- return true;
- }
- this.closeBubble();
-
- SimileAjax.DOM.cancelEvent(evt);
- return false;
- }
- return true;
-};
-
-Timeline._Band.prototype._onKeyUp = function(keyboardInput, evt, target) {
- if (!this._dragging) {
- this._scrollSpeed = this._originalScrollSpeed;
-
- switch (evt.keyCode) {
- case 35: // end
- this.setCenterVisibleDate(this._eventSource.getLatestDate());
- break;
- case 36: // home
- this.setCenterVisibleDate(this._eventSource.getEarliestDate());
- break;
- case 33: // page up
- this._autoScroll(this._timeline.getPixelLength());
- break;
- case 34: // page down
- this._autoScroll(-this._timeline.getPixelLength());
- break;
- default:
- return true;
- }
-
- this.closeBubble();
-
- SimileAjax.DOM.cancelEvent(evt);
- return false;
- }
- return true;
-};
-
-Timeline._Band.prototype._autoScroll = function(distance, f) {
- var b = this;
- var a = SimileAjax.Graphics.createAnimation(
- function(abs, diff) {
- b._moveEther(diff);
- },
- 0,
- distance,
- 1000,
- f
- );
- a.run();
-};
-
-Timeline._Band.prototype._moveEther = function(shift) {
- this.closeBubble();
-
- this._viewOffset += shift;
- this._ether.shiftPixels(-shift);
- if (this._timeline.isHorizontal()) {
- this._div.style.left = this._viewOffset + "px";
- } else {
- this._div.style.top = this._viewOffset + "px";
- }
-
- if (this._viewOffset > -this._viewLength * 0.5 ||
- this._viewOffset < -this._viewLength * (Timeline._Band.SCROLL_MULTIPLES - 1.5)) {
-
- this._recenterDiv();
- } else {
- this.softLayout();
- }
-
- this._onChanging();
-}
-
-Timeline._Band.prototype._onChanging = function() {
- this._changing = true;
-
- this._fireOnScroll();
- this._setSyncWithBandDate();
-
- this._changing = false;
-};
-
-Timeline._Band.prototype._fireOnScroll = function() {
- for (var i = 0; i < this._onScrollListeners.length; i++) {
- this._onScrollListeners[i](this);
- }
-};
-
-Timeline._Band.prototype._setSyncWithBandDate = function() {
- if (this._syncWithBand) {
- var centerDate = this._ether.pixelOffsetToDate(this.getViewLength() / 2);
- this._syncWithBand.setCenterVisibleDate(centerDate);
- }
-};
-
-Timeline._Band.prototype._onHighlightBandScroll = function() {
- if (this._syncWithBand) {
- var centerDate = this._syncWithBand.getCenterVisibleDate();
- var centerPixelOffset = this._ether.dateToPixelOffset(centerDate);
-
- this._moveEther(Math.round(this._viewLength / 2 - centerPixelOffset));
-
- if (this._highlight) {
- this._etherPainter.setHighlight(
- this._syncWithBand.getMinVisibleDate(),
- this._syncWithBand.getMaxVisibleDate());
- }
- }
-};
-
-Timeline._Band.prototype._onAddMany = function() {
- this._paintEvents();
-};
-
-Timeline._Band.prototype._onClear = function() {
- this._paintEvents();
-};
-
-Timeline._Band.prototype._positionHighlight = function() {
- if (this._syncWithBand) {
- var startDate = this._syncWithBand.getMinVisibleDate();
- var endDate = this._syncWithBand.getMaxVisibleDate();
-
- if (this._highlight) {
- this._etherPainter.setHighlight(startDate, endDate);
- }
- }
-};
-
-Timeline._Band.prototype._recenterDiv = function() {
- this._viewOffset = -this._viewLength * (Timeline._Band.SCROLL_MULTIPLES - 1) / 2;
- if (this._timeline.isHorizontal()) {
- this._div.style.left = this._viewOffset + "px";
- this._div.style.width = (Timeline._Band.SCROLL_MULTIPLES * this._viewLength) + "px";
- } else {
- this._div.style.top = this._viewOffset + "px";
- this._div.style.height = (Timeline._Band.SCROLL_MULTIPLES * this._viewLength) + "px";
- }
- this.layout();
-};
-
-Timeline._Band.prototype._paintEvents = function() {
- this._eventPainter.paint();
-};
-
-Timeline._Band.prototype._softPaintEvents = function() {
- this._eventPainter.softPaint();
-};
-
-Timeline._Band.prototype._paintDecorators = function() {
- for (var i = 0; i < this._decorators.length; i++) {
- this._decorators[i].paint();
- }
-};
-
-Timeline._Band.prototype._softPaintDecorators = function() {
- for (var i = 0; i < this._decorators.length; i++) {
- this._decorators[i].softPaint();
- }
-};
-
-Timeline._Band.prototype.closeBubble = function() {
- SimileAjax.WindowManager.cancelPopups();
-};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/units.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/units.js
deleted file mode 100644
index 15ea379..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/scripts/units.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/*==================================================
- * Default Unit
- *==================================================
- */
-
-Timeline.NativeDateUnit = new Object();
-
-Timeline.NativeDateUnit.createLabeller = function(locale, timeZone) {
- return new Timeline.GregorianDateLabeller(locale, timeZone);
-};
-
-Timeline.NativeDateUnit.makeDefaultValue = function() {
- return new Date();
-};
-
-Timeline.NativeDateUnit.cloneValue = function(v) {
- return new Date(v.getTime());
-};
-
-Timeline.NativeDateUnit.getParser = function(format) {
- if (typeof format == "string") {
- format = format.toLowerCase();
- }
- return (format == "iso8601" || format == "iso 8601") ?
- Timeline.DateTime.parseIso8601DateTime :
- Timeline.DateTime.parseGregorianDateTime;
-};
-
-Timeline.NativeDateUnit.parseFromObject = function(o) {
- return Timeline.DateTime.parseGregorianDateTime(o);
-};
-
-Timeline.NativeDateUnit.toNumber = function(v) {
- return v.getTime();
-};
-
-Timeline.NativeDateUnit.fromNumber = function(n) {
- return new Date(n);
-};
-
-Timeline.NativeDateUnit.compare = function(v1, v2) {
- var n1, n2;
- if (typeof v1 == "object") {
- n1 = v1.getTime();
- } else {
- n1 = Number(v1);
- }
- if (typeof v2 == "object") {
- n2 = v2.getTime();
- } else {
- n2 = Number(v2);
- }
-
- return n1 - n2;
-};
-
-Timeline.NativeDateUnit.earlier = function(v1, v2) {
- return Timeline.NativeDateUnit.compare(v1, v2) < 0 ? v1 : v2;
-};
-
-Timeline.NativeDateUnit.later = function(v1, v2) {
- return Timeline.NativeDateUnit.compare(v1, v2) > 0 ? v1 : v2;
-};
-
-Timeline.NativeDateUnit.change = function(v, n) {
- return new Date(v.getTime() + n);
-};
-
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/styles/ethers.css b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/styles/ethers.css
deleted file mode 100644
index 96b59ae..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/styles/ethers.css
+++ /dev/null
@@ -1,123 +0,0 @@
-
-
-/*------------------- Horizontal / Vertical lines ----------------*/
-
-/* style for ethers */
-.timeline-ether-lines{border-color:#666; border-style:dotted; position:absolute;}
-
-.timeline-horizontal .timeline-ether-lines{border-width:0 0 0 1px; height:100%; top: 0; width: 1px;}
-
-.timeline-vertical .timeline-ether-lines{border-width:1px 0 0; height:1px; left: 0; width: 100%;}
-
-
-
-
-/*---------------- Weekends ---------------------------*/
-
-.timeline-ether-weekends{
- position:absolute;
- background-color:#FFFFE0;
-}
-
-.timeline-vertical .timeline-ether-weekends{left:0;width:100%;}
-
-.timeline-horizontal .timeline-ether-weekends{top:0; height:100%;}
-
-
-
-/*-------------------------- HIGHLIGHT DECORATORS -------------------*/
-.timeline-highlight-decorator,
-.timeline-highlight-point-decorator{
- position:absolute;
- overflow:hidden;
-}
-.timeline-horizontal .timeline-highlight-point-decorator,
-.timeline-horizontal .timeline-highlight-decorator{
- width:10px;
- top:0;
- height:100%;
-}
-
-.timeline-vertical .timeline-highlight-point-decorator,
-.timeline-vertical .timeline-highlight-decorator{
- height:10px;
- width:100%;
- left:0;
-}
-
-.timeline-highlight-decorator{background-color:#FFC080;}
-.timeline-highlight-point-decorator{background-color:#ff5;}
-
-
-
-/*---------------------------- LABELS -------------------------*/
-.timeline-highlight-label{position:absolute;overflow:hidden;font-size:200%;font-weight:bold;color:#999;}
-
-
-/*---------------- VERTICAL LABEL -------------------*/
-.timeline-horizontal .timeline-highlight-label{top:0;height:100%;}
-.timeline-horizontal .timeline-highlight-label td{vertical-align:middle;}
-.timeline-horizontal .timeline-highlight-label-start{text-align:right;}
-.timeline-horizontal .timeline-highlight-label-end{text-align:left;}
-
-
-/*---------------- HORIZONTAL LABEL -------------------*/
-.timeline-vertical .timeline-highlight-label{left:0;width:100%;}
-.timeline-vertical .timeline-highlight-label td{vertical-align:top;}
-.timeline-vertical .timeline-highlight-label-start{text-align:center;}
-.timeline-vertical .timeline-highlight-label-end{text-align:center;}
-
-
-
-/*-------------------------------- DATE LABELS --------------------------------*/
-.timeline-date-label{position:absolute; border:solid #aaa; color:#aaa; width:5em; height:1.5em;}
-.timeline-date-label-em{color:#000;}
-
-/* horizontal */
-.timeline-horizontal .timeline-date-label{padding-left:2px;}
-.timeline-horizontal .timeline-date-label{border-width:0 0 0 1px;}
-.timeline-horizontal .timeline-date-label-em{height:2em}
-
-/* vertical */
-.timeline-vertical .timeline-date-label{padding-top:2px;}
-.timeline-vertical .timeline-date-label{border-width:1px 0 0;}
-.timeline-vertical .timeline-date-label-em{width:7em}
-
-/*------------------------------- Ether.highlight -------------------------*/
-.timeline-ether-highlight{position:absolute; background-color:#fff;}
-.timeline-horizontal .timeline-ether-highlight{top:2px;}
-.timeline-vertical .timeline-ether-highlight{left:2px;}
-
-
-
-/*------------------------------ EVENTS ------------------------------------*/
-.timeline-event-icon, .timeline-event-label,.timeline-event-tape{
- position:absolute;
- cursor:pointer;
-}
-
-.timeline-event-tape,
-.timeline-small-event-tape,
-.timeline-small-event-icon{
- background-color:#58A0DC;
- overflow:hidden;
-}
-
-.timeline-small-event-tape,
-.timeline-small-event-icon{
- position:absolute;
-}
-
-.timeline-event-tape{height:4px;}
-
-.timeline-small-event-tape{height:2px;}
-.timeline-small-event-icon{width:1px; height:6px;}
-
-
-
-/*--------------------------------- TIMELINE-------------------------*/
-.timeline-ether-bg{width:100%; height:100%;}
-.timeline-band-0 .timeline-ether-bg{background-color:#eee}
-.timeline-band-1 .timeline-ether-bg{background-color:#ddd}
-.timeline-band-2 .timeline-ether-bg{background-color:#ccc}
-.timeline-band-3 .timeline-ether-bg{background-color:#aaa}
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/styles/events.css b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/styles/events.css
deleted file mode 100644
index 4ece954..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/styles/events.css
+++ /dev/null
@@ -1,47 +0,0 @@
-.timeline-duration-event {
- position: absolute;
- overflow: hidden;
- border: 1px solid blue;
-}
-
-.timeline-instant-event2 {
- position: absolute;
- overflow: hidden;
- border-left: 1px solid blue;
- padding-left: 2px;
-}
-
-.timeline-instant-event {
- position: absolute;
- overflow: hidden;
-}
-
-.timeline-event-bubble-title {
- font-weight: bold;
- border-bottom: 1px solid #888;
- margin-bottom: 0.5em;
-}
-
-.timeline-event-bubble-body {
- overflow: auto;
- max-height: 350px;
-}
-
-.timeline-event-bubble-wiki {
- margin: 0.5em;
- text-align: right;
- color: #A0A040;
-}
-.timeline-event-bubble-wiki a {
- color: #A0A040;
-}
-
-.timeline-event-bubble-time {
- color: #aaa;
-}
-
-.timeline-event-bubble-image {
- float: right;
- padding-left: 5px;
- padding-bottom: 5px;
-}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/styles/timeline.css b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/styles/timeline.css
deleted file mode 100644
index 04ef2e4..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/styles/timeline.css
+++ /dev/null
@@ -1,65 +0,0 @@
-.timeline-container {
- position: relative;
- overflow: hidden;
-}
-
-.timeline-copyright {
- position: absolute;
- bottom: 0px;
- left: 0px;
- z-index: 1000;
- cursor: pointer;
-}
-
-.timeline-message-container {
- position: absolute;
- top: 30%;
- left: 35%;
- right: 35%;
- z-index: 1000;
- display: none;
-}
-.timeline-message {
- font-size: 120%;
- font-weight: bold;
- text-align: center;
-}
-.timeline-message img {
- vertical-align: middle;
-}
-
-.timeline-band {
- position: absolute;
- background: #eee;
- z-index: 10;
-}
-
-.timeline-band-inner {
- position: relative;
- width: 100%;
- height: 100%;
-}
-
-.timeline-band-input {
- position: absolute;
- width: 1em;
- height: 1em;
- overflow: hidden;
- z-index: 0;
-}
-.timeline-band-input input{
- width: 0;
-}
-
-.timeline-band-layer {
- position: absolute;
- width: 100%;
- height: 100%;
-}
-
-.timeline-band-layer-inner {
- position: relative;
- width: 100%;
- height: 100%;
-}
-
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/timeline-api.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/timeline-api.js
deleted file mode 100644
index 1447a26..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/timeline-api.js
+++ /dev/null
@@ -1,222 +0,0 @@
-/*==================================================
- * Timeline API
- *
- * This file will load all the Javascript files
- * necessary to make the standard timeline work.
- * It also detects the default locale.
- *
- * Include this file in your HTML file as follows:
- *
- * <script src="http://simile.mit.edu/timeline/api/scripts/timeline-api.js" type="text/javascript"></script>
- *
- *==================================================
- */
-
-(function() {
- var useLocalResources = true;
- if (document.location.search.length > 0) {
- var params = document.location.search.substr(1).split("&");
- for (var i = 0; i < params.length; i++) {
- if (params[i] == "timeline-use-local-resources") {
- useLocalResources = true;
- }
- }
- };
-
- var loadMe = function() {
- if ("Timeline" in window) {
- return;
- }
-
- window.Timeline = new Object();
- window.Timeline.DateTime = window.SimileAjax.DateTime; // for backward compatibility
-
- var bundle = false;
- var javascriptFiles = [
- "timeline.js",
- "themes.js",
- "ethers.js",
- "ether-painters.js",
- "labellers.js",
- "sources.js",
- "original-painter.js",
- "detailed-painter.js",
- "overview-painter.js",
- "decorators.js",
- "units.js"
- ];
- var cssFiles = [
- "timeline.css",
- "ethers.css",
- "events.css"
- ];
-
- var localizedJavascriptFiles = [
- "timeline.js",
- "labellers.js"
- ];
- var localizedCssFiles = [
- ];
-
- // ISO-639 language codes, ISO-3166 country codes (2 characters)
- var supportedLocales = [
- "cs", // Czech
- "de", // German
- "en", // English
- "es", // Spanish
- "fr", // French
- "it", // Italian
- "ru", // Russian
- "se", // Swedish
- "tr", // Turkish
- "vi", // Vietnamese
- "zh" // Chinese
- ];
-
- try {
- var desiredLocales = [ "en" ];
- var defaultServerLocale = "en";
-
- var parseURLParameters = function(parameters) {
- var params = parameters.split("&");
- for (var p = 0; p < params.length; p++) {
- var pair = params[p].split("=");
- if (pair[0] == "locales") {
- desiredLocales = desiredLocales.concat(pair[1].split(","));
- } else if (pair[0] == "defaultLocale") {
- defaultServerLocale = pair[1];
- } else if (pair[0] == "bundle") {
- bundle = pair[1] != "false";
- }
- }
- };
-
- (function() {
- if (typeof Timeline_urlPrefix == "string") {
- Timeline.urlPrefix = Timeline_urlPrefix;
- if (typeof Timeline_parameters == "string") {
- parseURLParameters(Timeline_parameters);
- }
- } else {
- var heads = document.documentElement.getElementsByTagName("head");
- for (var h = 0; h < heads.length; h++) {
- var scripts = heads[h].getElementsByTagName("script");
- for (var s = 0; s < scripts.length; s++) {
- var url = scripts[s].src;
- var i = url.indexOf("timeline-api.js");
- if (i >= 0) {
- Timeline.urlPrefix = url.substr(0, i);
- var q = url.indexOf("?");
- if (q > 0) {
- parseURLParameters(url.substr(q + 1));
- }
- return;
- }
- }
- }
- throw new Error("Failed to derive URL prefix for Timeline API code files");
- }
- })();
-
- var includeJavascriptFiles = function(urlPrefix, filenames) {
- SimileAjax.includeJavascriptFiles(document, urlPrefix, filenames);
- }
- var includeCssFiles = function(urlPrefix, filenames) {
- SimileAjax.includeCssFiles(document, urlPrefix, filenames);
- }
-
- /*
- * Include non-localized files
- */
- if (bundle) {
- includeJavascriptFiles(Timeline.urlPrefix, [ "timeline-bundle.js" ]);
- includeCssFiles(Timeline.urlPrefix, [ "timeline-bundle.css" ]);
- } else {
- includeJavascriptFiles(Timeline.urlPrefix + "scripts/", javascriptFiles);
- includeCssFiles(Timeline.urlPrefix + "styles/", cssFiles);
- }
-
- /*
- * Include localized files
- */
- var loadLocale = [];
- loadLocale[defaultServerLocale] = true;
-
- var tryExactLocale = function(locale) {
- for (var l = 0; l < supportedLocales.length; l++) {
- if (locale == supportedLocales[l]) {
- loadLocale[locale] = true;
- return true;
- }
- }
- return false;
- }
- var tryLocale = function(locale) {
- if (tryExactLocale(locale)) {
- return locale;
- }
-
- var dash = locale.indexOf("-");
- if (dash > 0 && tryExactLocale(locale.substr(0, dash))) {
- return locale.substr(0, dash);
- }
-
- return null;
- }
-
- for (var l = 0; l < desiredLocales.length; l++) {
- tryLocale(desiredLocales[l]);
- }
-
- var defaultClientLocale = defaultServerLocale;
- var defaultClientLocales = ("language" in navigator ? navigator.language : navigator.browserLanguage).split(";");
- for (var l = 0; l < defaultClientLocales.length; l++) {
- var locale = tryLocale(defaultClientLocales[l]);
- if (locale != null) {
- defaultClientLocale = locale;
- break;
- }
- }
-
- for (var l = 0; l < supportedLocales.length; l++) {
- var locale = supportedLocales[l];
- if (loadLocale[locale]) {
- includeJavascriptFiles(Timeline.urlPrefix + "scripts/l10n/" + locale + "/", localizedJavascriptFiles);
- includeCssFiles(Timeline.urlPrefix + "styles/l10n/" + locale + "/", localizedCssFiles);
- }
- }
-
- Timeline.serverLocale = defaultServerLocale;
- Timeline.clientLocale = defaultClientLocale;
- } catch (e) {
- alert(e);
- }
- };
-
- /*
- * Load SimileAjax if it's not already loaded
- */
- if (typeof SimileAjax == "undefined") {
- window.SimileAjax_onLoad = loadMe;
-
- var url = "/js/timeline/ajax/api/simile-ajax-api.js";
- var createScriptElement = function() {
- var script = document.createElement("script");
- script.type = "text/javascript";
- script.language = "JavaScript";
- script.src = url;
- document.getElementsByTagName("head")[0].appendChild(script);
- }
- if (document.body == null) {
- try {
- document.write("<script src='" + url + "' type='text/javascript'></script>");
- } catch (e) {
- createScriptElement();
- }
- } else {
- createScriptElement();
- }
- } else {
- loadMe();
- }
-})();
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/timeline-bundle.css b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/timeline-bundle.css
deleted file mode 100644
index 7f8acdc..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/timeline-bundle.css
+++ /dev/null
@@ -1,232 +0,0 @@
-
-
-/*------------------- Horizontal / Vertical lines ----------------*/
-
-/* style for ethers */
-.timeline-ether-lines{border-color:#666; border-style:dotted; position:absolute;}
-
-.timeline-horizontal .timeline-ether-lines{border-width:0 0 0 1px; height:100%; top: 0; width: 1px;}
-
-.timeline-vertical .timeline-ether-lines{border-width:1px 0 0; height:1px; left: 0; width: 100%;}
-
-
-
-
-/*---------------- Weekends ---------------------------*/
-
-.timeline-ether-weekends{
- position:absolute;
- background-color:#FFFFE0;
-}
-
-.timeline-vertical .timeline-ether-weekends{left:0;width:100%;}
-
-.timeline-horizontal .timeline-ether-weekends{top:0; height:100%;}
-
-
-
-/*-------------------------- HIGHLIGHT DECORATORS -------------------*/
-.timeline-highlight-decorator,
-.timeline-highlight-point-decorator{
- position:absolute;
- overflow:hidden;
-}
-.timeline-horizontal .timeline-highlight-point-decorator,
-.timeline-horizontal .timeline-highlight-decorator{
- width:10px;
- top:0;
- height:100%;
-}
-
-.timeline-vertical .timeline-highlight-point-decorator,
-.timeline-vertical .timeline-highlight-decorator{
- height:10px;
- width:100%;
- left:0;
-}
-
-.timeline-highlight-decorator{background-color:#FFC080;}
-.timeline-highlight-point-decorator{background-color:#ff5;}
-
-
-
-/*---------------------------- LABELS -------------------------*/
-.timeline-highlight-label{position:absolute;overflow:hidden;font-size:200%;font-weight:bold;color:#999;}
-
-
-/*---------------- VERTICAL LABEL -------------------*/
-.timeline-horizontal .timeline-highlight-label{top:0;height:100%;}
-.timeline-horizontal .timeline-highlight-label td{vertical-align:middle;}
-.timeline-horizontal .timeline-highlight-label-start{text-align:right;}
-.timeline-horizontal .timeline-highlight-label-end{text-align:left;}
-
-
-/*---------------- HORIZONTAL LABEL -------------------*/
-.timeline-vertical .timeline-highlight-label{left:0;width:100%;}
-.timeline-vertical .timeline-highlight-label td{vertical-align:top;}
-.timeline-vertical .timeline-highlight-label-start{text-align:center;}
-.timeline-vertical .timeline-highlight-label-end{text-align:center;}
-
-
-
-/*-------------------------------- DATE LABELS --------------------------------*/
-.timeline-date-label{position:absolute; border:solid #aaa; color:#aaa; width:5em; height:1.5em;}
-.timeline-date-label-em{color:#000;}
-
-/* horizontal */
-.timeline-horizontal .timeline-date-label{padding-left:2px;}
-.timeline-horizontal .timeline-date-label{border-width:0 0 0 1px;}
-.timeline-horizontal .timeline-date-label-em{height:2em}
-
-/* vertical */
-.timeline-vertical .timeline-date-label{padding-top:2px;}
-.timeline-vertical .timeline-date-label{border-width:1px 0 0;}
-.timeline-vertical .timeline-date-label-em{width:7em}
-
-/*------------------------------- Ether.highlight -------------------------*/
-.timeline-ether-highlight{position:absolute; background-color:#fff;}
-.timeline-horizontal .timeline-ether-highlight{top:2px;}
-.timeline-vertical .timeline-ether-highlight{left:2px;}
-
-
-
-/*------------------------------ EVENTS ------------------------------------*/
-.timeline-event-icon, .timeline-event-label,.timeline-event-tape{
- position:absolute;
- cursor:pointer;
-}
-
-.timeline-event-tape,
-.timeline-small-event-tape,
-.timeline-small-event-icon{
- background-color:#58A0DC;
- overflow:hidden;
-}
-
-.timeline-small-event-tape,
-.timeline-small-event-icon{
- position:absolute;
-}
-
-.timeline-event-tape{height:4px;}
-
-.timeline-small-event-tape{height:2px;}
-.timeline-small-event-icon{width:1px; height:6px;}
-
-
-
-/*--------------------------------- TIMELINE-------------------------*/
-.timeline-ether-bg{width:100%; height:100%;}
-.timeline-band-0 .timeline-ether-bg{background-color:#eee}
-.timeline-band-1 .timeline-ether-bg{background-color:#ddd}
-.timeline-band-2 .timeline-ether-bg{background-color:#ccc}
-.timeline-band-3 .timeline-ether-bg{background-color:#aaa}
-.timeline-duration-event {
- position: absolute;
- overflow: hidden;
- border: 1px solid blue;
-}
-
-.timeline-instant-event2 {
- position: absolute;
- overflow: hidden;
- border-left: 1px solid blue;
- padding-left: 2px;
-}
-
-.timeline-instant-event {
- position: absolute;
- overflow: hidden;
-}
-
-.timeline-event-bubble-title {
- font-weight: bold;
- border-bottom: 1px solid #888;
- margin-bottom: 0.5em;
-}
-
-.timeline-event-bubble-body {
-}
-
-.timeline-event-bubble-wiki {
- margin: 0.5em;
- text-align: right;
- color: #A0A040;
-}
-.timeline-event-bubble-wiki a {
- color: #A0A040;
-}
-
-.timeline-event-bubble-time {
- color: #aaa;
-}
-
-.timeline-event-bubble-image {
- float: right;
- padding-left: 5px;
- padding-bottom: 5px;
-}.timeline-container {
- position: relative;
- overflow: hidden;
-}
-
-.timeline-copyright {
- position: absolute;
- bottom: 0px;
- left: 0px;
- z-index: 1000;
- cursor: pointer;
-}
-
-.timeline-message-container {
- position: absolute;
- top: 30%;
- left: 35%;
- right: 35%;
- z-index: 1000;
- display: none;
-}
-.timeline-message {
- font-size: 120%;
- font-weight: bold;
- text-align: center;
-}
-.timeline-message img {
- vertical-align: middle;
-}
-
-.timeline-band {
- position: absolute;
- background: #eee;
- z-index: 10;
-}
-
-.timeline-band-inner {
- position: relative;
- width: 100%;
- height: 100%;
-}
-
-.timeline-band-input {
- position: absolute;
- width: 1em;
- height: 1em;
- overflow: hidden;
- z-index: 0;
-}
-.timeline-band-input input{
- width: 0;
-}
-
-.timeline-band-layer {
- position: absolute;
- width: 100%;
- height: 100%;
-}
-
-.timeline-band-layer-inner {
- position: relative;
- width: 100%;
- height: 100%;
-}
-
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/timeline-bundle.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/timeline-bundle.js
deleted file mode 100644
index 019e6a7..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/api/timeline-bundle.js
+++ /dev/null
@@ -1,2120 +0,0 @@
-
-
-/* decorators.js */
-Timeline.SpanHighlightDecorator=function(A){this._unit=("unit" in A)?A.unit:SimileAjax.NativeDateUnit;
-this._startDate=(typeof A.startDate=="string")?this._unit.parseFromObject(A.startDate):A.startDate;
-this._endDate=(typeof A.endDate=="string")?this._unit.parseFromObject(A.endDate):A.endDate;
-this._startLabel=A.startLabel;
-this._endLabel=A.endLabel;
-this._color=A.color;
-this._cssClass=("cssClass" in A)?A.cssClass:null;
-this._opacity=("opacity" in A)?A.opacity:100;
-};
-Timeline.SpanHighlightDecorator.prototype.initialize=function(B,A){this._band=B;
-this._timeline=A;
-this._layerDiv=null;
-};
-Timeline.SpanHighlightDecorator.prototype.paint=function(){if(this._layerDiv!=null){this._band.removeLayerDiv(this._layerDiv);
-}this._layerDiv=this._band.createLayerDiv(10);
-this._layerDiv.setAttribute("name","span-highlight-decorator");
-this._layerDiv.style.display="none";
-var F=this._band.getMinDate();
-var C=this._band.getMaxDate();
-if(this._unit.compare(this._startDate,C)<0&&this._unit.compare(this._endDate,F)>0){F=this._unit.later(F,this._startDate);
-C=this._unit.earlier(C,this._endDate);
-var D=this._band.dateToPixelOffset(F);
-var K=this._band.dateToPixelOffset(C);
-var I=this._timeline.getDocument();
-var H=function(){var L=I.createElement("table");
-L.insertRow(0).insertCell(0);
-return L;
-};
-var B=I.createElement("div");
-B.className="timeline-highlight-decorator";
-if(this._cssClass){B.className+=" "+this._cssClass;
-}if(this._opacity<100){SimileAjax.Graphics.setOpacity(B,this._opacity);
-}this._layerDiv.appendChild(B);
-var J=H();
-J.className="timeline-highlight-label timeline-highlight-label-start";
-var G=J.rows[0].cells[0];
-G.innerHTML=this._startLabel;
-if(this._cssClass){G.className="label_"+this._cssClass;
-}this._layerDiv.appendChild(J);
-var A=H();
-A.className="timeline-highlight-label timeline-highlight-label-end";
-var E=A.rows[0].cells[0];
-E.innerHTML=this._endLabel;
-if(this._cssClass){E.className="label_"+this._cssClass;
-}this._layerDiv.appendChild(A);
-if(this._timeline.isHorizontal()){B.style.left=D+"px";
-B.style.width=(K-D)+"px";
-J.style.right=(this._band.getTotalViewLength()-D)+"px";
-J.style.width=(this._startLabel.length)+"em";
-A.style.left=K+"px";
-A.style.width=(this._endLabel.length)+"em";
-}else{B.style.top=D+"px";
-B.style.height=(K-D)+"px";
-J.style.bottom=D+"px";
-J.style.height="1.5px";
-A.style.top=K+"px";
-A.style.height="1.5px";
-}}this._layerDiv.style.display="block";
-};
-Timeline.SpanHighlightDecorator.prototype.softPaint=function(){};
-Timeline.PointHighlightDecorator=function(A){this._unit=("unit" in A)?A.unit:SimileAjax.NativeDateUnit;
-this._date=(typeof A.date=="string")?this._unit.parseFromObject(A.date):A.date;
-this._width=("width" in A)?A.width:10;
-this._color=A.color;
-this._cssClass=("cssClass" in A)?A.cssClass:"";
-this._opacity=("opacity" in A)?A.opacity:100;
-};
-Timeline.PointHighlightDecorator.prototype.initialize=function(B,A){this._band=B;
-this._timeline=A;
-this._layerDiv=null;
-};
-Timeline.PointHighlightDecorator.prototype.paint=function(){if(this._layerDiv!=null){this._band.removeLayerDiv(this._layerDiv);
-}this._layerDiv=this._band.createLayerDiv(10);
-this._layerDiv.setAttribute("name","span-highlight-decorator");
-this._layerDiv.style.display="none";
-var C=this._band.getMinDate();
-var E=this._band.getMaxDate();
-if(this._unit.compare(this._date,E)<0&&this._unit.compare(this._date,C)>0){var B=this._band.dateToPixelOffset(this._date);
-var A=B-Math.round(this._width/2);
-var D=this._timeline.getDocument();
-var F=D.createElement("div");
-F.className="timeline-highlight-point-decorator";
-F.className+=" "+this._cssClass;
-if(this._opacity<100){SimileAjax.Graphics.setOpacity(F,this._opacity);
-}this._layerDiv.appendChild(F);
-if(this._timeline.isHorizontal()){F.style.left=A+"px";
-}else{F.style.top=A+"px";
-}}this._layerDiv.style.display="block";
-};
-Timeline.PointHighlightDecorator.prototype.softPaint=function(){};
-
-
-/* detailed-painter.js */
-Timeline.DetailedEventPainter=function(A){this._params=A;
-this._onSelectListeners=[];
-this._filterMatcher=null;
-this._highlightMatcher=null;
-this._frc=null;
-this._eventIdToElmt={};
-};
-Timeline.DetailedEventPainter.prototype.initialize=function(B,A){this._band=B;
-this._timeline=A;
-this._backLayer=null;
-this._eventLayer=null;
-this._lineLayer=null;
-this._highlightLayer=null;
-this._eventIdToElmt=null;
-};
-Timeline.DetailedEventPainter.prototype.addOnSelectListener=function(A){this._onSelectListeners.push(A);
-};
-Timeline.DetailedEventPainter.prototype.removeOnSelectListener=function(B){for(var A=0;
-A<this._onSelectListeners.length;
-A++){if(this._onSelectListeners[A]==B){this._onSelectListeners.splice(A,1);
-break;
-}}};
-Timeline.DetailedEventPainter.prototype.getFilterMatcher=function(){return this._filterMatcher;
-};
-Timeline.DetailedEventPainter.prototype.setFilterMatcher=function(A){this._filterMatcher=A;
-};
-Timeline.DetailedEventPainter.prototype.getHighlightMatcher=function(){return this._highlightMatcher;
-};
-Timeline.DetailedEventPainter.prototype.setHighlightMatcher=function(A){this._highlightMatcher=A;
-};
-Timeline.DetailedEventPainter.prototype.paint=function(){var B=this._band.getEventSource();
-if(B==null){return ;
-}this._eventIdToElmt={};
-this._prepareForPainting();
-var I=this._params.theme.event;
-var G=Math.max(I.track.height,this._frc.getLineHeight());
-var F={trackOffset:Math.round(this._band.getViewWidth()/2-G/2),trackHeight:G,trackGap:I.track.gap,trackIncrement:G+I.track.gap,icon:I.instant.icon,iconWidth:I.instant.iconWidth,iconHeight:I.instant.iconHeight,labelWidth:I.label.width};
-var C=this._band.getMinDate();
-var A=this._band.getMaxDate();
-var J=(this._filterMatcher!=null)?this._filterMatcher:function(K){return true;
-};
-var E=(this._highlightMatcher!=null)?this._highlightMatcher:function(K){return -1;
-};
-var D=B.getEventReverseIterator(C,A);
-while(D.hasNext()){var H=D.next();
-if(J(H)){this.paintEvent(H,F,this._params.theme,E(H));
-}}this._highlightLayer.style.display="block";
-this._lineLayer.style.display="block";
-this._eventLayer.style.display="block";
-};
-Timeline.DetailedEventPainter.prototype.softPaint=function(){};
-Timeline.DetailedEventPainter.prototype._prepareForPainting=function(){var B=this._band;
-if(this._backLayer==null){this._backLayer=this._band.createLayerDiv(0,"timeline-band-events");
-this._backLayer.style.visibility="hidden";
-var A=document.createElement("span");
-A.className="timeline-event-label";
-this._backLayer.appendChild(A);
-this._frc=SimileAjax.Graphics.getFontRenderingContext(A);
-}this._frc.update();
-this._lowerTracks=[];
-this._upperTracks=[];
-if(this._highlightLayer!=null){B.removeLayerDiv(this._highlightLayer);
-}this._highlightLayer=B.createLayerDiv(105,"timeline-band-highlights");
-this._highlightLayer.style.display="none";
-if(this._lineLayer!=null){B.removeLayerDiv(this._lineLayer);
-}this._lineLayer=B.createLayerDiv(110,"timeline-band-lines");
-this._lineLayer.style.display="none";
-if(this._eventLayer!=null){B.removeLayerDiv(this._eventLayer);
-}this._eventLayer=B.createLayerDiv(110,"timeline-band-events");
-this._eventLayer.style.display="none";
-};
-Timeline.DetailedEventPainter.prototype.paintEvent=function(B,C,D,A){if(B.isInstant()){this.paintInstantEvent(B,C,D,A);
-}else{this.paintDurationEvent(B,C,D,A);
-}};
-Timeline.DetailedEventPainter.prototype.paintInstantEvent=function(B,C,D,A){if(B.isImprecise()){this.paintImpreciseInstantEvent(B,C,D,A);
-}else{this.paintPreciseInstantEvent(B,C,D,A);
-}};
-Timeline.DetailedEventPainter.prototype.paintDurationEvent=function(B,C,D,A){if(B.isImprecise()){this.paintImpreciseDurationEvent(B,C,D,A);
-}else{this.paintPreciseDurationEvent(B,C,D,A);
-}};
-Timeline.DetailedEventPainter.prototype.paintPreciseInstantEvent=function(K,N,Q,O){var S=this._timeline.getDocument();
-var J=K.getText();
-var E=K.getStart();
-var C=Math.round(this._band.dateToPixelOffset(E));
-var A=Math.round(C+N.iconWidth/2);
-var I=Math.round(C-N.iconWidth/2);
-var G=this._frc.computeSize(J);
-var D=this._findFreeTrackForSolid(A,C);
-var B=this._paintEventIcon(K,D,I,N,Q);
-var T=A+Q.event.label.offsetFromLine;
-var P=D;
-var F=this._getTrackData(D);
-if(Math.min(F.solid,F.text)>=T+G.width){F.solid=I;
-F.text=T;
-}else{F.solid=I;
-T=C+Q.event.label.offsetFromLine;
-P=this._findFreeTrackForText(D,T+G.width,function(U){U.line=C-2;
-});
-this._getTrackData(P).text=I;
-this._paintEventLine(K,C,D,P,N,Q);
-}var R=Math.round(N.trackOffset+P*N.trackIncrement+N.trackHeight/2-G.height/2);
-var M=this._paintEventLabel(K,J,T,R,G.width,G.height,Q);
-var L=this;
-var H=function(U,V,W){return L._onClickInstantEvent(B.elmt,V,K);
-};
-SimileAjax.DOM.registerEvent(B.elmt,"mousedown",H);
-SimileAjax.DOM.registerEvent(M.elmt,"mousedown",H);
-this._createHighlightDiv(O,B,Q);
-this._eventIdToElmt[K.getID()]=B.elmt;
-};
-Timeline.DetailedEventPainter.prototype.paintImpreciseInstantEvent=function(N,Q,V,R){var X=this._timeline.getDocument();
-var M=N.getText();
-var H=N.getStart();
-var S=N.getEnd();
-var E=Math.round(this._band.dateToPixelOffset(H));
-var B=Math.round(this._band.dateToPixelOffset(S));
-var A=Math.round(E+Q.iconWidth/2);
-var L=Math.round(E-Q.iconWidth/2);
-var J=this._frc.computeSize(M);
-var F=this._findFreeTrackForSolid(B,E);
-var G=this._paintEventTape(N,F,E,B,V.event.instant.impreciseColor,V.event.instant.impreciseOpacity,Q,V);
-var C=this._paintEventIcon(N,F,L,Q,V);
-var I=this._getTrackData(F);
-I.solid=L;
-var W=A+V.event.label.offsetFromLine;
-var D=W+J.width;
-var T;
-if(D<B){T=F;
-}else{W=E+V.event.label.offsetFromLine;
-D=W+J.width;
-T=this._findFreeTrackForText(F,D,function(Y){Y.line=E-2;
-});
-this._getTrackData(T).text=L;
-this._paintEventLine(N,E,F,T,Q,V);
-}var U=Math.round(Q.trackOffset+T*Q.trackIncrement+Q.trackHeight/2-J.height/2);
-var P=this._paintEventLabel(N,M,W,U,J.width,J.height,V);
-var O=this;
-var K=function(Y,Z,a){return O._onClickInstantEvent(C.elmt,Z,N);
-};
-SimileAjax.DOM.registerEvent(C.elmt,"mousedown",K);
-SimileAjax.DOM.registerEvent(G.elmt,"mousedown",K);
-SimileAjax.DOM.registerEvent(P.elmt,"mousedown",K);
-this._createHighlightDiv(R,C,V);
-this._eventIdToElmt[N.getID()]=C.elmt;
-};
-Timeline.DetailedEventPainter.prototype.paintPreciseDurationEvent=function(J,M,S,O){var T=this._timeline.getDocument();
-var I=J.getText();
-var D=J.getStart();
-var P=J.getEnd();
-var B=Math.round(this._band.dateToPixelOffset(D));
-var A=Math.round(this._band.dateToPixelOffset(P));
-var F=this._frc.computeSize(I);
-var E=this._findFreeTrackForSolid(A);
-var N=J.getColor();
-N=N!=null?N:S.event.duration.color;
-var C=this._paintEventTape(J,E,B,A,N,100,M,S);
-var H=this._getTrackData(E);
-H.solid=B;
-var U=B+S.event.label.offsetFromLine;
-var Q=this._findFreeTrackForText(E,U+F.width,function(V){V.line=B-2;
-});
-this._getTrackData(Q).text=B-2;
-this._paintEventLine(J,B,E,Q,M,S);
-var R=Math.round(M.trackOffset+Q*M.trackIncrement+M.trackHeight/2-F.height/2);
-var L=this._paintEventLabel(J,I,U,R,F.width,F.height,S);
-var K=this;
-var G=function(V,W,X){return K._onClickDurationEvent(C.elmt,W,J);
-};
-SimileAjax.DOM.registerEvent(C.elmt,"mousedown",G);
-SimileAjax.DOM.registerEvent(L.elmt,"mousedown",G);
-this._createHighlightDiv(O,C,S);
-this._eventIdToElmt[J.getID()]=C.elmt;
-};
-Timeline.DetailedEventPainter.prototype.paintImpreciseDurationEvent=function(L,P,W,S){var Z=this._timeline.getDocument();
-var K=L.getText();
-var D=L.getStart();
-var Q=L.getLatestStart();
-var T=L.getEnd();
-var X=L.getEarliestEnd();
-var B=Math.round(this._band.dateToPixelOffset(D));
-var F=Math.round(this._band.dateToPixelOffset(Q));
-var A=Math.round(this._band.dateToPixelOffset(T));
-var G=Math.round(this._band.dateToPixelOffset(X));
-var H=this._frc.computeSize(K);
-var E=this._findFreeTrackForSolid(A);
-var R=L.getColor();
-R=R!=null?R:W.event.duration.color;
-var O=this._paintEventTape(L,E,B,A,W.event.duration.impreciseColor,W.event.duration.impreciseOpacity,P,W);
-var C=this._paintEventTape(L,E,F,G,R,100,P,W);
-var J=this._getTrackData(E);
-J.solid=B;
-var Y=F+W.event.label.offsetFromLine;
-var U=this._findFreeTrackForText(E,Y+H.width,function(a){a.line=F-2;
-});
-this._getTrackData(U).text=F-2;
-this._paintEventLine(L,F,E,U,P,W);
-var V=Math.round(P.trackOffset+U*P.trackIncrement+P.trackHeight/2-H.height/2);
-var N=this._paintEventLabel(L,K,Y,V,H.width,H.height,W);
-var M=this;
-var I=function(a,b,c){return M._onClickDurationEvent(C.elmt,b,L);
-};
-SimileAjax.DOM.registerEvent(C.elmt,"mousedown",I);
-SimileAjax.DOM.registerEvent(N.elmt,"mousedown",I);
-this._createHighlightDiv(S,C,W);
-this._eventIdToElmt[L.getID()]=C.elmt;
-};
-Timeline.DetailedEventPainter.prototype._findFreeTrackForSolid=function(B,A){for(var D=0;
-true;
-D++){if(D<this._lowerTracks.length){var C=this._lowerTracks[D];
-if(Math.min(C.solid,C.text)>B&&(!(A)||C.line>A)){return D;
-}}else{this._lowerTracks.push({solid:Number.POSITIVE_INFINITY,text:Number.POSITIVE_INFINITY,line:Number.POSITIVE_INFINITY});
-return D;
-}if(D<this._upperTracks.length){var C=this._upperTracks[D];
-if(Math.min(C.solid,C.text)>B&&(!(A)||C.line>A)){return -1-D;
-}}else{this._upperTracks.push({solid:Number.POSITIVE_INFINITY,text:Number.POSITIVE_INFINITY,line:Number.POSITIVE_INFINITY});
-return -1-D;
-}}};
-Timeline.DetailedEventPainter.prototype._findFreeTrackForText=function(D,C,H){var F;
-var G;
-var B;
-var J;
-if(D<0){F=true;
-B=-D;
-G=this._findFreeUpperTrackForText(B,C);
-J=-1-G;
-}else{if(D>0){F=false;
-B=D+1;
-G=this._findFreeLowerTrackForText(B,C);
-J=G;
-}else{var A=this._findFreeUpperTrackForText(0,C);
-var I=this._findFreeLowerTrackForText(1,C);
-if(I-1<=A){F=false;
-B=1;
-G=I;
-J=G;
-}else{F=true;
-B=0;
-G=A;
-J=-1-G;
-}}}if(F){if(G==this._upperTracks.length){this._upperTracks.push({solid:Number.POSITIVE_INFINITY,text:Number.POSITIVE_INFINITY,line:Number.POSITIVE_INFINITY});
-}for(var E=B;
-E<G;
-E++){H(this._upperTracks[E]);
-}}else{if(G==this._lowerTracks.length){this._lowerTracks.push({solid:Number.POSITIVE_INFINITY,text:Number.POSITIVE_INFINITY,line:Number.POSITIVE_INFINITY});
-}for(var E=B;
-E<G;
-E++){H(this._lowerTracks[E]);
-}}return J;
-};
-Timeline.DetailedEventPainter.prototype._findFreeLowerTrackForText=function(A,C){for(;
-A<this._lowerTracks.length;
-A++){var B=this._lowerTracks[A];
-if(Math.min(B.solid,B.text)>=C){break;
-}}return A;
-};
-Timeline.DetailedEventPainter.prototype._findFreeUpperTrackForText=function(A,C){for(;
-A<this._upperTracks.length;
-A++){var B=this._upperTracks[A];
-if(Math.min(B.solid,B.text)>=C){break;
-}}return A;
-};
-Timeline.DetailedEventPainter.prototype._getTrackData=function(A){return(A<0)?this._upperTracks[-A-1]:this._lowerTracks[A];
-};
-Timeline.DetailedEventPainter.prototype._paintEventLine=function(I,C,F,A,G,D){var H=Math.round(G.trackOffset+F*G.trackIncrement+G.trackHeight/2);
-var J=Math.round(Math.abs(A-F)*G.trackIncrement);
-var E="1px solid "+D.event.label.lineColor;
-var B=this._timeline.getDocument().createElement("div");
-B.style.position="absolute";
-B.style.left=C+"px";
-B.style.width=D.event.label.offsetFromLine+"px";
-B.style.height=J+"px";
-if(F>A){B.style.top=(H-J)+"px";
-B.style.borderTop=E;
-}else{B.style.top=H+"px";
-B.style.borderBottom=E;
-}B.style.borderLeft=E;
-this._lineLayer.appendChild(B);
-};
-Timeline.DetailedEventPainter.prototype._paintEventIcon=function(I,E,B,F,D){var H=I.getIcon();
-H=H!=null?H:F.icon;
-var J=F.trackOffset+E*F.trackIncrement+F.trackHeight/2;
-var G=Math.round(J-F.iconHeight/2);
-var C=SimileAjax.Graphics.createTranslucentImage(H);
-var A=this._timeline.getDocument().createElement("div");
-A.style.position="absolute";
-A.style.left=B+"px";
-A.style.top=G+"px";
-A.appendChild(C);
-A.style.cursor="pointer";
-if(I._title!=null){A.title=I._title;
-}this._eventLayer.appendChild(A);
-return{left:B,top:G,width:F.iconWidth,height:F.iconHeight,elmt:A};
-};
-Timeline.DetailedEventPainter.prototype._paintEventLabel=function(H,I,B,F,A,J,D){var G=this._timeline.getDocument();
-var K=G.createElement("div");
-K.style.position="absolute";
-K.style.left=B+"px";
-K.style.width=A+"px";
-K.style.top=F+"px";
-K.style.height=J+"px";
-K.style.backgroundColor=D.event.label.backgroundColor;
-SimileAjax.Graphics.setOpacity(K,D.event.label.backgroundOpacity);
-this._eventLayer.appendChild(K);
-var E=G.createElement("div");
-E.style.position="absolute";
-E.style.left=B+"px";
-E.style.width=A+"px";
-E.style.top=F+"px";
-E.innerHTML=I;
-E.style.cursor="pointer";
-if(H._title!=null){E.title=H._title;
-}var C=H.getTextColor();
-if(C==null){C=H.getColor();
-}if(C!=null){E.style.color=C;
-}this._eventLayer.appendChild(E);
-return{left:B,top:F,width:A,height:J,elmt:E};
-};
-Timeline.DetailedEventPainter.prototype._paintEventTape=function(L,H,E,A,C,G,I,F){var B=A-E;
-var D=F.event.tape.height;
-var M=I.trackOffset+H*I.trackIncrement+I.trackHeight/2;
-var J=Math.round(M-D/2);
-var K=this._timeline.getDocument().createElement("div");
-K.style.position="absolute";
-K.style.left=E+"px";
-K.style.width=B+"px";
-K.style.top=J+"px";
-K.style.height=D+"px";
-K.style.backgroundColor=C;
-K.style.overflow="hidden";
-K.style.cursor="pointer";
-if(L._title!=null){K.title=L._title;
-}SimileAjax.Graphics.setOpacity(K,G);
-this._eventLayer.appendChild(K);
-return{left:E,top:J,width:B,height:D,elmt:K};
-};
-Timeline.DetailedEventPainter.prototype._createHighlightDiv=function(A,C,E){if(A>=0){var D=this._timeline.getDocument();
-var G=E.event;
-var B=G.highlightColors[Math.min(A,G.highlightColors.length-1)];
-var F=D.createElement("div");
-F.style.position="absolute";
-F.style.overflow="hidden";
-F.style.left=(C.left-2)+"px";
-F.style.width=(C.width+4)+"px";
-F.style.top=(C.top-2)+"px";
-F.style.height=(C.height+4)+"px";
-F.style.background=B;
-this._highlightLayer.appendChild(F);
-}};
-Timeline.DetailedEventPainter.prototype._onClickInstantEvent=function(B,C,A){var D=SimileAjax.DOM.getPageCoordinates(B);
-this._showBubble(D.left+Math.ceil(B.offsetWidth/2),D.top+Math.ceil(B.offsetHeight/2),A);
-this._fireOnSelect(A.getID());
-C.cancelBubble=true;
-SimileAjax.DOM.cancelEvent(C);
-return false;
-};
-Timeline.DetailedEventPainter.prototype._onClickDurationEvent=function(D,C,B){if("pageX" in C){var A=C.pageX;
-var F=C.pageY;
-}else{var E=SimileAjax.DOM.getPageCoordinates(D);
-var A=C.offsetX+E.left;
-var F=C.offsetY+E.top;
-}this._showBubble(A,F,B);
-this._fireOnSelect(B.getID());
-C.cancelBubble=true;
-SimileAjax.DOM.cancelEvent(C);
-return false;
-};
-Timeline.DetailedEventPainter.prototype.showBubble=function(A){var B=this._eventIdToElmt[A.getID()];
-if(B){var C=SimileAjax.DOM.getPageCoordinates(B);
-this._showBubble(C.left+B.offsetWidth/2,C.top+B.offsetHeight/2,A);
-}};
-Timeline.DetailedEventPainter.prototype._showBubble=function(A,D,B){var C=document.createElement("div");
-B.fillInfoBubble(C,this._params.theme,this._band.getLabeller());
-SimileAjax.WindowManager.cancelPopups();
-SimileAjax.Graphics.createBubbleForContentAndPoint(C,A,D,this._params.theme.event.bubble.width);
-};
-Timeline.DetailedEventPainter.prototype._fireOnSelect=function(B){for(var A=0;
-A<this._onSelectListeners.length;
-A++){this._onSelectListeners[A](B);
-}};
-
-
-/* ether-painters.js */
-Timeline.GregorianEtherPainter=function(A){this._params=A;
-this._theme=A.theme;
-this._unit=A.unit;
-this._multiple=("multiple" in A)?A.multiple:1;
-};
-Timeline.GregorianEtherPainter.prototype.initialize=function(C,B){this._band=C;
-this._timeline=B;
-this._backgroundLayer=C.createLayerDiv(0);
-this._backgroundLayer.setAttribute("name","ether-background");
-this._backgroundLayer.className="timeline-ether-bg";
-this._markerLayer=null;
-this._lineLayer=null;
-var D=("align" in this._params&&this._params.align!=undefined)?this._params.align:this._theme.ether.interval.marker[B.isHorizontal()?"hAlign":"vAlign"];
-var A=("showLine" in this._params)?this._params.showLine:this._theme.ether.interval.line.show;
-this._intervalMarkerLayout=new Timeline.EtherIntervalMarkerLayout(this._timeline,this._band,this._theme,D,A);
-this._highlight=new Timeline.EtherHighlight(this._timeline,this._band,this._theme,this._backgroundLayer);
-};
-Timeline.GregorianEtherPainter.prototype.setHighlight=function(A,B){this._highlight.position(A,B);
-};
-Timeline.GregorianEtherPainter.prototype.paint=function(){if(this._markerLayer){this._band.removeLayerDiv(this._markerLayer);
-}this._markerLayer=this._band.createLayerDiv(100);
-this._markerLayer.setAttribute("name","ether-markers");
-this._markerLayer.style.display="none";
-if(this._lineLayer){this._band.removeLayerDiv(this._lineLayer);
-}this._lineLayer=this._band.createLayerDiv(1);
-this._lineLayer.setAttribute("name","ether-lines");
-this._lineLayer.style.display="none";
-var C=this._band.getMinDate();
-var F=this._band.getMaxDate();
-var B=this._band.getTimeZone();
-var E=this._band.getLabeller();
-SimileAjax.DateTime.roundDownToInterval(C,this._unit,B,this._multiple,this._theme.firstDayOfWeek);
-var D=this;
-var A=function(G){for(var H=0;
-H<D._multiple;
-H++){SimileAjax.DateTime.incrementByInterval(G,D._unit);
-}};
-while(C.getTime()<F.getTime()){this._intervalMarkerLayout.createIntervalMarker(C,E,this._unit,this._markerLayer,this._lineLayer);
-A(C);
-}this._markerLayer.style.display="block";
-this._lineLayer.style.display="block";
-};
-Timeline.GregorianEtherPainter.prototype.softPaint=function(){};
-Timeline.GregorianEtherPainter.prototype.zoom=function(A){if(A!=0){this._unit+=A;
-}};
-Timeline.HotZoneGregorianEtherPainter=function(G){this._params=G;
-this._theme=G.theme;
-this._zones=[{startTime:Number.NEGATIVE_INFINITY,endTime:Number.POSITIVE_INFINITY,unit:G.unit,multiple:1}];
-for(var E=0;
-E<G.zones.length;
-E++){var B=G.zones[E];
-var D=SimileAjax.DateTime.parseGregorianDateTime(B.start).getTime();
-var F=SimileAjax.DateTime.parseGregorianDateTime(B.end).getTime();
-for(var C=0;
-C<this._zones.length&&F>D;
-C++){var A=this._zones[C];
-if(D<A.endTime){if(D>A.startTime){this._zones.splice(C,0,{startTime:A.startTime,endTime:D,unit:A.unit,multiple:A.multiple});
-C++;
-A.startTime=D;
-}if(F<A.endTime){this._zones.splice(C,0,{startTime:D,endTime:F,unit:B.unit,multiple:(B.multiple)?B.multiple:1});
-C++;
-A.startTime=F;
-D=F;
-}else{A.multiple=B.multiple;
-A.unit=B.unit;
-D=A.endTime;
-}}}}};
-Timeline.HotZoneGregorianEtherPainter.prototype.initialize=function(C,B){this._band=C;
-this._timeline=B;
-this._backgroundLayer=C.createLayerDiv(0);
-this._backgroundLayer.setAttribute("name","ether-background");
-this._backgroundLayer.className="timeline-ether-bg";
-this._markerLayer=null;
-this._lineLayer=null;
-var D=("align" in this._params&&this._params.align!=undefined)?this._params.align:this._theme.ether.interval.marker[B.isHorizontal()?"hAlign":"vAlign"];
-var A=("showLine" in this._params)?this._params.showLine:this._theme.ether.interval.line.show;
-this._intervalMarkerLayout=new Timeline.EtherIntervalMarkerLayout(this._timeline,this._band,this._theme,D,A);
-this._highlight=new Timeline.EtherHighlight(this._timeline,this._band,this._theme,this._backgroundLayer);
-};
-Timeline.HotZoneGregorianEtherPainter.prototype.setHighlight=function(A,B){this._highlight.position(A,B);
-};
-Timeline.HotZoneGregorianEtherPainter.prototype.paint=function(){if(this._markerLayer){this._band.removeLayerDiv(this._markerLayer);
-}this._markerLayer=this._band.createLayerDiv(100);
-this._markerLayer.setAttribute("name","ether-markers");
-this._markerLayer.style.display="none";
-if(this._lineLayer){this._band.removeLayerDiv(this._lineLayer);
-}this._lineLayer=this._band.createLayerDiv(1);
-this._lineLayer.setAttribute("name","ether-lines");
-this._lineLayer.style.display="none";
-var D=this._band.getMinDate();
-var A=this._band.getMaxDate();
-var K=this._band.getTimeZone();
-var I=this._band.getLabeller();
-var B=this;
-var L=function(N,M){for(var O=0;
-O<M.multiple;
-O++){SimileAjax.DateTime.incrementByInterval(N,M.unit);
-}};
-var C=0;
-while(C<this._zones.length){if(D.getTime()<this._zones[C].endTime){break;
-}C++;
-}var E=this._zones.length-1;
-while(E>=0){if(A.getTime()>this._zones[E].startTime){break;
-}E--;
-}for(var H=C;
-H<=E;
-H++){var G=this._zones[H];
-var J=new Date(Math.max(D.getTime(),G.startTime));
-var F=new Date(Math.min(A.getTime(),G.endTime));
-SimileAjax.DateTime.roundDownToInterval(J,G.unit,K,G.multiple,this._theme.firstDayOfWeek);
-SimileAjax.DateTime.roundUpToInterval(F,G.unit,K,G.multiple,this._theme.firstDayOfWeek);
-while(J.getTime()<F.getTime()){this._intervalMarkerLayout.createIntervalMarker(J,I,G.unit,this._markerLayer,this._lineLayer);
-L(J,G);
-}}this._markerLayer.style.display="block";
-this._lineLayer.style.display="block";
-};
-Timeline.HotZoneGregorianEtherPainter.prototype.softPaint=function(){};
-Timeline.HotZoneGregorianEtherPainter.prototype.zoom=function(B){if(B!=0){for(var A=0;
-A<this._zones.length;
-++A){if(this._zones[A]){this._zones[A].unit+=B;
-}}}};
-Timeline.YearCountEtherPainter=function(A){this._params=A;
-this._theme=A.theme;
-this._startDate=SimileAjax.DateTime.parseGregorianDateTime(A.startDate);
-this._multiple=("multiple" in A)?A.multiple:1;
-};
-Timeline.YearCountEtherPainter.prototype.initialize=function(C,B){this._band=C;
-this._timeline=B;
-this._backgroundLayer=C.createLayerDiv(0);
-this._backgroundLayer.setAttribute("name","ether-background");
-this._backgroundLayer.className="timeline-ether-bg";
-this._markerLayer=null;
-this._lineLayer=null;
-var D=("align" in this._params)?this._params.align:this._theme.ether.interval.marker[B.isHorizontal()?"hAlign":"vAlign"];
-var A=("showLine" in this._params)?this._params.showLine:this._theme.ether.interval.line.show;
-this._intervalMarkerLayout=new Timeline.EtherIntervalMarkerLayout(this._timeline,this._band,this._theme,D,A);
-this._highlight=new Timeline.EtherHighlight(this._timeline,this._band,this._theme,this._backgroundLayer);
-};
-Timeline.YearCountEtherPainter.prototype.setHighlight=function(A,B){this._highlight.position(A,B);
-};
-Timeline.YearCountEtherPainter.prototype.paint=function(){if(this._markerLayer){this._band.removeLayerDiv(this._markerLayer);
-}this._markerLayer=this._band.createLayerDiv(100);
-this._markerLayer.setAttribute("name","ether-markers");
-this._markerLayer.style.display="none";
-if(this._lineLayer){this._band.removeLayerDiv(this._lineLayer);
-}this._lineLayer=this._band.createLayerDiv(1);
-this._lineLayer.setAttribute("name","ether-lines");
-this._lineLayer.style.display="none";
-var B=new Date(this._startDate.getTime());
-var F=this._band.getMaxDate();
-var E=this._band.getMinDate().getUTCFullYear()-this._startDate.getUTCFullYear();
-B.setUTCFullYear(this._band.getMinDate().getUTCFullYear()-E%this._multiple);
-var C=this;
-var A=function(G){for(var H=0;
-H<C._multiple;
-H++){SimileAjax.DateTime.incrementByInterval(G,SimileAjax.DateTime.YEAR);
-}};
-var D={labelInterval:function(G,I){var H=G.getUTCFullYear()-C._startDate.getUTCFullYear();
-return{text:H,emphasized:H==0};
-}};
-while(B.getTime()<F.getTime()){this._intervalMarkerLayout.createIntervalMarker(B,D,SimileAjax.DateTime.YEAR,this._markerLayer,this._lineLayer);
-A(B);
-}this._markerLayer.style.display="block";
-this._lineLayer.style.display="block";
-};
-Timeline.YearCountEtherPainter.prototype.softPaint=function(){};
-Timeline.QuarterlyEtherPainter=function(A){this._params=A;
-this._theme=A.theme;
-this._startDate=SimileAjax.DateTime.parseGregorianDateTime(A.startDate);
-};
-Timeline.QuarterlyEtherPainter.prototype.initialize=function(C,B){this._band=C;
-this._timeline=B;
-this._backgroundLayer=C.createLayerDiv(0);
-this._backgroundLayer.setAttribute("name","ether-background");
-this._backgroundLayer.className="timeline-ether-bg";
-this._markerLayer=null;
-this._lineLayer=null;
-var D=("align" in this._params)?this._params.align:this._theme.ether.interval.marker[B.isHorizontal()?"hAlign":"vAlign"];
-var A=("showLine" in this._params)?this._params.showLine:this._theme.ether.interval.line.show;
-this._intervalMarkerLayout=new Timeline.EtherIntervalMarkerLayout(this._timeline,this._band,this._theme,D,A);
-this._highlight=new Timeline.EtherHighlight(this._timeline,this._band,this._theme,this._backgroundLayer);
-};
-Timeline.QuarterlyEtherPainter.prototype.setHighlight=function(A,B){this._highlight.position(A,B);
-};
-Timeline.QuarterlyEtherPainter.prototype.paint=function(){if(this._markerLayer){this._band.removeLayerDiv(this._markerLayer);
-}this._markerLayer=this._band.createLayerDiv(100);
-this._markerLayer.setAttribute("name","ether-markers");
-this._markerLayer.style.display="none";
-if(this._lineLayer){this._band.removeLayerDiv(this._lineLayer);
-}this._lineLayer=this._band.createLayerDiv(1);
-this._lineLayer.setAttribute("name","ether-lines");
-this._lineLayer.style.display="none";
-var B=new Date(0);
-var E=this._band.getMaxDate();
-B.setUTCFullYear(Math.max(this._startDate.getUTCFullYear(),this._band.getMinDate().getUTCFullYear()));
-B.setUTCMonth(this._startDate.getUTCMonth());
-var C=this;
-var A=function(F){F.setUTCMonth(F.getUTCMonth()+3);
-};
-var D={labelInterval:function(F,H){var G=(4+(F.getUTCMonth()-C._startDate.getUTCMonth())/3)%4;
-if(G!=0){return{text:"Q"+(G+1),emphasized:false};
-}else{return{text:"Y"+(F.getUTCFullYear()-C._startDate.getUTCFullYear()+1),emphasized:true};
-}}};
-while(B.getTime()<E.getTime()){this._intervalMarkerLayout.createIntervalMarker(B,D,SimileAjax.DateTime.YEAR,this._markerLayer,this._lineLayer);
-A(B);
-}this._markerLayer.style.display="block";
-this._lineLayer.style.display="block";
-};
-Timeline.QuarterlyEtherPainter.prototype.softPaint=function(){};
-Timeline.EtherIntervalMarkerLayout=function(M,L,C,E,H){var A=M.isHorizontal();
-if(A){if(E=="Top"){this.positionDiv=function(O,N){O.style.left=N+"px";
-O.style.top="0px";
-};
-}else{this.positionDiv=function(O,N){O.style.left=N+"px";
-O.style.bottom="0px";
-};
-}}else{if(E=="Left"){this.positionDiv=function(O,N){O.style.top=N+"px";
-O.style.left="0px";
-};
-}else{this.positionDiv=function(O,N){O.style.top=N+"px";
-O.style.right="0px";
-};
-}}var D=C.ether.interval.marker;
-var I=C.ether.interval.line;
-var B=C.ether.interval.weekend;
-var K=(A?"h":"v")+E;
-var G=D[K+"Styler"];
-var J=D[K+"EmphasizedStyler"];
-var F=SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.DAY];
-this.createIntervalMarker=function(T,a,b,c,Q){var U=Math.round(L.dateToPixelOffset(T));
-if(H&&b!=SimileAjax.DateTime.WEEK){var V=M.getDocument().createElement("div");
-V.className="timeline-ether-lines";
-if(I.opacity<100){SimileAjax.Graphics.setOpacity(V,I.opacity);
-}if(A){V.style.left=U+"px";
-}else{V.style.top=U+"px";
-}Q.appendChild(V);
-}if(b==SimileAjax.DateTime.WEEK){var N=C.firstDayOfWeek;
-var W=new Date(T.getTime()+(6-N-7)*F);
-var Z=new Date(W.getTime()+2*F);
-var X=Math.round(L.dateToPixelOffset(W));
-var S=Math.round(L.dateToPixelOffset(Z));
-var R=Math.max(1,S-X);
-var P=M.getDocument().createElement("div");
-P.className="timeline-ether-weekends";
-if(B.opacity<100){SimileAjax.Graphics.setOpacity(P,B.opacity);
-}if(A){P.style.left=X+"px";
-P.style.width=R+"px";
-}else{P.style.top=X+"px";
-P.style.height=R+"px";
-}Q.appendChild(P);
-}var Y=a.labelInterval(T,b);
-var O=M.getDocument().createElement("div");
-O.innerHTML=Y.text;
-O.className="timeline-date-label";
-if(Y.emphasized){O.className+=" timeline-date-label-em";
-}this.positionDiv(O,U);
-c.appendChild(O);
-return O;
-};
-};
-Timeline.EtherHighlight=function(C,E,D,B){var A=C.isHorizontal();
-this._highlightDiv=null;
-this._createHighlightDiv=function(){if(this._highlightDiv==null){this._highlightDiv=C.getDocument().createElement("div");
-this._highlightDiv.setAttribute("name","ether-highlight");
-this._highlightDiv.className="timeline-ether-highlight";
-var F=D.ether.highlightOpacity;
-if(F<100){SimileAjax.Graphics.setOpacity(this._highlightDiv,F);
-}B.appendChild(this._highlightDiv);
-}};
-this.position=function(F,I){this._createHighlightDiv();
-var J=Math.round(E.dateToPixelOffset(F));
-var H=Math.round(E.dateToPixelOffset(I));
-var G=Math.max(H-J,3);
-if(A){this._highlightDiv.style.left=J+"px";
-this._highlightDiv.style.width=G+"px";
-this._highlightDiv.style.height=(E.getViewWidth()-4)+"px";
-}else{this._highlightDiv.style.top=J+"px";
-this._highlightDiv.style.height=G+"px";
-this._highlightDiv.style.width=(E.getViewWidth()-4)+"px";
-}};
-};
-
-
-/* ethers.js */
-Timeline.LinearEther=function(A){this._params=A;
-this._interval=A.interval;
-this._pixelsPerInterval=A.pixelsPerInterval;
-};
-Timeline.LinearEther.prototype.initialize=function(B,A){this._band=B;
-this._timeline=A;
-this._unit=A.getUnit();
-if("startsOn" in this._params){this._start=this._unit.parseFromObject(this._params.startsOn);
-}else{if("endsOn" in this._params){this._start=this._unit.parseFromObject(this._params.endsOn);
-this.shiftPixels(-this._timeline.getPixelLength());
-}else{if("centersOn" in this._params){this._start=this._unit.parseFromObject(this._params.centersOn);
-this.shiftPixels(-this._timeline.getPixelLength()/2);
-}else{this._start=this._unit.makeDefaultValue();
-this.shiftPixels(-this._timeline.getPixelLength()/2);
-}}}};
-Timeline.LinearEther.prototype.setDate=function(A){this._start=this._unit.cloneValue(A);
-};
-Timeline.LinearEther.prototype.shiftPixels=function(B){var A=this._interval*B/this._pixelsPerInterval;
-this._start=this._unit.change(this._start,A);
-};
-Timeline.LinearEther.prototype.dateToPixelOffset=function(A){var B=this._unit.compare(A,this._start);
-return this._pixelsPerInterval*B/this._interval;
-};
-Timeline.LinearEther.prototype.pixelOffsetToDate=function(B){var A=B*this._interval/this._pixelsPerInterval;
-return this._unit.change(this._start,A);
-};
-Timeline.LinearEther.prototype.zoom=function(D){var B=0;
-var A=this._band._zoomIndex;
-var C=A;
-if(D&&(A>0)){C=A-1;
-}if(!D&&(A<(this._band._zoomSteps.length-1))){C=A+1;
-}this._band._zoomIndex=C;
-this._interval=SimileAjax.DateTime.gregorianUnitLengths[this._band._zoomSteps[C].unit];
-this._pixelsPerInterval=this._band._zoomSteps[C].pixelsPerInterval;
-B=this._band._zoomSteps[C].unit-this._band._zoomSteps[A].unit;
-return B;
-};
-Timeline.HotZoneEther=function(A){this._params=A;
-this._interval=A.interval;
-this._pixelsPerInterval=A.pixelsPerInterval;
-this._theme=A.theme;
-};
-Timeline.HotZoneEther.prototype.initialize=function(H,I){this._band=H;
-this._timeline=I;
-this._unit=I.getUnit();
-this._zones=[{startTime:Number.NEGATIVE_INFINITY,endTime:Number.POSITIVE_INFINITY,magnify:1}];
-var B=this._params;
-for(var D=0;
-D<B.zones.length;
-D++){var G=B.zones[D];
-var E=this._unit.parseFromObject(G.start);
-var F=this._unit.parseFromObject(G.end);
-for(var C=0;
-C<this._zones.length&&this._unit.compare(F,E)>0;
-C++){var A=this._zones[C];
-if(this._unit.compare(E,A.endTime)<0){if(this._unit.compare(E,A.startTime)>0){this._zones.splice(C,0,{startTime:A.startTime,endTime:E,magnify:A.magnify});
-C++;
-A.startTime=E;
-}if(this._unit.compare(F,A.endTime)<0){this._zones.splice(C,0,{startTime:E,endTime:F,magnify:G.magnify*A.magnify});
-C++;
-A.startTime=F;
-E=F;
-}else{A.magnify*=G.magnify;
-E=A.endTime;
-}}}}if("startsOn" in this._params){this._start=this._unit.parseFromObject(this._params.startsOn);
-}else{if("endsOn" in this._params){this._start=this._unit.parseFromObject(this._params.endsOn);
-this.shiftPixels(-this._timeline.getPixelLength());
-}else{if("centersOn" in this._params){this._start=this._unit.parseFromObject(this._params.centersOn);
-this.shiftPixels(-this._timeline.getPixelLength()/2);
-}else{this._start=this._unit.makeDefaultValue();
-this.shiftPixels(-this._timeline.getPixelLength()/2);
-}}}};
-Timeline.HotZoneEther.prototype.setDate=function(A){this._start=this._unit.cloneValue(A);
-};
-Timeline.HotZoneEther.prototype.shiftPixels=function(A){this._start=this.pixelOffsetToDate(A);
-};
-Timeline.HotZoneEther.prototype.dateToPixelOffset=function(A){return this._dateDiffToPixelOffset(this._start,A);
-};
-Timeline.HotZoneEther.prototype.pixelOffsetToDate=function(A){return this._pixelOffsetToDate(A,this._start);
-};
-Timeline.HotZoneEther.prototype.zoom=function(D){var B=0;
-var A=this._band._zoomIndex;
-var C=A;
-if(D&&(A>0)){C=A-1;
-}if(!D&&(A<(this._band._zoomSteps.length-1))){C=A+1;
-}this._band._zoomIndex=C;
-this._interval=SimileAjax.DateTime.gregorianUnitLengths[this._band._zoomSteps[C].unit];
-this._pixelsPerInterval=this._band._zoomSteps[C].pixelsPerInterval;
-B=this._band._zoomSteps[C].unit-this._band._zoomSteps[A].unit;
-return B;
-};
-Timeline.HotZoneEther.prototype._dateDiffToPixelOffset=function(I,D){var B=this._getScale();
-var H=I;
-var C=D;
-var A=0;
-if(this._unit.compare(H,C)<0){var G=0;
-while(G<this._zones.length){if(this._unit.compare(H,this._zones[G].endTime)<0){break;
-}G++;
-}while(this._unit.compare(H,C)<0){var E=this._zones[G];
-var F=this._unit.earlier(C,E.endTime);
-A+=(this._unit.compare(F,H)/(B/E.magnify));
-H=F;
-G++;
-}}else{var G=this._zones.length-1;
-while(G>=0){if(this._unit.compare(H,this._zones[G].startTime)>0){break;
-}G--;
-}while(this._unit.compare(H,C)>0){var E=this._zones[G];
-var F=this._unit.later(C,E.startTime);
-A+=(this._unit.compare(F,H)/(B/E.magnify));
-H=F;
-G--;
-}}return A;
-};
-Timeline.HotZoneEther.prototype._pixelOffsetToDate=function(H,C){var G=this._getScale();
-var E=C;
-if(H>0){var F=0;
-while(F<this._zones.length){if(this._unit.compare(E,this._zones[F].endTime)<0){break;
-}F++;
-}while(H>0){var A=this._zones[F];
-var D=G/A.magnify;
-if(A.endTime==Number.POSITIVE_INFINITY){E=this._unit.change(E,H*D);
-H=0;
-}else{var B=this._unit.compare(A.endTime,E)/D;
-if(B>H){E=this._unit.change(E,H*D);
-H=0;
-}else{E=A.endTime;
-H-=B;
-}}F++;
-}}else{var F=this._zones.length-1;
-while(F>=0){if(this._unit.compare(E,this._zones[F].startTime)>0){break;
-}F--;
-}H=-H;
-while(H>0){var A=this._zones[F];
-var D=G/A.magnify;
-if(A.startTime==Number.NEGATIVE_INFINITY){E=this._unit.change(E,-H*D);
-H=0;
-}else{var B=this._unit.compare(E,A.startTime)/D;
-if(B>H){E=this._unit.change(E,-H*D);
-H=0;
-}else{E=A.startTime;
-H-=B;
-}}F--;
-}}return E;
-};
-Timeline.HotZoneEther.prototype._getScale=function(){return this._interval/this._pixelsPerInterval;
-};
-
-
-/* labellers.js */
-Timeline.GregorianDateLabeller=function(A,B){this._locale=A;
-this._timeZone=B;
-};
-Timeline.GregorianDateLabeller.monthNames=[];
-Timeline.GregorianDateLabeller.dayNames=[];
-Timeline.GregorianDateLabeller.labelIntervalFunctions=[];
-Timeline.GregorianDateLabeller.getMonthName=function(B,A){return Timeline.GregorianDateLabeller.monthNames[A][B];
-};
-Timeline.GregorianDateLabeller.prototype.labelInterval=function(A,C){var B=Timeline.GregorianDateLabeller.labelIntervalFunctions[this._locale];
-if(B==null){B=Timeline.GregorianDateLabeller.prototype.defaultLabelInterval;
-}return B.call(this,A,C);
-};
-Timeline.GregorianDateLabeller.prototype.labelPrecise=function(A){return SimileAjax.DateTime.removeTimeZoneOffset(A,this._timeZone).toUTCString();
-};
-Timeline.GregorianDateLabeller.prototype.defaultLabelInterval=function(B,F){var C;
-var E=false;
-B=SimileAjax.DateTime.removeTimeZoneOffset(B,this._timeZone);
-switch(F){case SimileAjax.DateTime.MILLISECOND:C=B.getUTCMilliseconds();
-break;
-case SimileAjax.DateTime.SECOND:C=B.getUTCSeconds();
-break;
-case SimileAjax.DateTime.MINUTE:var A=B.getUTCMinutes();
-if(A==0){C=B.getUTCHours()+":00";
-E=true;
-}else{C=A;
-}break;
-case SimileAjax.DateTime.HOUR:C=B.getUTCHours()+"hr";
-break;
-case SimileAjax.DateTime.DAY:C=Timeline.GregorianDateLabeller.getMonthName(B.getUTCMonth(),this._locale)+" "+B.getUTCDate();
-break;
-case SimileAjax.DateTime.WEEK:C=Timeline.GregorianDateLabeller.getMonthName(B.getUTCMonth(),this._locale)+" "+B.getUTCDate();
-break;
-case SimileAjax.DateTime.MONTH:var A=B.getUTCMonth();
-if(A!=0){C=Timeline.GregorianDateLabeller.getMonthName(A,this._locale);
-break;
-}case SimileAjax.DateTime.YEAR:case SimileAjax.DateTime.DECADE:case SimileAjax.DateTime.CENTURY:case SimileAjax.DateTime.MILLENNIUM:var D=B.getUTCFullYear();
-if(D>0){C=B.getUTCFullYear();
-}else{C=(1-D)+"BC";
-}E=(F==SimileAjax.DateTime.MONTH)||(F==SimileAjax.DateTime.DECADE&&D%100==0)||(F==SimileAjax.DateTime.CENTURY&&D%1000==0);
-break;
-default:C=B.toUTCString();
-}return{text:C,emphasized:E};
-};
-
-
-/* original-painter.js */
-Timeline.OriginalEventPainter=function(A){this._params=A;
-this._onSelectListeners=[];
-this._filterMatcher=null;
-this._highlightMatcher=null;
-this._frc=null;
-this._eventIdToElmt={};
-};
-Timeline.OriginalEventPainter.prototype.initialize=function(B,A){this._band=B;
-this._timeline=A;
-this._backLayer=null;
-this._eventLayer=null;
-this._lineLayer=null;
-this._highlightLayer=null;
-this._eventIdToElmt=null;
-};
-Timeline.OriginalEventPainter.prototype.addOnSelectListener=function(A){this._onSelectListeners.push(A);
-};
-Timeline.OriginalEventPainter.prototype.removeOnSelectListener=function(B){for(var A=0;
-A<this._onSelectListeners.length;
-A++){if(this._onSelectListeners[A]==B){this._onSelectListeners.splice(A,1);
-break;
-}}};
-Timeline.OriginalEventPainter.prototype.getFilterMatcher=function(){return this._filterMatcher;
-};
-Timeline.OriginalEventPainter.prototype.setFilterMatcher=function(A){this._filterMatcher=A;
-};
-Timeline.OriginalEventPainter.prototype.getHighlightMatcher=function(){return this._highlightMatcher;
-};
-Timeline.OriginalEventPainter.prototype.setHighlightMatcher=function(A){this._highlightMatcher=A;
-};
-Timeline.OriginalEventPainter.prototype.paint=function(){var B=this._band.getEventSource();
-if(B==null){return ;
-}this._eventIdToElmt={};
-this._prepareForPainting();
-var I=this._params.theme.event;
-var G=Math.max(I.track.height,I.tape.height+this._frc.getLineHeight());
-var F={trackOffset:I.track.gap,trackHeight:G,trackGap:I.track.gap,trackIncrement:G+I.track.gap,icon:I.instant.icon,iconWidth:I.instant.iconWidth,iconHeight:I.instant.iconHeight,labelWidth:I.label.width};
-var C=this._band.getMinDate();
-var A=this._band.getMaxDate();
-var J=(this._filterMatcher!=null)?this._filterMatcher:function(K){return true;
-};
-var E=(this._highlightMatcher!=null)?this._highlightMatcher:function(K){return -1;
-};
-var D=B.getEventReverseIterator(C,A);
-while(D.hasNext()){var H=D.next();
-if(J(H)){this.paintEvent(H,F,this._params.theme,E(H));
-}}this._highlightLayer.style.display="block";
-this._lineLayer.style.display="block";
-this._eventLayer.style.display="block";
-};
-Timeline.OriginalEventPainter.prototype.softPaint=function(){};
-Timeline.OriginalEventPainter.prototype._prepareForPainting=function(){var B=this._band;
-if(this._backLayer==null){this._backLayer=this._band.createLayerDiv(0,"timeline-band-events");
-this._backLayer.style.visibility="hidden";
-var A=document.createElement("span");
-A.className="timeline-event-label";
-this._backLayer.appendChild(A);
-this._frc=SimileAjax.Graphics.getFontRenderingContext(A);
-}this._frc.update();
-this._tracks=[];
-if(this._highlightLayer!=null){B.removeLayerDiv(this._highlightLayer);
-}this._highlightLayer=B.createLayerDiv(105,"timeline-band-highlights");
-this._highlightLayer.style.display="none";
-if(this._lineLayer!=null){B.removeLayerDiv(this._lineLayer);
-}this._lineLayer=B.createLayerDiv(110,"timeline-band-lines");
-this._lineLayer.style.display="none";
-if(this._eventLayer!=null){B.removeLayerDiv(this._eventLayer);
-}this._eventLayer=B.createLayerDiv(115,"timeline-band-events");
-this._eventLayer.style.display="none";
-};
-Timeline.OriginalEventPainter.prototype.paintEvent=function(B,C,D,A){if(B.isInstant()){this.paintInstantEvent(B,C,D,A);
-}else{this.paintDurationEvent(B,C,D,A);
-}};
-Timeline.OriginalEventPainter.prototype.paintInstantEvent=function(B,C,D,A){if(B.isImprecise()){this.paintImpreciseInstantEvent(B,C,D,A);
-}else{this.paintPreciseInstantEvent(B,C,D,A);
-}};
-Timeline.OriginalEventPainter.prototype.paintDurationEvent=function(B,C,D,A){if(B.isImprecise()){this.paintImpreciseDurationEvent(B,C,D,A);
-}else{this.paintPreciseDurationEvent(B,C,D,A);
-}};
-Timeline.OriginalEventPainter.prototype.paintPreciseInstantEvent=function(J,N,P,O){var S=this._timeline.getDocument();
-var I=J.getText();
-var E=J.getStart();
-var C=Math.round(this._band.dateToPixelOffset(E));
-var A=Math.round(C+N.iconWidth/2);
-var H=Math.round(C-N.iconWidth/2);
-var F=this._frc.computeSize(I);
-var T=A+P.event.label.offsetFromLine;
-var D=T+F.width;
-var R=D;
-var L=this._findFreeTrack(R);
-var Q=Math.round(N.trackOffset+L*N.trackIncrement+N.trackHeight/2-F.height/2);
-var B=this._paintEventIcon(J,L,H,N,P);
-var M=this._paintEventLabel(J,I,T,Q,F.width,F.height,P);
-var K=this;
-var G=function(U,V,W){return K._onClickInstantEvent(B.elmt,V,J);
-};
-SimileAjax.DOM.registerEvent(B.elmt,"mousedown",G);
-SimileAjax.DOM.registerEvent(M.elmt,"mousedown",G);
-this._createHighlightDiv(O,B,P);
-this._eventIdToElmt[J.getID()]=B.elmt;
-this._tracks[L]=H;
-};
-Timeline.OriginalEventPainter.prototype.paintImpreciseInstantEvent=function(L,P,T,Q){var V=this._timeline.getDocument();
-var K=L.getText();
-var G=L.getStart();
-var R=L.getEnd();
-var D=Math.round(this._band.dateToPixelOffset(G));
-var B=Math.round(this._band.dateToPixelOffset(R));
-var A=Math.round(D+P.iconWidth/2);
-var J=Math.round(D-P.iconWidth/2);
-var H=this._frc.computeSize(K);
-var W=A+T.event.label.offsetFromLine;
-var E=W+H.width;
-var U=Math.max(E,B);
-var N=this._findFreeTrack(U);
-var S=Math.round(P.trackOffset+N*P.trackIncrement+P.trackHeight/2-H.height/2);
-var C=this._paintEventIcon(L,N,J,P,T);
-var O=this._paintEventLabel(L,K,W,S,H.width,H.height,T);
-var F=this._paintEventTape(L,N,D,B,T.event.instant.impreciseColor,T.event.instant.impreciseOpacity,P,T);
-var M=this;
-var I=function(X,Y,Z){return M._onClickInstantEvent(C.elmt,Y,L);
-};
-SimileAjax.DOM.registerEvent(C.elmt,"mousedown",I);
-SimileAjax.DOM.registerEvent(F.elmt,"mousedown",I);
-SimileAjax.DOM.registerEvent(O.elmt,"mousedown",I);
-this._createHighlightDiv(Q,C,T);
-this._eventIdToElmt[L.getID()]=C.elmt;
-this._tracks[N]=J;
-};
-Timeline.OriginalEventPainter.prototype.paintPreciseDurationEvent=function(I,M,Q,O){var T=this._timeline.getDocument();
-var H=I.getText();
-var E=I.getStart();
-var P=I.getEnd();
-var B=Math.round(this._band.dateToPixelOffset(E));
-var A=Math.round(this._band.dateToPixelOffset(P));
-var F=this._frc.computeSize(H);
-var U=B;
-var C=U+F.width;
-var S=Math.max(C,A);
-var K=this._findFreeTrack(S);
-var R=Math.round(M.trackOffset+K*M.trackIncrement+Q.event.tape.height);
-var N=I.getColor();
-N=N!=null?N:Q.event.duration.color;
-var D=this._paintEventTape(I,K,B,A,N,100,M,Q);
-var L=this._paintEventLabel(I,H,U,R,F.width,F.height,Q);
-var J=this;
-var G=function(V,W,X){return J._onClickDurationEvent(D.elmt,W,I);
-};
-SimileAjax.DOM.registerEvent(D.elmt,"mousedown",G);
-SimileAjax.DOM.registerEvent(L.elmt,"mousedown",G);
-this._createHighlightDiv(O,D,Q);
-this._eventIdToElmt[I.getID()]=D.elmt;
-this._tracks[K]=B;
-};
-Timeline.OriginalEventPainter.prototype.paintImpreciseDurationEvent=function(K,P,V,S){var Y=this._timeline.getDocument();
-var J=K.getText();
-var E=K.getStart();
-var Q=K.getLatestStart();
-var T=K.getEnd();
-var X=K.getEarliestEnd();
-var B=Math.round(this._band.dateToPixelOffset(E));
-var F=Math.round(this._band.dateToPixelOffset(Q));
-var A=Math.round(this._band.dateToPixelOffset(T));
-var G=Math.round(this._band.dateToPixelOffset(X));
-var H=this._frc.computeSize(J);
-var Z=F;
-var C=Z+H.width;
-var W=Math.max(C,A);
-var M=this._findFreeTrack(W);
-var U=Math.round(P.trackOffset+M*P.trackIncrement+V.event.tape.height);
-var R=K.getColor();
-R=R!=null?R:V.event.duration.color;
-var O=this._paintEventTape(K,M,B,A,V.event.duration.impreciseColor,V.event.duration.impreciseOpacity,P,V);
-var D=this._paintEventTape(K,M,F,G,R,100,P,V);
-var N=this._paintEventLabel(K,J,Z,U,H.width,H.height,V);
-var L=this;
-var I=function(a,b,c){return L._onClickDurationEvent(D.elmt,b,K);
-};
-SimileAjax.DOM.registerEvent(D.elmt,"mousedown",I);
-SimileAjax.DOM.registerEvent(N.elmt,"mousedown",I);
-this._createHighlightDiv(S,D,V);
-this._eventIdToElmt[K.getID()]=D.elmt;
-this._tracks[M]=B;
-};
-Timeline.OriginalEventPainter.prototype._findFreeTrack=function(A){for(var C=0;
-C<this._tracks.length;
-C++){var B=this._tracks[C];
-if(B>A){break;
-}}return C;
-};
-Timeline.OriginalEventPainter.prototype._paintEventIcon=function(I,E,B,F,D){var H=I.getIcon();
-H=H!=null?H:F.icon;
-var J=F.trackOffset+E*F.trackIncrement+F.trackHeight/2;
-var G=Math.round(J-F.iconHeight/2);
-var C=SimileAjax.Graphics.createTranslucentImage(H);
-var A=this._timeline.getDocument().createElement("div");
-A.className="timeline-event-icon";
-A.style.left=B+"px";
-A.style.top=G+"px";
-A.appendChild(C);
-if(I._title!=null){A.title=I._title;
-}this._eventLayer.appendChild(A);
-return{left:B,top:G,width:F.iconWidth,height:F.iconHeight,elmt:A};
-};
-Timeline.OriginalEventPainter.prototype._paintEventLabel=function(I,J,B,G,A,K,E){var H=this._timeline.getDocument();
-var F=H.createElement("div");
-F.className="timeline-event-label";
-F.style.left=B+"px";
-F.style.width=A+"px";
-F.style.top=G+"px";
-F.innerHTML=J;
-if(I._title!=null){F.title=I._title;
-}var D=I.getTextColor();
-if(D==null){D=I.getColor();
-}if(D!=null){F.style.color=D;
-}var C=I.getClassName();
-if(C){F.className+=" "+C;
-}this._eventLayer.appendChild(F);
-return{left:B,top:G,width:A,height:K,elmt:F};
-};
-Timeline.OriginalEventPainter.prototype._paintEventTape=function(L,H,E,A,C,G,I,F){var B=A-E;
-var D=F.event.tape.height;
-var J=I.trackOffset+H*I.trackIncrement;
-var K=this._timeline.getDocument().createElement("div");
-K.className="timeline-event-tape";
-K.style.left=E+"px";
-K.style.width=B+"px";
-K.style.top=J+"px";
-if(L._title!=null){K.title=L._title;
-}SimileAjax.Graphics.setOpacity(K,G);
-this._eventLayer.appendChild(K);
-return{left:E,top:J,width:B,height:D,elmt:K};
-};
-Timeline.OriginalEventPainter.prototype._createHighlightDiv=function(A,C,E){if(A>=0){var D=this._timeline.getDocument();
-var G=E.event;
-var B=G.highlightColors[Math.min(A,G.highlightColors.length-1)];
-var F=D.createElement("div");
-F.style.position="absolute";
-F.style.overflow="hidden";
-F.style.left=(C.left-2)+"px";
-F.style.width=(C.width+4)+"px";
-F.style.top=(C.top-2)+"px";
-F.style.height=(C.height+4)+"px";
-this._highlightLayer.appendChild(F);
-}};
-Timeline.OriginalEventPainter.prototype._onClickInstantEvent=function(B,C,A){var D=SimileAjax.DOM.getPageCoordinates(B);
-this._showBubble(D.left+Math.ceil(B.offsetWidth/2),D.top+Math.ceil(B.offsetHeight/2),A);
-this._fireOnSelect(A.getID());
-C.cancelBubble=true;
-SimileAjax.DOM.cancelEvent(C);
-return false;
-};
-Timeline.OriginalEventPainter.prototype._onClickDurationEvent=function(D,C,B){if("pageX" in C){var A=C.pageX;
-var F=C.pageY;
-}else{var E=SimileAjax.DOM.getPageCoordinates(D);
-var A=C.offsetX+E.left;
-var F=C.offsetY+E.top;
-}this._showBubble(A,F,B);
-this._fireOnSelect(B.getID());
-C.cancelBubble=true;
-SimileAjax.DOM.cancelEvent(C);
-return false;
-};
-Timeline.OriginalEventPainter.prototype.showBubble=function(A){var B=this._eventIdToElmt[A.getID()];
-if(B){var C=SimileAjax.DOM.getPageCoordinates(B);
-this._showBubble(C.left+B.offsetWidth/2,C.top+B.offsetHeight/2,A);
-}};
-Timeline.OriginalEventPainter.prototype._showBubble=function(A,D,B){var C=document.createElement("div");
-B.fillInfoBubble(C,this._params.theme,this._band.getLabeller());
-SimileAjax.WindowManager.cancelPopups();
-SimileAjax.Graphics.createBubbleForContentAndPoint(C,A,D,this._params.theme.event.bubble.width);
-};
-Timeline.OriginalEventPainter.prototype._fireOnSelect=function(B){for(var A=0;
-A<this._onSelectListeners.length;
-A++){this._onSelectListeners[A](B);
-}};
-
-
-/* overview-painter.js */
-Timeline.OverviewEventPainter=function(A){this._params=A;
-this._onSelectListeners=[];
-this._filterMatcher=null;
-this._highlightMatcher=null;
-};
-Timeline.OverviewEventPainter.prototype.initialize=function(B,A){this._band=B;
-this._timeline=A;
-this._eventLayer=null;
-this._highlightLayer=null;
-};
-Timeline.OverviewEventPainter.prototype.addOnSelectListener=function(A){this._onSelectListeners.push(A);
-};
-Timeline.OverviewEventPainter.prototype.removeOnSelectListener=function(B){for(var A=0;
-A<this._onSelectListeners.length;
-A++){if(this._onSelectListeners[A]==B){this._onSelectListeners.splice(A,1);
-break;
-}}};
-Timeline.OverviewEventPainter.prototype.getFilterMatcher=function(){return this._filterMatcher;
-};
-Timeline.OverviewEventPainter.prototype.setFilterMatcher=function(A){this._filterMatcher=A;
-};
-Timeline.OverviewEventPainter.prototype.getHighlightMatcher=function(){return this._highlightMatcher;
-};
-Timeline.OverviewEventPainter.prototype.setHighlightMatcher=function(A){this._highlightMatcher=A;
-};
-Timeline.OverviewEventPainter.prototype.paint=function(){var B=this._band.getEventSource();
-if(B==null){return ;
-}this._prepareForPainting();
-var H=this._params.theme.event;
-var F={trackOffset:H.overviewTrack.offset,trackHeight:H.overviewTrack.height,trackGap:H.overviewTrack.gap,trackIncrement:H.overviewTrack.height+H.overviewTrack.gap};
-var C=this._band.getMinDate();
-var A=this._band.getMaxDate();
-var I=(this._filterMatcher!=null)?this._filterMatcher:function(J){return true;
-};
-var E=(this._highlightMatcher!=null)?this._highlightMatcher:function(J){return -1;
-};
-var D=B.getEventReverseIterator(C,A);
-while(D.hasNext()){var G=D.next();
-if(I(G)){this.paintEvent(G,F,this._params.theme,E(G));
-}}this._highlightLayer.style.display="block";
-this._eventLayer.style.display="block";
-};
-Timeline.OverviewEventPainter.prototype.softPaint=function(){};
-Timeline.OverviewEventPainter.prototype._prepareForPainting=function(){var A=this._band;
-this._tracks=[];
-if(this._highlightLayer!=null){A.removeLayerDiv(this._highlightLayer);
-}this._highlightLayer=A.createLayerDiv(105,"timeline-band-highlights");
-this._highlightLayer.style.display="none";
-if(this._eventLayer!=null){A.removeLayerDiv(this._eventLayer);
-}this._eventLayer=A.createLayerDiv(110,"timeline-band-events");
-this._eventLayer.style.display="none";
-};
-Timeline.OverviewEventPainter.prototype.paintEvent=function(B,C,D,A){if(B.isInstant()){this.paintInstantEvent(B,C,D,A);
-}else{this.paintDurationEvent(B,C,D,A);
-}};
-Timeline.OverviewEventPainter.prototype.paintInstantEvent=function(C,F,G,B){var A=C.getStart();
-var H=Math.round(this._band.dateToPixelOffset(A));
-var D=C.getColor();
-D=D!=null?D:G.event.duration.color;
-var E=this._paintEventTick(C,H,D,100,F,G);
-this._createHighlightDiv(B,E,G);
-};
-Timeline.OverviewEventPainter.prototype.paintDurationEvent=function(K,J,I,D){var A=K.getLatestStart();
-var C=K.getEarliestEnd();
-var B=Math.round(this._band.dateToPixelOffset(A));
-var E=Math.round(this._band.dateToPixelOffset(C));
-var H=0;
-for(;
-H<this._tracks.length;
-H++){if(E<this._tracks[H]){break;
-}}this._tracks[H]=E;
-var G=K.getColor();
-G=G!=null?G:I.event.duration.color;
-var F=this._paintEventTape(K,H,B,E,G,100,J,I);
-this._createHighlightDiv(D,F,I);
-};
-Timeline.OverviewEventPainter.prototype._paintEventTape=function(K,B,C,J,D,F,G,E){var H=G.trackOffset+B*G.trackIncrement;
-var A=J-C;
-var L=G.trackHeight;
-var I=this._timeline.getDocument().createElement("div");
-I.className="timeline-small-event-tape";
-I.style.left=C+"px";
-I.style.width=A+"px";
-I.style.top=H+"px";
-if(F<100){SimileAjax.Graphics.setOpacity(I,F);
-}this._eventLayer.appendChild(I);
-return{left:C,top:H,width:A,height:L,elmt:I};
-};
-Timeline.OverviewEventPainter.prototype._paintEventTick=function(J,B,D,F,G,E){var K=E.event.overviewTrack.tickHeight;
-var H=G.trackOffset-K;
-var A=1;
-var I=this._timeline.getDocument().createElement("div");
-I.className="timeline-small-event-icon";
-I.style.left=B+"px";
-I.style.top=H+"px";
-var C=J.getClassName();
-if(C){I.className+=" small-"+C;
-}if(F<100){SimileAjax.Graphics.setOpacity(I,F);
-}this._eventLayer.appendChild(I);
-return{left:B,top:H,width:A,height:K,elmt:I};
-};
-Timeline.OverviewEventPainter.prototype._createHighlightDiv=function(A,C,E){if(A>=0){var D=this._timeline.getDocument();
-var G=E.event;
-var B=G.highlightColors[Math.min(A,G.highlightColors.length-1)];
-var F=D.createElement("div");
-F.style.position="absolute";
-F.style.overflow="hidden";
-F.style.left=(C.left-1)+"px";
-F.style.width=(C.width+2)+"px";
-F.style.top=(C.top-1)+"px";
-F.style.height=(C.height+2)+"px";
-F.style.background=B;
-this._highlightLayer.appendChild(F);
-}};
-Timeline.OverviewEventPainter.prototype.showBubble=function(A){};
-
-
-/* sources.js */
-Timeline.DefaultEventSource=function(A){this._events=(A instanceof Object)?A:new SimileAjax.EventIndex();
-this._listeners=[];
-};
-Timeline.DefaultEventSource.prototype.addListener=function(A){this._listeners.push(A);
-};
-Timeline.DefaultEventSource.prototype.removeListener=function(B){for(var A=0;
-A<this._listeners.length;
-A++){if(this._listeners[A]==B){this._listeners.splice(A,1);
-break;
-}}};
-Timeline.DefaultEventSource.prototype.loadXML=function(F,A){var B=this._getBaseURL(A);
-var G=F.documentElement.getAttribute("wiki-url");
-var K=F.documentElement.getAttribute("wiki-section");
-var D=F.documentElement.getAttribute("date-time-format");
-var E=this._events.getUnit().getParser(D);
-var C=F.documentElement.firstChild;
-var H=false;
-while(C!=null){if(C.nodeType==1){var J="";
-if(C.firstChild!=null&&C.firstChild.nodeType==3){J=C.firstChild.nodeValue;
-}var I=new Timeline.DefaultEventSource.Event(C.getAttribute("id"),E(C.getAttribute("start")),E(C.getAttribute("end")),E(C.getAttribute("latestStart")),E(C.getAttribute("earliestEnd")),C.getAttribute("isDuration")!="true",C.getAttribute("title"),J,this._resolveRelativeURL(C.getAttribute("image"),B),this._resolveRelativeURL(C.getAttribute("link"),B),this._resolveRelativeURL(C.getAttribute("icon"),B),C.getAttribute("color"),C.getAttribute("textColor"),C.getAttribute("classname"));
-I._node=C;
-I.getProperty=function(L){return this._node.getAttribute(L);
-};
-I.setWikiInfo(G,K);
-this._events.add(I);
-H=true;
-}C=C.nextSibling;
-}if(H){this._fire("onAddMany",[]);
-}};
-Timeline.DefaultEventSource.prototype.loadJSON=function(F,B){var C=this._getBaseURL(B);
-var I=false;
-if(F&&F.events){var H=("wikiURL" in F)?F.wikiURL:null;
-var K=("wikiSection" in F)?F.wikiSection:null;
-var D=("dateTimeFormat" in F)?F.dateTimeFormat:null;
-var G=this._events.getUnit().getParser(D);
-for(var E=0;
-E<F.events.length;
-E++){var A=F.events[E];
-var J=new Timeline.DefaultEventSource.Event(("id" in A)?A.id:undefined,G(A.start),G(A.end),G(A.latestStart),G(A.earliestEnd),A.isDuration||false,A.title,A.description,this._resolveRelativeURL(A.image,C),this._resolveRelativeURL(A.link,C),this._resolveRelativeURL(A.icon,C),A.color,A.textColor,A.classname);
-J._obj=A;
-J.getProperty=function(L){return this._obj[L];
-};
-J.setWikiInfo(H,K);
-this._events.add(J);
-I=true;
-}}if(I){this._fire("onAddMany",[]);
-}};
-Timeline.DefaultEventSource.prototype.loadSPARQL=function(G,A){var C=this._getBaseURL(A);
-var E="iso8601";
-var F=this._events.getUnit().getParser(E);
-if(G==null){return ;
-}var D=G.documentElement.firstChild;
-while(D!=null&&(D.nodeType!=1||D.nodeName!="results")){D=D.nextSibling;
-}var I=null;
-var L=null;
-if(D!=null){I=D.getAttribute("wiki-url");
-L=D.getAttribute("wiki-section");
-D=D.firstChild;
-}var J=false;
-while(D!=null){if(D.nodeType==1){var B={};
-var H=D.firstChild;
-while(H!=null){if(H.nodeType==1&&H.firstChild!=null&&H.firstChild.nodeType==1&&H.firstChild.firstChild!=null&&H.firstChild.firstChild.nodeType==3){B[H.getAttribute("name")]=H.firstChild.firstChild.nodeValue;
-}H=H.nextSibling;
-}if(B["start"]==null&&B["date"]!=null){B["start"]=B["date"];
-}var K=new Timeline.DefaultEventSource.Event(B["id"],F(B["start"]),F(B["end"]),F(B["latestStart"]),F(B["earliestEnd"]),B["isDuration"]!="true",B["title"],B["description"],this._resolveRelativeURL(B["image"],C),this._resolveRelativeURL(B["link"],C),this._resolveRelativeURL(B["icon"],C),B["color"],B["textColor"],B["classname"]);
-K._bindings=B;
-K.getProperty=function(M){return this._bindings[M];
-};
-K.setWikiInfo(I,L);
-this._events.add(K);
-J=true;
-}D=D.nextSibling;
-}if(J){this._fire("onAddMany",[]);
-}};
-Timeline.DefaultEventSource.prototype.add=function(A){this._events.add(A);
-this._fire("onAddOne",[A]);
-};
-Timeline.DefaultEventSource.prototype.addMany=function(B){for(var A=0;
-A<B.length;
-A++){this._events.add(B[A]);
-}this._fire("onAddMany",[]);
-};
-Timeline.DefaultEventSource.prototype.clear=function(){this._events.removeAll();
-this._fire("onClear",[]);
-};
-Timeline.DefaultEventSource.prototype.getEvent=function(A){return this._events.getEvent(A);
-};
-Timeline.DefaultEventSource.prototype.getEventIterator=function(A,B){return this._events.getIterator(A,B);
-};
-Timeline.DefaultEventSource.prototype.getEventReverseIterator=function(A,B){return this._events.getReverseIterator(A,B);
-};
-Timeline.DefaultEventSource.prototype.getAllEventIterator=function(){return this._events.getAllIterator();
-};
-Timeline.DefaultEventSource.prototype.getCount=function(){return this._events.getCount();
-};
-Timeline.DefaultEventSource.prototype.getEarliestDate=function(){return this._events.getEarliestDate();
-};
-Timeline.DefaultEventSource.prototype.getLatestDate=function(){return this._events.getLatestDate();
-};
-Timeline.DefaultEventSource.prototype._fire=function(B,A){for(var C=0;
-C<this._listeners.length;
-C++){var D=this._listeners[C];
-if(B in D){try{D[B].apply(D,A);
-}catch(E){SimileAjax.Debug.exception(E);
-}}}};
-Timeline.DefaultEventSource.prototype._getBaseURL=function(A){if(A.indexOf("://")<0){var C=this._getBaseURL(document.location.href);
-if(A.substr(0,1)=="/"){A=C.substr(0,C.indexOf("/",C.indexOf("://")+3))+A;
-}else{A=C+A;
-}}var B=A.lastIndexOf("/");
-if(B<0){return"";
-}else{return A.substr(0,B+1);
-}};
-Timeline.DefaultEventSource.prototype._resolveRelativeURL=function(A,B){if(A==null||A==""){return A;
-}else{if(A.indexOf("://")>0){return A;
-}else{if(A.substr(0,1)=="/"){return B.substr(0,B.indexOf("/",B.indexOf("://")+3))+A;
-}else{return B+A;
-}}}};
-Timeline.DefaultEventSource.Event=function(A,B,H,J,I,C,O,N,E,L,K,G,M,F,D){A=(A)?A.trim():"";
-this._id=A.length>0?A:("e"+Math.floor(Math.random()*1000000));
-this._instant=C||(H==null);
-this._start=B;
-this._end=(H!=null)?H:B;
-this._latestStart=(J!=null)?J:(C?this._end:this._start);
-this._earliestEnd=(I!=null)?I:(C?this._start:this._end);
-this._text=SimileAjax.HTML.deEntify(O);
-this._description=SimileAjax.HTML.deEntify(N);
-this._image=(E!=null&&E!="")?E:null;
-this._link=(L!=null&&L!="")?L:null;
-this._title=(F!=null)?F:null;
-this._icon=(K!=null&&K!="")?K:null;
-this._color=(G!=null&&G!="")?G:null;
-this._textColor=(M!=null&&M!="")?M:null;
-this._classname=(D!=null&&D!="")?D:null;
-this._wikiURL=null;
-this._wikiSection=null;
-};
-Timeline.DefaultEventSource.Event.prototype={getID:function(){return this._id;
-},isInstant:function(){return this._instant;
-},isImprecise:function(){return this._start!=this._latestStart||this._end!=this._earliestEnd;
-},getStart:function(){return this._start;
-},getEnd:function(){return this._end;
-},getLatestStart:function(){return this._latestStart;
-},getEarliestEnd:function(){return this._earliestEnd;
-},getText:function(){return this._text;
-},getDescription:function(){return this._description;
-},getImage:function(){return this._image;
-},getLink:function(){return this._link;
-},getIcon:function(){return this._icon;
-},getColor:function(){return this._color;
-},getTextColor:function(){return this._textColor;
-},getClassName:function(){return this._classname;
-},getProperty:function(A){return null;
-},getWikiURL:function(){return this._wikiURL;
-},getWikiSection:function(){return this._wikiSection;
-},setWikiInfo:function(B,A){this._wikiURL=B;
-this._wikiSection=A;
-},fillDescription:function(A){A.innerHTML=this._description;
-},fillWikiInfo:function(D){if(this._wikiURL!=null&&this._wikiSection!=null){var C=this.getProperty("wikiID");
-if(C==null||C.length==0){C=this.getText();
-}C=C.replace(/\s/g,"_");
-var B=this._wikiURL+this._wikiSection.replace(/\s/g,"_")+"/"+C;
-var A=document.createElement("a");
-A.href=B;
-A.target="new";
-A.innerHTML=Timeline.strings[Timeline.clientLocale].wikiLinkLabel;
-D.appendChild(document.createTextNode("["));
-D.appendChild(A);
-D.appendChild(document.createTextNode("]"));
-}else{D.style.display="none";
-}},fillTime:function(A,B){if(this._instant){if(this.isImprecise()){A.appendChild(A.ownerDocument.createTextNode(B.labelPrecise(this._start)));
-A.appendChild(A.ownerDocument.createElement("br"));
-A.appendChild(A.ownerDocument.createTextNode(B.labelPrecise(this._end)));
-}else{A.appendChild(A.ownerDocument.createTextNode(B.labelPrecise(this._start)));
-}}else{if(this.isImprecise()){A.appendChild(A.ownerDocument.createTextNode(B.labelPrecise(this._start)+" ~ "+B.labelPrecise(this._latestStart)));
-A.appendChild(A.ownerDocument.createElement("br"));
-A.appendChild(A.ownerDocument.createTextNode(B.labelPrecise(this._earliestEnd)+" ~ "+B.labelPrecise(this._end)));
-}else{A.appendChild(A.ownerDocument.createTextNode(B.labelPrecise(this._start)));
-A.appendChild(A.ownerDocument.createElement("br"));
-A.appendChild(A.ownerDocument.createTextNode(B.labelPrecise(this._end)));
-}}},fillInfoBubble:function(A,D,K){var L=A.ownerDocument;
-var J=this.getText();
-var H=this.getLink();
-var C=this.getImage();
-if(C!=null){var E=L.createElement("img");
-E.src=C;
-D.event.bubble.imageStyler(E);
-A.appendChild(E);
-}var M=L.createElement("div");
-var B=L.createTextNode(J);
-if(H!=null){var I=L.createElement("a");
-I.href=H;
-I.appendChild(B);
-M.appendChild(I);
-}else{M.appendChild(B);
-}D.event.bubble.titleStyler(M);
-A.appendChild(M);
-var N=L.createElement("div");
-this.fillDescription(N);
-D.event.bubble.bodyStyler(N);
-A.appendChild(N);
-var G=L.createElement("div");
-this.fillTime(G,K);
-D.event.bubble.timeStyler(G);
-A.appendChild(G);
-var F=L.createElement("div");
-this.fillWikiInfo(F);
-D.event.bubble.wikiStyler(F);
-A.appendChild(F);
-}};
-
-
-/* themes.js */
-Timeline.ClassicTheme=new Object();
-Timeline.ClassicTheme.implementations=[];
-Timeline.ClassicTheme.create=function(A){if(A==null){A=Timeline.getDefaultLocale();
-}var B=Timeline.ClassicTheme.implementations[A];
-if(B==null){B=Timeline.ClassicTheme._Impl;
-}return new B();
-};
-Timeline.ClassicTheme._Impl=function(){this.firstDayOfWeek=0;
-this.ether={backgroundColors:[],highlightOpacity:50,interval:{line:{show:true,opacity:25},weekend:{opacity:30},marker:{hAlign:"Bottom",vAlign:"Right"}}};
-this.event={track:{height:10,gap:2},overviewTrack:{offset:20,tickHeight:6,height:2,gap:1},tape:{height:4},instant:{icon:Timeline.urlPrefix+"images/dull-blue-circle.png",iconWidth:10,iconHeight:10,impreciseOpacity:20},duration:{impreciseOpacity:20},label:{backgroundOpacity:50,offsetFromLine:3},highlightColors:[],bubble:{width:250,height:125,titleStyler:function(A){A.className="timeline-event-bubble-title";
-},bodyStyler:function(A){A.className="timeline-event-bubble-body";
-},imageStyler:function(A){A.className="timeline-event-bubble-image";
-},wikiStyler:function(A){A.className="timeline-event-bubble-wiki";
-},timeStyler:function(A){A.className="timeline-event-bubble-time";
-}}};
-this.zoom=true;
-};
-
-
-/* timeline.js */
-Timeline.strings={};
-Timeline.getDefaultLocale=function(){return Timeline.clientLocale;
-};
-Timeline.create=function(C,B,A,D){return new Timeline._Impl(C,B,A,D);
-};
-Timeline.HORIZONTAL=0;
-Timeline.VERTICAL=1;
-Timeline._defaultTheme=null;
-Timeline.createBandInfo=function(D){var E=("theme" in D)?D.theme:Timeline.getDefaultTheme();
-var B=("eventSource" in D)?D.eventSource:null;
-var F=new Timeline.LinearEther({centersOn:("date" in D)?D.date:new Date(),interval:SimileAjax.DateTime.gregorianUnitLengths[D.intervalUnit],pixelsPerInterval:D.intervalPixels,theme:E});
-var G=new Timeline.GregorianEtherPainter({unit:D.intervalUnit,multiple:("multiple" in D)?D.multiple:1,theme:E,align:("align" in D)?D.align:undefined});
-var I={showText:("showEventText" in D)?D.showEventText:true,theme:E};
-if("eventPainterParams" in D){for(var A in D.eventPainterParams){I[A]=D.eventPainterParams[A];
-}}if("trackHeight" in D){I.trackHeight=D.trackHeight;
-}if("trackGap" in D){I.trackGap=D.trackGap;
-}var H=("overview" in D&&D.overview)?"overview":("layout" in D?D.layout:"original");
-var C;
-if("eventPainter" in D){C=new D.eventPainter(I);
-}else{switch(H){case"overview":C=new Timeline.OverviewEventPainter(I);
-break;
-case"detailed":C=new Timeline.DetailedEventPainter(I);
-break;
-default:C=new Timeline.OriginalEventPainter(I);
-}}return{width:D.width,eventSource:B,timeZone:("timeZone" in D)?D.timeZone:0,ether:F,etherPainter:G,eventPainter:C,theme:E,zoomIndex:("zoomIndex" in D)?D.zoomIndex:0,zoomSteps:("zoomSteps" in D)?D.zoomSteps:null};
-};
-Timeline.createHotZoneBandInfo=function(D){var E=("theme" in D)?D.theme:Timeline.getDefaultTheme();
-var B=("eventSource" in D)?D.eventSource:null;
-var F=new Timeline.HotZoneEther({centersOn:("date" in D)?D.date:new Date(),interval:SimileAjax.DateTime.gregorianUnitLengths[D.intervalUnit],pixelsPerInterval:D.intervalPixels,zones:D.zones,theme:E});
-var G=new Timeline.HotZoneGregorianEtherPainter({unit:D.intervalUnit,zones:D.zones,theme:E,align:("align" in D)?D.align:undefined});
-var I={showText:("showEventText" in D)?D.showEventText:true,theme:E};
-if("eventPainterParams" in D){for(var A in D.eventPainterParams){I[A]=D.eventPainterParams[A];
-}}if("trackHeight" in D){I.trackHeight=D.trackHeight;
-}if("trackGap" in D){I.trackGap=D.trackGap;
-}var H=("overview" in D&&D.overview)?"overview":("layout" in D?D.layout:"original");
-var C;
-if("eventPainter" in D){C=new D.eventPainter(I);
-}else{switch(H){case"overview":C=new Timeline.OverviewEventPainter(I);
-break;
-case"detailed":C=new Timeline.DetailedEventPainter(I);
-break;
-default:C=new Timeline.OriginalEventPainter(I);
-}}return{width:D.width,eventSource:B,timeZone:("timeZone" in D)?D.timeZone:0,ether:F,etherPainter:G,eventPainter:C,theme:E,zoomIndex:("zoomIndex" in D)?D.zoomIndex:0,zoomSteps:("zoomSteps" in D)?D.zoomSteps:null};
-};
-Timeline.getDefaultTheme=function(){if(Timeline._defaultTheme==null){Timeline._defaultTheme=Timeline.ClassicTheme.create(Timeline.getDefaultLocale());
-}return Timeline._defaultTheme;
-};
-Timeline.setDefaultTheme=function(A){Timeline._defaultTheme=A;
-};
-Timeline.loadXML=function(A,C){var D=function(G,E,F){alert("Failed to load data xml from "+A+"\n"+G);
-};
-var B=function(F){var E=F.responseXML;
-if(!E.documentElement&&F.responseStream){E.load(F.responseStream);
-}C(E,A);
-};
-SimileAjax.XmlHttp.get(A,D,B);
-};
-Timeline.loadJSON=function(url,f){var fError=function(statusText,status,xmlhttp){alert("Failed to load json data from "+url+"\n"+statusText);
-};
-var fDone=function(xmlhttp){f(eval("("+xmlhttp.responseText+")"),url);
-};
-SimileAjax.XmlHttp.get(url,fError,fDone);
-};
-Timeline._Impl=function(C,B,A,D){SimileAjax.WindowManager.initialize();
-this._containerDiv=C;
-this._bandInfos=B;
-this._orientation=A==null?Timeline.HORIZONTAL:A;
-this._unit=(D!=null)?D:SimileAjax.NativeDateUnit;
-this._initialize();
-};
-Timeline._Impl.prototype.dispose=function(){for(var A=0;
-A<this._bands.length;
-A++){this._bands[A].dispose();
-}this._bands=null;
-this._bandInfos=null;
-this._containerDiv.innerHTML="";
-};
-Timeline._Impl.prototype.getBandCount=function(){return this._bands.length;
-};
-Timeline._Impl.prototype.getBand=function(A){return this._bands[A];
-};
-Timeline._Impl.prototype.layout=function(){this._distributeWidths();
-};
-Timeline._Impl.prototype.paint=function(){for(var A=0;
-A<this._bands.length;
-A++){this._bands[A].paint();
-}};
-Timeline._Impl.prototype.getDocument=function(){return this._containerDiv.ownerDocument;
-};
-Timeline._Impl.prototype.addDiv=function(A){this._containerDiv.appendChild(A);
-};
-Timeline._Impl.prototype.removeDiv=function(A){this._containerDiv.removeChild(A);
-};
-Timeline._Impl.prototype.isHorizontal=function(){return this._orientation==Timeline.HORIZONTAL;
-};
-Timeline._Impl.prototype.isVertical=function(){return this._orientation==Timeline.VERTICAL;
-};
-Timeline._Impl.prototype.getPixelLength=function(){return this._orientation==Timeline.HORIZONTAL?this._containerDiv.offsetWidth:this._containerDiv.offsetHeight;
-};
-Timeline._Impl.prototype.getPixelWidth=function(){return this._orientation==Timeline.VERTICAL?this._containerDiv.offsetWidth:this._containerDiv.offsetHeight;
-};
-Timeline._Impl.prototype.getUnit=function(){return this._unit;
-};
-Timeline._Impl.prototype.loadXML=function(B,D){var A=this;
-var E=function(H,F,G){alert("Failed to load data xml from "+B+"\n"+H);
-A.hideLoadingMessage();
-};
-var C=function(G){try{var F=G.responseXML;
-if(!F.documentElement&&G.responseStream){F.load(G.responseStream);
-}D(F,B);
-}finally{A.hideLoadingMessage();
-}};
-this.showLoadingMessage();
-window.setTimeout(function(){SimileAjax.XmlHttp.get(B,E,C);
-},0);
-};
-Timeline._Impl.prototype.loadJSON=function(url,f){var tl=this;
-var fError=function(statusText,status,xmlhttp){alert("Failed to load json data from "+url+"\n"+statusText);
-tl.hideLoadingMessage();
-};
-var fDone=function(xmlhttp){try{f(eval("("+xmlhttp.responseText+")"),url);
-}finally{tl.hideLoadingMessage();
-}};
-this.showLoadingMessage();
-window.setTimeout(function(){SimileAjax.XmlHttp.get(url,fError,fDone);
-},0);
-};
-Timeline._Impl.prototype._initialize=function(){var H=this._containerDiv;
-var E=H.ownerDocument;
-H.className=H.className.split(" ").concat("timeline-container").join(" ");
-var B=(this.isHorizontal())?"horizontal":"vertical";
-H.className+=" timeline-"+B;
-while(H.firstChild){H.removeChild(H.firstChild);
-}var A=SimileAjax.Graphics.createTranslucentImage(Timeline.urlPrefix+(this.isHorizontal()?"images/copyright-vertical.png":"images/copyright.png"));
-A.className="timeline-copyright";
-A.title="Timeline (c) SIMILE - http://simile.mit.edu/timeline/";
-SimileAjax.DOM.registerEvent(A,"click",function(){window.location="http://simile.mit.edu/timeline/";
-});
-H.appendChild(A);
-this._bands=[];
-for(var C=0;
-C<this._bandInfos.length;
-C++){var G=new Timeline._Band(this,this._bandInfos[C],C);
-this._bands.push(G);
-}this._distributeWidths();
-for(var C=0;
-C<this._bandInfos.length;
-C++){var F=this._bandInfos[C];
-if("syncWith" in F){this._bands[C].setSyncWithBand(this._bands[F.syncWith],("highlight" in F)?F.highlight:false);
-}}var D=SimileAjax.Graphics.createMessageBubble(E);
-D.containerDiv.className="timeline-message-container";
-H.appendChild(D.containerDiv);
-D.contentDiv.className="timeline-message";
-D.contentDiv.innerHTML="<img src='"+Timeline.urlPrefix+"images/progress-running.gif' /> Loading...";
-this.showLoadingMessage=function(){D.containerDiv.style.display="block";
-};
-this.hideLoadingMessage=function(){D.containerDiv.style.display="none";
-};
-};
-Timeline._Impl.prototype._distributeWidths=function(){var B=this.getPixelLength();
-var A=this.getPixelWidth();
-var D=0;
-for(var E=0;
-E<this._bands.length;
-E++){var I=this._bands[E];
-var J=this._bandInfos[E];
-var F=J.width;
-var H=F.indexOf("%");
-if(H>0){var G=parseInt(F.substr(0,H));
-var C=G*A/100;
-}else{var C=parseInt(F);
-}I.setBandShiftAndWidth(D,C);
-I.setViewLength(B);
-D+=C;
-}};
-Timeline._Impl.prototype.zoom=function(G,B,F,D){var C=new RegExp("^timeline-band-([0-9]+)$");
-var E=null;
-var A=C.exec(D.id);
-if(A){E=parseInt(A[1]);
-}if(E!=null){this._bands[E].zoom(G,B,F,D);
-}this.paint();
-};
-Timeline._Band=function(E,F,B){this._timeline=E;
-this._bandInfo=F;
-this._index=B;
-this._locale=("locale" in F)?F.locale:Timeline.getDefaultLocale();
-this._timeZone=("timeZone" in F)?F.timeZone:0;
-this._labeller=("labeller" in F)?F.labeller:(("createLabeller" in E.getUnit())?E.getUnit().createLabeller(this._locale,this._timeZone):new Timeline.GregorianDateLabeller(this._locale,this._timeZone));
-this._theme=F.theme;
-this._zoomIndex=("zoomIndex" in F)?F.zoomIndex:0;
-this._zoomSteps=("zoomSteps" in F)?F.zoomSteps:null;
-this._dragging=false;
-this._changing=false;
-this._originalScrollSpeed=5;
-this._scrollSpeed=this._originalScrollSpeed;
-this._onScrollListeners=[];
-var A=this;
-this._syncWithBand=null;
-this._syncWithBandHandler=function(G){A._onHighlightBandScroll();
-};
-this._selectorListener=function(G){A._onHighlightBandScroll();
-};
-var D=this._timeline.getDocument().createElement("div");
-D.className="timeline-band-input";
-this._timeline.addDiv(D);
-this._keyboardInput=document.createElement("input");
-this._keyboardInput.type="text";
-D.appendChild(this._keyboardInput);
-SimileAjax.DOM.registerEventWithObject(this._keyboardInput,"keydown",this,"_onKeyDown");
-SimileAjax.DOM.registerEventWithObject(this._keyboardInput,"keyup",this,"_onKeyUp");
-this._div=this._timeline.getDocument().createElement("div");
-this._div.id="timeline-band-"+B;
-this._div.className="timeline-band timeline-band-"+B;
-this._timeline.addDiv(this._div);
-SimileAjax.DOM.registerEventWithObject(this._div,"mousedown",this,"_onMouseDown");
-SimileAjax.DOM.registerEventWithObject(this._div,"mousemove",this,"_onMouseMove");
-SimileAjax.DOM.registerEventWithObject(this._div,"mouseup",this,"_onMouseUp");
-SimileAjax.DOM.registerEventWithObject(this._div,"mouseout",this,"_onMouseOut");
-SimileAjax.DOM.registerEventWithObject(this._div,"dblclick",this,"_onDblClick");
-if(SimileAjax.Platform.browser.isFirefox){SimileAjax.DOM.registerEventWithObject(this._div,"DOMMouseScroll",this,"_onMouseScroll");
-}else{SimileAjax.DOM.registerEventWithObject(this._div,"mousewheel",this,"_onMouseScroll");
-}this._innerDiv=this._timeline.getDocument().createElement("div");
-this._innerDiv.className="timeline-band-inner";
-this._div.appendChild(this._innerDiv);
-this._ether=F.ether;
-F.ether.initialize(this,E);
-this._etherPainter=F.etherPainter;
-F.etherPainter.initialize(this,E);
-this._eventSource=F.eventSource;
-if(this._eventSource){this._eventListener={onAddMany:function(){A._onAddMany();
-},onClear:function(){A._onClear();
-}};
-this._eventSource.addListener(this._eventListener);
-}this._eventPainter=F.eventPainter;
-F.eventPainter.initialize(this,E);
-this._decorators=("decorators" in F)?F.decorators:[];
-for(var C=0;
-C<this._decorators.length;
-C++){this._decorators[C].initialize(this,E);
-}};
-Timeline._Band.SCROLL_MULTIPLES=5;
-Timeline._Band.prototype.dispose=function(){this.closeBubble();
-if(this._eventSource){this._eventSource.removeListener(this._eventListener);
-this._eventListener=null;
-this._eventSource=null;
-}this._timeline=null;
-this._bandInfo=null;
-this._labeller=null;
-this._ether=null;
-this._etherPainter=null;
-this._eventPainter=null;
-this._decorators=null;
-this._onScrollListeners=null;
-this._syncWithBandHandler=null;
-this._selectorListener=null;
-this._div=null;
-this._innerDiv=null;
-this._keyboardInput=null;
-};
-Timeline._Band.prototype.addOnScrollListener=function(A){this._onScrollListeners.push(A);
-};
-Timeline._Band.prototype.removeOnScrollListener=function(B){for(var A=0;
-A<this._onScrollListeners.length;
-A++){if(this._onScrollListeners[A]==B){this._onScrollListeners.splice(A,1);
-break;
-}}};
-Timeline._Band.prototype.setSyncWithBand=function(B,A){if(this._syncWithBand){this._syncWithBand.removeOnScrollListener(this._syncWithBandHandler);
-}this._syncWithBand=B;
-this._syncWithBand.addOnScrollListener(this._syncWithBandHandler);
-this._highlight=A;
-this._positionHighlight();
-};
-Timeline._Band.prototype.getLocale=function(){return this._locale;
-};
-Timeline._Band.prototype.getTimeZone=function(){return this._timeZone;
-};
-Timeline._Band.prototype.getLabeller=function(){return this._labeller;
-};
-Timeline._Band.prototype.getIndex=function(){return this._index;
-};
-Timeline._Band.prototype.getEther=function(){return this._ether;
-};
-Timeline._Band.prototype.getEtherPainter=function(){return this._etherPainter;
-};
-Timeline._Band.prototype.getEventSource=function(){return this._eventSource;
-};
-Timeline._Band.prototype.getEventPainter=function(){return this._eventPainter;
-};
-Timeline._Band.prototype.layout=function(){this.paint();
-};
-Timeline._Band.prototype.paint=function(){this._etherPainter.paint();
-this._paintDecorators();
-this._paintEvents();
-};
-Timeline._Band.prototype.softLayout=function(){this.softPaint();
-};
-Timeline._Band.prototype.softPaint=function(){this._etherPainter.softPaint();
-this._softPaintDecorators();
-this._softPaintEvents();
-};
-Timeline._Band.prototype.setBandShiftAndWidth=function(A,D){var C=this._keyboardInput.parentNode;
-var B=A+Math.floor(D/2);
-if(this._timeline.isHorizontal()){this._div.style.top=A+"px";
-this._div.style.height=D+"px";
-C.style.top=B+"px";
-C.style.left="-1em";
-}else{this._div.style.left=A+"px";
-this._div.style.width=D+"px";
-C.style.left=B+"px";
-C.style.top="-1em";
-}};
-Timeline._Band.prototype.getViewWidth=function(){if(this._timeline.isHorizontal()){return this._div.offsetHeight;
-}else{return this._div.offsetWidth;
-}};
-Timeline._Band.prototype.setViewLength=function(A){this._viewLength=A;
-this._recenterDiv();
-this._onChanging();
-};
-Timeline._Band.prototype.getViewLength=function(){return this._viewLength;
-};
-Timeline._Band.prototype.getTotalViewLength=function(){return Timeline._Band.SCROLL_MULTIPLES*this._viewLength;
-};
-Timeline._Band.prototype.getViewOffset=function(){return this._viewOffset;
-};
-Timeline._Band.prototype.getMinDate=function(){return this._ether.pixelOffsetToDate(this._viewOffset);
-};
-Timeline._Band.prototype.getMaxDate=function(){return this._ether.pixelOffsetToDate(this._viewOffset+Timeline._Band.SCROLL_MULTIPLES*this._viewLength);
-};
-Timeline._Band.prototype.getMinVisibleDate=function(){return this._ether.pixelOffsetToDate(0);
-};
-Timeline._Band.prototype.getMaxVisibleDate=function(){return this._ether.pixelOffsetToDate(this._viewLength);
-};
-Timeline._Band.prototype.getCenterVisibleDate=function(){return this._ether.pixelOffsetToDate(this._viewLength/2);
-};
-Timeline._Band.prototype.setMinVisibleDate=function(A){if(!this._changing){this._moveEther(Math.round(-this._ether.dateToPixelOffset(A)));
-}};
-Timeline._Band.prototype.setMaxVisibleDate=function(A){if(!this._changing){this._moveEther(Math.round(this._viewLength-this._ether.dateToPixelOffset(A)));
-}};
-Timeline._Band.prototype.setCenterVisibleDate=function(A){if(!this._changing){this._moveEther(Math.round(this._viewLength/2-this._ether.dateToPixelOffset(A)));
-}};
-Timeline._Band.prototype.dateToPixelOffset=function(A){return this._ether.dateToPixelOffset(A)-this._viewOffset;
-};
-Timeline._Band.prototype.pixelOffsetToDate=function(A){return this._ether.pixelOffsetToDate(A+this._viewOffset);
-};
-Timeline._Band.prototype.createLayerDiv=function(D,B){var C=this._timeline.getDocument().createElement("div");
-C.className="timeline-band-layer"+(typeof B=="string"?(" "+B):"");
-C.style.zIndex=D;
-this._innerDiv.appendChild(C);
-var A=this._timeline.getDocument().createElement("div");
-A.className="timeline-band-layer-inner";
-if(SimileAjax.Platform.browser.isIE){A.style.cursor="move";
-}else{A.style.cursor="-moz-grab";
-}C.appendChild(A);
-return A;
-};
-Timeline._Band.prototype.removeLayerDiv=function(A){this._innerDiv.removeChild(A.parentNode);
-};
-Timeline._Band.prototype.scrollToCenter=function(B,C){var A=this._ether.dateToPixelOffset(B);
-if(A<-this._viewLength/2){this.setCenterVisibleDate(this.pixelOffsetToDate(A+this._viewLength));
-}else{if(A>3*this._viewLength/2){this.setCenterVisibleDate(this.pixelOffsetToDate(A-this._viewLength));
-}}this._autoScroll(Math.round(this._viewLength/2-this._ether.dateToPixelOffset(B)),C);
-};
-Timeline._Band.prototype.showBubbleForEvent=function(C){var A=this.getEventSource().getEvent(C);
-if(A){var B=this;
-this.scrollToCenter(A.getStart(),function(){B._eventPainter.showBubble(A);
-});
-}};
-Timeline._Band.prototype.zoom=function(F,A,E,C){if(!this._theme.zoom||!this._zoomSteps){return ;
-}A+=this._viewOffset;
-var D=this._ether.pixelOffsetToDate(A);
-var B=this._ether.zoom(F);
-this._etherPainter.zoom(B);
-this._moveEther(Math.round(-this._ether.dateToPixelOffset(D)));
-this._moveEther(A);
-};
-Timeline._Band.prototype._onMouseDown=function(B,A,C){this.closeBubble();
-this._dragging=true;
-this._dragX=A.clientX;
-this._dragY=A.clientY;
-};
-Timeline._Band.prototype._onMouseMove=function(D,A,E){if(this._dragging){var C=A.clientX-this._dragX;
-var B=A.clientY-this._dragY;
-this._dragX=A.clientX;
-this._dragY=A.clientY;
-this._moveEther(this._timeline.isHorizontal()?C:B);
-this._positionHighlight();
-}};
-Timeline._Band.prototype._onMouseUp=function(B,A,C){this._dragging=false;
-this._keyboardInput.focus();
-};
-Timeline._Band.prototype._onMouseOut=function(B,A,D){var C=SimileAjax.DOM.getEventRelativeCoordinates(A,B);
-C.x+=this._viewOffset;
-if(C.x<0||C.x>B.offsetWidth||C.y<0||C.y>B.offsetHeight){this._dragging=false;
-}};
-Timeline._Band.prototype._onMouseScroll=function(C,A,D){var B=new Date();
-B=B.getTime();
-if(!this._lastScrollTime||((B-this._lastScrollTime)>50)){this._lastScrollTime=B;
-var G=0;
-if(A.wheelDelta){G=A.wheelDelta/120;
-}else{if(A.detail){G=-A.detail/3;
-}}var E=SimileAjax.DOM.getEventRelativeCoordinates(A,C);
-if(G!=0){var F;
-if(G>0){F=true;
-}if(G<0){F=false;
-}this._timeline.zoom(F,E.x,E.y,C);
-}}if(A.stopPropagation){A.stopPropagation();
-}A.cancelBubble=true;
-if(A.preventDefault){A.preventDefault();
-}A.returnValue=false;
-};
-Timeline._Band.prototype._onDblClick=function(B,A,D){var C=SimileAjax.DOM.getEventRelativeCoordinates(A,B);
-var E=C.x-(this._viewLength/2-this._viewOffset);
-this._autoScroll(-E);
-};
-Timeline._Band.prototype._onKeyDown=function(B,A,C){if(!this._dragging){switch(A.keyCode){case 27:break;
-case 37:case 38:this._scrollSpeed=Math.min(50,Math.abs(this._scrollSpeed*1.05));
-this._moveEther(this._scrollSpeed);
-break;
-case 39:case 40:this._scrollSpeed=-Math.min(50,Math.abs(this._scrollSpeed*1.05));
-this._moveEther(this._scrollSpeed);
-break;
-default:return true;
-}this.closeBubble();
-SimileAjax.DOM.cancelEvent(A);
-return false;
-}return true;
-};
-Timeline._Band.prototype._onKeyUp=function(B,A,C){if(!this._dragging){this._scrollSpeed=this._originalScrollSpeed;
-switch(A.keyCode){case 35:this.setCenterVisibleDate(this._eventSource.getLatestDate());
-break;
-case 36:this.setCenterVisibleDate(this._eventSource.getEarliestDate());
-break;
-case 33:this._autoScroll(this._timeline.getPixelLength());
-break;
-case 34:this._autoScroll(-this._timeline.getPixelLength());
-break;
-default:return true;
-}this.closeBubble();
-SimileAjax.DOM.cancelEvent(A);
-return false;
-}return true;
-};
-Timeline._Band.prototype._autoScroll=function(D,C){var A=this;
-var B=SimileAjax.Graphics.createAnimation(function(E,F){A._moveEther(F);
-},0,D,1000,C);
-B.run();
-};
-Timeline._Band.prototype._moveEther=function(A){this.closeBubble();
-this._viewOffset+=A;
-this._ether.shiftPixels(-A);
-if(this._timeline.isHorizontal()){this._div.style.left=this._viewOffset+"px";
-}else{this._div.style.top=this._viewOffset+"px";
-}if(this._viewOffset>-this._viewLength*0.5||this._viewOffset<-this._viewLength*(Timeline._Band.SCROLL_MULTIPLES-1.5)){this._recenterDiv();
-}else{this.softLayout();
-}this._onChanging();
-};
-Timeline._Band.prototype._onChanging=function(){this._changing=true;
-this._fireOnScroll();
-this._setSyncWithBandDate();
-this._changing=false;
-};
-Timeline._Band.prototype._fireOnScroll=function(){for(var A=0;
-A<this._onScrollListeners.length;
-A++){this._onScrollListeners[A](this);
-}};
-Timeline._Band.prototype._setSyncWithBandDate=function(){if(this._syncWithBand){var A=this._ether.pixelOffsetToDate(this.getViewLength()/2);
-this._syncWithBand.setCenterVisibleDate(A);
-}};
-Timeline._Band.prototype._onHighlightBandScroll=function(){if(this._syncWithBand){var A=this._syncWithBand.getCenterVisibleDate();
-var B=this._ether.dateToPixelOffset(A);
-this._moveEther(Math.round(this._viewLength/2-B));
-if(this._highlight){this._etherPainter.setHighlight(this._syncWithBand.getMinVisibleDate(),this._syncWithBand.getMaxVisibleDate());
-}}};
-Timeline._Band.prototype._onAddMany=function(){this._paintEvents();
-};
-Timeline._Band.prototype._onClear=function(){this._paintEvents();
-};
-Timeline._Band.prototype._positionHighlight=function(){if(this._syncWithBand){var A=this._syncWithBand.getMinVisibleDate();
-var B=this._syncWithBand.getMaxVisibleDate();
-if(this._highlight){this._etherPainter.setHighlight(A,B);
-}}};
-Timeline._Band.prototype._recenterDiv=function(){this._viewOffset=-this._viewLength*(Timeline._Band.SCROLL_MULTIPLES-1)/2;
-if(this._timeline.isHorizontal()){this._div.style.left=this._viewOffset+"px";
-this._div.style.width=(Timeline._Band.SCROLL_MULTIPLES*this._viewLength)+"px";
-}else{this._div.style.top=this._viewOffset+"px";
-this._div.style.height=(Timeline._Band.SCROLL_MULTIPLES*this._viewLength)+"px";
-}this.layout();
-};
-Timeline._Band.prototype._paintEvents=function(){this._eventPainter.paint();
-};
-Timeline._Band.prototype._softPaintEvents=function(){this._eventPainter.softPaint();
-};
-Timeline._Band.prototype._paintDecorators=function(){for(var A=0;
-A<this._decorators.length;
-A++){this._decorators[A].paint();
-}};
-Timeline._Band.prototype._softPaintDecorators=function(){for(var A=0;
-A<this._decorators.length;
-A++){this._decorators[A].softPaint();
-}};
-Timeline._Band.prototype.closeBubble=function(){SimileAjax.WindowManager.cancelPopups();
-};
-
-
-/* units.js */
-Timeline.NativeDateUnit=new Object();
-Timeline.NativeDateUnit.createLabeller=function(A,B){return new Timeline.GregorianDateLabeller(A,B);
-};
-Timeline.NativeDateUnit.makeDefaultValue=function(){return new Date();
-};
-Timeline.NativeDateUnit.cloneValue=function(A){return new Date(A.getTime());
-};
-Timeline.NativeDateUnit.getParser=function(A){if(typeof A=="string"){A=A.toLowerCase();
-}return(A=="iso8601"||A=="iso 8601")?Timeline.DateTime.parseIso8601DateTime:Timeline.DateTime.parseGregorianDateTime;
-};
-Timeline.NativeDateUnit.parseFromObject=function(A){return Timeline.DateTime.parseGregorianDateTime(A);
-};
-Timeline.NativeDateUnit.toNumber=function(A){return A.getTime();
-};
-Timeline.NativeDateUnit.fromNumber=function(A){return new Date(A);
-};
-Timeline.NativeDateUnit.compare=function(D,C){var B,A;
-if(typeof D=="object"){B=D.getTime();
-}else{B=Number(D);
-}if(typeof C=="object"){A=C.getTime();
-}else{A=Number(C);
-}return B-A;
-};
-Timeline.NativeDateUnit.earlier=function(B,A){return Timeline.NativeDateUnit.compare(B,A)<0?B:A;
-};
-Timeline.NativeDateUnit.later=function(B,A){return Timeline.NativeDateUnit.compare(B,A)>0?B:A;
-};
-Timeline.NativeDateUnit.change=function(A,B){return new Date(A.getTime()+B);
-};
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/examples/examples.js b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/examples/examples.js
deleted file mode 100644
index c3b4eee..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/examples/examples.js
+++ /dev/null
@@ -1,123 +0,0 @@
-function centerSimileAjax(date) {
- tl.getBand(0).setCenterVisibleDate(SimileAjax.DateTime.parseGregorianDateTime(date));
-}
-
-function setupFilterHighlightControls(div, timeline, bandIndices, theme) {
- var table = document.createElement("table");
- var tr = table.insertRow(0);
-
- var td = tr.insertCell(0);
- td.innerHTML = "Filter:";
-
- td = tr.insertCell(1);
- td.innerHTML = "Highlight:";
-
- var handler = function(elmt, evt, target) {
- onKeyPress(timeline, bandIndices, table);
- };
-
- tr = table.insertRow(1);
- tr.style.verticalAlign = "top";
-
- td = tr.insertCell(0);
-
- var input = document.createElement("input");
- input.type = "text";
- SimileAjax.DOM.registerEvent(input, "keypress", handler);
- td.appendChild(input);
-
- for (var i = 0; i < theme.event.highlightColors.length; i++) {
- td = tr.insertCell(i + 1);
-
- input = document.createElement("input");
- input.type = "text";
- SimileAjax.DOM.registerEvent(input, "keypress", handler);
- td.appendChild(input);
-
- var divColor = document.createElement("div");
- divColor.style.height = "0.5em";
- divColor.style.background = theme.event.highlightColors[i];
- td.appendChild(divColor);
- }
-
- td = tr.insertCell(tr.cells.length);
- var button = document.createElement("button");
- button.innerHTML = "Clear All";
- SimileAjax.DOM.registerEvent(button, "click", function() {
- clearAll(timeline, bandIndices, table);
- });
- td.appendChild(button);
-
- div.appendChild(table);
-}
-
-var timerID = null;
-function onKeyPress(timeline, bandIndices, table) {
- if (timerID != null) {
- window.clearTimeout(timerID);
- }
- timerID = window.setTimeout(function() {
- performFiltering(timeline, bandIndices, table);
- }, 300);
-}
-function cleanString(s) {
- return s.replace(/^\s+/, '').replace(/\s+$/, '');
-}
-function performFiltering(timeline, bandIndices, table) {
- timerID = null;
-
- var tr = table.rows[1];
- var text = cleanString(tr.cells[0].firstChild.value);
-
- var filterMatcher = null;
- if (text.length > 0) {
- var regex = new RegExp(text, "i");
- filterMatcher = function(evt) {
- return regex.test(evt.getText()) || regex.test(evt.getDescription());
- };
- }
-
- var regexes = [];
- var hasHighlights = false;
- for (var x = 1; x < tr.cells.length - 1; x++) {
- var input = tr.cells[x].firstChild;
- var text2 = cleanString(input.value);
- if (text2.length > 0) {
- hasHighlights = true;
- regexes.push(new RegExp(text2, "i"));
- } else {
- regexes.push(null);
- }
- }
- var highlightMatcher = hasHighlights ? function(evt) {
- var text = evt.getText();
- var description = evt.getDescription();
- for (var x = 0; x < regexes.length; x++) {
- var regex = regexes[x];
- if (regex != null && (regex.test(text) || regex.test(description))) {
- return x;
- }
- }
- return -1;
- } : null;
-
- for (var i = 0; i < bandIndices.length; i++) {
- var bandIndex = bandIndices[i];
- timeline.getBand(bandIndex).getEventPainter().setFilterMatcher(filterMatcher);
- timeline.getBand(bandIndex).getEventPainter().setHighlightMatcher(highlightMatcher);
- }
- timeline.paint();
-}
-function clearAll(timeline, bandIndices, table) {
- var tr = table.rows[1];
- for (var x = 0; x < tr.cells.length - 1; x++) {
- tr.cells[x].firstChild.value = "";
- }
-
- for (var i = 0; i < bandIndices.length; i++) {
- var bandIndex = bandIndices[i];
- timeline.getBand(bandIndex).getEventPainter().setFilterMatcher(null);
- timeline.getBand(bandIndex).getEventPainter().setHighlightMatcher(null);
- }
- timeline.paint();
-}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/examples/styles.css b/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/examples/styles.css
deleted file mode 100644
index 55fe432..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/js/timeline/examples/styles.css
+++ /dev/null
@@ -1,11 +0,0 @@
-@import url("../styles.css");
-
-.footnotes {
- background: #eee;
- padding: 0.25em;
-}
-
-.controls {
- margin: 1em 0;
- padding: 0.5em;
-}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventsView.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventsView.jsp
index 85f8696..34e003e 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventsView.jsp
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventsView.jsp
@@ -21,12 +21,9 @@
<head>
<base target="_top"/>
- <script type="text/javascript">
- SimileAjax_urlPrefix = "/js/timeline/ajax/api/";
- </script>
- <script src="/js/timeline/ajax/api/simile-ajax-api.js" type="text/javascript"></script>
- <script src="/js/timeline/api/timeline-api.js" type="text/javascript"></script>
- <script src="/js/timeline/examples/examples.js" type="text/javascript"></script>
+ <script src="/js/timeline/timeline_ajax/simile-ajax-api.js?bundle=true" type="text/javascript"></script>
+ <script src="/js/timeline/timeline_js/timeline-api.js?bundle=true" type="text/javascript"></script>
+
<title>Simple jsp page</title>
<style type="text/css">
@@ -80,13 +77,13 @@
<input type="checkbox" name="content" checked="checked" onchange="onLoad()" id="contentField"/>
<label for="contentField"><img src="/images/icons/Content_grey_16.png"/> Content Changes</label>
</form>
+
<script type="text/javascript">
var tl;
function onLoad() {
-
var begin = <%= begin%>;
var end = <%= end%>;
@@ -98,7 +95,7 @@ function onLoad() {
var eventSource = new Timeline.DefaultEventSource();
- var theme = Timeline.ClassicTheme.create();
+ var theme = Timeline.ClassicTheme.create();
theme.event.bubble.width = 650;
theme.event.bubble.height = 320;
theme.event.label.width = 200;
commit f16bdbf5308b56eb3b16876450c1a388e462fae8
Merge: d8819bc... b751ba0...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Mar 9 12:00:29 2010 -0500
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
commit d8819bcbc5e356e5899987c1da295da5a621f876
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Mar 9 12:00:15 2010 -0500
more bundle wizard stuff
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java
index 17daba8..62e5691 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java
@@ -34,17 +34,17 @@ import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardView;
public class BundleCreationWizard implements Wizard {
private ArrayList<WizardStep> steps;
-
private WizardView view;
+ private String subtitle = "";
public BundleCreationWizard() {
steps = new ArrayList<WizardStep>();
- steps.add(new BundleInfoStep());
- steps.add(new BundleUploadRecipeStep());
- steps.add(new BundleUploadDataStep());
- steps.add(new BundleVerificationStep());
+ steps.add(new BundleInfoStep(this));
+ steps.add(new BundleUploadRecipeStep(this));
+ steps.add(new BundleUploadDataStep(this));
+ steps.add(new BundleVerificationStep(this));
}
@@ -57,7 +57,12 @@ public class BundleCreationWizard implements Wizard {
}
public String getSubtitle() {
- return "";
+ return subtitle;
+ }
+
+ public void setSubtitle(String subtitle) {
+ this.subtitle = subtitle;
+ this.view.refreshTitleLabelContents();
}
public List<WizardStep> getSteps() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
index e3e65ed..e25bdda 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
@@ -23,6 +23,8 @@ import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.FormItem;
import com.smartgwt.client.widgets.form.fields.TextAreaItem;
import com.smartgwt.client.widgets.form.fields.TextItem;
+import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
+import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
@@ -32,6 +34,11 @@ import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
public class BundleInfoStep implements WizardStep {
private DynamicForm form;
+ private final BundleCreationWizard wizard;
+
+ public BundleInfoStep(BundleCreationWizard bundleCreationWizard) {
+ this.wizard = bundleCreationWizard;
+ }
public Canvas getCanvas() {
if (form == null) {
@@ -41,6 +48,12 @@ public class BundleInfoStep implements WizardStep {
form.setColWidths("50%", "*");
final TextItem nameTextItem = new TextItem("name", "Name");
+ nameTextItem.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent event) {
+ wizard.setSubtitle(event.getValue().toString());
+ }
+ });
+
final TextItem versionTextItem = new TextItem("version", "Initial Version");
versionTextItem.setValue("1.0");
final TextAreaItem descriptionTextAreaItem = new TextAreaItem("description", "Description");
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
index 26e77af..6ae2579 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
@@ -18,22 +18,28 @@
*/
package org.rhq.enterprise.gui.coregui.client.bundle.create;
-import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
-
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.Label;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+
/**
* @author Greg Hinkle
*/
public class BundleUploadDataStep implements WizardStep {
+ private final BundleCreationWizard wizard;
+
+ public BundleUploadDataStep(BundleCreationWizard bundleCreationWizard) {
+ this.wizard = bundleCreationWizard;
+ }
+
public Canvas getCanvas() {
return new Label("Todo: implement me");
}
public boolean valid() {
- return false; // TODO: Implement this method.
+ return false; // TODO: Implement this method.
}
public String getName() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
index b67aa7e..497aebd 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
@@ -34,6 +34,11 @@ import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
public class BundleUploadRecipeStep implements WizardStep {
private DynamicForm form;
+ private final BundleCreationWizard wizard;
+
+ public BundleUploadRecipeStep(BundleCreationWizard bundleCreationWizard) {
+ this.wizard = bundleCreationWizard;
+ }
public Canvas getCanvas() {
if (form == null) {
@@ -42,27 +47,37 @@ public class BundleUploadRecipeStep implements WizardStep {
form.setNumCols(2);
form.setColWidths("50%", "*");
+ final String uploadRecipeString = "Upload Recipe";
+ final String writeRecipeString = "Write Recipe";
+
final RadioGroupItem radioGroupItem = new RadioGroupItem("reciperadio");
radioGroupItem.setTitle("");
- radioGroupItem.setValueMap("Upload Recipe", "Write Recipe");
+ radioGroupItem.setValueMap(uploadRecipeString, writeRecipeString);
+ radioGroupItem.setRedrawOnChange(true);
final TextItem recipeFileUploadItem = new TextItem("recipefile", "Recipe File");
recipeFileUploadItem.setVisible(false);
-
- final TextAreaItem recipeTextAreaItem = new TextAreaItem("recipetext", "Recipe Text");
- recipeTextAreaItem.setVisible(false);
-
recipeFileUploadItem.setShowIfCondition(new FormItemIfFunction() {
public boolean execute(FormItem item, Object value, DynamicForm form) {
- System.out.println("!!!!!!!!!!!!!!" + form.getValues());
- return (((RadioGroupItem) form.getValue("reciperadio")).getValue().equals("recipefile"));
+ String radioSelect = form.getValueAsString("reciperadio");
+ if (radioSelect != null) {
+ return radioSelect.equals(uploadRecipeString);
+ } else {
+ return false;
+ }
}
});
+ final TextAreaItem recipeTextAreaItem = new TextAreaItem("recipetext", "Recipe Text");
+ recipeTextAreaItem.setVisible(false);
recipeTextAreaItem.setShowIfCondition(new FormItemIfFunction() {
public boolean execute(FormItem item, Object value, DynamicForm form) {
- System.out.println("!!!!!!!!!!!!!!" + form.getValues());
- return (((RadioGroupItem) form.getValue("reciperadio")).getValue().equals("recipetext"));
+ String radioSelect = form.getValueAsString("reciperadio");
+ if (radioSelect != null) {
+ return radioSelect.equals(writeRecipeString);
+ } else {
+ return false;
+ }
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java
index 086491d..02df491 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java
@@ -18,22 +18,28 @@
*/
package org.rhq.enterprise.gui.coregui.client.bundle.create;
-import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
-
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.Label;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+
/**
* @author Greg Hinkle
*/
public class BundleVerificationStep implements WizardStep {
+ private final BundleCreationWizard wizard;
+
+ public BundleVerificationStep(BundleCreationWizard bundleCreationWizard) {
+ this.wizard = bundleCreationWizard;
+ }
+
public Canvas getCanvas() {
return new Label("Todo: implement me");
}
public boolean valid() {
- return false; // TODO: Implement this method.
+ return false; // TODO: Implement this method.
}
public String getName() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
index 7d1c9cb..61dc533 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
@@ -70,8 +70,8 @@ public class WizardView extends VLayout {
titleBar = new HLayout(30);
titleBar.setHeight(50);
titleBar.setBackgroundColor("#F0F0F0");
- titleLabel = new HTMLFlow("<span class=\"HeaderLabel\">" + wizard.getTitle() + "</span><br/>"
- + wizard.getSubtitle());
+ titleLabel = new HTMLFlow();
+ refreshTitleLabelContents();
titleLabel.setWidth("*");
stepLabel = new Label();
@@ -106,6 +106,15 @@ public class WizardView extends VLayout {
setStep(0);
}
+ /**
+ * You can call this if you ever change the wizard's title or subtitle and you want to see it
+ * reflected in the wizard UI.
+ */
+ public void refreshTitleLabelContents() {
+ this.titleLabel.setContents("<span class=\"HeaderLabel\">" + wizard.getTitle() + "</span><br/>"
+ + wizard.getSubtitle());
+ }
+
private void setupButtons() {
cancelButton = new IButton("Cancel");
cancelButton.addClickHandler(new ClickHandler() {
commit b751ba029f7bc2aaa3fcb081b0b3a164f25d82b1
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Mar 9 11:17:56 2010 -0500
Some tweaks to the scheduling interface
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java
index 77f73b0..b1a4a10 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java
@@ -18,9 +18,9 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.create;
-import org.rhq.enterprise.gui.coregui.client.components.wizard.Wizard;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+import com.smartgwt.client.types.FormErrorOrientation;
import com.smartgwt.client.types.TimeFormatter;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.form.DynamicForm;
@@ -28,10 +28,15 @@ import com.smartgwt.client.widgets.form.FormItemIfFunction;
import com.smartgwt.client.widgets.form.fields.CanvasItem;
import com.smartgwt.client.widgets.form.fields.CheckboxItem;
import com.smartgwt.client.widgets.form.fields.DateItem;
-import com.smartgwt.client.widgets.form.fields.DateTimeItem;
import com.smartgwt.client.widgets.form.fields.FormItem;
+import com.smartgwt.client.widgets.form.fields.HeaderItem;
+import com.smartgwt.client.widgets.form.fields.IntegerItem;
import com.smartgwt.client.widgets.form.fields.RadioGroupItem;
import com.smartgwt.client.widgets.form.fields.TimeItem;
+import com.smartgwt.client.widgets.form.validator.CustomValidator;
+import com.smartgwt.client.widgets.form.validator.DateRangeValidator;
+
+import java.util.Date;
/**
* @author Greg Hinkle
@@ -44,9 +49,12 @@ public class OperationSchedulingStep implements WizardStep {
if (form == null) {
form = new DynamicForm();
+ form.setWrapItemTitles(false);
+ form.setErrorOrientation(FormErrorOrientation.RIGHT);
form.setWidth100();
form.setNumCols(4);
- form.setColWidths("10%", "25%", "10%", "*");
+ form.setColWidths("15%", "35%", "15%", "*");
+ form.setValidateOnChange(true);
final RadioGroupItem start = new RadioGroupItem("start", "Start");
start.setColSpan(3);
@@ -54,72 +62,162 @@ public class OperationSchedulingStep implements WizardStep {
start.setRedrawOnChange(true);
start.setValue("Immediately");
- DateItem startDate = new DateItem("startDate", "Start Date");
- startDate.setShowIfCondition(new FormItemIfFunction() {
- public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !"Immediately".equals(form.getValueAsString("start"));
- }
- });
- TimeItem startTime = new TimeItem("startTime", "Start Time");
- startTime.setDisplayFormat(TimeFormatter.TOSHORTPADDEDTIME);
- startTime.setUseMask(true);
- startTime.setShowIfCondition(new FormItemIfFunction() {
+
+ HeaderItem scheduleHeader = new HeaderItem("scheduleHeader");
+ scheduleHeader.setValue("Schedule");
+ scheduleHeader.setShowIfCondition(new FormItemIfFunction() {
public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
return !"Immediately".equals(form.getValueAsString("start"));
}
});
+
RadioGroupItem recurr = new RadioGroupItem("recurr", "Recurrence");
- recurr.setValueMap("None", "Daily", "Weekly", "Monthly", "Yearly");
+ recurr.setValueMap("Once", "Daily", "Weekly", "Monthly");
recurr.setRedrawOnChange(true);
- recurr.setValue("None");
+ recurr.setValue("Once");
recurr.setShowIfCondition(new FormItemIfFunction() {
public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
return !"Immediately".equals(form.getValueAsString("start"));
}
});
- CanvasItem daysItem = new CanvasItem("days", "Days");
- daysItem.setCanvas(getDaysForm());
- daysItem.setShowIfCondition(new FormItemIfFunction() {
+
+
+
+
+ CanvasItem onceItem = new CanvasItem("once", "Run At");
+ onceItem.setShowTitle(false);
+ onceItem.setCanvas(getOnceForm());
+ onceItem.setShowIfCondition(new FormItemIfFunction() {
+ public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
+ return !"Immediately".equals(form.getValueAsString("start")) &&
+ "Once".equals(form.getValueAsString("recurr"));
+ }
+ });
+
+
+ CanvasItem dailyItem = new CanvasItem("daily", "Days");
+ dailyItem.setShowTitle(false);
+ dailyItem.setCanvas(getDailyForm());
+ dailyItem.setShowIfCondition(new FormItemIfFunction() {
+ public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
+ return !"Immediately".equals(form.getValueAsString("start")) &&
+ "Daily".equals(form.getValueAsString("recurr"));
+ }
+ });
+
+
+ CanvasItem weeklyItem = new CanvasItem("weekly", "Weekly");
+ weeklyItem.setShowTitle(false);
+ weeklyItem.setCanvas(getWeeklyForm());
+ weeklyItem.setShowIfCondition(new FormItemIfFunction() {
+ public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
+ return !"Immediately".equals(form.getValueAsString("start")) &&
+ "Weekly".equals(form.getValueAsString("recurr"));
+ }
+ });
+
+ CanvasItem monthlyItem = new CanvasItem("monthly", "Monthly");
+ monthlyItem.setShowTitle(false);
+ monthlyItem.setCanvas(getMonthlyForm());
+ monthlyItem.setShowIfCondition(new FormItemIfFunction() {
+ public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
+ return !"Immediately".equals(form.getValueAsString("start")) &&
+ "Monthly".equals(form.getValueAsString("recurr"));
+ }
+ });
+
+
+
+
+ HeaderItem rangeHeader = new HeaderItem("timePeriod");
+ rangeHeader.setValue("Time Period");
+ rangeHeader.setShowIfCondition(new FormItemIfFunction() {
+ public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
+ return !"Immediately".equals(form.getValueAsString("start")) &&
+ !"Once".equals(form.getValueAsString("recurr"));
+ }
+ });
+
+ DateItem startDate = new DateItem("startDate", "Start Date");
+ startDate.setStartRow(true);
+ startDate.setStartDate(new Date());
+ startDate.setShowIfCondition(new FormItemIfFunction() {
public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return "Weekly".equals(form.getValueAsString("recurr"));
+ return !"Immediately".equals(form.getValueAsString("start")) &&
+ !"Once".equals(form.getValueAsString("recurr"));
}
});
- DateTimeItem endDate = new DateTimeItem("endDate", "End Date");
+
+ final RadioGroupItem end = new RadioGroupItem("endType", "Recurrence End");
+ end.setShowIfCondition(new FormItemIfFunction() {
+ public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
+ return !"Immediately".equals(form.getValueAsString("start")) &&
+ !"Once".equals(form.getValueAsString("recurr"));
+ }
+ });
+ end.setStartRow(true);
+ end.setValueMap("Never", "End On");
+ end.setRedrawOnChange(true);
+ end.setValue("Never");
+
+ DateItem endDate = new DateItem("endDate", "End Date");
endDate.setStartRow(true);
+ endDate.setStartDate(new Date());
endDate.setShowIfCondition(new FormItemIfFunction() {
public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !"None".equals(form.getValueAsString("recurr"));
+ return !"Immediately".equals(form.getValueAsString("start")) &&
+ !"Once".equals(form.getValueAsString("recurr")) &&
+ !"Never".equals(form.getValueAsString("endType"));
}
});
- TimeItem endTime = new TimeItem("endTime", "End Time");
- endTime.setDisplayFormat(TimeFormatter.TOSHORTPADDEDTIME);
- endTime.setUseMask(true);
- endTime.setShowIfCondition(new FormItemIfFunction() {
- public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !"None".equals(form.getValueAsString("recurr"));
+ endDate.setValidators(new CustomValidator() {
+ @Override
+ protected boolean condition(Object o) {
+ return (((Date)form.getValue("startDate")).before((Date)o));
}
});
- form.setItems(start, startDate, startTime, recurr, daysItem, endDate, endTime);
+ form.setItems(start, scheduleHeader, recurr, onceItem, dailyItem, weeklyItem, monthlyItem, rangeHeader, startDate, end, endDate);
}
return form;
}
- private DynamicForm getDaysForm() {
+ private DynamicForm getOnceForm() {
DynamicForm form = new DynamicForm();
+ form.setWrapItemTitles(false);
form.setNumCols(2);
+
+ DateItem startDate = new DateItem("startDate", "Date");
+
+ TimeItem startTime = new TimeItem("startTime", "Time");
+ startTime.setDisplayFormat(TimeFormatter.TOSHORTPADDEDTIME);
+ startTime.setUseMask(true);
+ form.setItems(startDate, startTime);
+ return form;
+ }
+
+
+ private DynamicForm getWeeklyForm() {
+ DynamicForm form = new DynamicForm();
+ form.setWrapItemTitles(false);
+
+ TimeItem timeOfDay = new TimeItem("timeOfDay", "Time Of Day");
+ timeOfDay.setDisplayFormat(TimeFormatter.TOSHORTPADDEDTIME);
+ timeOfDay.setUseMask(true);
+
String[] days = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
- FormItem[] items = new FormItem[7];
- int i = 0;
+ FormItem[] items = new FormItem[8];
+ items[0] = timeOfDay;
+ int i = 1;
for (String day : days) {
CheckboxItem dayItem = new CheckboxItem(day);
dayItem.setShowTitle(false);
@@ -129,6 +227,34 @@ public class OperationSchedulingStep implements WizardStep {
return form;
}
+ private DynamicForm getDailyForm() {
+ DynamicForm form = new DynamicForm();
+ form.setWrapItemTitles(false);
+
+
+ TimeItem timeOfDay = new TimeItem("timeOfDay", "Time Of Day");
+ timeOfDay.setDisplayFormat(TimeFormatter.TOSHORTPADDEDTIME);
+ timeOfDay.setUseMask(true);
+
+ form.setItems(timeOfDay);
+ return form;
+ }
+
+ private DynamicForm getMonthlyForm() {
+ DynamicForm form = new DynamicForm();
+ form.setWrapItemTitles(false);
+
+ IntegerItem dayItem = new IntegerItem();
+ dayItem.setTitle("Day of Month");
+
+ TimeItem timeOfDay = new TimeItem("timeOfDay", "Time Of Day");
+ timeOfDay.setDisplayFormat(TimeFormatter.TOSHORTPADDEDTIME);
+ timeOfDay.setUseMask(true);
+
+ form.setItems(dayItem, timeOfDay);
+ return form;
+ }
+
public boolean valid() {
return false; // TODO: Implement this method.
@@ -137,5 +263,5 @@ public class OperationSchedulingStep implements WizardStep {
public String getName() {
return "Schedule";
}
-
+
}
commit 0ec64b1a02948ebfb031588cc38b5ab79da48385
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Mar 9 11:14:58 2010 -0500
starting bundle wizard. not even half baked
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
index 7f0ca51..e3e65ed 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
@@ -18,23 +18,40 @@
*/
package org.rhq.enterprise.gui.coregui.client.bundle.create;
-import org.rhq.enterprise.gui.coregui.client.components.wizard.Wizard;
-import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
-
import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.Label;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.FormItem;
+import com.smartgwt.client.widgets.form.fields.TextAreaItem;
+import com.smartgwt.client.widgets.form.fields.TextItem;
+
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
/**
* @author Greg Hinkle
*/
public class BundleInfoStep implements WizardStep {
+ private DynamicForm form;
+
public Canvas getCanvas() {
- return new Label("Todo: implement me");
+ if (form == null) {
+ form = new DynamicForm();
+ form.setWidth100();
+ form.setNumCols(2);
+ form.setColWidths("50%", "*");
+
+ final TextItem nameTextItem = new TextItem("name", "Name");
+ final TextItem versionTextItem = new TextItem("version", "Initial Version");
+ versionTextItem.setValue("1.0");
+ final TextAreaItem descriptionTextAreaItem = new TextAreaItem("description", "Description");
+ form.setItems(nameTextItem, versionTextItem, descriptionTextAreaItem);
+ }
+ return form;
}
public boolean valid() {
- return false; // TODO: Implement this method.
+ FormItem nameField = form.getField("name");
+ return true;
}
public String getName() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
index dd9edd1..b67aa7e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
@@ -18,22 +18,61 @@
*/
package org.rhq.enterprise.gui.coregui.client.bundle.create;
-import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
-
import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.Label;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.FormItemIfFunction;
+import com.smartgwt.client.widgets.form.fields.FormItem;
+import com.smartgwt.client.widgets.form.fields.RadioGroupItem;
+import com.smartgwt.client.widgets.form.fields.TextAreaItem;
+import com.smartgwt.client.widgets.form.fields.TextItem;
+
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
/**
* @author Greg Hinkle
*/
public class BundleUploadRecipeStep implements WizardStep {
+ private DynamicForm form;
+
public Canvas getCanvas() {
- return new Label("Todo: implement me");
+ if (form == null) {
+ form = new DynamicForm();
+ form.setWidth100();
+ form.setNumCols(2);
+ form.setColWidths("50%", "*");
+
+ final RadioGroupItem radioGroupItem = new RadioGroupItem("reciperadio");
+ radioGroupItem.setTitle("");
+ radioGroupItem.setValueMap("Upload Recipe", "Write Recipe");
+
+ final TextItem recipeFileUploadItem = new TextItem("recipefile", "Recipe File");
+ recipeFileUploadItem.setVisible(false);
+
+ final TextAreaItem recipeTextAreaItem = new TextAreaItem("recipetext", "Recipe Text");
+ recipeTextAreaItem.setVisible(false);
+
+ recipeFileUploadItem.setShowIfCondition(new FormItemIfFunction() {
+ public boolean execute(FormItem item, Object value, DynamicForm form) {
+ System.out.println("!!!!!!!!!!!!!!" + form.getValues());
+ return (((RadioGroupItem) form.getValue("reciperadio")).getValue().equals("recipefile"));
+ }
+ });
+
+ recipeTextAreaItem.setShowIfCondition(new FormItemIfFunction() {
+ public boolean execute(FormItem item, Object value, DynamicForm form) {
+ System.out.println("!!!!!!!!!!!!!!" + form.getValues());
+ return (((RadioGroupItem) form.getValue("reciperadio")).getValue().equals("recipetext"));
+ }
+ });
+
+ form.setItems(radioGroupItem, recipeFileUploadItem, recipeTextAreaItem);
+ }
+ return form;
}
public boolean valid() {
- return false; // TODO: Implement this method.
+ return false; // TODO: Implement this method.
}
public String getName() {
commit b8e141978e4547e5e0e7e8ff054ad74d94ed4fda
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Mar 9 09:40:13 2010 -0500
add getWindowTitle to the wizard API
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java
index 5c1d366..17daba8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java
@@ -18,16 +18,16 @@
*/
package org.rhq.enterprise.gui.coregui.client.bundle.create;
-import org.rhq.enterprise.gui.coregui.client.components.wizard.Wizard;
-import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
-import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardView;
-
-import com.smartgwt.client.widgets.IButton;
-
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import com.smartgwt.client.widgets.IButton;
+
+import org.rhq.enterprise.gui.coregui.client.components.wizard.Wizard;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardView;
+
/**
* @author Greg Hinkle
*/
@@ -48,12 +48,16 @@ public class BundleCreationWizard implements Wizard {
}
+ public String getWindowTitle() {
+ return "Bundle Creation Wizard";
+ }
+
public String getTitle() {
return "Create Bundle";
}
public String getSubtitle() {
- return null;
+ return "";
}
public List<WizardStep> getSteps() {
@@ -64,7 +68,6 @@ public class BundleCreationWizard implements Wizard {
return Collections.emptyList();
}
-
public void startBundleCreateWizard() {
view = new WizardView(this);
view.displayDialog();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/Wizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/Wizard.java
index 4f67415..e57b4f9 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/Wizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/Wizard.java
@@ -18,17 +18,16 @@
*/
package org.rhq.enterprise.gui.coregui.client.components.wizard;
-import com.smartgwt.client.widgets.IButton;
-import com.smartgwt.client.widgets.ImgButton;
-
-import java.util.Arrays;
import java.util.List;
+import com.smartgwt.client.widgets.IButton;
+
/**
* @author Greg Hinkle
*/
public interface Wizard {
+ String getWindowTitle();
String getTitle();
@@ -37,4 +36,5 @@ public interface Wizard {
List<WizardStep> getSteps();
List<IButton> getCustomButtons(int step);
+
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
index e26cdd9..7d1c9cb 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
@@ -18,6 +18,8 @@
*/
package org.rhq.enterprise.gui.coregui.client.components.wizard;
+import java.util.ArrayList;
+
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.IButton;
@@ -32,8 +34,6 @@ import com.smartgwt.client.widgets.layout.LayoutSpacer;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.toolbar.ToolStrip;
-import java.util.ArrayList;
-
/**
* @author Greg Hinkle
*/
@@ -43,7 +43,6 @@ public class WizardView extends VLayout {
private Wizard wizard;
private int currentStep;
-
HLayout titleBar;
HTMLFlow titleLabel;
Label stepLabel;
@@ -68,11 +67,11 @@ public class WizardView extends VLayout {
protected void onDraw() {
super.onDraw();
-
titleBar = new HLayout(30);
titleBar.setHeight(50);
titleBar.setBackgroundColor("#F0F0F0");
- titleLabel = new HTMLFlow("<span class=\"HeaderLabel\">" + wizard.getTitle() + "</span><br/>" + wizard.getSubtitle());
+ titleLabel = new HTMLFlow("<span class=\"HeaderLabel\">" + wizard.getTitle() + "</span><br/>"
+ + wizard.getSubtitle());
titleLabel.setWidth("*");
stepLabel = new Label();
@@ -82,7 +81,6 @@ public class WizardView extends VLayout {
addMember(titleBar);
-
stepTitleLabel = new Label();
stepTitleLabel.setWidth100();
stepTitleLabel.setHeight(40);
@@ -96,7 +94,6 @@ public class WizardView extends VLayout {
addMember(contentLayout);
-
buttonBar = new ToolStrip();
buttonBar.setPadding(5);
buttonBar.setWidth100();
@@ -134,10 +131,8 @@ public class WizardView extends VLayout {
buttonBar.addMember(previousButton);
buttonBar.addMember(nextButton);
-
}
-
public void setStep(int stepIndex) {
currentStep = stepIndex;
stepLabel.setContents("Step " + (stepIndex + 1) + " of " + wizard.getSteps().size());
@@ -170,7 +165,7 @@ public class WizardView extends VLayout {
public void displayDialog() {
wizardWindow = new Window();
- wizardWindow.setTitle("Operation Wizard");
+ wizardWindow.setTitle(wizard.getWindowTitle());
wizardWindow.setWidth(800);
wizardWindow.setHeight(600);
wizardWindow.setIsModal(true);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationCreateWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationCreateWizard.java
index 1a7e416..adedfb0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationCreateWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationCreateWizard.java
@@ -18,6 +18,15 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.create;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import com.smartgwt.client.widgets.IButton;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.operation.OperationDefinition;
import org.rhq.core.domain.resource.Resource;
@@ -27,16 +36,6 @@ import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardView;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.OperationGWTServiceAsync;
-import com.smartgwt.client.widgets.IButton;
-import com.smartgwt.client.widgets.ImgButton;
-import com.smartgwt.client.widgets.events.ClickEvent;
-import com.smartgwt.client.widgets.events.ClickHandler;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
/**
* @author Greg Hinkle
*/
@@ -67,7 +66,6 @@ public class OperationCreateWizard implements Wizard {
steps.add(parametersStep);
steps.add(schedulingStep);
-
executeNowButton = new IButton("Execute Immediately");
executeNowButton.setAutoFit(true);
executeNowButton.addClickHandler(new ClickHandler() {
@@ -83,11 +81,14 @@ public class OperationCreateWizard implements Wizard {
}
});
-
view = new WizardView(this);
view.displayDialog();
}
+ public String getWindowTitle() {
+ return "Operation Wizard";
+ }
+
public String getTitle() {
return "Execute " + operationDefinition.getDisplayName() + " on " + resource.getName();
}
@@ -102,12 +103,12 @@ public class OperationCreateWizard implements Wizard {
public List<IButton> getCustomButtons(int step) {
switch (step) {
- case 0:
- return Arrays.asList(executeNowButton);
- case 1:
- return Arrays.asList(executeButton);
- default:
- return Collections.emptyList();
+ case 0:
+ return Arrays.asList(executeNowButton);
+ case 1:
+ return Arrays.asList(executeButton);
+ default:
+ return Collections.emptyList();
}
}
@@ -118,10 +119,6 @@ public class OperationCreateWizard implements Wizard {
Configuration parameters = parametersStep.getParameterConfiguration();
-
-
-
-
view.closeDialog();
}
}
commit dfa1a26be7ffde48e73f29428df74368137fa10b
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Mar 9 09:39:42 2010 -0500
use -o in eclipse external tool def when starting gwt:run/debug
diff --git a/etc/eclipse-tools/maven/RHQ Maven Build - Run GWT DevMode-JPDA.launch b/etc/eclipse-tools/maven/RHQ Maven Build - Run GWT DevMode-JPDA.launch
index 006034d..6f5b7c2 100644
--- a/etc/eclipse-tools/maven/RHQ Maven Build - Run GWT DevMode-JPDA.launch
+++ b/etc/eclipse-tools/maven/RHQ Maven Build - Run GWT DevMode-JPDA.launch
@@ -6,6 +6,6 @@
<listEntry value="org.eclipse.ui.externaltools.launchGroup"/>
</listAttribute>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${env_var:M2_HOME}/bin/${MAVEN_EXE}"/>
-<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="-Dmaven.test.skip=true gwt:debug"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="-o -Dmaven.test.skip=true gwt:debug"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/rhq/modules/enterprise/gui/coregui}"/>
</launchConfiguration>
diff --git a/etc/eclipse-tools/maven/RHQ Maven Build - Run GWT DevMode.launch b/etc/eclipse-tools/maven/RHQ Maven Build - Run GWT DevMode.launch
index b69bb01..f1b94d5 100644
--- a/etc/eclipse-tools/maven/RHQ Maven Build - Run GWT DevMode.launch
+++ b/etc/eclipse-tools/maven/RHQ Maven Build - Run GWT DevMode.launch
@@ -6,6 +6,6 @@
<listEntry value="org.eclipse.ui.externaltools.launchGroup"/>
</listAttribute>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${env_var:M2_HOME}/bin/${MAVEN_EXE}"/>
-<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="-Dmaven.test.skip=true gwt:run"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="-o -Dmaven.test.skip=true gwt:run"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/rhq/modules/enterprise/gui/coregui}"/>
</launchConfiguration>
commit f469b9adfe14189fa231baecc8d71559ee2ab3d7
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Mon Mar 8 16:10:12 2010 -0500
Outline for the create bundle wizard
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 d18ed2b..8e46217 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
@@ -2,6 +2,7 @@ package org.rhq.enterprise.gui.coregui.client;
import org.rhq.core.domain.auth.Subject;
import org.rhq.enterprise.gui.coregui.client.admin.AdministrationView;
+import org.rhq.enterprise.gui.coregui.client.bundle.BundleTopView;
import org.rhq.enterprise.gui.coregui.client.dashboard.DashboardView;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.SubjectGWTServiceAsync;
@@ -252,6 +253,8 @@ public class CoreGUI implements EntryPoint {
canvas = new ResourceView();
} else if (breadcrumbName.equals("Dashboard")) {
canvas = new DashboardView();
+ } else if (breadcrumbName.equals("Bundles")) {
+ canvas = new BundleTopView();
} else {
canvas = null;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
new file mode 100644
index 0000000..fe0fc30
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
@@ -0,0 +1,48 @@
+/*
+ * 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.bundle;
+
+import org.rhq.enterprise.gui.coregui.client.bundle.create.BundleCreationWizard;
+
+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.HLayout;
+
+/**
+ * @author Greg Hinkle
+ */
+public class BundleTopView extends HLayout {
+
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+
+ IButton addButton = new IButton("New Bundle");
+ addButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ new BundleCreationWizard().startBundleCreateWizard();
+ }
+ });
+
+ addMember(addButton);
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java
new file mode 100644
index 0000000..5c1d366
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleCreationWizard.java
@@ -0,0 +1,72 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.bundle.create;
+
+import org.rhq.enterprise.gui.coregui.client.components.wizard.Wizard;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardView;
+
+import com.smartgwt.client.widgets.IButton;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author Greg Hinkle
+ */
+public class BundleCreationWizard implements Wizard {
+
+ private ArrayList<WizardStep> steps;
+
+ private WizardView view;
+
+ public BundleCreationWizard() {
+
+ steps = new ArrayList<WizardStep>();
+
+ steps.add(new BundleInfoStep());
+ steps.add(new BundleUploadRecipeStep());
+ steps.add(new BundleUploadDataStep());
+ steps.add(new BundleVerificationStep());
+
+ }
+
+ public String getTitle() {
+ return "Create Bundle";
+ }
+
+ public String getSubtitle() {
+ return null;
+ }
+
+ public List<WizardStep> getSteps() {
+ return steps;
+ }
+
+ public List<IButton> getCustomButtons(int step) {
+ return Collections.emptyList();
+ }
+
+
+ public void startBundleCreateWizard() {
+ view = new WizardView(this);
+ view.displayDialog();
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
new file mode 100644
index 0000000..7f0ca51
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleInfoStep.java
@@ -0,0 +1,44 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.bundle.create;
+
+import org.rhq.enterprise.gui.coregui.client.components.wizard.Wizard;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.Label;
+
+/**
+ * @author Greg Hinkle
+ */
+public class BundleInfoStep implements WizardStep {
+
+ public Canvas getCanvas() {
+ return new Label("Todo: implement me");
+ }
+
+ public boolean valid() {
+ return false; // TODO: Implement this method.
+ }
+
+ public String getName() {
+ return "Provide Bundle Information";
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
new file mode 100644
index 0000000..26e77af
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
@@ -0,0 +1,43 @@
+/*
+ * 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.bundle.create;
+
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.Label;
+
+/**
+ * @author Greg Hinkle
+ */
+public class BundleUploadDataStep implements WizardStep {
+
+ public Canvas getCanvas() {
+ return new Label("Todo: implement me");
+ }
+
+ public boolean valid() {
+ return false; // TODO: Implement this method.
+ }
+
+ public String getName() {
+ return "Upload Bundle Binary Information";
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
new file mode 100644
index 0000000..dd9edd1
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
@@ -0,0 +1,43 @@
+/*
+ * 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.bundle.create;
+
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.Label;
+
+/**
+ * @author Greg Hinkle
+ */
+public class BundleUploadRecipeStep implements WizardStep {
+
+ public Canvas getCanvas() {
+ return new Label("Todo: implement me");
+ }
+
+ public boolean valid() {
+ return false; // TODO: Implement this method.
+ }
+
+ public String getName() {
+ return "Setup Bundle Recipe Information";
+ }
+
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java
new file mode 100644
index 0000000..086491d
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleVerificationStep.java
@@ -0,0 +1,43 @@
+/*
+ * 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.bundle.create;
+
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.Label;
+
+/**
+ * @author Greg Hinkle
+ */
+public class BundleVerificationStep implements WizardStep {
+
+ public Canvas getCanvas() {
+ return new Label("Todo: implement me");
+ }
+
+ public boolean valid() {
+ return false; // TODO: Implement this method.
+ }
+
+ public String getName() {
+ return "Verify Bundle Information";
+ }
+
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardStep.java
index 3a467c5..c6e3437 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardStep.java
@@ -32,6 +32,4 @@ public interface WizardStep {
String getName();
- void setWizard(Wizard wizard);
-
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
index 80dec8b..e26cdd9 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
@@ -142,6 +142,10 @@ public class WizardView extends VLayout {
currentStep = stepIndex;
stepLabel.setContents("Step " + (stepIndex + 1) + " of " + wizard.getSteps().size());
+ WizardStep step = wizard.getSteps().get(currentStep);
+
+ stepTitleLabel.setContents(step.getName());
+
previousButton.setDisabled(stepIndex == 0);
boolean last = (stepIndex == (wizard.getSteps().size() - 1));
nextButton.setDisabled(last);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationParametersStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationParametersStep.java
index b26929c..27c4fd9 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationParametersStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationParametersStep.java
@@ -34,11 +34,9 @@ import com.smartgwt.client.widgets.HTMLFlow;
*/
public class OperationParametersStep implements WizardStep {
- private Wizard wizard;
-
private OperationDefinition definition;
-private ConfigurationEditor configurationEditor;
+ private ConfigurationEditor configurationEditor;
public OperationParametersStep(OperationDefinition operationDefinition) {
super();
@@ -66,9 +64,6 @@ private ConfigurationEditor configurationEditor;
return "Operation Parameters";
}
- public void setWizard(Wizard wizard) {
- this.wizard = wizard;
- }
public Configuration getParameterConfiguration() {
return configurationEditor.getConfiguration();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java
index 885a7ef..77f73b0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java
@@ -38,7 +38,7 @@ import com.smartgwt.client.widgets.form.fields.TimeItem;
*/
public class OperationSchedulingStep implements WizardStep {
- DynamicForm form;
+ private DynamicForm form;
public Canvas getCanvas() {
@@ -137,8 +137,5 @@ public class OperationSchedulingStep implements WizardStep {
public String getName() {
return "Schedule";
}
-
- public void setWizard(Wizard wizard) {
- // TODO: Implement this method.
- }
+
}
commit 37abf6c023a9c0b730bd3980d55effaf5c127c1b
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Mar 8 15:07:50 2010 -0500
add the lookup of the bundle service
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
index 6f98914..316119a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
@@ -18,13 +18,13 @@
*/
package org.rhq.enterprise.gui.coregui.client.gwt;
-import org.rhq.enterprise.gui.coregui.client.util.rpc.MonitoringRequestCallback;
-
import com.google.gwt.http.client.RequestBuilder;
import com.google.gwt.user.client.Cookies;
import com.google.gwt.user.client.rpc.RpcRequestBuilder;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
+import org.rhq.enterprise.gui.coregui.client.util.rpc.MonitoringRequestCallback;
+
/**
* This lookup service retrieves each RPC service and sets a
* custom RpcRequestBuilder that adds the login session id to
@@ -71,10 +71,14 @@ public class GWTServiceLookup {
public static OperationGWTServiceAsync getOperationService() {
return secure(OperationGWTServiceAsync.Util.getInstance());
}
-
+
+ public static BundleGWTServiceAsync getBundleService() {
+ return secure(BundleGWTServiceAsync.Util.getInstance());
+ }
private static <T> T secure(Object sdt) {
- if (!(sdt instanceof ServiceDefTarget)) return null;
+ if (!(sdt instanceof ServiceDefTarget))
+ return null;
((ServiceDefTarget) sdt).setRpcRequestBuilder(new SessionRpcRequestBuilder());
@@ -85,7 +89,6 @@ public class GWTServiceLookup {
Cookies.setCookie(SESSION_NAME, sessionId);
}
-
public static class SessionRpcRequestBuilder extends RpcRequestBuilder {
@Override
@@ -115,7 +118,8 @@ public class GWTServiceLookup {
StackTraceElement ste = stack[i];
// e.g. "org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTService_Proxy.findResourcesByCriteria(ResourceGWTService_Proxy.java:36)"
if (ste.getClassName().startsWith("org.rhq.enterprise.gui.coregui.client.gwt")) {
- return ste.getClassName().substring(ste.getClassName().lastIndexOf(".") + 1) + "." + ste.getMethodName();
+ return ste.getClassName().substring(ste.getClassName().lastIndexOf(".") + 1) + "."
+ + ste.getMethodName();
}
}
return "unknown";
commit 69f04858b1b3f32224b4a6558546749d20378cdb
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Mon Mar 8 14:54:01 2010 -0500
First cut at a wizard framework plus and example for operation execution
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 f3b295a..96239e2 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
@@ -52,6 +52,7 @@ import com.smartgwt.client.types.TreeModelType;
import com.smartgwt.client.types.VisibilityMode;
import com.smartgwt.client.util.BooleanCallback;
import com.smartgwt.client.util.SC;
+import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.Window;
@@ -136,6 +137,8 @@ public class ConfigurationEditor extends VLayout {
private ConfigType configType;
private IButton saveButton;
+
+
public static enum ConfigType {
plugin, resource
}
@@ -157,10 +160,20 @@ public class ConfigurationEditor extends VLayout {
setOverflow(Overflow.AUTO);
}
+ public ConfigurationEditor(ConfigurationDefinition definition, Configuration configuration) {
+ this.configuration = configuration;
+ this.definition = definition;
+ }
+
+
+ public Configuration getConfiguration() {
+ return configuration;
+ }
public void showError(Throwable failure) {
addMember(new Label(failure.getMessage()));
}
+
public void showError(String message) {
addMember(new Label(message));
}
@@ -168,62 +181,66 @@ public class ConfigurationEditor extends VLayout {
@Override
protected void onDraw() {
super.onDraw();
- System.out.println("onInit");
addMember(loadingLabel);
this.redraw();
final long start = System.currentTimeMillis();
- if (configType == ConfigType.resource) {
- configurationService.getResourceConfiguration( resourceId, new AsyncCallback<Configuration>() {
- public void onFailure(Throwable caught) {
- showError(caught);
- }
+ if (definition == null || configuration == null) {
- public void onSuccess(Configuration result) {
- configuration = result;
- System.out.println("Config retreived in: " + (System.currentTimeMillis() - start));
- reload();
- }
- });
+ if (configType == ConfigType.resource) {
+ configurationService.getResourceConfiguration(resourceId, new AsyncCallback<Configuration>() {
+ public void onFailure(Throwable caught) {
+ showError(caught);
+ }
- ResourceTypeRepository.Cache.getInstance().getResourceTypes(new Integer[]{resourceTypeId},
- EnumSet.of(ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
- new ResourceTypeRepository.TypesLoadedCallback() {
- public void onTypesLoaded(HashMap<Integer, ResourceType> types) {
- System.out.println("ConfigDef retreived in: " + (System.currentTimeMillis() - start));
- definition = types.get(resourceTypeId).getResourceConfigurationDefinition();
- if (definition == null) {
- loadingLabel.hide();
- showError("No configuration supported for this resource");
+ public void onSuccess(Configuration result) {
+ configuration = result;
+ System.out.println("Config retreived in: " + (System.currentTimeMillis() - start));
+ reload();
}
- reload();
- }
- });
+ });
- } else if (configType == ConfigType.plugin) {
- configurationService.getPluginConfiguration(resourceId, new AsyncCallback<Configuration>() {
- public void onFailure(Throwable caught) {
- showError(caught);
- }
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(new Integer[]{resourceTypeId},
+ EnumSet.of(ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
+ new ResourceTypeRepository.TypesLoadedCallback() {
+ public void onTypesLoaded(HashMap<Integer, ResourceType> types) {
+ System.out.println("ConfigDef retreived in: " + (System.currentTimeMillis() - start));
+ definition = types.get(resourceTypeId).getResourceConfigurationDefinition();
+ if (definition == null) {
+ loadingLabel.hide();
+ showError("No configuration supported for this resource");
+ }
+ reload();
+ }
+ });
+
+ } else if (configType == ConfigType.plugin) {
+ configurationService.getPluginConfiguration(resourceId, new AsyncCallback<Configuration>() {
+ public void onFailure(Throwable caught) {
+ showError(caught);
+ }
- public void onSuccess(Configuration result) {
- configuration = result;
- reload();
- }
- });
+ public void onSuccess(Configuration result) {
+ configuration = result;
+ reload();
+ }
+ });
- ResourceTypeRepository.Cache.getInstance().getResourceTypes(new Integer[]{resourceTypeId}, EnumSet.of(ResourceTypeRepository.MetadataType.pluginConfigurationDefinition), new ResourceTypeRepository.TypesLoadedCallback() {
- public void onTypesLoaded(HashMap<Integer, ResourceType> types) {
- System.out.println("ConfigDef retreived in: " + (System.currentTimeMillis() - start));
- definition = types.get(resourceTypeId).getPluginConfigurationDefinition();
- if (definition == null) {
- showError("No configuration supported for this resource");
- }
- reload();
- }
- });
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(new Integer[]{resourceTypeId}, EnumSet.of(ResourceTypeRepository.MetadataType.pluginConfigurationDefinition), new ResourceTypeRepository.TypesLoadedCallback() {
+ public void onTypesLoaded(HashMap<Integer, ResourceType> types) {
+ System.out.println("ConfigDef retreived in: " + (System.currentTimeMillis() - start));
+ definition = types.get(resourceTypeId).getPluginConfigurationDefinition();
+ if (definition == null) {
+ showError("No configuration supported for this resource");
+ }
+ reload();
+ }
+ });
+ }
+ } else {
+ reload();
}
}
@@ -254,11 +271,14 @@ public class ConfigurationEditor extends VLayout {
tabSet.addTab(tab);
}
- removeMember(loadingLabel);
+
+ for (Canvas c : getChildren()) {
+ c.destroy();
+ }
addMember(tabSet);
- this.redraw();
+ this.markForRedraw();
}
protected HLayout buildRawPane() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/Wizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/Wizard.java
new file mode 100644
index 0000000..4f67415
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/Wizard.java
@@ -0,0 +1,40 @@
+/*
+ * 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.wizard;
+
+import com.smartgwt.client.widgets.IButton;
+import com.smartgwt.client.widgets.ImgButton;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * @author Greg Hinkle
+ */
+public interface Wizard {
+
+
+ String getTitle();
+
+ String getSubtitle();
+
+ List<WizardStep> getSteps();
+
+ List<IButton> getCustomButtons(int step);
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardStep.java
new file mode 100644
index 0000000..3a467c5
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardStep.java
@@ -0,0 +1,37 @@
+/*
+ * 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.wizard;
+
+import com.smartgwt.client.widgets.Canvas;
+
+/**
+ * @author Greg Hinkle
+ */
+public interface WizardStep {
+
+
+ Canvas getCanvas();
+
+ boolean valid();
+
+ String getName();
+
+ void setWizard(Wizard wizard);
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
new file mode 100644
index 0000000..80dec8b
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
@@ -0,0 +1,190 @@
+/*
+ * 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.wizard;
+
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.HTMLFlow;
+import com.smartgwt.client.widgets.IButton;
+import com.smartgwt.client.widgets.Label;
+import com.smartgwt.client.widgets.Window;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.events.CloseClickHandler;
+import com.smartgwt.client.widgets.events.CloseClientEvent;
+import com.smartgwt.client.widgets.layout.HLayout;
+import com.smartgwt.client.widgets.layout.LayoutSpacer;
+import com.smartgwt.client.widgets.layout.VLayout;
+import com.smartgwt.client.widgets.toolbar.ToolStrip;
+
+import java.util.ArrayList;
+
+/**
+ * @author Greg Hinkle
+ */
+public class WizardView extends VLayout {
+
+ private Window wizardWindow;
+ private Wizard wizard;
+ private int currentStep;
+
+
+ HLayout titleBar;
+ HTMLFlow titleLabel;
+ Label stepLabel;
+
+ Label stepTitleLabel;
+ HLayout contentLayout;
+ ToolStrip buttonBar;
+
+ IButton cancelButton;
+ IButton previousButton;
+ IButton nextButton;
+
+ ArrayList<IButton> customButtons = new ArrayList<IButton>();
+ Canvas currentCanvas;
+
+ public WizardView(Wizard wizard) {
+ super(10);
+ this.wizard = wizard;
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+
+ titleBar = new HLayout(30);
+ titleBar.setHeight(50);
+ titleBar.setBackgroundColor("#F0F0F0");
+ titleLabel = new HTMLFlow("<span class=\"HeaderLabel\">" + wizard.getTitle() + "</span><br/>" + wizard.getSubtitle());
+ titleLabel.setWidth("*");
+
+ stepLabel = new Label();
+ stepLabel.setWidth(60);
+ titleBar.addMember(titleLabel);
+ titleBar.addMember(stepLabel);
+
+ addMember(titleBar);
+
+
+ stepTitleLabel = new Label();
+ stepTitleLabel.setWidth100();
+ stepTitleLabel.setHeight(40);
+ stepTitleLabel.setStyleName("HeaderLabel");
+
+ addMember(stepTitleLabel);
+
+ contentLayout = new HLayout();
+ contentLayout.setHeight("*");
+ contentLayout.setWidth100();
+
+ addMember(contentLayout);
+
+
+ buttonBar = new ToolStrip();
+ buttonBar.setPadding(5);
+ buttonBar.setWidth100();
+ buttonBar.setMembersMargin(15);
+
+ setupButtons();
+
+ addMember(buttonBar);
+
+ setStep(0);
+ }
+
+ private void setupButtons() {
+ cancelButton = new IButton("Cancel");
+ cancelButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ wizardWindow.destroy();
+ }
+ });
+ previousButton = new IButton("Previous");
+ previousButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ setStep(currentStep - 1);
+ }
+ });
+ nextButton = new IButton("Next");
+ nextButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ setStep(currentStep + 1);
+ }
+ });
+
+ buttonBar.addMember(cancelButton);
+ buttonBar.addMember(new LayoutSpacer());
+ buttonBar.addMember(previousButton);
+ buttonBar.addMember(nextButton);
+
+
+ }
+
+
+ public void setStep(int stepIndex) {
+ currentStep = stepIndex;
+ stepLabel.setContents("Step " + (stepIndex + 1) + " of " + wizard.getSteps().size());
+
+ previousButton.setDisabled(stepIndex == 0);
+ boolean last = (stepIndex == (wizard.getSteps().size() - 1));
+ nextButton.setDisabled(last);
+
+ for (IButton button : customButtons) {
+ buttonBar.removeMember(button);
+ }
+ customButtons.clear();
+ for (IButton button : wizard.getCustomButtons(currentStep)) {
+ buttonBar.addMember(button);
+ customButtons.add(button);
+ }
+
+ if (currentCanvas != null) {
+ contentLayout.removeMember(currentCanvas);
+ }
+ currentCanvas = wizard.getSteps().get(currentStep).getCanvas();
+ contentLayout.addMember(currentCanvas);
+
+ markForRedraw();
+ }
+
+ public void displayDialog() {
+ wizardWindow = new Window();
+ wizardWindow.setTitle("Operation Wizard");
+ wizardWindow.setWidth(800);
+ wizardWindow.setHeight(600);
+ wizardWindow.setIsModal(true);
+ wizardWindow.setShowModalMask(true);
+ wizardWindow.setCanDragResize(true);
+ wizardWindow.setShowResizer(true);
+ wizardWindow.centerInPage();
+ wizardWindow.addCloseClickHandler(new CloseClickHandler() {
+ public void onCloseClick(CloseClientEvent closeClientEvent) {
+ wizardWindow.destroy();
+ }
+ });
+ wizardWindow.addItem(this);
+ wizardWindow.show();
+
+ }
+
+ public void closeDialog() {
+ wizardWindow.destroy();
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
index c86b6aa..ce95ec5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
@@ -25,6 +25,7 @@ import org.rhq.enterprise.gui.coregui.client.components.configuration.Configurat
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.create.OperationCreateWizard;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.rpc.AsyncCallback;
@@ -242,8 +243,14 @@ public class ResourceTreeView extends VLayout {
// Operations Menu
MenuItem operations = new MenuItem("Operations");
Menu opSubMenu = new Menu();
- for (OperationDefinition operationDefinition : node.getResourceType().getOperationDefinitions()) {
- opSubMenu.addItem(new MenuItem(operationDefinition.getDisplayName()));
+ for (final OperationDefinition operationDefinition : node.getResourceType().getOperationDefinitions()) {
+ MenuItem operationItem = new MenuItem(operationDefinition.getDisplayName());
+ operationItem.addClickHandler(new ClickHandler() {
+ public void onClick(MenuItemClickEvent event) {
+ new OperationCreateWizard(selectedResource, operationDefinition).startOperationWizard();
+ }
+ });
+ opSubMenu.addItem(operationItem);
// todo action
}
operations.setEnabled(!node.getResourceType().getOperationDefinitions().isEmpty());
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationCreateWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationCreateWizard.java
new file mode 100644
index 0000000..1a7e416
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationCreateWizard.java
@@ -0,0 +1,127 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.create;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.operation.OperationDefinition;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.Wizard;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardView;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.gwt.OperationGWTServiceAsync;
+
+import com.smartgwt.client.widgets.IButton;
+import com.smartgwt.client.widgets.ImgButton;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author Greg Hinkle
+ */
+public class OperationCreateWizard implements Wizard {
+
+ private Resource resource;
+ private OperationDefinition operationDefinition;
+
+ private OperationParametersStep parametersStep;
+ private OperationSchedulingStep schedulingStep;
+
+ private ArrayList<WizardStep> steps = new ArrayList<WizardStep>();
+ private WizardView view;
+
+ private IButton executeNowButton;
+ private IButton executeButton;
+
+ public OperationCreateWizard(Resource resource, OperationDefinition operationDefinition) {
+ this.resource = resource;
+ this.operationDefinition = operationDefinition;
+ }
+
+ public void startOperationWizard() {
+
+ parametersStep = new OperationParametersStep(operationDefinition);
+ schedulingStep = new OperationSchedulingStep();
+
+ steps.add(parametersStep);
+ steps.add(schedulingStep);
+
+
+ executeNowButton = new IButton("Execute Immediately");
+ executeNowButton.setAutoFit(true);
+ executeNowButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ execute();
+ }
+ });
+
+ executeButton = new IButton("Execute");
+ executeButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ execute();
+ }
+ });
+
+
+ view = new WizardView(this);
+ view.displayDialog();
+ }
+
+ public String getTitle() {
+ return "Execute " + operationDefinition.getDisplayName() + " on " + resource.getName();
+ }
+
+ public String getSubtitle() {
+ return operationDefinition.getDescription();
+ }
+
+ public List<WizardStep> getSteps() {
+ return steps;
+ }
+
+ public List<IButton> getCustomButtons(int step) {
+ switch (step) {
+ case 0:
+ return Arrays.asList(executeNowButton);
+ case 1:
+ return Arrays.asList(executeButton);
+ default:
+ return Collections.emptyList();
+ }
+ }
+
+ private void execute() {
+ System.out.println("TODO Executed operation!!");
+
+ OperationGWTServiceAsync operationService = GWTServiceLookup.getOperationService();
+
+ Configuration parameters = parametersStep.getParameterConfiguration();
+
+
+
+
+
+ view.closeDialog();
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationParametersStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationParametersStep.java
new file mode 100644
index 0000000..b26929c
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationParametersStep.java
@@ -0,0 +1,76 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.create;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.operation.OperationDefinition;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.Wizard;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.HTMLFlow;
+
+
+/**
+ * @author Greg Hinkle
+ */
+public class OperationParametersStep implements WizardStep {
+
+ private Wizard wizard;
+
+ private OperationDefinition definition;
+
+private ConfigurationEditor configurationEditor;
+
+ public OperationParametersStep(OperationDefinition operationDefinition) {
+ super();
+ this.definition = operationDefinition;
+ }
+
+ public Canvas getCanvas() {
+ if (definition.getParametersConfigurationDefinition() != null) {
+ if (configurationEditor == null) {
+ ConfigurationDefinition configurationDefinition = definition.getParametersConfigurationDefinition();
+ Configuration defaultConfiguration = configurationDefinition.getDefaultTemplate() != null ? configurationDefinition.getDefaultTemplate().createConfiguration() : new Configuration();
+ configurationEditor = new ConfigurationEditor(configurationDefinition, defaultConfiguration);
+ }
+ return configurationEditor;
+ } else {
+ return new HTMLFlow("This operation does not take any parameters.");
+ }
+ }
+
+ public boolean valid() {
+ return false; // TODO: Implement this method.
+ }
+
+ public String getName() {
+ return "Operation Parameters";
+ }
+
+ public void setWizard(Wizard wizard) {
+ this.wizard = wizard;
+ }
+
+ public Configuration getParameterConfiguration() {
+ return configurationEditor.getConfiguration();
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java
new file mode 100644
index 0000000..885a7ef
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java
@@ -0,0 +1,144 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.create;
+
+import org.rhq.enterprise.gui.coregui.client.components.wizard.Wizard;
+import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+
+import com.smartgwt.client.types.TimeFormatter;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.FormItemIfFunction;
+import com.smartgwt.client.widgets.form.fields.CanvasItem;
+import com.smartgwt.client.widgets.form.fields.CheckboxItem;
+import com.smartgwt.client.widgets.form.fields.DateItem;
+import com.smartgwt.client.widgets.form.fields.DateTimeItem;
+import com.smartgwt.client.widgets.form.fields.FormItem;
+import com.smartgwt.client.widgets.form.fields.RadioGroupItem;
+import com.smartgwt.client.widgets.form.fields.TimeItem;
+
+/**
+ * @author Greg Hinkle
+ */
+public class OperationSchedulingStep implements WizardStep {
+
+ DynamicForm form;
+
+ public Canvas getCanvas() {
+
+ if (form == null) {
+ form = new DynamicForm();
+ form.setWidth100();
+ form.setNumCols(4);
+ form.setColWidths("10%", "25%", "10%", "*");
+
+ final RadioGroupItem start = new RadioGroupItem("start", "Start");
+ start.setColSpan(3);
+ start.setValueMap("Immediately", "Schedule for Future");
+ start.setRedrawOnChange(true);
+ start.setValue("Immediately");
+
+ DateItem startDate = new DateItem("startDate", "Start Date");
+ startDate.setShowIfCondition(new FormItemIfFunction() {
+ public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
+ return !"Immediately".equals(form.getValueAsString("start"));
+ }
+ });
+
+
+ TimeItem startTime = new TimeItem("startTime", "Start Time");
+ startTime.setDisplayFormat(TimeFormatter.TOSHORTPADDEDTIME);
+ startTime.setUseMask(true);
+ startTime.setShowIfCondition(new FormItemIfFunction() {
+ public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
+ return !"Immediately".equals(form.getValueAsString("start"));
+ }
+ });
+
+
+ RadioGroupItem recurr = new RadioGroupItem("recurr", "Recurrence");
+ recurr.setValueMap("None", "Daily", "Weekly", "Monthly", "Yearly");
+ recurr.setRedrawOnChange(true);
+ recurr.setValue("None");
+ recurr.setShowIfCondition(new FormItemIfFunction() {
+ public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
+ return !"Immediately".equals(form.getValueAsString("start"));
+ }
+ });
+
+ CanvasItem daysItem = new CanvasItem("days", "Days");
+ daysItem.setCanvas(getDaysForm());
+ daysItem.setShowIfCondition(new FormItemIfFunction() {
+ public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
+ return "Weekly".equals(form.getValueAsString("recurr"));
+ }
+ });
+
+
+ DateTimeItem endDate = new DateTimeItem("endDate", "End Date");
+ endDate.setStartRow(true);
+ endDate.setShowIfCondition(new FormItemIfFunction() {
+ public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
+ return !"None".equals(form.getValueAsString("recurr"));
+ }
+ });
+ TimeItem endTime = new TimeItem("endTime", "End Time");
+ endTime.setDisplayFormat(TimeFormatter.TOSHORTPADDEDTIME);
+ endTime.setUseMask(true);
+ endTime.setShowIfCondition(new FormItemIfFunction() {
+ public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
+ return !"None".equals(form.getValueAsString("recurr"));
+ }
+ });
+
+
+ form.setItems(start, startDate, startTime, recurr, daysItem, endDate, endTime);
+ }
+ return form;
+ }
+
+
+ private DynamicForm getDaysForm() {
+ DynamicForm form = new DynamicForm();
+ form.setNumCols(2);
+ String[] days = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
+ FormItem[] items = new FormItem[7];
+ int i = 0;
+ for (String day : days) {
+ CheckboxItem dayItem = new CheckboxItem(day);
+ dayItem.setShowTitle(false);
+ items[i++] = dayItem;
+ }
+ form.setItems(items);
+ return form;
+ }
+
+
+ public boolean valid() {
+ return false; // TODO: Implement this method.
+ }
+
+ public String getName() {
+ return "Schedule";
+ }
+
+ public void setWizard(Wizard wizard) {
+ // TODO: Implement this method.
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java
index c6cbde0..d9960e3 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java
@@ -121,10 +121,11 @@ public class ResourceTypeRepository {
final HashMap<Integer, ResourceType> cachedTypes = new HashMap<Integer, ResourceType>();
+
+ ArrayList<Integer> typesNeeded = new ArrayList<Integer>();
if (resourceTypeIds == null) {
//preload all
} else {
- ArrayList<Integer> typesNeeded = new ArrayList<Integer>();
for (Integer typeId : resourceTypeIds) {
if (!typeCache.containsKey(typeId) || (metadataTypes != null && !typeCacheLevel.get(typeId).containsAll(metadataTypes))) {
@@ -171,6 +172,8 @@ public class ResourceTypeRepository {
criteria.setPageControl(PageControl.getUnlimitedInstance());
+ System.out.println("Loading " + typesNeeded.size() + " types: " + metadataTypes.toString());
+
resourceTypeService.findResourceTypesByCriteria(criteria, new AsyncCallback<PageList<ResourceType>>() {
public void onFailure(Throwable caught) {
// TODO: Implement this method.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/OperationGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/OperationGWTServiceImpl.java
index 24bef8a..52d29e4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/OperationGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/OperationGWTServiceImpl.java
@@ -21,7 +21,6 @@ package org.rhq.enterprise.gui.coregui.server.gwt;
import org.rhq.core.domain.criteria.GroupOperationHistoryCriteria;
import org.rhq.core.domain.criteria.ResourceOperationHistoryCriteria;
import org.rhq.core.domain.operation.GroupOperationHistory;
-import org.rhq.core.domain.operation.OperationHistory;
import org.rhq.core.domain.operation.ResourceOperationHistory;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.gwt.OperationGWTService;
@@ -46,4 +45,6 @@ public class OperationGWTServiceImpl extends AbstractGWTServiceImpl implements O
"OperationService.findGroupOperationHistoriesByCriteria");
}
+
+
}
commit 3e41da086783468abcdb7c67e4a7502021160e66
Merge: 70ab3bb... 24efcf8...
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Mon Mar 8 14:04:39 2010 -0500
fix compile error
diff --cc modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentHistoryCriteria.java
index 598dc9f,094152a..65f2218
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentHistoryCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentHistoryCriteria.java
@@@ -39,8 -41,12 +39,7 @@@ public class BundleDeploymentHistoryCri
public Integer filterBundleDeploymentId;
public Integer filterBundleDeploymentDefinitionId;
- @Override
- public Class getPersistentClass() {
- public BundleDeploymentHistoryCriteria() {
- super();
-
- }
-
+ public Class<BundleDeploymentHistory> getPersistentClass() {
return BundleDeploymentHistory.class;
}
commit 70ab3bb376cd7f779ec5a1a89c0f1ca1f710af32
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Mon Mar 8 14:02:12 2010 -0500
fix compile error
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentHistoryCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentHistoryCriteria.java
index a459be5..598dc9f 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentHistoryCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentHistoryCriteria.java
@@ -16,7 +16,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
package org.rhq.core.domain.criteria;
import javax.xml.bind.annotation.XmlAccessType;
@@ -31,7 +30,6 @@ import org.rhq.core.domain.bundle.BundleDeploymentHistory;
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class BundleDeploymentHistoryCriteria extends Criteria {
-
private static final long serialVersionUID = 747793536546442610L;
//No reason to make these private. The setters are necessary to work with bean-api mechanisms
@@ -41,9 +39,9 @@ public class BundleDeploymentHistoryCriteria extends Criteria {
public Integer filterBundleDeploymentId;
public Integer filterBundleDeploymentDefinitionId;
- public BundleDeploymentHistoryCriteria() {
- super(BundleDeploymentHistory.class);
-
+ @Override
+ public Class getPersistentClass() {
+ return BundleDeploymentHistory.class;
}
public void setFilterId(Integer filterId) {
@@ -65,5 +63,4 @@ public class BundleDeploymentHistoryCriteria extends Criteria {
public void setFilterBundleDeploymentDefinitionId(Integer filterBundleDeploymentDefinitionId) {
this.filterBundleDeploymentDefinitionId = filterBundleDeploymentDefinitionId;
}
-
}
commit 24efcf8cc1c00ce5ee5867410d27d39c2bb7514c
Merge: eb2cffe... c0dcf32...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Mar 8 14:00:01 2010 -0500
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
commit eb2cffe4651701897bb5cbf294446ba1455a0188
Merge: e4a61cf... 6d0672e...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Mar 8 13:59:24 2010 -0500
Merge branch 'bundle' into gwt
Conflicts:
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AlertCriteria.java
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AlertDefinitionCriteria.java
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleCriteria.java
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeployDefinitionCriteria.java
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleVersionCriteria.java
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/EventCriteria.java
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/InstalledPackageCriteria.java
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementDefinitionCriteria.java
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementScheduleCriteria.java
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/OperationDefinitionCriteria.java
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/OperationHistoryCriteria.java
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/PackageVersionCriteria.java
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/RepoCriteria.java
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupCriteria.java
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceTypeCriteria.java
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/RoleCriteria.java
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/SavedSearchCriteria.java
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/SubjectCriteria.java
modules/enterprise/gui/portal-war/src/main/webapp/admin/test/browser.jsp
modules/plugins/hibernate/src/test/java/org/rhq/plugins/hibernate/test/HibernatePluginTest.java
commit c0dcf32e450b23919c7be56dc8cea8d06b9f15d9
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Mar 8 13:54:36 2010 -0500
forgot to add the bundle service to the gwt.xml
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
index ecdd6a1..ad288af 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
@@ -43,5 +43,6 @@
<servlet path="/MeasurementDataGWTService" class="org.rhq.enterprise.gui.coregui.server.gwt.MeasurementDataGWTServiceImpl"/>
<servlet path="/AlertGWTService" class="org.rhq.enterprise.gui.coregui.server.gwt.AlertGWTServiceImpl"/>
<servlet path="/OperationGWTService" class="org.rhq.enterprise.gui.coregui.server.gwt.OperationGWTServiceImpl"/>
+ <servlet path="/BundleGWTService" class="org.rhq.enterprise.gui.coregui.server.gwt.BundleGWTServiceImpl"/>
</module>
\ No newline at end of file
commit e4a61cf2f285992d7f70cf6b1c18a0ad78305bbc
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Mar 8 13:44:07 2010 -0500
stub out the rpc service for the bundle endpoint
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java
new file mode 100644
index 0000000..e155553
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java
@@ -0,0 +1,25 @@
+/*
+ * 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.gwt;
+
+import com.google.gwt.user.client.rpc.RemoteService;
+
+public interface BundleGWTService extends RemoteService {
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
new file mode 100644
index 0000000..a87ea8a
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
@@ -0,0 +1,35 @@
+/*
+ * 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.server.gwt;
+
+import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTService;
+import org.rhq.enterprise.gui.coregui.server.util.SerialUtility;
+import org.rhq.enterprise.server.bundle.BundleManagerLocal;
+import org.rhq.enterprise.server.util.LookupUtil;
+
+public class BundleGWTServiceImpl extends AbstractGWTServiceImpl implements BundleGWTService {
+ private static final long serialVersionUID = 1L;
+
+ private BundleManagerLocal bundleManager = LookupUtil.getBundleManager();
+
+ // TODO: this just illustrates how we are to prepare the results for the GWT client on the other end
+ public Object foo() {
+ return SerialUtility.prepare(null, null);
+ }
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml b/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
index d5cf5d2..7edb4ee 100644
--- a/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
+++ b/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
@@ -44,6 +44,10 @@
<servlet-class>org.rhq.enterprise.gui.coregui.server.gwt.OperationGWTServiceImpl
</servlet-class>
</servlet>
+ <servlet>
+ <servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI BundleGWTService</servlet-name>
+ <servlet-class>org.rhq.enterprise.gui.coregui.server.gwt.BundleGWTServiceImpl</servlet-class>
+ </servlet>
<servlet-mapping>
<servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI RoleGWTService</servlet-name>
@@ -81,4 +85,8 @@
<servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI OperationGWTService</servlet-name>
<url-pattern>/org.rhq.enterprise.gui.coregui.CoreGUI/OperationGWTService</url-pattern>
</servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI BundleGWTService</servlet-name>
+ <url-pattern>/org.rhq.enterprise.gui.coregui.CoreGUI/BundleGWTService</url-pattern>
+ </servlet-mapping>
</web-app>
commit 06be1c1d19d1c3100486af1e5d32327f74c077f6
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Mar 8 12:26:49 2010 -0500
add some eclipse external tool defs
diff --git a/etc/eclipse-tools/RHQ Remote Debugging - GWT.launch b/etc/eclipse-tools/RHQ Remote Debugging - GWT.launch
new file mode 100644
index 0000000..2388949
--- /dev/null
+++ b/etc/eclipse-tools/RHQ Remote Debugging - GWT.launch
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.launching.remoteJavaApplication">
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/rhq"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="4"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
+<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.jdt.launching.ALLOW_TERMINATE" value="true"/>
+<mapAttribute key="org.eclipse.jdt.launching.CONNECT_MAP">
+<mapEntry key="port" value="8000"/>
+<mapEntry key="hostname" value="localhost"/>
+</mapAttribute>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="rhq"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_CONNECTOR_ID" value="org.eclipse.jdt.launching.socketAttachConnector"/>
+</launchConfiguration>
diff --git a/etc/eclipse-tools/maven/RHQ Maven Build - Dev Profile Web UI Only (GWT).launch b/etc/eclipse-tools/maven/RHQ Maven Build - Dev Profile Web UI Only (GWT).launch
new file mode 100644
index 0000000..cfe9a0e
--- /dev/null
+++ b/etc/eclipse-tools/maven/RHQ Maven Build - Dev Profile Web UI Only (GWT).launch
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">
+<stringAttribute key="bad_container_name" value="\rhq\etc\eclipse-tools\maven"/>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
+<listEntry value="org.eclipse.ui.externaltools.launchGroup"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${env_var:M2_HOME}/bin/${MAVEN_EXE}"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="-Dmaven.test.skip=true -Pdev gwt:clean install"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/rhq/modules/enterprise/gui/coregui}"/>
+</launchConfiguration>
diff --git a/etc/eclipse-tools/maven/RHQ Maven Build - Run GWT DevMode-JPDA.launch b/etc/eclipse-tools/maven/RHQ Maven Build - Run GWT DevMode-JPDA.launch
new file mode 100644
index 0000000..006034d
--- /dev/null
+++ b/etc/eclipse-tools/maven/RHQ Maven Build - Run GWT DevMode-JPDA.launch
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">
+<stringAttribute key="bad_container_name" value="\rhq\etc\eclipse-tools\maven"/>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
+<listEntry value="org.eclipse.ui.externaltools.launchGroup"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${env_var:M2_HOME}/bin/${MAVEN_EXE}"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="-Dmaven.test.skip=true gwt:debug"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/rhq/modules/enterprise/gui/coregui}"/>
+</launchConfiguration>
diff --git a/etc/eclipse-tools/maven/RHQ Maven Build - Run GWT DevMode.launch b/etc/eclipse-tools/maven/RHQ Maven Build - Run GWT DevMode.launch
new file mode 100644
index 0000000..b69bb01
--- /dev/null
+++ b/etc/eclipse-tools/maven/RHQ Maven Build - Run GWT DevMode.launch
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">
+<stringAttribute key="bad_container_name" value="\rhq\etc\eclipse-tools\maven"/>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
+<listEntry value="org.eclipse.ui.externaltools.launchGroup"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${env_var:M2_HOME}/bin/${MAVEN_EXE}"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="-Dmaven.test.skip=true gwt:run"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/rhq/modules/enterprise/gui/coregui}"/>
+</launchConfiguration>
commit 5ad78660ee027856e0efcc912084beab5933fe12
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Mar 8 12:02:57 2010 -0500
git forced LT commit
diff --git a/modules/core/domain/src/main/java/META-INF/MANIFEST.MF b/modules/core/domain/src/main/java/META-INF/MANIFEST.MF
index 8af660b..f12a0e2 100644
--- a/modules/core/domain/src/main/java/META-INF/MANIFEST.MF
+++ b/modules/core/domain/src/main/java/META-INF/MANIFEST.MF
@@ -1,16 +1,16 @@
-Manifest-Version: 1.0
-Class-Path: i18nlog-1.0.9.jar jaxb-api-2.1.jar stax-api-1.0-2.jar acti
- vation-1.1.jar rhq-core-util-1.4.0-SNAPSHOT.jar jdom-1.0.jar lib/post
- gresql-8.4-701.jdbc3.jar lib/dom4j-1.6.1-jboss.jar lib/xml-apis-1.0.b
- 2.jar lib/i18nlog-1.0.9.jar lib/log4j-1.2.14.jar lib/hibernate-annota
- tions-3.2.1.GA.jar lib/javassist-3.4.ga.jar lib/testng-5.9-jdk15.jar
- lib/junit-3.8.1.jar lib/concurrent-1.3.4.jar lib/commons-collections-
- 3.2.jar lib/hibernate-entitymanager-3.2.1.GA.jar lib/persistence-api-
- 1.0.jar lib/commons-codec-1.4.jar lib/trove-1.0.2.jar lib/cglib-nodep
- -2.1_3.jar lib/jaxb-api-2.1.jar lib/stax-api-1.0-2.jar lib/activation
- -1.1.jar lib/hibernate3-3.2.r14201-2.jar lib/commons-logging-1.1.0.jb
- oss.jar lib/annotations-7.0.2.jar lib/jboss-ejb3-all-1.0.0.Alpha9.jar
- lib/antlr-2.7.7.jar lib/jtds-1.2.2.jar lib/rhq-core-util.jar lib/jdo
- m-1.0.jar lib/h2-1.1.117.jar lib/gwt-user-2.0.0.jar lib/xercesImpl-2.
- 8.1.jar
-
+Manifest-Version: 1.0
+Class-Path: i18nlog-1.0.9.jar jaxb-api-2.1.jar stax-api-1.0-2.jar acti
+ vation-1.1.jar rhq-core-util-1.4.0-SNAPSHOT.jar jdom-1.0.jar lib/post
+ gresql-8.4-701.jdbc3.jar lib/dom4j-1.6.1-jboss.jar lib/xml-apis-1.0.b
+ 2.jar lib/i18nlog-1.0.9.jar lib/log4j-1.2.14.jar lib/hibernate-annota
+ tions-3.2.1.GA.jar lib/javassist-3.4.ga.jar lib/testng-5.9-jdk15.jar
+ lib/junit-3.8.1.jar lib/concurrent-1.3.4.jar lib/commons-collections-
+ 3.2.jar lib/hibernate-entitymanager-3.2.1.GA.jar lib/persistence-api-
+ 1.0.jar lib/commons-codec-1.4.jar lib/trove-1.0.2.jar lib/cglib-nodep
+ -2.1_3.jar lib/jaxb-api-2.1.jar lib/stax-api-1.0-2.jar lib/activation
+ -1.1.jar lib/hibernate3-3.2.r14201-2.jar lib/commons-logging-1.1.0.jb
+ oss.jar lib/annotations-7.0.2.jar lib/jboss-ejb3-all-1.0.0.Alpha9.jar
+ lib/antlr-2.7.7.jar lib/jtds-1.2.2.jar lib/rhq-core-util.jar lib/jdo
+ m-1.0.jar lib/h2-1.1.117.jar lib/gwt-user-2.0.0.jar lib/xercesImpl-2.
+ 8.1.jar
+
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/admin/test/browser.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/admin/test/browser.jsp
index 2d3ad3a..a939783 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/admin/test/browser.jsp
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/admin/test/browser.jsp
@@ -1,253 +1,253 @@
-<%@page contentType="text/html"%>
-<%@page pageEncoding="UTF-8"%>
-<%@ page import="org.hibernate.engine.SessionFactoryImplementor" %>
-<%@ page import="org.rhq.core.server.PersistenceUtility" %>
-<%@ page import="org.rhq.enterprise.gui.legacy.util.SessionUtils" %>
-<%@ page import="org.rhq.enterprise.server.util.LookupUtil" %>
-<%@ page import="javax.naming.InitialContext" %>
-<%@ page import="javax.persistence.EntityManager" %>
-<%@ page import="javax.persistence.EntityManagerFactory" %>
-<%@ page import="javax.persistence.Id" %>
-<%@ page import="java.beans.BeanInfo" %>
-<%@ page import="java.beans.Introspector" %>
-<%@ page import="java.beans.PropertyDescriptor" %>
-<%@ page import="java.beans.PropertyEditor" %>
-<%@ page import="java.beans.PropertyEditorManager" %>
-<%@ page import="java.lang.reflect.Field" %>
-<%@ page import="java.lang.reflect.Method" %>
-<%@ page import="java.util.Collection" %>
-<%@ page import="java.util.Iterator" %>
-<%@ page import="java.util.List" %>
-<%@ page import="java.util.Map" %>
-<%@ page import="java.util.SortedSet" %>
-<%@ page import="java.util.TreeSet" %>
-<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
-
-<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>EJB3 Entity browser</title>
- </head>
- <body>
-
- <jsp:include page="/admin/include/adminTestLinks.html" flush="true" />
-
- <h1>Entity browser</h1>
- ${param.entityClass}
-
- <c:if test="${param.pEntity != null}">
- <c:url var="url" value="browser.jsp?entityClass=${param.pEntity}&key=${param.pKey}"/>
- <a href="${url}">Up to ${param.pEntity} (${param.pKey})</a>
- </c:if>
-
- <%
- InitialContext ic = new InitialContext();
-
- EntityManagerFactory emf = (EntityManagerFactory) ic.lookup("java:/RHQEntityManagerFactory");
- EntityManager em = ((EntityManagerFactory) ic.lookup("java:/RHQEntityManagerFactory"))
- .createEntityManager();
-
-
- org.hibernate.Session s = PersistenceUtility.getHibernateSession(em);
- SessionFactoryImplementor sfi = (SessionFactoryImplementor) s.getSessionFactory();
-
- %>
-
-
- <c:if test="${param.entityClass == null}">
- <c:set var="entityClass" value="org.rhq.core.domain.resource.Resource"/>
-
- <%
-
- Map<String, Object> metadata = sfi.getAllClassMetadata();
- SortedSet<String> classes = new TreeSet<String>(metadata.keySet());
-
- %>
-
- <ul>
-
- <%
- for (String className : classes) {
- Object val = metadata.get(className);
- String url = "browser.jsp?entityClass=" + className;
-
- className = className.replaceFirst(".*\\.(.*\\..*)","$1");
-
- out.println(
- " <li><a href=\"" + url + "\">" + className +"</a></li>");
- }
- %>
-
-
- </ul>
- </c:if>
-
-
- <c:if test="${param.entityClass != null}">
- <c:set var="entityClass" value="${param.entityClass}"/>
- </c:if>
-
- <c:if test="${param.mode == 'delete'}">
- <%
- String entityName = (String)pageContext.getRequest().getParameter("entityClass");
- String key = (String)pageContext.getRequest().getParameter("key");
-
- em.remove(em.find(Class.forName(entityName),key));
- entityName = (String) pageContext.getRequest().getParameter("pEntity");
- key = (String) pageContext.getRequest().getParameter("pKey");
- ((HttpServletResponse)pageContext.getResponse()).sendRedirect(
- "browser.jsp?entityClass=" + entityName + "&key=" + key);
- if (true)
- return;
- %></c:if>
-
-
- <c:if test="${param.key == null}">
- <h3>Listing ${entityClass}</h3>
- <%
- String entityName = (String)pageContext.findAttribute("entityClass");
- entityName = entityName.substring(entityName.lastIndexOf('.')+1);
- List values = em.createQuery("from " + entityName + " d").setMaxResults(100).getResultList();
-
- pageContext.setAttribute("values", values);%>
- <c:forEach var="entity" items="${values}">
- <c:url var="url" value="browser.jsp?entityClass=${entityClass}&key=${entity.id}"/>
- <a href="${url}">${entity}</a><br>
- </c:forEach>
-
- </c:if>
-
- <c:if test="${param.key != null}">
- <c:url var="url" value="browser.jsp?entityClass=${entityClass}"/>
- <h3>Details of ${entityClass} (${param.key})</h3>
- <a href="${url}">List all ${entityClass}</a><br>
- <%
- Class entityType = Class.forName((String)pageContext.findAttribute("entityClass"));
- Object entity = em.find(entityType,
- getConvertedKey(entityType,
- pageContext.getRequest().getParameter("key")));
- pageContext.setAttribute("entity",entity);
-
-
- BeanInfo beanInfo = Introspector.getBeanInfo(entity.getClass());
- PropertyDescriptor[] pds = beanInfo.getPropertyDescriptors();
- int ln = pds.length;
- %>
- <c:set var="entity" value="${entity}"/>
- String view: ${entity}
-
- <h4>Simple Properties</h4>
- <table border="1"><tr><td align="right"><b>Name</b></td><td><b>Value</b></td></tr>
- <%
- int i = 0;
- for (i = 0; i < ln; i++) {
- PropertyDescriptor pd = pds[i];
-
- if (!Collection.class.isAssignableFrom(pd.getPropertyType()) ) {
- out.println("<tr><td align='right'><b>" + pd.getName() + ": </b></td><td>");
-
- Object reference = pd.getReadMethod() == null ? "-cant read-" : pd.getReadMethod().invoke(entity, new Object[]{});
- if (reference != null && reference.getClass().getName().startsWith("org.rhq.core.domain")) {
- java.lang.reflect.Method idMethod = null;
- try {
- idMethod = reference.getClass().getMethod("getId", new Class[0]);
- } catch (NoSuchMethodException nsme) { }
- if (idMethod != null) {
- try {
- Object id = idMethod.invoke(reference,new Object[0]);
- pageContext.setAttribute("child", reference);
- String className = reference.getClass().getName();
- if (className.indexOf('_') > 0) {
- className = className.substring(0,className.indexOf('_'));
- }
- pageContext.setAttribute("cType", className);
-
- %>
- <c:url var="url" value="browser.jsp?entityClass=${cType}&key=${child.id}&pEntity=${entityClass}&pKey=${param.key}"/>
- <a href="${url}">${child}</a><br>
- <%
- } catch (Exception e) { out.println("{exception: " + e.toString() + "}"); }
- } else {
- try {
- out.println(reference);
- } catch (Exception e) { out.println("<i>" + e.getClass().getSimpleName() + "</i>"); }
- }
- } else {
- try {
- out.println(reference);
- } catch (Exception e) { out.println("<i>" + e.getClass().getSimpleName() + "</i>"); }
- }
-
- out.println("</td></tr>");
- }
- }
- %>
- </table>
-
-
- <%
- for (i = 0; i < ln; i++) {
- PropertyDescriptor pd = pds[i];
- if (Collection.class.isAssignableFrom(pd.getPropertyType())) {
- out.println("<h4>" + pd.getName() + ": </h4><ul>");
-
- Method readMethod = pd.getReadMethod();
- if (readMethod != null) {
- Collection c = (Collection) readMethod.invoke(entity, new Object[]{});
- for (Iterator iter = c.iterator(); iter.hasNext(); ) {
- Object child = iter.next();
- pageContext.setAttribute("child", child);
- pageContext.setAttribute("cType", child.getClass().getName());
- %>
- <c:catch var="foo">
- <li><c:url var="url" value="browser.jsp?entityClass=${cType}&key=${child.id}&pEntity=${entityClass}&pKey=${param.key}"/>
- <a href="${url}">${child}</a>
-
- <c:url var="url" value="browser.jsp?entityClass=${cType}&key=${child.id}&pEntity=${entityClass}&pKey=${param.key}&mode=delete"/>
- <a href="${url}"><font color="red">x</font></a>
-
- </li>
- </c:catch>
- <%
- }
- }
- out.write("</ul>");
- }
- }
- %>
-
-
- </c:if>
-
-
- <%!
- public Object getConvertedKey(Class type, Object key) {
- Class keyType = getKeyType(type);
- System.out.println("Key type is: " + keyType);
- PropertyEditor ed = PropertyEditorManager.findEditor(keyType);
- if (ed != null) {
- ed.setAsText(String.valueOf(key));
- return ed.getValue();
- } else {
- return key;
- }
- }
-
- public Class getKeyType(Class type) {
- Field[] fields = type.getDeclaredFields();
- for (Field f : fields) {
- Id id = f.getAnnotation(javax.persistence.Id.class);
- if (id != null) {
- return f.getType();
- }
- }
-
- return Integer.class;
- }
-
- %>
- </body>
-</html>
+<%@page contentType="text/html"%>
+<%@page pageEncoding="UTF-8"%>
+<%@ page import="org.hibernate.engine.SessionFactoryImplementor" %>
+<%@ page import="org.rhq.core.server.PersistenceUtility" %>
+<%@ page import="org.rhq.enterprise.gui.legacy.util.SessionUtils" %>
+<%@ page import="org.rhq.enterprise.server.util.LookupUtil" %>
+<%@ page import="javax.naming.InitialContext" %>
+<%@ page import="javax.persistence.EntityManager" %>
+<%@ page import="javax.persistence.EntityManagerFactory" %>
+<%@ page import="javax.persistence.Id" %>
+<%@ page import="java.beans.BeanInfo" %>
+<%@ page import="java.beans.Introspector" %>
+<%@ page import="java.beans.PropertyDescriptor" %>
+<%@ page import="java.beans.PropertyEditor" %>
+<%@ page import="java.beans.PropertyEditorManager" %>
+<%@ page import="java.lang.reflect.Field" %>
+<%@ page import="java.lang.reflect.Method" %>
+<%@ page import="java.util.Collection" %>
+<%@ page import="java.util.Iterator" %>
+<%@ page import="java.util.List" %>
+<%@ page import="java.util.Map" %>
+<%@ page import="java.util.SortedSet" %>
+<%@ page import="java.util.TreeSet" %>
+<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>EJB3 Entity browser</title>
+ </head>
+ <body>
+
+ <jsp:include page="/admin/include/adminTestLinks.html" flush="true" />
+
+ <h1>Entity browser</h1>
+ ${param.entityClass}
+
+ <c:if test="${param.pEntity != null}">
+ <c:url var="url" value="browser.jsp?entityClass=${param.pEntity}&key=${param.pKey}"/>
+ <a href="${url}">Up to ${param.pEntity} (${param.pKey})</a>
+ </c:if>
+
+ <%
+ InitialContext ic = new InitialContext();
+
+ EntityManagerFactory emf = (EntityManagerFactory) ic.lookup("java:/RHQEntityManagerFactory");
+ EntityManager em = ((EntityManagerFactory) ic.lookup("java:/RHQEntityManagerFactory"))
+ .createEntityManager();
+
+
+ org.hibernate.Session s = PersistenceUtility.getHibernateSession(em);
+ SessionFactoryImplementor sfi = (SessionFactoryImplementor) s.getSessionFactory();
+
+ %>
+
+
+ <c:if test="${param.entityClass == null}">
+ <c:set var="entityClass" value="org.rhq.core.domain.resource.Resource"/>
+
+ <%
+
+ Map<String, Object> metadata = sfi.getAllClassMetadata();
+ SortedSet<String> classes = new TreeSet<String>(metadata.keySet());
+
+ %>
+
+ <ul>
+
+ <%
+ for (String className : classes) {
+ Object val = metadata.get(className);
+ String url = "browser.jsp?entityClass=" + className;
+
+ className = className.replaceFirst(".*\\.(.*\\..*)","$1");
+
+ out.println(
+ " <li><a href=\"" + url + "\">" + className +"</a></li>");
+ }
+ %>
+
+
+ </ul>
+ </c:if>
+
+
+ <c:if test="${param.entityClass != null}">
+ <c:set var="entityClass" value="${param.entityClass}"/>
+ </c:if>
+
+ <c:if test="${param.mode == 'delete'}">
+ <%
+ String entityName = (String)pageContext.getRequest().getParameter("entityClass");
+ String key = (String)pageContext.getRequest().getParameter("key");
+
+ em.remove(em.find(Class.forName(entityName),key));
+ entityName = (String) pageContext.getRequest().getParameter("pEntity");
+ key = (String) pageContext.getRequest().getParameter("pKey");
+ ((HttpServletResponse)pageContext.getResponse()).sendRedirect(
+ "browser.jsp?entityClass=" + entityName + "&key=" + key);
+ if (true)
+ return;
+ %></c:if>
+
+
+ <c:if test="${param.key == null}">
+ <h3>Listing ${entityClass}</h3>
+ <%
+ String entityName = (String)pageContext.findAttribute("entityClass");
+ entityName = entityName.substring(entityName.lastIndexOf('.')+1);
+ List values = em.createQuery("from " + entityName + " d").setMaxResults(100).getResultList();
+
+ pageContext.setAttribute("values", values);%>
+ <c:forEach var="entity" items="${values}">
+ <c:url var="url" value="browser.jsp?entityClass=${entityClass}&key=${entity.id}"/>
+ <a href="${url}">${entity}</a><br>
+ </c:forEach>
+
+ </c:if>
+
+ <c:if test="${param.key != null}">
+ <c:url var="url" value="browser.jsp?entityClass=${entityClass}"/>
+ <h3>Details of ${entityClass} (${param.key})</h3>
+ <a href="${url}">List all ${entityClass}</a><br>
+ <%
+ Class entityType = Class.forName((String)pageContext.findAttribute("entityClass"));
+ Object entity = em.find(entityType,
+ getConvertedKey(entityType,
+ pageContext.getRequest().getParameter("key")));
+ pageContext.setAttribute("entity",entity);
+
+
+ BeanInfo beanInfo = Introspector.getBeanInfo(entity.getClass());
+ PropertyDescriptor[] pds = beanInfo.getPropertyDescriptors();
+ int ln = pds.length;
+ %>
+ <c:set var="entity" value="${entity}"/>
+ String view: ${entity}
+
+ <h4>Simple Properties</h4>
+ <table border="1"><tr><td align="right"><b>Name</b></td><td><b>Value</b></td></tr>
+ <%
+ int i = 0;
+ for (i = 0; i < ln; i++) {
+ PropertyDescriptor pd = pds[i];
+
+ if (!Collection.class.isAssignableFrom(pd.getPropertyType()) ) {
+ out.println("<tr><td align='right'><b>" + pd.getName() + ": </b></td><td>");
+
+ Object reference = pd.getReadMethod() == null ? "-cant read-" : pd.getReadMethod().invoke(entity, new Object[]{});
+ if (reference != null && reference.getClass().getName().startsWith("org.rhq.core.domain")) {
+ java.lang.reflect.Method idMethod = null;
+ try {
+ idMethod = reference.getClass().getMethod("getId", new Class[0]);
+ } catch (NoSuchMethodException nsme) { }
+ if (idMethod != null) {
+ try {
+ Object id = idMethod.invoke(reference,new Object[0]);
+ pageContext.setAttribute("child", reference);
+ String className = reference.getClass().getName();
+ if (className.indexOf('_') > 0) {
+ className = className.substring(0,className.indexOf('_'));
+ }
+ pageContext.setAttribute("cType", className);
+
+ %>
+ <c:url var="url" value="browser.jsp?entityClass=${cType}&key=${child.id}&pEntity=${entityClass}&pKey=${param.key}"/>
+ <a href="${url}">${child}</a><br>
+ <%
+ } catch (Exception e) { out.println("{exception: " + e.toString() + "}"); }
+ } else {
+ try {
+ out.println(reference);
+ } catch (Exception e) { out.println("<i>" + e.getClass().getSimpleName() + "</i>"); }
+ }
+ } else {
+ try {
+ out.println(reference);
+ } catch (Exception e) { out.println("<i>" + e.getClass().getSimpleName() + "</i>"); }
+ }
+
+ out.println("</td></tr>");
+ }
+ }
+ %>
+ </table>
+
+
+ <%
+ for (i = 0; i < ln; i++) {
+ PropertyDescriptor pd = pds[i];
+ if (Collection.class.isAssignableFrom(pd.getPropertyType())) {
+ out.println("<h4>" + pd.getName() + ": </h4><ul>");
+
+ Method readMethod = pd.getReadMethod();
+ if (readMethod != null) {
+ Collection c = (Collection) readMethod.invoke(entity, new Object[]{});
+ for (Iterator iter = c.iterator(); iter.hasNext(); ) {
+ Object child = iter.next();
+ pageContext.setAttribute("child", child);
+ pageContext.setAttribute("cType", child.getClass().getName());
+ %>
+ <c:catch var="foo">
+ <li><c:url var="url" value="browser.jsp?entityClass=${cType}&key=${child.id}&pEntity=${entityClass}&pKey=${param.key}"/>
+ <a href="${url}">${child}</a>
+
+ <c:url var="url" value="browser.jsp?entityClass=${cType}&key=${child.id}&pEntity=${entityClass}&pKey=${param.key}&mode=delete"/>
+ <a href="${url}"><font color="red">x</font></a>
+
+ </li>
+ </c:catch>
+ <%
+ }
+ }
+ out.write("</ul>");
+ }
+ }
+ %>
+
+
+ </c:if>
+
+
+ <%!
+ public Object getConvertedKey(Class type, Object key) {
+ Class keyType = getKeyType(type);
+ System.out.println("Key type is: " + keyType);
+ PropertyEditor ed = PropertyEditorManager.findEditor(keyType);
+ if (ed != null) {
+ ed.setAsText(String.valueOf(key));
+ return ed.getValue();
+ } else {
+ return key;
+ }
+ }
+
+ public Class getKeyType(Class type) {
+ Field[] fields = type.getDeclaredFields();
+ for (Field f : fields) {
+ Id id = f.getAnnotation(javax.persistence.Id.class);
+ if (id != null) {
+ return f.getType();
+ }
+ }
+
+ return Integer.class;
+ }
+
+ %>
+ </body>
+</html>
diff --git a/modules/enterprise/server/jar/src/main/java/META-INF/MANIFEST.MF b/modules/enterprise/server/jar/src/main/java/META-INF/MANIFEST.MF
index 538ff09..d44827d 100644
--- a/modules/enterprise/server/jar/src/main/java/META-INF/MANIFEST.MF
+++ b/modules/enterprise/server/jar/src/main/java/META-INF/MANIFEST.MF
@@ -1,42 +1,42 @@
-Manifest-Version: 1.0
-Class-Path: i18nlog-1.0.9.jar junit-3.8.1.jar rhq-enterprise-comm-1.4.
- 0-SNAPSHOT.jar rhq-core-util-1.4.0-SNAPSHOT.jar jdom-1.0.jar rhq-core
- -comm-api-1.4.0-SNAPSHOT.jar dom4j-1.6.1-jboss.jar getopt-1.0.13.jar
- jboss-remoting-2.2.2.SP8.jar jboss-serialization-1.0.3.GA.jar concurr
- ent-1.3.4.jar rhq-enterprise-server-xml-schemas-1.4.0-SNAPSHOT.jar rh
- q-core-client-api-1.4.0-SNAPSHOT.jar jaxb-impl-2.1.6.jar rhq-core-dbu
- tils-1.4.0-SNAPSHOT.jar ant-1.6.5.jar safe-invoker-1.4.0-SNAPSHOT.jar
- jbossws-native-core-3.1.1.GA.jar jbossws-spi-1.1.1.GA.jar commons-be
- anutils-1.6.1.jar commons-collections-3.2.jar commons-httpclient-3.0.
- 1.jar commons-codec-1.2.jar commons-validator-1.1.4.jar xml-apis-1.0.
- b2.jar jboss-cache-1.4.1.SP9.jar jbpm-3.1.1.jar snmp4j-1.8.2.jar post
- gresql-8.4-701.jdbc3.jar rss4j-0.92-on.2.jar lib/postgresql-8.4-701.j
- dbc3.jar lib/i18nlog-1.0.9.jar lib/log4j-1.2.14.jar lib/hibernate-ann
- otations-3.2.1.GA.jar lib/jboss-system-4.2.3.GA.jar lib/commons-valid
- ator-1.1.4.jar lib/concurrent-1.3.4.jar lib/junit-3.8.1.jar lib/catal
- ina-5.5.20.jar lib/hibernate-entitymanager-3.2.1.GA.jar lib/persisten
- ce-api-1.0.jar lib/quartz-oracle-1.6.5.jar lib/rss4j-0.92-on.2.jar li
- b/easymockclassextension-2.2.jar lib/easymock-2.2.jar lib/cglib-nodep
- -2.1_3.jar lib/snmp4j-1.8.2.jar lib/jboss-annotations-ejb3-4.2.3.GA.j
- ar lib/xalan-2.5.1.jar lib/jboss-cache-1.4.1.SP9.jar lib/hibernate3-3
- .2.r14201-2.jar lib/rhq-core-util.jar lib/jdom-1.0.jar lib/jaxb-api-2
- .1.jar lib/stax-api-1.0-2.jar lib/activation-1.1.jar lib/annotations-
- 7.0.2.jar lib/commons-logging-1.1.0.jboss.jar lib/jboss-ejb3-all-1.0.
- 0.Alpha9.jar lib/rhq-enterprise-server-xml-schemas.jar lib/rhq-core-c
- lient-api.jar lib/jaxb-impl-2.1.6.jar lib/antlr-2.7.7.jar lib/quartz-
- 1.6.5.jar lib/jboss-j2ee-4.2.3.GA.jar lib/rhq-enterprise-comm.jar lib
- /rhq-core-comm-api.jar lib/dom4j-1.6.1-jboss.jar lib/getopt-1.0.13.ja
- r lib/jboss-common-1.2.1.GA.jar lib/jboss-jmx-4.2.3.GA.jar lib/jboss-
- remoting-2.2.2.SP8.jar lib/jboss-serialization-1.0.3.GA.jar lib/jsp-a
- pi-2.0.jar lib/servlet-api-2.4.jar lib/xml-apis-1.0.b2.jar lib/testng
- -5.9-jdk15.jar lib/commons-beanutils-1.6.1.jar lib/commons-collection
- s-3.2.jar lib/commons-httpclient-3.0.1.jar lib/commons-codec-1.2.jar
- lib/commons-lang-2.4.jar lib/mail-1.3.1.jar lib/trove-1.0.2.jar lib/j
- bpm-3.1.1.jar lib/javassist-3.8.0.GA.jar lib/jbosssx-4.2.3.GA.jar lib
- /safe-invoker.jar lib/jbossws-native-core-3.1.1.GA.jar lib/jbossws-sp
- i-1.1.1.GA.jar lib/rhq-core-dbutils.jar lib/ant-1.6.5.jar lib/jboss-e
- jb3x-4.2.3.GA.jar lib/tomcat-jk-4.1.31.jar lib/test-utils.jar lib/jmo
- ck-2.5.1.jar lib/hamcrest-core-1.1.jar lib/hamcrest-library-1.1.jar l
- ib/xercesImpl-2.8.1.jar lib/jboss-jta-4.2.3.SP7.jar lib/jboss-jts-com
- mon-4.2.3.SP7.jar lib/rhq-core-domain.jar
-
+Manifest-Version: 1.0
+Class-Path: i18nlog-1.0.9.jar junit-3.8.1.jar rhq-enterprise-comm-1.4.
+ 0-SNAPSHOT.jar rhq-core-util-1.4.0-SNAPSHOT.jar jdom-1.0.jar rhq-core
+ -comm-api-1.4.0-SNAPSHOT.jar dom4j-1.6.1-jboss.jar getopt-1.0.13.jar
+ jboss-remoting-2.2.2.SP8.jar jboss-serialization-1.0.3.GA.jar concurr
+ ent-1.3.4.jar rhq-enterprise-server-xml-schemas-1.4.0-SNAPSHOT.jar rh
+ q-core-client-api-1.4.0-SNAPSHOT.jar jaxb-impl-2.1.6.jar rhq-core-dbu
+ tils-1.4.0-SNAPSHOT.jar ant-1.6.5.jar safe-invoker-1.4.0-SNAPSHOT.jar
+ jbossws-native-core-3.1.1.GA.jar jbossws-spi-1.1.1.GA.jar commons-be
+ anutils-1.6.1.jar commons-collections-3.2.jar commons-httpclient-3.0.
+ 1.jar commons-codec-1.2.jar commons-validator-1.1.4.jar xml-apis-1.0.
+ b2.jar jboss-cache-1.4.1.SP9.jar jbpm-3.1.1.jar snmp4j-1.8.2.jar post
+ gresql-8.4-701.jdbc3.jar rss4j-0.92-on.2.jar lib/postgresql-8.4-701.j
+ dbc3.jar lib/i18nlog-1.0.9.jar lib/log4j-1.2.14.jar lib/hibernate-ann
+ otations-3.2.1.GA.jar lib/jboss-system-4.2.3.GA.jar lib/commons-valid
+ ator-1.1.4.jar lib/concurrent-1.3.4.jar lib/junit-3.8.1.jar lib/catal
+ ina-5.5.20.jar lib/hibernate-entitymanager-3.2.1.GA.jar lib/persisten
+ ce-api-1.0.jar lib/quartz-oracle-1.6.5.jar lib/rss4j-0.92-on.2.jar li
+ b/easymockclassextension-2.2.jar lib/easymock-2.2.jar lib/cglib-nodep
+ -2.1_3.jar lib/snmp4j-1.8.2.jar lib/jboss-annotations-ejb3-4.2.3.GA.j
+ ar lib/xalan-2.5.1.jar lib/jboss-cache-1.4.1.SP9.jar lib/hibernate3-3
+ .2.r14201-2.jar lib/rhq-core-util.jar lib/jdom-1.0.jar lib/jaxb-api-2
+ .1.jar lib/stax-api-1.0-2.jar lib/activation-1.1.jar lib/annotations-
+ 7.0.2.jar lib/commons-logging-1.1.0.jboss.jar lib/jboss-ejb3-all-1.0.
+ 0.Alpha9.jar lib/rhq-enterprise-server-xml-schemas.jar lib/rhq-core-c
+ lient-api.jar lib/jaxb-impl-2.1.6.jar lib/antlr-2.7.7.jar lib/quartz-
+ 1.6.5.jar lib/jboss-j2ee-4.2.3.GA.jar lib/rhq-enterprise-comm.jar lib
+ /rhq-core-comm-api.jar lib/dom4j-1.6.1-jboss.jar lib/getopt-1.0.13.ja
+ r lib/jboss-common-1.2.1.GA.jar lib/jboss-jmx-4.2.3.GA.jar lib/jboss-
+ remoting-2.2.2.SP8.jar lib/jboss-serialization-1.0.3.GA.jar lib/jsp-a
+ pi-2.0.jar lib/servlet-api-2.4.jar lib/xml-apis-1.0.b2.jar lib/testng
+ -5.9-jdk15.jar lib/commons-beanutils-1.6.1.jar lib/commons-collection
+ s-3.2.jar lib/commons-httpclient-3.0.1.jar lib/commons-codec-1.2.jar
+ lib/commons-lang-2.4.jar lib/mail-1.3.1.jar lib/trove-1.0.2.jar lib/j
+ bpm-3.1.1.jar lib/javassist-3.8.0.GA.jar lib/jbosssx-4.2.3.GA.jar lib
+ /safe-invoker.jar lib/jbossws-native-core-3.1.1.GA.jar lib/jbossws-sp
+ i-1.1.1.GA.jar lib/rhq-core-dbutils.jar lib/ant-1.6.5.jar lib/jboss-e
+ jb3x-4.2.3.GA.jar lib/tomcat-jk-4.1.31.jar lib/test-utils.jar lib/jmo
+ ck-2.5.1.jar lib/hamcrest-core-1.1.jar lib/hamcrest-library-1.1.jar l
+ ib/xercesImpl-2.8.1.jar lib/jboss-jta-4.2.3.SP7.jar lib/jboss-jts-com
+ mon-4.2.3.SP7.jar lib/rhq-core-domain.jar
+
commit 1a102674189d5bbc4c27a355192b6fd13e0d789a
Merge: fd8fcb7... da6c146...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Mar 8 11:12:38 2010 -0500
Merge branch 'bundle' into gwt
Conflicts:
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
diff --cc modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
index 1f6d304,67cbaf6..b213501
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
@@@ -60,8 -65,9 +65,8 @@@ import org.rhq.core.domain.criteria.Bun
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.util.PageList;
- import org.rhq.core.server.PersistenceUtility;
-import org.rhq.core.domain.util.PersistenceUtility;
import org.rhq.enterprise.server.RHQConstants;
+ import org.rhq.enterprise.server.agentclient.AgentClient;
import org.rhq.enterprise.server.authz.AuthorizationManagerLocal;
import org.rhq.enterprise.server.authz.PermissionException;
import org.rhq.enterprise.server.authz.RequiredPermission;
@@@ -447,15 -495,15 +494,6 @@@ public class BundleManagerBean implemen
}
public PageList<Bundle> findBundlesByCriteria(Subject subject, BundleCriteria criteria) {
-- Query totalCountQuery = PersistenceUtility.createCountQuery(entityManager, Bundle.QUERY_FIND_ALL);
-- long totalCount = (Long) totalCountQuery.getSingleResult();
-- if (totalCount == 0) {
-- List<BundleType> bundleTypes = getAllBundleTypes(subject);
-- for (int i = 0; i < 50; i++) {
-- createMockBundle(subject, bundleTypes);
-- }
-- }
--
CriteriaQueryGenerator generator = new CriteriaQueryGenerator(criteria);
CriteriaQueryRunner<Bundle> queryRunner = new CriteriaQueryRunner<Bundle>(criteria, generator, entityManager);
commit fd8fcb73f3845b3fbf2efa5f8b84a385b324f081
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Mar 8 10:59:03 2010 -0500
git forced LT commin
diff --git a/modules/plugins/hibernate/src/test/java/org/rhq/plugins/hibernate/test/HibernatePluginTest.java b/modules/plugins/hibernate/src/test/java/org/rhq/plugins/hibernate/test/HibernatePluginTest.java
index a66b5db..d058626 100644
--- a/modules/plugins/hibernate/src/test/java/org/rhq/plugins/hibernate/test/HibernatePluginTest.java
+++ b/modules/plugins/hibernate/src/test/java/org/rhq/plugins/hibernate/test/HibernatePluginTest.java
@@ -1,145 +1,145 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc. All rights reserved.
- */
-
-package org.rhq.plugins.hibernate.test;
-
-import java.io.File;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.testng.annotations.AfterSuite;
-import org.testng.annotations.BeforeSuite;
-import org.testng.annotations.Test;
-
-import org.rhq.core.clientapi.server.discovery.InventoryReport;
-import org.rhq.core.domain.measurement.MeasurementData;
-import org.rhq.core.domain.measurement.MeasurementDefinition;
-import org.rhq.core.domain.measurement.MeasurementReport;
-import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
-import org.rhq.core.domain.resource.Resource;
-import org.rhq.core.pluginapi.inventory.ResourceComponent;
-import org.rhq.core.pluginapi.measurement.MeasurementFacet;
-import org.rhq.core.pc.PluginContainer;
-import org.rhq.core.pc.PluginContainerConfiguration;
-import org.rhq.core.pc.plugin.FileSystemPluginFinder;
-import org.rhq.core.pc.plugin.PluginEnvironment;
-import org.rhq.core.pc.plugin.PluginManager;
-
-/**
- * @author Greg Hinkle
- */
-@Test(groups = "hibernate-plugin")
-public class HibernatePluginTest
-{
- private Log log = LogFactory.getLog(HibernatePluginTest.class);
- private static final String PLUGIN_NAME = "Hibernate";
-
- @BeforeSuite
- public void start()
- {
- try
- {
- File pluginDir = new File("target/itest/plugins");
- PluginContainerConfiguration pcConfig = new PluginContainerConfiguration();
- pcConfig.setPluginFinder(new FileSystemPluginFinder(pluginDir));
- pcConfig.setPluginDirectory(pluginDir);
-
- pcConfig.setInsideAgent(false);
- PluginContainer.getInstance().setConfiguration(pcConfig);
- PluginContainer.getInstance().initialize();
- log.info("PC started.");
- for (String plugin : PluginContainer.getInstance().getPluginManager().getMetadataManager().getPluginNames()) {
- log.info("...Loaded plugin: " + plugin);
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- @AfterSuite
- public void stop()
- {
- PluginContainer.getInstance().shutdown();
- }
-
- @Test
- public void testPluginLoad()
- {
- PluginManager pluginManager = PluginContainer.getInstance().getPluginManager();
- PluginEnvironment pluginEnvironment = pluginManager.getPlugin(PLUGIN_NAME);
- assert (pluginEnvironment != null) : "Null environment, plugin not loaded";
- assert (pluginEnvironment.getPluginName().equals(PLUGIN_NAME));
- }
-
- @Test(dependsOnMethods = "testPluginLoad")
- public void testDiscovery() throws Exception
- {
- InventoryReport report = PluginContainer.getInstance().getInventoryManager().executeServerScanImmediately();
- assert report != null;
- System.out.println("Discovery took: " + (report.getEndTime() - report.getStartTime()) + "ms");
-
- report = PluginContainer.getInstance().getInventoryManager().executeServiceScanImmediately();
- assert report != null;
- System.out.println("Discovery took: " + (report.getEndTime() - report.getStartTime()) + "ms");
-
- Set<Resource> resources = findResource(PluginContainer.getInstance().getInventoryManager().getPlatform(), "Hibernate Statistics");
- System.out.println("Found " + resources.size() + " hibernate services");
- }
-
- @Test(dependsOnMethods = "testDiscovery")
- public void testMeasurement() throws Exception
- {
- for (Resource server : findResource(PluginContainer.getInstance().getInventoryManager().getPlatform(), "Hibernate Statistics"))
- {
- testResourceMeasurement(server);
- }
- }
-
- private Set<Resource> findResource(Resource parent, String typeName)
- {
- Set<Resource> found = new HashSet<Resource>();
- @SuppressWarnings({"UnnecessaryLocalVariable"})
- Resource platform = parent;
- for (Resource resource : platform.getChildResources())
- {
- if (resource.getResourceType().getName().equals(typeName))
- {
- found.add(resource);
- }
- if (resource.getChildResources() != null)
- {
- for (Resource child : found)
- {
- found.addAll(findResource(child,typeName));
- }
- }
- }
- return found;
- }
-
- private void testResourceMeasurement(Resource resource)throws Exception
- {
- ResourceComponent resourceComponent = PluginContainer.getInstance().getInventoryManager().getResourceComponent(resource);
- if (resourceComponent instanceof MeasurementFacet)
- {
- for (MeasurementDefinition def : resource.getResourceType().getMetricDefinitions())
- {
- Set<MeasurementScheduleRequest> metricList = new HashSet<MeasurementScheduleRequest>();
- metricList.add(new MeasurementScheduleRequest(1, def.getName(), 1000, true, def.getDataType(), null));
- MeasurementReport report = new MeasurementReport();
- ((MeasurementFacet) resourceComponent).getValues(report, metricList);
-
- assert report.getNumericData().size() > 0 : "Measurement " + def.getName() + " not collected from " + resource;
- MeasurementData data = report.getNumericData().iterator().next();
- assert data != null : "Unable to collect metric [" + def.getName() + "] on " + resource;
- System.out.println("Measurement: " + def.getName() + "=" + data.getValue());
- }
- }
- }
-}
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc. All rights reserved.
+ */
+
+package org.rhq.plugins.hibernate.test;
+
+import java.io.File;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.testng.annotations.AfterSuite;
+import org.testng.annotations.BeforeSuite;
+import org.testng.annotations.Test;
+
+import org.rhq.core.clientapi.server.discovery.InventoryReport;
+import org.rhq.core.domain.measurement.MeasurementData;
+import org.rhq.core.domain.measurement.MeasurementDefinition;
+import org.rhq.core.domain.measurement.MeasurementReport;
+import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.pluginapi.inventory.ResourceComponent;
+import org.rhq.core.pluginapi.measurement.MeasurementFacet;
+import org.rhq.core.pc.PluginContainer;
+import org.rhq.core.pc.PluginContainerConfiguration;
+import org.rhq.core.pc.plugin.FileSystemPluginFinder;
+import org.rhq.core.pc.plugin.PluginEnvironment;
+import org.rhq.core.pc.plugin.PluginManager;
+
+/**
+ * @author Greg Hinkle
+ */
+@Test(groups = "hibernate-plugin")
+public class HibernatePluginTest
+{
+ private Log log = LogFactory.getLog(HibernatePluginTest.class);
+ private static final String PLUGIN_NAME = "Hibernate";
+
+ @BeforeSuite
+ public void start()
+ {
+ try
+ {
+ File pluginDir = new File("target/itest/plugins");
+ PluginContainerConfiguration pcConfig = new PluginContainerConfiguration();
+ pcConfig.setPluginFinder(new FileSystemPluginFinder(pluginDir));
+ pcConfig.setPluginDirectory(pluginDir);
+
+ pcConfig.setInsideAgent(false);
+ PluginContainer.getInstance().setConfiguration(pcConfig);
+ PluginContainer.getInstance().initialize();
+ log.info("PC started.");
+ for (String plugin : PluginContainer.getInstance().getPluginManager().getMetadataManager().getPluginNames()) {
+ log.info("...Loaded plugin: " + plugin);
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ @AfterSuite
+ public void stop()
+ {
+ PluginContainer.getInstance().shutdown();
+ }
+
+ @Test
+ public void testPluginLoad()
+ {
+ PluginManager pluginManager = PluginContainer.getInstance().getPluginManager();
+ PluginEnvironment pluginEnvironment = pluginManager.getPlugin(PLUGIN_NAME);
+ assert (pluginEnvironment != null) : "Null environment, plugin not loaded";
+ assert (pluginEnvironment.getPluginName().equals(PLUGIN_NAME));
+ }
+
+ @Test(dependsOnMethods = "testPluginLoad")
+ public void testDiscovery() throws Exception
+ {
+ InventoryReport report = PluginContainer.getInstance().getInventoryManager().executeServerScanImmediately();
+ assert report != null;
+ System.out.println("Discovery took: " + (report.getEndTime() - report.getStartTime()) + "ms");
+
+ report = PluginContainer.getInstance().getInventoryManager().executeServiceScanImmediately();
+ assert report != null;
+ System.out.println("Discovery took: " + (report.getEndTime() - report.getStartTime()) + "ms");
+
+ Set<Resource> resources = findResource(PluginContainer.getInstance().getInventoryManager().getPlatform(), "Hibernate Statistics");
+ System.out.println("Found " + resources.size() + " hibernate services");
+ }
+
+ @Test(dependsOnMethods = "testDiscovery")
+ public void testMeasurement() throws Exception
+ {
+ for (Resource server : findResource(PluginContainer.getInstance().getInventoryManager().getPlatform(), "Hibernate Statistics"))
+ {
+ testResourceMeasurement(server);
+ }
+ }
+
+ private Set<Resource> findResource(Resource parent, String typeName)
+ {
+ Set<Resource> found = new HashSet<Resource>();
+ @SuppressWarnings({"UnnecessaryLocalVariable"})
+ Resource platform = parent;
+ for (Resource resource : platform.getChildResources())
+ {
+ if (resource.getResourceType().getName().equals(typeName))
+ {
+ found.add(resource);
+ }
+ if (resource.getChildResources() != null)
+ {
+ for (Resource child : found)
+ {
+ found.addAll(findResource(child,typeName));
+ }
+ }
+ }
+ return found;
+ }
+
+ private void testResourceMeasurement(Resource resource)throws Exception
+ {
+ ResourceComponent resourceComponent = PluginContainer.getInstance().getInventoryManager().getResourceComponent(resource);
+ if (resourceComponent instanceof MeasurementFacet)
+ {
+ for (MeasurementDefinition def : resource.getResourceType().getMetricDefinitions())
+ {
+ Set<MeasurementScheduleRequest> metricList = new HashSet<MeasurementScheduleRequest>();
+ metricList.add(new MeasurementScheduleRequest(1, def.getName(), 1000, true, def.getDataType(), null));
+ MeasurementReport report = new MeasurementReport();
+ ((MeasurementFacet) resourceComponent).getValues(report, metricList);
+
+ assert report.getNumericData().size() > 0 : "Measurement " + def.getName() + " not collected from " + resource;
+ MeasurementData data = report.getNumericData().iterator().next();
+ assert data != null : "Unable to collect metric [" + def.getName() + "] on " + resource;
+ System.out.println("Measurement: " + def.getName() + "=" + data.getValue());
+ }
+ }
+ }
+}
commit ad603d52450c73c054425168c274f35ebea918a2
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Mon Mar 8 10:56:50 2010 -0500
For mazz
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ObjectFilter.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ObjectFilter.java
index b18f348..6c46f7d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ObjectFilter.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ObjectFilter.java
@@ -34,7 +34,7 @@ import java.util.Set;
public class ObjectFilter {
- public static <T extends Collection> T filterFieldsInCollection(T collection, Set<String> goodFields) {
+ public static <T extends Collection<?>> T filterFieldsInCollection(T collection, Set<String> goodFields) {
long sizeOfBefore = sizeOf(collection);
for (Object object : collection) {
filterFields(object, goodFields);
commit 30bee41de31fe2e6ff3e98e437c3f6cef5a30080
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Mon Mar 8 10:56:03 2010 -0500
Avoid ambiguous methods
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ObjectFilter.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ObjectFilter.java
index 6aa5646..b18f348 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ObjectFilter.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ObjectFilter.java
@@ -34,7 +34,7 @@ import java.util.Set;
public class ObjectFilter {
- public static <T extends Collection> T filterFields(T collection, Set<String> goodFields) {
+ public static <T extends Collection> T filterFieldsInCollection(T collection, Set<String> goodFields) {
long sizeOfBefore = sizeOf(collection);
for (Object object : collection) {
filterFields(object, goodFields);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
index 6230e90..b523e3d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
@@ -18,31 +18,18 @@
*/
package org.rhq.enterprise.gui.coregui.server.gwt;
-import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.configuration.RawConfiguration;
import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTService;
import org.rhq.enterprise.gui.coregui.server.util.SerialUtility;
-import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import org.rhq.enterprise.server.resource.ResourceManagerLocal;
-import org.rhq.enterprise.server.util.HibernateDetachUtility;
import org.rhq.enterprise.server.util.LookupUtil;
-import com.google.gwt.user.server.rpc.RemoteServiceServlet;
-
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
+
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
@@ -120,7 +107,7 @@ public class ResourceGWTServiceImpl extends AbstractGWTServiceImpl implements Re
resource.setAgent(null);
}
- ObjectFilter.filterFields(result, importantFieldsSet);
+ ObjectFilter.filterFieldsInCollection(result, importantFieldsSet);
return SerialUtility.prepare(result, "ResourceService.findResourceByCriteria");
} catch (Exception e) {
commit f849d8997fd43ab89255feac56c826211da72866
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Mon Mar 8 09:51:48 2010 -0500
"Always" enablement for buttons like 'add' that have nothing to do with selection
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 7297c17..3e81000 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
@@ -46,7 +46,7 @@ import java.util.ArrayList;
* @author Ian Springer
*/
public class Table extends VLayout {
- private static final SelectionEnablement DEFAULT_SELECTION_ENABLEMENT = SelectionEnablement.ANY;
+ private static final SelectionEnablement DEFAULT_SELECTION_ENABLEMENT = SelectionEnablement.ALWAYS;
private HTMLFlow title;
private ListGrid listGrid;
@@ -58,17 +58,13 @@ public class Table extends VLayout {
* Specifies how many rows must be selected in order for a {@link TableAction} button to be enabled.
*/
public enum SelectionEnablement {
- /**
- * One or more rows are selected.
- */
+ /** Enabled no matter how many rows are selected (zero or more) */
+ ALWAYS,
+ /** One or more rows are selected. */
ANY,
- /**
- * Exactly one row is selected.
- */
+ /** Exactly one row is selected. */
SINGLE,
- /**
- * Two or more rows are selected.
- */
+ /** Two or more rows are selected. */
MULTIPLE
};
@@ -221,6 +217,7 @@ public class Table extends VLayout {
for (TableActionInfo tableAction : tableActions) {
boolean enabled;
switch (tableAction.enablement) {
+ case ALWAYS: enabled = true; break;
case ANY: enabled = (count >= 1); break;
case SINGLE: enabled = (count == 1); break;
case MULTIPLE: enabled = (count > 1); break;
commit 0705dbe03dc2f76a8fc91c6098aee06693e947db
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Sun Mar 7 16:51:35 2010 -0500
Basic OperationHistory viewing
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
index 2604a73..ecdd6a1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
@@ -42,5 +42,6 @@
<servlet path="/ResourceTypeGWTService" class="org.rhq.enterprise.gui.coregui.server.gwt.ResourceTypeGWTServiceImpl"/>
<servlet path="/MeasurementDataGWTService" class="org.rhq.enterprise.gui.coregui.server.gwt.MeasurementDataGWTServiceImpl"/>
<servlet path="/AlertGWTService" class="org.rhq.enterprise.gui.coregui.server.gwt.AlertGWTServiceImpl"/>
+ <servlet path="/OperationGWTService" class="org.rhq.enterprise.gui.coregui.server.gwt.OperationGWTServiceImpl"/>
</module>
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
index a769a18..6f98914 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
@@ -68,6 +68,11 @@ public class GWTServiceLookup {
return secure(AlertGWTServiceAsync.Util.getInstance());
}
+ public static OperationGWTServiceAsync getOperationService() {
+ return secure(OperationGWTServiceAsync.Util.getInstance());
+ }
+
+
private static <T> T secure(Object sdt) {
if (!(sdt instanceof ServiceDefTarget)) return null;
@@ -80,6 +85,7 @@ public class GWTServiceLookup {
Cookies.setCookie(SESSION_NAME, sessionId);
}
+
public static class SessionRpcRequestBuilder extends RpcRequestBuilder {
@Override
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/OperationGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/OperationGWTService.java
new file mode 100644
index 0000000..e1615a3
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/OperationGWTService.java
@@ -0,0 +1,41 @@
+/*
+ * 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.gwt;
+
+import org.rhq.core.domain.criteria.GroupOperationHistoryCriteria;
+import org.rhq.core.domain.criteria.ResourceOperationHistoryCriteria;
+import org.rhq.core.domain.operation.GroupOperationHistory;
+import org.rhq.core.domain.operation.ResourceOperationHistory;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.server.util.SerialUtility;
+
+import com.google.gwt.user.client.rpc.RemoteService;
+
+/**
+ * @author Greg Hinkle
+ */
+public interface OperationGWTService extends RemoteService {
+
+
+ PageList<ResourceOperationHistory> findResourceOperationHistoriesByCriteria(ResourceOperationHistoryCriteria criteria);
+
+ PageList<GroupOperationHistory> findGroupOperationHistoriesByCriteria(GroupOperationHistoryCriteria criteria);
+
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index e1d8573..2cf07c2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -37,6 +37,7 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectLi
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.alert.ResourceAlertHistoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration.ConfigurationHistoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.GraphListView;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.OperationHistoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
import com.google.gwt.user.client.History;
@@ -162,6 +163,7 @@ public class ResourceDetailView extends VLayout implements ViewRenderer, Resourc
inventoryTab.updateSubTab("Children", ResourceSearchView.getChildrenOf(resource.getId()));
inventoryTab.updateSubTab("Connection Settings", new ConfigurationEditor(resource.getId(), resource.getResourceType().getId(), ConfigurationEditor.ConfigType.plugin));
+ operationsTab.updateSubTab("History", OperationHistoryView.getResourceHistoryView(resource.getId()));
configurationTab.updateSubTab("Current", new ConfigurationEditor(resource.getId(), resource.getResourceType().getId()));
configurationTab.updateSubTab("History", ConfigurationHistoryView.getHistoryOf(resource.getId()));
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryDataSource.java
new file mode 100644
index 0000000..5a01bce
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryDataSource.java
@@ -0,0 +1,105 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation;
+
+import org.rhq.core.domain.criteria.ResourceOperationHistoryCriteria;
+import org.rhq.core.domain.operation.ResourceOperationHistory;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.gwt.OperationGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.data.fields.DataSourceIntegerField;
+import com.smartgwt.client.data.fields.DataSourceTextField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+/**
+ * @author Greg Hinkle
+ */
+public class OperationHistoryDataSource extends RPCDataSource<ResourceOperationHistory> {
+
+ private OperationGWTServiceAsync operationService = GWTServiceLookup.getOperationService();
+
+
+ public OperationHistoryDataSource() {
+ super();
+
+ DataSourceIntegerField idField = new DataSourceIntegerField("id");
+ idField.setPrimaryKey(true);
+ addField(idField);
+
+ DataSourceTextField nameField = new DataSourceTextField("operationName");
+ addField(nameField);
+
+ DataSourceTextField statusField = new DataSourceTextField("status");
+ addField(statusField);
+ }
+
+ @Override
+ protected void executeFetch(final DSRequest request, final DSResponse response) {
+ ResourceOperationHistoryCriteria criteria = new ResourceOperationHistoryCriteria();
+
+
+ if (request.getCriteria().getValues().containsKey("resourceId")) {
+ criteria.addFilterResourceIds(Integer.parseInt((String) request.getCriteria().getValues().get("resourceId")));
+ }
+
+ criteria.setPageControl(getPageControl(request));
+
+ operationService.findResourceOperationHistoriesByCriteria(
+ criteria, new AsyncCallback<PageList<ResourceOperationHistory>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failure loading operation histories",caught);
+ }
+
+ public void onSuccess(PageList<ResourceOperationHistory> result) {
+ response.setData(buildRecords(result));
+ processResponse(request.getRequestId(), response);
+ }
+ }
+ );
+ }
+
+ @Override
+ public ResourceOperationHistory copyValues(ListGridRecord from) {
+ throw new UnsupportedOperationException("ResourceOperationHistory is read only");
+ }
+
+ @Override
+ public ListGridRecord copyValues(ResourceOperationHistory from) {
+ ListGridRecord record = new ListGridRecord();
+ record.setAttribute("id",from.getId());
+ record.setAttribute("createdTime",from.getCreatedTime());
+ record.setAttribute("startedTime",from.getStartedTime());
+ record.setAttribute("duration",from.getDuration());
+ record.setAttribute("resource",from.getResource());
+ record.setAttribute("subject",from.getSubjectName());
+ record.setAttribute("operationDefinition",from.getOperationDefinition());
+ record.setAttribute("operationName",from.getOperationDefinition().getDisplayName());
+ record.setAttribute("errorMessage",from.getErrorMessage());
+ record.setAttribute("status",from.getStatus().getDisplayName());
+ record.setAttribute("parameters",from.getParameters());
+
+ return record;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
new file mode 100644
index 0000000..a5c083a
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
@@ -0,0 +1,70 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation;
+
+import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.widgets.layout.VLayout;
+
+/**
+ * @author Greg Hinkle
+ */
+public class OperationHistoryView extends VLayout {
+
+ Table table;
+ Criteria criteria;
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+
+
+ }
+
+ public OperationHistoryView() {
+ }
+
+ public OperationHistoryView(Criteria criteria) {
+ this.criteria = criteria;
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+ if (criteria == null) {
+ table = new Table("Operation History");
+ } else {
+ table = new Table("Operation History", criteria);
+ }
+
+ table.setDataSource(new OperationHistoryDataSource());
+
+
+ addMember(table);
+ }
+
+
+ public static OperationHistoryView getResourceHistoryView(int resourceId) {
+ Criteria criteria = new Criteria("resourceId", String.valueOf(resourceId));
+
+ return new OperationHistoryView(criteria);
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/OperationGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/OperationGWTServiceImpl.java
new file mode 100644
index 0000000..24bef8a
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/OperationGWTServiceImpl.java
@@ -0,0 +1,49 @@
+/*
+ * 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.server.gwt;
+
+import org.rhq.core.domain.criteria.GroupOperationHistoryCriteria;
+import org.rhq.core.domain.criteria.ResourceOperationHistoryCriteria;
+import org.rhq.core.domain.operation.GroupOperationHistory;
+import org.rhq.core.domain.operation.OperationHistory;
+import org.rhq.core.domain.operation.ResourceOperationHistory;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.gwt.OperationGWTService;
+import org.rhq.enterprise.gui.coregui.server.util.SerialUtility;
+import org.rhq.enterprise.server.operation.OperationManagerLocal;
+import org.rhq.enterprise.server.util.LookupUtil;
+
+/**
+ * @author Greg Hinkle
+ */
+public class OperationGWTServiceImpl extends AbstractGWTServiceImpl implements OperationGWTService {
+
+ private OperationManagerLocal operationManager = LookupUtil.getOperationManager();
+
+ public PageList<ResourceOperationHistory> findResourceOperationHistoriesByCriteria(ResourceOperationHistoryCriteria criteria) {
+ return SerialUtility.prepare(operationManager.findResourceOperationHistoriesByCriteria(getSessionSubject(), criteria),
+ "OperationService.findResourceOperationHistoriesByCriteria");
+
+ }
+ public PageList<GroupOperationHistory> findGroupOperationHistoriesByCriteria(GroupOperationHistoryCriteria criteria) {
+ return SerialUtility.prepare(operationManager.findGroupOperationHistoriesByCriteria(getSessionSubject(), criteria),
+ "OperationService.findGroupOperationHistoriesByCriteria");
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css
index 844eaa0..31d3f21 100644
--- a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css
+++ b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css
@@ -28,19 +28,19 @@ hr {
}
a:link {
- color: #003399;
+ color: #4A5D75;
font-weight: bold;
text-decoration: none;
}
a:visited {
- color: #003399;
+ color: #4A5D75;
font-weight: bold;
text-decoration: none;
}
a:hover {
- color: #003399;
+ color: #4A5D75;
font-weight: bold;
text-decoration: underline;
}
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml b/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
index 46a6a67..d5cf5d2 100644
--- a/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
+++ b/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
@@ -39,6 +39,11 @@
<servlet-class>org.rhq.enterprise.gui.coregui.server.gwt.AlertGWTServiceImpl
</servlet-class>
</servlet>
+ <servlet>
+ <servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI OperationGWTService</servlet-name>
+ <servlet-class>org.rhq.enterprise.gui.coregui.server.gwt.OperationGWTServiceImpl
+ </servlet-class>
+ </servlet>
<servlet-mapping>
<servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI RoleGWTService</servlet-name>
@@ -72,4 +77,8 @@
<servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI AlertGWTService</servlet-name>
<url-pattern>/org.rhq.enterprise.gui.coregui.CoreGUI/AlertGWTService</url-pattern>
</servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI OperationGWTService</servlet-name>
+ <url-pattern>/org.rhq.enterprise.gui.coregui.CoreGUI/OperationGWTService</url-pattern>
+ </servlet-mapping>
</web-app>
commit 4486c9df7659173d60a7873f9a8e28af3406993d
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Sun Mar 7 13:29:34 2010 -0500
More cleanup
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
index 6bf2f18..9b26ac0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
@@ -163,8 +163,6 @@ public class ResourceTreeDatasource extends DataSource {
}
public void onSuccess(PageList<Resource> result) {
- System.out.println("Got resources in: " + (System.currentTimeMillis() - start));
-
processIncomingData(result, response, requestId);
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
index 55c06b2..c86b6aa 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
@@ -100,12 +100,6 @@ public class ResourceTreeView extends VLayout {
contextMenu = new Menu();
MenuItem item = new MenuItem("Expand node");
- item.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
- public void onClick(MenuItemClickEvent event) {
- TreeGrid treeGrid = (TreeGrid) event.getTarget();
- System.out.println("You right clicked: " + treeGrid.getSelectedRecord());
- }
- });
/* Do menu support datasources? GH: Seemingly they'll only load once when done this way
contextMenu.setDataSource(new DataSource() {
@@ -340,15 +334,14 @@ public class ResourceTreeView extends VLayout {
if (!initialSelect) {
TreeNode selectedNode = treeGrid.getTree().findById(String.valueOf(selectedResource.getId()));
- System.out.println("Trying to preopen: " + selectedNode);
+// System.out.println("Trying to preopen: " + selectedNode);
if (selectedNode != null) {
- System.out.println("Preopen node!!!");
TreeNode[] parents = treeGrid.getTree().getParents(selectedNode);
treeGrid.getTree().openFolders(parents);
treeGrid.getTree().openFolder(selectedNode);
for (TreeNode p : parents) {
- System.out.println("open? " + treeGrid.getTree().isOpen(p) + " node: " + p.getName());
+// System.out.println("open? " + treeGrid.getTree().isOpen(p) + " node: " + p.getName());
}
treeGrid.selectRecord(selectedNode);
@@ -369,9 +362,9 @@ public class ResourceTreeView extends VLayout {
TreeNode selectedNode = treeGrid.getTree().findById(String.valueOf(selectedResource.getId()));
- System.out.println("Trying to preopen: " + selectedNode);
+// System.out.println("Trying to preopen: " + selectedNode);
if (selectedNode != null) {
- System.out.println("Preopen node!!!");
+// System.out.println("Preopen node!!!");
TreeNode[] parents = treeGrid.getTree().getParents(selectedNode);
treeGrid.getTree().openFolders(parents);
treeGrid.getTree().openFolder(selectedNode);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/GraphListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/GraphListView.java
index 1fbeee3..a444748 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/GraphListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/GraphListView.java
@@ -32,6 +32,7 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.layout.VLayout;
import java.util.ArrayList;
@@ -45,14 +46,14 @@ public class GraphListView extends VLayout implements ResourceSelectListener {
private Resource resource;
-
+ private Label loadingLabel = new Label("Loading...");
public GraphListView() {
}
public GraphListView(Resource resource) {
this.resource = resource;
- setOverflow(Overflow.SCROLL);
+ setOverflow(Overflow.AUTO);
}
@@ -63,6 +64,9 @@ public class GraphListView extends VLayout implements ResourceSelectListener {
for (Canvas c : getMembers()) {
c.destroy();
}
+
+ addMember(loadingLabel);
+
if (resource != null) {
buildGraphs();
}
@@ -93,22 +97,28 @@ public class GraphListView extends VLayout implements ResourceSelectListener {
GWTServiceLookup.getMeasurementDataService().findDataForResource(
resource.getId(),
measDefIdArray,
- System.currentTimeMillis() - (1000L*60*60*8),
+ System.currentTimeMillis() - (1000L * 60 * 60 * 8),
System.currentTimeMillis(),
60,
new AsyncCallback<List<List<MeasurementDataNumericHighLowComposite>>>() {
public void onFailure(Throwable caught) {
SC.say("Failed data load");
+ loadingLabel.setContents("failed to load graphs");
}
public void onSuccess(List<List<MeasurementDataNumericHighLowComposite>> result) {
- int i = 0;
- for (List<MeasurementDataNumericHighLowComposite> data : result) {
- buildGraph(measurementDefinitions.get(i++), data);
+ if (result.isEmpty()) {
+ loadingLabel.setContents("No graphs available");
+ } else {
+ loadingLabel.hide();
+ int i = 0;
+ for (List<MeasurementDataNumericHighLowComposite> data : result) {
+ buildGraph(measurementDefinitions.get(i++), data);
+ }
}
}
}
- );
+ );
}
}
@@ -118,7 +128,7 @@ public class GraphListView extends VLayout implements ResourceSelectListener {
private void buildGraph(MeasurementDefinition def, List<MeasurementDataNumericHighLowComposite> data) {
SmallGraphView graph = new SmallGraphView(def, data);
graph.setWidth("80%");
- graph.setHeight(250);
+ graph.setHeight(220);
addMember(graph);
@@ -128,8 +138,6 @@ public class GraphListView extends VLayout implements ResourceSelectListener {
this.resource = resource;
-
-
buildGraphs();
markForRedraw();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java
index a62ca57..c6cbde0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java
@@ -83,7 +83,6 @@ public class ResourceTypeRepository {
return;
}
- System.out.println("Getting types from cache");
long start = System.currentTimeMillis();
HashSet<Integer> types = new HashSet<Integer>();
@@ -99,7 +98,7 @@ public class ResourceTypeRepository {
}
});
- System.out.println("Loaded types from cache in " + (System.currentTimeMillis() - start));
+// System.out.println("Loaded types from cache in " + (System.currentTimeMillis() - start));
}
commit e316a1e1ccf2573ea41f49c1143c236650eadb90
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Sun Mar 7 13:29:02 2010 -0500
Move data load to onDraw from onInit. This stops premature data loads (for example when loading all the tabs)
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
index 9b1bb74..881b7f9 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
@@ -57,14 +57,21 @@ public class AlertsView extends VLayout {
this.table = new Table(TITLE, criteria, SORT_SPECIFIERS, excludedFieldNames);
}
+
@Override
protected void onInit() {
super.onInit();
-
setWidth100();
setHeight100();
setMembersMargin(20);
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+
// Add the list table as the top half of the view.
//Criteria criteria = new Criteria(AlertCriteria.);
this.table.setHeight("50%");
commit 752ec179068467fa7934e0db4862146826f2b551
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Sun Mar 7 13:28:19 2010 -0500
Icons for resource availability display
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/resources/availability_green_16.png b/modules/enterprise/gui/coregui/src/main/webapp/images/resources/availability_green_16.png
new file mode 100644
index 0000000..f0bf623
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/resources/availability_green_16.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/resources/availability_green_24.png b/modules/enterprise/gui/coregui/src/main/webapp/images/resources/availability_green_24.png
new file mode 100644
index 0000000..68e0780
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/resources/availability_green_24.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/resources/availability_grey_16.png b/modules/enterprise/gui/coregui/src/main/webapp/images/resources/availability_grey_16.png
new file mode 100644
index 0000000..ae6fa45
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/resources/availability_grey_16.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/resources/availability_grey_24.png b/modules/enterprise/gui/coregui/src/main/webapp/images/resources/availability_grey_24.png
new file mode 100644
index 0000000..4a6461d
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/resources/availability_grey_24.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/resources/availability_red_16.png b/modules/enterprise/gui/coregui/src/main/webapp/images/resources/availability_red_16.png
new file mode 100644
index 0000000..8182778
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/resources/availability_red_16.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/resources/availability_red_24.png b/modules/enterprise/gui/coregui/src/main/webapp/images/resources/availability_red_24.png
new file mode 100644
index 0000000..a6c61e9
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/resources/availability_red_24.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/resources/availability_yellow_16.png b/modules/enterprise/gui/coregui/src/main/webapp/images/resources/availability_yellow_16.png
new file mode 100644
index 0000000..f766722
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/resources/availability_yellow_16.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/resources/availability_yellow_24.png b/modules/enterprise/gui/coregui/src/main/webapp/images/resources/availability_yellow_24.png
new file mode 100644
index 0000000..a1f0520
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/resources/availability_yellow_24.png differ
commit 53185a0f2ce01442f2e672e481051bd1fe2f7317
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Sun Mar 7 13:27:59 2010 -0500
RPC call tracking and ajax loading icon while requests are in progress
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
index bf28cf5..a769a18 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
@@ -18,6 +18,8 @@
*/
package org.rhq.enterprise.gui.coregui.client.gwt;
+import org.rhq.enterprise.gui.coregui.client.util.rpc.MonitoringRequestCallback;
+
import com.google.gwt.http.client.RequestBuilder;
import com.google.gwt.user.client.Cookies;
import com.google.gwt.user.client.rpc.RpcRequestBuilder;
@@ -81,14 +83,37 @@ public class GWTServiceLookup {
public static class SessionRpcRequestBuilder extends RpcRequestBuilder {
@Override
+ protected void doSetRequestData(RequestBuilder rb, String data) {
+ super.doSetRequestData(rb, data); // TODO: Implement this method.
+ }
+
+ @Override
protected void doFinish(RequestBuilder rb) {
super.doFinish(rb);
+ // TODO Don't use the expensive determineName except in dev mode
+ rb.setCallback(new MonitoringRequestCallback(determineName(), rb.getCallback()));
+
String sid = Cookies.getCookie(SESSION_NAME);
if (sid != null) {
rb.setHeader(SESSION_NAME, sid);
}
}
+
+ public String determineName() {
+ Exception e = new Exception();
+
+ StackTraceElement[] stack = e.getStackTrace();
+ // Skip the first two stack elements to get to the proxy calling
+ for (int i = 2; i < stack.length; i++) {
+ StackTraceElement ste = stack[i];
+ // e.g. "org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTService_Proxy.findResourcesByCriteria(ResourceGWTService_Proxy.java:36)"
+ if (ste.getClassName().startsWith("org.rhq.enterprise.gui.coregui.client.gwt")) {
+ return ste.getClassName().substring(ste.getClassName().lastIndexOf(".") + 1) + "." + ste.getMethodName();
+ }
+ }
+ return "unknown";
+ }
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/rpc/MonitoringRequestCallback.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/rpc/MonitoringRequestCallback.java
new file mode 100644
index 0000000..f095e83
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/rpc/MonitoringRequestCallback.java
@@ -0,0 +1,66 @@
+/*
+ * 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.util.rpc;
+
+import com.google.gwt.http.client.Request;
+import com.google.gwt.http.client.RequestCallback;
+import com.google.gwt.http.client.Response;
+import com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter;
+
+/**
+ * @author Greg Hinkle
+ */
+public class MonitoringRequestCallback implements RequestCallback {
+
+ private int id;
+ private String name;
+ private long start = System.currentTimeMillis();
+
+ private RequestCallback callback;
+
+ public MonitoringRequestCallback(String name, RequestCallback callback) {
+ this.name = name;
+ id = RPCManager.getInstance().register(this);
+ this.callback = callback;
+ if (callback instanceof RequestCallbackAdapter) {
+// ((RequestCallbackAdapter)callback)
+
+ }
+
+ }
+
+ public void onError(Request request, Throwable exception) {
+ RPCManager.getInstance().failCall(this);
+ callback.onError(request, exception);
+ }
+
+ public void onResponseReceived(Request request, Response response) {
+ RPCManager.getInstance().succeedCall(this);
+ callback.onResponseReceived(request, response);
+ }
+
+
+ public String getName() {
+ return name;
+ }
+
+ public long age() {
+ return System.currentTimeMillis() - start;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/rpc/RPCManager.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/rpc/RPCManager.java
new file mode 100644
index 0000000..44aaacd
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/rpc/RPCManager.java
@@ -0,0 +1,92 @@
+/*
+ * 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.util.rpc;
+
+import com.smartgwt.client.widgets.Img;
+
+import java.util.HashSet;
+
+/**
+ * @author Greg Hinkle
+ */
+public class RPCManager {
+
+
+ int nextCallId = 0;
+
+ HashSet<MonitoringRequestCallback> inProgress = new HashSet<MonitoringRequestCallback>();
+
+ Img activityIndicator;
+
+ public RPCManager() {
+ activityIndicator = new Img("ajax-loader.gif", 16, 16);
+ activityIndicator.setZIndex(10000);
+ activityIndicator.setLeft(10);
+ activityIndicator.setTop(40);
+ activityIndicator.hide();
+ activityIndicator.draw();
+ }
+
+ public int register(MonitoringRequestCallback callback) {
+ inProgress.add(callback);
+ refresh();
+ return nextCallId++;
+ }
+
+ public void failCall(MonitoringRequestCallback callback) {
+ System.out.println("RPC [" + callback.getName() + "] failed in [" + callback.age() + "]");
+ inProgress.remove(callback);
+ refresh();
+ }
+
+ public void succeedCall(MonitoringRequestCallback callback) {
+ System.out.println("RPC [" + callback.getName() + "] succeeded in [" + callback.age() + "]");
+ inProgress.remove(callback);
+ refresh();
+ }
+
+ public int getQueueDepth() {
+ return inProgress.size();
+ }
+
+ public void refresh() {
+ if (getQueueDepth() > 0) {
+ activityIndicator.show();
+
+ StringBuilder buf = new StringBuilder().append("<b>").append(inProgress.size()).append(" active requests</b>");
+ for (MonitoringRequestCallback cb : inProgress) {
+ buf.append("<br/>");
+ buf.append(cb.getName());
+ }
+
+ activityIndicator.setTooltip(buf.toString());
+
+ } else {
+ activityIndicator.hide();
+ }
+ }
+
+
+ public static RPCManager INSTANCE = new RPCManager();
+
+ public static RPCManager getInstance() {
+ return INSTANCE;
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/ajax-loader.gif b/modules/enterprise/gui/coregui/src/main/webapp/images/ajax-loader.gif
new file mode 100644
index 0000000..d42f72c
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/ajax-loader.gif differ
commit dc012bdc5c8bb0d4e208693d718c679042fa7339
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Sun Mar 7 09:31:28 2010 -0500
Resource titlebar cleanup
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
index 4b99b4f..2604a73 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
@@ -23,7 +23,14 @@
<when-type-assignable class="org.rhq.core.domain.util.Recordizable"/>
</generate-with>-->
- <set-property name="user.agent" value="safari"/>
+ <!-- limit builds to your preferred browser -->
+
+ <!-- Safari -->
+ <!--<set-property name="user.agent" value="safari"/>-->
+
+ <!-- Firefox 3 -->
+ <set-property name="user.agent" value="gecko1_8"/>
+
<entry-point class='org.rhq.enterprise.gui.coregui.client.CoreGUI'/>
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
index c67846c..002c1ce 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
@@ -18,6 +18,7 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail;
+import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.resource.Resource;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
@@ -25,6 +26,7 @@ import com.smartgwt.client.types.SelectionType;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.IButton;
+import com.smartgwt.client.widgets.Img;
import com.smartgwt.client.widgets.ImgButton;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
@@ -38,7 +40,9 @@ public class ResourceTitleBar extends HLayout {
Resource resource;
ImgButton favoriteButton;
- HTMLFlow title = new HTMLFlow();
+ HTMLFlow title;
+ Img availabilityImage;
+
boolean favorite;
public static final String FAV_ICON = "Favorite_24_Selected.png";
@@ -48,13 +52,16 @@ public class ResourceTitleBar extends HLayout {
public ResourceTitleBar() {
super();
setWidth100();
- setHeight(60);
+ setHeight(30);
}
@Override
protected void onInit() {
super.onInit();
+ title = new HTMLFlow();
+ title.setWidth("*");
+
favoriteButton = new ImgButton();
favoriteButton.setSrc(NOT_FAV_ICON);
favoriteButton.setShowHover(false);
@@ -75,9 +82,12 @@ public class ResourceTitleBar extends HLayout {
}
});
+ availabilityImage = new Img("resources/availability_grey_24.png",24,24);
+
addMember(title);
addMember(favoriteButton);
+ addMember(availabilityImage);
}
public void setResource(Resource resource) {
@@ -87,6 +97,9 @@ public class ResourceTitleBar extends HLayout {
favorite = CoreGUI.getUserPreferences().getFavoriteResources().contains(resource.getId());
+ availabilityImage.setSrc("resources/availability_" +
+ (resource.getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP ? "green" : "red") +
+ "_24.png");
markForRedraw();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
index 66a2438..55c06b2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
@@ -385,11 +385,8 @@ public class ResourceTreeView extends VLayout {
treeGrid.markForRedraw();
}
-
-// treeGrid.fegetTree().openFolder(rootData[0]);
-
-
} else {
+
initialSelect = false;
for (TreeNode n : ResourceTreeDatasource.build(result)) {
treeGrid.getDataSource().addData(n);
commit 5cb6dd8db33cf8fbdfa24eacd21d61b54ff733f5
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Sat Mar 6 09:53:48 2010 -0500
a little minor refactoring + some javadoc
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 84cc93a..7297c17 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
@@ -43,8 +43,10 @@ import java.util.ArrayList;
/**
* @author Greg Hinkle
+ * @author Ian Springer
*/
public class Table extends VLayout {
+ private static final SelectionEnablement DEFAULT_SELECTION_ENABLEMENT = SelectionEnablement.ANY;
private HTMLFlow title;
private ListGrid listGrid;
@@ -52,6 +54,9 @@ public class Table extends VLayout {
private Label tableInfo;
private String[] excludedFieldNames;
+ /**
+ * Specifies how many rows must be selected in order for a {@link TableAction} button to be enabled.
+ */
public enum SelectionEnablement {
/**
* One or more rows are selected.
@@ -120,7 +125,6 @@ public class Table extends VLayout {
this.excludedFieldNames = excludedFieldNames;
}
-
@Override
protected void onDraw() {
super.onDraw();
@@ -200,10 +204,13 @@ public class Table extends VLayout {
}
public void addTableAction(String title, TableAction tableAction) {
- this.addTableAction(title, SelectionEnablement.ANY, null, tableAction);
+ this.addTableAction(title, null, null, tableAction);
}
public void addTableAction(String title, SelectionEnablement enablement, String confirmation, TableAction tableAction) {
+ if (enablement == null) {
+ enablement = DEFAULT_SELECTION_ENABLEMENT;
+ }
TableActionInfo info = new TableActionInfo(title, enablement, tableAction);
info.confirmMessage = confirmation;
tableActions.add(info);
@@ -212,13 +219,14 @@ public class Table extends VLayout {
private void refreshTableInfo() {
int count = this.listGrid.getSelection().length;
for (TableActionInfo tableAction : tableActions) {
- if (count == 0) {
- tableAction.actionButton.setDisabled(true);
- } else if (count == 1) {
- tableAction.actionButton.setDisabled(tableAction.enablement == SelectionEnablement.MULTIPLE);
- } else if (count > 1) {
- tableAction.actionButton.setDisabled(tableAction.enablement == SelectionEnablement.SINGLE);
+ boolean enabled;
+ switch (tableAction.enablement) {
+ case ANY: enabled = (count >= 1); break;
+ case SINGLE: enabled = (count == 1); break;
+ case MULTIPLE: enabled = (count > 1); break;
+ default: throw new IllegalStateException("Unhandled SelectionEnablement: " + tableAction.enablement.name());
}
+ tableAction.actionButton.setDisabled(!enabled);
}
this.tableInfo.setContents("Total: " + listGrid.getTotalRows() + " (" + count + " selected)");
}
@@ -234,7 +242,6 @@ public class Table extends VLayout {
String confirmMessage;
IButton actionButton;
-
protected TableActionInfo(String title, SelectionEnablement enablement, TableAction action) {
this.title = title;
this.enablement = enablement;
commit 5def5f5411939f423c3f0d4c8f6c9b6bc9a7e301
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Sat Mar 6 00:42:22 2010 -0500
add support for specifying criteria when creating or refreshing a Table component; add support to AlertDataSource for transposing the SmartGWT criteria object to an RHQ AlertCriteria
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AbstractAlertDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AbstractAlertDataSource.java
deleted file mode 100644
index c258db2..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AbstractAlertDataSource.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.alert;
-
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.i18n.client.DateTimeFormat;
-import com.google.gwt.user.client.Window;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.data.DSRequest;
-import com.smartgwt.client.data.DSResponse;
-import com.smartgwt.client.data.DataSourceField;
-import com.smartgwt.client.data.fields.DataSourceIntegerField;
-import com.smartgwt.client.data.fields.DataSourceTextField;
-import com.smartgwt.client.rpc.RPCResponse;
-import com.smartgwt.client.widgets.grid.ListGrid;
-import com.smartgwt.client.widgets.grid.ListGridRecord;
-import org.rhq.core.domain.alert.Alert;
-import org.rhq.core.domain.alert.AlertCondition;
-import org.rhq.core.domain.alert.AlertConditionLog;
-import org.rhq.core.domain.criteria.AlertCriteria;
-import org.rhq.core.domain.measurement.MeasurementConverterClient;
-import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.gui.coregui.client.gwt.AlertGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-import java.util.Set;
-
-/**
- * A server-side SmartGWT DataSource for CRUD of {@link Alert}s.
- *
- * @author Ian Springer
- */
-public abstract class AbstractAlertDataSource extends RPCDataSource<Alert> {
- private static final String NAME = "Alert";
- private static final DateTimeFormat DATE_TIME_FORMAT = DateTimeFormat.getMediumDateTimeFormat();
-
- private AlertGWTServiceAsync alertService = GWTServiceLookup.getAlertService();
-
- protected AbstractAlertDataSource() {
- super(NAME);
-
- setCanMultiSort(true);
-
- List<DataSourceField> fields = createFields();
- for (DataSourceField field : fields) {
- addField(field);
- }
- }
-
- protected List<DataSourceField> createFields() {
- List<DataSourceField> fields = new ArrayList<DataSourceField>();
-
- DataSourceField idField = new DataSourceIntegerField("id", "Id");
- idField.setPrimaryKey(true);
- idField.setHidden(true);
- fields.add(idField);
-
- DataSourceTextField nameField = new DataSourceTextField(AlertCriteria.SORT_FIELD_NAME, "Name", 100);
- fields.add(nameField);
-
- DataSourceTextField conditionTextField = new DataSourceTextField("conditionText", "Condition Text");
- conditionTextField.setCanSortClientOnly(true);
- fields.add(conditionTextField);
-
- DataSourceTextField conditionValueField = new DataSourceTextField("conditionValue", "Condition Value");
- conditionValueField.setCanSortClientOnly(true);
- fields.add(conditionValueField);
-
- DataSourceTextField recoveryInfoField = new DataSourceTextField("recoveryInfo", "Recovery Info");
- recoveryInfoField.setCanSortClientOnly(true);
- fields.add(recoveryInfoField);
-
- // TODO: Will using DataSourceEnumField here allow us to do
- // record.setAttribute("priority", alert.getAlertDefinition().getPriority()), rather than
- // record.setAttribute("priority", alert.getAlertDefinition().getPriority().name()) in
- // createRecord() below?
- DataSourceTextField priorityField = new DataSourceTextField(AlertCriteria.SORT_FIELD_PRIORITY, "Priority", 15);
- fields.add(priorityField);
-
- DataSourceTextField ctimeField = new DataSourceTextField(AlertCriteria.SORT_FIELD_CTIME, "Creation Time");
- fields.add(ctimeField);
-
- return fields;
- }
-
- void deleteAlerts(final AbstractAlertsView alertsView) {
- ListGrid listGrid = alertsView.getListGrid();
- ListGridRecord[] records = listGrid.getSelection();
-
- final Integer[] alertIds = new Integer[records.length];
- for (int i = 0, selectionLength = records.length; i < selectionLength; i++) {
- ListGridRecord record = records[i];
- Integer alertId = record.getAttributeAsInt("id");
- alertIds[i] = alertId;
- }
-
- this.alertService.deleteResourceAlerts(alertIds, new AsyncCallback<Void>() {
- public void onSuccess(Void blah) {
- System.out.println("Deleted Alerts with id's: " + Arrays.toString(alertIds) + ".");
- alertsView.refresh();
- }
-
- public void onFailure(Throwable caught) {
- Window.alert("Failed to delete Alerts with id's: " + Arrays.toString(alertIds) + " - cause: " + caught);
- System.err.println("Failed to delete Alerts with id's " + Arrays.toString(alertIds) + " - cause: " + caught);
- }
- });
- }
-
- protected void executeFetch(final DSRequest request, final DSResponse response) {
- final long start = System.currentTimeMillis();
-
- AlertCriteria criteria = getCriteria(request);
-
- this.alertService.findAlertsByCriteria(criteria, new AsyncCallback<PageList<Alert>>() {
- public void onFailure(Throwable caught) {
- Window.alert("Failed to fetch Alerts - cause: " + caught);
- System.err.println("Failed to fetch Alerts - cause: " + caught);
- response.setStatus(RPCResponse.STATUS_FAILURE);
- processResponse(request.getRequestId(), response);
- }
-
- public void onSuccess(PageList<Alert> result) {
- long fetchTime = System.currentTimeMillis() - start;
- System.out.println(result.size() + " Alerts fetched in: " + fetchTime + "ms");
-
- response.setData(buildRecords(result));
- // For paging to work, we have to specify size of full result set.
- response.setTotalRows(result.getTotalSize());
- processResponse(request.getRequestId(), response);
- }
- });
- }
-
- protected AlertCriteria getCriteria(DSRequest request) {
- AlertCriteria criteria = new AlertCriteria();
- criteria.fetchAlertDefinition(true);
- criteria.fetchRecoveryAlertDefinition(true);
- // TODO: Uncomment the below once the bad performance of it has been fixed.
- //criteria.fetchConditionLogs(true);
-
- criteria.setPageControl(getPageControl(request));
- return criteria;
- }
-
- @Override
- public Alert copyValues(ListGridRecord from) {
- return null; // TODO: Implement this method.
- }
-
- @Override
- public ListGridRecord copyValues(Alert from) {
- ListGridRecord record = new ListGridRecord();
- record.setAttribute("id", from.getId());
- record.setAttribute("resourceId", from.getAlertDefinition().getResource().getId());
- record.setAttribute("name", from.getAlertDefinition().getName());
- record.setAttribute("priority", from.getAlertDefinition().getPriority().name());
- record.setAttribute("ctime", DATE_TIME_FORMAT.format(new Date(from.getCtime())));
-
- Set<AlertConditionLog> conditionLogs = from.getConditionLogs();
- String conditionText;
- String conditionValue;
- if (conditionLogs.size() > 1) {
- conditionText = "Multiple Conditions";
- conditionValue = "--";
- } else if (conditionLogs.size() == 1) {
- AlertConditionLog conditionLog = conditionLogs.iterator().next();
- AlertCondition condition = conditionLog.getCondition();
- conditionText = AlertFormatUtility.formatAlertConditionForDisplay(condition);
- conditionValue = conditionLog.getValue();
- if (condition.getMeasurementDefinition() != null) {
- conditionValue = MeasurementConverterClient.format(Double.valueOf(conditionLog.getValue()), condition
- .getMeasurementDefinition().getUnits(), true);
- }
- } else {
- conditionText = "No Conditions";
- conditionValue = "--";
- }
- record.setAttribute("conditionText", conditionText);
- record.setAttribute("conditionValue", conditionValue);
-
- String recoveryInfo = AlertFormatUtility.getAlertRecoveryInfo(from);
- record.setAttribute("recoveryInfo", recoveryInfo);
- return record;
- }
-
- protected void executeRemove(final DSRequest request, final DSResponse response) {
- JavaScriptObject data = request.getData ();
- ListGridRecord record = new ListGridRecord(data);
- Window.alert(String.valueOf(record.getAttributeAsInt("id")));
- }
-
-}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AbstractAlertsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AbstractAlertsView.java
deleted file mode 100644
index dcf0e9f..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AbstractAlertsView.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.alert;
-
-import com.smartgwt.client.data.SortSpecifier;
-import com.smartgwt.client.types.SortDirection;
-import com.smartgwt.client.widgets.HTMLFlow;
-import com.smartgwt.client.widgets.grid.ListGrid;
-import com.smartgwt.client.widgets.grid.ListGridRecord;
-import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
-import com.smartgwt.client.widgets.grid.events.SelectionEvent;
-import com.smartgwt.client.widgets.layout.HLayout;
-import com.smartgwt.client.widgets.layout.VLayout;
-import org.rhq.core.domain.criteria.AlertCriteria;
-import org.rhq.enterprise.gui.coregui.client.components.table.Table;
-import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
-
-/**
- * A view that displays a paginated table of fired {@link org.rhq.core.domain.alert.Alert alert}s, along with the
- * ability to filter or sort those alerts, click on an alert to view details about that alert's definition, or delete
- * selected alerts.
- *
- * @author Ian Springer
- */
-public abstract class AbstractAlertsView extends VLayout {
- private static final String TABLE_TITLE = "Alerts";
-
- private static final SortSpecifier[] INITIAL_SORT_SPECIFIERS = new SortSpecifier[] {
- new SortSpecifier(AlertCriteria.SORT_FIELD_CTIME, SortDirection.DESCENDING),
- new SortSpecifier(AlertCriteria.SORT_FIELD_NAME, SortDirection.ASCENDING)
- };
-
- private static final String DELETE_CONFIRM_MESSAGE = "Are you sure you want to delete the selected alert(s)?";
-
- private ListGrid listGrid;
- private AbstractAlertDataSource dataSource;
- private HTMLFlow detailsContent;
-
- @Override
- protected void onInit() {
- super.onInit();
-
- setWidth100();
- setHeight100();
- setMembersMargin(20);
-
- // Add the list table as the top half of the view.
- Table table = new Table(TABLE_TITLE, INITIAL_SORT_SPECIFIERS);
- table.setHeight("50%");
- this.listGrid = table.getListGrid();
- this.dataSource = createDataSource();
- table.setDataSource(this.dataSource);
-
- table.addTableAction("Delete", Table.SelectionEnablement.ANY, DELETE_CONFIRM_MESSAGE, new TableAction() {
- public void executeAction(ListGridRecord[] selection) {
- AbstractAlertsView.this.dataSource.deleteAlerts(AbstractAlertsView.this);
- }
- });
-
- this.listGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
- public void onSelectionChanged(SelectionEvent event) {
- ListGridRecord[] selectedRecords = listGrid.getSelection();
- String contents;
- if (selectedRecords.length == 1) {
- ListGridRecord record = selectedRecords[0];
- String name = record.getAttribute("name");
- String id = record.getAttribute("id");
- // TODO: Finish this.
- contents = "Details for alert '" + name + "' with id " + id + "...<h2>TODO</h2>";
-
- } else {
- contents = "Select a single alert above to display its details here.";
- }
- detailsContent.setContents(contents);
- }
- });
-
- addMember(table);
-
- // Add the details panel as the bottom half of the view.
- HLayout detailsPane = new HLayout();
- detailsPane.setWidth100();
- detailsPane.setHeight("50%");
- this.detailsContent = new HTMLFlow("Select a single alert above to display its details here.");
- this.detailsContent.setWidth100();
- detailsPane.addMember(this.detailsContent);
- addMember(detailsPane);
- }
-
- protected abstract AbstractAlertDataSource createDataSource();
-
- ListGrid getListGrid() {
- return this.listGrid;
- }
-
- public void refresh() {
- this.listGrid.invalidateCache();
- this.listGrid.markForRedraw();
- }
-}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
new file mode 100644
index 0000000..09ccd6a
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
@@ -0,0 +1,227 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.alert;
+
+import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.i18n.client.DateTimeFormat;
+import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.data.DataSourceField;
+import com.smartgwt.client.data.fields.DataSourceIntegerField;
+import com.smartgwt.client.data.fields.DataSourceTextField;
+import com.smartgwt.client.rpc.RPCResponse;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import org.rhq.core.domain.alert.Alert;
+import org.rhq.core.domain.alert.AlertCondition;
+import org.rhq.core.domain.alert.AlertConditionLog;
+import org.rhq.core.domain.criteria.AlertCriteria;
+import org.rhq.core.domain.measurement.MeasurementConverterClient;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.gwt.AlertGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * A server-side SmartGWT DataSource for CRUD of {@link Alert}s.
+ *
+ * @author Ian Springer
+ */
+public class AlertDataSource extends RPCDataSource<Alert> {
+ private static final DateTimeFormat DATE_TIME_FORMAT = DateTimeFormat.getMediumDateTimeFormat();
+
+ private AlertGWTServiceAsync alertService = GWTServiceLookup.getAlertService();
+
+ protected AlertDataSource() {
+ super();
+
+ setCanMultiSort(true);
+
+ List<DataSourceField> fields = createFields();
+ for (DataSourceField field : fields) {
+ addField(field);
+ }
+ }
+
+ protected List<DataSourceField> createFields() {
+ List<DataSourceField> fields = new ArrayList<DataSourceField>();
+
+ DataSourceField idField = new DataSourceIntegerField("id", "Id");
+ idField.setPrimaryKey(true);
+ idField.setHidden(true);
+ fields.add(idField);
+
+ DataSourceTextField nameField = new DataSourceTextField(AlertCriteria.SORT_FIELD_NAME, "Name", 100);
+ fields.add(nameField);
+
+ DataSourceTextField conditionTextField = new DataSourceTextField("conditionText", "Condition Text");
+ conditionTextField.setCanSortClientOnly(true);
+ fields.add(conditionTextField);
+
+ DataSourceTextField conditionValueField = new DataSourceTextField("conditionValue", "Condition Value");
+ conditionValueField.setCanSortClientOnly(true);
+ fields.add(conditionValueField);
+
+ DataSourceTextField recoveryInfoField = new DataSourceTextField("recoveryInfo", "Recovery Info");
+ recoveryInfoField.setCanSortClientOnly(true);
+ fields.add(recoveryInfoField);
+
+ // TODO: Will using DataSourceEnumField here allow us to do
+ // record.setAttribute("priority", alert.getAlertDefinition().getPriority()), rather than
+ // record.setAttribute("priority", alert.getAlertDefinition().getPriority().name()) in
+ // createRecord() below?
+ DataSourceTextField priorityField = new DataSourceTextField(AlertCriteria.SORT_FIELD_PRIORITY, "Priority", 15);
+ fields.add(priorityField);
+
+ DataSourceTextField ctimeField = new DataSourceTextField(AlertCriteria.SORT_FIELD_CTIME, "Creation Time");
+ fields.add(ctimeField);
+
+ return fields;
+ }
+
+ void deleteAlerts(final AlertsView alertsView) {
+ ListGrid listGrid = alertsView.getListGrid();
+ ListGridRecord[] records = listGrid.getSelection();
+
+ final Integer[] alertIds = new Integer[records.length];
+ for (int i = 0, selectionLength = records.length; i < selectionLength; i++) {
+ ListGridRecord record = records[i];
+ Integer alertId = record.getAttributeAsInt("id");
+ alertIds[i] = alertId;
+ }
+
+ this.alertService.deleteResourceAlerts(alertIds, new AsyncCallback<Void>() {
+ public void onSuccess(Void blah) {
+ System.out.println("Deleted Alerts with id's: " + Arrays.toString(alertIds) + ".");
+ alertsView.refresh();
+ }
+
+ public void onFailure(Throwable caught) {
+ Window.alert("Failed to delete Alerts with id's: " + Arrays.toString(alertIds) + " - cause: " + caught);
+ System.err.println("Failed to delete Alerts with id's " + Arrays.toString(alertIds) + " - cause: " + caught);
+ }
+ });
+ }
+
+ protected void executeFetch(final DSRequest request, final DSResponse response) {
+ final long start = System.currentTimeMillis();
+
+ AlertCriteria criteria = getCriteria(request);
+
+ this.alertService.findAlertsByCriteria(criteria, new AsyncCallback<PageList<Alert>>() {
+ public void onFailure(Throwable caught) {
+ Window.alert("Failed to fetch Alerts - cause: " + caught);
+ System.err.println("Failed to fetch Alerts - cause: " + caught);
+ response.setStatus(RPCResponse.STATUS_FAILURE);
+ processResponse(request.getRequestId(), response);
+ }
+
+ public void onSuccess(PageList<Alert> result) {
+ long fetchTime = System.currentTimeMillis() - start;
+ System.out.println(result.size() + " Alerts fetched in: " + fetchTime + "ms");
+
+ response.setData(buildRecords(result));
+ // For paging to work, we have to specify size of full result set.
+ response.setTotalRows(result.getTotalSize());
+ processResponse(request.getRequestId(), response);
+ }
+ });
+ }
+
+ protected AlertCriteria getCriteria(DSRequest request) {
+ AlertCriteria criteria = new AlertCriteria();
+ criteria.fetchAlertDefinition(true);
+ criteria.fetchRecoveryAlertDefinition(true);
+ // TODO: Uncomment the below once the bad performance of it has been fixed.
+ //criteria.fetchConditionLogs(true);
+
+ Criteria requestCriteria = request.getCriteria();
+ if (requestCriteria != null) {
+ Map values = requestCriteria.getValues();
+ for (Object key : values.keySet()) {
+ String fieldName = (String) key;
+ if (fieldName.equals(AlertCriteria.SORT_FIELD_RESOURCE_ID)) {
+ Integer resourceId = (Integer) values.get(fieldName);
+ criteria.addFilterResourceIds(resourceId);
+ }
+ // TODO: Add support for other fields we need to filter by (e.g. resourceGroupId).
+ }
+ }
+
+ criteria.setPageControl(getPageControl(request));
+ return criteria;
+ }
+
+ @Override
+ public Alert copyValues(ListGridRecord from) {
+ return null; // TODO: Implement this method.
+ }
+
+ @Override
+ public ListGridRecord copyValues(Alert from) {
+ ListGridRecord record = new ListGridRecord();
+ record.setAttribute("id", from.getId());
+ record.setAttribute("resourceId", from.getAlertDefinition().getResource().getId());
+ record.setAttribute("name", from.getAlertDefinition().getName());
+ record.setAttribute("priority", from.getAlertDefinition().getPriority().name());
+ record.setAttribute("ctime", DATE_TIME_FORMAT.format(new Date(from.getCtime())));
+
+ Set<AlertConditionLog> conditionLogs = from.getConditionLogs();
+ String conditionText;
+ String conditionValue;
+ if (conditionLogs.size() > 1) {
+ conditionText = "Multiple Conditions";
+ conditionValue = "--";
+ } else if (conditionLogs.size() == 1) {
+ AlertConditionLog conditionLog = conditionLogs.iterator().next();
+ AlertCondition condition = conditionLog.getCondition();
+ conditionText = AlertFormatUtility.formatAlertConditionForDisplay(condition);
+ conditionValue = conditionLog.getValue();
+ if (condition.getMeasurementDefinition() != null) {
+ conditionValue = MeasurementConverterClient.format(Double.valueOf(conditionLog.getValue()), condition
+ .getMeasurementDefinition().getUnits(), true);
+ }
+ } else {
+ conditionText = "No Conditions";
+ conditionValue = "--";
+ }
+ record.setAttribute("conditionText", conditionText);
+ record.setAttribute("conditionValue", conditionValue);
+
+ String recoveryInfo = AlertFormatUtility.getAlertRecoveryInfo(from);
+ record.setAttribute("recoveryInfo", recoveryInfo);
+ return record;
+ }
+
+ protected void executeRemove(final DSRequest request, final DSResponse response) {
+ JavaScriptObject data = request.getData ();
+ ListGridRecord record = new ListGridRecord(data);
+ Window.alert(String.valueOf(record.getAttributeAsInt("id")));
+ }
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
new file mode 100644
index 0000000..9b1bb74
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
@@ -0,0 +1,129 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.alert;
+
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.data.SortSpecifier;
+import com.smartgwt.client.types.SortDirection;
+import com.smartgwt.client.widgets.HTMLFlow;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
+import com.smartgwt.client.widgets.grid.events.SelectionEvent;
+import com.smartgwt.client.widgets.layout.HLayout;
+import com.smartgwt.client.widgets.layout.VLayout;
+import org.rhq.core.domain.criteria.AlertCriteria;
+import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
+
+/**
+ * A view that displays a paginated table of fired {@link org.rhq.core.domain.alert.Alert alert}s, along with the
+ * ability to filter or sort those alerts, click on an alert to view details about that alert's definition, or delete
+ * selected alerts.
+ *
+ * @author Ian Springer
+ */
+public class AlertsView extends VLayout {
+ private static final String TITLE = "Alerts";
+
+ private static final SortSpecifier[] SORT_SPECIFIERS = new SortSpecifier[] {
+ new SortSpecifier(AlertCriteria.SORT_FIELD_CTIME, SortDirection.DESCENDING),
+ new SortSpecifier(AlertCriteria.SORT_FIELD_NAME, SortDirection.ASCENDING)
+ };
+
+ private static final String DELETE_CONFIRM_MESSAGE = "Are you sure you want to delete the selected alert(s)?";
+
+ private Table table;
+ private AlertDataSource dataSource;
+ private HTMLFlow detailsContent;
+
+ public AlertsView(Criteria criteria, String[] excludedFieldNames) {
+ this.table = new Table(TITLE, criteria, SORT_SPECIFIERS, excludedFieldNames);
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+
+ setWidth100();
+ setHeight100();
+ setMembersMargin(20);
+
+ // Add the list table as the top half of the view.
+ //Criteria criteria = new Criteria(AlertCriteria.);
+ this.table.setHeight("50%");
+ ListGrid listGrid = this.table.getListGrid();
+ this.dataSource = new AlertDataSource();
+ this.table.setDataSource(this.dataSource);
+
+ this.table.addTableAction("Delete", Table.SelectionEnablement.ANY, DELETE_CONFIRM_MESSAGE, new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ AlertsView.this.dataSource.deleteAlerts(AlertsView.this);
+ }
+ });
+
+ listGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
+ public void onSelectionChanged(SelectionEvent event) {
+ ListGridRecord[] selectedRecords = AlertsView.this.table.getListGrid().getSelection();
+ String contents;
+ if (selectedRecords.length == 1) {
+ ListGridRecord record = selectedRecords[0];
+ String name = record.getAttribute("name");
+ String id = record.getAttribute("id");
+ // TODO: Finish this.
+ contents = "Details for alert '" + name + "' with id " + id + "...<h2>TODO</h2>";
+
+ } else {
+ contents = "Select a single alert above to display its details here.";
+ }
+ AlertsView.this.detailsContent.setContents(contents);
+ }
+ });
+
+ addMember(this.table);
+
+ // Add the details panel as the bottom half of the view.
+ HLayout detailsPane = new HLayout();
+ detailsPane.setWidth100();
+ detailsPane.setHeight("50%");
+ this.detailsContent = new HTMLFlow("Select a single alert above to display its details here.");
+ this.detailsContent.setWidth100();
+ detailsPane.addMember(this.detailsContent);
+ addMember(detailsPane);
+ }
+
+ protected Criteria getCriteria() {
+ return null;
+ }
+
+ ListGrid getListGrid() {
+ return this.table.getListGrid();
+ }
+
+ public void refresh() {
+ this.table.getListGrid().invalidateCache();
+ //this.table.getListGrid().markForRedraw();
+ }
+
+ public void refresh(Criteria criteria) {
+ this.table.refresh(criteria);
+ //this.table.getListGrid().markForRedraw();
+ }
+
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/SubsystemResourceAlertDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/SubsystemResourceAlertDataSource.java
index 322467d..4fd84c1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/SubsystemResourceAlertDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/SubsystemResourceAlertDataSource.java
@@ -29,7 +29,7 @@ import org.rhq.core.domain.criteria.AlertCriteria;
/**
* @author Ian Springer
*/
-public class SubsystemResourceAlertDataSource extends AbstractAlertDataSource {
+public class SubsystemResourceAlertDataSource extends AlertDataSource {
@Override
protected void onInit() {
super.onInit();
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 b502d2f..84cc93a 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
@@ -50,26 +50,38 @@ public class Table extends VLayout {
private ListGrid listGrid;
private ToolStrip footer;
private Label tableInfo;
+ private String[] excludedFieldNames;
public enum SelectionEnablement {
- ANY, SINGLE, MULTIPLE
+ /**
+ * One or more rows are selected.
+ */
+ ANY,
+ /**
+ * Exactly one row is selected.
+ */
+ SINGLE,
+ /**
+ * Two or more rows are selected.
+ */
+ MULTIPLE
};
private ArrayList<TableActionInfo> tableActions = new ArrayList<TableActionInfo>();
public Table(String tableTitle) {
- this(tableTitle, null, null);
+ this(tableTitle, null, null, null);
}
public Table(String tableTitle, Criteria criteria) {
- this(tableTitle, criteria, null);
+ this(tableTitle, criteria, null, null);
}
public Table(String tableTitle, SortSpecifier[] sortSpecifiers) {
- this(tableTitle, null, sortSpecifiers);
+ this(tableTitle, null, sortSpecifiers, null);
}
- public Table(String tableTitle, Criteria criteria, SortSpecifier[] sortSpecifiers) {
+ public Table(String tableTitle, Criteria criteria, SortSpecifier[] sortSpecifiers, String[] excludedFieldNames) {
super();
setWidth100();
@@ -104,6 +116,8 @@ public class Table extends VLayout {
footer.setMembersMargin(15);
tableInfo = new Label("Total: " + listGrid.getTotalRows());
+
+ this.excludedFieldNames = excludedFieldNames;
}
@@ -111,6 +125,15 @@ public class Table extends VLayout {
protected void onDraw() {
super.onDraw();
+ // NOTE: It is essential that we wait to hide any excluded fields until after super.onDraw() is called, since
+ // super.onDraw() is what actually adds the fields to the ListGrid (based on what fields are defined in
+ // the underlying datasource).
+ if (this.excludedFieldNames != null) {
+ for (String excludedFieldName : excludedFieldNames) {
+ this.listGrid.hideField(excludedFieldName);
+ }
+ }
+
addMember(title);
addMember(listGrid);
addMember(footer);
@@ -141,7 +164,6 @@ public class Table extends VLayout {
footer.addMember(new LayoutSpacer());
footer.addMember(tableInfo);
-
// Manages enable/disable buttons for the grid
listGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
public void onSelectionChanged(SelectionEvent selectionEvent) {
@@ -156,6 +178,11 @@ public class Table extends VLayout {
});
}
+ public void refresh(Criteria criteria) {
+ this.listGrid.setCriteria(criteria);
+ this.listGrid.markForRedraw();
+ }
+
public void setTableTitle(String title) {
this.title.setContents(title);
}
@@ -164,17 +191,18 @@ public class Table extends VLayout {
listGrid.setDataSource(dataSource);
}
+ public RPCDataSource getDataSource() {
+ return (RPCDataSource) listGrid.getDataSource();
+ }
public ListGrid getListGrid() {
return listGrid;
}
-
public void addTableAction(String title, TableAction tableAction) {
this.addTableAction(title, SelectionEnablement.ANY, null, tableAction);
}
-
public void addTableAction(String title, SelectionEnablement enablement, String confirmation, TableAction tableAction) {
TableActionInfo info = new TableActionInfo(title, enablement, tableAction);
info.confirmMessage = confirmation;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/alert/ResourceAlertDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/alert/ResourceAlertDataSource.java
deleted file mode 100644
index 1818a54..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/alert/ResourceAlertDataSource.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.alert;
-
-import com.smartgwt.client.data.DSRequest;
-import org.rhq.core.domain.criteria.AlertCriteria;
-import org.rhq.enterprise.gui.coregui.client.alert.AbstractAlertDataSource;
-
-import java.util.Arrays;
-
-/**
- * @author Ian Springer
- */
-public class ResourceAlertDataSource extends AbstractAlertDataSource {
- private Integer resourceId;
-
- public ResourceAlertDataSource(int resourceId) {
- super();
- this.resourceId = resourceId;
- }
-
- @Override
- protected AlertCriteria getCriteria(DSRequest request) {
- AlertCriteria criteria = super.getCriteria(request);
- criteria.addFilterResourceIds(this.resourceId);
- return criteria;
- }
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/alert/ResourceAlertHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/alert/ResourceAlertHistoryView.java
index b14fcf5..cfa77c0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/alert/ResourceAlertHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/alert/ResourceAlertHistoryView.java
@@ -22,35 +22,30 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.alert;
+import com.smartgwt.client.data.Criteria;
+import org.rhq.core.domain.criteria.AlertCriteria;
import org.rhq.core.domain.resource.Resource;
-import org.rhq.enterprise.gui.coregui.client.alert.AbstractAlertDataSource;
-import org.rhq.enterprise.gui.coregui.client.alert.AbstractAlertsView;
+import org.rhq.enterprise.gui.coregui.client.alert.AlertsView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
/**
* @author Ian Springer
*/
-public class ResourceAlertHistoryView extends AbstractAlertsView
- implements ResourceSelectListener {
- private int resourceId;
+public class ResourceAlertHistoryView extends AlertsView
+ implements ResourceSelectListener {
+ private static final String[] EXCLUDED_FIELD_NAMES = new String[] { AlertCriteria.SORT_FIELD_RESOURCE_ID };
public ResourceAlertHistoryView(int resourceId) {
- super();
- this.resourceId = resourceId;
+ super(createCriteria(resourceId), EXCLUDED_FIELD_NAMES);
}
- @Override
- protected void onInit() {
- super.onInit();
- }
-
- @Override
- protected AbstractAlertDataSource createDataSource() {
- return new ResourceAlertDataSource(this.resourceId);
+ public void onResourceSelected(Resource resource) {
+ refresh(createCriteria(resource.getId()));
}
- public void onResourceSelected(Resource resource) {
- this.resourceId = resource.getId();
- markForRedraw();
+ private static Criteria createCriteria(int resourceId) {
+ Criteria criteria = new Criteria();
+ criteria.addCriteria(AlertCriteria.SORT_FIELD_RESOURCE_ID, resourceId);
+ return criteria;
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
index 85e4dda..0774160 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
@@ -38,14 +38,14 @@ import com.smartgwt.client.widgets.grid.ListGridRecord;
public abstract class RPCDataSource<T> extends DataSource {
public RPCDataSource() {
- setClientOnly(false);
- setDataProtocol(DSProtocol.CLIENTCUSTOM);
- setDataFormat(DSDataFormat.CUSTOM);
+ this(null);
}
public RPCDataSource(String name) {
- System.out.println("Trying to build DS: " + name);
- setID(name);
+ if (name != null) {
+ System.out.println("Trying to build DS: " + name);
+ setID(name);
+ }
setClientOnly(false);
setDataProtocol(DSProtocol.CLIENTCUSTOM);
setDataFormat(DSDataFormat.CUSTOM);
@@ -111,8 +111,6 @@ public abstract class RPCDataSource<T> extends DataSource {
}
-
-
public ListGridRecord[] buildRecords(PageList<T> list) {
if (list == null) {
return null;
@@ -129,9 +127,9 @@ public abstract class RPCDataSource<T> extends DataSource {
/**
* Extensions should implement this method to retrieve data. Paging solutions should use
- * @see getPageControl(). All implementations should call processResponse whether they
- * fail or succeed. Data should be set on the request via setData. Implementations can use
- * buildRecords to get the list of records.
+ * {@link #getPageControl(com.smartgwt.client.data.DSRequest)}. All implementations should call processResponse()
+ * whether they fail or succeed. Data should be set on the request via setData. Implementations can use
+ * buildRecords() to get the list of records.
*
* @param request
* @param response
commit bf3cbe9cf4a788cec11ebf0e8f638e7d6134b7e5
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Fri Mar 5 20:39:10 2010 -0500
make sure button enablement state get refreshed after a Delete or other action completes
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AbstractAlertDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AbstractAlertDataSource.java
index 6385357..c258db2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AbstractAlertDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AbstractAlertDataSource.java
@@ -105,7 +105,7 @@ public abstract class AbstractAlertDataSource extends RPCDataSource<Alert> {
}
void deleteAlerts(final AbstractAlertsView alertsView) {
- final ListGrid listGrid = alertsView.getListGrid();
+ ListGrid listGrid = alertsView.getListGrid();
ListGridRecord[] records = listGrid.getSelection();
final Integer[] alertIds = new Integer[records.length];
@@ -118,8 +118,7 @@ public abstract class AbstractAlertDataSource extends RPCDataSource<Alert> {
this.alertService.deleteResourceAlerts(alertIds, new AsyncCallback<Void>() {
public void onSuccess(Void blah) {
System.out.println("Deleted Alerts with id's: " + Arrays.toString(alertIds) + ".");
- listGrid.invalidateCache();
- listGrid.redraw();
+ alertsView.refresh();
}
public void onFailure(Throwable caught) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AbstractAlertsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AbstractAlertsView.java
index c158a2f..dcf0e9f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AbstractAlertsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AbstractAlertsView.java
@@ -46,7 +46,7 @@ public abstract class AbstractAlertsView extends VLayout {
new SortSpecifier(AlertCriteria.SORT_FIELD_NAME, SortDirection.ASCENDING)
};
- private static final String DELETE_CONFIRM_MESSAGE = "Are you sure you want to delete the selected alerts?";
+ private static final String DELETE_CONFIRM_MESSAGE = "Are you sure you want to delete the selected alert(s)?";
private ListGrid listGrid;
private AbstractAlertDataSource dataSource;
@@ -65,12 +65,11 @@ public abstract class AbstractAlertsView extends VLayout {
table.setHeight("50%");
this.listGrid = table.getListGrid();
this.dataSource = createDataSource();
- table.setDataSource(dataSource);
+ table.setDataSource(this.dataSource);
table.addTableAction("Delete", Table.SelectionEnablement.ANY, DELETE_CONFIRM_MESSAGE, new TableAction() {
public void executeAction(ListGridRecord[] selection) {
AbstractAlertsView.this.dataSource.deleteAlerts(AbstractAlertsView.this);
-
}
});
@@ -109,4 +108,9 @@ public abstract class AbstractAlertsView extends VLayout {
ListGrid getListGrid() {
return this.listGrid;
}
+
+ public void refresh() {
+ this.listGrid.invalidateCache();
+ this.listGrid.markForRedraw();
+ }
}
\ No newline at end of file
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 61a1fc0..b502d2f 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
@@ -145,23 +145,13 @@ public class Table extends VLayout {
// Manages enable/disable buttons for the grid
listGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
public void onSelectionChanged(SelectionEvent selectionEvent) {
- int count = listGrid.getSelection().length;
- for (TableActionInfo tableAction : tableActions) {
- if (count == 0) {
- tableAction.actionButton.setDisabled(true);
- } else if (count == 1) {
- tableAction.actionButton.setDisabled(tableAction.enablement == SelectionEnablement.MULTIPLE);
- } else if (count > 1) {
- tableAction.actionButton.setDisabled(tableAction.enablement == SelectionEnablement.SINGLE);
- }
- }
- tableInfo.setContents("Total: " + listGrid.getTotalRows() + " (" + count + " selected)");
+ refreshTableInfo();
}
});
listGrid.addDataArrivedHandler(new DataArrivedHandler() {
public void onDataArrived(DataArrivedEvent dataArrivedEvent) {
- tableInfo.setContents("Total: " + listGrid.getTotalRows() + " (" + listGrid.getSelection().length + " selected)");
+ refreshTableInfo();
}
});
}
@@ -191,6 +181,20 @@ public class Table extends VLayout {
tableActions.add(info);
}
+ private void refreshTableInfo() {
+ int count = this.listGrid.getSelection().length;
+ for (TableActionInfo tableAction : tableActions) {
+ if (count == 0) {
+ tableAction.actionButton.setDisabled(true);
+ } else if (count == 1) {
+ tableAction.actionButton.setDisabled(tableAction.enablement == SelectionEnablement.MULTIPLE);
+ } else if (count > 1) {
+ tableAction.actionButton.setDisabled(tableAction.enablement == SelectionEnablement.SINGLE);
+ }
+ }
+ this.tableInfo.setContents("Total: " + listGrid.getTotalRows() + " (" + count + " selected)");
+ }
+
// -------------- Inner utility class -------------
@@ -209,5 +213,4 @@ public class Table extends VLayout {
this.action = action;
}
}
-
}
commit 5023798b7704fe7b7fdee9120b9a471c3386512a
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Fri Mar 5 19:58:17 2010 -0500
update Alerts>History tab to use new Table component; start implementing selected Alert details pane on Alerts>History tab
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AbstractAlertDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AbstractAlertDataSource.java
index 4cbd8b5..6385357 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AbstractAlertDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AbstractAlertDataSource.java
@@ -105,7 +105,7 @@ public abstract class AbstractAlertDataSource extends RPCDataSource<Alert> {
}
void deleteAlerts(final AbstractAlertsView alertsView) {
- ListGrid listGrid = alertsView.getListGrid();
+ final ListGrid listGrid = alertsView.getListGrid();
ListGridRecord[] records = listGrid.getSelection();
final Integer[] alertIds = new Integer[records.length];
@@ -118,7 +118,8 @@ public abstract class AbstractAlertDataSource extends RPCDataSource<Alert> {
this.alertService.deleteResourceAlerts(alertIds, new AsyncCallback<Void>() {
public void onSuccess(Void blah) {
System.out.println("Deleted Alerts with id's: " + Arrays.toString(alertIds) + ".");
- alertsView.reloadData();
+ listGrid.invalidateCache();
+ listGrid.redraw();
}
public void onFailure(Throwable caught) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AbstractAlertsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AbstractAlertsView.java
index 09fc0d2..c158a2f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AbstractAlertsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AbstractAlertsView.java
@@ -18,31 +18,18 @@
*/
package org.rhq.enterprise.gui.coregui.client.alert;
-import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.data.SortSpecifier;
-import com.smartgwt.client.types.Autofit;
-import com.smartgwt.client.types.SelectionAppearance;
-import com.smartgwt.client.types.SelectionStyle;
import com.smartgwt.client.types.SortDirection;
-import com.smartgwt.client.types.VisibilityMode;
-import com.smartgwt.client.util.BooleanCallback;
-import com.smartgwt.client.util.SC;
-import com.smartgwt.client.widgets.IButton;
-import com.smartgwt.client.widgets.Label;
-import com.smartgwt.client.widgets.events.ClickEvent;
-import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.grid.ListGrid;
-import com.smartgwt.client.widgets.grid.events.DataArrivedEvent;
-import com.smartgwt.client.widgets.grid.events.DataArrivedHandler;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionEvent;
-import com.smartgwt.client.widgets.layout.LayoutSpacer;
-import com.smartgwt.client.widgets.layout.SectionStack;
-import com.smartgwt.client.widgets.layout.SectionStackSection;
+import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.VLayout;
-import com.smartgwt.client.widgets.toolbar.ToolStrip;
import org.rhq.core.domain.criteria.AlertCriteria;
-import org.rhq.enterprise.gui.coregui.client.admin.roles.RoleEditView;
+import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
/**
* A view that displays a paginated table of fired {@link org.rhq.core.domain.alert.Alert alert}s, along with the
@@ -51,134 +38,75 @@ import org.rhq.enterprise.gui.coregui.client.admin.roles.RoleEditView;
*
* @author Ian Springer
*/
-public abstract class AbstractAlertsView extends SectionStack {
+public abstract class AbstractAlertsView extends VLayout {
+ private static final String TABLE_TITLE = "Alerts";
+
private static final SortSpecifier[] INITIAL_SORT_SPECIFIERS = new SortSpecifier[] {
new SortSpecifier(AlertCriteria.SORT_FIELD_CTIME, SortDirection.DESCENDING),
new SortSpecifier(AlertCriteria.SORT_FIELD_NAME, SortDirection.ASCENDING)
};
+ private static final String DELETE_CONFIRM_MESSAGE = "Are you sure you want to delete the selected alerts?";
+
private ListGrid listGrid;
- private IButton removeButton;
- private Label tableInfo;
private AbstractAlertDataSource dataSource;
-
- public AbstractAlertsView() {
- }
+ private HTMLFlow detailsContent;
@Override
protected void onInit() {
super.onInit();
- setVisibilityMode(VisibilityMode.MULTIPLE);
setWidth100();
setHeight100();
+ setMembersMargin(20);
- VLayout gridHolder = new VLayout();
- gridHolder.setWidth100();
- gridHolder.setHeight100();
-
- this.listGrid = new ListGrid();
-
- // Appearance settings.
- this.listGrid.setWidth100();
- this.listGrid.setHeight100();
- this.listGrid.setAutoFitData(Autofit.HORIZONTAL);
- this.listGrid.setAlternateRecordStyles(true);
- this.listGrid.setSelectionType(SelectionStyle.SIMPLE);
- this.listGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
- //this.listGrid.setShowFilterEditor(true);
-
- // Data settings.
- this.dataSource = (AbstractAlertDataSource) createDataSource();
- this.listGrid.setDataSource(createDataSource());
- this.listGrid.setUseAllDataSourceFields(true);
- this.listGrid.setAutoFetchData(true);
- this.listGrid.setInitialSort(INITIAL_SORT_SPECIFIERS);
-
- gridHolder.addMember(this.listGrid);
-
- ToolStrip toolStrip = new ToolStrip();
- toolStrip.setMembersMargin(15);
-
- this.removeButton = new IButton("Delete");
- this.removeButton.setDisabled(true);
- this.removeButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- SC.confirm("Are you sure you want to delete the " + AbstractAlertsView.this.listGrid.getSelection().length
- + " selected alerts?",
- new BooleanCallback() {
- public void execute(Boolean confirmed) {
- if (confirmed) {
- //listGrid.removeSelectedData();
- dataSource.deleteAlerts(AbstractAlertsView.this);
- }
- }
- }
- );
- }
- });
- toolStrip.addMember(this.removeButton);
- toolStrip.addMember(new LayoutSpacer());
+ // Add the list table as the top half of the view.
+ Table table = new Table(TABLE_TITLE, INITIAL_SORT_SPECIFIERS);
+ table.setHeight("50%");
+ this.listGrid = table.getListGrid();
+ this.dataSource = createDataSource();
+ table.setDataSource(dataSource);
- this.tableInfo = new Label();
- this.tableInfo.setWrap(false);
- toolStrip.addMember(this.tableInfo);
+ table.addTableAction("Delete", Table.SelectionEnablement.ANY, DELETE_CONFIRM_MESSAGE, new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ AbstractAlertsView.this.dataSource.deleteAlerts(AbstractAlertsView.this);
- gridHolder.addMember(toolStrip);
-
- this.listGrid.addDataArrivedHandler(new DataArrivedHandler() {
- public void onDataArrived(DataArrivedEvent event) {
- updateFooter();
}
});
+
this.listGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
public void onSelectionChanged(SelectionEvent event) {
- updateFooter();
+ ListGridRecord[] selectedRecords = listGrid.getSelection();
+ String contents;
+ if (selectedRecords.length == 1) {
+ ListGridRecord record = selectedRecords[0];
+ String name = record.getAttribute("name");
+ String id = record.getAttribute("id");
+ // TODO: Finish this.
+ contents = "Details for alert '" + name + "' with id " + id + "...<h2>TODO</h2>";
+
+ } else {
+ contents = "Select a single alert above to display its details here.";
+ }
+ detailsContent.setContents(contents);
}
- });
-
- SectionStackSection topSection = new SectionStackSection("Alerts");
- topSection.setExpanded(true);
- topSection.setItems(gridHolder);
-
- addSection(topSection);
-
- final RoleEditView roleEditor = new RoleEditView();
+ });
- final SectionStackSection detailSection = new SectionStackSection("Selected Alert");
- detailSection.setItems(roleEditor);
- addSection(detailSection);
+ addMember(table);
- this.listGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
- public void onSelectionChanged(SelectionEvent selectionEvent) {
- if (selectionEvent.getState()) {
- expandSection(1);
- roleEditor.editRecord(selectionEvent.getRecord());
- } else
- collapseSection(1);
- roleEditor.editNone();
- }
- });
+ // Add the details panel as the bottom half of the view.
+ HLayout detailsPane = new HLayout();
+ detailsPane.setWidth100();
+ detailsPane.setHeight("50%");
+ this.detailsContent = new HTMLFlow("Select a single alert above to display its details here.");
+ this.detailsContent.setWidth100();
+ detailsPane.addMember(this.detailsContent);
+ addMember(detailsPane);
}
- protected abstract DataSource createDataSource();
+ protected abstract AbstractAlertDataSource createDataSource();
ListGrid getListGrid() {
return this.listGrid;
}
-
- void reloadData() {
- this.tableInfo.setContents("");
- this.listGrid.invalidateCache();
- //this.listGrid.markForRedraw();
- }
-
- private void updateFooter() {
- String label = "Total: " + this.listGrid.getTotalRows();
- if (this.listGrid.anySelected()) {
- label += " (" + this.listGrid.getSelection().length + " selected)";
- }
- this.tableInfo.setContents(label);
- this.removeButton.setDisabled(!listGrid.anySelected());
- }
}
\ No newline at end of file
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 636519b..61a1fc0 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
@@ -18,6 +18,7 @@
*/
package org.rhq.enterprise.gui.coregui.client.components.table;
+import com.smartgwt.client.data.SortSpecifier;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
import com.smartgwt.client.data.Criteria;
@@ -50,21 +51,25 @@ public class Table extends VLayout {
private ToolStrip footer;
private Label tableInfo;
-
-
public enum SelectionEnablement {
ANY, SINGLE, MULTIPLE
};
-
private ArrayList<TableActionInfo> tableActions = new ArrayList<TableActionInfo>();
-
public Table(String tableTitle) {
- this(tableTitle,null);
+ this(tableTitle, null, null);
}
public Table(String tableTitle, Criteria criteria) {
+ this(tableTitle, criteria, null);
+ }
+
+ public Table(String tableTitle, SortSpecifier[] sortSpecifiers) {
+ this(tableTitle, null, sortSpecifiers);
+ }
+
+ public Table(String tableTitle, Criteria criteria, SortSpecifier[] sortSpecifiers) {
super();
setWidth100();
@@ -83,13 +88,15 @@ public class Table extends VLayout {
if (criteria != null) {
listGrid.setInitialCriteria(criteria);
}
+ if (sortSpecifiers != null) {
+ listGrid.setInitialSort(sortSpecifiers);
+ }
listGrid.setWidth100();
listGrid.setHeight100();
listGrid.setAutoFetchData(true);
listGrid.setAutoFitData(Autofit.HORIZONTAL);
listGrid.setAlternateRecordStyles(true);
-
// Footer
footer = new ToolStrip();
footer.setPadding(5);
@@ -108,18 +115,17 @@ public class Table extends VLayout {
addMember(listGrid);
addMember(footer);
-
tableInfo.setWrap(false);
for (final TableActionInfo tableAction : tableActions) {
IButton button = new IButton(tableAction.title);
- button.setDisabled(tableAction.enablement != SelectionEnablement.ANY);
+ button.setDisabled(true);
button.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
if (tableAction.confirmMessage != null) {
SC.ask(tableAction.confirmMessage, new BooleanCallback() {
- public void execute(Boolean aBoolean) {
- if (aBoolean) {
+ public void execute(Boolean confirmed) {
+ if (confirmed) {
tableAction.action.executeAction(listGrid.getSelection());
}
}
@@ -142,9 +148,9 @@ public class Table extends VLayout {
int count = listGrid.getSelection().length;
for (TableActionInfo tableAction : tableActions) {
if (count == 0) {
- tableAction.actionButton.setDisabled(tableAction.enablement != SelectionEnablement.ANY);
+ tableAction.actionButton.setDisabled(true);
} else if (count == 1) {
- tableAction.actionButton.setDisabled(false);
+ tableAction.actionButton.setDisabled(tableAction.enablement == SelectionEnablement.MULTIPLE);
} else if (count > 1) {
tableAction.actionButton.setDisabled(tableAction.enablement == SelectionEnablement.SINGLE);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/alert/ResourceAlertHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/alert/ResourceAlertHistoryView.java
index 96eb309..b14fcf5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/alert/ResourceAlertHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/alert/ResourceAlertHistoryView.java
@@ -22,8 +22,8 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.alert;
-import com.smartgwt.client.data.DataSource;
import org.rhq.core.domain.resource.Resource;
+import org.rhq.enterprise.gui.coregui.client.alert.AbstractAlertDataSource;
import org.rhq.enterprise.gui.coregui.client.alert.AbstractAlertsView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
@@ -45,7 +45,7 @@ public class ResourceAlertHistoryView extends AbstractAlertsView
}
@Override
- protected DataSource createDataSource() {
+ protected AbstractAlertDataSource createDataSource() {
return new ResourceAlertDataSource(this.resourceId);
}
commit ee8ac4f6b746c12022c30ff767abcf9d2c41ccad
Merge: 7c36753... 0a0da10...
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Fri Mar 5 17:46:44 2010 -0500
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
commit 7c367539f3dcf6d72af848c03be35bb39af84c43
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Fri Mar 5 17:45:34 2010 -0500
update history value change listener so that if the requested path and the current path have a common base path, renderView() is only called for the part of the requested path after the common base path; implement Alert>History Resource tab
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 5330f61..d18ed2b 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
@@ -35,6 +35,7 @@ import com.smartgwt.client.widgets.layout.VLayout;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
+import java.util.LinkedList;
import java.util.List;
/**
@@ -125,9 +126,7 @@ public class CoreGUI implements EntryPoint {
});
}
-
private void buildCoreUI() {
-
RootCanvas rootCanvas = new RootCanvas();
this.currentView = this.rootView = new View(new ViewId("", null), rootCanvas);
@@ -166,23 +165,42 @@ public class CoreGUI implements EntryPoint {
System.out.println("History request: " + path);
List<String> viewIdNames = path.equals("") ? Collections.<String>emptyList() : Arrays.asList(path.split("\\/"));
-
+ String currentPath = CoreGUI.this.currentView.getId().getPath();
+ List<String> currentViewIdNames = currentPath.equals("") ? Collections.<String>emptyList() : Arrays.asList(currentPath.split("\\/"));
+
+ int commonBasePathSize = 0;
+ for (int i = 0; i < viewIdNames.size() && i < currentViewIdNames.size(); i++) {
+ String name = viewIdNames.get(i);
+ String currentName = currentViewIdNames.get(i);
+ if (name.equals(currentName)) {
+ commonBasePathSize++;
+ } else {
+ break;
+ }
+ }
+ int startIndex;
View parentView;
- if (path.startsWith(CoreGUI.this.currentView.getId().getPath())) {
- // The requested path is a descendant path of the current view, so skip rendering of components of
- // the path corresponding to the current view. For example, if the current view is Resource/10001
- // and Resource/10001/Summary/Overview is requested, call renderView() only on for the Summary and
- // Overview components of the path.
+ if (commonBasePathSize > 0) {
+ // The requested path shares a common base path with the current view, so skip rendering of
+ // views corresponding to this common base path. For example, if the current view is
+ // Resource/10001/Summary/Overview and Resource/10001/Monitor/Graphs is requested, call renderView()
+ // only on for the Monitor and Graphs components of the path.
+ startIndex = commonBasePathSize;
+ int subViewsToRenderPathSize = viewIdNames.size() - commonBasePathSize;
parentView = CoreGUI.this.currentView;
+ for (int i = 0; i < subViewsToRenderPathSize; i++) {
+ parentView = parentView.getParent();
+ }
} else {
// Otherwise, start at the root view (i.e. call renderView() for every component in the path).
+ startIndex = 0;
parentView = CoreGUI.this.rootView;
}
-
+ System.out.println("Starting parent view: " + parentView);
+
ViewRenderer viewRenderer = parentView.getDescendantViewRenderer();
- List<Breadcrumb> breadcrumbs = new ArrayList<Breadcrumb>(viewIdNames.size());
try {
- for (int i = 0, viewIdNamesSize = viewIdNames.size(); i < viewIdNamesSize; i++) {
+ for (int i = startIndex, viewIdNamesSize = viewIdNames.size(); i < viewIdNamesSize; i++) {
String viewIdName = viewIdNames.get(i);
// See if the parent view provided a view renderer to use for its descendants. If not,
// continue using the view renderer that renderer the parent view.
@@ -192,8 +210,10 @@ public class CoreGUI implements EntryPoint {
}
ViewId viewId = new ViewId(viewIdName, parentView.getId());
boolean lastNode = (i == (viewIdNamesSize - 1));
- parentView = viewRenderer.renderView(viewId, lastNode);
- breadcrumbs.add(parentView.getBreadcrumb());
+ View view = viewRenderer.renderView(viewId, lastNode);
+ view.setParent(parentView);
+
+ parentView = view;
}
} catch (UnknownViewException e) {
// Abort the for-loop, since once we hit an unknown name, we don't care about any remaining names
@@ -205,6 +225,12 @@ public class CoreGUI implements EntryPoint {
}
CoreGUI.this.currentView = parentView;
+ // Update the breadcrumb trail.
+ List<Breadcrumb> breadcrumbs = new LinkedList<Breadcrumb>();
+ while (parentView.getParent() != null) {
+ breadcrumbs.add(0, parentView.getBreadcrumb());
+ parentView = parentView.getParent();
+ }
System.out.println("Breadcrumbs: " + breadcrumbs);
breadCrumbTrailPane.setBreadcrumbs(breadcrumbs);
breadCrumbTrailPane.refresh();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/DemoCanvas.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/DemoCanvas.java
index 4468edf..9b4539a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/DemoCanvas.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/DemoCanvas.java
@@ -18,7 +18,6 @@
*/
package org.rhq.enterprise.gui.coregui.client;
-import org.rhq.enterprise.gui.coregui.client.alert.AlertsView;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSearchView;
@@ -54,7 +53,7 @@ public class DemoCanvas extends Canvas {
Tab tableTab = new Tab("Resource Search Table");
Tab treeTab = new Tab("Resource Tree");
final Tab configTab = new Tab("Configuration Editor");
- Tab alertHistoryTab = new Tab("Alert History");
+ //Tab alertHistoryTab = new Tab("Alert History");
// Agent: resource (10005) type (10060)
// Raw: 10003 / 10023
@@ -63,12 +62,12 @@ public class DemoCanvas extends Canvas {
//configTab.setPane(new ConfigurationEditor(10005, 10060, ConfigurationEditor.ConfigType.plugin));
//treeTab.setPane(new ResourceTreeView(new Resource(10001)));
tableTab.setPane(new ResourceSearchView());
- alertHistoryTab.setPane(new AlertsView());
+ //alertHistoryTab.setPane(new AbstractAlertsView());
topTabSet.addTab(configTab);
topTabSet.addTab(tableTab);
topTabSet.addTab(treeTab);
- topTabSet.addTab(alertHistoryTab);
+ //topTabSet.addTab(alertHistoryTab);
//topTabSet.selectTab(alertHistoryTab);
final Menu configSelectMenu = new Menu();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/View.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/View.java
index ae1a10b..eeaf777 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/View.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/View.java
@@ -29,22 +29,23 @@ package org.rhq.enterprise.gui.coregui.client;
*/
public class View {
private ViewId id;
- private ViewRenderer descendantViewRender;
+ private ViewRenderer descendantViewRenderer;
private Breadcrumb breadcrumb;
+ private View parent;
public View(ViewId id) {
this(id, null, null);
}
- public View(ViewId id, ViewRenderer descendantViewRender) {
- this(id, descendantViewRender, null);
+ public View(ViewId id, ViewRenderer descendantViewRenderer) {
+ this(id, descendantViewRenderer, null);
}
public View(ViewId id, Breadcrumb breadcrumb) {
this(id, null, breadcrumb);
}
- public View(ViewId id, ViewRenderer descendantViewRender, Breadcrumb breadcrumb) {
+ public View(ViewId id, ViewRenderer descendantViewRenderer, Breadcrumb breadcrumb) {
if (id == null) {
throw new IllegalArgumentException("Id is null.");
}
@@ -57,7 +58,7 @@ public class View {
} else {
this.breadcrumb = new Breadcrumb(id.getName());
}
- this.descendantViewRender = descendantViewRender;
+ this.descendantViewRenderer = descendantViewRenderer;
}
/**
@@ -79,7 +80,13 @@ public class View {
* descendant views
*/
public ViewRenderer getDescendantViewRenderer() {
- return this.descendantViewRender;
+ if (this.descendantViewRenderer != null) {
+ return this.descendantViewRenderer;
+ } else if (this.parent != null) {
+ return this.parent.getDescendantViewRenderer();
+ } else {
+ return null;
+ }
}
/**
@@ -93,11 +100,20 @@ public class View {
return this.breadcrumb;
}
+ public View getParent() {
+ return this.parent;
+ }
+
+ public void setParent(View parent) {
+ this.parent = parent;
+ }
+
@Override
public String toString() {
return "View[" +
"id=" + id +
- ", descendantViewRender=" + this.descendantViewRender +
+ ", descendantViewRenderer=" +
+ ((this.descendantViewRenderer != null) ? this.descendantViewRenderer.getClass().getName() : null) +
", breadcrumb=" + this.breadcrumb +
']';
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AbstractAlertDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AbstractAlertDataSource.java
new file mode 100644
index 0000000..4cbd8b5
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AbstractAlertDataSource.java
@@ -0,0 +1,214 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.alert;
+
+import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.i18n.client.DateTimeFormat;
+import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.data.DataSourceField;
+import com.smartgwt.client.data.fields.DataSourceIntegerField;
+import com.smartgwt.client.data.fields.DataSourceTextField;
+import com.smartgwt.client.rpc.RPCResponse;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import org.rhq.core.domain.alert.Alert;
+import org.rhq.core.domain.alert.AlertCondition;
+import org.rhq.core.domain.alert.AlertConditionLog;
+import org.rhq.core.domain.criteria.AlertCriteria;
+import org.rhq.core.domain.measurement.MeasurementConverterClient;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.gwt.AlertGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * A server-side SmartGWT DataSource for CRUD of {@link Alert}s.
+ *
+ * @author Ian Springer
+ */
+public abstract class AbstractAlertDataSource extends RPCDataSource<Alert> {
+ private static final String NAME = "Alert";
+ private static final DateTimeFormat DATE_TIME_FORMAT = DateTimeFormat.getMediumDateTimeFormat();
+
+ private AlertGWTServiceAsync alertService = GWTServiceLookup.getAlertService();
+
+ protected AbstractAlertDataSource() {
+ super(NAME);
+
+ setCanMultiSort(true);
+
+ List<DataSourceField> fields = createFields();
+ for (DataSourceField field : fields) {
+ addField(field);
+ }
+ }
+
+ protected List<DataSourceField> createFields() {
+ List<DataSourceField> fields = new ArrayList<DataSourceField>();
+
+ DataSourceField idField = new DataSourceIntegerField("id", "Id");
+ idField.setPrimaryKey(true);
+ idField.setHidden(true);
+ fields.add(idField);
+
+ DataSourceTextField nameField = new DataSourceTextField(AlertCriteria.SORT_FIELD_NAME, "Name", 100);
+ fields.add(nameField);
+
+ DataSourceTextField conditionTextField = new DataSourceTextField("conditionText", "Condition Text");
+ conditionTextField.setCanSortClientOnly(true);
+ fields.add(conditionTextField);
+
+ DataSourceTextField conditionValueField = new DataSourceTextField("conditionValue", "Condition Value");
+ conditionValueField.setCanSortClientOnly(true);
+ fields.add(conditionValueField);
+
+ DataSourceTextField recoveryInfoField = new DataSourceTextField("recoveryInfo", "Recovery Info");
+ recoveryInfoField.setCanSortClientOnly(true);
+ fields.add(recoveryInfoField);
+
+ // TODO: Will using DataSourceEnumField here allow us to do
+ // record.setAttribute("priority", alert.getAlertDefinition().getPriority()), rather than
+ // record.setAttribute("priority", alert.getAlertDefinition().getPriority().name()) in
+ // createRecord() below?
+ DataSourceTextField priorityField = new DataSourceTextField(AlertCriteria.SORT_FIELD_PRIORITY, "Priority", 15);
+ fields.add(priorityField);
+
+ DataSourceTextField ctimeField = new DataSourceTextField(AlertCriteria.SORT_FIELD_CTIME, "Creation Time");
+ fields.add(ctimeField);
+
+ return fields;
+ }
+
+ void deleteAlerts(final AbstractAlertsView alertsView) {
+ ListGrid listGrid = alertsView.getListGrid();
+ ListGridRecord[] records = listGrid.getSelection();
+
+ final Integer[] alertIds = new Integer[records.length];
+ for (int i = 0, selectionLength = records.length; i < selectionLength; i++) {
+ ListGridRecord record = records[i];
+ Integer alertId = record.getAttributeAsInt("id");
+ alertIds[i] = alertId;
+ }
+
+ this.alertService.deleteResourceAlerts(alertIds, new AsyncCallback<Void>() {
+ public void onSuccess(Void blah) {
+ System.out.println("Deleted Alerts with id's: " + Arrays.toString(alertIds) + ".");
+ alertsView.reloadData();
+ }
+
+ public void onFailure(Throwable caught) {
+ Window.alert("Failed to delete Alerts with id's: " + Arrays.toString(alertIds) + " - cause: " + caught);
+ System.err.println("Failed to delete Alerts with id's " + Arrays.toString(alertIds) + " - cause: " + caught);
+ }
+ });
+ }
+
+ protected void executeFetch(final DSRequest request, final DSResponse response) {
+ final long start = System.currentTimeMillis();
+
+ AlertCriteria criteria = getCriteria(request);
+
+ this.alertService.findAlertsByCriteria(criteria, new AsyncCallback<PageList<Alert>>() {
+ public void onFailure(Throwable caught) {
+ Window.alert("Failed to fetch Alerts - cause: " + caught);
+ System.err.println("Failed to fetch Alerts - cause: " + caught);
+ response.setStatus(RPCResponse.STATUS_FAILURE);
+ processResponse(request.getRequestId(), response);
+ }
+
+ public void onSuccess(PageList<Alert> result) {
+ long fetchTime = System.currentTimeMillis() - start;
+ System.out.println(result.size() + " Alerts fetched in: " + fetchTime + "ms");
+
+ response.setData(buildRecords(result));
+ // For paging to work, we have to specify size of full result set.
+ response.setTotalRows(result.getTotalSize());
+ processResponse(request.getRequestId(), response);
+ }
+ });
+ }
+
+ protected AlertCriteria getCriteria(DSRequest request) {
+ AlertCriteria criteria = new AlertCriteria();
+ criteria.fetchAlertDefinition(true);
+ criteria.fetchRecoveryAlertDefinition(true);
+ // TODO: Uncomment the below once the bad performance of it has been fixed.
+ //criteria.fetchConditionLogs(true);
+
+ criteria.setPageControl(getPageControl(request));
+ return criteria;
+ }
+
+ @Override
+ public Alert copyValues(ListGridRecord from) {
+ return null; // TODO: Implement this method.
+ }
+
+ @Override
+ public ListGridRecord copyValues(Alert from) {
+ ListGridRecord record = new ListGridRecord();
+ record.setAttribute("id", from.getId());
+ record.setAttribute("resourceId", from.getAlertDefinition().getResource().getId());
+ record.setAttribute("name", from.getAlertDefinition().getName());
+ record.setAttribute("priority", from.getAlertDefinition().getPriority().name());
+ record.setAttribute("ctime", DATE_TIME_FORMAT.format(new Date(from.getCtime())));
+
+ Set<AlertConditionLog> conditionLogs = from.getConditionLogs();
+ String conditionText;
+ String conditionValue;
+ if (conditionLogs.size() > 1) {
+ conditionText = "Multiple Conditions";
+ conditionValue = "--";
+ } else if (conditionLogs.size() == 1) {
+ AlertConditionLog conditionLog = conditionLogs.iterator().next();
+ AlertCondition condition = conditionLog.getCondition();
+ conditionText = AlertFormatUtility.formatAlertConditionForDisplay(condition);
+ conditionValue = conditionLog.getValue();
+ if (condition.getMeasurementDefinition() != null) {
+ conditionValue = MeasurementConverterClient.format(Double.valueOf(conditionLog.getValue()), condition
+ .getMeasurementDefinition().getUnits(), true);
+ }
+ } else {
+ conditionText = "No Conditions";
+ conditionValue = "--";
+ }
+ record.setAttribute("conditionText", conditionText);
+ record.setAttribute("conditionValue", conditionValue);
+
+ String recoveryInfo = AlertFormatUtility.getAlertRecoveryInfo(from);
+ record.setAttribute("recoveryInfo", recoveryInfo);
+ return record;
+ }
+
+ protected void executeRemove(final DSRequest request, final DSResponse response) {
+ JavaScriptObject data = request.getData ();
+ ListGridRecord record = new ListGridRecord(data);
+ Window.alert(String.valueOf(record.getAttributeAsInt("id")));
+ }
+
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AbstractAlertsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AbstractAlertsView.java
new file mode 100644
index 0000000..09fc0d2
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AbstractAlertsView.java
@@ -0,0 +1,184 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.alert;
+
+import com.smartgwt.client.data.DataSource;
+import com.smartgwt.client.data.SortSpecifier;
+import com.smartgwt.client.types.Autofit;
+import com.smartgwt.client.types.SelectionAppearance;
+import com.smartgwt.client.types.SelectionStyle;
+import com.smartgwt.client.types.SortDirection;
+import com.smartgwt.client.types.VisibilityMode;
+import com.smartgwt.client.util.BooleanCallback;
+import com.smartgwt.client.util.SC;
+import com.smartgwt.client.widgets.IButton;
+import com.smartgwt.client.widgets.Label;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.events.DataArrivedEvent;
+import com.smartgwt.client.widgets.grid.events.DataArrivedHandler;
+import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
+import com.smartgwt.client.widgets.grid.events.SelectionEvent;
+import com.smartgwt.client.widgets.layout.LayoutSpacer;
+import com.smartgwt.client.widgets.layout.SectionStack;
+import com.smartgwt.client.widgets.layout.SectionStackSection;
+import com.smartgwt.client.widgets.layout.VLayout;
+import com.smartgwt.client.widgets.toolbar.ToolStrip;
+import org.rhq.core.domain.criteria.AlertCriteria;
+import org.rhq.enterprise.gui.coregui.client.admin.roles.RoleEditView;
+
+/**
+ * A view that displays a paginated table of fired {@link org.rhq.core.domain.alert.Alert alert}s, along with the
+ * ability to filter or sort those alerts, click on an alert to view details about that alert's definition, or delete
+ * selected alerts.
+ *
+ * @author Ian Springer
+ */
+public abstract class AbstractAlertsView extends SectionStack {
+ private static final SortSpecifier[] INITIAL_SORT_SPECIFIERS = new SortSpecifier[] {
+ new SortSpecifier(AlertCriteria.SORT_FIELD_CTIME, SortDirection.DESCENDING),
+ new SortSpecifier(AlertCriteria.SORT_FIELD_NAME, SortDirection.ASCENDING)
+ };
+
+ private ListGrid listGrid;
+ private IButton removeButton;
+ private Label tableInfo;
+ private AbstractAlertDataSource dataSource;
+
+ public AbstractAlertsView() {
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+
+ setVisibilityMode(VisibilityMode.MULTIPLE);
+ setWidth100();
+ setHeight100();
+
+ VLayout gridHolder = new VLayout();
+ gridHolder.setWidth100();
+ gridHolder.setHeight100();
+
+ this.listGrid = new ListGrid();
+
+ // Appearance settings.
+ this.listGrid.setWidth100();
+ this.listGrid.setHeight100();
+ this.listGrid.setAutoFitData(Autofit.HORIZONTAL);
+ this.listGrid.setAlternateRecordStyles(true);
+ this.listGrid.setSelectionType(SelectionStyle.SIMPLE);
+ this.listGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
+ //this.listGrid.setShowFilterEditor(true);
+
+ // Data settings.
+ this.dataSource = (AbstractAlertDataSource) createDataSource();
+ this.listGrid.setDataSource(createDataSource());
+ this.listGrid.setUseAllDataSourceFields(true);
+ this.listGrid.setAutoFetchData(true);
+ this.listGrid.setInitialSort(INITIAL_SORT_SPECIFIERS);
+
+ gridHolder.addMember(this.listGrid);
+
+ ToolStrip toolStrip = new ToolStrip();
+ toolStrip.setMembersMargin(15);
+
+ this.removeButton = new IButton("Delete");
+ this.removeButton.setDisabled(true);
+ this.removeButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ SC.confirm("Are you sure you want to delete the " + AbstractAlertsView.this.listGrid.getSelection().length
+ + " selected alerts?",
+ new BooleanCallback() {
+ public void execute(Boolean confirmed) {
+ if (confirmed) {
+ //listGrid.removeSelectedData();
+ dataSource.deleteAlerts(AbstractAlertsView.this);
+ }
+ }
+ }
+ );
+ }
+ });
+ toolStrip.addMember(this.removeButton);
+ toolStrip.addMember(new LayoutSpacer());
+
+ this.tableInfo = new Label();
+ this.tableInfo.setWrap(false);
+ toolStrip.addMember(this.tableInfo);
+
+ gridHolder.addMember(toolStrip);
+
+ this.listGrid.addDataArrivedHandler(new DataArrivedHandler() {
+ public void onDataArrived(DataArrivedEvent event) {
+ updateFooter();
+ }
+ });
+ this.listGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
+ public void onSelectionChanged(SelectionEvent event) {
+ updateFooter();
+ }
+ });
+
+ SectionStackSection topSection = new SectionStackSection("Alerts");
+ topSection.setExpanded(true);
+ topSection.setItems(gridHolder);
+
+ addSection(topSection);
+
+ final RoleEditView roleEditor = new RoleEditView();
+
+ final SectionStackSection detailSection = new SectionStackSection("Selected Alert");
+ detailSection.setItems(roleEditor);
+ addSection(detailSection);
+
+ this.listGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
+ public void onSelectionChanged(SelectionEvent selectionEvent) {
+ if (selectionEvent.getState()) {
+ expandSection(1);
+ roleEditor.editRecord(selectionEvent.getRecord());
+ } else
+ collapseSection(1);
+ roleEditor.editNone();
+ }
+ });
+ }
+
+ protected abstract DataSource createDataSource();
+
+ ListGrid getListGrid() {
+ return this.listGrid;
+ }
+
+ void reloadData() {
+ this.tableInfo.setContents("");
+ this.listGrid.invalidateCache();
+ //this.listGrid.markForRedraw();
+ }
+
+ private void updateFooter() {
+ String label = "Total: " + this.listGrid.getTotalRows();
+ if (this.listGrid.anySelected()) {
+ label += " (" + this.listGrid.getSelection().length + " selected)";
+ }
+ this.tableInfo.setContents(label);
+ this.removeButton.setDisabled(!listGrid.anySelected());
+ }
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
deleted file mode 100644
index cdbe515..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.alert;
-
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.i18n.client.DateTimeFormat;
-import com.google.gwt.user.client.Window;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.data.DSRequest;
-import com.smartgwt.client.data.DSResponse;
-import com.smartgwt.client.data.DataSourceField;
-import com.smartgwt.client.data.fields.DataSourceIntegerField;
-import com.smartgwt.client.data.fields.DataSourceTextField;
-import com.smartgwt.client.rpc.RPCResponse;
-import com.smartgwt.client.widgets.grid.ListGrid;
-import com.smartgwt.client.widgets.grid.ListGridRecord;
-import org.rhq.core.domain.alert.Alert;
-import org.rhq.core.domain.alert.AlertCondition;
-import org.rhq.core.domain.alert.AlertConditionLog;
-import org.rhq.core.domain.criteria.AlertCriteria;
-import org.rhq.core.domain.measurement.MeasurementConverterClient;
-import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.gui.coregui.client.gwt.AlertGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
-
-import java.util.Arrays;
-import java.util.Date;
-import java.util.Set;
-
-/**
- * A server-side SmartGWT DataSource for CRUD of {@link Alert}s.
- *
- * @author Ian Springer
- */
-public class AlertDataSource extends RPCDataSource<Alert> {
- private static final String NAME = "Alert";
- private static final DateTimeFormat DATE_TIME_FORMAT = DateTimeFormat.getMediumDateTimeFormat();
-
- private static AlertDataSource INSTANCE;
-
- private AlertGWTServiceAsync alertService = GWTServiceLookup.getAlertService();
-
- public static AlertDataSource getInstance() {
- if (INSTANCE == null) {
- INSTANCE = new AlertDataSource();
- }
- return INSTANCE;
- }
-
- protected AlertDataSource() {
- super(NAME);
-
- setCanMultiSort(true);
-
- DataSourceField idField = new DataSourceIntegerField("id", "Id");
- idField.setPrimaryKey(true);
- idField.setHidden(true);
-
- // TODO: Replace 'Resource Id' column with 'Resource Name' and 'Resource Lineage' columns.
- DataSourceField resourceIdField = new DataSourceIntegerField(AlertCriteria.SORT_FIELD_RESOURCE_ID, "Resource Id");
-
- DataSourceTextField nameField = new DataSourceTextField(AlertCriteria.SORT_FIELD_NAME, "Name", 100);
-
- DataSourceTextField conditionTextField = new DataSourceTextField("conditionText", "Condition Text");
- conditionTextField.setCanSortClientOnly(true);
-
- DataSourceTextField conditionValueField = new DataSourceTextField("conditionValue", "Condition Value");
- conditionValueField.setCanSortClientOnly(true);
-
- DataSourceTextField recoveryInfoField = new DataSourceTextField("recoveryInfo", "Recovery Info");
- recoveryInfoField.setCanSortClientOnly(true);
-
- // TODO: Will using DataSourceEnumField here allow us to do
- // record.setAttribute("priority", alert.getAlertDefinition().getPriority()), rather than
- // record.setAttribute("priority", alert.getAlertDefinition().getPriority().name()) in
- // createRecord() below?
- DataSourceTextField priorityField = new DataSourceTextField(AlertCriteria.SORT_FIELD_PRIORITY, "Priority", 15);
-
- DataSourceTextField ctimeField = new DataSourceTextField(AlertCriteria.SORT_FIELD_CTIME, "Creation Time");
-
- setFields(idField, resourceIdField, nameField, conditionTextField, conditionValueField, recoveryInfoField,
- priorityField, ctimeField);
- }
-
- void deleteAlerts(final AlertsView alertsView) {
- ListGrid listGrid = alertsView.getListGrid();
- ListGridRecord[] records = listGrid.getSelection();
-
- final Integer[] alertIds = new Integer[records.length];
- for (int i = 0, selectionLength = records.length; i < selectionLength; i++) {
- ListGridRecord record = records[i];
- Integer alertId = record.getAttributeAsInt("id");
- alertIds[i] = alertId;
- }
-
- this.alertService.deleteResourceAlerts(alertIds, new AsyncCallback<Void>() {
- public void onSuccess(Void blah) {
- System.out.println("Deleted Alerts with id's: " + Arrays.toString(alertIds) + ".");
- alertsView.reloadData();
- }
-
- public void onFailure(Throwable caught) {
- Window.alert("Failed to delete Alerts with id's: " + Arrays.toString(alertIds) + " - cause: " + caught);
- System.err.println("Failed to delete Alerts with id's " + Arrays.toString(alertIds) + " - cause: " + caught);
- }
- });
- }
-
- protected void executeFetch(final DSRequest request, final DSResponse response) {
- final long start = System.currentTimeMillis();
-
- AlertCriteria criteria = new AlertCriteria();
- criteria.fetchAlertDefinition(true);
- criteria.fetchRecoveryAlertDefinition(true);
- // TODO: Uncomment the below once the bad performance of it has been fixed.
- //criteria.fetchConditionLogs(true);
-
- criteria.setPageControl(getPageControl(request));
-
- this.alertService.findAlertsByCriteria(criteria, new AsyncCallback<PageList<Alert>>() {
- public void onFailure(Throwable caught) {
- Window.alert("Failed to fetch Alerts - cause: " + caught);
- System.err.println("Failed to fetch Alerts - cause: " + caught);
- response.setStatus(RPCResponse.STATUS_FAILURE);
- processResponse(request.getRequestId(), response);
- }
-
- public void onSuccess(PageList<Alert> result) {
- long fetchTime = System.currentTimeMillis() - start;
- System.out.println(result.size() + " Alerts fetched in: " + fetchTime + "ms");
-
- response.setData(buildRecords(result));
- // For paging to work, we have to specify size of full result set.
- response.setTotalRows(result.getTotalSize());
- processResponse(request.getRequestId(), response);
- }
- });
- }
-
- @Override
- public Alert copyValues(ListGridRecord from) {
- return null; // TODO: Implement this method.
- }
-
- @Override
- public ListGridRecord copyValues(Alert from) {
- ListGridRecord record = new ListGridRecord();
- record.setAttribute("id", from.getId());
- record.setAttribute("resourceId", from.getAlertDefinition().getResource().getId());
- record.setAttribute("name", from.getAlertDefinition().getName());
- record.setAttribute("priority", from.getAlertDefinition().getPriority().name());
- record.setAttribute("ctime", DATE_TIME_FORMAT.format(new Date(from.getCtime())));
-
- Set<AlertConditionLog> conditionLogs = from.getConditionLogs();
- String conditionText;
- String conditionValue;
- if (conditionLogs.size() > 1) {
- conditionText = "Multiple Conditions";
- conditionValue = "--";
- } else if (conditionLogs.size() == 1) {
- AlertConditionLog conditionLog = conditionLogs.iterator().next();
- AlertCondition condition = conditionLog.getCondition();
- conditionText = AlertFormatUtility.formatAlertConditionForDisplay(condition);
- conditionValue = conditionLog.getValue();
- if (condition.getMeasurementDefinition() != null) {
- conditionValue = MeasurementConverterClient.format(Double.valueOf(conditionLog.getValue()), condition
- .getMeasurementDefinition().getUnits(), true);
- }
- } else {
- conditionText = "No Conditions";
- conditionValue = "--";
- }
- record.setAttribute("conditionText", conditionText);
- record.setAttribute("conditionValue", conditionValue);
-
- String recoveryInfo = AlertFormatUtility.getAlertRecoveryInfo(from);
- record.setAttribute("recoveryInfo", recoveryInfo);
- return record;
- }
-
- protected void executeRemove(final DSRequest request, final DSResponse response) {
- JavaScriptObject data = request.getData ();
- ListGridRecord record = new ListGridRecord(data);
- Window.alert(String.valueOf(record.getAttributeAsInt("id")));
- }
-
-}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
deleted file mode 100644
index ce36802..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.alert;
-
-import com.smartgwt.client.types.Autofit;
-import com.smartgwt.client.types.SelectionAppearance;
-import com.smartgwt.client.types.SelectionStyle;
-import com.smartgwt.client.types.VisibilityMode;
-import com.smartgwt.client.util.BooleanCallback;
-import com.smartgwt.client.util.SC;
-import com.smartgwt.client.widgets.IButton;
-import com.smartgwt.client.widgets.Label;
-import com.smartgwt.client.widgets.events.ClickEvent;
-import com.smartgwt.client.widgets.events.ClickHandler;
-import com.smartgwt.client.widgets.grid.ListGrid;
-import com.smartgwt.client.widgets.grid.events.DataArrivedEvent;
-import com.smartgwt.client.widgets.grid.events.DataArrivedHandler;
-import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
-import com.smartgwt.client.widgets.grid.events.SelectionEvent;
-import com.smartgwt.client.widgets.layout.LayoutSpacer;
-import com.smartgwt.client.widgets.layout.SectionStack;
-import com.smartgwt.client.widgets.layout.SectionStackSection;
-import com.smartgwt.client.widgets.layout.VLayout;
-import com.smartgwt.client.widgets.toolbar.ToolStrip;
-import org.rhq.core.domain.criteria.AlertCriteria;
-import org.rhq.enterprise.gui.coregui.client.admin.roles.RoleEditView;
-
-/**
- * A view that displays a paginated table of fired {@link org.rhq.core.domain.alert.Alert alert}s, along with the
- * ability to filter or sort those alerts, click on an alert to view details about that alert's definition, or delete
- * selected alerts.
- *
- * @author Ian Springer
- */
-public class AlertsView extends SectionStack {
- private ListGrid listGrid;
- private IButton removeButton;
- private Label tableInfo;
-
- @Override
- protected void onInit() {
- super.onInit();
-
- setVisibilityMode(VisibilityMode.MULTIPLE);
- setWidth100();
- setHeight100();
-
- final AlertDataSource dataSource = AlertDataSource.getInstance();
-
- VLayout gridHolder = new VLayout();
- gridHolder.setWidth100();
- gridHolder.setHeight100();
-
- this.listGrid = new ListGrid();
- this.listGrid.setWidth100();
- this.listGrid.setHeight100();
- this.listGrid.setDataSource(dataSource);
- this.listGrid.setAutoFetchData(true);
- this.listGrid.setAutoFitData(Autofit.HORIZONTAL);
- this.listGrid.setAlternateRecordStyles(true);
- this.listGrid.setSelectionType(SelectionStyle.SIMPLE);
- this.listGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
-
- this.listGrid.setShowFilterEditor(true);
-
- this.listGrid.setUseAllDataSourceFields(true);
- this.listGrid.setSortField(AlertCriteria.SORT_FIELD_NAME);
-
- gridHolder.addMember(this.listGrid);
-
- ToolStrip toolStrip = new ToolStrip();
- toolStrip.setMembersMargin(15);
-
- this.removeButton = new IButton("Delete");
- this.removeButton.setDisabled(true);
- this.removeButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- SC.confirm("Are you sure you want to delete the " + AlertsView.this.listGrid.getSelection().length
- + " selected alerts?",
- new BooleanCallback() {
- public void execute(Boolean confirmed) {
- if (confirmed) {
- //listGrid.removeSelectedData();
- dataSource.deleteAlerts(AlertsView.this);
- }
- }
- }
- );
- }
- });
- toolStrip.addMember(this.removeButton);
- toolStrip.addMember(new LayoutSpacer());
-
- this.tableInfo = new Label();
- this.tableInfo.setWrap(false);
- toolStrip.addMember(this.tableInfo);
-
- gridHolder.addMember(toolStrip);
-
- this.listGrid.addDataArrivedHandler(new DataArrivedHandler() {
- public void onDataArrived(DataArrivedEvent event) {
- updateFooter();
- }
- });
- this.listGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
- public void onSelectionChanged(SelectionEvent event) {
- updateFooter();
- }
- });
-
- SectionStackSection topSection = new SectionStackSection("Alerts");
- topSection.setExpanded(true);
- topSection.setItems(gridHolder);
-
- addSection(topSection);
-
- final RoleEditView roleEditor = new RoleEditView();
-
- final SectionStackSection detailSection = new SectionStackSection("Selected Alert");
- detailSection.setItems(roleEditor);
- addSection(detailSection);
-
- this.listGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
- public void onSelectionChanged(SelectionEvent selectionEvent) {
- if (selectionEvent.getState()) {
- expandSection(1);
- roleEditor.editRecord(selectionEvent.getRecord());
- } else
- collapseSection(1);
- roleEditor.editNone();
- }
- });
- }
-
- ListGrid getListGrid() {
- return this.listGrid;
- }
-
- void reloadData() {
- this.tableInfo.setContents("");
- this.listGrid.invalidateCache();
- //this.listGrid.markForRedraw();
- }
-
- private void updateFooter() {
- String label = "Total: " + this.listGrid.getTotalRows();
- if (this.listGrid.anySelected()) {
- label += " (" + this.listGrid.getSelection().length + " selected)";
- }
- this.tableInfo.setContents(label);
- this.removeButton.setDisabled(!listGrid.anySelected());
- }
-}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/SubsystemResourceAlertDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/SubsystemResourceAlertDataSource.java
new file mode 100644
index 0000000..322467d
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/SubsystemResourceAlertDataSource.java
@@ -0,0 +1,46 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.alert;
+
+import com.smartgwt.client.data.DataSourceField;
+import com.smartgwt.client.data.fields.DataSourceIntegerField;
+import org.rhq.core.domain.criteria.AlertCriteria;
+
+/**
+ * @author Ian Springer
+ */
+public class SubsystemResourceAlertDataSource extends AbstractAlertDataSource {
+ @Override
+ protected void onInit() {
+ super.onInit();
+
+ DataSourceField[] fields = getFields();
+ DataSourceField[] updatedFields = new DataSourceField[fields.length + 1];
+
+ // TODO: Replace 'Resource Id' column with 'Resource Name' and 'Resource Lineage' columns.
+ DataSourceField resourceIdField = new DataSourceIntegerField(AlertCriteria.SORT_FIELD_RESOURCE_ID, "Resource Id");
+ updatedFields[0] = resourceIdField;
+
+ System.arraycopy(fields, 0, updatedFields, 1, fields.length);
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index 8ccfd8f..c5642a5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -34,6 +34,7 @@ import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSelectedH
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSet;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSearchView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.alert.ResourceAlertHistoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration.ConfigurationHistoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.GraphListView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
@@ -110,7 +111,7 @@ public class ResourceDetailView extends VLayout implements ViewRenderer, Resourc
operationsTab.registerSubTabs("History", "Scheduled");
alertsTab = new TwoLevelTab("Alerts", "/images/icons/Alert_grey_16.png");
- alertsTab.registerSubTabs("Alert History", "Alert Definitions");
+ alertsTab.registerSubTabs("History", "Definitions");
configurationTab = new TwoLevelTab("Configuration", "/images/icons/Configure_grey_16.png");
configurationTab.registerSubTabs("Current", "History");
@@ -165,6 +166,8 @@ public class ResourceDetailView extends VLayout implements ViewRenderer, Resourc
configurationTab.updateSubTab("Current", new ConfigurationEditor(resource.getId(), resource.getResourceType().getId()));
configurationTab.updateSubTab("History", ConfigurationHistoryView.getHistoryOf(resource.getId()));
+ alertsTab.updateSubTab("History", new ResourceAlertHistoryView(resource.getId()));
+
topTabSet.setSelectedTab(selectedTab);
updateTabStatus();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/alert/ResourceAlertDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/alert/ResourceAlertDataSource.java
new file mode 100644
index 0000000..1818a54
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/alert/ResourceAlertDataSource.java
@@ -0,0 +1,48 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.alert;
+
+import com.smartgwt.client.data.DSRequest;
+import org.rhq.core.domain.criteria.AlertCriteria;
+import org.rhq.enterprise.gui.coregui.client.alert.AbstractAlertDataSource;
+
+import java.util.Arrays;
+
+/**
+ * @author Ian Springer
+ */
+public class ResourceAlertDataSource extends AbstractAlertDataSource {
+ private Integer resourceId;
+
+ public ResourceAlertDataSource(int resourceId) {
+ super();
+ this.resourceId = resourceId;
+ }
+
+ @Override
+ protected AlertCriteria getCriteria(DSRequest request) {
+ AlertCriteria criteria = super.getCriteria(request);
+ criteria.addFilterResourceIds(this.resourceId);
+ return criteria;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/alert/ResourceAlertHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/alert/ResourceAlertHistoryView.java
new file mode 100644
index 0000000..96eb309
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/alert/ResourceAlertHistoryView.java
@@ -0,0 +1,56 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.alert;
+
+import com.smartgwt.client.data.DataSource;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.enterprise.gui.coregui.client.alert.AbstractAlertsView;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
+
+/**
+ * @author Ian Springer
+ */
+public class ResourceAlertHistoryView extends AbstractAlertsView
+ implements ResourceSelectListener {
+ private int resourceId;
+
+ public ResourceAlertHistoryView(int resourceId) {
+ super();
+ this.resourceId = resourceId;
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+ }
+
+ @Override
+ protected DataSource createDataSource() {
+ return new ResourceAlertDataSource(this.resourceId);
+ }
+
+ public void onResourceSelected(Resource resource) {
+ this.resourceId = resource.getId();
+ markForRedraw();
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
index 197f8a0..fb027d3 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
@@ -55,7 +55,6 @@ public abstract class RPCDataSource<T> extends DataSource {
setClientOnly(false);
setDataProtocol(DSProtocol.CLIENTCUSTOM);
setDataFormat(DSDataFormat.CUSTOM);
-
}
@Override
commit 0a0da10ed49db36c502118ed638d6473f8f2780d
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Fri Mar 5 16:51:40 2010 -0500
Select and open the node in the tree in two other conditions
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
index e36a727..66a2438 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
@@ -307,7 +307,11 @@ public class ResourceTreeView extends VLayout {
TreeNode node = null;
if (treeGrid != null && treeGrid.getTree() != null
&& (node = treeGrid.getTree().findById(String.valueOf(selectedResource.getId()))) != null) {
+
+ TreeNode[] parents = treeGrid.getTree().getParents(node);
+ treeGrid.getTree().openFolders(parents);
treeGrid.getTree().openFolder(node);
+
treeGrid.deselectAllRecords();
treeGrid.selectRecord(node);
} else {
@@ -390,6 +394,17 @@ public class ResourceTreeView extends VLayout {
for (TreeNode n : ResourceTreeDatasource.build(result)) {
treeGrid.getDataSource().addData(n);
}
+
+ TreeNode selectedNode = treeGrid.getTree().findById(String.valueOf(selectedResource.getId()));
+ if (selectedNode != null) {
+ treeGrid.deselectAllRecords();
+ treeGrid.selectRecord(selectedNode);
+
+ TreeNode[] parents = treeGrid.getTree().getParents(selectedNode);
+ treeGrid.getTree().openFolders(parents);
+ treeGrid.getTree().openFolder(selectedNode);
+ }
+
}
commit 4027a0a8b8a9512a4e879eabdaf5c3e31d2f59ba
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Fri Mar 5 16:38:47 2010 -0500
Base Table Component will handle things like toobar buttons, messages and titles for all table views
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java
index 3a7de7f..312d10e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java
@@ -104,14 +104,7 @@ public class RolesDataSource extends RPCDataSource<Role> {
System.out.println("Data retrieved in: " + (System.currentTimeMillis() - start));
- ListGridRecord[] records = new ListGridRecord[result.size()];
- for (int x = 0; x < result.size(); x++) {
- Role role = result.get(x);
- ListGridRecord record = copyValues(role);
- records[x] = record;
- }
-
- response.setData(records);
+ response.setData(buildRecords(result));
response.setTotalRows(result.getTotalSize()); // for paging to work we have to specify size of full result set
processResponse(request.getRequestId(), response);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
index 9e5bda6..d6b3137 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
@@ -18,23 +18,17 @@
*/
package org.rhq.enterprise.gui.coregui.client.admin.roles;
-import com.smartgwt.client.types.Autofit;
+import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
+
import com.smartgwt.client.types.ListGridFieldType;
import com.smartgwt.client.types.Overflow;
-import com.smartgwt.client.util.BooleanCallback;
-import com.smartgwt.client.util.SC;
-import com.smartgwt.client.widgets.IButton;
-import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.Window;
-import com.smartgwt.client.widgets.events.ClickEvent;
-import com.smartgwt.client.widgets.events.ClickHandler;
-import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionEvent;
-import com.smartgwt.client.widgets.layout.LayoutSpacer;
import com.smartgwt.client.widgets.layout.VLayout;
-import com.smartgwt.client.widgets.toolbar.ToolStrip;
/**
* @author Greg Hinkle
@@ -51,26 +45,12 @@ public class RolesView extends VLayout {
final RolesDataSource datasource = RolesDataSource.getInstance();
- VLayout gridHolder = new VLayout();
- gridHolder.setWidth100();
- gridHolder.setHeight("50%");
- gridHolder.setShowResizeBar(true);
- gridHolder.setResizeBarTarget("next");
-
-
- final ListGrid listGrid = new ListGrid();
- listGrid.setWidth100();
- listGrid.setHeight100();
- listGrid.setDataSource(datasource);
- listGrid.setAutoFetchData(true);
- listGrid.setAutoFitData(Autofit.HORIZONTAL);
- listGrid.setAlternateRecordStyles(true);
-// listGrid.setSelectionType(SelectionStyle.SIMPLE);
-// listGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
-
- listGrid.setShowFilterEditor(true);
-// listGrid.setUseAllDataSourceFields(true);
+ final Table table = new Table("Roles");
+ table.setHeight("50%");
+ table.setShowResizeBar(true);
+ table.setResizeBarTarget("next");
+ table.setDataSource(datasource);
ListGridField idField = new ListGridField("id", "Id", 55);
idField.setType(ListGridFieldType.INTEGER);
@@ -78,69 +58,36 @@ public class RolesView extends VLayout {
ListGridField nameField = new ListGridField("name", "Name");
- listGrid.setFields(idField, nameField);
-
+ table.getListGrid().setFields(idField, nameField);
- gridHolder.addMember(listGrid);
- ToolStrip toolStrip = new ToolStrip();
- toolStrip.setWidth100();
- toolStrip.setMembersMargin(15);
-
- final IButton removeButton = new IButton("Remove");
- removeButton.setDisabled(true);
- removeButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- SC.confirm("Are you sure you want to delete " + listGrid.getSelection().length + " resources?",
- new BooleanCallback() {
- public void execute(Boolean accepted) {
- if (accepted) {
- listGrid.removeSelectedData();
- }
- }
- }
- );
- }
- });
+ table.addTableAction("Remove",
+ Table.SelectionEnablement.MULTIPLE,
+ "Are you sure you want to delete # roles?",
+ new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ table.getListGrid().removeSelectedData();
+ }
+ });
+ table.addTableAction("Add Role",
+ new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ createRole();
+ }
+ });
- final IButton addButton = new IButton("Add Role");
- addButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- createRole();
- }
- });
-
-
- final Label tableInfo = new Label("Total: " + listGrid.getTotalRows());
- tableInfo.setWrap(false);
-
- toolStrip.addMember(removeButton);
- toolStrip.addMember(addButton);
- toolStrip.addMember(new LayoutSpacer());
- toolStrip.addMember(tableInfo);
-
- gridHolder.addMember(toolStrip);
-
-
- listGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
- public void onSelectionChanged(SelectionEvent selectionEvent) {
- int selectedCount = ((ListGrid) selectionEvent.getSource()).getSelection().length;
- tableInfo.setContents("Total: " + listGrid.getTotalRows() + " (" + selectedCount + " selected)");
- removeButton.setDisabled(selectedCount == 0);
- }
- });
+ addMember(table);
- addMember(gridHolder);
final RoleEditView roleEditor = new RoleEditView();
roleEditor.setOverflow(Overflow.AUTO);
addMember(roleEditor);
- listGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
+ table.getListGrid().addSelectionChangedHandler(new SelectionChangedHandler() {
public void onSelectionChanged(SelectionEvent selectionEvent) {
if (selectionEvent.getState()) {
roleEditor.editRecord(selectionEvent.getRecord());
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
index 8f0429c..9f3e896 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
@@ -142,11 +142,13 @@ public class UserEditView extends VLayout {
form.show();
form.setSaveOperationType(DSOperationType.UPDATE);
+ markForRedraw();
}
public void editNone() {
message.show();
form.hide();
+ markForRedraw();
}
public void editNew() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
index 57ef82c..c85edb9 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
@@ -18,20 +18,16 @@
*/
package org.rhq.enterprise.gui.coregui.client.admin.users;
-import com.smartgwt.client.types.Autofit;
+import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
+
import com.smartgwt.client.types.ListGridFieldType;
-import com.smartgwt.client.util.BooleanCallback;
-import com.smartgwt.client.util.SC;
-import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.Window;
-import com.smartgwt.client.widgets.events.ClickEvent;
-import com.smartgwt.client.widgets.events.ClickHandler;
-import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionEvent;
-import com.smartgwt.client.widgets.layout.LayoutSpacer;
import com.smartgwt.client.widgets.layout.SectionStackSection;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.toolbar.ToolStrip;
@@ -54,24 +50,11 @@ public class UsersView extends VLayout {
final UsersDataSource datasource = UsersDataSource.getInstance();
- VLayout gridHolder = new VLayout();
- gridHolder.setWidth100();
- gridHolder.setHeight("50%");
- gridHolder.setShowResizeBar(true);
-
- final ListGrid listGrid = new ListGrid();
- listGrid.setWidth100();
- listGrid.setHeight100();
- listGrid.setDataSource(datasource);
- listGrid.setAutoFetchData(true);
- listGrid.setAutoFitData(Autofit.HORIZONTAL);
-// listGrid.setAutoFitData(Autofit.HORIZONTAL);
- listGrid.setAlternateRecordStyles(true);
-// listGrid.setAutoFitData(Autofit.HORIZONTAL);
-// listGrid.setSelectionType(SelectionStyle.SIMPLE);
-// listGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
-
- listGrid.setShowFilterEditor(true);
+ final Table table = new Table("Users");
+ table.setHeight("50%");
+ table.setShowResizeBar(true);
+ table.setDataSource(datasource);
+
ListGridField idField = new ListGridField("id", "Id", 55);
idField.setType(ListGridFieldType.INTEGER);
@@ -80,66 +63,36 @@ public class UsersView extends VLayout {
ListGridField emailField = new ListGridField("email", "Email Address");
- listGrid.setFields(idField, nameField, emailField);
-
-
- gridHolder.addMember(listGrid);
+ table.getListGrid().setFields(idField, nameField, emailField);
ToolStrip toolStrip = new ToolStrip();
toolStrip.setWidth100();
toolStrip.setMembersMargin(15);
- final IButton removeButton = new IButton("Remove");
- removeButton.setDisabled(true);
- removeButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- SC.confirm("Are you sure you want to delete " + listGrid.getSelection().length + " users?",
- new BooleanCallback() {
- public void execute(Boolean aBoolean) {
- // todo
- }
- }
- );
- }
- });
-
-
- final Label tableInfo = new Label("Total: " + listGrid.getTotalRows());
- tableInfo.setWrap(false);
+ table.addTableAction("Remove",
+ Table.SelectionEnablement.MULTIPLE,
+ "Are you sure you want to delete # roles?",
+ new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ table.getListGrid().removeSelectedData();
+ }
+ });
-
- final IButton addButton = new IButton("Add Role");
- addButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- createUser();
- }
- });
-
-
- toolStrip.addMember(removeButton);
- toolStrip.addMember(addButton);
- toolStrip.addMember(new LayoutSpacer());
- toolStrip.addMember(tableInfo);
-
- gridHolder.addMember(toolStrip);
+ table.addTableAction("Add Role",
+ new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ createUser();
+ }
+ });
final UserEditView userEditor = new UserEditView();
-
- listGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
- public void onSelectionChanged(SelectionEvent selectionEvent) {
- int selectedCount = ((ListGrid) selectionEvent.getSource()).getSelection().length;
- tableInfo.setContents("Total: " + listGrid.getTotalRows() + " (" + selectedCount + " selected)");
- removeButton.setDisabled(selectedCount == 0);
- }
- });
-
final SectionStackSection detailsSection = new SectionStackSection("Details");
detailsSection.setItems(new Label("Select a user to edit..."));
detailsSection.setExpanded(false);
- listGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
+ table.getListGrid().addSelectionChangedHandler(new SelectionChangedHandler() {
public void onSelectionChanged(SelectionEvent selectionEvent) {
if (selectionEvent.getState()) {
userEditor.editRecord(selectionEvent.getRecord());
@@ -150,7 +103,7 @@ public class UsersView extends VLayout {
});
- addMember(gridHolder);
+ addMember(table);
addMember(userEditor);
}
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
new file mode 100644
index 0000000..636519b
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
@@ -0,0 +1,207 @@
+/*
+ * 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.table;
+
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.types.Autofit;
+import com.smartgwt.client.util.BooleanCallback;
+import com.smartgwt.client.util.SC;
+import com.smartgwt.client.widgets.HTMLFlow;
+import com.smartgwt.client.widgets.IButton;
+import com.smartgwt.client.widgets.Label;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.events.DataArrivedEvent;
+import com.smartgwt.client.widgets.grid.events.DataArrivedHandler;
+import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
+import com.smartgwt.client.widgets.grid.events.SelectionEvent;
+import com.smartgwt.client.widgets.layout.LayoutSpacer;
+import com.smartgwt.client.widgets.layout.VLayout;
+import com.smartgwt.client.widgets.toolbar.ToolStrip;
+
+import java.util.ArrayList;
+
+/**
+ * @author Greg Hinkle
+ */
+public class Table extends VLayout {
+
+ private HTMLFlow title;
+ private ListGrid listGrid;
+ private ToolStrip footer;
+ private Label tableInfo;
+
+
+
+ public enum SelectionEnablement {
+ ANY, SINGLE, MULTIPLE
+ };
+
+
+ private ArrayList<TableActionInfo> tableActions = new ArrayList<TableActionInfo>();
+
+
+ public Table(String tableTitle) {
+ this(tableTitle,null);
+ }
+
+ public Table(String tableTitle, Criteria criteria) {
+ super();
+
+ setWidth100();
+ setHeight100();
+
+ // Title
+ title = new HTMLFlow();
+ title.setWidth100();
+ title.setHeight(35);
+ title.setContents(tableTitle);
+ title.setPadding(4);
+ title.setStyleName("HeaderLabel");
+
+ // Grid
+ listGrid = new ListGrid();
+ if (criteria != null) {
+ listGrid.setInitialCriteria(criteria);
+ }
+ listGrid.setWidth100();
+ listGrid.setHeight100();
+ listGrid.setAutoFetchData(true);
+ listGrid.setAutoFitData(Autofit.HORIZONTAL);
+ listGrid.setAlternateRecordStyles(true);
+
+
+ // Footer
+ footer = new ToolStrip();
+ footer.setPadding(5);
+ footer.setWidth100();
+ footer.setMembersMargin(15);
+
+ tableInfo = new Label("Total: " + listGrid.getTotalRows());
+ }
+
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+ addMember(title);
+ addMember(listGrid);
+ addMember(footer);
+
+
+ tableInfo.setWrap(false);
+
+ for (final TableActionInfo tableAction : tableActions) {
+ IButton button = new IButton(tableAction.title);
+ button.setDisabled(tableAction.enablement != SelectionEnablement.ANY);
+ button.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ if (tableAction.confirmMessage != null) {
+ SC.ask(tableAction.confirmMessage, new BooleanCallback() {
+ public void execute(Boolean aBoolean) {
+ if (aBoolean) {
+ tableAction.action.executeAction(listGrid.getSelection());
+ }
+ }
+ });
+ } else {
+ tableAction.action.executeAction(listGrid.getSelection());
+ }
+ }
+ });
+ tableAction.actionButton = button;
+ footer.addMember(button);
+ }
+ footer.addMember(new LayoutSpacer());
+ footer.addMember(tableInfo);
+
+
+ // Manages enable/disable buttons for the grid
+ listGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
+ public void onSelectionChanged(SelectionEvent selectionEvent) {
+ int count = listGrid.getSelection().length;
+ for (TableActionInfo tableAction : tableActions) {
+ if (count == 0) {
+ tableAction.actionButton.setDisabled(tableAction.enablement != SelectionEnablement.ANY);
+ } else if (count == 1) {
+ tableAction.actionButton.setDisabled(false);
+ } else if (count > 1) {
+ tableAction.actionButton.setDisabled(tableAction.enablement == SelectionEnablement.SINGLE);
+ }
+ }
+ tableInfo.setContents("Total: " + listGrid.getTotalRows() + " (" + count + " selected)");
+ }
+ });
+
+ listGrid.addDataArrivedHandler(new DataArrivedHandler() {
+ public void onDataArrived(DataArrivedEvent dataArrivedEvent) {
+ tableInfo.setContents("Total: " + listGrid.getTotalRows() + " (" + listGrid.getSelection().length + " selected)");
+ }
+ });
+ }
+
+ public void setTableTitle(String title) {
+ this.title.setContents(title);
+ }
+
+ public void setDataSource(RPCDataSource dataSource) {
+ listGrid.setDataSource(dataSource);
+ }
+
+
+ public ListGrid getListGrid() {
+ return listGrid;
+ }
+
+
+ public void addTableAction(String title, TableAction tableAction) {
+ this.addTableAction(title, SelectionEnablement.ANY, null, tableAction);
+ }
+
+
+ public void addTableAction(String title, SelectionEnablement enablement, String confirmation, TableAction tableAction) {
+ TableActionInfo info = new TableActionInfo(title, enablement, tableAction);
+ info.confirmMessage = confirmation;
+ tableActions.add(info);
+ }
+
+
+ // -------------- Inner utility class -------------
+
+ private static class TableActionInfo {
+
+ public String title;
+ public SelectionEnablement enablement;
+ TableAction action;
+ String confirmMessage;
+ IButton actionButton;
+
+
+ protected TableActionInfo(String title, SelectionEnablement enablement, TableAction action) {
+ this.title = title;
+ this.enablement = enablement;
+ this.action = action;
+ }
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableAction.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableAction.java
new file mode 100644
index 0000000..0c57786
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableAction.java
@@ -0,0 +1,30 @@
+/*
+ * 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.table;
+
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+/**
+ * @author Greg Hinkle
+ */
+public interface TableAction {
+
+ public abstract void executeAction(ListGridRecord[] selection);
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
index 43f99aa..ea145cd 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
@@ -18,11 +18,9 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.groups;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDatasource;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
+import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
-import com.google.gwt.event.dom.client.KeyCodes;
-import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.ListGridFieldType;
import com.smartgwt.client.types.SelectionAppearance;
@@ -33,10 +31,6 @@ import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
-import com.smartgwt.client.widgets.form.DynamicForm;
-import com.smartgwt.client.widgets.form.fields.TextItem;
-import com.smartgwt.client.widgets.form.fields.events.KeyPressEvent;
-import com.smartgwt.client.widgets.form.fields.events.KeyPressHandler;
import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
@@ -49,14 +43,12 @@ import com.smartgwt.client.widgets.layout.LayoutSpacer;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.toolbar.ToolStrip;
-import java.util.ArrayList;
-
/**
* @author Greg Hinkle
*/
public class ResourceGroupListView extends VLayout {
- private ListGrid listGrid;
+ private Table table;
public ResourceGroupListView() {
@@ -64,32 +56,15 @@ public class ResourceGroupListView extends VLayout {
setWidth100();
setHeight100();
-// DynamicForm searchPanel = new DynamicForm();
-// final TextItem searchBox = new TextItem("query", "Search Resources");
-// searchBox.setValue("");
-// searchPanel.setWrapItemTitles(false);
-// searchPanel.setFields(searchBox);
-//
-//
-// addMember(searchPanel);
-
-
final ResourceGroupsDataSource datasource = ResourceGroupsDataSource.getInstance();
- VLayout gridHolder = new VLayout();
- listGrid = new ListGrid();
- listGrid.setWidth100();
- listGrid.setHeight100();
- listGrid.setDataSource(datasource);
- listGrid.setAutoFetchData(true);
- listGrid.setAlternateRecordStyles(true);
-// listGrid.setAutoFitData(Autofit.HORIZONTAL);
-// listGrid.setCriteria(new Criteria("name", searchPanel.getValueAsString("query")));
+ table = new Table("Resource Groups");
+ table.setDataSource(datasource);
- listGrid.setSelectionType(SelectionStyle.SIMPLE);
- listGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
- listGrid.setResizeFieldsInRealTime(true);
+ table.getListGrid().setSelectionType(SelectionStyle.SIMPLE);
+ table.getListGrid().setSelectionAppearance(SelectionAppearance.CHECKBOX);
+ table.getListGrid().setResizeFieldsInRealTime(true);
ListGridField idField = new ListGridField("id", "Id", 55);
@@ -110,73 +85,21 @@ public class ResourceGroupListView extends VLayout {
ListGridField availabilityField = new ListGridField("currentAvailability", "Availability", 55);
availabilityField.setAlign(Alignment.CENTER);
- listGrid.setFields(idField, nameField, descriptionField, typeNameField, pluginNameField, categoryField, availabilityField);
-
-
- gridHolder.addMember(listGrid);
-
- ToolStrip toolStrip = new ToolStrip();
- toolStrip.setMembersMargin(15);
-
- final IButton removeButton = new IButton("Remove");
- removeButton.setDisabled(true);
- removeButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- SC.confirm("Are you sure you want to delete " + listGrid.getSelection().length + " resources?",
- new BooleanCallback() {
- public void execute(Boolean aBoolean) {
-
- }
- }
- );
- }
- });
-
-
-
+ table.getListGrid().setFields(idField, nameField, descriptionField, typeNameField, pluginNameField, categoryField, availabilityField);
- final Label tableInfo = new Label("Total: " + listGrid.getTotalRows());
- tableInfo.setWrap(false);
-
- toolStrip.addMember(removeButton);
- toolStrip.addMember(new LayoutSpacer());
- toolStrip.addMember(tableInfo);
-
- gridHolder.addMember(toolStrip);
-
-
- listGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
- public void onSelectionChanged(SelectionEvent selectionEvent) {
- int selectedCount = ((ListGrid)selectionEvent.getSource()).getSelection().length;
- tableInfo.setContents("Total: " + listGrid.getTotalRows() + " (" + selectedCount + " selected)");
- removeButton.setDisabled(selectedCount == 0);
- }
- });
-
-
-
- addMember(gridHolder);
+ table.addTableAction(
+ "Delete Groups",
+ Table.SelectionEnablement.MULTIPLE,
+ "Are you sure you want to delete # groups?",
+ new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ // TODO: Implement this method.
+ }
+ });
- listGrid.addDataArrivedHandler(new DataArrivedHandler() {
- public void onDataArrived(DataArrivedEvent dataArrivedEvent) {
- int selectedCount = ((ListGrid)dataArrivedEvent.getSource()).getSelection().length;
- tableInfo.setContents("Total: " + listGrid.getTotalRows() + " (" + selectedCount + " selected)");
- }
- });
+ addMember(table);
- /*
- searchBox.addKeyPressHandler(new KeyPressHandler() {
- public void onKeyPress(KeyPressEvent event) {
- if (event.getCharacterValue() == KeyCodes.KEY_ENTER) {
- datasource.setQuery((String) searchBox.getValue());
- Criteria c = new Criteria("name", (String) searchBox.getValue());
- long start = System.currentTimeMillis();
- listGrid.fetchData(c);
- System.out.println("Loaded in: " + (System.currentTimeMillis() - start));
- }
- }
- });*/
}
}
\ No newline at end of file
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 2857cb0..68cda78 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,44 +18,23 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource;
-import org.rhq.core.domain.criteria.ResourceCriteria;
-import org.rhq.core.domain.resource.Resource;
-import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
import com.google.gwt.event.dom.client.KeyCodes;
-import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Criteria;
-import com.smartgwt.client.data.fields.DataSourceTextField;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.ListGridFieldType;
import com.smartgwt.client.types.SelectionAppearance;
import com.smartgwt.client.types.SelectionStyle;
-import com.smartgwt.client.util.BooleanCallback;
-import com.smartgwt.client.util.SC;
-import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.IButton;
-import com.smartgwt.client.widgets.Label;
-import com.smartgwt.client.widgets.events.ClickEvent;
-import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.form.fields.events.KeyPressEvent;
import com.smartgwt.client.widgets.form.fields.events.KeyPressHandler;
import com.smartgwt.client.widgets.grid.CellFormatter;
-import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
-import com.smartgwt.client.widgets.grid.events.DataArrivedEvent;
-import com.smartgwt.client.widgets.grid.events.DataArrivedHandler;
-import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
-import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
-import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
-import com.smartgwt.client.widgets.grid.events.SelectionEvent;
-import com.smartgwt.client.widgets.layout.LayoutSpacer;
import com.smartgwt.client.widgets.layout.VLayout;
-import com.smartgwt.client.widgets.toolbar.ToolStrip;
import java.util.ArrayList;
@@ -64,7 +43,7 @@ import java.util.ArrayList;
*/
public class ResourceSearchView extends VLayout {
- private ListGrid listGrid;
+ private Table table;
private ArrayList<ResourceSelectListener> selectListeners = new ArrayList<ResourceSelectListener>();
@@ -79,7 +58,7 @@ public class ResourceSearchView extends VLayout {
/**
* Resource list filtered by a given criteria
- * @param parentResourceId
+ * @param criteria
*/
public ResourceSearchView(Criteria criteria) {
@@ -97,24 +76,12 @@ public class ResourceSearchView extends VLayout {
final ResourceDatasource datasource = new ResourceDatasource();
+ table = new Table("Resources", criteria);
+ table.setDataSource(datasource);
- VLayout gridHolder = new VLayout();
-
- listGrid = new ListGrid();
- listGrid.setWidth100();
- listGrid.setHeight100();
- listGrid.setDataSource(datasource);
- listGrid.setAutoFetchData(true);
- listGrid.setAlternateRecordStyles(true);
-// listGrid.setAutoFitData(Autofit.HORIZONTAL);
-
- if (criteria != null) {
- listGrid.setInitialCriteria(criteria);
- }
-
- listGrid.setSelectionType(SelectionStyle.SIMPLE);
- listGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
- listGrid.setResizeFieldsInRealTime(true);
+ table.getListGrid().setSelectionType(SelectionStyle.SIMPLE);
+ table.getListGrid().setSelectionAppearance(SelectionAppearance.CHECKBOX);
+ table.getListGrid().setResizeFieldsInRealTime(true);
ListGridField idField = new ListGridField("id", "Id", 55);
@@ -135,59 +102,20 @@ public class ResourceSearchView extends VLayout {
ListGridField availabilityField = new ListGridField("currentAvailability", "Availability", 55);
availabilityField.setAlign(Alignment.CENTER);
- listGrid.setFields(idField, nameField, descriptionField, typeNameField, pluginNameField, categoryField, availabilityField);
-
-
- gridHolder.addMember(listGrid);
-
- ToolStrip toolStrip = new ToolStrip();
- toolStrip.setPadding(5);
- toolStrip.setWidth100();
- toolStrip.setMembersMargin(15);
-
- final IButton removeButton = new IButton("Remove");
- removeButton.setDisabled(true);
- removeButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- SC.confirm("Are you sure you want to delete " + listGrid.getSelection().length + " resources?",
- new BooleanCallback() {
- public void execute(Boolean aBoolean) {
-
- }
- }
- );
- }
- });
-
+ table.getListGrid().setFields(idField, nameField, descriptionField, typeNameField, pluginNameField, categoryField, availabilityField);
- final Label tableInfo = new Label("Total: " + listGrid.getTotalRows());
- tableInfo.setWrap(false);
- toolStrip.addMember(removeButton);
- toolStrip.addMember(new LayoutSpacer());
- toolStrip.addMember(tableInfo);
-
- gridHolder.addMember(toolStrip);
-
-
- listGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
- public void onSelectionChanged(SelectionEvent selectionEvent) {
- int selectedCount = ((ListGrid) selectionEvent.getSource()).getSelection().length;
- tableInfo.setContents("Total: " + listGrid.getTotalRows() + " (" + selectedCount + " selected)");
- removeButton.setDisabled(selectedCount == 0);
- }
- });
-
-
- addMember(gridHolder);
+ table.addTableAction("Uninventory",
+ Table.SelectionEnablement.MULTIPLE,
+ "Are you sure you want to delete # resources?",
+ new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ table.getListGrid().removeSelectedData();
+ }
+ });
- listGrid.addDataArrivedHandler(new DataArrivedHandler() {
- public void onDataArrived(DataArrivedEvent dataArrivedEvent) {
- int selectedCount = ((ListGrid) dataArrivedEvent.getSource()).getSelection().length;
- tableInfo.setContents("Total: " + listGrid.getTotalRows() + " (" + selectedCount + " selected)");
- }
- });
+ addMember(table);
searchBox.addKeyPressHandler(new KeyPressHandler() {
@@ -195,7 +123,7 @@ public class ResourceSearchView extends VLayout {
if ((event.getCharacterValue() != null) && (event.getCharacterValue() == KeyCodes.KEY_ENTER)) {
datasource.setQuery((String) searchBox.getValue());
- Criteria c = listGrid.getCriteria();
+ Criteria c = table.getListGrid().getCriteria();
if (c == null) {
c = new Criteria();
}
@@ -203,7 +131,7 @@ public class ResourceSearchView extends VLayout {
c.addCriteria("name",(String) searchBox.getValue());
long start = System.currentTimeMillis();
- listGrid.fetchData(c);
+ table.getListGrid().fetchData(c);
System.out.println("Loaded in: " + (System.currentTimeMillis() - start));
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index bfd6781..b5a1899 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -248,7 +248,7 @@ public class ResourceDetailView extends VLayout implements ViewRenderer, Resourc
if (tab.getTitle().equals(parts[2])) {
if (parts.length == 3) {
- crumb = new Breadcrumb(parts[2], parts[2]);
+ crumb = new Breadcrumb(parts[2], parts[2], false);
}
@@ -260,7 +260,7 @@ public class ResourceDetailView extends VLayout implements ViewRenderer, Resourc
if (parts.length == 4) {
- crumb = new Breadcrumb(parts[3], parts[3]);
+ crumb = new Breadcrumb(parts[3], parts[3], false);
}
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceSummaryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceSummaryView.java
index 159439b..2793d5d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceSummaryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceSummaryView.java
@@ -176,9 +176,8 @@ public class ResourceSummaryView extends DynamicForm implements ResourceSelectLi
setValue("descriptionItem", resource.getDescription());
setValue("versionItem", resource.getVersion());
setValue("parentItem", resource.getParentResource() == null ? null :
- (resource.getParentResource().getResourceType().getName() +
- " '<a href=\"#Resource/" + resource.getParentResource().getId() + "\">" +
- resource.getParentResource().getName() + "</a>'"));
+ ("<a href=\"#Resource/" + resource.getParentResource().getId() + "\">" +
+ resource.getParentResource().getName() + "</a>"));
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
index 8edf449..e36a727 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
@@ -96,7 +96,7 @@ public class ResourceTreeView extends VLayout {
treeGrid.setShowRollOver(false);
treeGrid.setSortField("name");
treeGrid.setShowHeader(false);
-
+
contextMenu = new Menu();
MenuItem item = new MenuItem("Expand node");
@@ -140,7 +140,7 @@ public class ResourceTreeView extends VLayout {
String currentToken = History.getToken();
if (!currentToken.startsWith(newToken)) {
- String ending = currentToken.replaceFirst("^[^\\/]*\\/[^\\/]*","");
+ String ending = currentToken.replaceFirst("^[^\\/]*\\/[^\\/]*", "");
History.newItem("Resource/" + node.getResource().getId() + ending);
@@ -257,7 +257,6 @@ public class ResourceTreeView extends VLayout {
contextMenu.addItem(operations);
-
// Create Menu
MenuItem createChildMenu = new MenuItem("Create Child");
Menu createChildSubMenu = new Menu();
@@ -288,14 +287,14 @@ public class ResourceTreeView extends VLayout {
}
Resource getResource(int resourceId) {
- if (this.treeGrid != null && this.treeGrid.getTree() != null) {
- ResourceTreeDatasource.ResourceTreeNode treeNode =
- (ResourceTreeDatasource.ResourceTreeNode) this.treeGrid.getTree().findById(String.valueOf(resourceId));
- if (treeNode != null) {
- return treeNode.getResource();
- }
- }
- return null;
+ if (this.treeGrid != null && this.treeGrid.getTree() != null) {
+ ResourceTreeDatasource.ResourceTreeNode treeNode =
+ (ResourceTreeDatasource.ResourceTreeNode) this.treeGrid.getTree().findById(String.valueOf(resourceId));
+ if (treeNode != null) {
+ return treeNode.getResource();
+ }
+ }
+ return null;
}
private void setRootResource(Resource rootResource) {
@@ -309,6 +308,8 @@ public class ResourceTreeView extends VLayout {
if (treeGrid != null && treeGrid.getTree() != null
&& (node = treeGrid.getTree().findById(String.valueOf(selectedResource.getId()))) != null) {
treeGrid.getTree().openFolder(node);
+ treeGrid.deselectAllRecords();
+ treeGrid.selectRecord(node);
} else {
final ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();
resourceService.getResourceLineageAndSiblings(selectedResource.getId(), new AsyncCallback<List<Resource>>() {
@@ -329,14 +330,6 @@ public class ResourceTreeView extends VLayout {
setRootResource(root);
- ResourceTreeDatasource dataSource = new ResourceTreeDatasource(result);
- treeGrid.setDataSource(dataSource);
- // GH: couldn't get initial data to mix with the datasource... so i put the inital data in
- // the first datasource request
-// treeGrid.setInitialData(selectedLineage);
-
- addMember(treeGrid);
-
treeGrid.addDataArrivedHandler(new DataArrivedHandler() {
public void onDataArrived(DataArrivedEvent dataArrivedEvent) {
@@ -351,7 +344,7 @@ public class ResourceTreeView extends VLayout {
treeGrid.getTree().openFolder(selectedNode);
for (TreeNode p : parents) {
- System.out.println("open? " + treeGrid.getTree().isOpen(p) + " node: " + p);
+ System.out.println("open? " + treeGrid.getTree().isOpen(p) + " node: " + p.getName());
}
treeGrid.selectRecord(selectedNode);
@@ -362,6 +355,33 @@ public class ResourceTreeView extends VLayout {
}
});
+ ResourceTreeDatasource dataSource = new ResourceTreeDatasource(result);
+ treeGrid.setDataSource(dataSource);
+ // GH: couldn't get initial data to mix with the datasource... so i put the inital data in
+ // the first datasource request
+// treeGrid.setInitialData(selectedLineage);
+
+ addMember(treeGrid);
+
+
+ TreeNode selectedNode = treeGrid.getTree().findById(String.valueOf(selectedResource.getId()));
+ System.out.println("Trying to preopen: " + selectedNode);
+ if (selectedNode != null) {
+ System.out.println("Preopen node!!!");
+ TreeNode[] parents = treeGrid.getTree().getParents(selectedNode);
+ treeGrid.getTree().openFolders(parents);
+ treeGrid.getTree().openFolder(selectedNode);
+
+ for (TreeNode p : parents) {
+ System.out.println("open? " + treeGrid.getTree().isOpen(p) + " node: " + p.getName());
+ }
+
+ treeGrid.selectRecord(selectedNode);
+ initialSelect = true;
+ treeGrid.markForRedraw();
+ }
+
+
// treeGrid.fegetTree().openFolder(rootData[0]);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
index 197f8a0..c0dfa8a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
@@ -18,10 +18,6 @@
*/
package org.rhq.enterprise.gui.coregui.client.util;
-import org.rhq.core.domain.authz.Role;
-import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
-import org.rhq.core.domain.criteria.ResourceCriteria;
-import org.rhq.core.domain.util.OrderingField;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
@@ -34,8 +30,6 @@ import com.smartgwt.client.types.DSDataFormat;
import com.smartgwt.client.types.DSProtocol;
import com.smartgwt.client.widgets.grid.ListGridRecord;
-import java.util.List;
-
/**
* Base GWT-RPC oriented DataSource class.
*
@@ -110,7 +104,6 @@ public abstract class RPCDataSource<T> extends DataSource {
for (String sort : sorts) {
PageOrdering ordering = (sort.startsWith("-")) ? PageOrdering.DESC : PageOrdering.ASC;
String columnName = (ordering == PageOrdering.DESC) ? sort.substring(1) : sort;
- ResourceCriteria c;
pageControl.addDefaultOrderingField(columnName, ordering);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css
index c873d70..844eaa0 100644
--- a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css
+++ b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css
@@ -105,7 +105,7 @@ a:hover {
.BreadCrumb {
- font-size: 12pt;
+ font-size: 10pt;
font-weight: bold;
text-decoration: none;
color: #363636;
commit d04c1659d404505ad849e9e54a37e1bd654384b6
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Fri Mar 5 16:37:27 2010 -0500
No duplicates in resourceLineageAndSiblings
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
index f6688b0..20035ae 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
@@ -649,22 +649,15 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
}
public List<Resource> getResourceLineageAndSiblings(int resourceId) {
- LinkedList<Resource> resourceLineage = new LinkedList<Resource>();
- Resource resource = entityManager.find(Resource.class, resourceId);
- if (resource == null) {
- throw new ResourceNotFoundException(resourceId);
- }
+ List<Resource> resourceLineage = getResourceLineage(resourceId);
+ LinkedList<Resource> result = new LinkedList<Resource>();
- resourceLineage.add(resource);
- int childResourceId = resourceId;
- Resource parent;
- while ((parent = getParentResource(childResourceId)) != null) {
- resourceLineage.addAll(parent.getChildResources());
- resourceLineage.addFirst(parent);
- childResourceId = parent.getId(); // This also ensures Hibernate actually populates parent's fields.
+ result.add(resourceLineage.get(0));
+ for (Resource resource : resourceLineage) {
+ result.addAll(resource.getChildResources());
}
- return resourceLineage;
+ return result;
}
commit 1f37d55fb98d0ae248afe9c00f0ade1f0dd3d236
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Mar 5 14:20:18 2010 -0500
get eclipse classpath up to date
diff --git a/.classpath b/.classpath
index a1a16c2..082cf31 100644
--- a/.classpath
+++ b/.classpath
@@ -4,6 +4,8 @@
<classpathentry kind="src" path="modules/common/filetemplate-bundle/src/main/java"/>
<classpathentry kind="src" path="modules/common/filetemplate-bundle/src/test/java"/>
<classpathentry kind="src" path="modules/enterprise/gui/base-perspective-jar/src/main/java"/>
+ <classpathentry kind="src" path="modules/enterprise/gui/coregui/src/main/java"/>
+ <classpathentry kind="src" path="modules/enterprise/gui/coregui/target/generated-sources/gwt"/>
<classpathentry kind="src" path="modules/plugins/nss/src/main/java"/>
<classpathentry kind="src" path="modules/enterprise/server/plugins/jboss-software/src/test/java"/>
<classpathentry kind="src" path="modules/enterprise/server/plugins/jboss-software/src/main/java"/>
@@ -239,5 +241,7 @@
<classpathentry exported="true" kind="var" path="M2_REPO/org/fedorahosted/cobbler/cobbler4j/0.1/cobbler4j-0.1.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/com/google/gwt/gwt-user/2.0.0/gwt-user-2.0.0.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/com/google/gwt/gwt-dev/2.0.0/gwt-dev-2.0.0.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/com/smartgwt/smartgwt/2.1/smartgwt-2.1.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/ca/nanometrics/gflot/1.0.0/gflot-1.0.0.jar"/>
<classpathentry kind="output" path="eclipse-classes"/>
</classpath>
commit 446ed8321d61baeda5341dc4e3f2b1b75e7c69f0
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Mar 5 14:00:52 2010 -0500
base64 encode the token
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CoreServerServiceImpl.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CoreServerServiceImpl.java
index afdb681..3b5ecc7 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CoreServerServiceImpl.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CoreServerServiceImpl.java
@@ -42,6 +42,7 @@ import org.rhq.core.clientapi.server.core.AgentVersion;
import org.rhq.core.clientapi.server.core.ConnectAgentRequest;
import org.rhq.core.clientapi.server.core.ConnectAgentResults;
import org.rhq.core.clientapi.server.core.CoreServerService;
+import org.rhq.core.db.ant.Base64;
import org.rhq.core.domain.cloud.PartitionEventType;
import org.rhq.core.domain.cloud.Server;
import org.rhq.core.domain.cloud.composite.FailoverListComposite;
@@ -443,19 +444,18 @@ public class CoreServerServiceImpl implements CoreServerService {
return;
}
-
private synchronized String generateAgentToken() {
if (random == null) {
try {
random = SecureRandom.getInstance("SHA1PRNG");
} catch (NoSuchAlgorithmException e) {
- throw new RuntimeException("Could not load SecureRandom algorithm",e);
+ throw new RuntimeException("Could not load SecureRandom algorithm", e);
}
}
byte[] tokenBytes = new byte[50];
random.nextBytes(tokenBytes);
- return new String(tokenBytes);
+ return Base64.encode(tokenBytes);
}
}
\ No newline at end of file
commit c0ad9af60bf4500f5d2b999bac1ff51432f33b37
Merge: ff2067e... ab98d70...
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Fri Mar 5 11:48:06 2010 -0500
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
commit ff2067e928ed54edbf4cb16037b1f94849ea1e42
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Fri Mar 5 11:47:14 2010 -0500
update history value change listener to only call renderView() for descendant portion of requested path if requested path is a descendant path of the current path; call history value changed listener when a tab is clicked
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 fa73838..5330f61 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
@@ -39,6 +39,7 @@ import java.util.List;
/**
* @author Greg Hinkle
+ * @author Ian Springer
*/
public class CoreGUI implements EntryPoint {
@@ -57,6 +58,8 @@ public class CoreGUI implements EntryPoint {
private View rootView;
+ public View currentView;
+
public void onModuleLoad() {
if (!GWT.isScript()) {
@@ -126,8 +129,7 @@ public class CoreGUI implements EntryPoint {
private void buildCoreUI() {
RootCanvas rootCanvas = new RootCanvas();
- this.rootView = new View(new ViewId("", null), rootCanvas);
-
+ this.currentView = this.rootView = new View(new ViewId("", null), rootCanvas);
// HTMLPane menuPane = new HTMLPane();
// menuPane.setWidth100();
@@ -135,48 +137,48 @@ public class CoreGUI implements EntryPoint {
// menuPane.setContentsType(ContentsType.PAGE);
// menuPane.setContentsURL("/rhq/common/menu/menu.xhtml");
// menuPane.setZIndex(400000);
-//
// layout.addMember(menuPane);
-
MenuBarView menuBarView = new MenuBarView();
menuBarView.setWidth("100%");
// WidgetCanvas menuCanvas = new WidgetCanvas(menuBarView);
// menuCanvas.setTop(0);
// menuCanvas.setWidth100();
// menuCanvas.draw();
-
rootCanvas.addMember(menuBarView);
-
breadCrumbTrailPane = new BreadcrumbTrailPane();
-
rootCanvas.addMember(breadCrumbTrailPane);
-
DOM.setInnerHTML(RootPanel.get("Loading-Panel").getElement(), "");
-
Canvas canvas = new Canvas(CONTENT_CANVAS_ID);
canvas.setWidth100();
canvas.setHeight100();
-
rootCanvas.addMember(canvas);
-
-// canvas.addChild(new AdministrationView()) ; //DemoCanvas());
-
-
rootCanvas.draw();
History.addValueChangeHandler(new ValueChangeHandler<String>() {
+
public void onValueChange(ValueChangeEvent<String> historyChangeEvent) {
String path = historyChangeEvent.getValue();
System.out.println("History request: " + path);
List<String> viewIdNames = path.equals("") ? Collections.<String>emptyList() : Arrays.asList(path.split("\\/"));
- View parentView = CoreGUI.this.rootView;
+ View parentView;
+ if (path.startsWith(CoreGUI.this.currentView.getId().getPath())) {
+ // The requested path is a descendant path of the current view, so skip rendering of components of
+ // the path corresponding to the current view. For example, if the current view is Resource/10001
+ // and Resource/10001/Summary/Overview is requested, call renderView() only on for the Summary and
+ // Overview components of the path.
+ parentView = CoreGUI.this.currentView;
+ } else {
+ // Otherwise, start at the root view (i.e. call renderView() for every component in the path).
+ parentView = CoreGUI.this.rootView;
+ }
+
ViewRenderer viewRenderer = parentView.getDescendantViewRenderer();
List<Breadcrumb> breadcrumbs = new ArrayList<Breadcrumb>(viewIdNames.size());
try {
@@ -201,6 +203,7 @@ public class CoreGUI implements EntryPoint {
// TODO: Should we add a new token to the History to point to the valid location
// we ended up at?
}
+ CoreGUI.this.currentView = parentView;
System.out.println("Breadcrumbs: " + breadcrumbs);
breadCrumbTrailPane.setBreadcrumbs(breadcrumbs);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewId.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewId.java
index 9a2406e..e5200fb 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewId.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewId.java
@@ -30,7 +30,14 @@ public class ViewId {
private String name;
private ViewId parent;
private String path;
-
+
+ /**
+ * Create a view id with the specified base name and parent. The name must not contain any slashes. The parent
+ * should not be null, unless this is the root view id.
+ *
+ * @param name the base name of the view represented by this id
+ * @param parent the id of the view represented by this id's parent view
+ */
public ViewId(String name, ViewId parent) {
if (name == null) {
throw new IllegalArgumentException("Name is null.");
@@ -66,25 +73,6 @@ public class ViewId {
return this.path;
}
- /**
- *
- * @param viewId the id of some View that is an ancestor of the View represented by this id
- * (i.e. the following must be true: this.getPath().startsWith(viewId.getPath())
- * @return the path relative to the specified ancestral view id
- */
- public String getPathRelativeTo(ViewId viewId) {
- if (viewId == null) {
- throw new IllegalArgumentException("ViewId is null.");
- }
- if (!getPath().startsWith(viewId.getPath())) {
- throw new IllegalArgumentException("ViewId [" + viewId + "] is not an ancestor of this ViewId [" + this + "]");
- }
- if (viewId.getName().equals(ViewId.ROOT_VIEW_ID.getName())) {
- return getPath();
- }
- return getPath().substring(viewId.getPath().length() + 1);
- }
-
@Override
public boolean equals(Object o) {
if (this == o) return true;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index b4ff9ec..8ccfd8f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -27,7 +27,6 @@ import org.rhq.enterprise.gui.coregui.client.ViewId;
import org.rhq.enterprise.gui.coregui.client.ViewRenderer;
import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
import org.rhq.enterprise.gui.coregui.client.components.SimpleCollapsiblePanel;
-import org.rhq.enterprise.gui.coregui.client.components.SubTabLayout;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTab;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSelectedEvent;
@@ -40,14 +39,9 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitorin
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
import com.google.gwt.user.client.History;
-import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.types.Side;
-import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.tab.Tab;
-import com.smartgwt.client.widgets.tab.TabSet;
-import com.smartgwt.client.widgets.tab.events.TabSelectedEvent;
-import com.smartgwt.client.widgets.tab.events.TabSelectedHandler;
import java.util.EnumSet;
@@ -220,15 +214,12 @@ public class ResourceDetailView extends VLayout implements ViewRenderer, Resourc
}
public void onTabSelected(TwoLevelTabSelectedEvent tabSelectedEvent) {
- // TODO: Implement this method.
-
String tabPath = "/" + tabSelectedEvent.getId() + "/" + tabSelectedEvent.getSubTabId();
-
-
// System.out.println("TAB: " + currentView.getPath() + tabPath);
if (resource != null) {
- History.newItem("Resource/" + resource.getId() + tabPath, false);
+ String path = "Resource/" + resource.getId() + tabPath;
+ History.newItem(path);
}
}
commit 61ce5d747137aece4d531d918d0c4cb177dfc572
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Fri Mar 5 10:37:40 2010 -0500
fix so Resource name is displayed in breadcrumb trail rather than "..."
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 ab5ecee..fa73838 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
@@ -270,19 +270,8 @@ public class CoreGUI implements EntryPoint {
History.newItem(path);
}
- public static void updateBreadCrumbDisplayName(ViewId viewId, String displayName) {
- int index = -1;
- for (ViewId current = viewId.getParent(); current != null; current = current.getParent()) {
- index++;
- }
- List<Breadcrumb> breadcrumbs = breadCrumbTrailPane.getBreadcrumbs();
- if (index < breadcrumbs.size()) {
- Breadcrumb breadcrumb = breadcrumbs.get(index);
- if (breadcrumb.getName().equals(viewId.getName())) {
- breadcrumbs.set(index, new Breadcrumb(breadcrumb.getName(), displayName));
- breadCrumbTrailPane.refresh();
- }
- }
+ public static void refreshBreadCrumbTrail() {
+ breadCrumbTrailPane.refresh();
}
private class RootCanvas extends VLayout implements ViewRenderer {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index bfd6781..b4ff9ec 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -267,10 +267,6 @@ public class ResourceDetailView extends VLayout implements ViewRenderer, Resourc
}
}
- if (crumb != null) {
- return new View(viewId, crumb);
- } else {
- return new View(viewId);
- }
+ return new View(viewId, crumb);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
index 1b808f5..48469cd 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
@@ -87,11 +87,10 @@ public class ResourceView extends HLayout implements ViewRenderer {
}
- public void setSelectedResource(final int resourceId, final ViewId viewId) {
+ public void setSelectedResource(final int resourceId, final View view) {
Resource resource = this.treeView.getResource(resourceId);
if (resource != null) {
- setSelectedResource(resource);
- CoreGUI.updateBreadCrumbDisplayName(viewId, resource.getName());
+ setSelectedResource(resource, view);
} else {
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterId(resourceId);
@@ -109,14 +108,19 @@ public class ResourceView extends HLayout implements ViewRenderer {
onFailure(new Exception("Resource with id [" + resourceId + "] does not exist."));
} else {
Resource resource = result.get(0);
- setSelectedResource(resource);
- CoreGUI.updateBreadCrumbDisplayName(viewId, resource.getName());
+ setSelectedResource(resource, view);
}
}
});
}
}
+ private void setSelectedResource(Resource resource, View view) {
+ view.getBreadcrumb().setDisplayName(resource.getName());
+ CoreGUI.refreshBreadCrumbTrail();
+ setSelectedResource(resource);
+ }
+
public void setSelectedResource(Resource resource) {
this.selectedResource = resource;
this.treeView.setSelectedResource(resource);
@@ -142,15 +146,16 @@ public class ResourceView extends HLayout implements ViewRenderer {
// not a valid Resource id - nothing for us to do
throw new UnknownViewException("Invalid Resource id [" + viewId + "]");
}
- if (this.selectedResource == null || this.selectedResource.getId() != resourceId) {
- setSelectedResource(resourceId, viewId);
- }
+
// Use "..." as temporary display name for breadcrumb. If the Resource is fetched successfully, the display name
// will be updated to be the Resource's name.
Breadcrumb breadcrumb = new Breadcrumb(viewId.getName(), "...");
-// detailView.renderView(viewId, lastNode);
+ View view = new View(viewId, detailView, breadcrumb);
+ if (this.selectedResource == null || this.selectedResource.getId() != resourceId) {
+ setSelectedResource(resourceId, view);
+ }
- return new View(viewId, detailView, breadcrumb);
+ return view;
}
}
commit 56571c9f53d6d23a3a89c572c866a4bbe7cde5b8
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Fri Mar 5 10:36:54 2010 -0500
optimize imports; fix typo
diff --git a/modules/core/domain/src/main/java/org/rhq/core/server/MeasurementConverter.java b/modules/core/domain/src/main/java/org/rhq/core/server/MeasurementConverter.java
index 1826a63..443964f 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/server/MeasurementConverter.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/server/MeasurementConverter.java
@@ -22,18 +22,14 @@
*/
package org.rhq.core.server;
- import java.text.DecimalFormat;
- import java.text.NumberFormat;
- import java.text.ParseException;
- import java.util.HashSet;
- import java.util.Set;
- import java.util.regex.Matcher;
- import java.util.regex.Pattern;
-
- import org.rhq.core.domain.measurement.MeasurementSchedule;
- import org.rhq.core.domain.measurement.MeasurementUnits;
- import org.rhq.core.domain.measurement.composite.MeasurementNumericValueAndUnits;
- import org.rhq.core.domain.measurement.util.MeasurementConversionException;
+import java.text.NumberFormat;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.rhq.core.domain.measurement.MeasurementSchedule;
+import org.rhq.core.domain.measurement.MeasurementUnits;
+import org.rhq.core.domain.measurement.composite.MeasurementNumericValueAndUnits;
+import org.rhq.core.domain.measurement.util.MeasurementConversionException;
public class MeasurementConverter {
private static final int MAX_PRECISION_DIGITS = 4;
diff --git a/modules/core/domain/src/main/java/org/rhq/core/server/MeasurementParser.java b/modules/core/domain/src/main/java/org/rhq/core/server/MeasurementParser.java
index b6e3400..42cd8f3 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/server/MeasurementParser.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/server/MeasurementParser.java
@@ -66,7 +66,7 @@ public class MeasurementParser {
if ((fromUnits == null) || (!fromUnits.isComparableTo(targetUnits))) {
throw new MeasurementConversionException("The units in '" + input + "' were not valid, " + "expected '"
- + targetUnits.getFamily() + "' units " + "received '" + units + "' units");
+ + targetUnits.getFamily() + "' units, received '" + units + "' units");
}
}
commit ab98d702f90b5220c7e6ac877414d7c2040292ae
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Fri Mar 5 09:15:37 2010 -0500
NPE fix in resource view
SubTab is properly defaulted to first tab
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
index c5aba88..9b07011 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
@@ -72,7 +72,8 @@ public class SubTabLayout extends VLayout {
int i = 0;
for (final String title : subtabs.keySet()) {
- if (currentlyDisplayed == null) {
+
+ if (currentlySelected == null) {
currentlyDisplayed = subtabs.get(title);
currentlySelected = title;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceSummaryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceSummaryView.java
index ed2da2e..159439b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceSummaryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceSummaryView.java
@@ -81,7 +81,7 @@ public class ResourceSummaryView extends DynamicForm implements ResourceSelectLi
markForRedraw();
}
- private void loadValues() {
+ private void loadValues() {
GWTServiceLookup.getMeasurementDataService().findCurrentTraitsForResource(
resource.getId(),
DisplayType.SUMMARY,
@@ -93,11 +93,11 @@ public class ResourceSummaryView extends DynamicForm implements ResourceSelectLi
public void onSuccess(List<MeasurementDataTrait> result) {
// TODO: Implement this method.
for (MeasurementDataTrait trait : result) {
- String formId = trait.getName().replaceAll("\\.", "_").replaceAll(" ","__");
+ String formId = trait.getName().replaceAll("\\.", "_").replaceAll(" ", "__");
FormItem item = getItem(formId);
-
+
if (item != null) {
- setValue(formId,trait.getValue());
+ setValue(formId, trait.getValue());
}
}
markForRedraw();
@@ -127,31 +127,31 @@ public class ResourceSummaryView extends DynamicForm implements ResourceSelectLi
ArrayList<String> itemIds = new ArrayList<String>();
- StaticTextItem typeItem = new StaticTextItem("typeItem","Type");
+ StaticTextItem typeItem = new StaticTextItem("typeItem", "Type");
typeItem.setTooltip("Plugin: " + type.getPlugin() + "\n<br>" + "Type: " + type.getName());
typeItem.setValue(type.getName() + " (" + type.getPlugin() + ")");
formItems.add(typeItem);
itemIds.add(typeItem.getName());
- StaticTextItem descriptionItem = new StaticTextItem("descriptionItem","Description");
+ StaticTextItem descriptionItem = new StaticTextItem("descriptionItem", "Description");
descriptionItem.setValue(resource.getDescription());
formItems.add(descriptionItem);
itemIds.add(descriptionItem.getName());
- StaticTextItem versionItem = new StaticTextItem("versionItem","Version");
+ StaticTextItem versionItem = new StaticTextItem("versionItem", "Version");
formItems.add(versionItem);
itemIds.add(versionItem.getName());
-
- StaticTextItem parentItem = new StaticTextItem("parentItem","Parent");
+
+ StaticTextItem parentItem = new StaticTextItem("parentItem", "Parent");
formItems.add(parentItem);
itemIds.add(parentItem.getName());
for (MeasurementDefinition trait : traits) {
- String id = trait.getDisplayName().replaceAll("\\.", "_").replaceAll(" ","__");
+ String id = trait.getDisplayName().replaceAll("\\.", "_").replaceAll(" ", "__");
itemIds.add(id);
StaticTextItem item = new StaticTextItem(id, trait.getDisplayName());
@@ -171,12 +171,14 @@ public class ResourceSummaryView extends DynamicForm implements ResourceSelectLi
formItems.add(new SpacerItem());
setItems(formItems.toArray(new FormItem[formItems.size()]));
-
+
setValue("typeItem", type.getName() + " (" + type.getPlugin() + ")");
setValue("descriptionItem", resource.getDescription());
setValue("versionItem", resource.getVersion());
- setValue("parentItem", resource.getParentResource() == null ? null : (resource.getParentResource().getResourceType().getName() +
- " '<a href=\"#Resource/" + resource.getParentResource().getId()) + "\">" + resource.getParentResource().getName() + "</a>'");
+ setValue("parentItem", resource.getParentResource() == null ? null :
+ (resource.getParentResource().getResourceType().getName() +
+ " '<a href=\"#Resource/" + resource.getParentResource().getId() + "\">" +
+ resource.getParentResource().getName() + "</a>'"));
}
commit 7b5359e7b8e000764cba42b824f61cc861d40fb4
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Mar 5 00:46:11 2010 -0500
update eclipse classpath
diff --git a/.classpath b/.classpath
index 9e01641..a1a16c2 100644
--- a/.classpath
+++ b/.classpath
@@ -186,10 +186,10 @@
<classpathentry exported="true" kind="var" path="M2_REPO/cglib/cglib-nodep/2.1_3/cglib-nodep-2.1_3.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/commons-logging/commons-logging/1.1/commons-logging-1.1.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/commons-lang/commons-lang/2.4/commons-lang-2.4.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/javax/faces/jsf-api/1.2_12/jsf-api-1.2_12.jar" sourcepath="/M2_REPO/javax/faces/jsf-api/1.2_12/jsf-api-1.2_12-sources.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/javax/faces/jsf-impl/1.2_12/jsf-impl-1.2_12.jar" sourcepath="/M2_REPO/javax/faces/jsf-impl/1.2_12/jsf-impl-1.2_12-sources.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/javax/faces/jsf-api/1.2_14/jsf-api-1.2_14.jar" sourcepath="/M2_REPO/javax/faces/jsf-api/1.2_14/jsf-api-1.2_14-sources.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/javax/faces/jsf-impl/1.2_14/jsf-impl-1.2_14.jar" sourcepath="/M2_REPO/javax/faces/jsf-impl/1.2_14/jsf-impl-1.2_14-sources.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/javax/el/el-api/1.0/el-api-1.0.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/com/sun/facelets/jsf-facelets/1.1.14/jsf-facelets-1.1.14.jar" sourcepath="/M2_REPO/com/sun/facelets/jsf-facelets/1.1.13/jsf-facelets-1.1.13-sources.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/com/sun/facelets/jsf-facelets/1.1.15.B1/jsf-facelets-1.1.15.B1.jar" sourcepath="/M2_REPO/com/sun/facelets/jsf-facelets/1.1.15.B1/jsf-facelets-1.1.15.B1-sources.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/mc4j/org-mc4j-ems/1.2.11/org-mc4j-ems-1.2.11.jar" sourcepath="/M2_REPO/mc4j/org-mc4j-ems/1.2.11/org-mc4j-ems-1.2.11-sources.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/opensymphony/quartz/quartz/1.6.5/quartz-1.6.5.jar" sourcepath="/M2_REPO/org/opensymphony/quartz/quartz/1.6.5/quartz-1.6.5-sources.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/javax/mail/mail/1.3.1/mail-1.3.1.jar"/>
@@ -210,7 +210,7 @@
<classpathentry exported="true" kind="var" path="M2_REPO/org/jvnet/inflector/0.7.0/inflector-0.7.0.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/net/augeas/augeas/0.0.1/augeas-0.0.1.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/json/json/20080701/json-20080701.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/com/sun/jna/jna/3.0.1/jna-3.0.1.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/net/java/dev/jna/jna/3.2.2/jna-3.2.2.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/freemarker/freemarker/2.3.11/freemarker-2.3.11.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/seam/jboss-seam/2.1.0.SP1/jboss-seam-2.1.0.SP1.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/seam/jboss-seam-ui/2.1.0.SP1/jboss-seam-ui-2.1.0.SP1.jar"/>
@@ -224,7 +224,7 @@
<classpathentry exported="true" kind="var" path="M2_REPO/org/apache/xmlrpc/xmlrpc-client/3.1.2/xmlrpc-client-3.1.2.jar" sourcepath="/M2_REPO/org/apache/xmlrpc/xmlrpc-client/3.1.2/xmlrpc-client-3.1.2-sources.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/apache/xmlrpc/xmlrpc-common/3.1.2/xmlrpc-common-3.1.2.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/apache/ws/commons/util/ws-commons-util/1.0.2/ws-commons-util-1.0.2.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/commons-digester/commons-digester/1.8/commons-digester-1.8.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/commons-digester/commons-digester/1.8.1/commons-digester-1.8.1.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/commons-codec/commons-codec/1.4/commons-codec-1.4.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/pircbot/pircbot/1.4.2/pircbot-1.4.2.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/net/homeip/yusuke/twitter4j/2.0.9/twitter4j-2.0.9.jar"/>
@@ -238,5 +238,6 @@
<classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/byteman/byteman/1.2.1/byteman-1.2.1.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/fedorahosted/cobbler/cobbler4j/0.1/cobbler4j-0.1.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/com/google/gwt/gwt-user/2.0.0/gwt-user-2.0.0.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/com/google/gwt/gwt-dev/2.0.0/gwt-dev-2.0.0.jar"/>
<classpathentry kind="output" path="eclipse-classes"/>
</classpath>
commit 6e918a06d54ba2f19b2497c9b215c3a43eaebc23
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Thu Mar 4 21:51:52 2010 -0500
Merge fix
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/SubjectGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/SubjectGWTService.java
index eb74cd4..93fbd5d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/SubjectGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/SubjectGWTService.java
@@ -98,7 +98,6 @@ public interface SubjectGWTService extends RemoteService {
*/
Subject updateSubject(Subject subjectToModify);
- PageList<Subject> findSubjectsByCriteria(
- SubjectCriteria criteria);
+ PageList<Subject> findSubjectsByCriteria(SubjectCriteria criteria);
}
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/converter/MetricPercentConverter.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/converter/MetricPercentConverter.java
index 19dae93..fdc34ff 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/converter/MetricPercentConverter.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/converter/MetricPercentConverter.java
@@ -31,7 +31,7 @@ import org.jboss.seam.annotations.faces.Converter;
import org.rhq.core.domain.measurement.MeasurementUnits;
import org.rhq.core.domain.measurement.composite.MeasurementNumericValueAndUnits;
import org.rhq.core.domain.measurement.util.MeasurementConversionException;
-import org.rhq.core.domain.measurement.util.MeasurementConverter;
+import org.rhq.core.server.MeasurementParser;
@Converter
@Scope(ScopeType.APPLICATION)
@@ -40,7 +40,7 @@ public class MetricPercentConverter implements javax.faces.convert.Converter {
public Object getAsObject(FacesContext context, UIComponent component, String value) {
try {
- MeasurementNumericValueAndUnits percentage = MeasurementConverter.parse(value, MeasurementUnits.PERCENTAGE);
+ MeasurementNumericValueAndUnits percentage = MeasurementParser.parse(value, MeasurementUnits.PERCENTAGE);
return percentage.getValue();
} catch (MeasurementConversionException e) {
commit 57e3242aea755fce89f47a4f63d7058d2c382582
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Thu Mar 4 21:51:19 2010 -0500
Fixing merge issues on criteria api for gwt
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AlertCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AlertCriteria.java
index e1b4b2c..a605adf 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AlertCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AlertCriteria.java
@@ -76,7 +76,6 @@ public class AlertCriteria extends Criteria {
private PageOrdering sortResourceId; // requires sort override
public AlertCriteria() {
- super(Alert.class);
filterOverrides.put("triggeredOperationName", "triggeredOperation like ?");
filterOverrides.put("startTime", "ctime >= ?");
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AlertDefinitionCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AlertDefinitionCriteria.java
index 756dc5a..c3992cb 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AlertDefinitionCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AlertDefinitionCriteria.java
@@ -62,8 +62,6 @@ public class AlertDefinitionCriteria extends Criteria {
private PageOrdering sortPriority;
public AlertDefinitionCriteria() {
- super(AlertDefinition.class);
-
filterOverrides.put("alertTemplateParentId", "parentId = ?");
filterOverrides.put("alertTemplateResourceTypeId", "resourceType.id = ?");
filterOverrides.put("alertTemplateResourceTypeName", "resourceType.name like ?");
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleCriteria.java
index f38cfad..f004685 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleCriteria.java
@@ -42,12 +42,15 @@ public class BundleCriteria extends Criteria {
private boolean fetchRepo;
public BundleCriteria() {
- super(Bundle.class);
-
filterOverrides.put("bundleTypeId", "bundleType.id = ?");
filterOverrides.put("bundleTypeName", "bundleType.name like ?");
}
+ @Override
+ public Class getPersistentClass() {
+ return Bundle.class;
+ }
+
public void addFilterId(Integer filterId) {
this.filterId = filterId;
}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeployDefinitionCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeployDefinitionCriteria.java
index 975e137..54b4930 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeployDefinitionCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeployDefinitionCriteria.java
@@ -44,7 +44,11 @@ public class BundleDeployDefinitionCriteria extends Criteria {
private boolean fetchDeployments;
public BundleDeployDefinitionCriteria() {
- super(BundleDeployDefinition.class);
+ }
+
+ @Override
+ public Class getPersistentClass() {
+ return BundleDeployDefinitionCriteria.class;
}
public void addFilterId(Integer filterId) {
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java
index da8476a..47f500c 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java
@@ -44,14 +44,17 @@ public class BundleDeploymentCriteria extends Criteria {
private boolean fetchHistory;
public BundleDeploymentCriteria() {
- super(BundleDeployment.class);
-
filterOverrides.put("resourceId", "resource.id = ?");
filterOverrides.put("resourceName", "resource.name like ?");
filterOverrides.put("bundleDeployDefinitionId", "parentResource.id = ?");
filterOverrides.put("bundleDeployDefinitionName", "parentResource.name like ?");
}
+ @Override
+ public Class getPersistentClass() {
+ return BundleDeployment.class;
+ }
+
public void addFilterId(Integer filterId) {
this.filterId = filterId;
}
@@ -78,6 +81,7 @@ public class BundleDeploymentCriteria extends Criteria {
/**
* Requires MANAGE_INVENTORY
+ *
* @param fetchResource
*/
public void fetchResource(boolean fetchResource) {
@@ -88,7 +92,9 @@ public class BundleDeploymentCriteria extends Criteria {
this.fetchHistory = fetchHistory;
}
- /** subclasses should override as necessary */
+ /**
+ * subclasses should override as necessary
+ */
public boolean isInventoryManagerRequired() {
return (this.fetchResource);
}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleVersionCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleVersionCriteria.java
index 5264a76..4d01be0 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleVersionCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleVersionCriteria.java
@@ -46,11 +46,14 @@ public class BundleVersionCriteria extends Criteria {
private boolean fetchConfigurationDefinition;
public BundleVersionCriteria() {
- super(BundleVersion.class);
-
filterOverrides.put("bundleName", "bundle.name like ?");
}
+ @Override
+ public Class getPersistentClass() {
+ return BundleVersion.class;
+ }
+
public void addFilterId(Integer filterId) {
this.filterId = filterId;
}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
index e19b022..15332a4 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
@@ -42,13 +42,11 @@ import java.util.Map;
@XmlAccessorType(XmlAccessType.FIELD)
public abstract class Criteria implements Serializable {
public enum Type {
- FILTER, FETCH, SORT
+ FILTER, FETCH, SORT;
}
private static final long serialVersionUID = 1L;
- private Class<?> persistentClass;
-
private Integer pageNumber;
private Integer pageSize;
@@ -67,10 +65,6 @@ public abstract class Criteria implements Serializable {
//added no args constructor for bean and JAXB requirement
@SuppressWarnings("unused")
public Criteria() {
- }
-
- public Criteria(Class<?> persistentClass) {
- this.persistentClass = persistentClass;
this.filterOverrides = new HashMap<String, String>();
this.sortOverrides = new HashMap<String, String>();
@@ -84,9 +78,7 @@ public abstract class Criteria implements Serializable {
setPaging(0, 200);
}
- public Class<?> getPersistentClass() {
- return persistentClass;
- }
+ public abstract Class getPersistentClass();
public Integer getPageNumber() {
return pageNumber;
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/EventCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/EventCriteria.java
index 1192dd5..c6e12e0 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/EventCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/EventCriteria.java
@@ -54,8 +54,6 @@ public class EventCriteria extends Criteria {
private PageOrdering sortSeverity;
public EventCriteria() {
- super(Event.class);
-
filterOverrides.put("sourceName", "source.eventDefinition.name like ?");
filterOverrides.put("startTime", "timestamp >= ?");
filterOverrides.put("endTime", "timestamp <= ?");
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/GroupOperationHistoryCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/GroupOperationHistoryCriteria.java
index 2cd5326..e3fb715 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/GroupOperationHistoryCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/GroupOperationHistoryCriteria.java
@@ -40,11 +40,14 @@ public class GroupOperationHistoryCriteria extends OperationHistoryCriteria {
private List<Integer> filterResourceGroupIds; // requires override
public GroupOperationHistoryCriteria() {
- super(GroupOperationHistory.class);
-
filterOverrides.put("resourceGroupIds", "group.id IN ( ? )");
}
+ @Override
+ public Class getPersistentClass() {
+ return GroupOperationHistory.class;
+ }
+
public void addFilterResourceGroupIds(List<Integer> filterResourceGroupIds) {
this.filterResourceGroupIds = filterResourceGroupIds;
}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/InstalledPackageCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/InstalledPackageCriteria.java
index c2ab51b..34fb9f9 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/InstalledPackageCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/InstalledPackageCriteria.java
@@ -25,8 +25,6 @@ public class InstalledPackageCriteria extends Criteria {
private PageOrdering sortInstallationDate;
public InstalledPackageCriteria() {
- super(InstalledPackage.class);
-
filterOverrides.put("installationTimeMinimum", "installationDate >= ?");
filterOverrides.put("installationTimeMaximum", "installationDate <= ?");
filterOverrides.put("packageVersionId", "packageVersion.id = ? ");
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementDefinitionCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementDefinitionCriteria.java
index de78ff3..2ce0f65 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementDefinitionCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementDefinitionCriteria.java
@@ -67,8 +67,6 @@ public class MeasurementDefinitionCriteria extends Criteria {
private PageOrdering sortDefaultInterval;
public MeasurementDefinitionCriteria() {
- super(MeasurementDefinition.class);
-
filterOverrides.put("resourceTypeName", "resourceType.name like ?");
filterOverrides.put("resourceTypeId", "resourceType.id = ?");
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementScheduleCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementScheduleCriteria.java
index f56098c..ca90068 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementScheduleCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementScheduleCriteria.java
@@ -53,8 +53,6 @@ public class MeasurementScheduleCriteria extends Criteria {
private PageOrdering sortName; // requires overrides
public MeasurementScheduleCriteria() {
- super(MeasurementSchedule.class);
-
filterOverrides.put("definitionIds", "definition.id IN ( ? )");
filterOverrides.put("resourceId", "resource.id IN ( ? )");
filterOverrides.put("resourceGroupId", "resource.id IN " //
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/OperationDefinitionCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/OperationDefinitionCriteria.java
index c36681a..d66d118 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/OperationDefinitionCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/OperationDefinitionCriteria.java
@@ -56,8 +56,6 @@ public class OperationDefinitionCriteria extends Criteria {
private PageOrdering sortName;
public OperationDefinitionCriteria() {
- super(OperationDefinition.class);
-
filterOverrides.put("resourceTypeId", "resourceType.id = ?");
filterOverrides.put("resourceTypeName", "resourceType.name like ?");
filterOverrides.put("pluginName", "resourceType.plugin like ?");
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/OperationHistoryCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/OperationHistoryCriteria.java
index c770f3c..f54de21 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/OperationHistoryCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/OperationHistoryCriteria.java
@@ -58,12 +58,6 @@ public abstract class OperationHistoryCriteria extends Criteria {
private PageOrdering sortOperationName; // requires override
public OperationHistoryCriteria() {
- super(OperationHistory.class);
- init();
- }
-
- protected OperationHistoryCriteria(Class<? extends OperationHistory> clazz) {
- super(clazz);
init();
}
@@ -79,9 +73,9 @@ public abstract class OperationHistoryCriteria extends Criteria {
filterOverrides.put("endTime", "modifiedTime <= ?");
filterOverrides.put("resourceIds", "id IN " //
- + " ( SELECT roh.id " //
- + " FROM ResourceOperationHistory roh " //
- + " WHERE roh.resource.id IN ( ? ) ) ");
+ + " ( SELECT roh.id " //
+ + " FROM ResourceOperationHistory roh " //
+ + " WHERE roh.resource.id IN ( ? ) ) ");
sortOverrides.put("startTime", "startedTime");
sortOverrides.put("endTime", "modifiedTime");
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/PackageVersionCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/PackageVersionCriteria.java
index d6c128d..5e0d2f8 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/PackageVersionCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/PackageVersionCriteria.java
@@ -35,8 +35,6 @@ public class PackageVersionCriteria extends Criteria {
private PageOrdering sortDisplayName;
public PackageVersionCriteria() {
- super(PackageVersion.class);
-
filterOverrides.put("repoId", "id IN " //
+ "( SELECT cpv.packageVersion.id" //
+ " FROM pv.repoPackageVersions cpv " //
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/RepoCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/RepoCriteria.java
index 2084cf2..42e2ec8 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/RepoCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/RepoCriteria.java
@@ -55,8 +55,6 @@ public class RepoCriteria extends Criteria {
private PageOrdering sortName;
public RepoCriteria() {
- super(Repo.class);
-
filterOverrides.put("resourceIds", "resourceRepos.resource.id IN ( ? )");
filterOverrides.put("contentSourceIds",
"id IN (SELECT innerRepo FROM Repo innerRepo " +
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
index 0e84b1e..627a6eb 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
@@ -91,8 +91,6 @@ public class ResourceCriteria extends Criteria {
private PageOrdering sortCurrentAvailability; // needs overrides
public ResourceCriteria() {
- super(Resource.class);
-
filterOverrides.put("resourceTypeId", "resourceType.id = ?");
filterOverrides.put("resourceTypeName", "resourceType.name like ?");
filterOverrides.put("resourceCategory", "resourceType.category = ?");
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupCriteria.java
index 7f594c0..ae99f2b 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupCriteria.java
@@ -62,8 +62,6 @@ public class ResourceGroupCriteria extends Criteria {
private PageOrdering sortResourceTypeName; // requires overrides
public ResourceGroupCriteria() {
- super(ResourceGroup.class);
-
filterOverrides.put("resourceTypeId", "resourceType.id = ?");
filterOverrides.put("resourceTypeName", "resourceType.name like ?");
filterOverrides.put("pluginName", "resourceType.plugin like ?");
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupDefinitionCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupDefinitionCriteria.java
index 9116dc8..96925fb 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupDefinitionCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupDefinitionCriteria.java
@@ -52,7 +52,7 @@ public class ResourceGroupDefinitionCriteria extends Criteria {
public ResourceGroupDefinitionCriteria() {
- super(GroupDefinition.class);
+
}
@Override
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceOperationHistoryCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceOperationHistoryCriteria.java
index f3e1bb6..e1ab4c4 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceOperationHistoryCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceOperationHistoryCriteria.java
@@ -45,11 +45,14 @@ public class ResourceOperationHistoryCriteria extends OperationHistoryCriteria {
private boolean fetchResults;
public ResourceOperationHistoryCriteria() {
- super(ResourceOperationHistory.class);
-
filterOverrides.put("resourceIds", "resource.id IN ( ? )");
}
+ @Override
+ public Class getPersistentClass() {
+ return ResourceOperationHistory.class;
+ }
+
public void addFilterResourceIds(Integer... filterResourceIds) {
this.filterResourceIds = Arrays.asList(filterResourceIds);
}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceTypeCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceTypeCriteria.java
index 51120f1..d8cfe89 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceTypeCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceTypeCriteria.java
@@ -73,8 +73,6 @@ public class ResourceTypeCriteria extends Criteria {
private PageOrdering sortPluginName; // needs overrides
public ResourceTypeCriteria() {
- super(ResourceType.class);
-
filterOverrides.put("pluginName", "plugin like ?");
filterOverrides.put("ids", "id in ( ? )");
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/RoleCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/RoleCriteria.java
index 3fe5c87..1b1c3fe 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/RoleCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/RoleCriteria.java
@@ -49,10 +49,7 @@ public class RoleCriteria extends Criteria {
private PageOrdering sortName;
public RoleCriteria() {
- super(Role.class);
-
filterOverrides.put("subjectId", "id in (select sr.id from Role sr JOIN sr.subjects s where s.id = :id)");
-
}
@Override
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/SavedSearchCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/SavedSearchCriteria.java
index bd70b6f..934e179 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/SavedSearchCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/SavedSearchCriteria.java
@@ -58,14 +58,17 @@ public class SavedSearchCriteria extends Criteria {
private PageOrdering sortGlobal;
public SavedSearchCriteria() {
- super(SavedSearch.class);
-
filterOverrides.put("lastComputeTimeMin", "lastComputeTime >= ?");
filterOverrides.put("lastComputeTimeMax", "lastComputeTime <= ?");
filterOverrides.put("resultCountMin", "resultCount >= ?");
filterOverrides.put("resultCountMax", "resultCount <= ?");
}
+ @Override
+ public Class getPersistentClass() {
+ return SavedSearch.class;
+ }
+
public void addFilterId(Integer filterId) {
this.filterId = filterId;
}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/SubjectCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/SubjectCriteria.java
index 9557539..9ddd35b 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/SubjectCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/SubjectCriteria.java
@@ -59,7 +59,6 @@ public class SubjectCriteria extends Criteria {
private PageOrdering sortDepartment;
public SubjectCriteria() {
- super(Subject.class);
}
@Override
commit 1046122781cab48be3817ef413b2b29632ed8017
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Thu Mar 4 17:17:53 2010 -0500
Config history improvements
Configuration Diff view
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationComparisonView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationComparisonView.java
new file mode 100644
index 0000000..6966a93
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationComparisonView.java
@@ -0,0 +1,248 @@
+/*
+ * 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.AbstractPropertyMap;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
+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.core.domain.configuration.definition.PropertyGroupDefinition;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+
+import com.smartgwt.client.widgets.Window;
+import com.smartgwt.client.widgets.grid.CellFormatter;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.layout.VLayout;
+import com.smartgwt.client.widgets.tree.Tree;
+import com.smartgwt.client.widgets.tree.TreeGrid;
+import com.smartgwt.client.widgets.tree.TreeGridField;
+import com.smartgwt.client.widgets.tree.TreeNode;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.EnumSet;
+import java.util.List;
+
+/**
+ * @author Greg Hinkle
+ */
+public class ConfigurationComparisonView extends VLayout {
+
+ private ConfigurationDefinition definition;
+ private List<Configuration> configs;
+ private List<String> titles;
+
+ public ConfigurationComparisonView(ConfigurationDefinition definition, List<Configuration> configs, List<String> titles) {
+ this.definition = definition;
+ this.configs = configs;
+ this.titles = titles;
+
+ setWidth100();
+ }
+
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+ TreeGrid treeGrid = new TreeGrid();
+ treeGrid.setWidth100();
+
+ treeGrid.setLoadDataOnDemand(false);
+
+
+ TreeGridField[] fields = new TreeGridField[2 + titles.size()];
+
+ TreeGridField nameField = new TreeGridField("name","Name",250);
+ nameField.setFrozen(true);
+ nameField.setCellFormatter(new CellFormatter() {
+ public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
+ if (listGridRecord.getAttributeAsBoolean("consistent")) {
+ return String.valueOf(o);
+ } else {
+ return "<span style=\"color: red;\">" + String.valueOf(o) + "</span>";
+ }
+ }
+ });
+
+ TreeGridField typeField = new TreeGridField("type","Type", 80);
+
+ fields[0] = nameField;
+ fields[1] = typeField;
+
+ int i = 2;
+ for (String title : titles) {
+ TreeGridField columnField = new TreeGridField(title, title, 150);
+ columnField.setCellFormatter(new CellFormatter() {
+ public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
+ if (!(listGridRecord instanceof ComparisonTreeNode)) {
+ return "";
+ } else if (listGridRecord.getAttributeAsBoolean("consistent")) {
+ return String.valueOf(o);
+ } else {
+ return "<span style=\"color: red;\">" + String.valueOf(o) + "</span>";
+ }
+ }
+ });
+ fields[i++] = columnField;
+ }
+
+ treeGrid.setFields(fields);
+
+ treeGrid.setData(buildTree());
+
+
+ addMember(treeGrid);
+ }
+
+
+ protected Tree buildTree() {
+ Tree tree = new Tree();
+
+ TreeNode root = new TreeNode("Configuration Comparison");
+
+
+ ArrayList<TreeNode> children = new ArrayList<TreeNode>();
+
+ List<PropertyDefinition> nonGroupDefs = definition.getNonGroupedProperties();
+ if (nonGroupDefs != null && !nonGroupDefs.isEmpty()) {
+ TreeNode groupNode = new TreeNode("General Properties");
+ buildNode(groupNode,nonGroupDefs, configs);
+ children.add(groupNode);
+ }
+
+ for (PropertyGroupDefinition group : definition.getGroupDefinitions()) {
+
+ TreeNode groupNode = new TreeNode(group.getDisplayName());
+
+ buildNode(groupNode, definition.getPropertiesInGroup(group.getName()), configs);
+ children.add(groupNode);
+ }
+
+ root.setChildren(children.toArray(new TreeNode[children.size()]));
+
+ tree.setRoot(root);
+ return tree;
+ }
+
+
+
+ private void buildNode(TreeNode parent, Collection<PropertyDefinition> definitions, List<? extends AbstractPropertyMap> maps) {
+ ArrayList<TreeNode> children = new ArrayList<TreeNode>();
+
+ parent.setAttribute("consistent",true);
+ for (PropertyDefinition definition : definitions) {
+ if (definition instanceof PropertyDefinitionSimple) {
+
+ ArrayList<PropertySimple> properties = new ArrayList<PropertySimple>();
+ for (AbstractPropertyMap map : maps) {
+ properties.add(map.getSimple(definition.getName()));
+ }
+ ComparisonTreeNode node = new ComparisonTreeNode((PropertyDefinitionSimple) definition, properties, titles);
+ if (!node.getAttributeAsBoolean("consistent")) {
+ parent.setAttribute("consistent",false);
+ }
+ children.add(node);
+ }
+
+ // TODO Add support for maps and lists of maps
+ }
+ parent.setChildren(children.toArray(new TreeNode[children.size()]));
+ }
+
+
+ public static void displayComparisonDialog(final ArrayList<ResourceConfigurationUpdate> configs) {
+ int resourceId = configs.get(0).getResource().getResourceType().getId();
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(
+ resourceId,
+ EnumSet.of(ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
+ new ResourceTypeRepository.TypeLoadedCallback() {
+
+ public void onTypesLoaded(ResourceType type) {
+
+ ConfigurationDefinition definition = type.getResourceConfigurationDefinition();
+
+ ArrayList<Configuration> configurations = new ArrayList<Configuration>();
+ ArrayList<String> titles = new ArrayList<String>();
+ for (ResourceConfigurationUpdate update : configs) {
+ configurations.add(update.getConfiguration());
+ titles.add(String.valueOf(update.getId()));
+ }
+ displayComparisonDialog(definition, configurations, titles);
+ }
+ } );
+ }
+
+ public static void displayComparisonDialog(ConfigurationDefinition definition, ArrayList<Configuration> configurations, ArrayList<String> titles) {
+
+ ConfigurationComparisonView view = new ConfigurationComparisonView(definition, configurations, titles);
+ Window dialog = new Window();
+ dialog.setTitle("Comparing configurations");
+ dialog.setWidth(800);
+ dialog.setHeight(800);
+ dialog.setIsModal(true);
+ dialog.setShowModalMask(true);
+ dialog.setCanDragResize(true);
+ dialog.centerInPage();
+ dialog.addItem(view);
+ dialog.show();
+ }
+
+
+ private static class ComparisonTreeNode extends TreeNode {
+
+ PropertyDefinitionSimple definition;
+ List<PropertySimple> properties;
+
+ private ComparisonTreeNode(PropertyDefinitionSimple definition, List<PropertySimple> properties, List<String> titles) {
+ super(definition.getDisplayName());
+
+ this.definition = definition;
+ this.properties = properties;
+
+ setAttribute("type", definition.getType().name());
+
+ int i = 0;
+ boolean allTheSame = true;
+ String commonValue = null;
+ for (PropertySimple prop : properties) {
+
+ String value = prop != null ? prop.getStringValue() : null;
+
+ if (i == 0) {
+ commonValue = value;
+ } else if (allTheSame && commonValue == null && value != null || (commonValue != null && !commonValue.equals(value))) {
+ allTheSame = false;
+ }
+ setAttribute(titles.get(i++), value);
+
+ setAttribute("consistent", allTheSame);
+ }
+ }
+ }
+
+
+ private static class ColoredTreeGrid extends TreeGrid {
+
+ }
+}
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 cd0252f..f3b295a 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
@@ -195,6 +195,7 @@ public class ConfigurationEditor extends VLayout {
System.out.println("ConfigDef retreived in: " + (System.currentTimeMillis() - start));
definition = types.get(resourceTypeId).getResourceConfigurationDefinition();
if (definition == null) {
+ loadingLabel.hide();
showError("No configuration supported for this resource");
}
reload();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java
index 9e424b6..9eab1ae 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java
@@ -30,8 +30,11 @@ import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.data.fields.DataSourceIntegerField;
import com.smartgwt.client.data.fields.DataSourceTextField;
+import com.smartgwt.client.types.FieldType;
import com.smartgwt.client.widgets.grid.ListGridRecord;
+import java.util.Date;
+
/**
* @author Greg Hinkle
*/
@@ -51,6 +54,7 @@ public class ConfigurationHistoryDataSource extends RPCDataSource<ResourceConfig
addField(idField);
DataSourceTextField submittedField = new DataSourceTextField("createdTime");
+ submittedField.setType(FieldType.DATETIME);
addField(submittedField);
DataSourceTextField statusField = new DataSourceTextField("status");
@@ -98,12 +102,13 @@ public class ConfigurationHistoryDataSource extends RPCDataSource<ResourceConfig
record.setAttribute("resource",from.getResource());
record.setAttribute("subject",from.getSubjectName());
record.setAttribute("configuration", from.getConfiguration());
- record.setAttribute("createdTime",from.getCreatedTime());
+ record.setAttribute("createdTime",new Date(from.getCreatedTime()));
record.setAttribute("duration", from.getDuration());
record.setAttribute("errorMessage", from.getErrorMessage());
- record.setAttribute("modifiedTime", from.getModifiedTime());
- record.setAttribute("status",from.getStatus());
+ record.setAttribute("modifiedTime", new Date(from.getModifiedTime()));
+ record.setAttribute("status",from.getStatus().name());
+ record.setAttribute("entity",from);
return record;
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
index 3b52ecb..3961d0c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
@@ -18,6 +18,9 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationComparisonView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDatasource;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
@@ -68,7 +71,7 @@ public class ConfigurationHistoryView extends VLayout {
/**
* Resource list filtered by a given criteria
*/
- public ConfigurationHistoryView(Criteria criteria) {
+ public ConfigurationHistoryView(final Criteria criteria) {
setWidth100();
setHeight100();
@@ -86,6 +89,14 @@ public class ConfigurationHistoryView extends VLayout {
listGrid.setAlternateRecordStyles(true);
listGrid.setUseAllDataSourceFields(true);
+
+ ListGridField idField = new ListGridField("id","ID",60);
+ ListGridField createdField = new ListGridField("createdTime","Timestamp",200);
+ ListGridField statusField = new ListGridField("status","Status",100);
+ ListGridField userField = new ListGridField("subject","User",150);
+ listGrid.setFields(idField,createdField,statusField,userField);
+
+
if (criteria != null) {
listGrid.setInitialCriteria(criteria);
}
@@ -117,10 +128,30 @@ public class ConfigurationHistoryView extends VLayout {
});
+ final IButton compareButton = new IButton("Compare");
+ compareButton.setDisabled(true);
+ compareButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ int resourceId = Integer.parseInt((String)criteria.getValues().get("resourceId"));
+
+ ListGridRecord[] selection = listGrid.getSelection();
+ ArrayList<ResourceConfigurationUpdate> configs = new ArrayList<ResourceConfigurationUpdate>();
+ for (ListGridRecord record : selection) {
+ ResourceConfigurationUpdate update = (ResourceConfigurationUpdate) record.getAttributeAsObject("entity");
+ configs.add(update);
+ }
+
+
+ ConfigurationComparisonView.displayComparisonDialog(configs);
+ }
+ });
+
+
final Label tableInfo = new Label("Total: " + listGrid.getTotalRows());
tableInfo.setWrap(false);
toolStrip.addMember(removeButton);
+ toolStrip.addMember(compareButton);
toolStrip.addMember(new LayoutSpacer());
toolStrip.addMember(tableInfo);
@@ -132,6 +163,7 @@ public class ConfigurationHistoryView extends VLayout {
int selectedCount = ((ListGrid) selectionEvent.getSource()).getSelection().length;
tableInfo.setContents("Total: " + listGrid.getTotalRows() + " (" + selectedCount + " selected)");
removeButton.setDisabled(selectedCount == 0);
+ compareButton.setDisabled(selectedCount == 0);
}
});
commit a5a1e55f8e41bd210c1bb87ee35f5b8e396f45a6
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Thu Mar 4 17:15:14 2010 -0500
Prettier breadcrumb
Mocked up search bar
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadcrumbTrailPane.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadcrumbTrailPane.java
index a206c88..377a3fa 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadcrumbTrailPane.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadcrumbTrailPane.java
@@ -39,7 +39,7 @@ public class BreadcrumbTrailPane extends HTMLPane {
public BreadcrumbTrailPane() {
setHeight(28);
setBackgroundColor("#E6E3E3");
- setBackgroundImage("[skin]images/ToolStrip/background.png");
+ setBackgroundImage("[skin]images/SectionHeader/header_opened_stretch.png"); //ToolStrip/background.png");
setBackgroundRepeat(BkgndRepeat.REPEAT_X);
setPadding(5);
setOverflow(Overflow.CLIP_V);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/SearchBarPane.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/SearchBarPane.java
index 2cd3d35..d69fdf3 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/SearchBarPane.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/SearchBarPane.java
@@ -19,7 +19,10 @@
package org.rhq.enterprise.gui.coregui.client.menu;
import com.google.gwt.user.client.ui.TextBox;
+import com.smartgwt.client.types.FormLayoutType;
+import com.smartgwt.client.widgets.Window;
import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.ButtonItem;
import com.smartgwt.client.widgets.form.fields.SelectItem;
import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.layout.HLayout;
@@ -46,8 +49,9 @@ public class SearchBarPane extends HLayout {
super.onInit();
DynamicForm form = new DynamicForm();
- form.setNumCols(3);
- form.setWidth100();
+ form.setNumCols(4);
+ form.setItemLayout(FormLayoutType.ABSOLUTE);
+// form.setWidth100();
LinkedHashMap<String, String> values = new LinkedHashMap<String, String>();
@@ -59,14 +63,21 @@ public class SearchBarPane extends HLayout {
values.put("Roles", "Roles");
SelectItem searchType = new SelectItem("searchType", "Search");
+ searchType.setWidth(150);
searchType.setValueMap(values);
TextItem query = new TextItem("query");
- query.setWidth("100%");
+ query.setLeft(210);
+ query.setWidth(400);
query.setShowTitle(false);
- form.setItems(searchType, query);
+ ButtonItem search = new ButtonItem("Search", "Search");
+ search.setLeft(620);
+ search.setIcon(Window.getImgURL("[SKIN]/actions/view.png"));
+
+
+ form.setItems(searchType, query, search);
addMember(form);
}
commit 313cdd5047b3c22eef45ce525d016de6b2938da1
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Thu Mar 4 17:14:27 2010 -0500
Tab/SubTab system further implemented and hooked into history for the ResourceDetailView
ResourceTree fixes
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
index 204bcfb..c5aba88 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
@@ -18,6 +18,8 @@
*/
package org.rhq.enterprise.gui.coregui.client.components.tab;
+import com.google.gwt.event.shared.HandlerManager;
+import com.google.gwt.event.shared.HandlerRegistration;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.types.SelectionType;
import com.smartgwt.client.widgets.Button;
@@ -25,6 +27,7 @@ import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.layout.VLayout;
+import com.smartgwt.client.widgets.tab.events.TabSelectedEvent;
import com.smartgwt.client.widgets.toolbar.ToolStrip;
import java.util.LinkedHashMap;
@@ -71,6 +74,7 @@ public class SubTabLayout extends VLayout {
for (final String title : subtabs.keySet()) {
if (currentlyDisplayed == null) {
currentlyDisplayed = subtabs.get(title);
+ currentlySelected = title;
}
@@ -92,6 +96,7 @@ public class SubTabLayout extends VLayout {
public void onClick(ClickEvent clickEvent) {
currentlySelected = title;
currentIndex = index;
+ fireSubTabSelection();
draw(subtabs.get(title));
}
});
@@ -101,11 +106,7 @@ public class SubTabLayout extends VLayout {
}
// Initial settings
- Button b = (Button) buttonBar.getMember(0);
- b.select();
- if (currentlyDisplayed != null) {
- addMember(currentlyDisplayed);
- }
+ selectTab(currentlySelected);
}
public void updateSubTab(String title, Canvas canvas) {
@@ -146,4 +147,47 @@ public class SubTabLayout extends VLayout {
public int getCurrentIndex() {
return currentIndex;
}
+
+
+
+ public void selectTab(String title) {
+ currentlySelected = title;
+ int i = 0;
+ for (String sub : subtabs.keySet()) {
+ if (sub.equals(title)) {
+ currentIndex = i;
+ break;
+ }
+ i++;
+ }
+
+
+ if (isDrawn()) {
+ ((Button)buttonBar.getMember(currentIndex)).select();
+ draw(subtabs.get(title));
+ }
+ }
+
+
+
+
+ // ------- Event support -------
+ // Done with a separate handler manager from parent class on purpose (compatibility issue)
+
+ private HandlerManager hm = new HandlerManager(this);
+
+ public HandlerRegistration addTwoLevelTabSelectedHandler(TwoLevelTabSelectedHandler handler) {
+ return hm.addHandler(TwoLevelTabSelectedEvent.TYPE, handler);
+ }
+
+ public void fireSubTabSelection() {
+ TwoLevelTabSelectedEvent event = new TwoLevelTabSelectedEvent(
+ "?",
+ currentlySelected,
+ -1,
+ currentIndex,
+ currentlyDisplayed
+ );
+ hm.fireEvent(event);
+ }
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java
index 7a44277..9f9e5d4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java
@@ -45,8 +45,15 @@ public class TwoLevelTab extends Tab {
}
}
+ public SubTabLayout getLayout() {
+ return layout;
+ }
+
@Override
public Canvas getPane() {
return layout;
}
+
+
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSelectedEvent.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSelectedEvent.java
new file mode 100644
index 0000000..374c049
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSelectedEvent.java
@@ -0,0 +1,101 @@
+/*
+ * 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.tab;
+
+import com.google.gwt.event.shared.EventHandler;
+import com.google.gwt.event.shared.GwtEvent;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.tab.Tab;
+
+/**
+ * @author Greg Hinkle
+ */
+public class TwoLevelTabSelectedEvent extends GwtEvent<TwoLevelTabSelectedHandler> {
+
+ public static final GwtEvent.Type<TwoLevelTabSelectedHandler> TYPE = new Type<TwoLevelTabSelectedHandler>();
+
+ String id;
+ String subTabId;
+
+ int tabNum;
+ int subTabNum;
+
+ Canvas subTabPane;
+
+ public TwoLevelTabSelectedEvent(String id, String subTabId, int tabNum, int subTabNum, Canvas subTabPane) {
+ this.id = id;
+ this.subTabId = subTabId;
+ this.tabNum = tabNum;
+ this.subTabNum = subTabNum;
+ this.subTabPane = subTabPane;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getSubTabId() {
+ return subTabId;
+ }
+
+ public void setSubTabId(String subTabId) {
+ this.subTabId = subTabId;
+ }
+
+ public int getTabNum() {
+ return tabNum;
+ }
+
+ public void setTabNum(int tabNum) {
+ this.tabNum = tabNum;
+ }
+
+ public int getSubTabNum() {
+ return subTabNum;
+ }
+
+ public void setSubTabNum(int subTabNum) {
+ this.subTabNum = subTabNum;
+ }
+
+ public Canvas getSubTabPane() {
+ return subTabPane;
+ }
+
+ public void setSubTabPane(Canvas subTabPane) {
+ this.subTabPane = subTabPane;
+ }
+
+
+ @Override
+ public Type<TwoLevelTabSelectedHandler> getAssociatedType() {
+ return TYPE;
+ }
+
+ @Override
+ protected void dispatch(TwoLevelTabSelectedHandler handler) {
+ handler.onTabSelected(this);
+ }
+
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSelectedHandler.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSelectedHandler.java
new file mode 100644
index 0000000..85c0c3e
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSelectedHandler.java
@@ -0,0 +1,28 @@
+/*
+ * 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.tab;
+
+/**
+ * @author Greg Hinkle
+ */
+public interface TwoLevelTabSelectedHandler extends com.google.gwt.event.shared.EventHandler {
+
+ void onTabSelected(TwoLevelTabSelectedEvent tabSelectedEvent);
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java
index ba48226..a8bc6cd 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java
@@ -18,26 +18,67 @@
*/
package org.rhq.enterprise.gui.coregui.client.components.tab;
+import com.google.gwt.event.shared.DefaultHandlerRegistration;
+import com.google.gwt.event.shared.HandlerManager;
+import com.google.gwt.event.shared.HandlerRegistration;
import com.smartgwt.client.widgets.tab.Tab;
import com.smartgwt.client.widgets.tab.TabSet;
+import com.smartgwt.client.widgets.tab.events.TabSelectedEvent;
+import com.smartgwt.client.widgets.tab.events.TabSelectedHandler;
+
+import java.util.ArrayList;
/**
* @author Greg Hinkle
*/
-public class TwoLevelTabSet extends TabSet {
+public class TwoLevelTabSet extends TabSet implements TabSelectedHandler, TwoLevelTabSelectedHandler {
- @Override
- public void setTabs(Tab... tabs) {
- super.setTabs(tabs);
- for (Tab tab : tabs) {
- TwoLevelTab tltab = (TwoLevelTab) tab;
+ public void setTabs(TwoLevelTab... tabs) {
+ super.setTabs(tabs);
+ for (TwoLevelTab tab : tabs) {
- updateTab(tab,tltab.getPane());
+ tab.getLayout().addTwoLevelTabSelectedHandler(this);
+ updateTab(tab,tab.getPane());
}
+ addTabSelectedHandler(this);
+ }
+
+
+
+
+
+ // ------- Event support -------
+ // Done with a separate handler manager from parent class on purpose (compatibility issue)
+
+ private HandlerManager m = new HandlerManager(this);
+
+ public HandlerRegistration addTwoLevelTabSelectedHandler(TwoLevelTabSelectedHandler handler) {
+ return m.addHandler(TwoLevelTabSelectedEvent.TYPE,handler);
+ }
+
+ public void onTabSelected(TabSelectedEvent tabSelectedEvent) {
+
+ TwoLevelTab tab = (TwoLevelTab) getSelectedTab();
+
+ TwoLevelTabSelectedEvent event = new TwoLevelTabSelectedEvent(
+ getSelectedTab().getTitle(),
+ tab.getLayout().currentlySelected,
+ tabSelectedEvent.getTabNum(),
+ tab.getLayout().getCurrentIndex(),
+ tab.getLayout().currentlyDisplayed
+ );
+ m.fireEvent(event);
+ }
+
+ public void onTabSelected(TwoLevelTabSelectedEvent tabSelectedEvent) {
+ tabSelectedEvent.setTabNum(getSelectedTabNumber());
+ tabSelectedEvent.setId(getSelectedTab().getTitle());
+
+ m.fireEvent(tabSelectedEvent);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/CustomResourceTreeGrid.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/CustomResourceTreeGrid.java
index 178043d..6f73db8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/CustomResourceTreeGrid.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/CustomResourceTreeGrid.java
@@ -41,9 +41,12 @@ public class CustomResourceTreeGrid extends TreeGrid {
boolean up = resource.getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP;
+ if (resource.getResourceType().getChildResourceTypes() == null || resource.getResourceType().getChildResourceTypes().isEmpty()) {
+ return "resources/Service_" + (up ? "up" : "down") + "_16.png";
- return "resources/folder_" + (up ? "" : "down_") + (open ? "opened" : "closed") + ".png";
-
+ } else {
+ return "resources/folder_" + (up ? "" : "down_") + (open ? "opened" : "closed") + ".png";
+ }
} else {
return "resources/folder_group_" + (open ? "opened" : "closed") + ".png";
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index 834a74d..bfd6781 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -20,11 +20,18 @@ package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.enterprise.gui.coregui.client.Breadcrumb;
+import org.rhq.enterprise.gui.coregui.client.UnknownViewException;
+import org.rhq.enterprise.gui.coregui.client.View;
+import org.rhq.enterprise.gui.coregui.client.ViewId;
+import org.rhq.enterprise.gui.coregui.client.ViewRenderer;
import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
import org.rhq.enterprise.gui.coregui.client.components.SimpleCollapsiblePanel;
import org.rhq.enterprise.gui.coregui.client.components.SubTabLayout;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTab;
+import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSelectedEvent;
+import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSelectedHandler;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSet;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSearchView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
@@ -32,12 +39,15 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configura
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.GraphListView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+import com.google.gwt.user.client.History;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.types.Side;
import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.tab.Tab;
import com.smartgwt.client.widgets.tab.TabSet;
+import com.smartgwt.client.widgets.tab.events.TabSelectedEvent;
+import com.smartgwt.client.widgets.tab.events.TabSelectedHandler;
import java.util.EnumSet;
@@ -46,7 +56,7 @@ import java.util.EnumSet;
*
* @author Greg Hinkle
*/
-public class ResourceDetailView extends VLayout implements ResourceSelectListener {
+public class ResourceDetailView extends VLayout implements ViewRenderer, ResourceSelectListener, TwoLevelTabSelectedHandler {
private Resource resource;
@@ -66,6 +76,9 @@ public class ResourceDetailView extends VLayout implements ResourceSelectListene
private ResourceTitleBar titleBar;
+ private ViewId currentView;
+ private ViewId baseViewId;
+
public void setResource(Resource resource) {
this.resource = resource;
}
@@ -115,6 +128,8 @@ public class ResourceDetailView extends VLayout implements ResourceSelectListene
topTabSet.setTabs(summaryTab, monitoringTab, inventoryTab, operationsTab, alertsTab, configurationTab, eventsTab, contentTab);
+ topTabSet.addTwoLevelTabSelectedHandler(this);
+
titleBar = new ResourceTitleBar();
addMember(titleBar);
@@ -148,7 +163,7 @@ public class ResourceDetailView extends VLayout implements ResourceSelectListene
monitoringTab.updateSubTab("Availability", new FullHTMLPane("/rhq/resource/monitor/availabilityHistory.xhtml?id=" + resource.getId()));
monitoringTab.updateSubTab("Schedules", new FullHTMLPane("/rhq/resource/monitor/schedules.xhtml?id=" + resource.getId()));
-
+
inventoryTab.updateSubTab("Children", ResourceSearchView.getChildrenOf(resource.getId()));
inventoryTab.updateSubTab("Connection Settings", new ConfigurationEditor(resource.getId(), resource.getResourceType().getId(), ConfigurationEditor.ConfigType.plugin));
@@ -204,4 +219,58 @@ public class ResourceDetailView extends VLayout implements ResourceSelectListene
}
+ public void onTabSelected(TwoLevelTabSelectedEvent tabSelectedEvent) {
+ // TODO: Implement this method.
+
+ String tabPath = "/" + tabSelectedEvent.getId() + "/" + tabSelectedEvent.getSubTabId();
+
+
+// System.out.println("TAB: " + currentView.getPath() + tabPath);
+
+ if (resource != null) {
+ History.newItem("Resource/" + resource.getId() + tabPath, false);
+ }
+ }
+
+ public View renderView(ViewId viewId, boolean lastNode) throws UnknownViewException {
+
+ if (baseViewId == null) {
+ baseViewId = viewId;
+ }
+ currentView = viewId;
+
+ String[] parts = currentView.getPath().split("/");
+ Breadcrumb crumb = null;
+ if (parts.length >= 3) {
+ for (Tab t : topTabSet.getTabs()) {
+ TwoLevelTab tab = (TwoLevelTab) t;
+
+ if (tab.getTitle().equals(parts[2])) {
+
+ if (parts.length == 3) {
+ crumb = new Breadcrumb(parts[2], parts[2]);
+ }
+
+
+ if (parts.length >= 4) {
+ tab.getLayout().selectTab(parts[3]);
+
+ // Switch the top tab after the subtab to avoid an extra subtab render
+ topTabSet.selectTab(tab);
+
+
+ if (parts.length == 4) {
+ crumb = new Breadcrumb(parts[3], parts[3]);
+ }
+ }
+ }
+ }
+ }
+
+ if (crumb != null) {
+ return new View(viewId, crumb);
+ } else {
+ return new View(viewId);
+ }
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
index f1e4592..6bf2f18 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
@@ -47,6 +47,8 @@ import java.util.HashMap;
import java.util.List;
/**
+ * This doesn't extend RPCDataSource because it is tree oriented and
+ * behaves different from normal list data sources in some places.
* @author Greg Hinkle
*/
public class ResourceTreeDatasource extends DataSource {
@@ -276,19 +278,10 @@ public class ResourceTreeDatasource extends DataSource {
? "/images/icons/availability_green_16.png"
: "/images/icons/availability_red_16.png");
+ setIsFolder((resource.getResourceType().getChildResourceTypes() != null &&
+ !resource.getResourceType().getChildResourceTypes().isEmpty()));
}
- @Override
- public String getIcon() {
-
- boolean up = resource.getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP;
-
- // (open ? "opened" : "closed") +
-
- return "resources/folder_" + (up ? "" : "down_") + ".png";
- }
-
-
public Resource getResource() {
return resource;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
index fb13013..8edf449 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
@@ -135,10 +135,16 @@ public class ResourceTreeView extends VLayout {
if (treeGrid.getSelectedRecord() instanceof ResourceTreeDatasource.ResourceTreeNode) {
ResourceTreeDatasource.ResourceTreeNode node = (ResourceTreeDatasource.ResourceTreeNode) treeGrid.getSelectedRecord();
System.out.println("Resource selected in tree: " + node.getResource());
- History.newItem("Resource/" + node.getResource().getId());
-// for (ResourceSelectListener l : selectListeners) {
-// l.onResourceSelected(node.getResource());
-// }
+
+ String newToken = "Resource/" + node.getResource().getId();
+ String currentToken = History.getToken();
+ if (!currentToken.startsWith(newToken)) {
+
+ String ending = currentToken.replaceFirst("^[^\\/]*\\/[^\\/]*","");
+
+ History.newItem("Resource/" + node.getResource().getId() + ending);
+
+ }
}
}
@@ -340,9 +346,17 @@ public class ResourceTreeView extends VLayout {
System.out.println("Trying to preopen: " + selectedNode);
if (selectedNode != null) {
System.out.println("Preopen node!!!");
- treeGrid.getTree().openFolders(treeGrid.getTree().getParents(selectedNode));
+ TreeNode[] parents = treeGrid.getTree().getParents(selectedNode);
+ treeGrid.getTree().openFolders(parents);
+ treeGrid.getTree().openFolder(selectedNode);
+
+ for (TreeNode p : parents) {
+ System.out.println("open? " + treeGrid.getTree().isOpen(p) + " node: " + p);
+ }
+
treeGrid.selectRecord(selectedNode);
initialSelect = true;
+ treeGrid.markForRedraw();
}
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
index 651914f..1b808f5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
@@ -47,7 +47,7 @@ public class ResourceView extends HLayout implements ViewRenderer {
//private Resource resourcePlatform;
private ResourceTreeView treeView;
- private ResourceDetailView detailView;
+ private ResourceDetailView detailView = new ResourceDetailView();
private ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();
@@ -77,7 +77,8 @@ public class ResourceView extends HLayout implements ViewRenderer {
addMember(contentCanvas);
- detailView = new ResourceDetailView();
+ // created above
+// detailView = new ResourceDetailView();
treeView.addResourceSelectListener(detailView);
@@ -147,6 +148,9 @@ public class ResourceView extends HLayout implements ViewRenderer {
// Use "..." as temporary display name for breadcrumb. If the Resource is fetched successfully, the display name
// will be updated to be the Resource's name.
Breadcrumb breadcrumb = new Breadcrumb(viewId.getName(), "...");
- return new View(viewId, breadcrumb);
+
+// detailView.renderView(viewId, lastNode);
+
+ return new View(viewId, detailView, breadcrumb);
}
}
commit facc29329de0c57c53f9d27da7710a4390e89bab
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Thu Mar 4 20:47:21 2010 -0500
fix more compile errors resulting from recent merge from master
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
index dc96f1b..b76527f 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
@@ -184,7 +184,7 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
+ "for the following Resource(s): " + forbiddenResources);
}
- deleteAlerts(alertIds);
+ deleteAlerts(user, alertIds);
}
public void deleteAlerts(Subject user, int resourceId, Integer[] ids) {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
index b04efa0..1f6d304 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
@@ -21,6 +21,7 @@ package org.rhq.enterprise.server.bundle;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Random;
@@ -59,7 +60,7 @@ import org.rhq.core.domain.criteria.BundleVersionCriteria;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.util.PageList;
-import org.rhq.core.domain.util.PersistenceUtility;
+import org.rhq.core.server.PersistenceUtility;
import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.authz.AuthorizationManagerLocal;
import org.rhq.enterprise.server.authz.PermissionException;
@@ -333,7 +334,7 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
throws Exception {
if (null == resourceIds || 0 == resourceIds.length) {
- throw new IllegalArgumentException("Invalid resourceIds: " + resourceIds);
+ throw new IllegalArgumentException("Invalid resourceIds: " + Arrays.toString(resourceIds));
}
BundleDeployDefinition deployDef = entityManager.find(BundleDeployDefinition.class, bundleDeployDefinitionId);
@@ -342,7 +343,7 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
}
Resource[] resources = new Resource[resourceIds.length];
for (int i = 0; (i < resourceIds.length); ++i) {
- resources[i] = (Resource) entityManager.find(Resource.class, resourceIds[i]);
+ resources[i] = entityManager.find(Resource.class, resourceIds[i]);
if (null == resources[i]) {
throw new IllegalArgumentException("Invalid resourceId (Resource does not exist): " + resources[i]);
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index a47a3b8..91dc303 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -58,6 +58,7 @@ import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
import org.rhq.core.domain.configuration.PluginConfigurationUpdate;
import org.rhq.core.domain.configuration.Property;
+import org.rhq.core.domain.configuration.RawConfiguration;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
import org.rhq.core.domain.configuration.composite.ConfigurationUpdateComposite;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
commit e82c39e718bc6b639e0b0cfdf1ee9723c8634492
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Thu Mar 4 20:41:43 2010 -0500
fix a few compile errors resulting from recent merge from master
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java b/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java
index b8ca4df..b562d38 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java
@@ -22,7 +22,6 @@
*/
package org.rhq.core.domain.auth;
-import org.rhq.core.domain.alert.notification.SubjectNotification;
import org.rhq.core.domain.authz.Role;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.util.Recordizable;
@@ -40,7 +39,6 @@ import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
-import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.QueryHint;
import javax.persistence.SequenceGenerator;
@@ -53,7 +51,6 @@ import java.util.Set;
/**
* @author Greg Hinkle
- *
*/
@Entity
@NamedQueries( {
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleCriteria.java
index aed446a..f38cfad 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleCriteria.java
@@ -16,7 +16,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
package org.rhq.core.domain.criteria;
import javax.xml.bind.annotation.XmlAccessType;
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java
index cbbdcaf..da8476a 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java
@@ -16,7 +16,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
package org.rhq.core.domain.criteria;
import javax.xml.bind.annotation.XmlAccessType;
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
index cd83770..e19b022 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
@@ -41,13 +41,14 @@ import java.util.Map;
*/
@XmlAccessorType(XmlAccessType.FIELD)
public abstract class Criteria implements Serializable {
-
public enum Type {
- FILTER, FETCH, SORT;
+ FILTER, FETCH, SORT
}
private static final long serialVersionUID = 1L;
+ private Class<?> persistentClass;
+
private Integer pageNumber;
private Integer pageSize;
@@ -69,10 +70,12 @@ public abstract class Criteria implements Serializable {
}
public Criteria(Class<?> persistentClass) {
- filterOverrides = new HashMap<String, String>();
- sortOverrides = new HashMap<String, String>();
+ this.persistentClass = persistentClass;
- orderingFieldNames = new ArrayList<String>();
+ this.filterOverrides = new HashMap<String, String>();
+ this.sortOverrides = new HashMap<String, String>();
+
+ this.orderingFieldNames = new ArrayList<String>();
/*
* reasonably large default, but prevent accidentally returning 100K objects
@@ -81,7 +84,9 @@ public abstract class Criteria implements Serializable {
setPaging(0, 200);
}
- public abstract Class getPersistentClass();
+ public Class<?> getPersistentClass() {
+ return persistentClass;
+ }
public Integer getPageNumber() {
return pageNumber;
commit 611382fcaddab145244abfa17f744768266f895d
Merge: a9c0525... aa66cbc...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Mar 4 16:50:53 2010 -0500
Merge branch 'master' into gwt
commit a9c05259b5cbbe828400293ab7df9c13a56c9f40
Merge: 1a83f4f... 5b305e0...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Mar 4 16:40:07 2010 -0500
Merge branch 'master' into gwt
commit 1a83f4f27b025643cadd443036d69d1b1d87159b
Merge: 734e126... 3b99cb5...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Mar 4 16:38:01 2010 -0500
Merge branch 'master' into gwt - this also pulls in the bundle stuff
Conflicts:
modules/core/domain/src/main/java/org/rhq/core/domain/alert/Alert.java
modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/RoleNotification.java
modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/SubjectNotification.java
modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java
modules/core/domain/src/main/java/org/rhq/core/domain/authz/Role.java
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
modules/enterprise/gui/portal-war/pom.xml
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/resource/ResourceTreeModelUIBean.java
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/subsystem/SubsystemAlertHistoryUIBean.java
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertNotificationManagerBean.java
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryRunner.java
diff --cc modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java
index 99f7d92,f13d6ef..b8ca4df
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java
@@@ -527,6 -490,6 +488,6 @@@ public class Subject implements Seriali
this.configuration = (Configuration) in.readObject();
this.roles = (Set<Role>) in.readObject();
this.sessionId = in.readInt();
- }
+ }*/
--}
++}
diff --cc modules/core/domain/src/main/java/org/rhq/core/domain/authz/Role.java
index 039f356,35772bd..b052763
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/authz/Role.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/authz/Role.java
@@@ -134,10 -118,7 +118,7 @@@ public class Role implements Serializab
@JoinTable(name = "RHQ_PERMISSION", joinColumns = @JoinColumn(name = "ROLE_ID"))
private Set<Permission> permissions = new HashSet<Permission>();
- @OneToMany(mappedBy = "role", cascade = javax.persistence.CascadeType.ALL)
- private Set<RoleNotification> roleNotifications = new HashSet<RoleNotification>();
-
- protected Role() {
+ public Role() {
fsystem = Boolean.FALSE;
}
@@@ -297,4 -266,4 +266,4 @@@
public int hashCode() {
return name.hashCode();
}
--}
++}
diff --cc modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java
index b7151ba,d016f50..42b2a88
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java
@@@ -85,11 -86,14 +86,19 @@@ public class RawConfiguration implement
@JoinColumn(name = "CONFIG_ID", nullable = false)
private Configuration configuration;
+
+ public RawConfiguration() {
+
+ }
+
+ /**
+ * THis value is not persisted to the database, but is
+ * set when validation indicates that there is a problem
+ * with the file structure.
+ */
+ @Transient
+ public String errorMessage;
+
/** @return The database identifier or primary key */
public int getId() {
return id;
@@@ -122,6 -126,14 +131,7 @@@
*/
public void setContents(String contents) {
this.contents = contents;
+ this.errorMessage = null;
- updateSha256();
- }
-
- private void updateSha256() {
- MessageDigestGenerator sha256Generator = new MessageDigestGenerator("SHA-256");
- sha256Generator.add(contents.getBytes());
- sha256 = sha256Generator.getDigestString();
}
/**
diff --cc modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
index 75c32dc,dd943e0..cd83770
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
@@@ -195,15 -259,44 +195,12 @@@ public abstract class Criteria implemen
this.requiredPermissions = Arrays.asList(requiredPermissions);
}
-
-
-
- public PageControl getPageControl() {
- PageControl pc = null;
-
- if (pageControlOverrides != null) {
- pc = pageControlOverrides;
- } else {
- if (pageNumber == null || pageSize == null) {
- pc = PageControl.getUnlimitedInstance();
- } else {
- pc = new PageControl(pageNumber, pageSize);
- }
- for (String fieldName : orderingFieldNames) {
- for (Field sortField : getFields(Type.SORT)) {
- if (sortField.getName().equals(fieldName) == false) {
- continue;
- }
- Object sortFieldValue = null;
- try {
- sortFieldValue = sortField.get(this);
- } catch (IllegalAccessException iae) {
- throw new RuntimeException(iae);
- }
- if (sortFieldValue != null) {
- PageOrdering pageOrdering = (PageOrdering) sortFieldValue;
- pc.addDefaultOrderingField(getCleansedFieldName(sortField, 4), pageOrdering);
- }
- }
- }
+ public String getAlias() {
+ if (this.alias == null) {
+ // Base alias on persistent class's name: org.rhq.core.domain.ResourceType -> "resourcetype"
+ String classSimpleName = GwtClientUtility.getSimpleName(getPersistentClass());
+ this.alias = classSimpleName.toLowerCase();
}
- if (LOG.isDebugEnabled()) {
- LOG.debug("Page Control: " + pc);
- }
- return pc;
- }
-
- private String getCleansedFieldName(Field field, int leadingCharsToStrip) {
- String fieldNameFragment = field.getName().substring(leadingCharsToStrip);
- String fieldName = Character.toLowerCase(fieldNameFragment.charAt(0)) + fieldNameFragment.substring(1);
- return fieldName;
+ return this.alias;
}
}
diff --cc modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
index a208829,c074969..32e16b7
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/Resource.java
@@@ -720,10 -726,11 +720,11 @@@ import org.rhq.core.domain.util.Summary
})
@SequenceGenerator(name = "RHQ_RESOURCE_SEQ", sequenceName = "RHQ_RESOURCE_ID_SEQ")
- @Table(name = "RHQ_RESOURCE")
+ @Table(name = Resource.TABLE_NAME)
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement
-public class Resource implements Comparable<Resource>, Externalizable {
+public class Resource implements Comparable<Resource>, Serializable {
+ public static final String TABLE_NAME = "RHQ_RESOURCE";
public static final String QUERY_FIND_PROBLEM_RESOURCES_ALERT = "Resource.findProblemResourcesAlert";
public static final String QUERY_FIND_PROBLEM_RESOURCES_ALERT_ADMIN = "Resource.findProblemResourcesAlert_admin";
public static final String QUERY_FIND_PROBLEM_RESOURCES_ALERT_COUNT = "Resource.findProblemResourcesAlertCount";
@@@ -1011,8 -1099,11 +1093,11 @@@
@ManyToOne(fetch = FetchType.LAZY)
private ProductVersion productVersion;
+ // @OneToMany(mappedBy = "resource", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
+ // private List<BundleDeployment> deployments = new ArrayList<BundleDeployment>();
+
public Resource() {
- this.uuid = UUID.randomUUID().toString();
+
}
/**
diff --cc modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
index dd9f65a,69e8175..9a779ba
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
@@@ -22,12 -22,15 +22,16 @@@
*/
package org.rhq.core.domain.resource;
- import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
- import org.rhq.core.domain.content.PackageType;
- import org.rhq.core.domain.event.EventDefinition;
- import org.rhq.core.domain.measurement.MeasurementDefinition;
- import org.rhq.core.domain.operation.OperationDefinition;
- import org.rhq.core.domain.util.Summary;
+ import java.io.Externalizable;
+ import java.io.IOException;
+ import java.io.ObjectInput;
+ import java.io.ObjectOutput;
++import java.io.Serializable;
+ import java.util.ArrayList;
+ import java.util.HashSet;
+ import java.util.LinkedHashSet;
+ import java.util.List;
+ import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
@@@ -58,18 -62,15 +63,13 @@@ import javax.persistence.Table
import javax.persistence.Transient;
import javax.xml.bind.annotation.XmlTransient;
- import java.io.Externalizable;
- import java.io.IOException;
- import java.io.ObjectInput;
- import java.io.ObjectInputStream;
- import java.io.ObjectOutput;
- import java.io.ObjectOutputStream;
- import java.io.Serializable;
- import java.util.ArrayList;
- import java.util.HashSet;
- import java.util.LinkedHashSet;
- import java.util.List;
- import java.util.Set;
+ import org.rhq.core.domain.bundle.BundleType;
+ import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+ import org.rhq.core.domain.content.PackageType;
+ import org.rhq.core.domain.event.EventDefinition;
+ import org.rhq.core.domain.measurement.MeasurementDefinition;
+ import org.rhq.core.domain.operation.OperationDefinition;
-import org.rhq.core.domain.util.EntitySerializer;
+ import org.rhq.core.domain.util.Summary;
-import org.rhq.core.domain.util.serial.ExternalizableStrategy;
/**
* Defines a type of {@link Resource} (e.g. a Linux platform, a JBossAS server, or a Datasource service).
@@@ -234,12 -235,14 +234,14 @@@
+ "FROM RHQ_resource_type_parents rtp2 "
+ "WHERE rtp2.resource_type_id = crt2.id) " + "AND crt2.category = ? " +
// "ORDER BY crt2.name" +
- ")) ORDER BY name", resultSetMapping = ResourceType.MAPPING_FIND_CHILDREN_BY_CATEGORY)
- })
+ ")) ORDER BY name", resultSetMapping = ResourceType.MAPPING_FIND_CHILDREN_BY_CATEGORY) //
+ })
@SqlResultSetMapping(name = ResourceType.MAPPING_FIND_CHILDREN_BY_CATEGORY, entities = { @EntityResult(entityClass = ResourceType.class) })
// @Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
-public class ResourceType implements Externalizable, Comparable<ResourceType> {
+public class ResourceType implements Serializable, Comparable<ResourceType> {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 2L;
+
+ public static final String TABLE_NAME = "RHQ_RESOURCE_TYPE";
public static final ResourceType ANY_PLATFORM_TYPE = null;
diff --cc modules/core/domain/src/main/java/org/rhq/core/server/PersistenceUtility.java
index 0580b59,0000000..65fb192
mode 100644,000000..100644
--- a/modules/core/domain/src/main/java/org/rhq/core/server/PersistenceUtility.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/server/PersistenceUtility.java
@@@ -1,512 -1,0 +1,602 @@@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.core.server;
+
+import org.rhq.core.domain.util.OrderingField;
+import org.rhq.core.domain.util.PageControl;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.core.domain.util.PageOrdering;
+
++import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.management.InstanceAlreadyExistsException;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.ObjectName;
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.ejb.EntityManagerImpl;
+import org.hibernate.engine.NamedQueryDefinition;
+import org.hibernate.engine.SessionFactoryImplementor;
+import org.hibernate.jmx.StatisticsService;
+import org.hibernate.stat.Statistics;
++import org.hibernate.type.CustomType;
++import org.hibernate.type.EntityType;
++import org.hibernate.type.PrimitiveType;
++import org.hibernate.type.Type;
+
+/**
+ * Various persistence utility methods - mostly Hibernate-specific.
+ *
+ * @author Heiko Rupp
++ * @author Joseph Marques
+ * @author Greg Hinkle
+ */
+public class PersistenceUtility {
+ private static final Log LOG = LogFactory.getLog(PersistenceUtility.class);
+
+ private static final Pattern COUNT_QUERY_PATTERN = Pattern.compile("^(\\s*SELECT\\s+)(.*?)(\\s+FROM.*)",
+ Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
+ private static final Pattern COUNT_QUERY_REMOVE_FETCH = Pattern.compile("FETCH", Pattern.CASE_INSENSITIVE
+ | Pattern.MULTILINE | Pattern.DOTALL);
+
+ public static final String HIBERNATE_STATISTICS_MBEAN_OBJECTNAME = "Hibernate:type=statistics,application=RHQ";
+
++ public static String getDisplayString(Type hibernateType) {
++ if (hibernateType instanceof EntityType) {
++ return hibernateType.getName() + " (enter integer of ID / primary key field)";
++ } else if (hibernateType instanceof CustomType) {
++ if (Enum.class.isAssignableFrom(hibernateType.getReturnedClass())) {
++ Class<? extends Enum<?>> enumClass = hibernateType.getReturnedClass();
++ StringBuilder result = new StringBuilder();
++ result.append(enumClass.getName());
++ result.append(" (");
++ boolean first = true;
++ for (Enum<?> nextEnum : enumClass.getEnumConstants()) {
++ if (!first) {
++ result.append(" | ");
++ } else {
++ first = false;
++ }
++ result.append(nextEnum.name());
++ }
++ result.append(")");
++ return result.toString();
++ }
++ }
++ return hibernateType.getName();
++ }
++
++ @SuppressWarnings("unchecked")
++ public static Object cast(String value, Type hibernateType) {
++ if (hibernateType instanceof PrimitiveType) {
++ Class<?> type = ((PrimitiveType) hibernateType).getPrimitiveClass();
++ if (type.equals(Byte.TYPE)) {
++ return Byte.valueOf(value);
++ } else if (type.equals(Short.TYPE)) {
++ return Short.valueOf(value);
++ } else if (type.equals(Integer.TYPE)) {
++ return Integer.valueOf(value);
++ } else if (type.equals(Long.TYPE)) {
++ return Long.valueOf(value);
++ } else if (type.equals(Float.TYPE)) {
++ return Float.valueOf(value);
++ } else if (type.equals(Double.TYPE)) {
++ return Double.valueOf(value);
++ } else if (type.equals(Boolean.TYPE)) {
++ return Boolean.valueOf(value);
++ }
++ } else if (hibernateType instanceof EntityType) {
++ String entityName = ((EntityType) hibernateType).getAssociatedEntityName();
++ try {
++ Class<?> entityClass = Class.forName(entityName);
++ Object entity = entityClass.newInstance();
++
++ Field primaryKeyField = entityClass.getDeclaredField("id");
++ primaryKeyField.setAccessible(true);
++ primaryKeyField.setInt(entity, Integer.valueOf(value));
++ return entity;
++ } catch (Throwable t) {
++ throw new IllegalArgumentException("Type[" + entityName + "] must have PK field named 'id'");
++ }
++ } else if (hibernateType instanceof CustomType) {
++ if (Enum.class.isAssignableFrom(hibernateType.getReturnedClass())) {
++ Class<? extends Enum<?>> enumClass = hibernateType.getReturnedClass();
++ Enum<?>[] enumValues = enumClass.getEnumConstants();
++ try {
++ int enumOrdinal = Integer.valueOf(value);
++ try {
++ return enumValues[enumOrdinal];
++ } catch (ArrayIndexOutOfBoundsException aioobe) {
++ throw new IllegalArgumentException("There is no " + enumClass.getSimpleName()
++ + " enum with ordinal '" + enumOrdinal + "'");
++ }
++ } catch (NumberFormatException nfe) {
++ String ucaseValue = value.toUpperCase();
++ for (Enum<?> nextEnum : enumValues) {
++ if (nextEnum.name().toUpperCase().equals(ucaseValue)) {
++ return nextEnum;
++ }
++ }
++ throw new IllegalArgumentException("There is no " + enumClass.getSimpleName() + " enum with name '"
++ + value + "'");
++ }
++ }
++ }
++ return value;
++ }
++
+ /**
+ * Used to create queries to use with the {@link org.rhq.core.domain.util.PageControl} objects. The query will already have its sort column
+ * and order appended as well as having its first result and max results set according to the page control data.
+ *
+ * @param entityManager your entity manager
+ * @param queryName name of the query
+ * @param pageControl the controls on the paging and sorting
+ *
+ * @return a preconfigured query for ordered pagination
+ */
+ public static Query createQueryWithOrderBy(EntityManager entityManager, String queryName, PageControl pageControl) {
+ Query query;
+
+ if (pageControl.getPrimarySortColumn() != null) {
+ query = createQueryWithOrderBy(entityManager, queryName, pageControl.getOrderingFieldsAsArray());
+ } else {
+ StackTraceElement caller = new Throwable().fillInStackTrace().getStackTrace()[1];
+ LOG.warn("Queries should really supply default sort columns. Caller did not: " + caller);
+
+ // Use the standard named query if no sorting is specified
+ query = entityManager.createNamedQuery(queryName);
+ }
+
+ setDataPage(query, pageControl);
+
+ return query;
+ }
+
+ /**
+ * Create a query from a named query with a transformed order by clause with multiple new ordery by clauses.
+ *
+ * @param entityManager the entity manager to build the query against
+ * @param queryName the name of the query to transform
+ * @param orderByFields an array of clauses to contribute to the order by
+ *
+ * @return the transformed query
+ */
+ public static Query createQueryWithOrderBy(EntityManager entityManager, String queryName,
+ OrderingField... orderByFields) {
+ NamedQueryDefinition ndc = getNamedQueryDefinition(entityManager, queryName);
+ StringBuilder query = new StringBuilder(ndc.getQueryString());
+ buildOrderBy(query, orderByFields);
+ return entityManager.createQuery(query.toString());
+ }
+
+ public static Query createNonNamedQueryWithOrderBy(EntityManager entityManager, String queryText,
+ PageControl pageControl) {
+ Query query;
+
+ if (pageControl.getPrimarySortColumn() != null) {
+ query = createNonNamedQueryWithOrderBy(entityManager, queryText, pageControl.getOrderingFieldsAsArray());
+ } else {
+ StackTraceElement caller = new Throwable().fillInStackTrace().getStackTrace()[1];
+ LOG.warn("Queries should really supply default sort columns. Caller did not: " + caller);
+
+ // Use the standard named query if no sorting is specified
+ query = entityManager.createQuery(queryText);
+ }
+
+ setDataPage(query, pageControl);
+
+ return query;
+ }
+
+ public static Query createNonNamedQueryWithOrderBy(EntityManager entityManager, String queryText,
+ OrderingField... orderByFields) {
+
+ StringBuilder query = new StringBuilder(queryText);
+ buildOrderBy(query, orderByFields);
+ return entityManager.createQuery(query.toString());
+ }
+
+ private static StringBuilder buildOrderBy(StringBuilder query, OrderingField... orderByFields) {
+ boolean first = true;
+ for (OrderingField orderingField : orderByFields) {
+ if (first) {
+ // TODO GH: We could see if there already is an order by clause and contribute or override it
+ query.append(" ORDER BY ");
+ first = false;
+ } else {
+ query.append(", ");
+ }
+
+ query.append(orderingField.getField()).append(" ").append(orderingField.getOrdering());
+ }
+
+ return query;
+ }
+
+ private static String getOrderByFragment(OrderingField... orderByFields) {
+ boolean first = true;
+ StringBuilder builder = new StringBuilder();
+ for (OrderingField orderingField : orderByFields) {
+ if (first) {
+ builder.append(" ORDER BY ");
+ first = false;
+ } else {
+ builder.append(", ");
+ }
+
+ builder.append(orderingField.getField()).append(" ").append(orderingField.getOrdering());
+ }
+
+ return builder.toString();
+ }
+
+ /**
+ * Builds a count(*) version of the named query so we don't have duplicate all our queries to use two query
+ * pagination model.
+ *
+ * @param em the entity manager to build the query for
+ * @param queryName the NamedQuery to transform
+ *
+ * @return a query that can be bound and executed to get the total count of results
+ */
+ public static Query createCountQuery(EntityManager em, String queryName) {
+ return createCountQuery(em, queryName, "*");
+ }
+
+ /**
+ * Builds a count(*) version of the named query so we don't have duplicate all our queries to use two query
+ * pagination model.
+ *
+ * @param entityManager the entity manager to build the query for
+ * @param queryName the NamedQuery to transform
+ * @param countItem the object or attribute that needs to be counted, when it's ambiguous
+ *
+ * @return a query that can be bound and executed to get the total count of results
+ */
+ public static Query createCountQuery(EntityManager entityManager, String queryName, String countItem) {
+ NamedQueryDefinition namedQueryDefinition = getNamedQueryDefinition(entityManager, queryName);
+ String query = namedQueryDefinition.getQueryString();
+
+ Matcher matcher = COUNT_QUERY_PATTERN.matcher(query);
+ if (!matcher.find()) {
+ throw new RuntimeException("Unable to transform query into count query [" + queryName + " - " + query + "]");
+ }
+
+ String newQuery = matcher.group(1) + "COUNT(" + countItem + ")" + matcher.group(3);
+
+ matcher = COUNT_QUERY_REMOVE_FETCH.matcher(newQuery);
+ if (matcher.find()) {
+ StringBuffer buffer = new StringBuffer();
+ do {
+ matcher.appendReplacement(buffer, "");
+ } while (matcher.find());
+ matcher.appendTail(buffer);
+ newQuery = buffer.toString();
+ }
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Transformed query to count query [" + queryName + "] resulting in [" + newQuery + "]");
+ }
+
+ return entityManager.createQuery(newQuery);
+ }
+
+ public static void setDataPage(Query query, PageControl pageControl) {
+ if (pageControl.getPageSize() > 0) {
+ query.setFirstResult(pageControl.getStartRow());
+ query.setMaxResults(pageControl.getPageSize());
+ }
+ }
+
+ public static String formatSearchParameter(String value) {
+ if (value == null || value.trim().equals("")) {
+ return null;
+ }
+
+ return "%" + value.replaceAll("\\_", "\\\\_").toUpperCase() + "%";
+ }
+
+ /**
+ * Creates and executes a filter query for a collection relationship. This executes without passing back the query
+ * object because the most common case is to simply paginate for a relationship. Use the createFilter method to
+ * create more generic filters and get access to the hibernate query object for setting parameters etc.
+ *
+ * @param entityManager
+ * @param collection
+ * @param pageControl
+ *
+ * @return the result list of the entities from the filtered relationship
+ */
+ @SuppressWarnings("unchecked")
+ public static PageList createPaginationFilter(EntityManager entityManager, Collection collection,
+ PageControl pageControl) {
+ if (collection == null) {
+ return new PageList(pageControl);
+ }
+
+ String filter = "";
+ if (pageControl.getPrimarySortColumn() != null) {
+ PageOrdering order = (pageControl.getPrimarySortOrder() == null) ? PageOrdering.ASC : pageControl
+ .getPrimarySortOrder();
+ filter = buildOrderBy(new StringBuilder(), new OrderingField(pageControl.getPrimarySortColumn(), order))
+ .toString();
+ }
+
+ org.hibernate.Query query = getHibernateSession(entityManager).createFilter(collection, filter);
+ if (pageControl.getPageSize() > 0) {
+ query.setFirstResult(pageControl.getPageNumber() * pageControl.getPageSize());
+ query.setMaxResults(pageControl.getPageSize());
+ }
+
+ // TODO GH: Always flushing is probably not what we really want here
+ // relationship filters don't seem to cause the proper flush, so manually flush
+ getHibernateSession(entityManager).flush();
+
+ // TODO GH: This can only create unbounded PageLists since I don't know how to do a count query to find the size
+ return new PageList<Object>(query.list(), pageControl);
+ }
+
+ /**
+ * Use this inside subclasses as a convenience method.
+ */
+ @SuppressWarnings("unchecked")
+ public static <T> List<T> findByCriteria(EntityManager entityManager, Class<T> type,
+ org.hibernate.criterion.Criterion... criterion) {
+ // Using Hibernate, more difficult with EntityManager and EJB-QL
+ org.hibernate.Criteria crit = getHibernateSession(entityManager).createCriteria(type);
+ for (org.hibernate.criterion.Criterion c : criterion) {
+ crit.add(c);
+ }
+
+ return crit.list();
+ }
+
+ public static Session getHibernateSession(EntityManager entityManager) {
+ Session session;
+ if (entityManager.getDelegate() instanceof EntityManagerImpl) {
+ EntityManagerImpl entityManagerImpl = (EntityManagerImpl) entityManager.getDelegate();
+ session = entityManagerImpl.getSession();
+ } else {
+ session = (Session) entityManager.getDelegate();
+ }
+
+ return session;
+ }
+
+ /**
+ * Enables the hibernate statistics mbean to provide access to information on the ejb3 persistence tier.
+ *
+ * @param entityManager an inject entity manager whose session factory will be tracked with these statistics
+ * @param server the MBeanServer where the statistics MBean should be registered; if <code>null</code>, the
+ * first one in the list returned by MBeanServerFactory.findMBeanServer(null) is used
+ */
+ public static void enableHibernateStatistics(EntityManager entityManager, MBeanServer server) {
+ try {
+ SessionFactory sessionFactory = PersistenceUtility.getHibernateSession(entityManager).getSessionFactory();
+
+ if (server == null) {
+ ArrayList<MBeanServer> list = MBeanServerFactory.findMBeanServer(null);
+ server = list.get(0);
+ }
+
+ ObjectName objectName = new ObjectName(HIBERNATE_STATISTICS_MBEAN_OBJECTNAME);
+ StatisticsService mBean = new StatisticsService();
+ mBean.setSessionFactory(sessionFactory);
+ server.registerMBean(mBean, objectName);
+ sessionFactory.getStatistics().setStatisticsEnabled(true);
+ } catch (InstanceAlreadyExistsException iaee) {
+ LOG.info("Duplicate mbean registration ignored: " + HIBERNATE_STATISTICS_MBEAN_OBJECTNAME);
+ } catch (Exception e) {
+ LOG.warn("Couldn't register hibernate statistics mbean", e);
+ }
+ }
+
+ public static Statistics getStatisticsService(EntityManager entityManager, MBeanServer server) {
+ Session hibernateSession = PersistenceUtility.getHibernateSession(entityManager);
+ SessionFactory hibernateSessionFactory = hibernateSession.getSessionFactory();
+ Statistics hibernateStatistics = hibernateSessionFactory.getStatistics();
+ return hibernateStatistics;
+ }
+
+ public static String getQueryDefinitionFromNamedQuery(EntityManager entityManager, String queryName) {
+
+ NamedQueryDefinition ndc = getNamedQueryDefinition(entityManager, queryName);
+ return ndc.getQueryString();
+ }
+
+ private static NamedQueryDefinition getNamedQueryDefinition(EntityManager entityManager, String queryName) {
+ SessionFactoryImplementor sessionFactory = getHibernateSessionFactoryImplementor(entityManager);
+ NamedQueryDefinition namedQueryDefinition = sessionFactory.getNamedQuery(queryName);
+ if (namedQueryDefinition == null) {
+ throw new RuntimeException("EJB3 query not found [" + queryName + "]");
+ }
+
+ return namedQueryDefinition;
+ }
+
+ private static SessionFactoryImplementor getHibernateSessionFactoryImplementor(EntityManager entityManager) {
+ Session session = getHibernateSession(entityManager);
+ SessionFactoryImplementor sessionFactory = (SessionFactoryImplementor) session.getSessionFactory();
+ return sessionFactory;
+ }
+
+ // wanted to combine postgres and oracle methods, but org.rhq.core.db.DatabaseType objects are not visible to domain
+ public static String addPostgresNativePagingSortingToQuery(String query, PageControl pageControl) {
+ return addLimitOffsetToQuery(query, pageControl);
+ }
+
+ // wanted to combine postgres and oracle methods, but org.rhq.core.db.DatabaseType objects are not visible to domain
+ public static String addOracleNativePagingSortingToQuery(String query, PageControl pageControl) {
+ StringBuilder queryWithPagingSorting = new StringBuilder(query.length() + 50);
+
+ int minRowNum = pageControl.getStartRow() + 1;
+ int maxRowNum = minRowNum + pageControl.getPageSize() - 1;
+
+ // pagination calculations based off of double-projection of the results
+ queryWithPagingSorting.append("SELECT outerResults.* FROM ( ");
+
+ queryWithPagingSorting.append("SELECT innerResults.*, ROWNUM rnum FROM ( ");
+ queryWithPagingSorting.append(query);
+ // for oracle, order by occurs at the end of the original query, whether grouped or not
+ buildOrderBy(queryWithPagingSorting, pageControl.getOrderingFieldsAsArray());
+ queryWithPagingSorting.append(" ) innerResults ");
+
+ // for oracle, paginate high off of the inner projection
+ queryWithPagingSorting.append(" WHERE ROWNUM <= ").append(maxRowNum);
+
+ // for oracle, paginate low off of the outer projection
+ queryWithPagingSorting.append(" ) outerResults ");
+ queryWithPagingSorting.append(" WHERE rnum >= ").append(minRowNum);
+
+ return queryWithPagingSorting.toString();
+ }
+
+ /**
+ * Note: always put the rownum column at the END of the columns, so that code
+ * which relies on index-based access to the result set data doesn't break
+ *
+ * Method 1:
+ *
+ * SELECT outerResults.* FROM (
+ * SELECT innerResults.*,
+ * ROW_NUMBER() OVER( {orderByClause} ) AS rownum
+ * FROM ( {queryWithoutOrderBy} ) AS innerResults
+ * ) AS outerResults
+ * WHERE rownum <= maxRowNum AND rownum >= minRowNum
+ *
+ * The above method fails in circumstances where the orderByClause is built up with
+ * aliases that aren't in the explicit select list returned from queryWithoutOrderBy
+ *
+ *
+ * Method 2:
+ *
+ * Fix above shortcomings by pushing the orderByClause into the actual select list
+ *
+ * SELECT singleResults.* FROM (
+ * {queryWithoutOrderBySelectList}
+ * , ROW_NUMBER() OVER( {orderByClause} ) AS rownum
+ * {queryWithoutOrderByRestOfQuery}
+ * ) AS singleResults
+ * WHERE rownum <= maxRowNum AND rownum >= minRowNum
+ *
+ *
+ * Actually, both of the above methods have small flaws. The first can not sort by columns that
+ * aren't in the explicit return list. The second can not sort by computed columns and subqueries
+ * in the select list. The only way I see how this can work is by modifying the queryWithoutOrderBy
+ * to explicitly return all parameters that will be sorted on (even if the use case wouldn't normally
+ * require them to be in the select list), alias them, and order by the aliases by modifying the web
+ * ui code to use those tokens when generating the sortable column headers (jmarques - June/2009)
+ */
+ public static String addSQLServerNativePagingSortingToQuery(String query, PageControl pageControl) {
+ return addSQLServerNativePagingSortingToQuery(query, pageControl, false);
+ }
+
+ public static String addSQLServerNativePagingSortingToQuery(String query, PageControl pageControl,
+ boolean alternatePagingStyle) {
+ StringBuilder queryWithPagingSorting = new StringBuilder(query.length() + 50);
+
+ int minRowNum = pageControl.getStartRow() + 1;
+ int maxRowNum = minRowNum + pageControl.getPageSize() - 1;
+
+ String orderByClause = getOrderByFragment(pageControl.getOrderingFieldsAsArray());
+
+ if (alternatePagingStyle) {
+ int index = findSelectListEndIndex(query);
+ String selectList = query.substring(0, index);
+ String restOfQuery = query.substring(index);
+ queryWithPagingSorting.append("SELECT singleResults.* FROM ( ");
+ queryWithPagingSorting.append(selectList);
+ queryWithPagingSorting.append(", ROW_NUMBER() OVER( " + orderByClause + " ) AS rownum ");
+ queryWithPagingSorting.append(restOfQuery);
+ queryWithPagingSorting.append(") AS singleResults ");
+ } else {
+ queryWithPagingSorting.append("SELECT outerResults.* FROM ( ");
+ queryWithPagingSorting.append(" SELECT innerResults.*, ");
+ queryWithPagingSorting.append(" ROW_NUMBER() OVER( " + orderByClause + " ) AS rownum ");
+ queryWithPagingSorting.append(" FROM ( " + query + " ) AS innerResults ");
+ queryWithPagingSorting.append(" ) AS outerResults ");
+ }
+ queryWithPagingSorting.append("WHERE rownum <= ").append(maxRowNum);
+ queryWithPagingSorting.append(" AND rownum >= ").append(minRowNum);
+
+ return queryWithPagingSorting.toString();
+ }
+
+ // beginning of from clause (not counting retrievals via subqueries) should indicate end of select list
+ private static int findSelectListEndIndex(String query) {
+ int nesting = 0;
+ query = query.toLowerCase();
+ StringBuilder wordBuffer = new StringBuilder();
+ for (int i = 0; i < query.length(); i++) {
+ char next = query.charAt(i);
+ if (next == '(') {
+ nesting++;
+ } else if (next == ')') {
+ nesting--;
+ } else {
+ if (nesting != 0) {
+ continue;
+ }
+ if (Character.isLetter(next)) {
+ wordBuffer.append(next);
+ if (wordBuffer.toString().equals("from")) {
+ return i - 4; // return index representing the character just before "from"
+ }
+ } else {
+ wordBuffer.setLength(0); // clear buffer if we find any non-letter
+ }
+ }
+ }
+ throw new IllegalArgumentException("Could not find select list end index");
+ }
+
+ // wanted to combine postgres and oracle methods, but org.rhq.core.db.DatabaseType objects are not visible to domain
+ public static String addH2NativePagingSortingToQuery(String query, PageControl pageControl) {
+ return addLimitOffsetToQuery(query, pageControl);
+ }
+
+ private static String addLimitOffsetToQuery(String query, PageControl pageControl) {
+ StringBuilder queryWithPagingSorting = new StringBuilder(query.length() + 50);
+ queryWithPagingSorting.append(query);
+
+ // for postgres, first order by
+ buildOrderBy(queryWithPagingSorting, pageControl.getOrderingFieldsAsArray());
+
+ // for postgres, then paginate
+ queryWithPagingSorting.append(" LIMIT ").append(pageControl.getPageSize());
+ queryWithPagingSorting.append(" OFFSET ").append(pageControl.getStartRow());
+
+ return queryWithPagingSorting.toString();
+ }
+}
diff --cc modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/ViewAlertAction.java
index 7f4bafe,b08a41c..fe72354
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/ViewAlertAction.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/ViewAlertAction.java
@@@ -42,9 -42,10 +42,10 @@@ import org.rhq.core.domain.alert.AlertC
import org.rhq.core.domain.alert.AlertConditionCategory;
import org.rhq.core.domain.alert.AlertConditionLog;
import org.rhq.core.domain.alert.AlertDefinition;
+ import org.rhq.core.domain.alert.notification.AlertNotificationLog;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.measurement.MeasurementDefinition;
-import org.rhq.core.domain.measurement.util.MeasurementConverter;
+import org.rhq.core.server.MeasurementConverter;
import org.rhq.enterprise.gui.legacy.AttrConstants;
import org.rhq.enterprise.gui.legacy.beans.AlertConditionBean;
import org.rhq.enterprise.gui.legacy.util.RequestUtils;
diff --cc modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/subsystem/SubsystemAlertHistoryUIBean.java
index 28369a2,0ad0c7a..12e28b3
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/subsystem/SubsystemAlertHistoryUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/subsystem/SubsystemAlertHistoryUIBean.java
@@@ -32,15 -32,19 +32,19 @@@ import org.rhq.core.domain.alert.AlertC
import org.rhq.core.domain.alert.AlertConditionCategory;
import org.rhq.core.domain.alert.AlertConditionLog;
import org.rhq.core.domain.alert.composite.AlertHistoryComposite;
+ import org.rhq.core.domain.auth.Subject;
-import org.rhq.core.domain.measurement.util.MeasurementConverter;
+ import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.gui.util.FacesContextUtility;
+import org.rhq.core.server.MeasurementConverter;
+ import org.rhq.core.util.IntExtractor;
import org.rhq.enterprise.gui.common.converter.SelectItemUtils;
import org.rhq.enterprise.gui.common.paging.PageControlView;
- import org.rhq.enterprise.gui.common.paging.PagedListDataModel;
+ import org.rhq.enterprise.gui.common.paging.ResourceNameDisambiguatingPagedListDataModel;
import org.rhq.enterprise.gui.legacy.action.resource.common.monitor.alerts.AlertDefUtil;
import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
+ import org.rhq.enterprise.server.alert.AlertManagerLocal;
import org.rhq.enterprise.server.subsystem.AlertSubsystemManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
@@@ -232,4 -269,4 +269,4 @@@ public class SubsystemAlertHistoryUIBea
return null;
}
}
--}
++}
diff --cc modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
index 8183853,0f48f9e..dc96f1b
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
@@@ -38,8 -69,8 +68,9 @@@ import org.rhq.core.domain.resource.Res
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
-import org.rhq.core.domain.util.PersistenceUtility;
+import org.rhq.core.server.MeasurementConverter;
+import org.rhq.core.server.PersistenceUtility;
+ import org.rhq.core.domain.util.StringUtils;
import org.rhq.core.util.collection.ArrayUtils;
import org.rhq.core.util.jdbc.JDBCUtil;
import org.rhq.enterprise.server.RHQConstants;
@@@ -64,37 -94,6 +94,7 @@@ import org.rhq.enterprise.server.util.C
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
import org.rhq.enterprise.server.util.LookupUtil;
- import org.jboss.annotation.IgnoreDependency;
- import org.jboss.annotation.ejb.TransactionTimeout;
-
- import org.apache.commons.logging.Log;
- import org.apache.commons.logging.LogFactory;
- import org.quartz.SchedulerException;
- import org.quartz.SimpleTrigger;
-
- import javax.ejb.EJB;
- import javax.ejb.Stateless;
- import javax.ejb.TransactionAttribute;
- import javax.ejb.TransactionAttributeType;
- import javax.persistence.EntityManager;
- import javax.persistence.PersistenceContext;
- import javax.persistence.Query;
- import javax.sql.DataSource;
-
- import java.sql.Connection;
- import java.sql.PreparedStatement;
- import java.sql.SQLException;
- import java.text.SimpleDateFormat;
- import java.util.ArrayList;
- import java.util.Arrays;
- import java.util.Collection;
- import java.util.Date;
- import java.util.HashMap;
- import java.util.LinkedHashSet;
- import java.util.List;
- import java.util.Map;
- import java.util.Set;
+
/**
* @author Joseph Marques
* @author Ian Springer
@@@ -153,32 -158,15 +159,34 @@@ public class AlertManagerBean implement
for (Integer id : ids) {
Alert alert = entityManager.find(Alert.class, id);
if (alert != null) {
- AlertNotificationLog anl = alert.getAlertNotificationLog();
- entityManager.remove(anl);
+ // AlertNotificationLog anl = alert.getAlertNotificationLog(); TODO is that all?
+ // entityManager.remove(anl);
entityManager.remove(alert); // condition logs will be removed with entity cascading
}
+ i++;
}
+ return i;
}
+ public void deleteResourceAlerts(Subject user, Integer[] alertIds) {
+ Query q = entityManager.createNamedQuery(Alert.QUERY_FIND_RESOURCES);
+ q.setParameter("alertIds", Arrays.asList(alertIds));
+ List<Resource> resources = q.getResultList();
+
+ List<Resource> forbiddenResources = new ArrayList<Resource>();
+ for (Resource resource : resources) {
+ if (!authorizationManager.hasResourcePermission(user, Permission.MANAGE_ALERTS, resource.getId())) {
+ forbiddenResources.add(resource);
+ }
+ }
+ if (!forbiddenResources.isEmpty()) {
+ throw new PermissionException("User [" + user.getName() + "] does not have permissions to delete alerts "
+ + "for the following Resource(s): " + forbiddenResources);
+ }
+
+ deleteAlerts(alertIds);
+ }
+
public void deleteAlerts(Subject user, int resourceId, Integer[] ids) {
if (!authorizationManager.hasResourcePermission(user, Permission.MANAGE_ALERTS, resourceId)) {
throw new PermissionException("User [" + user.getName() + "] does not have permissions to delete alerts "
diff --cc modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
index 6cb15a4,c3eda0e..f6688b0
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
@@@ -100,8 -105,10 +105,10 @@@ import org.rhq.core.domain.resource.gro
import org.rhq.core.domain.resource.group.composite.AutoGroupComposite;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
-import org.rhq.core.domain.util.PersistenceUtility;
+import org.rhq.core.server.PersistenceUtility;
+ import org.rhq.core.util.IntExtractor;
import org.rhq.core.util.collection.ArrayUtils;
+ import org.rhq.core.util.jdbc.JDBCUtil;
import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.agentclient.AgentClient;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
diff --cc modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java
index 033417f,bb0c072..5e487fc
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java
@@@ -76,10 -77,23 +78,14 @@@ public final class CriteriaQueryGenerat
public CriteriaQueryGenerator(Criteria criteria) {
this.criteria = criteria;
-
- String criteriaClassName = criteria.getClass().getSimpleName();
- className = criteriaClassName.substring(0, criteriaClassName.length() - 8);
-
- StringBuilder aliasBuilder = new StringBuilder();
- for (char c : this.className.toCharArray()) {
- if (Character.isUpperCase(c)) {
- aliasBuilder.append(Character.toLowerCase(c));
- }
- }
- this.alias = aliasBuilder.toString();
+ this.className = criteria.getPersistentClass().getSimpleName();
+ this.alias = this.criteria.getAlias();
}
+ public void setAuthorizationCustomConditionFragment(String fragment) {
+ this.authorizationCustomConditionFragment = fragment;
+ }
+
public void setAuthorizationResourceFragment(AuthorizationTokenType type, int subjectId) {
String defaultFragment = null;
if (type == AuthorizationTokenType.RESOURCE) {
diff --cc modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryRunner.java
index dad2707,6d4d497..d2c712e
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryRunner.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryRunner.java
@@@ -53,22 -59,18 +59,18 @@@ public class CriteriaQueryRunner<T>
long count = (Long) countQuery.getSingleResult();
List<T> results = query.getResultList();
- if (!queryGenerator.getPersistentBagFields().isEmpty()) {
- initAllPersistentBags(results);
- if (autoInitializeBags) {
++ if (autoInitializeBags && (!queryGenerator.getPersistentBagFields().isEmpty())) {
+ for (T entity : results) {
+ initPersistentBags(entity);
+ }
}
- return new PageList<T>(results, (int) count, criteria.getPageControl());
+ return new PageList<T>(results, (int) count, CriteriaQueryGenerator.getPageControl(criteria));
}
- private void initAllPersistentBags(List<T> entities) {
- for (T entity : entities) {
- initPersistentBags(entity);
- }
- }
-
- private void initPersistentBags(T entity) {
+ public void initPersistentBags(Object entity) {
for (Field persistentBagField : queryGenerator.getPersistentBagFields()) {
- List persistentBag = getList(entity, persistentBagField);
+ List<?> persistentBag = getList(entity, persistentBagField);
persistentBag.size();
}
}
diff --cc modules/enterprise/server/plugins/perspectives/core/perspective/src/main/resources/META-INF/rhq-serverplugin.xml
index 07ea8e6,b04c465..cd02787
--- a/modules/enterprise/server/plugins/perspectives/core/perspective/src/main/resources/META-INF/rhq-serverplugin.xml
+++ b/modules/enterprise/server/plugins/perspectives/core/perspective/src/main/resources/META-INF/rhq-serverplugin.xml
@@@ -92,25 -92,16 +92,33 @@@
placement="after" />
</menu-item>
+ <menu-item
+ name="overview.gwtGui"
+ displayName="GWT GUI"
+ url="/coregui/CoreGUI.html#Resources">
+ <position
+ name="overview.dashboard"
+ placement="after" />
+ </menu-item>
+ <menu-item
+ name="overview.gwtGuiDevMode"
+ displayName="GWT GUI - Dev Mode"
+ url="/coregui/CoreGUI.html?gwt.codesvr=127.0.0.1:9997#Resources">
+ <position
+ name="overview.gwtGui"
+ placement="after" />
+ </menu-item>
+
<!-- Core Menu: Resources -->
<menu-item
+ name="resources.all"
+ displayName="All Resources"
+ url="/rhq/inventory/browseResources.xhtml?subtab=all">
+ <position
+ name="resources"
+ placement="firstChild" />
+ </menu-item>
+ <menu-item
name="resources.platforms"
displayName="Platforms"
iconUrl="/images/icons/Platform_up_16.png"
commit 734e126f592053b08692ef7f508e7ab89f33ddc9
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Thu Mar 4 11:00:24 2010 -0500
display parent resourcetype name in resource summary header
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceSummaryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceSummaryView.java
index 0cd388a..ed2da2e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceSummaryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceSummaryView.java
@@ -32,10 +32,8 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.FormItem;
-import com.smartgwt.client.widgets.form.fields.SectionItem;
import com.smartgwt.client.widgets.form.fields.SpacerItem;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
-import com.smartgwt.client.widgets.form.fields.TextItem;
import java.util.ArrayList;
import java.util.Collections;
@@ -83,7 +81,7 @@ public class ResourceSummaryView extends DynamicForm implements ResourceSelectLi
markForRedraw();
}
- private void loadValues() {
+ private void loadValues() {
GWTServiceLookup.getMeasurementDataService().findCurrentTraitsForResource(
resource.getId(),
DisplayType.SUMMARY,
@@ -106,6 +104,7 @@ public class ResourceSummaryView extends DynamicForm implements ResourceSelectLi
}
}
);
+
}
private void buildForm(ResourceType type) {
@@ -176,8 +175,8 @@ public class ResourceSummaryView extends DynamicForm implements ResourceSelectLi
setValue("typeItem", type.getName() + " (" + type.getPlugin() + ")");
setValue("descriptionItem", resource.getDescription());
setValue("versionItem", resource.getVersion());
- setValue("parentItem", resource.getParentResource() == null ? null : (resource.getParentResource().getName() +
- "'<a href=\"#Resource/" + resource.getParentResource().getId()) + "\">" + resource.getParentResource().getName() + "</a>'");
+ setValue("parentItem", resource.getParentResource() == null ? null : (resource.getParentResource().getResourceType().getName() +
+ " '<a href=\"#Resource/" + resource.getParentResource().getId()) + "\">" + resource.getParentResource().getName() + "</a>'");
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
index 63bcea4..651914f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
@@ -94,6 +94,7 @@ public class ResourceView extends HLayout implements ViewRenderer {
} else {
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterId(resourceId);
+ criteria.fetchParentResource(true);
resourceService.findResourcesByCriteria(criteria, new AsyncCallback<PageList<Resource>>() {
public void onFailure(Throwable caught) {
SC.say("Failed to load Resource with id " + resourceId + ": " + caught);
commit 5ca5a668de1183a2425231d7066910183e203c28
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Thu Mar 4 02:16:58 2010 -0500
some icon migration
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/Favorite_24.png b/modules/enterprise/gui/coregui/src/main/webapp/images/Favorite_24.png
new file mode 100644
index 0000000..c87e683
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/Favorite_24.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/Favorite_24_Selected.png b/modules/enterprise/gui/coregui/src/main/webapp/images/Favorite_24_Selected.png
new file mode 100644
index 0000000..0772dc7
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/Favorite_24_Selected.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/resources/Service_down_24.png b/modules/enterprise/gui/coregui/src/main/webapp/images/resources/Service_down_24.png
new file mode 100644
index 0000000..24b1d98
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/resources/Service_down_24.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/resources/Service_up_24.png b/modules/enterprise/gui/coregui/src/main/webapp/images/resources/Service_up_24.png
new file mode 100644
index 0000000..7df5599
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/resources/Service_up_24.png differ
commit a1dfc9958fd77f22674e89630ed73d884b78156e
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Thu Mar 4 02:15:47 2010 -0500
RPCDataSource enhancements
Config History view
toolstrip width fix for sgwt 2.1
security fix in config manager
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ResourceConfigurationUpdate.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ResourceConfigurationUpdate.java
index 7d3ce29..3825097 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ResourceConfigurationUpdate.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ResourceConfigurationUpdate.java
@@ -189,8 +189,8 @@ public class ResourceConfigurationUpdate extends AbstractResourceConfigurationUp
@ManyToOne
private GroupResourceConfigurationUpdate groupConfigurationUpdate;
- protected ResourceConfigurationUpdate() {
- } // JPA
+ public ResourceConfigurationUpdate() {
+ }
public ResourceConfigurationUpdate(Resource resource, Configuration config, String subjectName) {
super(config, subjectName);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java
index a6b8bd8..8d4025e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java
@@ -24,8 +24,6 @@ import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.components.HeaderLabel;
-import com.smartgwt.client.data.Criteria;
-import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.data.Record;
import com.smartgwt.client.types.DSOperationType;
import com.smartgwt.client.types.Overflow;
@@ -34,10 +32,7 @@ import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.events.SubmitValuesEvent;
import com.smartgwt.client.widgets.form.events.SubmitValuesHandler;
-import com.smartgwt.client.widgets.form.fields.CanvasItem;
-import com.smartgwt.client.widgets.form.fields.FormItem;
import com.smartgwt.client.widgets.form.fields.ResetItem;
-import com.smartgwt.client.widgets.form.fields.SectionItem;
import com.smartgwt.client.widgets.form.fields.SubmitItem;
import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
@@ -45,8 +40,6 @@ import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.layout.VLayout;
-import java.util.HashMap;
-import java.util.HashSet;
import java.util.Set;
/**
@@ -105,7 +98,6 @@ public class RoleEditView extends VLayout {
permissionEditorItem.setColSpan(2);
-
assignedGroupEditorItem = new RoleGroupsEditorItem("assignedGroups", "Assigned Groups");
assignedGroupEditorItem.setShowTitle(false);
assignedGroupEditorItem.setColSpan(2);
@@ -163,29 +155,14 @@ public class RoleEditView extends VLayout {
}
public void editNew() {
- ListGridRecord r = new ListGridRecord();
- Role newRole = new Role(null); // todo make default constructor public
- RolesDataSource.copyValues(newRole, r);
+ ListGridRecord r = RolesDataSource.getInstance().copyValues(new Role());
editRecord(r);
form.setSaveOperationType(DSOperationType.ADD);
-//
-// HashSet<Permission> permissions = new HashSet<Permission>();
-// HashMap values = new HashMap();
-// values.put("permssions", permissions);
-//
-// form.editNewRecord();
-
-
editLabel.setContents("Create Role");
-// permissionEditorItem.setPermissions(permissions);
-
-// message.hide();
-// editCanvas.show();
}
-
public void save() {
System.out.println("Saving role");
form.saveData();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleGroupsEditorItem.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleGroupsEditorItem.java
index 6eff51e..59ebf1c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleGroupsEditorItem.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleGroupsEditorItem.java
@@ -57,7 +57,7 @@ public class RoleGroupsEditorItem extends CanvasItem {
availableGroupGrid.setCanDragRecordsOut(true);
availableGroupGrid.setDragTrackerMode(DragTrackerMode.RECORD);
availableGroupGrid.setDragDataAction(DragDataAction.MOVE);
- availableGroupGrid.setDataSource(new ResourceGroupsDataSource());
+ availableGroupGrid.setDataSource(ResourceGroupsDataSource.getInstance());
availableGroupGrid.setAutoFetchData(true);
availableGroupGrid.setFields(new ListGridField("id",50), new ListGridField("name"));
@@ -82,7 +82,7 @@ public class RoleGroupsEditorItem extends CanvasItem {
assignedGroupGrid.setHeight(350);
assignedGroupGrid.setCanDragRecordsOut(true);
assignedGroupGrid.setCanAcceptDroppedRecords(true);
- assignedGroupGrid.setDataSource(new ResourceGroupsDataSource());
+ assignedGroupGrid.setDataSource(ResourceGroupsDataSource.getInstance());
assignedGroupGrid.setFields(new ListGridField("id", 50), new ListGridField("name"));
layout.addMember(assignedGroupGrid);
@@ -94,7 +94,7 @@ public class RoleGroupsEditorItem extends CanvasItem {
public void setGroups(PageList<ResourceGroup> assignedGroups) {
this.assignedGroups = assignedGroups;
- assignedGroupGrid.setData(ResourceGroupsDataSource.buildRecords(assignedGroups));
+ assignedGroupGrid.setData(ResourceGroupsDataSource.getInstance().buildRecords(assignedGroups));
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java
index 6f8894b..3a7de7f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java
@@ -44,19 +44,18 @@ import com.smartgwt.client.widgets.grid.ListGridRecord;
import java.util.Collection;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* @author Greg Hinkle
*/
-public class RolesDataSource extends RPCDataSource {
-
- private static RolesDataSource INSTANCE;
+public class RolesDataSource extends RPCDataSource<Role> {
private RoleGWTServiceAsync roleService = GWTServiceLookup.getRoleService();
+ private static RolesDataSource INSTANCE;
+
public static RolesDataSource getInstance() {
if (INSTANCE == null) {
INSTANCE = new RolesDataSource();
@@ -64,7 +63,7 @@ public class RolesDataSource extends RPCDataSource {
return INSTANCE;
}
- protected RolesDataSource() {
+ private RolesDataSource() {
super("Roles");
DataSourceField idDataField = new DataSourceIntegerField("id", "ID");
@@ -108,10 +107,7 @@ public class RolesDataSource extends RPCDataSource {
ListGridRecord[] records = new ListGridRecord[result.size()];
for (int x = 0; x < result.size(); x++) {
Role role = result.get(x);
- ListGridRecord record = new ListGridRecord();
-
- copyValues(role, record);
-
+ ListGridRecord record = copyValues(role);
records[x] = record;
}
@@ -127,8 +123,7 @@ public class RolesDataSource extends RPCDataSource {
protected void executeAdd(final DSRequest request, final DSResponse response) {
JavaScriptObject data = request.getData();
final ListGridRecord rec = new ListGridRecord(data);
- Role newRole = new Role("newName"); // TODO GH: Make default constructor public
- copyValues(rec, newRole);
+ Role newRole = copyValues(rec);
roleService.createRole(newRole, new AsyncCallback<Role>() {
public void onFailure(Throwable caught) {
@@ -142,8 +137,7 @@ public class RolesDataSource extends RPCDataSource {
public void onSuccess(Role result) {
ListGridRecord record = new ListGridRecord();
- copyValues(result,record);
- response.setData(new Record[] {record});
+ response.setData(new Record[] {copyValues(result)});
processResponse(request.getRequestId(),response);
}
});
@@ -154,8 +148,7 @@ public class RolesDataSource extends RPCDataSource {
protected void executeUpdate(final DSRequest request, final DSResponse response) {
final ListGridRecord record = getEditedRecord(request);
System.out.println("Updating record: " + record);
- Role updatedRole = new Role("foo");
- copyValues(record, updatedRole);
+ Role updatedRole = copyValues(record);
roleService.updateRole(updatedRole, new AsyncCallback<Role>() {
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError("Failed to update role",caught);
@@ -163,8 +156,7 @@ public class RolesDataSource extends RPCDataSource {
public void onSuccess(Role result) {
System.out.println("Role Updated");
- copyValues(result,record);
- response.setData(new Record[] {record});
+ response.setData(new Record[] {copyValues(result)});
processResponse(request.getRequestId(),response);
}
});
@@ -174,8 +166,7 @@ public class RolesDataSource extends RPCDataSource {
protected void executeRemove(final DSRequest request, final DSResponse response) {
JavaScriptObject data = request.getData();
final ListGridRecord rec = new ListGridRecord(data);
- Role newRole = new Role("newName"); // TODO GH: Make default constructor public
- copyValues(rec, newRole);
+ Role newRole = copyValues(rec);
roleService.removeRoles(new Integer[]{newRole.getId()}, new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
@@ -191,7 +182,8 @@ public class RolesDataSource extends RPCDataSource {
}
- private static void copyValues(ListGridRecord from, Role to) {
+ public Role copyValues(ListGridRecord from) {
+ Role to = new Role();
to.setId(from.getAttributeAsInt("id"));
to.setName(from.getAttributeAsString("name"));
// to.setDate (from.getAttributeAsDate ("date"));
@@ -199,9 +191,11 @@ public class RolesDataSource extends RPCDataSource {
to.setResourceGroups((Set<ResourceGroup>) from.getAttributeAsObject("resourceGroups"));
to.setPermissions((Set<Permission>) from.getAttributeAsObject("permissions"));
to.setSubjects((Set<Subject>) from.getAttributeAsObject("subjects"));
+ return to;
}
- static void copyValues(Role from, ListGridRecord to) {
+ public ListGridRecord copyValues(Role from) {
+ ListGridRecord to = new ListGridRecord();
to.setAttribute("id", from.getId());
to.setAttribute("name", from.getName());
to.setAttribute("resourceGroups", from.getResourceGroups());
@@ -209,6 +203,7 @@ public class RolesDataSource extends RPCDataSource {
to.setAttribute("subjects", from.getSubjects());
to.setAttribute("entity", from);
+ return to;
}
@@ -226,12 +221,11 @@ public class RolesDataSource extends RPCDataSource {
return newRecord;
}
- public static ListGridRecord[] buildRecords(Collection<Role> roles) {
+ public ListGridRecord[] buildRecords(Collection<Role> roles) {
ListGridRecord[] roleRecords = new ListGridRecord[roles.size()];
int i = 0;
for (Role role : roles) {
- ListGridRecord record = new ListGridRecord();
- copyValues(role, record);
+ ListGridRecord record = copyValues(role);
roleRecords[i++] = record;
}
return roleRecords;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/SubjectRolesEditorItem.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/SubjectRolesEditorItem.java
index ab61eac..72fc465 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/SubjectRolesEditorItem.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/SubjectRolesEditorItem.java
@@ -106,7 +106,7 @@ public class SubjectRolesEditorItem extends CanvasItem {
public void setRoles(Set<Role> assignedRoles) {
this.assignedRoles = assignedRoles;
- assignedRoleGrid.setData(RolesDataSource.buildRecords(assignedRoles));
+ assignedRoleGrid.setData(RolesDataSource.getInstance().buildRecords(assignedRoles));
}
public Set<Role> getRoles() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
index 1b74870..8f0429c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
@@ -20,21 +20,13 @@ package org.rhq.enterprise.gui.coregui.client.admin.users;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Role;
-import org.rhq.enterprise.gui.coregui.client.admin.roles.RolesDataSource;
-import org.rhq.enterprise.gui.coregui.client.admin.roles.RolesView;
import org.rhq.enterprise.gui.coregui.client.components.HeaderLabel;
-import com.google.gwt.user.client.ui.Widget;
-import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.data.Record;
-import com.smartgwt.client.docs.FormLayout;
import com.smartgwt.client.types.DSOperationType;
-import com.smartgwt.client.types.VisibilityMode;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.form.DynamicForm;
-import com.smartgwt.client.widgets.form.fields.BooleanItem;
-import com.smartgwt.client.widgets.form.fields.FormItem;
import com.smartgwt.client.widgets.form.fields.ResetItem;
import com.smartgwt.client.widgets.form.fields.SectionItem;
import com.smartgwt.client.widgets.form.fields.SubmitItem;
@@ -42,12 +34,8 @@ import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
import com.smartgwt.client.widgets.grid.ListGridRecord;
-import com.smartgwt.client.widgets.layout.HLayout;
-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;
import java.util.Set;
/**
@@ -64,6 +52,8 @@ public class UserEditView extends VLayout {
private HeaderLabel editLabel;
private DynamicForm form;
+ private UsersDataSource dataSource;
+
private Subject subject;
@Override
@@ -107,10 +97,10 @@ public class UserEditView extends VLayout {
// form.setField//s(userEditSection);
- UsersDataSource ds = UsersDataSource.getInstance();
+ dataSource = UsersDataSource.getInstance();
form.setUseAllDataSourceFields(true);
- form.setDataSource(ds);
+ form.setDataSource(dataSource);
subjectRolesEditorItem = new SubjectRolesEditorItem("rolesEditor","Assigned Roles");
@@ -162,9 +152,7 @@ public class UserEditView extends VLayout {
public void editNew() {
form.getDataSource().getField("username").setCanEdit(true);
- ListGridRecord r = new ListGridRecord();
- Subject subject = new Subject(); // todo make default constructor public
- UsersDataSource.copyValues(subject, r);
+ ListGridRecord r = dataSource.copyValues(subject);
editRecord(r);
form.setSaveOperationType(DSOperationType.ADD);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java
index 8e88e06..b874fe7 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java
@@ -54,7 +54,7 @@ import java.util.Set;
/**
* @author Greg Hinkle
*/
-public class UsersDataSource extends RPCDataSource {
+public class UsersDataSource extends RPCDataSource<Subject> {
private static UsersDataSource INSTANCE;
@@ -69,7 +69,7 @@ public class UsersDataSource extends RPCDataSource {
}
- protected UsersDataSource() {
+ private UsersDataSource() {
super("Users");
DataSourceField idDataField = new DataSourceIntegerField("id", "ID");
@@ -137,11 +137,8 @@ public class UsersDataSource extends RPCDataSource {
ListGridRecord[] records = new ListGridRecord[result.size()];
for (int x = 0; x < result.size(); x++) {
Subject subject = result.get(x);
- ListGridRecord record = new ListGridRecord();
- copyValues(subject, record);
-
- records[x] = record;
+ records[x] = copyValues(subject);
}
response.setData(records);
@@ -152,18 +149,16 @@ public class UsersDataSource extends RPCDataSource {
}
-
- @Override
+ @Override
protected void executeAdd(final DSRequest request, final DSResponse response) {
JavaScriptObject data = request.getData();
final ListGridRecord rec = new ListGridRecord(data);
- Subject newSubject = new Subject();
- copyValues(rec, newSubject);
+ Subject newSubject = copyValues(rec);
subjectService.createSubject(newSubject, new AsyncCallback<Subject>() {
public void onFailure(Throwable caught) {
// TODO better exceptions so we can set the right validation errors
- Map<String,String> errors = new HashMap<String, String>();
+ Map<String, String> errors = new HashMap<String, String>();
errors.put("username", "A user with this name already exists.");
response.setErrors(errors);
// CoreGUI.getErrorHandler().handleError("Failed to create role",caught);
@@ -172,10 +167,8 @@ public class UsersDataSource extends RPCDataSource {
}
public void onSuccess(Subject result) {
- ListGridRecord record = new ListGridRecord();
- copyValues(result,record);
- response.setData(new Record[] {record});
- processResponse(request.getRequestId(),response);
+ response.setData(new Record[]{copyValues(result)});
+ processResponse(request.getRequestId(), response);
}
});
@@ -185,11 +178,10 @@ public class UsersDataSource extends RPCDataSource {
protected void executeUpdate(final DSRequest request, final DSResponse response) {
final ListGridRecord record = getEditedRecord(request);
System.out.println("Updating record: " + record);
- final Subject updatedSubject = new Subject();
- copyValues(record, updatedSubject);
+ final Subject updatedSubject = copyValues(record);
subjectService.updateSubject(updatedSubject, new AsyncCallback<Subject>() {
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to update subject",caught);
+ CoreGUI.getErrorHandler().handleError("Failed to update subject", caught);
}
public void onSuccess(final Subject result) {
@@ -198,22 +190,20 @@ public class UsersDataSource extends RPCDataSource {
if (password != null) {
subjectService.changePassword(updatedSubject.getName(), password, new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to update subject's password",caught);
+ CoreGUI.getErrorHandler().handleError("Failed to update subject's password", caught);
}
public void onSuccess(Void nothing) {
System.out.println("Subject Updated");
- copyValues(result,record);
- response.setData(new Record[] {record});
- processResponse(request.getRequestId(),response);
+ response.setData(new Record[]{copyValues(result)});
+ processResponse(request.getRequestId(), response);
}
});
} else {
System.out.println("Subject Updated");
- copyValues(result,record);
- response.setData(new Record[] {record});
- processResponse(request.getRequestId(),response);
+ response.setData(new Record[]{copyValues(result)});
+ processResponse(request.getRequestId(), response);
}
}
});
@@ -223,12 +213,11 @@ public class UsersDataSource extends RPCDataSource {
protected void executeRemove(final DSRequest request, final DSResponse response) {
JavaScriptObject data = request.getData();
final ListGridRecord rec = new ListGridRecord(data);
- Subject subjectToDelete = new Subject(); // TODO GH: Make default constructor public
- copyValues(rec, subjectToDelete);
+ Subject subjectToDelete = copyValues(rec);
subjectService.deleteSubjects(new int[]{subjectToDelete.getId()}, new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to delete role",caught);
+ CoreGUI.getErrorHandler().handleError("Failed to delete role", caught);
}
public void onSuccess(Void result) {
@@ -241,8 +230,8 @@ public class UsersDataSource extends RPCDataSource {
}
-
- private static void copyValues(ListGridRecord from, Subject to) {
+ public Subject copyValues(ListGridRecord from) {
+ Subject to = new Subject();
to.setId(from.getAttributeAsInt("id"));
to.setName(from.getAttributeAsString("username"));
to.setFirstName(from.getAttributeAsString("firstName"));
@@ -253,9 +242,11 @@ public class UsersDataSource extends RPCDataSource {
to.setEmailAddress(from.getAttributeAsString("email"));
to.setRoles((Set<Role>) from.getAttributeAsObject("roles"));
+ return to;
}
- static void copyValues(Subject from, ListGridRecord to) {
+ public ListGridRecord copyValues(Subject from) {
+ ListGridRecord to = new ListGridRecord();
to.setAttribute("id", from.getId());
to.setAttribute("username", from.getName());
to.setAttribute("firstName", from.getFirstName());
@@ -265,13 +256,13 @@ public class UsersDataSource extends RPCDataSource {
to.setAttribute("phoneNumber", from.getPhoneNumber());
to.setAttribute("email", from.getEmailAddress());
- to.setAttribute("roles",from.getRoles());
+ to.setAttribute("roles", from.getRoles());
to.setAttribute("entity", from);
+ return to;
}
-
private ListGridRecord getEditedRecord(DSRequest request) {
// Retrieving values before edit
JavaScriptObject oldValues = request.getAttributeAsJavaScriptObject("oldValues");
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
index c21d00a..cdbe515 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
@@ -49,7 +49,7 @@ import java.util.Set;
*
* @author Ian Springer
*/
-public class AlertDataSource extends RPCDataSource {
+public class AlertDataSource extends RPCDataSource<Alert> {
private static final String NAME = "Alert";
private static final DateTimeFormat DATE_TIME_FORMAT = DateTimeFormat.getMediumDateTimeFormat();
@@ -146,14 +146,7 @@ public class AlertDataSource extends RPCDataSource {
long fetchTime = System.currentTimeMillis() - start;
System.out.println(result.size() + " Alerts fetched in: " + fetchTime + "ms");
- ListGridRecord[] records = new ListGridRecord[result.size()];
- for (int i = 0; i < result.size(); i++) {
- Alert alert = result.get(i);
- ListGridRecord record = createRecord(alert);
- records[i] = record;
- }
-
- response.setData(records);
+ response.setData(buildRecords(result));
// For paging to work, we have to specify size of full result set.
response.setTotalRows(result.getTotalSize());
processResponse(request.getRequestId(), response);
@@ -161,21 +154,21 @@ public class AlertDataSource extends RPCDataSource {
});
}
- protected void executeRemove(final DSRequest request, final DSResponse response) {
- JavaScriptObject data = request.getData ();
- ListGridRecord record = new ListGridRecord(data);
- Window.alert(String.valueOf(record.getAttributeAsInt("id")));
+ @Override
+ public Alert copyValues(ListGridRecord from) {
+ return null; // TODO: Implement this method.
}
- private ListGridRecord createRecord(Alert alert) {
+ @Override
+ public ListGridRecord copyValues(Alert from) {
ListGridRecord record = new ListGridRecord();
- record.setAttribute("id", alert.getId());
- record.setAttribute("resourceId", alert.getAlertDefinition().getResource().getId());
- record.setAttribute("name", alert.getAlertDefinition().getName());
- record.setAttribute("priority", alert.getAlertDefinition().getPriority().name());
- record.setAttribute("ctime", DATE_TIME_FORMAT.format(new Date(alert.getCtime())));
+ record.setAttribute("id", from.getId());
+ record.setAttribute("resourceId", from.getAlertDefinition().getResource().getId());
+ record.setAttribute("name", from.getAlertDefinition().getName());
+ record.setAttribute("priority", from.getAlertDefinition().getPriority().name());
+ record.setAttribute("ctime", DATE_TIME_FORMAT.format(new Date(from.getCtime())));
- Set<AlertConditionLog> conditionLogs = alert.getConditionLogs();
+ Set<AlertConditionLog> conditionLogs = from.getConditionLogs();
String conditionText;
String conditionValue;
if (conditionLogs.size() > 1) {
@@ -197,8 +190,15 @@ public class AlertDataSource extends RPCDataSource {
record.setAttribute("conditionText", conditionText);
record.setAttribute("conditionValue", conditionValue);
- String recoveryInfo = AlertFormatUtility.getAlertRecoveryInfo(alert);
+ String recoveryInfo = AlertFormatUtility.getAlertRecoveryInfo(from);
record.setAttribute("recoveryInfo", recoveryInfo);
return record;
}
+
+ protected void executeRemove(final DSRequest request, final DSResponse response) {
+ JavaScriptObject data = request.getData ();
+ ListGridRecord record = new ListGridRecord(data);
+ Window.alert(String.valueOf(record.getAttributeAsInt("id")));
+ }
+
}
\ No newline at end of file
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 ab6862c..cd0252f 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
@@ -578,6 +578,7 @@ public class ConfigurationEditor extends VLayout {
VLayout summaryTableHolder = new VLayout();
ToolStrip toolStrip = new ToolStrip();
+ toolStrip.setWidth100();
IButton addRowButton = new IButton();
addRowButton.setIcon(Window.getImgURL("[SKIN]/actions/add.png"));
addRowButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java
index 9358332..307bafe 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ConfigurationGWTService.java
@@ -3,7 +3,9 @@ package org.rhq.enterprise.gui.coregui.client.gwt;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.RawConfiguration;
+import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.util.PageList;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
@@ -19,6 +21,9 @@ public interface ConfigurationGWTService extends RemoteService {
ConfigurationDefinition getResourceConfigurationDefinition(int resourceTypeId);
+ PageList<ResourceConfigurationUpdate> findResourceConfigurationUpdates(int resourceId);
+
+
RawConfiguration dummy(RawConfiguration config);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
index 538fc95..43f99aa 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
@@ -74,7 +74,7 @@ public class ResourceGroupListView extends VLayout {
// addMember(searchPanel);
- final ResourceGroupsDataSource datasource = new ResourceGroupsDataSource();
+ final ResourceGroupsDataSource datasource = ResourceGroupsDataSource.getInstance();
VLayout gridHolder = new VLayout();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java
index 1f88e32..ddfa206 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java
@@ -19,8 +19,6 @@
package org.rhq.enterprise.gui.coregui.client.inventory.groups;
import org.rhq.core.domain.criteria.ResourceGroupCriteria;
-import org.rhq.core.domain.measurement.AvailabilityType;
-import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
@@ -28,12 +26,10 @@ import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGroupGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
-import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.data.DataSourceField;
-import com.smartgwt.client.data.fields.DataSourceImageField;
import com.smartgwt.client.data.fields.DataSourceIntegerField;
import com.smartgwt.client.data.fields.DataSourceTextField;
import com.smartgwt.client.rpc.RPCResponse;
@@ -42,14 +38,24 @@ import com.smartgwt.client.widgets.grid.ListGridRecord;
/**
* @author Greg Hinkle
*/
-public class ResourceGroupsDataSource extends RPCDataSource {
+public class ResourceGroupsDataSource extends RPCDataSource<ResourceGroup> {
private String query;
private ResourceGroupGWTServiceAsync groupService = GWTServiceLookup.getResourceGroupService();
+ private static ResourceGroupsDataSource INSTANCE;
+
+ public static ResourceGroupsDataSource getInstance() {
+ if (INSTANCE == null) {
+ INSTANCE = new ResourceGroupsDataSource();
+ }
+ return INSTANCE;
+ }
- public ResourceGroupsDataSource() {
+
+ private ResourceGroupsDataSource() {
+ super("ResourceGroups");
DataSourceField idDataField = new DataSourceIntegerField("id", "ID", 20);
idDataField.setPrimaryKey(true);
@@ -93,31 +99,27 @@ public class ResourceGroupsDataSource extends RPCDataSource {
});
}
+ @Override
+ public ResourceGroup copyValues(ListGridRecord from) {
+ return null; // TODO: Implement this method.
+ }
- public static ListGridRecord[] buildRecords(PageList<ResourceGroup> groupList) {
-
- ListGridRecord[] records = null;
- if (groupList != null) {
- records = new ListGridRecord[groupList.size()];
-
- for (int x = 0; x < groupList.size(); x++) {
- ResourceGroup group = groupList.get(x);
- ListGridRecord record = new ListGridRecord();
- record.setAttribute("group", group);
- record.setAttribute("id", group.getId());
- record.setAttribute("name", group.getName());
- record.setAttribute("description", group.getDescription());
- record.setAttribute("groupCategory", group.getGroupCategory());
-
- if (group.getResourceType() != null) {
- record.setAttribute("resourceType", group.getResourceType());
- record.setAttribute("typeName", group.getResourceType().getName());
- record.setAttribute("pluginName", group.getResourceType().getPlugin());
- }
- records[x] = record;
- }
+ @Override
+ public ListGridRecord copyValues(ResourceGroup from) {
+ ListGridRecord record = new ListGridRecord();
+ record.setAttribute("group", from);
+ record.setAttribute("id", from.getId());
+ record.setAttribute("name", from.getName());
+ record.setAttribute("description", from.getDescription());
+ record.setAttribute("groupCategory", from.getGroupCategory());
+
+ if (from.getResourceType() != null) {
+ record.setAttribute("resourceType", from.getResourceType());
+ record.setAttribute("typeName", from.getResourceType().getName());
+ record.setAttribute("pluginName", from.getResourceType().getPlugin());
}
- return records;
+
+ return record;
}
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionDataSource.java
index b5a9b89..2d2ca93 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionDataSource.java
@@ -38,7 +38,7 @@ import com.smartgwt.client.widgets.grid.ListGridRecord;
/**
* @author Greg Hinkle
*/
-public class GroupDefinitionDataSource extends RPCDataSource {
+public class GroupDefinitionDataSource extends RPCDataSource<GroupDefinition> {
private ResourceGroupGWTServiceAsync groupService = GWTServiceLookup.getResourceGroupService();
@@ -88,27 +88,25 @@ public class GroupDefinitionDataSource extends RPCDataSource {
});
}
+ @Override
+ public GroupDefinition copyValues(ListGridRecord from) {
+ return null; // TODO: Implement this method.
+ }
- public ListGridRecord[] buildRecords(PageList<GroupDefinition> definitions) {
-
- ListGridRecord[] records = new ListGridRecord[definitions.size()];
- int i = 0;
- for (GroupDefinition def : definitions) {
- ListGridRecord record = new ListGridRecord();
- record.setAttribute("id", def.getId());
- record.setAttribute("name", def.getName());
- record.setAttribute("description", def.getDescription());
- record.setAttribute("expression", def.getExpression());
- record.setAttribute("recalculationInterval", def.getRecalculationInterval());
- record.setAttribute("modifiedTime", def.getModifiedTime());
- record.setAttribute("createdTime", def.getCreatedTime());
- record.setAttribute("lastCalculationTime", def.getLastCalculationTime());
- record.setAttribute("nextCalculationTime", def.getNextCalculationTime());
- record.setAttribute("managedResourceGroups", def.getManagedResourceGroups());
-
- records[i++] = record;
- }
-
- return records;
+ @Override
+ public ListGridRecord copyValues(GroupDefinition from) {
+ ListGridRecord record = new ListGridRecord();
+ record.setAttribute("id", from.getId());
+ record.setAttribute("name", from.getName());
+ record.setAttribute("description", from.getDescription());
+ record.setAttribute("expression", from.getExpression());
+ record.setAttribute("recalculationInterval", from.getRecalculationInterval());
+ record.setAttribute("modifiedTime", from.getModifiedTime());
+ record.setAttribute("createdTime", from.getCreatedTime());
+ record.setAttribute("lastCalculationTime", from.getLastCalculationTime());
+ record.setAttribute("nextCalculationTime", from.getNextCalculationTime());
+ record.setAttribute("managedResourceGroups", from.getManagedResourceGroups());
+
+ return record;
}
}
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 294bda1..b692edf 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
@@ -40,7 +40,7 @@ import com.smartgwt.client.widgets.grid.ListGridRecord;
/**
* @author Greg Hinkle
*/
-public class ResourceDatasource extends RPCDataSource {
+public class ResourceDatasource extends RPCDataSource<Resource> {
private String query;
@@ -104,29 +104,35 @@ public class ResourceDatasource extends RPCDataSource {
System.out.println("Data retrieved in: " + (System.currentTimeMillis() - start));
- ListGridRecord[] records = new ListGridRecord[result.size()];
- for (int x=0; x<result.size(); x++) {
- Resource res = result.get(x);
- ListGridRecord record = new ListGridRecord();
- record.setAttribute("resource",res);
- record.setAttribute("id",res.getId());
- record.setAttribute("name",res.getName());
- record.setAttribute("description",res.getDescription());
- record.setAttribute("typeName",res.getResourceType().getName());
- record.setAttribute("pluginName",res.getResourceType().getPlugin());
- record.setAttribute("category",res.getResourceType().getCategory().getDisplayName());
-
- record.setAttribute("currentAvailability",
- res.getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP
- ? "/images/icons/availability_green_16.png"
- : "/images/icons/availability_red_16.png");
- records[x] = record;
- }
-
+ 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 null; // TODO: Implement this method.
+ }
+
+ @Override
+ public ListGridRecord copyValues(Resource from) {
+ ListGridRecord record = new ListGridRecord();
+ record.setAttribute("resource",from);
+ record.setAttribute("id",from.getId());
+ record.setAttribute("name",from.getName());
+ record.setAttribute("description",from.getDescription());
+ record.setAttribute("typeName",from.getResourceType().getName());
+ record.setAttribute("pluginName",from.getResourceType().getPlugin());
+ record.setAttribute("category",from.getResourceType().getCategory().getDisplayName());
+
+ record.setAttribute("currentAvailability",
+ from.getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP
+ ? "/images/icons/availability_green_16.png"
+ : "/images/icons/availability_red_16.png");
+
+ return record;
+ }
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index e1529ac..834a74d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -28,6 +28,7 @@ import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTab;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSet;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSearchView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration.ConfigurationHistoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.GraphListView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
@@ -153,7 +154,7 @@ public class ResourceDetailView extends VLayout implements ResourceSelectListene
configurationTab.updateSubTab("Current", new ConfigurationEditor(resource.getId(), resource.getResourceType().getId()));
-
+ configurationTab.updateSubTab("History", ConfigurationHistoryView.getHistoryOf(resource.getId()));
topTabSet.setSelectedTab(selectedTab);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java
new file mode 100644
index 0000000..9e424b6
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java
@@ -0,0 +1,109 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration;
+
+import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
+import org.rhq.core.domain.util.PageList;
+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 org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.data.fields.DataSourceIntegerField;
+import com.smartgwt.client.data.fields.DataSourceTextField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+/**
+ * @author Greg Hinkle
+ */
+public class ConfigurationHistoryDataSource extends RPCDataSource<ResourceConfigurationUpdate> {
+
+ private ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService();
+
+
+ public ConfigurationHistoryDataSource() {
+ super();
+
+ // id, resource, subject, configuration, createdTime, duration, errorMessage, modifiedTime, status
+
+
+ DataSourceIntegerField idField = new DataSourceIntegerField("id");
+ idField.setPrimaryKey(true);
+ addField(idField);
+
+ DataSourceTextField submittedField = new DataSourceTextField("createdTime");
+ addField(submittedField);
+
+ DataSourceTextField statusField = new DataSourceTextField("status");
+ addField(statusField);
+
+ DataSourceTextField subjectField = new DataSourceTextField("subject");
+ addField(subjectField);
+
+
+ }
+
+ @Override
+ protected void executeFetch(final DSRequest request, final DSResponse response) {
+
+ int resourceId = Integer.parseInt((String) request.getCriteria().getValues().get("resourceId"));
+
+ configurationService.findResourceConfigurationUpdates(resourceId, new AsyncCallback<PageList<ResourceConfigurationUpdate>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Unable to load configuration history",caught);
+ response.setStatus(DSResponse.STATUS_FAILURE);
+ processResponse(request.getRequestId(),response);
+ }
+
+ public void onSuccess(PageList<ResourceConfigurationUpdate> result) {
+ response.setData(buildRecords(result));
+ response.setTotalRows(result.getTotalSize());
+ processResponse(request.getRequestId(), response);
+ }
+ });
+ }
+
+
+
+
+
+ @Override
+ public ResourceConfigurationUpdate copyValues(ListGridRecord from) {
+ return null; // TODO: Implement this method.
+ }
+
+ @Override
+ public ListGridRecord copyValues(ResourceConfigurationUpdate from) {
+ ListGridRecord record = new ListGridRecord();
+ record.setAttribute("id", from.getId());
+ record.setAttribute("resource",from.getResource());
+ record.setAttribute("subject",from.getSubjectName());
+ record.setAttribute("configuration", from.getConfiguration());
+ record.setAttribute("createdTime",from.getCreatedTime());
+ record.setAttribute("duration", from.getDuration());
+ record.setAttribute("errorMessage", from.getErrorMessage());
+ record.setAttribute("modifiedTime", from.getModifiedTime());
+ record.setAttribute("status",from.getStatus());
+
+ return record;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
new file mode 100644
index 0000000..3b52ecb
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
@@ -0,0 +1,162 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration;
+
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDatasource;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
+
+import com.google.gwt.event.dom.client.KeyCodes;
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.types.ListGridFieldType;
+import com.smartgwt.client.types.SelectionAppearance;
+import com.smartgwt.client.types.SelectionStyle;
+import com.smartgwt.client.util.BooleanCallback;
+import com.smartgwt.client.util.SC;
+import com.smartgwt.client.widgets.IButton;
+import com.smartgwt.client.widgets.Label;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.TextItem;
+import com.smartgwt.client.widgets.form.fields.events.KeyPressEvent;
+import com.smartgwt.client.widgets.form.fields.events.KeyPressHandler;
+import com.smartgwt.client.widgets.grid.CellFormatter;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.grid.events.DataArrivedEvent;
+import com.smartgwt.client.widgets.grid.events.DataArrivedHandler;
+import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
+import com.smartgwt.client.widgets.grid.events.SelectionEvent;
+import com.smartgwt.client.widgets.layout.LayoutSpacer;
+import com.smartgwt.client.widgets.layout.VLayout;
+import com.smartgwt.client.widgets.toolbar.ToolStrip;
+
+import java.util.ArrayList;
+
+/**
+ * @author Greg Hinkle
+ */
+public class ConfigurationHistoryView extends VLayout {
+
+ private ListGrid listGrid;
+
+ /**
+ * A resource list of all resources in the system
+ */
+ public ConfigurationHistoryView() {
+ this(null);
+ }
+
+ /**
+ * Resource list filtered by a given criteria
+ */
+ public ConfigurationHistoryView(Criteria criteria) {
+
+ setWidth100();
+ setHeight100();
+
+
+ final ConfigurationHistoryDataSource datasource = new ConfigurationHistoryDataSource();
+
+ VLayout gridHolder = new VLayout();
+
+ listGrid = new ListGrid();
+ listGrid.setWidth100();
+ listGrid.setHeight100();
+ listGrid.setDataSource(datasource);
+ listGrid.setAutoFetchData(true);
+ listGrid.setAlternateRecordStyles(true);
+ listGrid.setUseAllDataSourceFields(true);
+
+ if (criteria != null) {
+ listGrid.setInitialCriteria(criteria);
+ }
+
+ listGrid.setSelectionType(SelectionStyle.SIMPLE);
+ listGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
+ listGrid.setResizeFieldsInRealTime(true);
+
+
+ gridHolder.addMember(listGrid);
+
+ ToolStrip toolStrip = new ToolStrip();
+ toolStrip.setPadding(5);
+ toolStrip.setWidth100();
+ toolStrip.setMembersMargin(15);
+
+ final IButton removeButton = new IButton("Remove");
+ removeButton.setDisabled(true);
+ removeButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ SC.confirm("Are you sure you want to delete " + listGrid.getSelection().length + " configurations?",
+ new BooleanCallback() {
+ public void execute(Boolean aBoolean) {
+
+ }
+ }
+ );
+ }
+ });
+
+
+ final Label tableInfo = new Label("Total: " + listGrid.getTotalRows());
+ tableInfo.setWrap(false);
+
+ toolStrip.addMember(removeButton);
+ toolStrip.addMember(new LayoutSpacer());
+ toolStrip.addMember(tableInfo);
+
+ gridHolder.addMember(toolStrip);
+
+
+ listGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
+ public void onSelectionChanged(SelectionEvent selectionEvent) {
+ int selectedCount = ((ListGrid) selectionEvent.getSource()).getSelection().length;
+ tableInfo.setContents("Total: " + listGrid.getTotalRows() + " (" + selectedCount + " selected)");
+ removeButton.setDisabled(selectedCount == 0);
+ }
+ });
+
+
+ addMember(gridHolder);
+
+
+ listGrid.addDataArrivedHandler(new DataArrivedHandler() {
+ public void onDataArrived(DataArrivedEvent dataArrivedEvent) {
+ int selectedCount = ((ListGrid) dataArrivedEvent.getSource()).getSelection().length;
+ tableInfo.setContents("Total: " + listGrid.getTotalRows() + " (" + selectedCount + " selected)");
+ }
+ });
+ }
+
+
+
+ // -------- Static Utility loaders ------------
+
+
+ public static ConfigurationHistoryView getHistoryOf(int resourceId) {
+ return new ConfigurationHistoryView(new Criteria("resourceId",String.valueOf(resourceId)));
+ }
+
+
+
+
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationWizard.java
new file mode 100644
index 0000000..26f7108
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationWizard.java
@@ -0,0 +1,69 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation;
+
+import org.rhq.core.domain.resource.Resource;
+
+import com.smartgwt.client.widgets.Window;
+import com.smartgwt.client.widgets.events.CloseClickHandler;
+import com.smartgwt.client.widgets.events.CloseClientEvent;
+import com.smartgwt.client.widgets.layout.VLayout;
+
+/**
+ * @author Greg Hinkle
+ */
+public class OperationWizard extends VLayout{
+
+ private Resource resource;
+ private String operation;
+
+ public OperationWizard(Resource resource, String operation) {
+ this.resource = resource;
+ this.operation = operation;
+ }
+
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+ }
+
+
+
+ public static void startPopupOperationWizard(Resource resource, String operation) {
+ final Window dialog = new Window();
+ dialog.setTitle("Execute Operation");
+ dialog.setWidth(800);
+ dialog.setHeight(800);
+ dialog.setIsModal(true);
+ dialog.setShowModalMask(true);
+ dialog.setCanDragResize(true);
+ dialog.setShowResizer(true);
+ dialog.centerInPage();
+ dialog.addCloseClickHandler(new CloseClickHandler() {
+ public void onCloseClick(CloseClientEvent closeClientEvent) {
+ dialog.destroy();
+ }
+ });
+ dialog.addItem(new OperationWizard(resource, operation));
+ dialog.show();
+
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
index b09fac8..91c46f5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
@@ -23,6 +23,7 @@ import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.VerticalAlignment;
import com.smartgwt.client.widgets.Img;
import com.smartgwt.client.widgets.layout.HLayout;
+import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.menu.Menu;
import com.smartgwt.client.widgets.menu.MenuBar;
import org.rhq.enterprise.gui.coregui.client.components.AboutModalWindow;
@@ -91,54 +92,38 @@ public class MenuBarView extends HLayout {
});
addMember(logo);
+ VLayout right = new VLayout();
+
+
+
+ HLayout links = new HLayout(25);
+
Hyperlink dashboardLink = new Hyperlink("Dashboard", "Dashboard");
dashboardLink.setStylePrimaryName("TopSectionLink");
dashboardLink.setStyleName("TopSectionLink");
- addMember(dashboardLink);
+ links.addMember(dashboardLink);
Hyperlink demoLink = new Hyperlink("Demo", "Demo");
demoLink.setStylePrimaryName("TopSectionLink");
- addMember(demoLink);
+ links.addMember(demoLink);
Hyperlink resourcesLink = new Hyperlink("Resources", "Resources");
resourcesLink.setStylePrimaryName("TopSectionLink");
- addMember(resourcesLink);
+ links.addMember(resourcesLink);
Hyperlink bundlesLink = new Hyperlink("Bundles", "Bundles");
bundlesLink.setStylePrimaryName("TopSectionLink");
- addMember(bundlesLink);
+ links.addMember(bundlesLink);
Hyperlink adminLink = new Hyperlink("Administration", "Administration");
adminLink.setStylePrimaryName("TopSectionLink");
- addMember(adminLink);
+ links.addMember(adminLink);
+
+
+ right.addMember(links);
+ right.addMember(new SearchBarPane());
-
-//
-// LinkItem demoLink = new LinkItem("Demo");
-// demoLink.setShowTitle(false);
-// demoLink.setLinkTitle("Demo");
-// demoLink.addClickHandler(new ClickHandler() {
-// public void onClick(ClickEvent clickEvent) {
-// CoreGUI.setContent(new DemoCanvas());
-// }
-// });
-//
-//
-// LinkItem adminLink = new LinkItem("Administration");
-// adminLink.setShowTitle(false);
-// adminLink.setLinkTitle("Administration");
-//
-// demoLink.addClickHandler(new ClickHandler() {
-// public void onClick(ClickEvent clickEvent) {
-// CoreGUI.setContent(new AdministrationView());
-// }
-// });
-//
-// DynamicForm form = new DynamicForm();
-//
-// form.setItems(demoLink, adminLink);
-//
-// addMember(form);
+ addMember(right);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/SearchBarPane.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/SearchBarPane.java
new file mode 100644
index 0000000..2cd3d35
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/SearchBarPane.java
@@ -0,0 +1,73 @@
+/*
+ * 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.menu;
+
+import com.google.gwt.user.client.ui.TextBox;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.SelectItem;
+import com.smartgwt.client.widgets.form.fields.TextItem;
+import com.smartgwt.client.widgets.layout.HLayout;
+import com.smartgwt.client.widgets.menu.Menu;
+import com.smartgwt.client.widgets.menu.MenuButton;
+import com.smartgwt.client.widgets.menu.MenuItem;
+import com.smartgwt.client.widgets.menu.MenuItemSeparator;
+
+import java.util.LinkedHashMap;
+
+/**
+ * @author Greg Hinkle
+ */
+public class SearchBarPane extends HLayout {
+
+ public SearchBarPane() {
+ super();
+ setWidth100();
+ setHeight(45);
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+
+ DynamicForm form = new DynamicForm();
+ form.setNumCols(3);
+ form.setWidth100();
+
+
+ LinkedHashMap<String, String> values = new LinkedHashMap<String, String>();
+ values.put("Resources", "Resources");
+ values.put("Resources Groups", "Resources Groups");
+ values.put("Bundles", "Bundles");
+ values.put("Packages", "Package");
+ values.put("Users", "Users");
+ values.put("Roles", "Roles");
+
+ SelectItem searchType = new SelectItem("searchType", "Search");
+ searchType.setValueMap(values);
+
+
+ TextItem query = new TextItem("query");
+ query.setWidth("100%");
+ query.setShowTitle(false);
+
+ form.setItems(searchType, query);
+
+ addMember(form);
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
index f484c29..197f8a0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
@@ -18,9 +18,12 @@
*/
package org.rhq.enterprise.gui.coregui.client.util;
+import org.rhq.core.domain.authz.Role;
+import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.util.OrderingField;
import org.rhq.core.domain.util.PageControl;
+import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
@@ -29,13 +32,16 @@ import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.types.DSDataFormat;
import com.smartgwt.client.types.DSProtocol;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
import java.util.List;
/**
+ * Base GWT-RPC oriented DataSource class.
+ *
* @author Greg Hinkle
*/
-public abstract class RPCDataSource extends DataSource {
+public abstract class RPCDataSource<T> extends DataSource {
public RPCDataSource() {
setClientOnly(false);
@@ -52,8 +58,6 @@ public abstract class RPCDataSource extends DataSource {
}
-
-
@Override
protected Object transformRequest(DSRequest request) {
try {
@@ -115,8 +119,39 @@ public abstract class RPCDataSource extends DataSource {
}
+
+
+ public ListGridRecord[] buildRecords(PageList<T> list) {
+ if (list == null) {
+ return null;
+ }
+
+ ListGridRecord[] records = new ListGridRecord[list.size()];
+ int i = 0;
+ for (T item : list) {
+ records[i++] = copyValues(item);
+ }
+ return records;
+ }
+
+
+ /**
+ * Extensions should implement this method to retrieve data. Paging solutions should use
+ * @see getPageControl(). All implementations should call processResponse whether they
+ * fail or succeed. Data should be set on the request via setData. Implementations can use
+ * buildRecords to get the list of records.
+ *
+ * @param request
+ * @param response
+ */
protected abstract void executeFetch(final DSRequest request, final DSResponse response);
+
+ public abstract T copyValues(ListGridRecord from);
+
+ public abstract ListGridRecord copyValues(T from);
+
+
/**
* Executed on <code>REMOVE</code> operation. <code>processResponse (requestId, response)</code>
* should be called when operation completes (either successful or failure).
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferences.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferences.java
index 93a7743..2b935e5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferences.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferences.java
@@ -43,7 +43,7 @@ public class UserPreferences {
public UserPreferences(Subject subject) {
this.subject = subject;
- subject.getUserConfiguration();
+ this.userConfiguration = subject.getUserConfiguration();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java
index 7887501..d4d9386 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ConfigurationGWTServiceImpl.java
@@ -3,7 +3,11 @@ package org.rhq.enterprise.gui.coregui.server.gwt;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.RawConfiguration;
+import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.util.PageControl;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.core.domain.util.PageOrdering;
import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTService;
import org.rhq.enterprise.gui.coregui.server.util.SerialUtility;
import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal;
@@ -14,9 +18,10 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet;
public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implements ConfigurationGWTService {
+ private ConfigurationManagerLocal configurationManager = LookupUtil.getConfigurationManager();
+
public Configuration getPluginConfiguration(int resourceId) {
- ConfigurationManagerLocal configurationManager = LookupUtil.getConfigurationManager();
Configuration configuration = configurationManager.getPluginConfiguration(getSessionSubject(), resourceId);
@@ -24,7 +29,6 @@ public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implemen
}
public ConfigurationDefinition getPluginConfigurationDefinition(int resourceTypeId) {
- ConfigurationManagerLocal configurationManager = LookupUtil.getConfigurationManager();
ConfigurationDefinition definition = configurationManager.getPluginConfigurationDefinitionForResourceType(getSessionSubject(), resourceTypeId);
return SerialUtility.prepare(definition, "PluginDefinition");
@@ -33,19 +37,29 @@ public class ConfigurationGWTServiceImpl extends AbstractGWTServiceImpl implemen
public Configuration getResourceConfiguration(int resourceId) {
- ConfigurationManagerLocal configurationManager = LookupUtil.getConfigurationManager();
-
Configuration configuration = configurationManager.getResourceConfiguration(getSessionSubject(), resourceId);
return SerialUtility.prepare(configuration, "ResourceConfiguration");
}
public ConfigurationDefinition getResourceConfigurationDefinition(int resourceTypeId) {
- ConfigurationManagerLocal configurationManager = LookupUtil.getConfigurationManager();
ConfigurationDefinition definition = configurationManager.getResourceConfigurationDefinitionWithTemplatesForResourceType(getSessionSubject(), resourceTypeId);
return SerialUtility.prepare(definition, "ResourceDefinition");
}
+ public PageList<ResourceConfigurationUpdate> findResourceConfigurationUpdates(int resourceId) {
+ PageList<ResourceConfigurationUpdate> result;
+
+ PageControl pc = PageControl.getUnlimitedInstance();
+ pc.initDefaultOrderingField("cu.id", PageOrdering.DESC);
+
+ // TODO GH: I'd prefer a criteria based solution here
+ result = configurationManager.findResourceConfigurationUpdates(getSessionSubject(), resourceId, null, null, false, pc);
+
+ return SerialUtility.prepare(result,"ConfigurationService.findResourceConfigurationUpdates");
+ }
+
+
public RawConfiguration dummy(RawConfiguration config) {
System.out.println(config.getPath());
return new RawConfiguration();
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index 778abd6..f933d5f 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -847,9 +847,9 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
public PageList<ResourceConfigurationUpdate> findResourceConfigurationUpdates(Subject subject, Integer resourceId,
Long beginDate, Long endDate, boolean suppressOldest, PageControl pc) {
- if (!authorizationManager.canViewResource(subject, resourceId)) {
+ if (!authorizationManager.hasResourcePermission(subject, Permission.CONFIGURE, resourceId)) {
throw new PermissionException("User [" + subject.getName()
- + "] does not have permission to view resource[id=" + resourceId + "]");
+ + "] does not have permission to manage configuration for resource[id=" + resourceId + "]");
}
Resource resource = entityManager.find(Resource.class, resourceId);
commit 2eccc60e6fd78d25d99ff7746d54c57454ba0982
Merge: 987d9fd... 74cb7e2...
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Wed Mar 3 18:28:48 2010 -0500
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
Conflicts:
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
index e1b3ac9,73e54a7..d38ea91
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
@@@ -38,11 -38,11 +38,9 @@@ public class AboutModalWindow extends W
private static final String TITLE = "About RHQ";
public AboutModalWindow() {
-- super();
--
setTitle(TITLE);
setWidth(300);
- setHeight(250);
+ setHeight(240);
setOverflow(Overflow.VISIBLE);
setShowMinimizeButton(false);
setIsModal(true);
@@@ -54,15 -53,16 +52,13 @@@
}
@Override
- protected void onDraw() {
- // NOTE: super.onDraw() is what will add the header bar to the Window, so we have to add our own content
- // after it's called, otherwise the header bar end up below our content...
- super.onDraw();
+ protected void onInit() {
+ super.onInit();
-
- // NOTE: super.onDraw() is what will add the header bar to the Window, so we have to add our own content
- // after it's called, otherwise the header bar end up below our content...
-
+
VLayout contentPane = new VLayout();
- contentPane.setMembersMargin(25);
contentPane.setPadding(15);
- contentPane.setAlign(VerticalAlignment.TOP);
-
++ contentPane.setMembersMargin(25);
+
HTMLFlow htmlFlow = new HTMLFlow();
String html =
"<span class=\"DisplaySubhead\">\n" +
@@@ -94,6 -93,8 +89,8 @@@
});
bottomPanel.addMember(closeButton);
-
-
++ // NOTE: Since this is a subclass of Window, we MUST use addItem(), rather than addMember() from the
++ // Layout class.
addItem(contentPane);
}
}
commit 987d9fda73189fef28739d7a543158146a3761d4
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Wed Mar 3 16:57:21 2010 -0500
fix layout in About box
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
index 21240cf..e1b3ac9 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
@@ -42,13 +42,14 @@ public class AboutModalWindow extends Window {
setTitle(TITLE);
setWidth(300);
- setHeight(250);
+ setHeight(240);
setOverflow(Overflow.VISIBLE);
setShowMinimizeButton(false);
setIsModal(true);
setShowModalMask(true);
setCanDragResize(false);
setCanDragReposition(false);
+ setAlign(VerticalAlignment.TOP);
centerInPage();
}
@@ -57,11 +58,10 @@ public class AboutModalWindow extends Window {
// NOTE: super.onDraw() is what will add the header bar to the Window, so we have to add our own content
// after it's called, otherwise the header bar end up below our content...
super.onDraw();
-
+
VLayout contentPane = new VLayout();
+ contentPane.setMembersMargin(25);
contentPane.setPadding(15);
- contentPane.setAlign(VerticalAlignment.TOP);
- addMember(contentPane);
HTMLFlow htmlFlow = new HTMLFlow();
String html =
@@ -75,6 +75,7 @@ public class AboutModalWindow extends Window {
"</a></p>\n" +
"<div style=\"top-margin: 10px\">All rights reserved.</div>\n";
htmlFlow.setContents(html);
+ htmlFlow.setAutoHeight();
contentPane.addMember(htmlFlow);
HLayout bottomPanel = new HLayout();
@@ -92,5 +93,7 @@ public class AboutModalWindow extends Window {
}
});
bottomPanel.addMember(closeButton);
+
+ addItem(contentPane);
}
}
commit 74cb7e2033597e9cf51fea8e6240c72a89673f6e
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Wed Mar 3 16:53:19 2010 -0500
L&F tweaks
ResouceChildren subtab
Connection settings subtab
user preference access
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
index 4493de6..4b99b4f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
@@ -9,7 +9,9 @@
<inherits name='com.smartgwt.SmartGwt' />
<inherits name="com.smartgwt.tools.SmartGwtTools"/>
+<!--
<inherits name="com.smartclient.theme.graphite.Graphite"/>
+-->
<inherits name='ca.nanometrics.gflot.GFlot'/>
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadcrumbTrailPane.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadcrumbTrailPane.java
index c522ce2..a206c88 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadcrumbTrailPane.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadcrumbTrailPane.java
@@ -19,6 +19,7 @@
package org.rhq.enterprise.gui.coregui.client;
import com.google.gwt.user.client.Window;
+import com.smartgwt.client.types.BkgndRepeat;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.widgets.HTMLPane;
@@ -38,6 +39,8 @@ public class BreadcrumbTrailPane extends HTMLPane {
public BreadcrumbTrailPane() {
setHeight(28);
setBackgroundColor("#E6E3E3");
+ setBackgroundImage("[skin]images/ToolStrip/background.png");
+ setBackgroundRepeat(BkgndRepeat.REPEAT_X);
setPadding(5);
setOverflow(Overflow.CLIP_V);
}
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 02ccaee..ab5ecee 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
@@ -9,6 +9,7 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourcesView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceView;
import org.rhq.enterprise.gui.coregui.client.menu.MenuBarView;
import org.rhq.enterprise.gui.coregui.client.util.ErrorHandler;
+import org.rhq.enterprise.gui.coregui.client.util.preferences.UserPreferences;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
@@ -46,6 +47,8 @@ public class CoreGUI implements EntryPoint {
private static Subject sessionSubject;
//private static Subject fullSubject;
+ private static UserPreferences userPreferences;
+
private static ErrorHandler errorHandler = new ErrorHandler();
private static BreadcrumbTrailPane breadCrumbTrailPane;
@@ -102,6 +105,7 @@ public class CoreGUI implements EntryPoint {
public void onSuccess(Subject result) {
System.out.println("Logged in: " + result.getSessionId());
setSessionSubject(result);
+ userPreferences = new UserPreferences(result);
buildCoreUI();
@@ -236,6 +240,10 @@ public class CoreGUI implements EntryPoint {
return sessionSubject;
}
+ public static UserPreferences getUserPreferences() {
+ return userPreferences;
+ }
+
public static void setSessionSubject(Subject subject) {
GWTServiceLookup.registerSession(String.valueOf(subject.getSessionId()));
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
index 3f15169..9e5bda6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
@@ -84,6 +84,7 @@ public class RolesView extends VLayout {
gridHolder.addMember(listGrid);
ToolStrip toolStrip = new ToolStrip();
+ toolStrip.setWidth100();
toolStrip.setMembersMargin(15);
final IButton removeButton = new IButton("Remove");
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
index bf6d742..57ef82c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
@@ -86,6 +86,7 @@ public class UsersView extends VLayout {
gridHolder.addMember(listGrid);
ToolStrip toolStrip = new ToolStrip();
+ toolStrip.setWidth100();
toolStrip.setMembersMargin(15);
final IButton removeButton = new IButton("Remove");
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
index 21240cf..73e54a7 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
@@ -53,16 +53,16 @@ public class AboutModalWindow extends Window {
}
@Override
- protected void onDraw() {
+ protected void onInit() {
+ super.onInit();
+
// NOTE: super.onDraw() is what will add the header bar to the Window, so we have to add our own content
// after it's called, otherwise the header bar end up below our content...
- super.onDraw();
VLayout contentPane = new VLayout();
contentPane.setPadding(15);
contentPane.setAlign(VerticalAlignment.TOP);
- addMember(contentPane);
-
+
HTMLFlow htmlFlow = new HTMLFlow();
String html =
"<span class=\"DisplaySubhead\">\n" +
@@ -92,5 +92,9 @@ public class AboutModalWindow extends Window {
}
});
bottomPanel.addMember(closeButton);
+
+
+
+ addItem(contentPane);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
index 2e15b68..204bcfb 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
@@ -61,6 +61,7 @@ public class SubTabLayout extends VLayout {
buttonBar.setBackgroundColor("grey");
buttonBar.setWidth100();
buttonBar.setBorder(null);
+ buttonBar.setMembersMargin(30);
addMember(buttonBar);
@@ -78,6 +79,7 @@ public class SubTabLayout extends VLayout {
button.setActionType(SelectionType.RADIO);
button.setRadioGroup("subtabs");
button.setBorder(null);
+ button.setAutoFit(true);
button.setBaseStyle("SubTabButton");
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 647b072..294bda1 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
@@ -83,7 +83,14 @@ public class ResourceDatasource extends RPCDataSource {
ResourceCriteria criteria = new ResourceCriteria();
criteria.setPageControl(getPageControl(request));
- criteria.addFilterName(this.query);
+
+ if (request.getCriteria().getValues().get("parentId") != null) {
+ criteria.addFilterParentResourceId(Integer.parseInt((String) request.getCriteria().getValues().get("parentId")));
+ }
+
+ if (request.getCriteria().getValues().get("name") != null) {
+ criteria.addFilterName((String) request.getCriteria().getValues().get("name"));
+ }
resourceService.findResourcesByCriteria(criteria, new AsyncCallback<PageList<Resource>>() {
public void onFailure(Throwable caught) {
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 8a6b60f..2857cb0 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
@@ -68,7 +68,20 @@ public class ResourceSearchView extends VLayout {
private ArrayList<ResourceSelectListener> selectListeners = new ArrayList<ResourceSelectListener>();
+ int parentResourceId;
+
+ /**
+ * A resource list of all resources in the system
+ */
public ResourceSearchView() {
+ this(null);
+ }
+
+ /**
+ * Resource list filtered by a given criteria
+ * @param parentResourceId
+ */
+ public ResourceSearchView(Criteria criteria) {
setWidth100();
setHeight100();
@@ -94,7 +107,11 @@ public class ResourceSearchView extends VLayout {
listGrid.setAutoFetchData(true);
listGrid.setAlternateRecordStyles(true);
// listGrid.setAutoFitData(Autofit.HORIZONTAL);
- listGrid.setCriteria(new Criteria("name", searchPanel.getValueAsString("query")));
+
+ if (criteria != null) {
+ listGrid.setInitialCriteria(criteria);
+ }
+
listGrid.setSelectionType(SelectionStyle.SIMPLE);
listGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
listGrid.setResizeFieldsInRealTime(true);
@@ -105,7 +122,7 @@ public class ResourceSearchView extends VLayout {
ListGridField nameField = new ListGridField("name", "Name", 250);
nameField.setCellFormatter(new CellFormatter() {
public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
- return "<a href=\"#Resource/" + listGridRecord.getAttribute("id") +"\">" + o + "</a>";
+ return "<a href=\"#Resource/" + listGridRecord.getAttribute("id") + "\">" + o + "</a>";
}
});
@@ -116,7 +133,6 @@ public class ResourceSearchView extends VLayout {
ListGridField categoryField = new ListGridField("category", "Category", 60);
-
ListGridField availabilityField = new ListGridField("currentAvailability", "Availability", 55);
availabilityField.setAlign(Alignment.CENTER);
listGrid.setFields(idField, nameField, descriptionField, typeNameField, pluginNameField, categoryField, availabilityField);
@@ -125,6 +141,8 @@ public class ResourceSearchView extends VLayout {
gridHolder.addMember(listGrid);
ToolStrip toolStrip = new ToolStrip();
+ toolStrip.setPadding(5);
+ toolStrip.setWidth100();
toolStrip.setMembersMargin(15);
final IButton removeButton = new IButton("Remove");
@@ -142,8 +160,6 @@ public class ResourceSearchView extends VLayout {
});
-
-
final Label tableInfo = new Label("Total: " + listGrid.getTotalRows());
tableInfo.setWrap(false);
@@ -156,20 +172,19 @@ public class ResourceSearchView extends VLayout {
listGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
public void onSelectionChanged(SelectionEvent selectionEvent) {
- int selectedCount = ((ListGrid)selectionEvent.getSource()).getSelection().length;
+ int selectedCount = ((ListGrid) selectionEvent.getSource()).getSelection().length;
tableInfo.setContents("Total: " + listGrid.getTotalRows() + " (" + selectedCount + " selected)");
removeButton.setDisabled(selectedCount == 0);
}
});
-
addMember(gridHolder);
listGrid.addDataArrivedHandler(new DataArrivedHandler() {
public void onDataArrived(DataArrivedEvent dataArrivedEvent) {
- int selectedCount = ((ListGrid)dataArrivedEvent.getSource()).getSelection().length;
+ int selectedCount = ((ListGrid) dataArrivedEvent.getSource()).getSelection().length;
tableInfo.setContents("Total: " + listGrid.getTotalRows() + " (" + selectedCount + " selected)");
}
});
@@ -177,9 +192,16 @@ public class ResourceSearchView extends VLayout {
searchBox.addKeyPressHandler(new KeyPressHandler() {
public void onKeyPress(KeyPressEvent event) {
- if (event.getCharacterValue() == KeyCodes.KEY_ENTER) {
+ if ((event.getCharacterValue() != null) && (event.getCharacterValue() == KeyCodes.KEY_ENTER)) {
datasource.setQuery((String) searchBox.getValue());
- Criteria c = new Criteria("name", (String) searchBox.getValue());
+
+ Criteria c = listGrid.getCriteria();
+ if (c == null) {
+ c = new Criteria();
+ }
+
+ c.addCriteria("name",(String) searchBox.getValue());
+
long start = System.currentTimeMillis();
listGrid.fetchData(c);
System.out.println("Loaded in: " + (System.currentTimeMillis() - start));
@@ -193,4 +215,15 @@ public class ResourceSearchView extends VLayout {
selectListeners.add(listener);
}
+
+ // -------- Static Utility loaders ------------
+
+
+ public static ResourceSearchView getChildrenOf(int resourceId) {
+ return new ResourceSearchView(new Criteria("parentId",String.valueOf(resourceId)));
+ }
+
+
+
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index 9c6d2ae..e1529ac 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -26,10 +26,12 @@ import org.rhq.enterprise.gui.coregui.client.components.SubTabLayout;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTab;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSet;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSearchView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.GraphListView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.types.Side;
import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.layout.VLayout;
@@ -61,7 +63,7 @@ public class ResourceDetailView extends VLayout implements ResourceSelectListene
private TwoLevelTabSet topTabSet;
- HTMLFlow title = new HTMLFlow();
+ private ResourceTitleBar titleBar;
public void setResource(Resource resource) {
this.resource = resource;
@@ -88,13 +90,13 @@ public class ResourceDetailView extends VLayout implements ResourceSelectListene
topTabSet.setEdgeSize(0);
summaryTab = new TwoLevelTab("Summary", "/images/icons/Service_up_16.png");
- summaryTab.registerSubTabs("Overview","Timeline");
+ summaryTab.registerSubTabs("Overview", "Timeline");
monitoringTab = new TwoLevelTab("Monitoring", "/images/icons/Monitor_grey_16.png");
- monitoringTab.registerSubTabs("Graphs","Tables","Traits","Availability","Schedules");
+ monitoringTab.registerSubTabs("Graphs", "Tables", "Traits", "Availability", "Schedules");
inventoryTab = new TwoLevelTab("Inventory", "/images/icons/Inventory_grey_16.png");
- inventoryTab.registerSubTabs("Children","Connection Settings");
+ inventoryTab.registerSubTabs("Children", "Connection Settings");
operationsTab = new TwoLevelTab("Operations", "/images/icons/Operation_grey_16.png");
operationsTab.registerSubTabs("History", "Scheduled");
@@ -111,8 +113,9 @@ public class ResourceDetailView extends VLayout implements ResourceSelectListene
topTabSet.setTabs(summaryTab, monitoringTab, inventoryTab, operationsTab, alertsTab, configurationTab, eventsTab, contentTab);
- title.setContents("Loading...");
- addMember(title);
+
+ titleBar = new ResourceTitleBar();
+ addMember(titleBar);
addMember(summaryPanel);
@@ -127,8 +130,7 @@ public class ResourceDetailView extends VLayout implements ResourceSelectListene
this.summaryView.onResourceSelected(resource);
- title.setContents("<h2>" + resource.getName() + "</h2>");
- title.markForRedraw();
+ titleBar.setResource(resource);
int selectedTab = topTabSet.getSelectedTabNumber();
@@ -145,6 +147,10 @@ public class ResourceDetailView extends VLayout implements ResourceSelectListene
monitoringTab.updateSubTab("Availability", new FullHTMLPane("/rhq/resource/monitor/availabilityHistory.xhtml?id=" + resource.getId()));
monitoringTab.updateSubTab("Schedules", new FullHTMLPane("/rhq/resource/monitor/schedules.xhtml?id=" + resource.getId()));
+
+ inventoryTab.updateSubTab("Children", ResourceSearchView.getChildrenOf(resource.getId()));
+ inventoryTab.updateSubTab("Connection Settings", new ConfigurationEditor(resource.getId(), resource.getResourceType().getId(), ConfigurationEditor.ConfigType.plugin));
+
configurationTab.updateSubTab("Current", new ConfigurationEditor(resource.getId(), resource.getResourceType().getId()));
@@ -176,7 +182,7 @@ public class ResourceDetailView extends VLayout implements ResourceSelectListene
topTabSet.enableTab(eventsTab);
}
- if (type.getPackageTypes() == null || type.getPackageTypes().isEmpty()) {
+ if (type.getPackageTypes() == null || type.getPackageTypes().isEmpty()) {
topTabSet.disableTab(contentTab);
} else {
topTabSet.enableTab(contentTab);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
new file mode 100644
index 0000000..c67846c
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
@@ -0,0 +1,94 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail;
+
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+
+import com.smartgwt.client.types.SelectionType;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.HTMLFlow;
+import com.smartgwt.client.widgets.IButton;
+import com.smartgwt.client.widgets.ImgButton;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.layout.HLayout;
+
+
+/**
+ * @author Greg Hinkle
+ */
+public class ResourceTitleBar extends HLayout {
+
+ Resource resource;
+ ImgButton favoriteButton;
+ HTMLFlow title = new HTMLFlow();
+ boolean favorite;
+
+ public static final String FAV_ICON = "Favorite_24_Selected.png";
+ public static final String NOT_FAV_ICON = "Favorite_24.png";
+
+
+ public ResourceTitleBar() {
+ super();
+ setWidth100();
+ setHeight(60);
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+
+ favoriteButton = new ImgButton();
+ favoriteButton.setSrc(NOT_FAV_ICON);
+ favoriteButton.setShowHover(false);
+ favoriteButton.setShowDownIcon(false);
+ favoriteButton.setShowRollOverIcon(false);
+ favoriteButton.setShowFocusedIcon(false);
+
+ favoriteButton.setActionType(SelectionType.CHECKBOX);
+ favoriteButton.setWidth(24);
+ favoriteButton.setHeight(24);
+
+ favoriteButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ favorite = !favorite;
+
+// favoriteButton.setIcon(favorite ? FAV_ICON : NOT_FAV_ICON);
+
+ }
+ });
+
+
+ addMember(title);
+ addMember(favoriteButton);
+ }
+
+ public void setResource(Resource resource) {
+ this.resource = resource;
+
+ title.setContents("<h2>" + resource.getName() + "</h2>");
+
+ favorite = CoreGUI.getUserPreferences().getFavoriteResources().contains(resource.getId());
+
+ markForRedraw();
+ }
+
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferences.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferences.java
new file mode 100644
index 0000000..93a7743
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferences.java
@@ -0,0 +1,95 @@
+/*
+ * 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.util.preferences;
+
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.configuration.Configuration;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * @author Greg Hinkle
+ */
+public class UserPreferences {
+
+
+ private Subject subject;
+
+ private Configuration userConfiguration;
+
+
+ protected static final String PREF_ITEM_DELIM = "|";
+
+ public static final String PREF_DASH_FAVORITE_RESOURCES = ".dashContent.resourcehealth.resources";
+
+
+ public UserPreferences(Subject subject) {
+ this.subject = subject;
+ subject.getUserConfiguration();
+ }
+
+
+
+
+
+
+
+ public List<Integer> getFavoriteResources() {
+ return getPreferenceAsIntegerList(PREF_DASH_FAVORITE_RESOURCES,PREF_ITEM_DELIM);
+ }
+
+
+
+ protected String getPreference(String name) {
+ return userConfiguration.getSimpleValue(name, null);
+ }
+
+ protected List<String> getPreferenceAsList(String key, String delimiter) {
+ String pref = null;
+ try {
+ pref = getPreference(key);
+ } catch (IllegalArgumentException e) {
+// log.debug("A user preference named '" + key + "' does not exist.");
+ }
+
+ return (pref != null) ? Arrays.asList(pref.split(delimiter)) : new ArrayList<String>();
+ }
+
+ protected List<Integer> getPreferenceAsIntegerList(String key, String delimiter) {
+ try {
+ List<String> value = getPreferenceAsList(key, delimiter);
+
+ List<Integer> result = new ArrayList<Integer>(value.size());
+ for (int i = 0; i < value.size(); i++) {
+ String trimmed = value.get(i).trim();
+ if (trimmed.length() > 0) {
+ result.add(Integer.valueOf(trimmed));
+ }
+ }
+
+ return result;
+ } catch (Exception e) {
+ return new ArrayList<Integer>();
+ }
+ }
+
+
+}
commit c318d414c4d1541b66d27d60ea7a14a81bacc653
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Wed Mar 3 14:06:47 2010 -0500
Experimenting with selenium testing
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java
index 525c8b7..58b3a05 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java
@@ -36,7 +36,6 @@ import ca.nanometrics.gflot.client.options.TickFormatter;
import org.rhq.core.domain.measurement.MeasurementConverterClient;
import org.rhq.core.domain.measurement.MeasurementDefinition;
-import org.rhq.core.domain.measurement.MeasurementUnits;
import org.rhq.core.domain.measurement.composite.MeasurementDataNumericHighLowComposite;
import com.google.gwt.i18n.client.DateTimeFormat;
@@ -45,6 +44,8 @@ import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.WidgetCanvas;
+import com.smartgwt.client.widgets.events.MouseOutEvent;
+import com.smartgwt.client.widgets.events.MouseOutHandler;
import com.smartgwt.client.widgets.layout.VLayout;
import java.util.Date;
@@ -80,8 +81,6 @@ public class SmallGraphView extends VLayout {
setHeight100();
setWidth100();
// setPadding(10);
-
-
}
public String getName() {
@@ -101,6 +100,16 @@ public class SmallGraphView extends VLayout {
@Override
+ protected void onDetach() {
+ super.onDetach(); // TODO: Implement this method.
+ }
+
+ @Override
+ protected void onUnload() {
+ super.onUnload(); // TODO: Implement this method.
+ }
+
+ @Override
public void parentResized() {
super.parentResized();
onDraw();
@@ -159,6 +168,12 @@ public class SmallGraphView extends VLayout {
}
}, false);
+ addMouseOutHandler(new MouseOutHandler() {
+ public void onMouseOut(MouseOutEvent mouseOutEvent) {
+ hoverLabel.animateHide(AnimationEffect.FADE);
+ }
+ });
+
hoverLabel.setOpacity(80);
hoverLabel.setWrap(false);
hoverLabel.setHeight(25);
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.html b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.html
index 5b78843..37fa7dc 100644
--- a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.html
+++ b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.html
@@ -5,7 +5,9 @@
<link rel="icon" type="image/png" href="/images/favicon.png" />
<link rel="apple-touch-icon" href="/images/favicon.png" />
- <script type="text/javascript">var isomorphicDir = "org.rhq.enterprise.gui.coregui.CoreGUI/sc/";
+ <script type="text/javascript">
+ document.globalObj = window;
+ var isomorphicDir = "org.rhq.enterprise.gui.coregui.CoreGUI/sc/";
</script>
commit 1fa0487a463841eb06b64cf226cd6ef338b14699
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Wed Mar 3 13:22:30 2010 -0500
upgrade SmartGWT from 2.0 to 2.1; switch to Graphite SmartGWT skin; fix a couple bugs in AdministrationView
diff --git a/modules/enterprise/gui/coregui/pom.xml b/modules/enterprise/gui/coregui/pom.xml
index f248a15..b0f49c3 100644
--- a/modules/enterprise/gui/coregui/pom.xml
+++ b/modules/enterprise/gui/coregui/pom.xml
@@ -66,8 +66,15 @@
<dependency>
<groupId>com.smartgwt</groupId>
<artifactId>smartgwt</artifactId>
- <version>2.0</version>
+ <version>2.1</version>
+ </dependency>
+ <!--
+ <dependency>
+ <groupId>com.smartgwt</groupId>
+ <artifactId>smartgwt-skins</artifactId>
+ <version>2.1</version>
</dependency>
+ -->
<!-- The graphing library -->
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
index 080f9b2..4493de6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
@@ -9,7 +9,10 @@
<inherits name='com.smartgwt.SmartGwt' />
<inherits name="com.smartgwt.tools.SmartGwtTools"/>
+ <inherits name="com.smartclient.theme.graphite.Graphite"/>
+
<inherits name='ca.nanometrics.gflot.GFlot'/>
+
<!--
<inherits name='com.google.gwt.widgetideas.WidgetIdeas'/>
-->
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 1e4e517..c1c321e 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
@@ -28,11 +28,9 @@ import org.rhq.enterprise.gui.coregui.client.admin.roles.RolesView;
import org.rhq.enterprise.gui.coregui.client.admin.users.UsersView;
import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
-import com.smartgwt.client.types.ContentsType;
import com.smartgwt.client.types.VisibilityMode;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
-import com.smartgwt.client.widgets.HTMLPane;
import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionEvent;
import com.smartgwt.client.widgets.layout.HLayout;
@@ -125,13 +123,18 @@ public class AdministrationView extends HLayout implements ViewRenderer {
securityTreeGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
public void onSelectionChanged(SelectionEvent selectionEvent) {
if (selectionEvent.getState()) {
+ Canvas content;
if (selectionEvent.getRecord() == manageUsersNode) {
- setContent(new UsersView());
+ content = new UsersView();
} else if (selectionEvent.getRecord() == manageRolesNode) {
- setContent(new RolesView());
+ content = new RolesView();
} else if (selectionEvent.getRecord() == manageGroups) {
- setContent(new RolesView());
+ content = new RolesView();
+ } else {
+ throw new IllegalStateException("Unknown record selected: " + selectionEvent.getRecord());
}
+ setContent(content);
+
for (TreeGrid treeGrid : treeGrids) {
if (treeGrid != securityTreeGrid) {
treeGrid.deselectAllRecords();
@@ -171,12 +174,7 @@ public class AdministrationView extends HLayout implements ViewRenderer {
mgmtClusterTreeGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
public void onSelectionChanged(SelectionEvent selectionEvent) {
if (selectionEvent.getState()) {
- HTMLPane pane = new HTMLPane();
- pane.setContentsType(ContentsType.PAGE);
- pane.setWidth100();
- pane.setHeight100();
-
- String url = null;
+ String url;
if (selectionEvent.getRecord() == manageServersNode) {
url = "/rhq/ha/listServers.xhtml";
} else if (selectionEvent.getRecord() == manageAgentsNode) {
@@ -185,9 +183,13 @@ public class AdministrationView extends HLayout implements ViewRenderer {
url = "/rhq/ha/listAffinityGroups.xhtml";
} else if (selectionEvent.getRecord() == managePartitionEventsNode) {
url = "/rhq/ha/listPartitionEvents.xhtml";
+ } else {
+ throw new IllegalStateException("Unknown record selected: " + selectionEvent.getRecord());
}
- pane.setContentsURL(url + "?nomenu=true");
+ url = addQueryStringParam(url, "nomenu=true");
+ FullHTMLPane pane = new FullHTMLPane(url);
setContent(pane);
+
for (TreeGrid treeGrid : treeGrids) {
if (treeGrid != mgmtClusterTreeGrid) {
treeGrid.deselectAllRecords();
@@ -221,17 +223,16 @@ public class AdministrationView extends HLayout implements ViewRenderer {
pluginsTreeGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
public void onSelectionChanged(SelectionEvent selectionEvent) {
if (selectionEvent.getState()) {
- HTMLPane pane = new HTMLPane();
- pane.setContentsType(ContentsType.PAGE);
- pane.setWidth100();
- pane.setHeight100();
-
String url = null;
if (selectionEvent.getRecord() == managePlugins) {
url = "/rhq/admin/plugin/plugin-list.xhtml";
+ } else {
+ throw new IllegalStateException("Unknown record selected: " + selectionEvent.getRecord());
}
- pane.setContentsURL(url + "?nomenu=true");
+ url = addQueryStringParam(url, "nomenu=true");
+ FullHTMLPane pane = new FullHTMLPane(url);
setContent(pane);
+
for (TreeGrid treeGrid : treeGrids) {
if (treeGrid != pluginsTreeGrid) {
treeGrid.deselectAllRecords();
@@ -282,10 +283,10 @@ public class AdministrationView extends HLayout implements ViewRenderer {
} else {
throw new IllegalStateException("Unknown record selected: " + selectionEvent.getRecord());
}
- url += "&nomenu=true";
-
+ url = addQueryStringParam(url, "nomenu=true");
FullHTMLPane pane = new FullHTMLPane(url);
setContent(pane);
+
for (TreeGrid treeGrid : treeGrids) {
if (treeGrid != systemConfigTreeGrid) {
treeGrid.deselectAllRecords();
@@ -362,4 +363,9 @@ public class AdministrationView extends HLayout implements ViewRenderer {
}
throw new UnknownViewException();
}
+
+ private static String addQueryStringParam(String url, String param) {
+ char separatorChar = (url.indexOf('?') == -1) ? '?' : '&';
+ return url + separatorChar + param;
+ }
}
commit 1b17bb43d3a34ee9233a55222e2b8e9a6b642c2d
Merge: e7db48a... 013f7b7...
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Wed Mar 3 08:42:46 2010 -0500
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
commit e7db48aeb91b95d7ecc8f03ba84ed04509b1fb9d
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Wed Mar 3 08:42:31 2010 -0500
add About box
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
new file mode 100644
index 0000000..21240cf
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
@@ -0,0 +1,96 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.components;
+
+import com.smartgwt.client.types.Overflow;
+import com.smartgwt.client.types.VerticalAlignment;
+import com.smartgwt.client.widgets.Button;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.HTMLFlow;
+import com.smartgwt.client.widgets.Window;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.layout.HLayout;
+import com.smartgwt.client.widgets.layout.VLayout;
+
+/**
+ * The "About RHQ" modal window.
+ *
+ * @author Ian Springer
+ */
+public class AboutModalWindow extends Window {
+ private static final String TITLE = "About RHQ";
+
+ public AboutModalWindow() {
+ super();
+
+ setTitle(TITLE);
+ setWidth(300);
+ setHeight(250);
+ setOverflow(Overflow.VISIBLE);
+ setShowMinimizeButton(false);
+ setIsModal(true);
+ setShowModalMask(true);
+ setCanDragResize(false);
+ setCanDragReposition(false);
+ centerInPage();
+ }
+
+ @Override
+ protected void onDraw() {
+ // NOTE: super.onDraw() is what will add the header bar to the Window, so we have to add our own content
+ // after it's called, otherwise the header bar end up below our content...
+ super.onDraw();
+
+ VLayout contentPane = new VLayout();
+ contentPane.setPadding(15);
+ contentPane.setAlign(VerticalAlignment.TOP);
+ addMember(contentPane);
+
+ HTMLFlow htmlFlow = new HTMLFlow();
+ String html =
+ "<span class=\"DisplaySubhead\">\n" +
+ " <a href=\"http://rhq-project.org/\" title=\"RHQ Homepage\" target=\"_blank\">RHQ</a>\n" +
+ "</span><br/>\n" +
+ "<span class=\"DisplayLabel\">Version: 3.0.0-SNAPSHOT</span><br/>\n" +
+ "<span class=\"DisplayLabel\">Build Number: 0</span>\n" +
+ "<p><a href=\"http://jboss.org/\" title=\"JBoss Homepage\">\n" +
+ " <img height=\"55\" alt=\"JBoss by Red Hat\" src=\"/images/jboss_logo.png\">\n" +
+ "</a></p>\n" +
+ "<div style=\"top-margin: 10px\">All rights reserved.</div>\n";
+ htmlFlow.setContents(html);
+ contentPane.addMember(htmlFlow);
+
+ HLayout bottomPanel = new HLayout();
+ contentPane.addMember(bottomPanel);
+ Canvas spacer = new Canvas();
+ spacer.setWidth("*");
+ bottomPanel.addMember(spacer);
+ Button closeButton = new Button("Close");
+ closeButton.setShowRollOver(true);
+ closeButton.setShowDown(true);
+ closeButton.setWidth("60");
+ closeButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent event) {
+ hide();
+ }
+ });
+ bottomPanel.addMember(closeButton);
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
index 90dcac4..b09fac8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
@@ -18,28 +18,14 @@
*/
package org.rhq.enterprise.gui.coregui.client.menu;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.DemoCanvas;
-import org.rhq.enterprise.gui.coregui.client.admin.AdministrationView;
-
-import com.google.gwt.user.client.ui.Anchor;
-import com.google.gwt.user.client.ui.ClickListener;
-import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Hyperlink;
-import com.google.gwt.user.client.ui.Widget;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.VerticalAlignment;
-import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.Img;
-import com.smartgwt.client.widgets.WidgetCanvas;
-import com.smartgwt.client.widgets.form.DynamicForm;
-import com.smartgwt.client.widgets.form.fields.LinkItem;
-import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
-import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.menu.Menu;
import com.smartgwt.client.widgets.menu.MenuBar;
-import com.smartgwt.client.widgets.menu.MenuItem;
+import org.rhq.enterprise.gui.coregui.client.components.AboutModalWindow;
import java.util.LinkedHashMap;
@@ -50,11 +36,11 @@ public class MenuBarView extends HLayout {
MenuBar menuBar;
-
LinkedHashMap<String, Menu> menus = new LinkedHashMap<String, Menu>();
- public MenuBarView() {
+ private AboutModalWindow aboutModalWindow;
+ public MenuBarView() {
setHeight(30);
setAlign(VerticalAlignment.BOTTOM);
setAlign(Alignment.LEFT);
@@ -68,7 +54,6 @@ public class MenuBarView extends HLayout {
icon.addItem(new MenuItem("Dashboard"));
menuBar.addMenus(new Menu[]{icon},0);
-
Menu overview = new Menu();
overview.setTitle("Applications");
overview.addItem(new MenuItem("Content Configuration"));
@@ -76,7 +61,6 @@ public class MenuBarView extends HLayout {
overview.addItem(new MenuItem("Administration"));
menuBar.addMenus(new Menu[]{overview},1);
-
Menu views = new Menu();
views.setTitle("Views");
views.addItem(new MenuItem("Problems"));
@@ -85,11 +69,8 @@ public class MenuBarView extends HLayout {
views.addItem(new MenuItem("Recent Administration"));
menuBar.addMenus(new Menu[]{views},2);
-
menuBar.setWidth100();
-
-
addChild(menuBar);
setWidth100();*/
}
@@ -101,7 +82,13 @@ public class MenuBarView extends HLayout {
setMembersMargin(20);
+ this.aboutModalWindow = new AboutModalWindow();
Img logo = new Img("RHQ.png", 100, 35);
+ logo.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
+ public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
+ MenuBarView.this.aboutModalWindow.show();
+ }
+ });
addMember(logo);
Hyperlink dashboardLink = new Hyperlink("Dashboard", "Dashboard");
@@ -120,14 +107,12 @@ public class MenuBarView extends HLayout {
Hyperlink bundlesLink = new Hyperlink("Bundles", "Bundles");
bundlesLink.setStylePrimaryName("TopSectionLink");
addMember(bundlesLink);
-
Hyperlink adminLink = new Hyperlink("Administration", "Administration");
adminLink.setStylePrimaryName("TopSectionLink");
addMember(adminLink);
-
-
+
//
// LinkItem demoLink = new LinkItem("Demo");
// demoLink.setShowTitle(false);
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css
index 4391f58..c873d70 100644
--- a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css
+++ b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css
@@ -133,6 +133,21 @@ a:hover {
}
+/* About Modal Window */
+.DisplayContent,.DisplayLabel {
+ font-size: 11px;
+}
+
+.DisplayLabel {
+ font-weight: bold;
+}
+
+.DisplaySubhead {
+ font-weight: bolder;
+ font-size: 16px;
+ color: #DE652D;
+}
+
.SubTabButton,
.SubTabButtonOver,
commit 013f7b7627edbe17d53ed90a049acfafa94844ac
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Mar 2 17:34:25 2010 -0500
New TwoLevelTab component supports the basics of tabs/subtabs (more to add around history navigation for this)
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
new file mode 100644
index 0000000..2e15b68
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
@@ -0,0 +1,147 @@
+/*
+ * 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.tab;
+
+import com.smartgwt.client.types.Overflow;
+import com.smartgwt.client.types.SelectionType;
+import com.smartgwt.client.widgets.Button;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.layout.VLayout;
+import com.smartgwt.client.widgets.toolbar.ToolStrip;
+
+import java.util.LinkedHashMap;
+
+/**
+ * @author Greg Hinkle
+ */
+public class SubTabLayout extends VLayout {
+
+ ToolStrip buttonBar;
+
+ LinkedHashMap<String, Canvas> subtabs = new LinkedHashMap<String, Canvas>();
+
+ Canvas currentlyDisplayed;
+ String currentlySelected;
+ int currentIndex = 0;
+
+ public SubTabLayout() {
+ super();
+ setOverflow(Overflow.AUTO);
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+ setWidth100();
+ setHeight100();
+ setMargin(0);
+ setPadding(0);
+
+
+ buttonBar = new ToolStrip();
+ buttonBar.setBackgroundColor("grey");
+ buttonBar.setWidth100();
+ buttonBar.setBorder(null);
+
+ addMember(buttonBar);
+
+
+ int i = 0;
+
+ for (final String title : subtabs.keySet()) {
+ if (currentlyDisplayed == null) {
+ currentlyDisplayed = subtabs.get(title);
+ }
+
+
+ Button button = new Button(title);
+ button.setShowRollOver(false);
+ button.setActionType(SelectionType.RADIO);
+ button.setRadioGroup("subtabs");
+ button.setBorder(null);
+
+ button.setBaseStyle("SubTabButton");
+
+// button.setStyleName("SubTabButton");
+// button.setStylePrimaryName("SubTabButton");
+
+ final Integer index = i++;
+
+ button.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ currentlySelected = title;
+ currentIndex = index;
+ draw(subtabs.get(title));
+ }
+ });
+
+ buttonBar.addMember(button);
+
+ }
+
+ // Initial settings
+ Button b = (Button) buttonBar.getMember(0);
+ b.select();
+ if (currentlyDisplayed != null) {
+ addMember(currentlyDisplayed);
+ }
+ }
+
+ public void updateSubTab(String title, Canvas canvas) {
+ subtabs.put(title, canvas);
+ if (isDrawn() && title.equals(currentlySelected)) {
+ draw(canvas);
+ }
+
+ }
+
+ private void draw(Canvas canvas) {
+ if (currentlyDisplayed != null) {
+ currentlyDisplayed.hide();
+// removeMember(currentlyDisplayed);
+ }
+ if (canvas != null) {
+ if (hasMember(canvas)) {
+ canvas.show();
+ } else {
+ if (!canvas.isCreated()) {
+ canvas.setOverflow(Overflow.SCROLL);
+ }
+ addMember(canvas);
+ markForRedraw();
+ }
+ currentlyDisplayed = canvas;
+ }
+ }
+
+
+ public void registerSubTab(String title, Canvas canvas) {
+ if (currentlySelected == null) {
+ currentlySelected = title;
+ }
+ subtabs.put(title, canvas);
+ }
+
+ public int getCurrentIndex() {
+ return currentIndex;
+ }
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java
new file mode 100644
index 0000000..7a44277
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java
@@ -0,0 +1,52 @@
+/*
+ * 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.tab;
+
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.tab.Tab;
+
+/**
+ * @author Greg Hinkle
+ */
+public class TwoLevelTab extends Tab {
+
+ private SubTabLayout layout;
+
+ public TwoLevelTab(String title, String icon) {
+ super(title, icon);
+
+ layout = new SubTabLayout();
+ }
+
+
+ public void updateSubTab(String tab, Canvas canvas) {
+ layout.updateSubTab(tab, canvas);
+ }
+
+ public void registerSubTabs(String... tabs) {
+ for (String tab :tabs) {
+ layout.registerSubTab(tab, null);
+ }
+ }
+
+ @Override
+ public Canvas getPane() {
+ return layout;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java
new file mode 100644
index 0000000..ba48226
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java
@@ -0,0 +1,43 @@
+/*
+ * 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.tab;
+
+import com.smartgwt.client.widgets.tab.Tab;
+import com.smartgwt.client.widgets.tab.TabSet;
+
+/**
+ * @author Greg Hinkle
+ */
+public class TwoLevelTabSet extends TabSet {
+
+
+ @Override
+ public void setTabs(Tab... tabs) {
+ super.setTabs(tabs);
+ for (Tab tab : tabs) {
+ TwoLevelTab tltab = (TwoLevelTab) tab;
+
+
+ updateTab(tab,tltab.getPane());
+
+ }
+
+ }
+}
+
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index 38f36a4..9c6d2ae 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -24,6 +24,8 @@ import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
import org.rhq.enterprise.gui.coregui.client.components.SimpleCollapsiblePanel;
import org.rhq.enterprise.gui.coregui.client.components.SubTabLayout;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
+import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTab;
+import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSet;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.GraphListView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
@@ -48,15 +50,16 @@ public class ResourceDetailView extends VLayout implements ResourceSelectListene
private SimpleCollapsiblePanel summaryPanel;
private ResourceSummaryView summaryView;
- private Tab summaryTab;
- private Tab monitoringTab;
- private Tab inventoryTab;
- private Tab operationsTab;
- private Tab alertsTab;
- private Tab configurationTab;
- private Tab eventsTab;
- private Tab contentTab;
- private TabSet topTabSet;
+ private TwoLevelTab summaryTab;
+ private TwoLevelTab monitoringTab;
+ private TwoLevelTab inventoryTab;
+ private TwoLevelTab operationsTab;
+ private TwoLevelTab alertsTab;
+ private TwoLevelTab configurationTab;
+ private TwoLevelTab eventsTab;
+ private TwoLevelTab contentTab;
+
+ private TwoLevelTabSet topTabSet;
HTMLFlow title = new HTMLFlow();
@@ -65,8 +68,8 @@ public class ResourceDetailView extends VLayout implements ResourceSelectListene
}
@Override
- protected void onInit() {
- super.onInit();
+ protected void onDraw() {
+ super.onDraw();
setWidth100();
setHeight100();
@@ -77,21 +80,34 @@ public class ResourceDetailView extends VLayout implements ResourceSelectListene
// The Tabs section
- topTabSet = new TabSet();
+ topTabSet = new TwoLevelTabSet();
topTabSet.setTabBarPosition(Side.TOP);
topTabSet.setWidth100();
topTabSet.setHeight100();
topTabSet.setEdgeMarginSize(0);
topTabSet.setEdgeSize(0);
- summaryTab = new Tab("Summary", "/images/icons/Service_up_16.png");
- monitoringTab = new Tab("Monitoring", "/images/icons/Monitor_grey_16.png");
- inventoryTab = new Tab("Inventory", "/images/icons/Inventory_grey_16.png");
- operationsTab = new Tab("Operations", "/images/icons/Operation_grey_16.png");
- alertsTab = new Tab("Alerts", "/images/icons/Alert_grey_16.png");
- configurationTab = new Tab("Configuration", "/images/icons/Configure_grey_16.png");
- eventsTab = new Tab("Events", "/images/icons/Events_grey_16.png");
- contentTab = new Tab("Content", "/images/icons/Content_grey_16.png");
+ summaryTab = new TwoLevelTab("Summary", "/images/icons/Service_up_16.png");
+ summaryTab.registerSubTabs("Overview","Timeline");
+
+ monitoringTab = new TwoLevelTab("Monitoring", "/images/icons/Monitor_grey_16.png");
+ monitoringTab.registerSubTabs("Graphs","Tables","Traits","Availability","Schedules");
+
+ inventoryTab = new TwoLevelTab("Inventory", "/images/icons/Inventory_grey_16.png");
+ inventoryTab.registerSubTabs("Children","Connection Settings");
+
+ operationsTab = new TwoLevelTab("Operations", "/images/icons/Operation_grey_16.png");
+ operationsTab.registerSubTabs("History", "Scheduled");
+
+ alertsTab = new TwoLevelTab("Alerts", "/images/icons/Alert_grey_16.png");
+ alertsTab.registerSubTabs("Alert History", "Alert Definitions");
+
+ configurationTab = new TwoLevelTab("Configuration", "/images/icons/Configure_grey_16.png");
+ configurationTab.registerSubTabs("Current", "History");
+
+ eventsTab = new TwoLevelTab("Events", "/images/icons/Events_grey_16.png");
+
+ contentTab = new TwoLevelTab("Content", "/images/icons/Content_grey_16.png");
topTabSet.setTabs(summaryTab, monitoringTab, inventoryTab, operationsTab, alertsTab, configurationTab, eventsTab, contentTab);
@@ -119,21 +135,19 @@ public class ResourceDetailView extends VLayout implements ResourceSelectListene
FullHTMLPane summaryPane = new FullHTMLPane("/rhq/resource/summary/overview-plain.xhtml?id=" + resource.getId());
FullHTMLPane timelinePane = new FullHTMLPane("/rhq/resource/summary/timeline-plain.xhtml?id=" + resource.getId());
- SubTabLayout summarySet = new SubTabLayout();
- summarySet.registerSubTab("Overview", summaryPane);
- summarySet.registerSubTab("Timeline", timelinePane);
+ summaryTab.updateSubTab("Overview", summaryPane);
+ summaryTab.updateSubTab("Timeline", timelinePane);
+
+
+ monitoringTab.updateSubTab("Graphs", new GraphListView(resource)); // new FullHTMLPane("/rhq/common/monitor/graphs.xhtml?id=" + resource.getId()));
+ monitoringTab.updateSubTab("Tables", new FullHTMLPane("/rhq/common/monitor/tables.xhtml?id=" + resource.getId()));
+ monitoringTab.updateSubTab("Traits", new FullHTMLPane("/rhq/resource/monitor/traits.xhtml?id=" + resource.getId()));
+ monitoringTab.updateSubTab("Availability", new FullHTMLPane("/rhq/resource/monitor/availabilityHistory.xhtml?id=" + resource.getId()));
+ monitoringTab.updateSubTab("Schedules", new FullHTMLPane("/rhq/resource/monitor/schedules.xhtml?id=" + resource.getId()));
- topTabSet.updateTab(summaryTab, summarySet);
- SubTabLayout monitoringSet = new SubTabLayout();
- monitoringSet.registerSubTab("Graphs", new GraphListView(resource)); // new FullHTMLPane("/rhq/common/monitor/graphs.xhtml?id=" + resource.getId()));
- monitoringSet.registerSubTab("Tables", new FullHTMLPane("/rhq/common/monitor/tables.xhtml?id=" + resource.getId()));
- monitoringSet.registerSubTab("Traits", new FullHTMLPane("/rhq/resource/monitor/traits.xhtml?id=" + resource.getId()));
- monitoringSet.registerSubTab("Availability", new FullHTMLPane("/rhq/resource/monitor/availabilityHistory.xhtml?id=" + resource.getId()));
- monitoringSet.registerSubTab("Schedules", new FullHTMLPane("/rhq/resource/monitor/schedules.xhtml?id=" + resource.getId()));
- topTabSet.updateTab(monitoringTab, monitoringSet);
+ configurationTab.updateSubTab("Current", new ConfigurationEditor(resource.getId(), resource.getResourceType().getId()));
- topTabSet.updateTab(configurationTab, new ConfigurationEditor(resource.getId(), resource.getResourceType().getId()));
topTabSet.setSelectedTab(selectedTab);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
index dce0409..fb13013 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
@@ -292,6 +292,10 @@ public class ResourceTreeView extends VLayout {
return null;
}
+ private void setRootResource(Resource rootResource) {
+ this.rootResource = rootResource;
+ }
+
public void setSelectedResource(final Resource selectedResource) {
this.selectedResource = selectedResource;
@@ -317,8 +321,7 @@ public class ResourceTreeView extends VLayout {
}
buildTree();
- ResourceTreeView.this.rootResource = root;
-
+ setRootResource(root);
ResourceTreeDatasource dataSource = new ResourceTreeDatasource(result);
treeGrid.setDataSource(dataSource);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
index 61a7267..63bcea4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
@@ -129,7 +129,7 @@ public class ResourceView extends HLayout implements ViewRenderer {
}
public View renderView(ViewId viewId, boolean lastNode) throws UnknownViewException {
- String parentPath = viewId.getParent().getPath();
+ String parentPath = viewId.getParent().getPath();
if (!parentPath.equals("Resource")) {
throw new UnknownViewException();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/GraphListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/GraphListView.java
index 2c3a254..1fbeee3 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/GraphListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/GraphListView.java
@@ -29,6 +29,7 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectLi
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.layout.VLayout;
@@ -51,6 +52,7 @@ public class GraphListView extends VLayout implements ResourceSelectListener {
public GraphListView(Resource resource) {
this.resource = resource;
+ setOverflow(Overflow.SCROLL);
}
commit bf8ccaad90117640f514d387b9df8a5422b601b7
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Mar 2 17:33:11 2010 -0500
Don't destroy root views when reselecting them
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 468dcea..745c4fc 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
@@ -163,7 +163,7 @@ public class CoreGUI implements EntryPoint {
// canvas.addChild(new AdministrationView()) ; //DemoCanvas());
- rootCanvas.draw();
+ rootCanvas.draw();
History.addValueChangeHandler(new ValueChangeHandler<String>() {
public void onValueChange(ValueChangeEvent<String> historyChangeEvent) {
@@ -265,7 +265,7 @@ public class CoreGUI implements EntryPoint {
public static void updateBreadCrumbDisplayName(ViewId viewId, String displayName) {
int index = -1;
for (ViewId current = viewId.getParent(); current != null; current = current.getParent()) {
- index++;
+ index++;
}
List<Breadcrumb> breadcrumbs = breadCrumbTrailPane.getBreadcrumbs();
if (index < breadcrumbs.size()) {
@@ -278,20 +278,29 @@ public class CoreGUI implements EntryPoint {
}
private class RootCanvas extends VLayout implements ViewRenderer {
+
+ ViewId currentViewId;
+ Canvas currentCanvas;
+
private RootCanvas() {
setWidth100(); // (1200);
setHeight100(); // (900);
}
public View renderView(ViewId viewId, boolean lastNode) throws UnknownViewException {
- String path = viewId.getPath();
- Canvas canvas = createContent(path);
- if (canvas == null) {
- throw new UnknownViewException();
+ if (!viewId.equals(currentViewId)) {
+ currentViewId = viewId;
+ String path = viewId.getPath();
+ Canvas canvas = createContent(path);
+ if (canvas == null) {
+ throw new UnknownViewException();
+ }
+ currentCanvas = canvas;
+ setContent(canvas);
}
- setContent(canvas);
- ViewRenderer descendantViewRender = (canvas instanceof ViewRenderer) ?
- (ViewRenderer)canvas : null;
+ ViewRenderer descendantViewRender = (currentCanvas instanceof ViewRenderer) ?
+ (ViewRenderer) currentCanvas : null;
+
return new View(viewId, descendantViewRender);
}
}
commit 604dd8ff69c821d192c447af81c7f6f3deb0a8e8
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Tue Mar 2 14:29:41 2010 -0500
use History.newItem(path) rather than History.newItem(path, true), since, when in prod mode, the latter appears to not call the history even listener as it should; add menu items in portal-war Overview menu that link to the new GWT GUI
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 468dcea..956b01b 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
@@ -259,7 +259,7 @@ public class CoreGUI implements EntryPoint {
}
public static void goTo(String path) {
- History.newItem(path, true);
+ History.newItem(path);
}
public static void updateBreadCrumbDisplayName(ViewId viewId, String displayName) {
diff --git a/modules/enterprise/server/plugins/perspectives/core/perspective/src/main/resources/META-INF/rhq-serverplugin.xml b/modules/enterprise/server/plugins/perspectives/core/perspective/src/main/resources/META-INF/rhq-serverplugin.xml
index 06c665b..07ea8e6 100644
--- a/modules/enterprise/server/plugins/perspectives/core/perspective/src/main/resources/META-INF/rhq-serverplugin.xml
+++ b/modules/enterprise/server/plugins/perspectives/core/perspective/src/main/resources/META-INF/rhq-serverplugin.xml
@@ -92,6 +92,23 @@
placement="after" />
</menu-item>
+ <menu-item
+ name="overview.gwtGui"
+ displayName="GWT GUI"
+ url="/coregui/CoreGUI.html#Resources">
+ <position
+ name="overview.dashboard"
+ placement="after" />
+ </menu-item>
+ <menu-item
+ name="overview.gwtGuiDevMode"
+ displayName="GWT GUI - Dev Mode"
+ url="/coregui/CoreGUI.html?gwt.codesvr=127.0.0.1:9997#Resources">
+ <position
+ name="overview.gwtGui"
+ placement="after" />
+ </menu-item>
+
<!-- Core Menu: Resources -->
<menu-item
name="resources.platforms"
commit 38af78cff487e16ec7b69d7197fbad3ed46137a2
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Tue Mar 2 13:15:28 2010 -0500
fix so #Resource/xxxxx URLs work again; remove parentView param from ViewRenderer.renderView() method; delete Presenter and Place classes
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 21a1f58..468dcea 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
@@ -48,7 +48,7 @@ public class CoreGUI implements EntryPoint {
private static ErrorHandler errorHandler = new ErrorHandler();
- private static BreadcrumbTrailPane breadCrumb;
+ private static BreadcrumbTrailPane breadCrumbTrailPane;
private static Canvas content;
@@ -145,9 +145,9 @@ public class CoreGUI implements EntryPoint {
rootCanvas.addMember(menuBarView);
- breadCrumb = new BreadcrumbTrailPane();
+ breadCrumbTrailPane = new BreadcrumbTrailPane();
- rootCanvas.addMember(breadCrumb);
+ rootCanvas.addMember(breadCrumbTrailPane);
DOM.setInnerHTML(RootPanel.get("Loading-Panel").getElement(), "");
@@ -186,7 +186,7 @@ public class CoreGUI implements EntryPoint {
}
ViewId viewId = new ViewId(viewIdName, parentView.getId());
boolean lastNode = (i == (viewIdNamesSize - 1));
- parentView = viewRenderer.renderView(viewId, parentView, lastNode);
+ parentView = viewRenderer.renderView(viewId, lastNode);
breadcrumbs.add(parentView.getBreadcrumb());
}
} catch (UnknownViewException e) {
@@ -194,35 +194,13 @@ public class CoreGUI implements EntryPoint {
// in the list. The breadcrumbs list will contain breadcrumbs for only the names that were
// recognized.
System.err.println(e.getMessage());
+ // TODO: Should we add a new token to the History to point to the valid location
+ // we ended up at?
}
System.out.println("Breadcrumbs: " + breadcrumbs);
- breadCrumb.setBreadcrumbs(breadcrumbs);
-
- /*breadCrumb.initialize(path);
- ArrayList<Place> trail = breadCrumb.getTrail();
-
- Place base = trail.get(0);
-
- if (content != null && content instanceof Presenter) {
- Presenter p = ((Presenter) content);
- if (!p.fireDisplay(base, trail.subList(1, trail.size()))) {
- Canvas c = createContent(base.getId());
- setContent(c);
-
- if (trail.size() >= 2 && c instanceof Presenter) {
- ((Presenter) c).fireDisplay(trail.get(0), trail.subList(1, trail.size()));
- }
- }
- } else {
- Canvas c = createContent(base.getId());
- setContent(c);
- if (trail.size() >= 2 && c instanceof Presenter) {
- ((Presenter) c).fireDisplay(trail.get(0), trail.subList(1, trail.size()));
- }
- }*/
-
- breadCrumb.refresh();
+ breadCrumbTrailPane.setBreadcrumbs(breadcrumbs);
+ breadCrumbTrailPane.refresh();
}
});
@@ -289,12 +267,12 @@ public class CoreGUI implements EntryPoint {
for (ViewId current = viewId.getParent(); current != null; current = current.getParent()) {
index++;
}
- List<Breadcrumb> breadcrumbs = breadCrumb.getBreadcrumbs();
+ List<Breadcrumb> breadcrumbs = breadCrumbTrailPane.getBreadcrumbs();
if (index < breadcrumbs.size()) {
Breadcrumb breadcrumb = breadcrumbs.get(index);
if (breadcrumb.getName().equals(viewId.getName())) {
breadcrumbs.set(index, new Breadcrumb(breadcrumb.getName(), displayName));
- breadCrumb.refresh();
+ breadCrumbTrailPane.refresh();
}
}
}
@@ -305,14 +283,16 @@ public class CoreGUI implements EntryPoint {
setHeight100(); // (900);
}
- public View renderView(ViewId viewId, View parentView, boolean lastNode) throws UnknownViewException {
+ public View renderView(ViewId viewId, boolean lastNode) throws UnknownViewException {
String path = viewId.getPath();
Canvas canvas = createContent(path);
if (canvas == null) {
throw new UnknownViewException();
}
setContent(canvas);
- return new View(viewId);
+ ViewRenderer descendantViewRender = (canvas instanceof ViewRenderer) ?
+ (ViewRenderer)canvas : null;
+ return new View(viewId, descendantViewRender);
}
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Presenter.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Presenter.java
deleted file mode 100644
index 84fa7e5..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Presenter.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client;
-
-import org.rhq.enterprise.gui.coregui.client.places.Place;
-
-import java.util.List;
-
-/**
- * @deprecated replaced by {@link ViewRenderer}
- *
- * @author Greg Hinkle
- */
-@Deprecated
-public interface Presenter {
-
- boolean fireDisplay(Place baseLocation, List<Place> subLocations);
-
- Place getPlace();
-
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewRenderer.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewRenderer.java
index d3f237f..8a9279a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewRenderer.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewRenderer.java
@@ -28,8 +28,7 @@ public interface ViewRenderer {
* TODO
*
* @param viewId
- *@param parentView @return
* @param lastNode @throws UnknownViewException
*/
- View renderView(ViewId viewId, View parentView, boolean lastNode) throws UnknownViewException;
+ View renderView(ViewId viewId, boolean lastNode) throws UnknownViewException;
}
\ No newline at end of file
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 90611b0..1e4e517 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
@@ -146,7 +146,6 @@ public class AdministrationView extends HLayout implements ViewRenderer {
return section;
}
-
private SectionStackSection buildManagementClusterSection() {
final SectionStackSection section = new SectionStackSection("Management Cluster");
section.setExpanded(true);
@@ -346,8 +345,8 @@ public class AdministrationView extends HLayout implements ViewRenderer {
}
- public View renderView(ViewId viewId, View parentView, boolean lastNode) throws UnknownViewException {
- String parentPath = parentView.getId().getPath();
+ public View renderView(ViewId viewId, boolean lastNode) throws UnknownViewException {
+ String parentPath = viewId.getParent().getPath();
if (parentPath.equals("Administration")) {
SectionStackSection stackSection = this.sectionStack.getSection(viewId.getName());
if (stackSection != null) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
index 8f71101..3f15169 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
@@ -18,18 +18,9 @@
*/
package org.rhq.enterprise.gui.coregui.client.admin.roles;
-import org.rhq.enterprise.gui.coregui.client.Presenter;
-import org.rhq.enterprise.gui.coregui.client.admin.users.UsersDataSource;
-import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
-import org.rhq.enterprise.gui.coregui.client.places.Place;
-
-import com.smartgwt.client.docs.CheckboxField;
import com.smartgwt.client.types.Autofit;
import com.smartgwt.client.types.ListGridFieldType;
import com.smartgwt.client.types.Overflow;
-import com.smartgwt.client.types.SelectionAppearance;
-import com.smartgwt.client.types.SelectionStyle;
-import com.smartgwt.client.types.VisibilityMode;
import com.smartgwt.client.util.BooleanCallback;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.IButton;
@@ -37,25 +28,18 @@ import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.Window;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
-import com.smartgwt.client.widgets.form.events.SubmitValuesEvent;
-import com.smartgwt.client.widgets.form.events.SubmitValuesHandler;
-import com.smartgwt.client.widgets.form.fields.CheckboxItem;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionEvent;
import com.smartgwt.client.widgets.layout.LayoutSpacer;
-import com.smartgwt.client.widgets.layout.SectionStack;
-import com.smartgwt.client.widgets.layout.SectionStackSection;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.toolbar.ToolStrip;
-import java.util.List;
-
/**
* @author Greg Hinkle
*/
-public class RolesView extends VLayout implements Presenter {
+public class RolesView extends VLayout {
@Override
@@ -185,17 +169,4 @@ public class RolesView extends VLayout implements Presenter {
editView.editNew();
}
-
- public boolean fireDisplay(Place base, List<Place> subLocations) {
- if (!getPlace().equals(base)) {
- return false;
- }
-
-
- return true;
- }
-
- public Place getPlace() {
- return new Place("Roles", "Manage Roles");
- }
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
index c2c0c6f..bf6d742 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
@@ -18,21 +18,10 @@
*/
package org.rhq.enterprise.gui.coregui.client.admin.users;
-import org.rhq.enterprise.gui.coregui.client.Presenter;
-import org.rhq.enterprise.gui.coregui.client.admin.roles.RoleEditView;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDatasource;
-import org.rhq.enterprise.gui.coregui.client.places.Place;
-
-import com.smartgwt.client.data.Criteria;
-import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.Autofit;
import com.smartgwt.client.types.ListGridFieldType;
-import com.smartgwt.client.types.SelectionAppearance;
-import com.smartgwt.client.types.SelectionStyle;
-import com.smartgwt.client.types.VisibilityMode;
import com.smartgwt.client.util.BooleanCallback;
import com.smartgwt.client.util.SC;
-import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.Window;
@@ -43,17 +32,14 @@ import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionEvent;
import com.smartgwt.client.widgets.layout.LayoutSpacer;
-import com.smartgwt.client.widgets.layout.SectionStack;
import com.smartgwt.client.widgets.layout.SectionStackSection;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.toolbar.ToolStrip;
-import java.util.List;
-
/**
* @author Greg Hinkle
*/
-public class UsersView extends VLayout implements Presenter {
+public class UsersView extends VLayout {
public UsersView() {
super();
@@ -185,18 +171,4 @@ public class UsersView extends VLayout implements Presenter {
editView.editNew();
}
-
- public boolean fireDisplay(Place base, List<Place> subLocations) {
- if (!base.equals(getPlace())) {
- return false;
- }
- if (subLocations.size() > 0) {
- int userId = Integer.parseInt(subLocations.get(0).getId());
- }
- return true;
- }
-
- public Place getPlace() {
- return new Place("users", "Users");
- }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
index ba07d21..7764657 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardView.java
@@ -18,11 +18,9 @@
*/
package org.rhq.enterprise.gui.coregui.client.dashboard;
-import org.rhq.enterprise.gui.coregui.client.Presenter;
import org.rhq.enterprise.gui.coregui.client.admin.roles.RolesView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSearchView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.SmallGraphView;
-import org.rhq.enterprise.gui.coregui.client.places.Place;
import com.google.gwt.user.client.Random;
import com.smartgwt.client.widgets.AnimationCallback;
@@ -33,12 +31,10 @@ import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.layout.LayoutSpacer;
import com.smartgwt.client.widgets.layout.VLayout;
-import java.util.List;
-
/**
* @author Greg Hinkle
*/
-public class DashboardView extends VLayout implements Presenter {
+public class DashboardView extends VLayout {
private static String[] colors = new String[]{
"FF6600", "808000", "008000", "008080", "0000FF", "666699",
@@ -187,12 +183,4 @@ public class DashboardView extends VLayout implements Presenter {
addMember(portalLayout);
}
-
- public boolean fireDisplay(Place base, List<Place> subLocations) {
- return base.equals(getPlace());
- }
-
- public Place getPlace() {
- return new Place("Dashboard", "Dashboard");
- }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourcesView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourcesView.java
index 38fa943..bb6c190 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourcesView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourcesView.java
@@ -20,10 +20,8 @@ package org.rhq.enterprise.gui.coregui.client.inventory.resource;
import org.rhq.core.domain.resource.Resource;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.Presenter;
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.places.Place;
import com.smartgwt.client.types.ContentsType;
import com.smartgwt.client.types.VisibilityMode;
@@ -38,12 +36,10 @@ import com.smartgwt.client.widgets.tree.Tree;
import com.smartgwt.client.widgets.tree.TreeGrid;
import com.smartgwt.client.widgets.tree.TreeNode;
-import java.util.List;
-
/**
* @author Greg Hinkle
*/
-public class ResourcesView extends HLayout implements Presenter {
+public class ResourcesView extends HLayout {
public static final String VIEW_PATH = "Resources";
@@ -173,11 +169,9 @@ public class ResourcesView extends HLayout implements Presenter {
section.addItem(treeGrid);
-
return section;
}
-
public void setContent(Canvas newContent) {
if (contentCanvas.getChildren().length > 0)
contentCanvas.getChildren()[0].destroy();
@@ -186,25 +180,4 @@ public class ResourcesView extends HLayout implements Presenter {
contentCanvas.addChild(newContent);
contentCanvas.draw();
}
-
-
- public boolean fireDisplay(Place base, List<Place> subLocations) {
- if (base.equals(getPlace())) {
- if (!subLocations.isEmpty()) {
- if (contentCanvas.getChildren().length > 0) {
- Canvas element = contentCanvas.getChildren()[0];
- if (element instanceof Presenter) {
- ((Presenter) element).fireDisplay(subLocations.get(0), subLocations.subList(1, subLocations.size() - 1));
- }
- }
- }
- return true;
- }
- return false;
- }
-
-
- public Place getPlace() {
- return new Place("Resources", "Resources");
- }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index f97a858..38f36a4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -20,7 +20,6 @@ package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.enterprise.gui.coregui.client.Presenter;
import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
import org.rhq.enterprise.gui.coregui.client.components.SimpleCollapsiblePanel;
import org.rhq.enterprise.gui.coregui.client.components.SubTabLayout;
@@ -28,7 +27,6 @@ import org.rhq.enterprise.gui.coregui.client.components.configuration.Configurat
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.GraphListView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
-import org.rhq.enterprise.gui.coregui.client.places.Place;
import com.smartgwt.client.types.Side;
import com.smartgwt.client.widgets.HTMLFlow;
@@ -37,14 +35,13 @@ import com.smartgwt.client.widgets.tab.Tab;
import com.smartgwt.client.widgets.tab.TabSet;
import java.util.EnumSet;
-import java.util.List;
/**
* Right panel of the resource view.
*
* @author Greg Hinkle
*/
-public class ResourceDetailView extends VLayout implements Presenter, ResourceSelectListener {
+public class ResourceDetailView extends VLayout implements ResourceSelectListener {
private Resource resource;
@@ -61,7 +58,6 @@ public class ResourceDetailView extends VLayout implements Presenter, ResourceSe
private Tab contentTab;
private TabSet topTabSet;
-
HTMLFlow title = new HTMLFlow();
public void setResource(Resource resource) {
@@ -109,19 +105,6 @@ public class ResourceDetailView extends VLayout implements Presenter, ResourceSe
// CoreGUI.addBreadCrumb(getPlace());
}
-
- public boolean fireDisplay(Place base, List<Place> subLocations) {
- if (base.equals(getPlace())) {
-
- }
- return true;
-
- }
-
- public Place getPlace() {
- return new Place(String.valueOf(resource.getId()), resource.getName());
- }
-
public void onResourceSelected(Resource resource) {
this.resource = resource;
@@ -142,10 +125,6 @@ public class ResourceDetailView extends VLayout implements Presenter, ResourceSe
topTabSet.updateTab(summaryTab, summarySet);
-
-
-
-
SubTabLayout monitoringSet = new SubTabLayout();
monitoringSet.registerSubTab("Graphs", new GraphListView(resource)); // new FullHTMLPane("/rhq/common/monitor/graphs.xhtml?id=" + resource.getId()));
monitoringSet.registerSubTab("Tables", new FullHTMLPane("/rhq/common/monitor/tables.xhtml?id=" + resource.getId()));
@@ -154,7 +133,6 @@ public class ResourceDetailView extends VLayout implements Presenter, ResourceSe
monitoringSet.registerSubTab("Schedules", new FullHTMLPane("/rhq/resource/monitor/schedules.xhtml?id=" + resource.getId()));
topTabSet.updateTab(monitoringTab, monitoringSet);
-
topTabSet.updateTab(configurationTab, new ConfigurationEditor(resource.getId(), resource.getResourceType().getId()));
topTabSet.setSelectedTab(selectedTab);
@@ -203,7 +181,6 @@ public class ResourceDetailView extends VLayout implements Presenter, ResourceSe
}
});
-
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
index 738fa17..61a7267 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
@@ -27,23 +27,19 @@ import org.rhq.enterprise.gui.coregui.client.View;
import org.rhq.enterprise.gui.coregui.client.ViewId;
import org.rhq.enterprise.gui.coregui.client.ViewRenderer;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.Presenter;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourcesView;
-import org.rhq.enterprise.gui.coregui.client.places.Place;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.layout.HLayout;
-import java.util.List;
-
/**
* @author Greg Hinkle
*/
-public class ResourceView extends HLayout implements Presenter, ViewRenderer {
+public class ResourceView extends HLayout implements ViewRenderer {
private Canvas contentCanvas;
@@ -90,27 +86,6 @@ public class ResourceView extends HLayout implements Presenter, ViewRenderer {
}
- public boolean fireDisplay(Place base, List<Place> subLocations) {
- try {
- if (base.equals(getPlace())) {
- if (subLocations.size() > 0) {
- Place resourcePlace = subLocations.get(0);
- int resourceId = Integer.parseInt(resourcePlace.getId());
-
- if (selectedResource == null || selectedResource.getId() != resourceId) {
- setSelectedResource(resourceId, null);
- }
- }
- return true;
- } else {
- return false;
- }
- } catch (Exception e) {
- return false;
- }
- }
-
-
public void setSelectedResource(final int resourceId, final ViewId viewId) {
Resource resource = this.treeView.getResource(resourceId);
if (resource != null) {
@@ -140,19 +115,12 @@ public class ResourceView extends HLayout implements Presenter, ViewRenderer {
}
}
-
public void setSelectedResource(Resource resource) {
this.selectedResource = resource;
this.treeView.setSelectedResource(resource);
this.detailView.onResourceSelected(resource);
}
-
- public Place getPlace() {
-// return new Place("Resource[" + selectedResource.getId() + "]", "Resource - " + selectedResource.getName());
- return new Place("Resource", "Resource");
- }
-
public void setContent(Canvas newContent) {
if (contentCanvas.getChildren().length > 0)
contentCanvas.getChildren()[0].destroy();
@@ -160,8 +128,8 @@ public class ResourceView extends HLayout implements Presenter, ViewRenderer {
contentCanvas.draw();
}
- public View renderView(ViewId viewId, View parentView, boolean lastNode) throws UnknownViewException {
- String parentPath = parentView.getId().getPath();
+ public View renderView(ViewId viewId, boolean lastNode) throws UnknownViewException {
+ String parentPath = viewId.getParent().getPath();
if (!parentPath.equals("Resource")) {
throw new UnknownViewException();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/places/Place.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/places/Place.java
deleted file mode 100644
index cb63156..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/places/Place.java
+++ /dev/null
@@ -1,66 +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.places;
-
-/**
- * @deprecated replaced by {@link org.rhq.enterprise.gui.coregui.client.View} and
- * {@link org.rhq.enterprise.gui.coregui.client.Breadcrumb}
- *
- * @author Greg Hinkle
- */
-@Deprecated
-public class Place {
-
- private String id;
- private String name;
-
- public Place(String id, String name) {
- this.id = id;
- this.name = name;
- }
-
- public String getId() {
- return id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- Place place = (Place) o;
-
- if (!id.equals(place.id)) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- return id.hashCode();
- }
-}
commit d62a17440a0d3d45d446a0f598ab564cf74308f3
Merge: cdfa722... 5c46dee...
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Tue Mar 2 12:02:59 2010 -0500
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
commit cdfa722fbe40368c3b47b9525df970c2d95714a7
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Tue Mar 2 12:02:40 2010 -0500
replace getCanvas() method in View class with getDescendantViewRenderer() and refactor callers; add javadoc to View class
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 67881a4..21a1f58 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
@@ -36,7 +36,6 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
-
/**
* @author Greg Hinkle
*/
@@ -174,14 +173,16 @@ public class CoreGUI implements EntryPoint {
List<String> viewIdNames = path.equals("") ? Collections.<String>emptyList() : Arrays.asList(path.split("\\/"));
View parentView = CoreGUI.this.rootView;
- ViewRenderer viewRenderer = (ViewRenderer)parentView.getCanvas();
+ ViewRenderer viewRenderer = parentView.getDescendantViewRenderer();
List<Breadcrumb> breadcrumbs = new ArrayList<Breadcrumb>(viewIdNames.size());
try {
for (int i = 0, viewIdNamesSize = viewIdNames.size(); i < viewIdNamesSize; i++) {
String viewIdName = viewIdNames.get(i);
- Canvas parentCanvas = parentView.getCanvas();
- if (parentCanvas != null && parentCanvas instanceof ViewRenderer) {
- viewRenderer = (ViewRenderer) parentCanvas;
+ // See if the parent view provided a view renderer to use for its descendants. If not,
+ // continue using the view renderer that renderer the parent view.
+ ViewRenderer descendantViewRenderer = parentView.getDescendantViewRenderer();
+ if (descendantViewRenderer != null) {
+ viewRenderer = descendantViewRenderer;
}
ViewId viewId = new ViewId(viewIdName, parentView.getId());
boolean lastNode = (i == (viewIdNamesSize - 1));
@@ -311,7 +312,7 @@ public class CoreGUI implements EntryPoint {
throw new UnknownViewException();
}
setContent(canvas);
- return new View(viewId, canvas);
+ return new View(viewId);
}
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/View.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/View.java
index 6c37f97..ae1a10b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/View.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/View.java
@@ -18,31 +18,33 @@
*/
package org.rhq.enterprise.gui.coregui.client;
-import com.smartgwt.client.widgets.Canvas;
-
/**
- * TODO
+ * A view in the GUI which has a bookmarkable URL. The fragment portion of the URL is what
+ * uniquely identifies the view. View id's are hierarchical and are therefore represented as
+ * paths (e.g. "http://localhost:7080/coregui/CoreGUI.html#Resource/10001" is a view URL,
+ * whose view id is "Resource/1001". The URL of its parent view is
+ * ""http://localhost:7080/coregui/CoreGUI.html#Resource", whose view id is "Resource".
*
* @author Ian Springer
*/
public class View {
private ViewId id;
- private Canvas canvas;
+ private ViewRenderer descendantViewRender;
private Breadcrumb breadcrumb;
public View(ViewId id) {
this(id, null, null);
}
- public View(ViewId id, Canvas canvas) {
- this(id, canvas, null);
+ public View(ViewId id, ViewRenderer descendantViewRender) {
+ this(id, descendantViewRender, null);
}
public View(ViewId id, Breadcrumb breadcrumb) {
this(id, null, breadcrumb);
}
- public View(ViewId id, Canvas canvas, Breadcrumb breadcrumb) {
+ public View(ViewId id, ViewRenderer descendantViewRender, Breadcrumb breadcrumb) {
if (id == null) {
throw new IllegalArgumentException("Id is null.");
}
@@ -55,27 +57,48 @@ public class View {
} else {
this.breadcrumb = new Breadcrumb(id.getName());
}
- this.canvas = canvas;
+ this.descendantViewRender = descendantViewRender;
}
+ /**
+ * Returns this view's unique id.
+ *
+ * @return this view's unique id
+ */
public ViewId getId() {
- return id;
+ return this.id;
}
- public Canvas getCanvas() {
- return canvas;
+ /**
+ * Returns a view renderer that should be used to render descendant views, or null if
+ * the view renderer that rendered this view should also be used to render descendant
+ * views.
+ *
+ * @return a view renderer that should be used to render descendant views, or null if
+ * the view renderer that rendered this view should also be used to render
+ * descendant views
+ */
+ public ViewRenderer getDescendantViewRenderer() {
+ return this.descendantViewRender;
}
+ /**
+ * Returns info that should be used when rendering a breadcrumb for this view in the
+ * breadcrumb trail, or null if a default breadcrumb should be used.
+ *
+ * @return info that should be used when rendering a breadcrumb for this view in the
+ * breadcrumb trail, or null if a default breadcrumb should be used
+ */
public Breadcrumb getBreadcrumb() {
- return breadcrumb;
+ return this.breadcrumb;
}
@Override
public String toString() {
return "View[" +
"id=" + id +
- ", canvas=" + canvas +
- ", breadcrumb=" + breadcrumb +
+ ", descendantViewRender=" + this.descendantViewRender +
+ ", breadcrumb=" + this.breadcrumb +
']';
}
}
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 18673f1..90611b0 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
@@ -357,10 +357,9 @@ public class AdministrationView extends HLayout implements ViewRenderer {
}
return new View(viewId, new Breadcrumb(viewId.getName(), false));
}
- } else if (parentPath.equals("Administration/Reports")) {
- FullHTMLPane pane = new FullHTMLPane(IFRAME_URL_INVENTORY_SUMMARY_REPORT);
- setContent(pane);
- return new View(viewId, pane);
+ } else if (parentPath.equals("Administration/Reports")) {
+ setContent(new FullHTMLPane(IFRAME_URL_INVENTORY_SUMMARY_REPORT));
+ return new View(viewId);
}
throw new UnknownViewException();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
index 048db28..738fa17 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
@@ -178,6 +178,6 @@ public class ResourceView extends HLayout implements Presenter, ViewRenderer {
// Use "..." as temporary display name for breadcrumb. If the Resource is fetched successfully, the display name
// will be updated to be the Resource's name.
Breadcrumb breadcrumb = new Breadcrumb(viewId.getName(), "...");
- return new View(viewId, this.detailView, breadcrumb);
+ return new View(viewId, breadcrumb);
}
}
commit 5c46dee953d93d777bac6ce77ff2b6a9e0eda0f6
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Mar 2 10:51:14 2010 -0500
Moving to avoid conflict
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Breadcrumb.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Breadcrumb.java
index 3abac57..1e647c5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Breadcrumb.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Breadcrumb.java
@@ -107,7 +107,7 @@ public class Breadcrumb {
}
} else {
first = false;
- }
+ }
displayName.append(currentChar);
}
return displayName.toString();
commit 698cc9d42a499d76f4c0b54ffe51d4bc77c6557e
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Mar 2 10:43:00 2010 -0500
Group Definition list view, datasource and server side access
Subject create, update, delete *
Role create, update, delete *
* Not completed. Still working on grid to grid copy/drag to assign component
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/authz/Role.java b/modules/core/domain/src/main/java/org/rhq/core/domain/authz/Role.java
index 482fa08..039f356 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/authz/Role.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/authz/Role.java
@@ -137,7 +137,7 @@ public class Role implements Serializable {
@OneToMany(mappedBy = "role", cascade = javax.persistence.CascadeType.ALL)
private Set<RoleNotification> roleNotifications = new HashSet<RoleNotification>();
- protected Role() {
+ public Role() {
fsystem = Boolean.FALSE;
}
diff --git a/modules/enterprise/gui/coregui/pom.xml b/modules/enterprise/gui/coregui/pom.xml
index 0e72200..f248a15 100644
--- a/modules/enterprise/gui/coregui/pom.xml
+++ b/modules/enterprise/gui/coregui/pom.xml
@@ -180,7 +180,7 @@
<inplace>false</inplace>
<logLevel>INFO</logLevel>
<runTarget>http://localhost:7080/coregui/CoreGUI.html</runTarget>
- <extraJvmArgs>-Xmx512m</extraJvmArgs>
+ <extraJvmArgs>-Xms1024M -Xmx1024M -XX:PermSize=256M -XX:MaxPermSize=256M</extraJvmArgs>
<localWorkers>2</localWorkers>
<draftCompile>true</draftCompile>
<buildOutputDirectory>target/gwtclasses</buildOutputDirectory>
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java
new file mode 100644
index 0000000..e5579cf
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java
@@ -0,0 +1,36 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client;
+
+import com.smartgwt.client.widgets.layout.HLayout;
+
+/**
+ * @author Greg Hinkle
+ */
+public class Footer extends HLayout {
+
+ public Footer() {
+ super();
+
+ setHeight(100);
+ setBackgroundColor("gray");
+
+
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/PermissionEditorView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/PermissionEditorView.java
index c788499..123e47d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/PermissionEditorView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/PermissionEditorView.java
@@ -23,6 +23,8 @@ import org.rhq.enterprise.gui.coregui.client.components.SimpleCollapsiblePanel;
import com.smartgwt.client.widgets.Canvas;
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.CanvasItem;
import com.smartgwt.client.widgets.form.fields.CheckboxItem;
import com.smartgwt.client.widgets.form.fields.FormItem;
@@ -30,6 +32,7 @@ import com.smartgwt.client.widgets.form.fields.HeaderItem;
import java.util.ArrayList;
import java.util.EnumSet;
+import java.util.HashSet;
import java.util.Set;
/**
@@ -38,14 +41,16 @@ import java.util.Set;
public class PermissionEditorView extends CanvasItem {
- private Set<Permission> permissions = EnumSet.noneOf(Permission.class);
+ private Set<Permission> selectedPermissions = EnumSet.noneOf(Permission.class);
+
+ private DynamicForm parentForm;
private DynamicForm form;
+
public PermissionEditorView(String name, String title) {
super(name, title);
-
setCanvas(new SimpleCollapsiblePanel("Permissions", buildForm()));
}
@@ -90,10 +95,37 @@ public class PermissionEditorView extends CanvasItem {
public void setPermissions(Set<Permission> permissions) {
- this.permissions = permissions;
+ this.selectedPermissions = permissions;
for (Permission p : Permission.values()) {
form.setValue(p.name(), permissions.contains(p));
}
+
+ form.addItemChangedHandler(new ItemChangedHandler() {
+ public void onItemChanged(ItemChangedEvent itemChangedEvent) {
+ for (Permission p : Permission.values()) {
+ if ((Boolean)form.getValue(p.name())) {
+ selectedPermissions.add(p);
+ } else {
+ selectedPermissions.remove(p);
+ }
+ }
+ }
+ });
+
form.markForRedraw();
}
+
+ public Set<Permission> getPermissions() {
+ return selectedPermissions;
+ }
+
+ @Override
+ public Object getValue() {
+ System.out.println("Finding Value");
+ return super.getValue();
+ }
+
+ public void setParentForm(DynamicForm parentForm) {
+ this.parentForm = parentForm;
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java
index 56b913e..a6b8bd8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java
@@ -19,24 +19,34 @@
package org.rhq.enterprise.gui.coregui.client.admin.roles;
import org.rhq.core.domain.authz.Permission;
+import org.rhq.core.domain.authz.Role;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.components.HeaderLabel;
+import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.data.Record;
+import com.smartgwt.client.types.DSOperationType;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.events.SubmitValuesEvent;
+import com.smartgwt.client.widgets.form.events.SubmitValuesHandler;
import com.smartgwt.client.widgets.form.fields.CanvasItem;
import com.smartgwt.client.widgets.form.fields.FormItem;
import com.smartgwt.client.widgets.form.fields.ResetItem;
import com.smartgwt.client.widgets.form.fields.SectionItem;
import com.smartgwt.client.widgets.form.fields.SubmitItem;
import com.smartgwt.client.widgets.form.fields.TextItem;
+import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
+import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.layout.VLayout;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.Set;
/**
@@ -44,6 +54,9 @@ import java.util.Set;
*/
public class RoleEditView extends VLayout {
+ private Role roleBeingEdited;
+
+
private Label message = new Label("Select a role to edit...");
@@ -81,29 +94,45 @@ public class RoleEditView extends VLayout {
editCanvas.addMember(editLabel);
form = new DynamicForm();
- form.setAutoFetchData(true);
form.setDataSource(RolesDataSource.getInstance());
- TextItem idItem = new TextItem("id","Id");
+ TextItem idItem = new TextItem("id", "Id");
- TextItem nameItem = new TextItem("name","Name");
+ TextItem nameItem = new TextItem("name", "Name");
permissionEditorItem = new PermissionEditorView("permissionEditor", "Permissions");
permissionEditorItem.setShowTitle(false);
permissionEditorItem.setColSpan(2);
- assignedGroupEditorItem = new RoleGroupsEditorItem("assignedGroups","Assigned Groups");
+
+ assignedGroupEditorItem = new RoleGroupsEditorItem("assignedGroups", "Assigned Groups");
assignedGroupEditorItem.setShowTitle(false);
assignedGroupEditorItem.setColSpan(2);
+ SubmitItem saveButton = new SubmitItem("save", "Save");
+
+ saveButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ save();
+ System.out.println("Save is done");
+ }
+ });
+
+ form.addSubmitValuesHandler(new SubmitValuesHandler() {
+ public void onSubmitValues(SubmitValuesEvent submitValuesEvent) {
+ Object o = submitValuesEvent.getValues();
+ System.out.println("O: " + o);
+ }
+ });
+
+
form.setItems(
idItem,
nameItem,
permissionEditorItem,
assignedGroupEditorItem,
- new SubmitItem("save", "Save"), new ResetItem("reset", "Reset"));
-
+ saveButton, new ResetItem("reset", "Reset"));
editCanvas.addMember(form);
@@ -111,11 +140,13 @@ public class RoleEditView extends VLayout {
}
public void editRecord(Record record) {
+ this.roleBeingEdited = (Role) record.getAttributeAsObject("entity");
message.hide();
editCanvas.show();
try {
- editLabel.setContents("Editing user " + record.getAttribute("name"));
+ editLabel.setContents("Editing Role " + record.getAttribute("name"));
form.editRecord(record);
+ permissionEditorItem.setParentForm(form);
permissionEditorItem.setPermissions((Set<Permission>) record.getAttributeAsObject("permissions"));
assignedGroupEditorItem.setGroups((PageList<ResourceGroup>) record.getAttributeAsObject("assignedGroups"));
} catch (Throwable t) {
@@ -130,4 +161,38 @@ public class RoleEditView extends VLayout {
markForRedraw();
}
+
+ public void editNew() {
+ ListGridRecord r = new ListGridRecord();
+ Role newRole = new Role(null); // todo make default constructor public
+ RolesDataSource.copyValues(newRole, r);
+ editRecord(r);
+ form.setSaveOperationType(DSOperationType.ADD);
+
+//
+// HashSet<Permission> permissions = new HashSet<Permission>();
+// HashMap values = new HashMap();
+// values.put("permssions", permissions);
+//
+// form.editNewRecord();
+
+
+ editLabel.setContents("Create Role");
+// permissionEditorItem.setPermissions(permissions);
+
+// message.hide();
+// editCanvas.show();
+ }
+
+
+
+ public void save() {
+ System.out.println("Saving role");
+ form.saveData();
+ }
+
+
+ public DynamicForm getForm() {
+ return form;
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleGroupsEditorItem.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleGroupsEditorItem.java
index 1a2da36..6eff51e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleGroupsEditorItem.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleGroupsEditorItem.java
@@ -53,7 +53,7 @@ public class RoleGroupsEditorItem extends CanvasItem {
HLayout layout = new HLayout(10);
availableGroupGrid = new ListGrid();
- availableGroupGrid.setMinHeight(350);
+ availableGroupGrid.setHeight(350);
availableGroupGrid.setCanDragRecordsOut(true);
availableGroupGrid.setDragTrackerMode(DragTrackerMode.RECORD);
availableGroupGrid.setDragDataAction(DragDataAction.MOVE);
@@ -79,7 +79,7 @@ public class RoleGroupsEditorItem extends CanvasItem {
layout.addMember(moveButtonStack);
assignedGroupGrid = new ListGrid();
- assignedGroupGrid.setMinHeight(350);
+ assignedGroupGrid.setHeight(350);
assignedGroupGrid.setCanDragRecordsOut(true);
assignedGroupGrid.setCanAcceptDroppedRecords(true);
assignedGroupGrid.setDataSource(new ResourceGroupsDataSource());
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java
index bf100c0..6f8894b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java
@@ -18,23 +18,36 @@
*/
package org.rhq.enterprise.gui.coregui.client.admin.roles;
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.authz.Role;
import org.rhq.core.domain.criteria.RoleCriteria;
+import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.RoleGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.data.DataSourceField;
+import com.smartgwt.client.data.Record;
import com.smartgwt.client.data.fields.DataSourceIntegerField;
import com.smartgwt.client.data.fields.DataSourceTextField;
import com.smartgwt.client.rpc.RPCResponse;
+import com.smartgwt.client.util.JSOHelper;
import com.smartgwt.client.widgets.grid.ListGridRecord;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
/**
* @author Greg Hinkle
*/
@@ -71,6 +84,10 @@ public class RolesDataSource extends RPCDataSource {
RoleCriteria criteria = new RoleCriteria();
criteria.setPageControl(getPageControl(request));
+ Integer subjectId = request.getCriteria().getAttributeAsInt("subjectId");
+ if (subjectId != null) {
+ criteria.setFilterSubjectId(subjectId);
+ }
criteria.setFetchResourceGroups(true);
criteria.setFetchPermissions(true);
@@ -92,12 +109,8 @@ public class RolesDataSource extends RPCDataSource {
for (int x = 0; x < result.size(); x++) {
Role role = result.get(x);
ListGridRecord record = new ListGridRecord();
- record.setAttribute("id", role.getId());
- record.setAttribute("name", role.getName());
- record.setAttribute("resourceGroups", role.getResourceGroups());
- record.setAttribute("permissions", role.getPermissions());
- record.setAttribute("subjects", role.getSubjects());
+ copyValues(role, record);
records[x] = record;
}
@@ -109,4 +122,118 @@ public class RolesDataSource extends RPCDataSource {
});
}
+
+ @Override
+ protected void executeAdd(final DSRequest request, final DSResponse response) {
+ JavaScriptObject data = request.getData();
+ final ListGridRecord rec = new ListGridRecord(data);
+ Role newRole = new Role("newName"); // TODO GH: Make default constructor public
+ copyValues(rec, newRole);
+
+ roleService.createRole(newRole, new AsyncCallback<Role>() {
+ public void onFailure(Throwable caught) {
+ Map<String,String> errors = new HashMap<String, String>();
+ errors.put("name", "A role with name already exists.");
+ response.setErrors(errors);
+// CoreGUI.getErrorHandler().handleError("Failed to create role",caught);
+ response.setStatus(RPCResponse.STATUS_VALIDATION_ERROR);
+ processResponse(request.getRequestId(), response);
+ }
+
+ public void onSuccess(Role result) {
+ ListGridRecord record = new ListGridRecord();
+ copyValues(result,record);
+ response.setData(new Record[] {record});
+ processResponse(request.getRequestId(),response);
+ }
+ });
+
+ }
+
+ @Override
+ protected void executeUpdate(final DSRequest request, final DSResponse response) {
+ final ListGridRecord record = getEditedRecord(request);
+ System.out.println("Updating record: " + record);
+ Role updatedRole = new Role("foo");
+ copyValues(record, updatedRole);
+ roleService.updateRole(updatedRole, new AsyncCallback<Role>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to update role",caught);
+ }
+
+ public void onSuccess(Role result) {
+ System.out.println("Role Updated");
+ copyValues(result,record);
+ response.setData(new Record[] {record});
+ processResponse(request.getRequestId(),response);
+ }
+ });
+ }
+
+ @Override
+ protected void executeRemove(final DSRequest request, final DSResponse response) {
+ JavaScriptObject data = request.getData();
+ final ListGridRecord rec = new ListGridRecord(data);
+ Role newRole = new Role("newName"); // TODO GH: Make default constructor public
+ copyValues(rec, newRole);
+
+ roleService.removeRoles(new Integer[]{newRole.getId()}, new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to delete role",caught);
+ }
+
+ public void onSuccess(Void result) {
+ System.out.println("Role deleted");
+ response.setData(new Record[]{rec});
+ processResponse(request.getRequestId(), response);
+ }
+ });
+
+ }
+
+ private static void copyValues(ListGridRecord from, Role to) {
+ to.setId(from.getAttributeAsInt("id"));
+ to.setName(from.getAttributeAsString("name"));
+// to.setDate (from.getAttributeAsDate ("date"));
+// from.getAttributeAsIntArray("resourceGroups");
+ to.setResourceGroups((Set<ResourceGroup>) from.getAttributeAsObject("resourceGroups"));
+ to.setPermissions((Set<Permission>) from.getAttributeAsObject("permissions"));
+ to.setSubjects((Set<Subject>) from.getAttributeAsObject("subjects"));
+ }
+
+ static void copyValues(Role from, ListGridRecord to) {
+ to.setAttribute("id", from.getId());
+ to.setAttribute("name", from.getName());
+ to.setAttribute("resourceGroups", from.getResourceGroups());
+ to.setAttribute("permissions", from.getPermissions());
+ to.setAttribute("subjects", from.getSubjects());
+
+ to.setAttribute("entity", from);
+ }
+
+
+ private ListGridRecord getEditedRecord(DSRequest request) {
+ // Retrieving values before edit
+ JavaScriptObject oldValues = request.getAttributeAsJavaScriptObject("oldValues");
+ // Creating new record for combining old values with changes
+ ListGridRecord newRecord = new ListGridRecord();
+ // Copying properties from old record
+ JSOHelper.apply(oldValues, newRecord.getJsObj());
+ // Retrieving changed values
+ JavaScriptObject data = request.getData();
+ // Apply changes
+ JSOHelper.apply(data, newRecord.getJsObj());
+ return newRecord;
+ }
+
+ public static ListGridRecord[] buildRecords(Collection<Role> roles) {
+ ListGridRecord[] roleRecords = new ListGridRecord[roles.size()];
+ int i = 0;
+ for (Role role : roles) {
+ ListGridRecord record = new ListGridRecord();
+ copyValues(role, record);
+ roleRecords[i++] = record;
+ }
+ return roleRecords;
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
index bc88bad..8f71101 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
@@ -20,6 +20,7 @@ package org.rhq.enterprise.gui.coregui.client.admin.roles;
import org.rhq.enterprise.gui.coregui.client.Presenter;
import org.rhq.enterprise.gui.coregui.client.admin.users.UsersDataSource;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
import org.rhq.enterprise.gui.coregui.client.places.Place;
import com.smartgwt.client.docs.CheckboxField;
@@ -33,8 +34,11 @@ import com.smartgwt.client.util.BooleanCallback;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.Label;
+import com.smartgwt.client.widgets.Window;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.form.events.SubmitValuesEvent;
+import com.smartgwt.client.widgets.form.events.SubmitValuesHandler;
import com.smartgwt.client.widgets.form.fields.CheckboxItem;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
@@ -88,7 +92,7 @@ public class RolesView extends VLayout implements Presenter {
idField.setType(ListGridFieldType.INTEGER);
- ListGridField nameField = new ListGridField("username", "Name");
+ ListGridField nameField = new ListGridField("name", "Name");
listGrid.setFields(idField, nameField);
@@ -104,8 +108,10 @@ public class RolesView extends VLayout implements Presenter {
public void onClick(ClickEvent clickEvent) {
SC.confirm("Are you sure you want to delete " + listGrid.getSelection().length + " resources?",
new BooleanCallback() {
- public void execute(Boolean aBoolean) {
-
+ public void execute(Boolean accepted) {
+ if (accepted) {
+ listGrid.removeSelectedData();
+ }
}
}
);
@@ -113,10 +119,20 @@ public class RolesView extends VLayout implements Presenter {
});
+
+ final IButton addButton = new IButton("Add Role");
+ addButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ createRole();
+ }
+ });
+
+
final Label tableInfo = new Label("Total: " + listGrid.getTotalRows());
tableInfo.setWrap(false);
toolStrip.addMember(removeButton);
+ toolStrip.addMember(addButton);
toolStrip.addMember(new LayoutSpacer());
toolStrip.addMember(tableInfo);
@@ -148,8 +164,26 @@ public class RolesView extends VLayout implements Presenter {
}
}
});
+ }
+
+
+
+ public void createRole() {
+
+ RoleEditView editView = new RoleEditView();
+ final Window roleEditor = new Window();
+ roleEditor.setTitle("Create Role");
+ roleEditor.setWidth(800);
+ roleEditor.setHeight(800);
+ roleEditor.setIsModal(true);
+ roleEditor.setShowModalMask(true);
+ roleEditor.setCanDragResize(true);
+ roleEditor.centerInPage();
+ roleEditor.addItem(editView);
+ roleEditor.show();
+ editView.editNew();
}
public boolean fireDisplay(Place base, List<Place> subLocations) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/SubjectRolesEditorItem.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/SubjectRolesEditorItem.java
new file mode 100644
index 0000000..ab61eac
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/SubjectRolesEditorItem.java
@@ -0,0 +1,126 @@
+/*
+ * 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.admin.users;
+
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.authz.Role;
+import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.admin.roles.RolesDataSource;
+import org.rhq.enterprise.gui.coregui.client.components.SimpleCollapsiblePanel;
+import org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupsDataSource;
+
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.types.DSOperationType;
+import com.smartgwt.client.types.DragDataAction;
+import com.smartgwt.client.types.DragTrackerMode;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.TransferImgButton;
+import com.smartgwt.client.widgets.form.fields.CanvasItem;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.layout.HLayout;
+import com.smartgwt.client.widgets.layout.VStack;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author Greg Hinkle
+ */
+public class SubjectRolesEditorItem extends CanvasItem {
+
+ private Set<Role> assignedRoles;
+ private Subject subject;
+
+ private ListGrid assignedRoleGrid;
+ private ListGrid availableRoleGrid;
+
+ public SubjectRolesEditorItem(String name, String title) {
+ super(name, title);
+ setShowTitle(false);
+ setColSpan(2);
+ setWidth("90%");
+ setCanvas(new SimpleCollapsiblePanel("Assigned Roles", buildForm()));
+ }
+
+ private Canvas buildForm() {
+
+ HLayout layout = new HLayout(10);
+
+ availableRoleGrid = new ListGrid();
+ availableRoleGrid.setHeight(250);
+ availableRoleGrid.setCanDragRecordsOut(true);
+ availableRoleGrid.setDragTrackerMode(DragTrackerMode.RECORD);
+ availableRoleGrid.setDragDataAction(DragDataAction.MOVE);
+ availableRoleGrid.setDataSource(RolesDataSource.getInstance());
+ availableRoleGrid.setAutoFetchData(true);
+ availableRoleGrid.setFields(new ListGridField("id", 50), new ListGridField("name"));
+
+ layout.addMember(availableRoleGrid);
+
+ VStack moveButtonStack = new VStack(10);
+ moveButtonStack.setWidth(50);
+
+ TransferImgButton addButton = new TransferImgButton(TransferImgButton.RIGHT);
+ TransferImgButton removeButton = new TransferImgButton(TransferImgButton.LEFT);
+ TransferImgButton addAllButton = new TransferImgButton(TransferImgButton.RIGHT_ALL);
+ TransferImgButton removeAllButton = new TransferImgButton(TransferImgButton.LEFT_ALL);
+
+ moveButtonStack.addMember(addButton);
+ moveButtonStack.addMember(removeButton);
+ moveButtonStack.addMember(addAllButton);
+ moveButtonStack.addMember(removeAllButton);
+
+ layout.addMember(moveButtonStack);
+
+ assignedRoleGrid = new ListGrid();
+ assignedRoleGrid.setHeight(250);
+ assignedRoleGrid.setCanDragRecordsOut(true);
+ assignedRoleGrid.setCanAcceptDroppedRecords(true);
+// assignedRoleGrid.setDataSource(RolesDataSource.getInstance());
+ assignedRoleGrid.setFields(new ListGridField("id", 50), new ListGridField("name"));
+
+ layout.addMember(assignedRoleGrid);
+
+
+ return layout;
+ }
+
+ public void setRoles(Set<Role> assignedRoles) {
+ this.assignedRoles = assignedRoles;
+
+ assignedRoleGrid.setData(RolesDataSource.buildRecords(assignedRoles));
+ }
+
+ public Set<Role> getRoles() {
+ return this.assignedRoles;
+ }
+
+ public Subject getSubject() {
+ return subject;
+ }
+
+ public void setSubject(Subject subject) {
+ this.subject = subject;
+ if (subject != null) {
+ assignedRoleGrid.setCriteria(new Criteria("subjectId", String.valueOf(subject.getId())));
+ }
+ }
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
index 83e599d..1b74870 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
@@ -19,30 +19,52 @@
package org.rhq.enterprise.gui.coregui.client.admin.users;
import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.authz.Role;
+import org.rhq.enterprise.gui.coregui.client.admin.roles.RolesDataSource;
import org.rhq.enterprise.gui.coregui.client.admin.roles.RolesView;
+import org.rhq.enterprise.gui.coregui.client.components.HeaderLabel;
import com.google.gwt.user.client.ui.Widget;
import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.data.Record;
import com.smartgwt.client.docs.FormLayout;
+import com.smartgwt.client.types.DSOperationType;
import com.smartgwt.client.types.VisibilityMode;
import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.BooleanItem;
import com.smartgwt.client.widgets.form.fields.FormItem;
+import com.smartgwt.client.widgets.form.fields.ResetItem;
import com.smartgwt.client.widgets.form.fields.SectionItem;
+import com.smartgwt.client.widgets.form.fields.SubmitItem;
import com.smartgwt.client.widgets.form.fields.TextItem;
+import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
+import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.layout.HLayout;
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;
+import java.util.Set;
/**
* @author Greg Hinkle
*/
-public class UserEditView extends HLayout {
+public class UserEditView extends VLayout {
- private Subject subject;
- private Subject originalSubject;
+ private Label message = new Label("Select a user to edit...");
+
+ private SubjectRolesEditorItem subjectRolesEditorItem ;
+
+ private VLayout editCanvas;
+ private HeaderLabel editLabel;
+ private DynamicForm form;
+
+ private Subject subject;
@Override
protected void onInit() {
@@ -51,26 +73,16 @@ public class UserEditView extends HLayout {
setWidth100();
setHeight100();
- SectionStack sectionStack = new SectionStack();
- sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE);
+ buildSubjectEditor();
+ form.hide();
- sectionStack.setWidth100();
- sectionStack.setHeight100();
-
- SectionStackSection subjectSection = new SectionStackSection("Edit Subject");
- subjectSection.setItems(buildSubjectEditor());
-
- SectionStackSection roleSection = new SectionStackSection("Edit Subject's Roles");
- roleSection.setItems(buildRoleEditor());
-
- sectionStack.setSections(subjectSection, roleSection );
-
- addMember(buildSubjectEditor());
+ addMember(message);
+ addMember(form);
}
private Canvas buildSubjectEditor() {
- DynamicForm form = new DynamicForm();
+ form = new DynamicForm();
form.setWidth100();
SectionItem userEditSection = new SectionItem("userEditSection", "Edit User");
@@ -96,19 +108,28 @@ public class UserEditView extends HLayout {
UsersDataSource ds = UsersDataSource.getInstance();
- ds.filterData(new Criteria("id", "2"));
form.setUseAllDataSourceFields(true);
form.setDataSource(ds);
- form.setAutoFetchData(true);
- form.getField("id").hide();
+ subjectRolesEditorItem = new SubjectRolesEditorItem("rolesEditor","Assigned Roles");
+
- FormItem[] forms = form.getFields();
+ SubmitItem saveButton = new SubmitItem("save", "Save");
-
+ saveButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ form.saveData();
+ System.out.println("Save is done");
+ }
+ });
+ TextItem departmentItem = new TextItem("department");
+
+ ResetItem resetButton = new ResetItem("reset", "Reset");
+
+ form.setItems(departmentItem, subjectRolesEditorItem, saveButton, resetButton);
return form;
@@ -116,12 +137,38 @@ public class UserEditView extends HLayout {
}
- private Canvas buildRoleEditor() {
+ public void editRecord(Record record) {
+ form.getDataSource().getField("username").setCanEdit(false);
+
+ subjectRolesEditorItem.setSubject((Subject) record.getAttributeAsObject("entity"));
+ subjectRolesEditorItem.setRoles((Set<Role>) record.getAttributeAsObject("roles"));
+
+ try {
+ form.editRecord(record);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ message.hide();
+ form.show();
+ form.setSaveOperationType(DSOperationType.UPDATE);
+
+ }
+
+ public void editNone() {
+ message.show();
+ form.hide();
+ }
+
+ public void editNew() {
+ form.getDataSource().getField("username").setCanEdit(true);
- RolesView rv = new RolesView();
- // set subject criteria
- return rv;
+ ListGridRecord r = new ListGridRecord();
+ Subject subject = new Subject(); // todo make default constructor public
+ UsersDataSource.copyValues(subject, r);
+ editRecord(r);
+ form.setSaveOperationType(DSOperationType.ADD);
}
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java
index dcf7199..8e88e06 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java
@@ -19,23 +19,38 @@
package org.rhq.enterprise.gui.coregui.client.admin.users;
import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.authz.Permission;
+import org.rhq.core.domain.authz.Role;
import org.rhq.core.domain.criteria.SubjectCriteria;
+import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.SubjectGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
import com.google.gwt.core.client.GWT;
+import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.data.DataSourceField;
+import com.smartgwt.client.data.FieldValueExtractor;
+import com.smartgwt.client.data.Record;
import com.smartgwt.client.data.fields.DataSourceIntegerField;
import com.smartgwt.client.data.fields.DataSourceTextField;
import com.smartgwt.client.rpc.RPCResponse;
+import com.smartgwt.client.types.FieldType;
+import com.smartgwt.client.util.JSOHelper;
+import com.smartgwt.client.widgets.form.validator.LengthRangeValidator;
+import com.smartgwt.client.widgets.form.validator.MatchesFieldValidator;
import com.smartgwt.client.widgets.grid.ListGridRecord;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
/**
* @author Greg Hinkle
*/
@@ -53,21 +68,40 @@ public class UsersDataSource extends RPCDataSource {
return INSTANCE;
}
-
+
protected UsersDataSource() {
super("Users");
DataSourceField idDataField = new DataSourceIntegerField("id", "ID");
idDataField.setPrimaryKey(true);
+ idDataField.setCanEdit(false);
+
+ DataSourceTextField usernameField = new DataSourceTextField("username", "User Name", 100, true);
+ usernameField.setRequired(true);
+
+ DataSourceTextField firstName = new DataSourceTextField("firstName", "First Name", 100, true);
+
+ DataSourceTextField lastName = new DataSourceTextField("lastName", "Last Name", 100, true);
+
+ DataSourceTextField password = new DataSourceTextField("password", "Password", 100, false);
+ password.setType(FieldType.PASSWORD);
+
+ LengthRangeValidator passwordValdidator = new LengthRangeValidator();
+ passwordValdidator.setMin(6);
+ passwordValdidator.setErrorMessage("Password must be at least six characters");
+ password.setValidators(passwordValdidator);
+
- DataSourceTextField usernameField = new DataSourceTextField("username", "User Name");
- usernameField.setCanEdit(false);
+ DataSourceTextField passwordVerify = new DataSourceTextField("passwordVerify", "Verify", 100, false);
+ passwordVerify.setType(FieldType.PASSWORD);
- DataSourceTextField firstName = new DataSourceTextField("firstName", "First Name");
+ MatchesFieldValidator passwordsEqualValidator = new MatchesFieldValidator();
+ passwordsEqualValidator.setOtherField("password");
+ passwordsEqualValidator.setErrorMessage("Passwords do not match");
+ passwordVerify.setValidators(passwordsEqualValidator);
- DataSourceTextField lastName = new DataSourceTextField("lastName", "Last Name");
- DataSourceTextField email = new DataSourceTextField("email", "Email Address");
+ DataSourceTextField email = new DataSourceTextField("email", "Email Address", 100, true);
DataSourceTextField phone = new DataSourceTextField("phoneNumber", "Phone");
@@ -79,13 +113,13 @@ public class UsersDataSource extends RPCDataSource {
roles.setMultiple(true);
- setFields(idDataField, usernameField, firstName, lastName, phone, email, department);
+ setFields(idDataField, usernameField, firstName, lastName, password, passwordVerify, phone, email, department);
}
public void executeFetch(final DSRequest request, final DSResponse response) {
final long start = System.currentTimeMillis();
-
+
SubjectCriteria criteria = new SubjectCriteria();
criteria.setPageControl(getPageControl(request));
@@ -101,26 +135,155 @@ public class UsersDataSource extends RPCDataSource {
System.out.println("Data retrieved in: " + (System.currentTimeMillis() - start));
ListGridRecord[] records = new ListGridRecord[result.size()];
- for (int x=0; x<result.size(); x++) {
- Subject res = result.get(x);
+ for (int x = 0; x < result.size(); x++) {
+ Subject subject = result.get(x);
ListGridRecord record = new ListGridRecord();
- record.setAttribute("id",res.getId());
- record.setAttribute("username",res.getName());
-// record.setAttribute("name",res.getFirstName() + " " + res.getLastName());
- record.setAttribute("firstName", res.getFirstName());
- record.setAttribute("lastName", res.getLastName());
- record.setAttribute("factive", res.getFactive());
- record.setAttribute("department", res.getDepartment());
- record.setAttribute("phoneNumber", res.getPhoneNumber());
- record.setAttribute("email",res.getEmailAddress());
+
+ copyValues(subject, record);
+
records[x] = record;
}
response.setData(records);
- response.setTotalRows(result.getTotalSize()); // for paging to work we have to specify size of full result set
+ response.setTotalRows(result.getTotalSize()); // for paging to work we have to specify size of full result set
processResponse(request.getRequestId(), response);
}
});
}
+
+
+ @Override
+ protected void executeAdd(final DSRequest request, final DSResponse response) {
+ JavaScriptObject data = request.getData();
+ final ListGridRecord rec = new ListGridRecord(data);
+ Subject newSubject = new Subject();
+ copyValues(rec, newSubject);
+
+ subjectService.createSubject(newSubject, new AsyncCallback<Subject>() {
+ public void onFailure(Throwable caught) {
+ // TODO better exceptions so we can set the right validation errors
+ Map<String,String> errors = new HashMap<String, String>();
+ errors.put("username", "A user with this name already exists.");
+ response.setErrors(errors);
+// CoreGUI.getErrorHandler().handleError("Failed to create role",caught);
+ response.setStatus(RPCResponse.STATUS_VALIDATION_ERROR);
+ processResponse(request.getRequestId(), response);
+ }
+
+ public void onSuccess(Subject result) {
+ ListGridRecord record = new ListGridRecord();
+ copyValues(result,record);
+ response.setData(new Record[] {record});
+ processResponse(request.getRequestId(),response);
+ }
+ });
+
+ }
+
+ @Override
+ protected void executeUpdate(final DSRequest request, final DSResponse response) {
+ final ListGridRecord record = getEditedRecord(request);
+ System.out.println("Updating record: " + record);
+ final Subject updatedSubject = new Subject();
+ copyValues(record, updatedSubject);
+ subjectService.updateSubject(updatedSubject, new AsyncCallback<Subject>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to update subject",caught);
+ }
+
+ public void onSuccess(final Subject result) {
+
+ String password = record.getAttributeAsString("password");
+ if (password != null) {
+ subjectService.changePassword(updatedSubject.getName(), password, new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to update subject's password",caught);
+ }
+
+ public void onSuccess(Void nothing) {
+ System.out.println("Subject Updated");
+ copyValues(result,record);
+ response.setData(new Record[] {record});
+ processResponse(request.getRequestId(),response);
+
+ }
+ });
+ } else {
+ System.out.println("Subject Updated");
+ copyValues(result,record);
+ response.setData(new Record[] {record});
+ processResponse(request.getRequestId(),response);
+ }
+ }
+ });
+ }
+
+ @Override
+ protected void executeRemove(final DSRequest request, final DSResponse response) {
+ JavaScriptObject data = request.getData();
+ final ListGridRecord rec = new ListGridRecord(data);
+ Subject subjectToDelete = new Subject(); // TODO GH: Make default constructor public
+ copyValues(rec, subjectToDelete);
+
+ subjectService.deleteSubjects(new int[]{subjectToDelete.getId()}, new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to delete role",caught);
+ }
+
+ public void onSuccess(Void result) {
+ System.out.println("Subject deleted");
+ response.setData(new Record[]{rec});
+ processResponse(request.getRequestId(), response);
+ }
+ });
+
+ }
+
+
+
+ private static void copyValues(ListGridRecord from, Subject to) {
+ to.setId(from.getAttributeAsInt("id"));
+ to.setName(from.getAttributeAsString("username"));
+ to.setFirstName(from.getAttributeAsString("firstName"));
+ to.setLastName(from.getAttributeAsString("lastName"));
+ to.setFactive(from.getAttributeAsBoolean("factive"));
+ to.setDepartment(from.getAttributeAsString("department"));
+ to.setPhoneNumber(from.getAttributeAsString("phoneNumber"));
+ to.setEmailAddress(from.getAttributeAsString("email"));
+
+ to.setRoles((Set<Role>) from.getAttributeAsObject("roles"));
+ }
+
+ static void copyValues(Subject from, ListGridRecord to) {
+ to.setAttribute("id", from.getId());
+ to.setAttribute("username", from.getName());
+ to.setAttribute("firstName", from.getFirstName());
+ to.setAttribute("lastName", from.getLastName());
+ to.setAttribute("factive", from.getFactive());
+ to.setAttribute("department", from.getDepartment());
+ to.setAttribute("phoneNumber", from.getPhoneNumber());
+ to.setAttribute("email", from.getEmailAddress());
+
+ to.setAttribute("roles",from.getRoles());
+
+ to.setAttribute("entity", from);
+ }
+
+
+
+ private ListGridRecord getEditedRecord(DSRequest request) {
+ // Retrieving values before edit
+ JavaScriptObject oldValues = request.getAttributeAsJavaScriptObject("oldValues");
+ // Creating new record for combining old values with changes
+ ListGridRecord newRecord = new ListGridRecord();
+ // Copying properties from old record
+ JSOHelper.apply(oldValues, newRecord.getJsObj());
+ // Retrieving changed values
+ JavaScriptObject data = request.getData();
+ // Apply changes
+ JSOHelper.apply(data, newRecord.getJsObj());
+ return newRecord;
+ }
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
index b6757ea..c2c0c6f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
@@ -19,6 +19,7 @@
package org.rhq.enterprise.gui.coregui.client.admin.users;
import org.rhq.enterprise.gui.coregui.client.Presenter;
+import org.rhq.enterprise.gui.coregui.client.admin.roles.RoleEditView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDatasource;
import org.rhq.enterprise.gui.coregui.client.places.Place;
@@ -34,6 +35,7 @@ import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.Label;
+import com.smartgwt.client.widgets.Window;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.grid.ListGrid;
@@ -51,24 +53,25 @@ import java.util.List;
/**
* @author Greg Hinkle
*/
-public class UsersView extends SectionStack implements Presenter {
-
-
+public class UsersView extends VLayout implements Presenter {
+ public UsersView() {
+ super();
+ setWidth100();
+ setHeight100();
+ }
@Override
protected void onInit() {
super.onInit();
- setVisibilityMode(VisibilityMode.MULTIPLE);
- setWidth100();
- setHeight100();
- final UsersDataSource datasource = UsersDataSource.getInstance();
+ final UsersDataSource datasource = UsersDataSource.getInstance();
VLayout gridHolder = new VLayout();
gridHolder.setWidth100();
- gridHolder.setHeight100();
+ gridHolder.setHeight("50%");
+ gridHolder.setShowResizeBar(true);
final ListGrid listGrid = new ListGrid();
listGrid.setWidth100();
@@ -79,21 +82,19 @@ public class UsersView extends SectionStack implements Presenter {
// listGrid.setAutoFitData(Autofit.HORIZONTAL);
listGrid.setAlternateRecordStyles(true);
// listGrid.setAutoFitData(Autofit.HORIZONTAL);
- listGrid.setSelectionType(SelectionStyle.SIMPLE);
- listGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
+// listGrid.setSelectionType(SelectionStyle.SIMPLE);
+// listGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
listGrid.setShowFilterEditor(true);
ListGridField idField = new ListGridField("id", "Id", 55);
idField.setType(ListGridFieldType.INTEGER);
-
+
ListGridField nameField = new ListGridField("username", "Name", 100);
+ ListGridField emailField = new ListGridField("email", "Email Address");
- ListGridField descriptionField = new ListGridField("name", "Name", 150);
- ListGridField emailField = new ListGridField("email", "Email Address", 100);
-
- listGrid.setFields(idField, nameField, descriptionField, emailField);
+ listGrid.setFields(idField, nameField, emailField);
gridHolder.addMember(listGrid);
@@ -105,10 +106,10 @@ public class UsersView extends SectionStack implements Presenter {
removeButton.setDisabled(true);
removeButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
- SC.confirm("Are you sure you want to delete " + listGrid.getSelection().length + " resources?",
+ SC.confirm("Are you sure you want to delete " + listGrid.getSelection().length + " users?",
new BooleanCallback() {
public void execute(Boolean aBoolean) {
-
+ // todo
}
}
);
@@ -116,20 +117,32 @@ public class UsersView extends SectionStack implements Presenter {
});
-
final Label tableInfo = new Label("Total: " + listGrid.getTotalRows());
tableInfo.setWrap(false);
+
+ final IButton addButton = new IButton("Add Role");
+ addButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ createUser();
+ }
+ });
+
+
toolStrip.addMember(removeButton);
+ toolStrip.addMember(addButton);
toolStrip.addMember(new LayoutSpacer());
toolStrip.addMember(tableInfo);
gridHolder.addMember(toolStrip);
+ final UserEditView userEditor = new UserEditView();
+
+
listGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
public void onSelectionChanged(SelectionEvent selectionEvent) {
- int selectedCount = ((ListGrid)selectionEvent.getSource()).getSelection().length;
+ int selectedCount = ((ListGrid) selectionEvent.getSource()).getSelection().length;
tableInfo.setContents("Total: " + listGrid.getTotalRows() + " (" + selectedCount + " selected)");
removeButton.setDisabled(selectedCount == 0);
}
@@ -141,22 +154,36 @@ public class UsersView extends SectionStack implements Presenter {
listGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
public void onSelectionChanged(SelectionEvent selectionEvent) {
- for (Canvas c : detailsSection.getItems())
- c.destroy();
-
- detailsSection.setItems(new UserEditView());
- detailsSection.setExpanded(true);
- expandSection(1);
+ if (selectionEvent.getState()) {
+ userEditor.editRecord(selectionEvent.getRecord());
+ } else {
+ userEditor.editNone();
+ }
}
});
- SectionStackSection gridSection = new SectionStackSection("Search Users");
- gridSection.setExpanded(true);
- gridSection.setItems(gridHolder);
- addSection(gridSection);
- addSection(detailsSection);
+ addMember(gridHolder);
+ addMember(userEditor);
+ }
+
+
+ public void createUser() {
+
+ UserEditView editView = new UserEditView();
+
+ final Window roleEditor = new Window();
+ roleEditor.setTitle("Create User");
+ roleEditor.setWidth(800);
+ roleEditor.setHeight(800);
+ roleEditor.setIsModal(true);
+ roleEditor.setShowModalMask(true);
+ roleEditor.setCanDragResize(true);
+ roleEditor.centerInPage();
+ roleEditor.addItem(editView);
+ roleEditor.show();
+ editView.editNew();
}
public boolean fireDisplay(Place base, List<Place> subLocations) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/SimpleCollapsiblePanel.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/SimpleCollapsiblePanel.java
index e516d00..cb09a01 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/SimpleCollapsiblePanel.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/SimpleCollapsiblePanel.java
@@ -52,6 +52,7 @@ public class SimpleCollapsiblePanel extends VLayout {
button.setShowRollOver(false);
button.setActionType(SelectionType.RADIO);
button.setBorder(null);
+ button.setAutoFit(true);
button.setIcon("[skin]/images/SectionHeader/opener_opened.png");
@@ -66,6 +67,7 @@ public class SimpleCollapsiblePanel extends VLayout {
} else {
button.setIcon("[skin]/images/SectionHeader/opener_closed.png");
content.hide();
+ setHeight(30);
}
getParentElement().markForRedraw();
markForRedraw();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGroupGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGroupGWTService.java
index d1fc4a3..d0cc937 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGroupGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceGroupGWTService.java
@@ -20,6 +20,8 @@ package org.rhq.enterprise.gui.coregui.client.gwt;
import org.rhq.core.domain.criteria.ResourceGroupCriteria;
+import org.rhq.core.domain.criteria.ResourceGroupDefinitionCriteria;
+import org.rhq.core.domain.resource.group.GroupDefinition;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.util.PageList;
@@ -36,4 +38,5 @@ public interface ResourceGroupGWTService extends RemoteService {
PageList<ResourceGroup> findResourceGroupsByCriteria(ResourceGroupCriteria criteria);
+ PageList<GroupDefinition> findGroupDefinitionsByCriteria(ResourceGroupDefinitionCriteria criteria);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/RoleGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/RoleGWTService.java
index 66123f9..230dbdc 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/RoleGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/RoleGWTService.java
@@ -32,4 +32,9 @@ public interface RoleGWTService extends RemoteService {
PageList<Role> findRolesByCriteria(RoleCriteria criteria);
+ Role createRole(Role role);
+
+ Role updateRole(Role role);
+
+ void removeRoles(Integer[] roleIds);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
new file mode 100644
index 0000000..538fc95
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
@@ -0,0 +1,182 @@
+/*
+ * 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;
+
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDatasource;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
+
+import com.google.gwt.event.dom.client.KeyCodes;
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.types.ListGridFieldType;
+import com.smartgwt.client.types.SelectionAppearance;
+import com.smartgwt.client.types.SelectionStyle;
+import com.smartgwt.client.util.BooleanCallback;
+import com.smartgwt.client.util.SC;
+import com.smartgwt.client.widgets.IButton;
+import com.smartgwt.client.widgets.Label;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.TextItem;
+import com.smartgwt.client.widgets.form.fields.events.KeyPressEvent;
+import com.smartgwt.client.widgets.form.fields.events.KeyPressHandler;
+import com.smartgwt.client.widgets.grid.CellFormatter;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.grid.events.DataArrivedEvent;
+import com.smartgwt.client.widgets.grid.events.DataArrivedHandler;
+import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
+import com.smartgwt.client.widgets.grid.events.SelectionEvent;
+import com.smartgwt.client.widgets.layout.LayoutSpacer;
+import com.smartgwt.client.widgets.layout.VLayout;
+import com.smartgwt.client.widgets.toolbar.ToolStrip;
+
+import java.util.ArrayList;
+
+/**
+ * @author Greg Hinkle
+ */
+public class ResourceGroupListView extends VLayout {
+
+ private ListGrid listGrid;
+
+
+ public ResourceGroupListView() {
+
+ setWidth100();
+ setHeight100();
+
+// DynamicForm searchPanel = new DynamicForm();
+// final TextItem searchBox = new TextItem("query", "Search Resources");
+// searchBox.setValue("");
+// searchPanel.setWrapItemTitles(false);
+// searchPanel.setFields(searchBox);
+//
+//
+// addMember(searchPanel);
+
+
+ final ResourceGroupsDataSource datasource = new ResourceGroupsDataSource();
+
+ VLayout gridHolder = new VLayout();
+
+ listGrid = new ListGrid();
+ listGrid.setWidth100();
+ listGrid.setHeight100();
+ listGrid.setDataSource(datasource);
+ listGrid.setAutoFetchData(true);
+ listGrid.setAlternateRecordStyles(true);
+// listGrid.setAutoFitData(Autofit.HORIZONTAL);
+// listGrid.setCriteria(new Criteria("name", searchPanel.getValueAsString("query")));
+
+ listGrid.setSelectionType(SelectionStyle.SIMPLE);
+ listGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
+ listGrid.setResizeFieldsInRealTime(true);
+
+
+ ListGridField idField = new ListGridField("id", "Id", 55);
+ idField.setType(ListGridFieldType.INTEGER);
+ ListGridField nameField = new ListGridField("name", "Name", 250);
+ nameField.setCellFormatter(new CellFormatter() {
+ public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
+ return "<a href=\"#ResourceGroup/" + listGridRecord.getAttribute("id") +"\">" + o + "</a>";
+ }
+ });
+
+
+ ListGridField descriptionField = new ListGridField("description", "Description");
+ ListGridField typeNameField = new ListGridField("typeName", "Type", 130);
+ ListGridField pluginNameField = new ListGridField("pluginName", "Plugin", 100);
+ ListGridField categoryField = new ListGridField("category", "Category", 60);
+
+ ListGridField availabilityField = new ListGridField("currentAvailability", "Availability", 55);
+
+ availabilityField.setAlign(Alignment.CENTER);
+ listGrid.setFields(idField, nameField, descriptionField, typeNameField, pluginNameField, categoryField, availabilityField);
+
+
+ gridHolder.addMember(listGrid);
+
+ ToolStrip toolStrip = new ToolStrip();
+ toolStrip.setMembersMargin(15);
+
+ final IButton removeButton = new IButton("Remove");
+ removeButton.setDisabled(true);
+ removeButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ SC.confirm("Are you sure you want to delete " + listGrid.getSelection().length + " resources?",
+ new BooleanCallback() {
+ public void execute(Boolean aBoolean) {
+
+ }
+ }
+ );
+ }
+ });
+
+
+
+
+ final Label tableInfo = new Label("Total: " + listGrid.getTotalRows());
+ tableInfo.setWrap(false);
+
+ toolStrip.addMember(removeButton);
+ toolStrip.addMember(new LayoutSpacer());
+ toolStrip.addMember(tableInfo);
+
+ gridHolder.addMember(toolStrip);
+
+
+ listGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
+ public void onSelectionChanged(SelectionEvent selectionEvent) {
+ int selectedCount = ((ListGrid)selectionEvent.getSource()).getSelection().length;
+ tableInfo.setContents("Total: " + listGrid.getTotalRows() + " (" + selectedCount + " selected)");
+ removeButton.setDisabled(selectedCount == 0);
+ }
+ });
+
+
+
+ addMember(gridHolder);
+
+
+ listGrid.addDataArrivedHandler(new DataArrivedHandler() {
+ public void onDataArrived(DataArrivedEvent dataArrivedEvent) {
+ int selectedCount = ((ListGrid)dataArrivedEvent.getSource()).getSelection().length;
+ tableInfo.setContents("Total: " + listGrid.getTotalRows() + " (" + selectedCount + " selected)");
+ }
+ });
+
+ /*
+ searchBox.addKeyPressHandler(new KeyPressHandler() {
+ public void onKeyPress(KeyPressEvent event) {
+ if (event.getCharacterValue() == KeyCodes.KEY_ENTER) {
+ datasource.setQuery((String) searchBox.getValue());
+ Criteria c = new Criteria("name", (String) searchBox.getValue());
+ long start = System.currentTimeMillis();
+ listGrid.fetchData(c);
+ System.out.println("Loaded in: " + (System.currentTimeMillis() - start));
+ }
+ }
+ });*/
+ }
+
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java
index 69a8968..1f88e32 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java
@@ -109,10 +109,11 @@ public class ResourceGroupsDataSource extends RPCDataSource {
record.setAttribute("description", group.getDescription());
record.setAttribute("groupCategory", group.getGroupCategory());
- record.setAttribute("resourceType", group.getResourceType());
- record.setAttribute("typeName", group.getResourceType().getName());
- record.setAttribute("pluginName", group.getResourceType().getPlugin());
-
+ if (group.getResourceType() != null) {
+ record.setAttribute("resourceType", group.getResourceType());
+ record.setAttribute("typeName", group.getResourceType().getName());
+ record.setAttribute("pluginName", group.getResourceType().getPlugin());
+ }
records[x] = record;
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionDataSource.java
new file mode 100644
index 0000000..b5a9b89
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionDataSource.java
@@ -0,0 +1,114 @@
+/*
+ * 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.definitions;
+
+import org.rhq.core.domain.criteria.ResourceGroupDefinitionCriteria;
+import org.rhq.core.domain.resource.group.GroupDefinition;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGroupGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.data.DataSourceField;
+import com.smartgwt.client.data.fields.DataSourceIntegerField;
+import com.smartgwt.client.data.fields.DataSourceTextField;
+import com.smartgwt.client.rpc.RPCResponse;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+/**
+ * @author Greg Hinkle
+ */
+public class GroupDefinitionDataSource extends RPCDataSource {
+
+
+ private ResourceGroupGWTServiceAsync groupService = GWTServiceLookup.getResourceGroupService();
+
+
+ public GroupDefinitionDataSource() {
+ super();
+
+ DataSourceField idDataField = new DataSourceIntegerField("id", "ID");
+ idDataField.setPrimaryKey(true);
+ idDataField.setCanEdit(false);
+
+ DataSourceTextField nameField = new DataSourceTextField("name", "Name");
+ DataSourceTextField descriptionField = new DataSourceTextField("description", "Description");
+ DataSourceTextField expressionField = new DataSourceTextField("expression", "Expression");
+ DataSourceTextField recalculationIntervalField = new DataSourceTextField("recalculationInterval", "Recalculation Interval");
+ DataSourceTextField modifiedTimeField = new DataSourceTextField("modifiedTime", "Modified Time");
+ DataSourceTextField createdTimeField = new DataSourceTextField("createdTime", "Created Time");
+ DataSourceTextField lastCalculationTimeField = new DataSourceTextField("lastCalculationTime", "Last Calculation Time");
+ DataSourceTextField nextCalculationTimeField = new DataSourceTextField("nextCalculationTime", "Next Calculation Time");
+ DataSourceTextField managedResourceGroupsField = new DataSourceTextField("managedResourceGroups", "Managed Resource Groups");
+
+
+ setFields(idDataField, nameField, descriptionField, expressionField, recalculationIntervalField, modifiedTimeField, createdTimeField, lastCalculationTimeField, nextCalculationTimeField, managedResourceGroupsField);
+
+ }
+
+ @Override
+ protected void executeFetch(final DSRequest request, final DSResponse response) {
+ ResourceGroupDefinitionCriteria criteria = new ResourceGroupDefinitionCriteria();
+ criteria.setPageControl(getPageControl(request));
+
+ groupService.findGroupDefinitionsByCriteria(criteria, new AsyncCallback<PageList<GroupDefinition>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load group definitions", caught);
+ }
+
+ public void onSuccess(PageList<GroupDefinition> result) {
+
+
+ response.setStatus(RPCResponse.STATUS_SUCCESS);
+ response.setData(buildRecords(result));
+ response.setTotalRows(result.getTotalSize());
+ processResponse(request.getRequestId(), response);
+
+ }
+ });
+ }
+
+
+ public ListGridRecord[] buildRecords(PageList<GroupDefinition> definitions) {
+
+ ListGridRecord[] records = new ListGridRecord[definitions.size()];
+ int i = 0;
+ for (GroupDefinition def : definitions) {
+ ListGridRecord record = new ListGridRecord();
+ record.setAttribute("id", def.getId());
+ record.setAttribute("name", def.getName());
+ record.setAttribute("description", def.getDescription());
+ record.setAttribute("expression", def.getExpression());
+ record.setAttribute("recalculationInterval", def.getRecalculationInterval());
+ record.setAttribute("modifiedTime", def.getModifiedTime());
+ record.setAttribute("createdTime", def.getCreatedTime());
+ record.setAttribute("lastCalculationTime", def.getLastCalculationTime());
+ record.setAttribute("nextCalculationTime", def.getNextCalculationTime());
+ record.setAttribute("managedResourceGroups", def.getManagedResourceGroups());
+
+ records[i++] = record;
+ }
+
+ return records;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java
new file mode 100644
index 0000000..91dc3ba
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java
@@ -0,0 +1,173 @@
+/*
+ * 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.definitions;
+
+import org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupsDataSource;
+
+import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.types.ListGridFieldType;
+import com.smartgwt.client.types.SelectionAppearance;
+import com.smartgwt.client.types.SelectionStyle;
+import com.smartgwt.client.util.BooleanCallback;
+import com.smartgwt.client.util.SC;
+import com.smartgwt.client.widgets.IButton;
+import com.smartgwt.client.widgets.Label;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.grid.CellFormatter;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.grid.events.DataArrivedEvent;
+import com.smartgwt.client.widgets.grid.events.DataArrivedHandler;
+import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
+import com.smartgwt.client.widgets.grid.events.SelectionEvent;
+import com.smartgwt.client.widgets.layout.LayoutSpacer;
+import com.smartgwt.client.widgets.layout.VLayout;
+import com.smartgwt.client.widgets.toolbar.ToolStrip;
+
+/**
+ * @author Greg Hinkle
+ */
+public class GroupDefinitionListView extends VLayout {
+
+ private ListGrid listGrid;
+
+
+ public GroupDefinitionListView() {
+
+ setWidth100();
+ setHeight100();
+
+// DynamicForm searchPanel = new DynamicForm();
+// final TextItem searchBox = new TextItem("query", "Search Resources");
+// searchBox.setValue("");
+// searchPanel.setWrapItemTitles(false);
+// searchPanel.setFields(searchBox);
+//
+//
+// addMember(searchPanel);
+
+
+ final GroupDefinitionDataSource datasource = new GroupDefinitionDataSource();
+
+ VLayout gridHolder = new VLayout();
+
+ listGrid = new ListGrid();
+ listGrid.setWidth100();
+ listGrid.setHeight100();
+ listGrid.setDataSource(datasource);
+ listGrid.setAutoFetchData(true);
+ listGrid.setAlternateRecordStyles(true);
+// listGrid.setAutoFitData(Autofit.HORIZONTAL);
+// listGrid.setCriteria(new Criteria("name", searchPanel.getValueAsString("query")));
+
+ listGrid.setSelectionType(SelectionStyle.SIMPLE);
+ listGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
+ listGrid.setResizeFieldsInRealTime(true);
+
+
+ ListGridField idField = new ListGridField("id", "Id", 55);
+ idField.setType(ListGridFieldType.INTEGER);
+ ListGridField nameField = new ListGridField("name", "Name", 250);
+ nameField.setCellFormatter(new CellFormatter() {
+ public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
+ return "<a href=\"#ResourceGroupDefinition/" + listGridRecord.getAttribute("id") +"\">" + o + "</a>";
+ }
+ });
+
+
+ ListGridField descriptionField = new ListGridField("description", "Description");
+//// ListGridField typeNameField = new ListGridField("typeName", "Type", 130);
+//// ListGridField pluginNameField = new ListGridField("pluginName", "Plugin", 100);
+//// ListGridField categoryField = new ListGridField("category", "Category", 60);
+////
+//// ListGridField availabilityField = new ListGridField("currentAvailability", "Availability", 55);
+//
+// availabilityField.setAlign(Alignment.CENTER);
+// listGrid.setFields(idField, nameField, descriptionField, typeNameField, pluginNameField, categoryField, availabilityField);
+
+
+ gridHolder.addMember(listGrid);
+
+ ToolStrip toolStrip = new ToolStrip();
+ toolStrip.setMembersMargin(15);
+
+ final IButton removeButton = new IButton("Remove");
+ removeButton.setDisabled(true);
+ removeButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ SC.confirm("Are you sure you want to delete " + listGrid.getSelection().length + " resources?",
+ new BooleanCallback() {
+ public void execute(Boolean aBoolean) {
+
+ }
+ }
+ );
+ }
+ });
+
+
+
+
+ final Label tableInfo = new Label("Total: " + listGrid.getTotalRows());
+ tableInfo.setWrap(false);
+
+ toolStrip.addMember(removeButton);
+ toolStrip.addMember(new LayoutSpacer());
+ toolStrip.addMember(tableInfo);
+
+ gridHolder.addMember(toolStrip);
+
+
+ listGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
+ public void onSelectionChanged(SelectionEvent selectionEvent) {
+ int selectedCount = ((ListGrid)selectionEvent.getSource()).getSelection().length;
+ tableInfo.setContents("Total: " + listGrid.getTotalRows() + " (" + selectedCount + " selected)");
+ removeButton.setDisabled(selectedCount == 0);
+ }
+ });
+
+
+
+ addMember(gridHolder);
+
+
+ listGrid.addDataArrivedHandler(new DataArrivedHandler() {
+ public void onDataArrived(DataArrivedEvent dataArrivedEvent) {
+ int selectedCount = ((ListGrid)dataArrivedEvent.getSource()).getSelection().length;
+ tableInfo.setContents("Total: " + listGrid.getTotalRows() + " (" + selectedCount + " selected)");
+ }
+ });
+
+ /*
+ searchBox.addKeyPressHandler(new KeyPressHandler() {
+ public void onKeyPress(KeyPressEvent event) {
+ if (event.getCharacterValue() == KeyCodes.KEY_ENTER) {
+ datasource.setQuery((String) searchBox.getValue());
+ Criteria c = new Criteria("name", (String) searchBox.getValue());
+ long start = System.currentTimeMillis();
+ listGrid.fetchData(c);
+ System.out.println("Loaded in: " + (System.currentTimeMillis() - start));
+ }
+ }
+ });*/
+ }
+
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourcesView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourcesView.java
index b3bf91f..38fa943 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourcesView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourcesView.java
@@ -21,6 +21,8 @@ package org.rhq.enterprise.gui.coregui.client.inventory.resource;
import org.rhq.core.domain.resource.Resource;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.Presenter;
+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.places.Place;
import com.smartgwt.client.types.ContentsType;
@@ -130,14 +132,14 @@ public class ResourcesView extends HLayout implements Presenter {
treeGrid.setShowHeader(false);
Tree tree = new Tree();
- final TreeNode manageServersNode = new TreeNode("Groups");
- final TreeNode manageAgentsNode = new TreeNode("DynaGroups");
+ final TreeNode groupsNode = new TreeNode("Groups");
+ final TreeNode groupDefinitions = new TreeNode("DynaGroups");
final TreeNode manageAffinityGroupsNode = new TreeNode("Special Groups");
final TreeNode managePartitionEventsNode = new TreeNode("Greg's Groups");
tree.setRoot(new TreeNode("clustering",
- manageServersNode,
- manageAgentsNode,
+ groupsNode,
+ groupDefinitions,
manageAffinityGroupsNode,
managePartitionEventsNode));
@@ -152,10 +154,12 @@ public class ResourcesView extends HLayout implements Presenter {
pane.setHeight100();
String url = null;
- if (selectionEvent.getRecord() == manageServersNode) {
- url = "/rhq/ha/listServers.xhtml";
- } else if (selectionEvent.getRecord() == manageAgentsNode) {
- url = "/rhq/ha/listAgents.xhtml";
+ if (selectionEvent.getRecord() == groupsNode) {
+ setContent(new ResourceGroupListView());
+ return;
+ } else if (selectionEvent.getRecord() == groupDefinitions) {
+ setContent(new GroupDefinitionListView());
+ return;
} else if (selectionEvent.getRecord() == manageAffinityGroupsNode) {
url = "/rhq/ha/listAffinityGroups.xhtml";
} else if (selectionEvent.getRecord() == managePartitionEventsNode) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/ErrorHandler.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/ErrorHandler.java
index 766f6a5..5fcee6b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/ErrorHandler.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/ErrorHandler.java
@@ -20,6 +20,7 @@ package org.rhq.enterprise.gui.coregui.client.util;
import com.smartgwt.client.util.SC;
+import java.util.ArrayList;
import java.util.List;
/**
@@ -28,7 +29,7 @@ import java.util.List;
public class ErrorHandler {
- private List<String> errors;
+ private ArrayList<String> errors = new ArrayList<String>();
public void handleError(String message, Throwable t) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
index c979e3f..f484c29 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
@@ -49,20 +49,28 @@ public abstract class RPCDataSource extends DataSource {
setClientOnly(false);
setDataProtocol(DSProtocol.CLIENTCUSTOM);
setDataFormat(DSDataFormat.CUSTOM);
+
}
+
+
@Override
protected Object transformRequest(DSRequest request) {
try {
+ DSResponse response = createResponse(request);
+
switch (request.getOperationType()) {
case FETCH:
- DSResponse response = createResponse(request);
executeFetch(request, response);
break;
case ADD:
+ executeAdd(request, response);
+ break;
case UPDATE:
+ executeUpdate(request, response);
+ break;
case REMOVE:
- super.transformRequest(request);
+ executeRemove(request, response);
break;
default:
super.transformRequest(request);
@@ -123,6 +131,14 @@ public abstract class RPCDataSource extends DataSource {
throw new UnsupportedOperationException("This dataSource does not support removal.");
}
+ protected void executeAdd(final DSRequest request, final DSResponse response) {
+ throw new UnsupportedOperationException("This dataSource does not support addition.");
+ }
+
+ protected void executeUpdate(final DSRequest request, final DSResponse response) {
+ throw new UnsupportedOperationException("This dataSource does not support updates.");
+ }
+
private DSResponse createResponse(DSRequest request) {
DSResponse response = new DSResponse();
response.setAttribute("clientContext", request.getAttributeAsObject("clientContext"));
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGroupGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGroupGWTServiceImpl.java
index a4ae911..867de6e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGroupGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGroupGWTServiceImpl.java
@@ -21,12 +21,15 @@ package org.rhq.enterprise.gui.coregui.server.gwt;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import org.rhq.core.domain.criteria.ResourceGroupCriteria;
+import org.rhq.core.domain.criteria.ResourceGroupDefinitionCriteria;
+import org.rhq.core.domain.resource.group.GroupDefinition;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGroupGWTService;
import org.rhq.enterprise.gui.coregui.server.util.SerialUtility;
import org.rhq.enterprise.server.resource.group.ResourceGroupManagerBean;
import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
+import org.rhq.enterprise.server.resource.group.definition.GroupDefinitionManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
@@ -36,10 +39,19 @@ import org.rhq.enterprise.server.util.LookupUtil;
public class ResourceGroupGWTServiceImpl extends AbstractGWTServiceImpl implements ResourceGroupGWTService {
private ResourceGroupManagerLocal groupManager = LookupUtil.getResourceGroupManager();
+ private GroupDefinitionManagerLocal definitionManager = LookupUtil.getGroupDefinitionManager();
+
public PageList<ResourceGroup> findResourceGroupsByCriteria(ResourceGroupCriteria criteria) {
return SerialUtility.prepare(groupManager.findResourceGroupsByCriteria(getSessionSubject(), criteria),
"ResourceGroupService.findResourceGroupsByCriteria");
}
+ // TODO GH: build and expose findResourceGroupCompositesByCriteria
+
+ public PageList<GroupDefinition> findGroupDefinitionsByCriteria(ResourceGroupDefinitionCriteria criteria) {
+ return SerialUtility.prepare(definitionManager.findGroupDefinitionsByCriteria(getSessionSubject(), criteria),
+ "ResourceGroupService.findGroupDefinitionsByCriteria");
+ }
+
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/RoleGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/RoleGWTServiceImpl.java
index 360e078..373322f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/RoleGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/RoleGWTServiceImpl.java
@@ -47,4 +47,19 @@ public class RoleGWTServiceImpl extends AbstractGWTServiceImpl implements RoleGW
return SerialUtility.prepare(roleManager.findRolesByCriteria(getSessionSubject(), criteria),
"RoleService.findRolesByCriteria");
}
+
+ public Role createRole(Role role) {
+ return SerialUtility.prepare(roleManager.createRole(getSessionSubject(), role),
+ "RoleService.createRole");
+ }
+
+ public Role updateRole(Role role) {
+ return SerialUtility.prepare(roleManager.updateRole(getSessionSubject(), role),
+ "RoleService.updateRole");
+ }
+
+ public void removeRoles(Integer[] roleIds) {
+ roleManager.deleteRoles(getSessionSubject(), roleIds);
+ }
+
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/SubjectGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/SubjectGWTServiceImpl.java
index f347e10..a46900c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/SubjectGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/SubjectGWTServiceImpl.java
@@ -39,19 +39,20 @@ public class SubjectGWTServiceImpl extends AbstractGWTServiceImpl implements Sub
private SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
public void changePassword(String username, String password) {
- // TODO: Implement this method.
+ subjectManager.changePassword(getSessionSubject(), username, password);
}
public void createPrincipal(String username, String password) {
- // TODO: Implement this method.
+ subjectManager.createPrincipal(getSessionSubject(), username, password);
}
public Subject createSubject(Subject subjectToCreate) {
- return null; // TODO: Implement this method.
+ return SerialUtility.prepare(subjectManager.createSubject(getSessionSubject(), subjectToCreate),
+ "SubjectManager.createSubject");
}
public void deleteSubjects(int[] subjectIds) {
- // TODO: Implement this method.
+ subjectManager.deleteSubjects(getSessionSubject(),subjectIds);
}
public Subject login(String username, String password) {
@@ -63,11 +64,12 @@ public class SubjectGWTServiceImpl extends AbstractGWTServiceImpl implements Sub
}
public void logout(Subject subject) {
- // TODO: Implement this method.
+ subjectManager.logout(subject.getSessionId());
}
public Subject updateSubject(Subject subjectToModify) {
- return null; // TODO: Implement this method.
+ return SerialUtility.prepare(subjectManager.updateSubject(getSessionSubject(), subjectToModify),
+ "SubjectManager.updateSubject");
}
public PageList<Subject> findSubjectsByCriteria(SubjectCriteria criteria) {
commit c5a5bf943e8e0f1e584ec5650a9707be919a7868
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Mar 2 10:39:55 2010 -0500
Group Definition criteria query access
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupDefinitionCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupDefinitionCriteria.java
new file mode 100644
index 0000000..9116dc8
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupDefinitionCriteria.java
@@ -0,0 +1,108 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.core.domain.criteria;
+
+import org.rhq.core.domain.resource.group.GroupDefinition;
+import org.rhq.core.domain.util.PageOrdering;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+
+/**
+ * @author Greg Hinkle
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@SuppressWarnings("unused")
+public class ResourceGroupDefinitionCriteria extends Criteria {
+ private static final long serialVersionUID = 1L;
+
+
+ private Integer filterId;
+ private String filterName;
+ private String filterDescription;
+ private Boolean filterRecursive;
+ private String filterExpression;
+
+ private boolean fetchManagedResourceGroups;
+
+ private PageOrdering sortName;
+ private PageOrdering sortDescription;
+ private PageOrdering sortRecursive;
+ private PageOrdering sortExpression;
+
+
+ public ResourceGroupDefinitionCriteria() {
+ super(GroupDefinition.class);
+ }
+
+ @Override
+ public Class getPersistentClass() {
+ return GroupDefinition.class;
+ }
+
+ public void addFilterId(Integer filterId) {
+ this.filterId = filterId;
+ }
+
+ public void addFilterName(String filterName) {
+ this.filterName = filterName;
+ }
+
+ public void addFilterDescription(String filterDescription) {
+ this.filterDescription = filterDescription;
+ }
+
+ public void addFilterRecursive(Boolean filterRecursive) {
+ this.filterRecursive = filterRecursive;
+ }
+
+ public void addFilterExpression(String filterExpression) {
+ this.filterExpression = filterExpression;
+ }
+
+
+ public void fetchManagedResourceGroups(boolean fetchManagedResourceGroups) {
+ this.fetchManagedResourceGroups = fetchManagedResourceGroups;
+ }
+
+
+ public void addSortName(PageOrdering sortName) {
+ addSortField("name");
+ this.sortName = sortName;
+ }
+
+ public void addSortDescription(PageOrdering sortDescription) {
+ addSortField("description");
+ this.sortDescription = sortDescription;
+ }
+
+ public void addSortRecursive(PageOrdering sortRecursive) {
+ addSortField("recursive");
+ this.sortRecursive = sortRecursive;
+ }
+
+ public void addSortExpression(PageOrdering sortExpression) {
+ addSortField("expression");
+ this.sortExpression = sortExpression;
+ }
+}
\ No newline at end of file
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/definition/GroupDefinitionManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/definition/GroupDefinitionManagerBean.java
index 3a3f842..9dc3430 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/definition/GroupDefinitionManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/definition/GroupDefinitionManagerBean.java
@@ -51,6 +51,8 @@ import org.rhq.core.db.PostgresqlDatabaseType;
import org.rhq.core.db.SQLServerDatabaseType;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Permission;
+import org.rhq.core.domain.criteria.ResourceGroupDefinitionCriteria;
+import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.composite.ResourceFacets;
import org.rhq.core.domain.resource.group.GroupDefinition;
@@ -65,6 +67,7 @@ import org.rhq.core.util.jdbc.JDBCUtil;
import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import org.rhq.enterprise.server.authz.AuthorizationManagerLocal;
+import org.rhq.enterprise.server.authz.PermissionException;
import org.rhq.enterprise.server.authz.RequiredPermission;
import org.rhq.enterprise.server.resource.ResourceManagerLocal;
import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal;
@@ -81,6 +84,8 @@ import org.rhq.enterprise.server.resource.group.definition.framework.ExpressionE
import org.rhq.enterprise.server.resource.group.definition.framework.InvalidExpressionException;
import org.rhq.enterprise.server.resource.group.definition.mbean.GroupDefinitionRecalculationThreadMonitor;
import org.rhq.enterprise.server.resource.group.definition.mbean.GroupDefinitionRecalculationThreadMonitorMBean;
+import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
+import org.rhq.enterprise.server.util.CriteriaQueryRunner;
@Stateless
@javax.annotation.Resource(name = "RHQ_DS", mappedName = RHQConstants.DATASOURCE_JNDI_NAME)
@@ -555,6 +560,20 @@ public class GroupDefinitionManagerBean implements GroupDefinitionManagerLocal {
}
}
+ public PageList<GroupDefinition> findGroupDefinitionsByCriteria(Subject subject, ResourceGroupDefinitionCriteria criteria) {
+ CriteriaQueryGenerator generator = new CriteriaQueryGenerator(criteria);
+ if (authorizationManager.isInventoryManager(subject) == false) {
+ if (criteria.isInventoryManagerRequired()) {
+ throw new PermissionException("Subject [" + subject.getName()
+ + "] requires InventoryManager permission for requested query criteria.");
+ }
+ }
+
+ CriteriaQueryRunner<GroupDefinition> queryRunner = new CriteriaQueryRunner(criteria, generator, entityManager);
+
+ return queryRunner.execute();
+ }
+
public int getGroupDefinitionCount(Subject subject) {
if (authorizationManager.isInventoryManager(subject)) {
Query queryCount = PersistenceUtility.createCountQuery(entityManager, GroupDefinition.QUERY_FIND_ALL);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/definition/GroupDefinitionManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/definition/GroupDefinitionManagerLocal.java
index a7c8a86..4738625 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/definition/GroupDefinitionManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/definition/GroupDefinitionManagerLocal.java
@@ -21,6 +21,7 @@ package org.rhq.enterprise.server.resource.group.definition;
import javax.ejb.Local;
import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.criteria.ResourceGroupDefinitionCriteria;
import org.rhq.core.domain.resource.group.GroupDefinition;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
import org.rhq.core.domain.util.PageControl;
@@ -60,6 +61,8 @@ public interface GroupDefinitionManagerLocal {
PageList<GroupDefinition> getGroupDefinitions(Subject subject, PageControl pc);
+ PageList<GroupDefinition> findGroupDefinitionsByCriteria(Subject subject, ResourceGroupDefinitionCriteria criteria);
+
int getGroupDefinitionCount(Subject subject);
int getAutoRecalculationGroupDefinitionCount(Subject subject);
commit 12b9f3e85501ef0657e83e2528447c223f0e9606
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Tue Mar 2 11:25:37 2010 -0500
rename BreadCrumb class to BreadcrumbTrailRenderer; start using FullHTMLPane in AdministrationView; add IFRAME-based Administratio/Settings/Downloads view; fix links on Administration/Reports/InventorySummary view
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadCrumb.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadCrumb.java
deleted file mode 100644
index c57c352..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadCrumb.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client;
-
-import com.google.gwt.user.client.Window;
-import com.smartgwt.client.types.Overflow;
-import com.smartgwt.client.widgets.HTMLPane;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * GWT widget for the breadcrumb trail, which is displayed at the top of each page.
- *
- * @author Greg Hinkle
- * @author Ian Springer
- */
-public class BreadCrumb extends HTMLPane {
-
- private List<Breadcrumb> breadcrumbs = new ArrayList<Breadcrumb>();
-
- public BreadCrumb() {
- setHeight(28);
- setBackgroundColor("#E6E3E3");
- setPadding(5);
- setOverflow(Overflow.CLIP_V);
- }
-
- public List<Breadcrumb> getBreadcrumbs() {
- return this.breadcrumbs;
- }
-
- public void setBreadcrumbs(List<Breadcrumb> breadcrumbs) {
- this.breadcrumbs = breadcrumbs;
- }
-
- public void refresh() {
- try {
- boolean first = true;
- StringBuilder path = new StringBuilder();
- StringBuilder content = new StringBuilder();
- content.append("<div class=\"BreadCrumb\">");
- for (int i = 0, trailSize = this.breadcrumbs.size(); i < trailSize; i++) {
- if (!first) {
- path.append("/");
- content.append(" > ");
- } else {
- first = false;
- }
-
- Breadcrumb breadcrumb = breadcrumbs.get(i);
- path.append(breadcrumb.getName());
-
- if ((i == (trailSize - 1) || !breadcrumb.isHyperlink())) {
- // last item in trail is the current page and so should not be a link
- content.append(breadcrumb.getDisplayName());
- } else {
- content.append("<a href=\"#");
- // NOTE: We have to call toString() below, because GWT chokes if you try to append a StringBuilder.
- content.append(path.toString());
- content.append("\">");
- content.append(breadcrumb.getDisplayName());
- content.append("</a>");
- }
- content.append("\n");
- }
- content.append("</div>");
-
- setContents(content.toString());
- } catch (Throwable t) {
- System.err.println("Failed to refresh bread crumb HTML - cause: " + t);
- }
-
- String title = "RHQ";
- if (!breadcrumbs.isEmpty()) {
- title += ": " + this.breadcrumbs.get(this.breadcrumbs.size() - 1);
- }
- Window.setTitle(title);
-
- redraw();
- }
-
- @Override
- public String toString() {
- StringBuilder result = new StringBuilder("BreadCrumb[");
- result.append(this.breadcrumbs);
- result.append("]");
- return result.toString();
- }
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadcrumbTrailPane.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadcrumbTrailPane.java
new file mode 100644
index 0000000..c522ce2
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadcrumbTrailPane.java
@@ -0,0 +1,106 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client;
+
+import com.google.gwt.user.client.Window;
+import com.smartgwt.client.types.Overflow;
+import com.smartgwt.client.widgets.HTMLPane;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * GWT widget for the breadcrumb trail, which is displayed at the top of each page.
+ *
+ * @author Greg Hinkle
+ * @author Ian Springer
+ */
+public class BreadcrumbTrailPane extends HTMLPane {
+
+ private List<Breadcrumb> breadcrumbs = new ArrayList<Breadcrumb>();
+
+ public BreadcrumbTrailPane() {
+ setHeight(28);
+ setBackgroundColor("#E6E3E3");
+ setPadding(5);
+ setOverflow(Overflow.CLIP_V);
+ }
+
+ public List<Breadcrumb> getBreadcrumbs() {
+ return this.breadcrumbs;
+ }
+
+ public void setBreadcrumbs(List<Breadcrumb> breadcrumbs) {
+ this.breadcrumbs = breadcrumbs;
+ }
+
+ public void refresh() {
+ try {
+ boolean first = true;
+ StringBuilder path = new StringBuilder();
+ StringBuilder content = new StringBuilder();
+ content.append("<div class=\"BreadCrumb\">");
+ for (int i = 0, trailSize = this.breadcrumbs.size(); i < trailSize; i++) {
+ if (!first) {
+ path.append("/");
+ content.append(" > ");
+ } else {
+ first = false;
+ }
+
+ Breadcrumb breadcrumb = breadcrumbs.get(i);
+ path.append(breadcrumb.getName());
+
+ if ((i == (trailSize - 1) || !breadcrumb.isHyperlink())) {
+ // last item in trail is the current page and so should not be a link
+ content.append(breadcrumb.getDisplayName());
+ } else {
+ content.append("<a href=\"#");
+ // NOTE: We have to call toString() below, because GWT chokes if you try to append a StringBuilder.
+ content.append(path.toString());
+ content.append("\">");
+ content.append(breadcrumb.getDisplayName());
+ content.append("</a>");
+ }
+ content.append("\n");
+ }
+ content.append("</div>");
+
+ setContents(content.toString());
+ } catch (Throwable t) {
+ System.err.println("Failed to refresh bread crumb HTML - cause: " + t);
+ }
+
+ String title = "RHQ";
+ if (!breadcrumbs.isEmpty()) {
+ title += ": " + this.breadcrumbs.get(this.breadcrumbs.size() - 1);
+ }
+ Window.setTitle(title);
+
+ redraw();
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder result = new StringBuilder("BreadCrumb[");
+ result.append(this.breadcrumbs);
+ result.append("]");
+ return result.toString();
+ }
+}
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 24dbe6e..67881a4 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
@@ -49,7 +49,7 @@ public class CoreGUI implements EntryPoint {
private static ErrorHandler errorHandler = new ErrorHandler();
- private static BreadCrumb breadCrumb;
+ private static BreadcrumbTrailPane breadCrumb;
private static Canvas content;
@@ -146,7 +146,7 @@ public class CoreGUI implements EntryPoint {
rootCanvas.addMember(menuBarView);
- breadCrumb = new BreadCrumb();
+ breadCrumb = new BreadcrumbTrailPane();
rootCanvas.addMember(breadCrumb);
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 e8804bd..18673f1 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
@@ -24,11 +24,9 @@ import org.rhq.enterprise.gui.coregui.client.View;
import org.rhq.enterprise.gui.coregui.client.ViewId;
import org.rhq.enterprise.gui.coregui.client.ViewRenderer;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.Presenter;
-import org.rhq.enterprise.gui.coregui.client.admin.report.InventorySummaryReportView;
import org.rhq.enterprise.gui.coregui.client.admin.roles.RolesView;
import org.rhq.enterprise.gui.coregui.client.admin.users.UsersView;
-import org.rhq.enterprise.gui.coregui.client.places.Place;
+import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
import com.smartgwt.client.types.ContentsType;
import com.smartgwt.client.types.VisibilityMode;
@@ -45,14 +43,19 @@ import com.smartgwt.client.widgets.tree.TreeGrid;
import com.smartgwt.client.widgets.tree.TreeNode;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
/**
*
* @author Greg Hinkle
*/
-public class AdministrationView extends HLayout implements Presenter, ViewRenderer {
+public class AdministrationView extends HLayout implements ViewRenderer {
+ public static final String VIEW_PATH = "Administration";
+
+ public static final String SUBVIEW_PATH_REPORTS = VIEW_PATH + ViewId.PATH_SEPARATOR + "Reports";
+ public static final String SUBVIEW_PATH_REPORTS_INVENTORY_SUMMARY = SUBVIEW_PATH_REPORTS + ViewId.PATH_SEPARATOR + "InventorySummary";
+
+ private static final String IFRAME_URL_INVENTORY_SUMMARY_REPORT = "/rhq/admin/report/resourceInstallReport-body.xhtml";
private SectionStack sectionStack;
@@ -256,10 +259,11 @@ public class AdministrationView extends HLayout implements Presenter, ViewRender
Tree tree = new Tree();
final TreeNode manageSettings = new TreeNode("System Settings");
final TreeNode manageTemplates = new TreeNode("Templates");
+ final TreeNode manageDownloads = new TreeNode("Downloads");
final TreeNode manageLicense = new TreeNode("License");
tree.setRoot(new TreeNode("System Configuration",
- manageSettings, manageTemplates, manageLicense));
+ manageSettings, manageTemplates, manageDownloads, manageLicense));
systemConfigTreeGrid.setData(tree);
@@ -267,19 +271,21 @@ public class AdministrationView extends HLayout implements Presenter, ViewRender
systemConfigTreeGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
public void onSelectionChanged(SelectionEvent selectionEvent) {
if (selectionEvent.getState()) {
- HTMLPane pane = new HTMLPane();
- pane.setContentsType(ContentsType.PAGE);
- pane.setWidth100();
- pane.setHeight100();
-
- String url = null;
+ String url;
if (selectionEvent.getRecord() == manageSettings) {
url = "/admin/config/Config.do?mode=edit";
} else if (selectionEvent.getRecord() == manageTemplates) {
url = "/admin/config/EditDefaults.do?mode=monitor&viewMode=all";
+ } else if (selectionEvent.getRecord() == manageDownloads) {
+ url = "/rhq/admin/downloads-body.xhtml";
+ } else if (selectionEvent.getRecord() == manageLicense) {
+ url = "/admin/license/LicenseAdmin.do?mode=view";
+ } else {
+ throw new IllegalStateException("Unknown record selected: " + selectionEvent.getRecord());
}
+ url += "&nomenu=true";
- pane.setContentsURL(url + "&nomenu=true");
+ FullHTMLPane pane = new FullHTMLPane(url);
setContent(pane);
for (TreeGrid treeGrid : treeGrids) {
if (treeGrid != systemConfigTreeGrid) {
@@ -315,9 +321,7 @@ public class AdministrationView extends HLayout implements Presenter, ViewRender
reportsTreeGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
public void onSelectionChanged(SelectionEvent selectionEvent) {
if (selectionEvent.getState()) {
- HTMLPane pane = new InventorySummaryReportView();
- setContent(pane);
- CoreGUI.goTo(InventorySummaryReportView.PATH);
+ CoreGUI.goTo(SUBVIEW_PATH_REPORTS_INVENTORY_SUMMARY);
for (TreeGrid treeGrid : treeGrids) {
if (treeGrid != reportsTreeGrid) {
treeGrid.deselectAllRecords();
@@ -332,7 +336,6 @@ public class AdministrationView extends HLayout implements Presenter, ViewRender
return section;
}
-
public void setContent(Canvas newContent) {
if (contentCanvas.getChildren().length > 0)
@@ -343,54 +346,6 @@ public class AdministrationView extends HLayout implements Presenter, ViewRender
}
-
- public boolean fireDisplay(Place base, List<Place> subLocations) {
- try {
- if (base.equals(getPlace())) {
- if (!subLocations.isEmpty()) {
- Place child = subLocations.get(0);
- String childId = child.getId();
- if (childId.equals("Reports")) {
- if (subLocations.size() >= 2) {
- Place grandchild = subLocations.get(1);
- String grandchildId = grandchild.getId();
- if (grandchildId.equals("InventorySummary")) {
- HTMLPane pane = new InventorySummaryReportView();
- setContent(pane);
- return true;
- }
- }
- }
- }
- }
- } catch (Exception e) {
- System.err.println(e);
- }
- return false;
- }
-
- public Place getPlace() {
- return new Place("Administration", "Administration");
- }
-
- public List<Breadcrumb> render(List<String> breadcrumbNames) {
- if (breadcrumbNames == null || breadcrumbNames.size() < 2) {
- return Collections.emptyList();
- }
- List<Breadcrumb> renderedBreadcrumbs = new ArrayList<Breadcrumb>(breadcrumbNames.size());
- String firstBreadcrumbName = breadcrumbNames.get(0);
- if (firstBreadcrumbName.equals("Reports")) {
- String secondBreadcrumbName = breadcrumbNames.get(1);
- if (secondBreadcrumbName.equals("InventorySummary")) {
- HTMLPane pane = new InventorySummaryReportView();
- setContent(pane);
- renderedBreadcrumbs.add(new Breadcrumb("Reports"));
- renderedBreadcrumbs.add(new Breadcrumb("InventorySummary"));
- }
- }
- return renderedBreadcrumbs;
- }
-
public View renderView(ViewId viewId, View parentView, boolean lastNode) throws UnknownViewException {
String parentPath = parentView.getId().getPath();
if (parentPath.equals("Administration")) {
@@ -403,9 +358,9 @@ public class AdministrationView extends HLayout implements Presenter, ViewRender
return new View(viewId, new Breadcrumb(viewId.getName(), false));
}
} else if (parentPath.equals("Administration/Reports")) {
- InventorySummaryReportView canvas = new InventorySummaryReportView();
- setContent(canvas);
- return new View(viewId, canvas);
+ FullHTMLPane pane = new FullHTMLPane(IFRAME_URL_INVENTORY_SUMMARY_REPORT);
+ setContent(pane);
+ return new View(viewId, pane);
}
throw new UnknownViewException();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/report/InventorySummaryReportView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/report/InventorySummaryReportView.java
deleted file mode 100644
index 1faeba5..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/report/InventorySummaryReportView.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.rhq.enterprise.gui.coregui.client.admin.report;
-
-import com.smartgwt.client.types.ContentsType;
-import com.smartgwt.client.widgets.HTMLPane;
-import org.rhq.enterprise.gui.coregui.client.BreadCrumb;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.Presenter;
-import org.rhq.enterprise.gui.coregui.client.places.Place;
-
-import java.util.List;
-
-/**
- * @author Ian Springer
- */
-public class InventorySummaryReportView extends HTMLPane implements Presenter {
- public static final String PATH = "Administration/Reports/InventorySummary";
- public static final Place PLACE = new Place(PATH.substring(PATH.lastIndexOf('/') + 1), null);
- private static final String URL = "/rhq/admin/report/resourceInstallReport-body.xhtml";
-
- public InventorySummaryReportView() {
- super();
- setContentsType(ContentsType.PAGE);
- setWidth100();
- setHeight100();
- setContentsURL(URL);
- }
-
- public boolean fireDisplay(Place base, List<Place> subLocations) {
- return false;
- }
-
- public Place getPlace() {
- return PLACE;
- }
-}
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/downloads-body.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/downloads-body.xhtml
new file mode 100644
index 0000000..ce33488
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/downloads-body.xhtml
@@ -0,0 +1,101 @@
+<?xml version="1.0"?>
+
+<ui:composition
+ template="/rhq/layout/main.xhtml"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:fn="http://java.sun.com/jsp/jstl/functions"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich"
+ xmlns:rhq="http://rhq-project.org/rhq"
+ xmlns:onc="http://jboss.org/on/component">
+
+ <ui:param name="disableMenu" value="true"/>
+ <ui:param name="disableBreadcrumbs" value="true"/>
+
+ <ui:define name="body">
+
+ <rich:panel>
+ <f:facet name="header">
+ <h:outputText value="Downloads"/>
+ </f:facet>
+
+ <h:panelGrid columns="1" width="100%">
+
+ <h:outputLink value="/agentupdate/download">
+ <h:graphicImage value="/images/icons/Save_32.png"/>
+ <h:outputText value="Download Agent Installer"/>
+ </h:outputLink>
+
+ <h:panelGroup>
+ <span class="DisplayLabel">Agent Version: </span>
+ <h:outputText value="#{DownloadsUIBean.agentVersionProperties['rhq-agent.latest.version']}"/><br/>
+ <span class="DisplayLabel">Agent Build: </span>
+ <h:outputText value="#{DownloadsUIBean.agentVersionProperties['rhq-agent.latest.build-number']}"/><br/>
+ <span class="DisplayLabel">Agent MD5: </span>
+ <h:outputText value="#{DownloadsUIBean.agentVersionProperties['rhq-agent.latest.md5']}"/>
+ </h:panelGroup>
+
+
+ <h3>Agent Install</h3>
+
+ <p>
+ <b>java -jar <agent-download.jar> --install[=<new agent dir>]</b><br/>
+ When specified, this will install a new agent
+ without attempting to update any existing
+ agent. If you do not specify the directory,
+ the default is:.
+ Note the directory will be the parent of the
+ new agent home installation directory.
+ This is mutually exclusive of --update
+ </p>
+
+
+ <h3>Agent Update</h3>
+
+ <p>
+ <b>java -jar <agent-download.jar> --update[=<old agent home>]</b><br/>
+ When specified, this will update an existing
+ agent. If you do not specify the directory
+ where the existing agent is, the default is:
+ rhq-agent
+ This is mutually exclusive of --install
+ </p>
+
+
+ <h3>Connector Downloads</h3>
+ <ui:repeat var="download" value="#{DownloadsUIBean.connectorDownloadFiles}">
+ <h:outputLink value="/downloads/connectors/#{download.name}">
+ <h:outputText value="#{download.name}"/>
+ </h:outputLink>
+ <br/>
+ </ui:repeat>
+
+ </h:panelGrid>
+ </rich:panel>
+
+ <rich:panel>
+ <f:facet name="header">
+ <h:outputText value="Command Line Client Download"/>
+ </f:facet>
+
+ <h:panelGrid columns="1" width="100%">
+
+ <h:outputLink value="/client/download">
+ <h:graphicImage value="/images/icons/Save_32.png"/>
+ <h:outputText value="Download Client Installer"/>
+ </h:outputLink>
+
+ <h:panelGroup>
+ <span class="DisplayLabel">Client Version: </span> <h:outputText value="#{DownloadsUIBean.clientVersionProperties['rhq-server.version']}"/><br/>
+ <span class="DisplayLabel">Client Build: </span> <h:outputText value="#{DownloadsUIBean.clientVersionProperties['rhq-server.build-number']}"/>
+ </h:panelGroup>
+
+ </h:panelGrid>
+ </rich:panel>
+
+ </ui:define>
+</ui:composition>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/report/resourceInstallReport-body.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/report/resourceInstallReport-body.xhtml
index 65ce5ee..81ac667 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/report/resourceInstallReport-body.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/report/resourceInstallReport-body.xhtml
@@ -48,7 +48,7 @@
<f:facet name="header">
Type
</f:facet>
- <h:outputLink value="#Resources" target="_top">
+ <h:outputLink value="/coregui/CoreGUI.html#Resources" target="_top">
<h:outputText value="#{installReport.typeName}"/>
</h:outputLink>
</rich:column>
commit cadfa16f30d8bad35db39e03a24baae9ef09914f
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Tue Mar 2 08:14:08 2010 -0500
small improvement to getDefaultDisplayName()
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Breadcrumb.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Breadcrumb.java
index 4d61b96..3abac57 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Breadcrumb.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Breadcrumb.java
@@ -98,12 +98,17 @@ public class Breadcrumb {
StringBuilder displayName = new StringBuilder();
boolean first = true;
for (int i = 0; i < this.name.length(); i++) {
- char c = this.name.charAt(i);
- if (Character.isUpperCase(c) && !first) {
- displayName.append(" ");
- }
- first = false;
- displayName.append(c);
+ char currentChar = this.name.charAt(i);
+ if (!first) {
+ if (Character.isUpperCase(currentChar)) {
+ if ((i + 1) == this.name.length() || Character.isLowerCase(this.name.charAt(i + 1))) {
+ displayName.append(" ");
+ }
+ }
+ } else {
+ first = false;
+ }
+ displayName.append(currentChar);
}
return displayName.toString();
}
commit 7d3a71a9a988fa6d57d8a90e7790b52cb191fbf1
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Mon Mar 1 16:04:26 2010 -0500
a couple minor tweaks to the history/breadcrumb API
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 3ab6790..24dbe6e 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
@@ -177,13 +177,15 @@ public class CoreGUI implements EntryPoint {
ViewRenderer viewRenderer = (ViewRenderer)parentView.getCanvas();
List<Breadcrumb> breadcrumbs = new ArrayList<Breadcrumb>(viewIdNames.size());
try {
- for (String viewIdName : viewIdNames) {
+ for (int i = 0, viewIdNamesSize = viewIdNames.size(); i < viewIdNamesSize; i++) {
+ String viewIdName = viewIdNames.get(i);
Canvas parentCanvas = parentView.getCanvas();
if (parentCanvas != null && parentCanvas instanceof ViewRenderer) {
- viewRenderer = (ViewRenderer)parentCanvas;
+ viewRenderer = (ViewRenderer) parentCanvas;
}
ViewId viewId = new ViewId(viewIdName, parentView.getId());
- parentView = viewRenderer.renderView(parentView, viewId);
+ boolean lastNode = (i == (viewIdNamesSize - 1));
+ parentView = viewRenderer.renderView(viewId, parentView, lastNode);
breadcrumbs.add(parentView.getBreadcrumb());
}
} catch (UnknownViewException e) {
@@ -302,14 +304,14 @@ public class CoreGUI implements EntryPoint {
setHeight100(); // (900);
}
- public View renderView(View parentView, ViewId viewId) throws UnknownViewException {
+ public View renderView(ViewId viewId, View parentView, boolean lastNode) throws UnknownViewException {
String path = viewId.getPath();
Canvas canvas = createContent(path);
- if (canvas != null) {
- setContent(canvas);
- return new View(viewId, canvas);
+ if (canvas == null) {
+ throw new UnknownViewException();
}
- throw new UnknownViewException(viewId);
+ setContent(canvas);
+ return new View(viewId, canvas);
}
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UnknownViewException.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UnknownViewException.java
index 8179b86..d5ff736 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UnknownViewException.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UnknownViewException.java
@@ -24,24 +24,10 @@ package org.rhq.enterprise.gui.coregui.client;
* @author Ian Springer
*/
public class UnknownViewException extends Exception {
- private ViewId viewId;
- private String message;
-
- public UnknownViewException(ViewId viewId) {
- this(viewId, null);
- }
-
- public UnknownViewException(ViewId viewId, String message) {
- this.viewId = viewId;
- this.message = message;
+ public UnknownViewException() {
}
- @Override
- public String getMessage() {
- String message = "Unknown view id [" + this.viewId + "]";
- if (this.message != null) {
- message += ": " + this.message;
- }
- return message;
+ public UnknownViewException(String message) {
+ super(message);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewId.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewId.java
index 77c7dd6..9a2406e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewId.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewId.java
@@ -18,9 +18,6 @@
*/
package org.rhq.enterprise.gui.coregui.client;
-import java.util.ArrayList;
-import java.util.List;
-
/**
* TODO
*
@@ -56,21 +53,14 @@ public class ViewId {
public String getPath() {
if (this.path == null) {
StringBuilder buffer = new StringBuilder();
- List<String> names = new ArrayList<String>(5);
- ViewId current = this;
- do {
- names.add(0, current.getName());
- current = current.getParent();
- } while (current != null && !current.getName().equals(ROOT_VIEW_ID.getName()));
- boolean first = true;
- for (String name : names) {
- if (first) {
- first = false;
- } else {
+ if (this.parent != null) {
+ String parentPath = this.parent.getPath();
+ buffer.append(parentPath);
+ if (!parentPath.equals(ROOT_VIEW_ID.getPath())) {
buffer.append(PATH_SEPARATOR);
}
- buffer.append(name);
}
+ buffer.append(this.name);
this.path = buffer.toString();
}
return this.path;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewRenderer.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewRenderer.java
index f2eb39b..d3f237f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewRenderer.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewRenderer.java
@@ -27,10 +27,9 @@ public interface ViewRenderer {
/**
* TODO
*
- * @param parentView
* @param viewId
- * @return
- * @throws UnknownViewException
+ *@param parentView @return
+ * @param lastNode @throws UnknownViewException
*/
- View renderView(View parentView, ViewId viewId) throws UnknownViewException;
+ View renderView(ViewId viewId, View parentView, boolean lastNode) throws UnknownViewException;
}
\ No newline at end of file
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 455b00e..e8804bd 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
@@ -391,12 +391,15 @@ public class AdministrationView extends HLayout implements Presenter, ViewRender
return renderedBreadcrumbs;
}
- public View renderView(View parentView, ViewId viewId) throws UnknownViewException {
- String parentPath = viewId.getParent().getPath();
+ public View renderView(ViewId viewId, View parentView, boolean lastNode) throws UnknownViewException {
+ String parentPath = parentView.getId().getPath();
if (parentPath.equals("Administration")) {
SectionStackSection stackSection = this.sectionStack.getSection(viewId.getName());
if (stackSection != null) {
stackSection.setExpanded(true);
+ if (lastNode) {
+ // TODO: Render some default content for the e.g. Administration/Reports view.
+ }
return new View(viewId, new Breadcrumb(viewId.getName(), false));
}
} else if (parentPath.equals("Administration/Reports")) {
@@ -404,6 +407,6 @@ public class AdministrationView extends HLayout implements Presenter, ViewRender
setContent(canvas);
return new View(viewId, canvas);
}
- throw new UnknownViewException(viewId);
+ throw new UnknownViewException();
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
index aa1f7a9..048db28 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceView.java
@@ -160,14 +160,17 @@ public class ResourceView extends HLayout implements Presenter, ViewRenderer {
contentCanvas.draw();
}
- public View renderView(View parentView, ViewId viewId) throws UnknownViewException {
- String path = viewId.getPathRelativeTo(parentView.getId());
+ public View renderView(ViewId viewId, View parentView, boolean lastNode) throws UnknownViewException {
+ String parentPath = parentView.getId().getPath();
+ if (!parentPath.equals("Resource")) {
+ throw new UnknownViewException();
+ }
int resourceId;
try {
- resourceId = Integer.parseInt(path);
+ resourceId = Integer.parseInt(viewId.getName());
} catch (NumberFormatException e) {
// not a valid Resource id - nothing for us to do
- throw new UnknownViewException(viewId, "Invalid Resource id [" + path + "]");
+ throw new UnknownViewException("Invalid Resource id [" + viewId + "]");
}
if (this.selectedResource == null || this.selectedResource.getId() != resourceId) {
setSelectedResource(resourceId, viewId);
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css
index 2011c8c..4391f58 100644
--- a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css
+++ b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css
@@ -108,7 +108,7 @@ a:hover {
font-size: 12pt;
font-weight: bold;
text-decoration: none;
- color: darkgray;
+ color: #363636;
}
.SectionHeader {
commit b8e74ea0b436305d25b13cbe5df6d81d93c5b824
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Mon Mar 1 13:33:35 2010 -0500
implement Administration>Reports>Inventory Summary page (loads JSF page via IFRAME); revamp history/breadcrumb API
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadCrumb.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadCrumb.java
index 2f5a744..c57c352 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadCrumb.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadCrumb.java
@@ -18,105 +18,89 @@
*/
package org.rhq.enterprise.gui.coregui.client;
-import org.rhq.enterprise.gui.coregui.client.places.Place;
-
-import com.google.gwt.user.client.History;
import com.google.gwt.user.client.Window;
-import com.google.gwt.user.client.ui.Hyperlink;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.widgets.HTMLPane;
-import com.smartgwt.client.widgets.Label;
-import com.smartgwt.client.widgets.layout.HLayout;
-import com.smartgwt.client.widgets.layout.HStack;
import java.util.ArrayList;
+import java.util.List;
/**
+ * GWT widget for the breadcrumb trail, which is displayed at the top of each page.
+ *
* @author Greg Hinkle
+ * @author Ian Springer
*/
public class BreadCrumb extends HTMLPane {
- private ArrayList<Place> trail = new ArrayList<Place>();
+ private List<Breadcrumb> breadcrumbs = new ArrayList<Breadcrumb>();
public BreadCrumb() {
-
setHeight(28);
setBackgroundColor("#E6E3E3");
setPadding(5);
setOverflow(Overflow.CLIP_V);
}
-
- public void initialize(String historyPath) {
- String[] ids =historyPath.split("\\/");
-
- for (String id : ids) {
- trail.add(new Place(id,"?"));
- }
-
+ public List<Breadcrumb> getBreadcrumbs() {
+ return this.breadcrumbs;
}
- public void verify(String historyPath) {
- String[] ids = historyPath.split("\\/");
+ public void setBreadcrumbs(List<Breadcrumb> breadcrumbs) {
+ this.breadcrumbs = breadcrumbs;
+ }
- for (int i = 0; i < ids.length; i++) {
- if (trail.size() > i && !trail.get(i).getId().equals(ids[i])) {
- trail = new ArrayList(trail.subList(0,i));
- trail.add(new Place(ids[i], "?"));
- } else {
- if (trail.size() > i) {
- trail.set(i,new Place(ids[i],"?"));
+ public void refresh() {
+ try {
+ boolean first = true;
+ StringBuilder path = new StringBuilder();
+ StringBuilder content = new StringBuilder();
+ content.append("<div class=\"BreadCrumb\">");
+ for (int i = 0, trailSize = this.breadcrumbs.size(); i < trailSize; i++) {
+ if (!first) {
+ path.append("/");
+ content.append(" > ");
} else {
- trail.add(new Place(ids[i],"?"));
+ first = false;
}
- }
- }
- }
+ Breadcrumb breadcrumb = breadcrumbs.get(i);
+ path.append(breadcrumb.getName());
-
- public void setPlace(Place place) {
- trail.clear();
- addPlace(place);
- }
-
- public void addPlace(Place place) {
- trail.add(place);
-
- refresh();
- }
-
- public void refresh() {
- String content = "";
- boolean first = true;
-
- String path = "";
- for (Place place : trail) {
- if (!first) {
- content += " > ";
- }
- first = false;
- if (path.length() > 0) {
- path += "/";
+ if ((i == (trailSize - 1) || !breadcrumb.isHyperlink())) {
+ // last item in trail is the current page and so should not be a link
+ content.append(breadcrumb.getDisplayName());
+ } else {
+ content.append("<a href=\"#");
+ // NOTE: We have to call toString() below, because GWT chokes if you try to append a StringBuilder.
+ content.append(path.toString());
+ content.append("\">");
+ content.append(breadcrumb.getDisplayName());
+ content.append("</a>");
+ }
+ content.append("\n");
}
- path += place.getId();
-
+ content.append("</div>");
- content += "<a class=\"BreadCrumb\" href=\"#" + path + "\">" + place.getName() + "</a>";
+ setContents(content.toString());
+ } catch (Throwable t) {
+ System.err.println("Failed to refresh bread crumb HTML - cause: " + t);
}
- setContents(content);
-
- History.newItem(path);
- if (!trail.isEmpty())
- Window.setTitle("RHQ: " + trail.get(trail.size()-1));
+ String title = "RHQ";
+ if (!breadcrumbs.isEmpty()) {
+ title += ": " + this.breadcrumbs.get(this.breadcrumbs.size() - 1);
+ }
+ Window.setTitle(title);
redraw();
}
-
- public ArrayList<Place> getTrail() {
- return trail;
+ @Override
+ public String toString() {
+ StringBuilder result = new StringBuilder("BreadCrumb[");
+ result.append(this.breadcrumbs);
+ result.append("]");
+ return result.toString();
}
-
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Breadcrumb.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Breadcrumb.java
new file mode 100644
index 0000000..4d61b96
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Breadcrumb.java
@@ -0,0 +1,110 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client;
+
+/**
+ * Information about a breadcrumb (i.e. history token component) that is used to render that breadcrumb in the
+ * breadcrumb trail at the top of the page.
+ *
+ * @author Ian Springer
+ */
+public class Breadcrumb {
+ private String name;
+ private String displayName;
+ private boolean hyperlink;
+
+ public Breadcrumb(String name) {
+ this(name, null);
+ }
+
+ public Breadcrumb(String name, String displayName) {
+ this(name, displayName, true);
+ }
+
+ public Breadcrumb(String name, boolean hyperlink) {
+ this(name, null, hyperlink);
+ }
+
+ public Breadcrumb(String name, String displayName, boolean hyperlink) {
+ if (name == null) {
+ throw new IllegalArgumentException("Name is null.");
+ }
+ this.name = name;
+ setDisplayName(displayName);
+ this.hyperlink = hyperlink;
+ }
+
+ /**
+ * Returns this breadcrumb's name (e.g. "10001").
+ *
+ * @return this breadcrumb's name (e.g. "10001")
+ */
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * Returns the display name to use for this breadcrumb in the breadcrumb trail, or null if the display name should
+ * be derived from the name.
+ *
+ * @return the display name to use for this breadcrumb in the breadcrumb trail, or null if the display name should
+ * be derived from the name
+ */
+ public String getDisplayName() {
+ return this.displayName;
+ }
+
+ /**
+ * Sets the display name to use for this breadcrumb in the breadcrumb trail, or null if the display name should
+ * be derived from the name.
+ */
+ public void setDisplayName(String displayName) {
+ this.displayName = (displayName != null) ? displayName : getDefaultDisplayName();
+ }
+
+ /**
+ * Return true if this breadcrumb should be a hyperlink in the breadcrumb trail, or false otherwise. NOTE:
+ * Regardless of what this method returns, if this breadcrumb is the last item in the breadcrumb trail, it
+ * will not be made a hyperlink, since it already corr