01: /* *****************************************************************************
02: * ElementWithLocationInfo.java
03: * ****************************************************************************/
04:
05: /* J_LZ_COPYRIGHT_BEGIN *******************************************************
06: * Copyright 2001-2004 Laszlo Systems, Inc. All Rights Reserved. *
07: * Use is subject to license terms. *
08: * J_LZ_COPYRIGHT_END *********************************************************/
09:
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 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 e) {
30: return null;
31: }
32: }
33:
34: public ElementWithLocationInfo(String name) {
35: super (name);
36: }
37:
38: public ElementWithLocationInfo(String name, Namespace ns) {
39: super (name, ns);
40: }
41:
42: public ElementWithLocationInfo(String name, String uri) {
43: super (name, uri);
44: }
45:
46: public ElementWithLocationInfo(String name, String prefix,
47: String uri) {
48: super (name, prefix, uri);
49: }
50:
51: public void initSourceLocator(SourceLocator locator) {
52: this .locator = locator;
53: }
54:
55: public SourceLocator getSourceLocator() {
56: return this .locator;
57: }
58:
59: public void setHTMLContent(String s) {
60: mHTMLContent = s;
61: }
62:
63: public String getHTMLContent() {
64: return mHTMLContent;
65: }
66:
67: }
|