KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > xml > xmlc > metadata > HTMLTagSetDef


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  *
19  * Contributor(s):
20  *
21  * $Id: HTMLTagSetDef.java,v 1.1.1.1 2003/03/10 16:36:23 taweili Exp $
22  */

23
24 package org.enhydra.xml.xmlc.metadata;
25
26 import java.util.ArrayList JavaDoc;
27
28 /**
29  * Base class used for defining a proprietary set of HTML tags.
30  */

31 abstract class HTMLTagSetDef {
32     /**
33      * Tag and attribute definitions.
34      */

35     private ArrayList JavaDoc tagDefs = new ArrayList JavaDoc();
36     private ArrayList JavaDoc attrDefs = new ArrayList JavaDoc();
37
38     /**
39      * Is set completed (can't modify);
40      */

41     private boolean readOnly = false;
42
43     /**
44      * Check if class can be modified.
45      */

46     private void modifyCheck() {
47         if (readOnly) {
48             throw new UnsupportedOperationException JavaDoc("HTMLTagSetDef object is read-only");
49         }
50     }
51
52     /**
53      * Add an tag definition.
54      */

55     protected void addTagDef(HTMLTagDef tagDef) {
56         modifyCheck();
57         tagDefs.add(tagDef);
58     }
59
60     /**
61      * Add an attribute definition.
62      */

63     protected void addAttrDef(HTMLAttrDef attrDef) {
64         modifyCheck();
65         attrDefs.add(attrDef);
66     }
67     /**
68      * Mark readonly.
69      */

70     protected void setReadOnly() {
71         readOnly = true;
72     }
73
74     /**
75      * Get the tag definitions.
76      */

77     public HTMLTagDef[] getTagDefs() {
78         return (HTMLTagDef[])tagDefs.toArray(new HTMLTagDef[tagDefs.size()]);
79     }
80
81     /**
82      * Get the attribute definitions.
83      */

84     public HTMLAttrDef[] getAttrDefs() {
85         return (HTMLAttrDef[])attrDefs.toArray(new HTMLAttrDef[attrDefs.size()]);
86     }
87 }
88
Popular Tags