01: /******************************************************************************
02: * DebugCompiler.java
03: * ****************************************************************************/package org.openlaszlo.compiler;
04:
05: import org.jdom.Element;
06: import java.io.File;
07: import java.io.FileNotFoundException;
08: import java.util.*;
09:
10: /**
11: * Compiler for <code>debug</code> element.
12: *
13: * @author Henry Minsky
14: */
15: class DebugCompiler extends ViewCompiler {
16: DebugCompiler(CompilationEnvironment env) {
17: super (env);
18: }
19:
20: static final String DEBUG_WINDOW_CLASSNAME = "LzDebugWindow";
21:
22: /** Returns true iff this class applies to this element.
23: * @param element an element
24: * @return see doc
25: */
26: public static boolean isElement(Element element) {
27: return element.getName().equals("debug");
28: }
29:
30: public void compile(Element element) throws CompilationError {
31: element.setName(DEBUG_WINDOW_CLASSNAME);
32: // If the canvas does not have the debug flag, or if we have already instantiated a debugger,
33: // return now.
34: if (!mEnv.getBooleanProperty(mEnv.DEBUG_PROPERTY)
35: || mEnv.getBooleanProperty(mEnv.USER_DEBUG_WINDOW)
36: // No debug window in DHTML -- it is in its own iframe.
37: || mEnv.isDHTML()) {
38: return;
39: } else {
40: mEnv.setProperty(mEnv.USER_DEBUG_WINDOW, true);
41: super.compile(element);
42: }
43: }
44: }
|