01: // ========================================================================
02: // $Id: List.java,v 1.3 2004/05/09 20:31:28 gregwilkins Exp $
03: // Copyright 1996-2004 Mort Bay Consulting Pty. Ltd.
04: // ------------------------------------------------------------------------
05: // Licensed under the Apache License, Version 2.0 (the "License");
06: // you may not use this file except in compliance with the License.
07: // You may obtain a copy of the License at
08: // http://www.apache.org/licenses/LICENSE-2.0
09: // Unless required by applicable law or agreed to in writing, software
10: // distributed under the License is distributed on an "AS IS" BASIS,
11: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: // See the License for the specific language governing permissions and
13: // limitations under the License.
14: // ========================================================================
15:
16: package org.mortbay.html;
17:
18: /* -------------------------------------------------------------------- */
19: /** HTML List Block.
20: * Each Element added to the List (which is a Composite) is treated
21: * as a new List Item.
22: * @see org.mortbay.html.Block
23: */
24: public class List extends Block {
25: /* ----------------------------------------------------------------- */
26: public static final String Unordered = "ul";
27: public static final String Ordered = "ol";
28: public static final String Menu = "menu";
29: public static final String Directory = "dir";
30:
31: /* ----------------------------------------------------------------- */
32: public List(String type) {
33: super (type);
34: }
35:
36: /* ----------------------------------------------------------------- */
37: /**
38: * @param o The item
39: * @return This List.
40: */
41: public Composite add(Object o) {
42: super .add("<li>");
43: super .add(o);
44: super .add("</li>");
45: return this ;
46: }
47:
48: /* ----------------------------------------------------------------- */
49: /**
50: * @return The new Item composite
51: */
52: public Composite newItem() {
53: super .add("<li>");
54: Composite composite = new Composite();
55: super .add(composite);
56: super .add("</li>");
57: return composite;
58: }
59:
60: }
|