You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2009/07/22 22:15:28 UTC

svn commit: r796865 - /incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Menu.java

Author: gbrown
Date: Wed Jul 22 20:15:28 2009
New Revision: 796865

URL: http://svn.apache.org/viewvc?rev=796865&view=rev
Log:
Add a getItem(String):Menu.Item method to Menu.

Modified:
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Menu.java

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Menu.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Menu.java?rev=796865&r1=796864&r2=796865&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Menu.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Menu.java Wed Jul 22 20:15:28 2009
@@ -130,11 +130,11 @@
 
             if (previousMenu != menu) {
                 if (previousMenu != null) {
-                    previousMenu.setItem(null);
+                    previousMenu.item = null;
                 }
 
                 if (menu != null) {
-                    menu.setItem(this);
+                    menu.item = this;
                 }
 
                 this.menu = menu;
@@ -514,22 +514,43 @@
         installSkin(Menu.class);
     }
 
+    /**
+     * Retrieves the parent item of this menu.
+     */
     public Item getItem() {
         return item;
     }
 
-    private void setItem(Item item) {
-        this.item = item;
-    }
-
     public SectionSequence getSections() {
         return sectionSequence;
     }
 
+    /**
+     * Retrieves a named section.
+     *
+     * @param name
+     *
+     * @return
+     * The section with the given name, or <tt>null</tt> if the name does not
+     * exist.
+     */
     public Section getSection(String name) {
         return sectionMap.get(name);
     }
 
+    /**
+     * Retrieves a named item.
+     *
+     * @param name
+     *
+     * @return
+     * The item with the given name, or <tt>null</tt> if the name does not
+     * exist.
+     */
+    public Item getItem(String name) {
+        return itemMap.get(name);
+    }
+
     @Override
     public Sequence<Component> remove(int index, int count) {
         for (int i = index, n = index + count; i < n; i++) {