View Javadoc

1   /*
2    * $Id: Item.java 2993 2011-11-24 19:51:48Z andrewinkler $
3    * ============================================================================
4    * Project gluehloch-homepage-core
5    * Copyright (c) 2004-2007 by Andre Winkler. All rights reserved.
6    * ============================================================================
7    *          GNU LESSER GENERAL PUBLIC LICENSE
8    *  TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
9    *
10   *  This library is free software; you can redistribute it and/or
11   *  modify it under the terms of the GNU Lesser General Public
12   *  License as published by the Free Software Foundation; either
13   *  version 2.1 of the License, or (at your option) any later version.
14   *
15   *  This library is distributed in the hope that it will be useful,
16   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18   *  Lesser General Public License for more details.
19   *
20   *  You should have received a copy of the GNU Lesser General Public
21   *  License along with this library; if not, write to the Free Software
22   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23   *
24   */
25  
26  package de.awtools.homegen.navigation;
27  
28  import java.util.ArrayList;
29  import java.util.List;
30  
31  /**
32   * Ein <code>Item</code> aus der <code>navigation.xml</code>.
33   *
34   * @version $LastChangedRevision: 2993 $ $LastChangedDate: 2011-11-24 20:51:48 +0100 (Thu, 24 Nov 2011) $
35   * @author by Andre Winkler, $LastChangedBy: andrewinkler $
36   */
37  public final class Item extends HRef {
38  
39      // -- name ----------------------------------------------------------------
40  
41      /** Bezeichner des Items. */
42      private String name;
43  
44      /**
45       * Liefert den Bezeichner.
46       *
47       * @return Der Bezeichner.
48       */
49      public String getName() {
50          return name;
51      }
52  
53      /**
54       * Setzt den Bezeichner.
55       *
56       * @param value Der Bezeichner.
57       */
58      public void setName(final String value) {
59          name = value;
60      }
61  
62      // -- subitems ------------------------------------------------------------
63  
64      /** Eine Liste mit Items. Hierarchie Ebenen für Menüs. */
65      private final List<Item> subItems = new ArrayList<Item>();
66  
67      /**
68       * Liefert eine Liste von {@link Item}s.
69       *
70       * @return Eine Liste von {@link Item}s.
71       *
72       * @since 1.1
73       */
74      public List<Item> getSubItems() {
75          return subItems;
76      }
77  
78      /**
79       * Fügt ein Item der Liste hinzu.
80       *
81       * @param item Ein Item.
82       *
83       * @since 1.1
84       */
85      public void addItem(final Item item) {
86          subItems.add(item);
87      }
88  
89      /**
90       * Hat dieses Item ein oder mehrere SubItems? D.h. sind diesem Item weitere
91       * Items untergeordnet?
92       *
93       * @return Gibt es weitere Items unterhalb dieses Items?
94       *
95       * @since 1.1
96       */
97      public boolean hasSubItems() {
98          return (!subItems.isEmpty());
99      }
100 
101 }