Author: ips
Date: 2008-11-24 18:36:40 -0500 (Mon, 24 Nov 2008)
New Revision: 59
Modified:
trunk/core/src/main/java/org/jboss/on/embedded/ui/nav/NonSingletonResourceTypeTreeNode.java
trunk/core/src/main/java/org/jboss/on/embedded/ui/nav/SingletonResourceTypeTreeNode.java
Log:
pluralize names of ResourceTypeTreeNodes
Modified:
trunk/core/src/main/java/org/jboss/on/embedded/ui/nav/NonSingletonResourceTypeTreeNode.java
===================================================================
---
trunk/core/src/main/java/org/jboss/on/embedded/ui/nav/NonSingletonResourceTypeTreeNode.java 2008-11-24
01:43:08 UTC (rev 58)
+++
trunk/core/src/main/java/org/jboss/on/embedded/ui/nav/NonSingletonResourceTypeTreeNode.java 2008-11-24
23:36:40 UTC (rev 59)
@@ -67,10 +67,19 @@
public String getName()
{
- return getResourceType().getName();
+ return pluralize(getResourceType().getName());
}
-
- public SummaryActionOutcome getSummaryActionOutcome(SummaryAction action) {
+
+ public SummaryActionOutcome getSummaryActionOutcome(SummaryAction action) {
return action.new NonSingletonResourceTypeOutcome(getResourceType(),
getParentResource());
}
+
+ private static String pluralize(String noun) {
+ if (noun.endsWith("y"))
+ return noun.substring(0, noun.length() - 1) + "ies";
+ else if (noun.endsWith("s"))
+ return noun;
+ else
+ return noun + "s";
+ }
}
Modified:
trunk/core/src/main/java/org/jboss/on/embedded/ui/nav/SingletonResourceTypeTreeNode.java
===================================================================
---
trunk/core/src/main/java/org/jboss/on/embedded/ui/nav/SingletonResourceTypeTreeNode.java 2008-11-24
01:43:08 UTC (rev 58)
+++
trunk/core/src/main/java/org/jboss/on/embedded/ui/nav/SingletonResourceTypeTreeNode.java 2008-11-24
23:36:40 UTC (rev 59)
@@ -21,14 +21,10 @@
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
-import org.jboss.on.embedded.manager.ResourceManager;
-import org.jboss.on.embedded.manager.ResourceManagerFactory;
+
import org.jboss.on.embedded.ui.SummaryAction;
-import org.jboss.on.embedded.ui.SummaryAction.ResourceOutcome;
import org.jboss.on.embedded.ui.SummaryAction.SummaryActionOutcome;
-import java.util.Set;
-
/**
* Class representing a node in the nav tree which holds a resource type
* which is a singleton.
@@ -44,7 +40,8 @@
{
private Resource singletonInstance;
- public SingletonResourceTypeTreeNode(String key, ResourceType type, Resource
singletonInstance, Resource parentResource)
+ public SingletonResourceTypeTreeNode(String key, ResourceType type, Resource
singletonInstance,
+ Resource parentResource)
{
super(key, type, parentResource);
this.singletonInstance = singletonInstance;
Show replies by date