Author: ito
Date: Wed Jul 21 11:13:21 2010
New Revision: 966181

URL: http://svn.apache.org/viewvc?rev=966181&view=rev
Log:
CLEREZZA-262 globalmenuitem extend with description

Modified:
    
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.dashboard/org.apache.clerezza.platform.dashboard.core/src/main/java/org/apache/clerezza/platform/dashboard/ContextualMenuGenerator.java
    
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.dashboard/org.apache.clerezza.platform.dashboard.core/src/main/java/org/apache/clerezza/platform/dashboard/GlobalMenuItem.java

Modified: 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.dashboard/org.apache.clerezza.platform.dashboard.core/src/main/java/org/apache/clerezza/platform/dashboard/ContextualMenuGenerator.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.dashboard/org.apache.clerezza.platform.dashboard.core/src/main/java/org/apache/clerezza/platform/dashboard/ContextualMenuGenerator.java?rev=966181&r1=966180&r2=966181&view=diff
==============================================================================
--- 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.dashboard/org.apache.clerezza.platform.dashboard.core/src/main/java/org/apache/clerezza/platform/dashboard/ContextualMenuGenerator.java
 (original)
+++ 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.dashboard/org.apache.clerezza.platform.dashboard.core/src/main/java/org/apache/clerezza/platform/dashboard/ContextualMenuGenerator.java
 Wed Jul 21 11:13:21 2010
@@ -40,6 +40,7 @@ import org.apache.clerezza.rdf.core.NonL
 import org.apache.clerezza.rdf.core.TripleCollection;
 import org.apache.clerezza.rdf.core.impl.PlainLiteralImpl;
 import org.apache.clerezza.rdf.core.impl.TripleImpl;
+import org.apache.clerezza.rdf.ontologies.DCTERMS;
 import org.apache.clerezza.rdf.ontologies.RDF;
 import org.apache.clerezza.rdf.ontologies.RDFS;
 import org.apache.clerezza.rdf.utils.RdfList;
@@ -153,6 +154,11 @@ public class ContextualMenuGenerator imp
                        final String label = menu.root.getLabel();
                        Literal labelLiteral = new PlainLiteralImpl(label);
                        mGraph.add(new TripleImpl(node, 
RDFS.label,labelLiteral));
+                       final String description = menu.root.getDescription();
+                       if (description != null) {
+                               Literal descLiteral = new 
PlainLiteralImpl(description);
+                               mGraph.add(new TripleImpl(node, 
DCTERMS.description, descLiteral));
+                       }
                        final String path = menu.root.getPath();
                        if (path != null) {
                                Literal pathLiteral = 
LiteralFactory.getInstance().
@@ -180,6 +186,11 @@ public class ContextualMenuGenerator imp
                        final String label = item.getLabel();
                        Literal labelLiteral = new PlainLiteralImpl(label);
                        mGraph.add(new TripleImpl(node, 
RDFS.label,labelLiteral));
+                       final String description = item.getDescription();
+                       if (description != null) {
+                               Literal descLiteral = new 
PlainLiteralImpl(description);
+                               mGraph.add(new TripleImpl(node, 
DCTERMS.description, descLiteral));
+                       }
                        final String path = item.getPath();
                        if (path != null) {
                                Literal pathLiteral = 
LiteralFactory.getInstance().

Modified: 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.dashboard/org.apache.clerezza.platform.dashboard.core/src/main/java/org/apache/clerezza/platform/dashboard/GlobalMenuItem.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.dashboard/org.apache.clerezza.platform.dashboard.core/src/main/java/org/apache/clerezza/platform/dashboard/GlobalMenuItem.java?rev=966181&r1=966180&r2=966181&view=diff
==============================================================================
--- 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.dashboard/org.apache.clerezza.platform.dashboard.core/src/main/java/org/apache/clerezza/platform/dashboard/GlobalMenuItem.java
 (original)
+++ 
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.dashboard/org.apache.clerezza.platform.dashboard.core/src/main/java/org/apache/clerezza/platform/dashboard/GlobalMenuItem.java
 Wed Jul 21 11:13:21 2010
@@ -27,6 +27,7 @@ public class GlobalMenuItem implements C
 
        private String path;
        private String label;
+       private String description;
        private String identifier;
        private int priority;
        private String groupIdentifier;
@@ -54,6 +55,30 @@ public class GlobalMenuItem implements C
        }
 
        /**
+        * Creates a new <code>GlobalMenuItem</code>.
+        *
+        * @param relativeUri of the resource to be shown in the menu.
+        * @param identifier The identifier of the menu item.
+        * @param label Specifies the label of the menu entry.
+        * @param description The description of the menu item.
+        * @param priority the priority, higher numbers appear first in the menu
+        * @param groupIdentifier Specifies the the identifier of the group of 
which
+        *              the menu item is part.
+        */
+       public GlobalMenuItem(String path, String identifier, String label, 
String description,
+                       int priority, String groupIdentifier) {
+               if (label == null) {
+                       throw new IllegalArgumentException("label may not be 
null");
+               }
+               this.path = path;
+               this.label = label;
+               this.description = description;
+               this.identifier = identifier;
+               this.priority = priority;
+               this.groupIdentifier = groupIdentifier;
+       }
+
+       /**
         * Returns the path of the resource to be shown in the menu. The
         * path is additional to the bundle prefix and if existing to the
         * <code>javax.ws.rs.Path</code> annotation of the
@@ -74,6 +99,14 @@ public class GlobalMenuItem implements C
        }
 
        /**
+        * Returns the description of the menu entry.
+        * @return the groupIdentifier
+        */
+       public String getDescription() {
+               return description;
+       }
+
+       /**
         * Return the identifier of the menu entry.
         *
         * @return
@@ -115,6 +148,9 @@ public class GlobalMenuItem implements C
                if (!this.label.equals(other.label)) {
                        return false;
                }
+               if ((this.description == null) ? (other.description != null) : 
!this.description.equals(other.description)) {
+                       return false;
+               }
                if (this.priority != other.priority) {
                        return false;
                }
@@ -129,6 +165,7 @@ public class GlobalMenuItem implements C
                int hash = 5;
                hash = 53 * hash + (this.path != null ? this.path.hashCode() : 
0);
                hash = 53 * hash + this.label.hashCode();
+               hash = 53 * hash + (this.description != null ? 
this.description.hashCode() : 0);
                hash = 53 * hash + this.priority;
                hash = 53 * hash + (this.groupIdentifier != null ? 
this.groupIdentifier.hashCode() : 0);
                return hash;


Reply via email to