KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openlaszlo > compiler > ElementWithLocationInfo


1 /* *****************************************************************************
2  * ElementWithLocationInfo.java
3 * ****************************************************************************/

4
5 /* J_LZ_COPYRIGHT_BEGIN *******************************************************
6 * Copyright 2001-2004 Laszlo Systems, Inc. All Rights Reserved. *
7 * Use is subject to license terms. *
8 * J_LZ_COPYRIGHT_END *********************************************************/

9
10 package org.openlaszlo.compiler;
11
12 import org.jdom.Namespace;
13
14 // TODO [2003-05-03 ptw] Rename this ElementAnnotated
15
// [ows] or AnnotatedElement
16

17 /** A subclass of JDOM Element which can store info about the
18  * location in the XML source file that this it parsed from.
19  */

20 public class ElementWithLocationInfo extends org.jdom.Element {
21     SourceLocator locator = new SourceLocator();
22     String JavaDoc mHTMLContent = null;
23     // The compiler model object that represents this element
24
NodeModel model = null;
25
26     public static SourceLocator getSourceLocator(org.jdom.Element elt) {
27         try {
28             return ((ElementWithLocationInfo) elt).getSourceLocator();
29         } catch (ClassCastException JavaDoc e) {
30             return null;
31         }
32     }
33
34     public ElementWithLocationInfo (String JavaDoc name) {
35         super(name);
36     }
37
38     public ElementWithLocationInfo (String JavaDoc name, Namespace ns) {
39         super(name, ns);
40     }
41
42     public ElementWithLocationInfo (String JavaDoc name, String JavaDoc uri) {
43         super(name, uri);
44     }
45
46     public ElementWithLocationInfo (String JavaDoc name, String JavaDoc prefix, String JavaDoc uri) {
47         super(name, prefix, uri);
48     }
49     
50     public void initSourceLocator(SourceLocator locator) {
51         this.locator = locator;
52     }
53
54     public SourceLocator getSourceLocator() {
55         return this.locator;
56     }
57
58     public void setHTMLContent(String JavaDoc s) {
59         mHTMLContent = s;
60     }
61
62     public String JavaDoc getHTMLContent() {
63         return mHTMLContent;
64     }
65
66 }
67
Popular Tags