Author: ips
Date: 2009-04-22 13:25:09 -0400 (Wed, 22 Apr 2009)
New Revision: 320
Modified:
trunk/core/src/main/java/org/jboss/on/embedded/ui/NavigationAction.java
Log:
disable Control tab for the platform Resource
(
https://jira.jboss.org/jira/browse/EMBJOPR-157); misc. cosmetic cleanup
Modified: trunk/core/src/main/java/org/jboss/on/embedded/ui/NavigationAction.java
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/ui/NavigationAction.java 2009-04-22
16:35:50 UTC (rev 319)
+++ trunk/core/src/main/java/org/jboss/on/embedded/ui/NavigationAction.java 2009-04-22
17:25:09 UTC (rev 320)
@@ -35,6 +35,7 @@
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceCreationDataType;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.ResourceCategory;
import org.richfaces.component.UITree;
import org.jboss.seam.ScopeType;
@@ -258,58 +259,44 @@
// probably move there too or just move it to a Tab related class
public List<String> getEnabledTabs()
{
- List<String> enabledTabs = new ArrayList<String>();
-
+ List<String> enabledTabs = new ArrayList<String>(4);
JONTreeNode currentNode = getSelectedNode();
if (currentNode instanceof TreeNodeWithResource)
{
Resource resource = ((TreeNodeWithResource) currentNode).getResource();
if (hasConfiguration(resource))
- {
enabledTabs.add(Constants.TAB_CONFIGURATION);
- }
if (hasMetrics(resource))
- {
enabledTabs.add(Constants.TAB_METRIC);
- }
- if (hasOperations(resource))
- {
+ if (resource.getResourceType().getCategory() != ResourceCategory.PLATFORM
&& hasOperations(resource))
enabledTabs.add(Constants.TAB_OPERATION);
- }
- if (hasContent(resource))
- {
+ if (isContentBacked(resource))
enabledTabs.add(Constants.TAB_CONTENT);
- }
}
-
return enabledTabs;
}
- private boolean hasContent(Resource resource)
+ private boolean isContentBacked(Resource resource)
{
- return
resource.getResourceType().getCreationDataType().equals(ResourceCreationDataType.CONTENT);
+ return
(resource.getResourceType().getCreationDataType().equals(ResourceCreationDataType.CONTENT));
}
private boolean hasOperations(Resource resource)
{
List operations = getManager().getOperationsForResource(resource);
- return operations != null && operations.size() > 0;
+ return (!operations.isEmpty());
}
private boolean hasMetrics(Resource resource)
{
Set metrics = resource.getResourceType().getMetricDefinitions();
- return metrics != null && metrics.size() > 0;
+ return (metrics != null && !metrics.isEmpty());
}
private boolean hasConfiguration(Resource resource)
{
- boolean hasConfiguration = false;
- ConfigurationDefinition resourceConfigurationDef =
- resource.getResourceType().getResourceConfigurationDefinition();
- if (resourceConfigurationDef != null)
- hasConfiguration = resourceConfigurationDef.getPropertyDefinitions().size()
> 0;
- return hasConfiguration;
+ ConfigurationDefinition resourceConfigDef =
resource.getResourceType().getResourceConfigurationDefinition();
+ return (resourceConfigDef != null &&
!resourceConfigDef.getPropertyDefinitions().isEmpty());
}
// @TODO Another method that we should move to CommonActionUtil. I also think there
should be a way