GWT Tk 0.2.3

asquare.gwt.debug.client
Class DebugConsole

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.Panel
              extended by com.google.gwt.user.client.ui.SimplePanel
                  extended by com.google.gwt.user.client.ui.PopupPanel
                      extended by com.google.gwt.user.client.ui.DialogBox
                          extended by asquare.gwt.debug.client.DebugConsole
All Implemented Interfaces:
EventListener, EventPreview, HasHTML, HasText, HasWidgets, MouseListener, SourcesPopupEvents

public class DebugConsole
extends DialogBox

An in-browser debug console. By default you can press 'w' twice to disable this console without disabling other debug output. Uses a DebugEventListener to listen for the enabler key. See DebugEventListener for potential conflicts with popup/dialog event filtering.

It is preferable to print debug statements through Debug since a stub implementation is provided to remove it from the deliverable.

Opera stops displaying text after a while. This may be due to a maximum text node size limitation: QuirksMode issue.

CSS Style Rules

See Also:
Debug.print(String), Debug.println(String), DebugEventListener

Field Summary
static char DEFAULT_ENABLE_KEY
           
 
Constructor Summary
protected DebugConsole()
          Creates the console, installs the enabler key listener.
 
Method Summary
 void clearMessages()
          Clears all messages from the console.
 void disable()
          Disables and hides the console.
 void enable()
          Enables the console.
static DebugConsole getInstance()
          Get the sole instance of the console, creating if necessary.
 void hide()
          Overrides popup's implementation to prevent event filtering ala EventPreview
 void print(String text)
          Prints a string to the console.
 void println(String text)
          Prints a string to the console, followed by a "\r\n".
 void setEnableKey(char keyCode)
          Set the key which is pressed twice to enable/disable the console.
 void show()
          Overrides popup's implementation to prevent event filtering ala EventPreview
 
Methods inherited from class com.google.gwt.user.client.ui.DialogBox
getHTML, getText, onMouseDown, onMouseEnter, onMouseLeave, onMouseMove, onMouseUp, remove, setHTML, setText, setWidget
 
Methods inherited from class com.google.gwt.user.client.ui.PopupPanel
addPopupListener, getPopupLeft, getPopupTop, onEventPreview, onKeyDownPreview, onKeyPressPreview, onKeyUpPreview, removePopupListener, setPopupPosition
 
Methods inherited from class com.google.gwt.user.client.ui.SimplePanel
add, getContainerElement, getWidget, iterator
 
Methods inherited from class com.google.gwt.user.client.ui.Panel
adopt, clear, disown, onAttach, onDetach
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
getParent, isAttached, onBrowserEvent, onLoad, removeFromParent
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleName, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleName, getTitle, isVisible, isVisible, removeStyleName, setElement, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setTitle, setVisible, setVisible, setWidth, sinkEvents, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_ENABLE_KEY

public static final char DEFAULT_ENABLE_KEY
See Also:
Constant Field Values
Constructor Detail

DebugConsole

protected DebugConsole()
Creates the console, installs the enabler key listener. The console is not attached to the DOM yet.

Method Detail

getInstance

public static DebugConsole getInstance()
Get the sole instance of the console, creating if necessary.


setEnableKey

public void setEnableKey(char keyCode)
Set the key which is pressed twice to enable/disable the console.

Parameters:
keyCode -

enable

public void enable()
Enables the console. It will be shown when the next message is printed.


disable

public void disable()
Disables and hides the console.


clearMessages

public void clearMessages()
Clears all messages from the console.


print

public void print(String text)
Prints a string to the console. Direct use of this method is discouraged.

Parameters:
text -
See Also:
Debug.print(String)

println

public void println(String text)
Prints a string to the console, followed by a "\r\n". Direct use of this method is discouraged.

Parameters:
text -
See Also:
Debug.println(String)

show

public void show()
Overrides popup's implementation to prevent event filtering ala EventPreview

Overrides:
show in class PopupPanel

hide

public void hide()
Overrides popup's implementation to prevent event filtering ala EventPreview

Overrides:
hide in class PopupPanel

GWT Tk 0.2.3

© 2007 Mat Gessel