com.gwtext.client.widgets
Class SyntaxHighlightPanel

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.gwtext.client.widgets.Component
              extended by com.gwtext.client.widgets.BoxComponent
                  extended by com.gwtext.client.widgets.Container
                      extended by com.gwtext.client.widgets.Panel
                          extended by com.gwtext.client.widgets.HTMLPanel
                              extended by com.gwtext.client.widgets.SyntaxHighlightPanel
All Implemented Interfaces:
com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.HasWidgets, Observable, java.lang.Iterable

public class SyntaxHighlightPanel
extends HTMLPanel

This class creates a Syntax Highlight panel for different languages, XML, and HTML for displaying. This class uses the syntaxhighlighter library found at: http://code.google.com/p/syntaxhighlighter/


Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
 
Field Summary
static java.lang.String SYNTAX_CPP
           
static java.lang.String SYNTAX_CSHARP
           
static java.lang.String SYNTAX_CSS
           
static java.lang.String SYNTAX_DELPHI
           
static java.lang.String SYNTAX_HTML
           
static java.lang.String SYNTAX_JAVA
           
static java.lang.String SYNTAX_JAVASCRIPT
           
static java.lang.String SYNTAX_PASCAL
           
static java.lang.String SYNTAX_PHP
           
static java.lang.String SYNTAX_PYTHON
           
static java.lang.String SYNTAX_RUBY
           
static java.lang.String SYNTAX_SQL
           
static java.lang.String SYNTAX_VB
           
static java.lang.String SYNTAX_XML
           
 
Fields inherited from class com.gwtext.client.widgets.Component
config, id
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
SyntaxHighlightPanel()
          Create a new SyntaxHighlightPanel.
SyntaxHighlightPanel(java.lang.String code, java.lang.String syntaxType)
          Create a new SyntaxHighlightPanel.
 
Method Summary
protected  com.google.gwt.core.client.JavaScriptObject create(com.google.gwt.core.client.JavaScriptObject config)
           
protected  com.google.gwt.core.client.JavaScriptObject createJ(com.google.gwt.core.client.JavaScriptObject config)
           
 void setCollapseAll(boolean collapseAll)
          Method to collapse the code
 void setFirstLine(int firstLine)
          Method to set what line to start showing
 void setHtml(java.lang.String code)
          sets the code to the SyntaxHighlightPanel.
 void setShowColumns(boolean showColumns)
          Method to show columns
 void setShowControls(boolean showControls)
          Method to show controls
 void setShowGutter(boolean showGutter)
          Method to show gutter
protected  java.lang.String setSyntaxHighlight()
          This method is called internally to set the html to use the textarea with a specific name and classname for the library to use its specific css
 void updateHtml(java.lang.String html)
          This method can be called after the component is rendered so that it can update the code
 void updateHtml(java.lang.String html, java.lang.String syntaxType)
          This method can be called after the component is rendered so that it can update the code
 
Methods inherited from class com.gwtext.client.widgets.Panel
addButton, addListener, addTool, collapse, collapse, expand, expand, getBaseCls, getBody, getBodyStyle, getBodyWrap, getBottomToolbar, getCollapsedCls, getCollapseFirst, getConfigPrototype, getFloating, getFooter, getFrameHeight, getFrameWidth, getHeader, getHtml, getIconCls, getInnerHeight, getInnerWidth, getMinButtonWidth, getShadowOffset, getTabCls, getTitle, getTopToolbar, getUpdateManager, getXType, isAnimCollapse, isAutoScroll, isBodyBorder, isBorder, isClosable, isCollapsed, isCollapsible, isFrame, isHeader, isHeaderAsText, isHideCollapseTool, isMaskDisabled, isShadow, isShim, isTitleCollapse, load, load, setAnimCollapse, setAutoLoad, setAutoLoad, setAutoScroll, setBaseCls, setBodyBorder, setBodyStyle, setBorder, setBottomToolbar, setBottomToolbar, setBottomToolbar, setButtonAlign, setButtons, setClosable, setCollapsed, setCollapsedCls, setCollapseFirst, setCollapsible, setContentEl, setDraggable, setFloating, setFooter, setFrame, setHeader, setHeaderAsText, setHideCollapseTool, setIconCls, setMargins, setMargins, setMaskDisabled, setMinButtonWidth, setPaddings, setPaddings, setShadow, setShadow, setShadowOffset, setShim, setTabCls, setTitle, setTitle, setTitleCollapse, setTools, setTopToolbar, setTopToolbar, setTopToolbar, toggleCollapse, toggleCollapse
 
Methods inherited from class com.gwtext.client.widgets.Container
add, add, add, add, addListener, bubble, cascade, clear, doLayout, doLayout, findBy, findByID, findByType, getActiveItem, getActiveItemID, getAutoDestroy, getBufferResize, getComponent, getComponent, getComponents, getHideBorders, getItems, getLayout, getMonitorResize, insert, iterator, remove, remove, remove, remove, removeAll, removeAll, setActiveItem, setActiveItemID, setAutoDestroy, setBufferResize, setDefaults, setHideBorders, setLayout, setMonitorResize
 
Methods inherited from class com.gwtext.client.widgets.BoxComponent
addListener, doOnRender, doOnRender, getAutoHeight, getAutoWidth, getBox, getBox, getHeight, getPosition, getPosition, getSize, getWidth, setAutoHeight, setAutoWidth, setHeight, setHeight, setPagePosition, setPosition, setSize, setSize, setWidth, setWidth, syncSize, updateBox
 
Methods inherited from class com.gwtext.client.widgets.Component
addClass, addClassCreated, addEvent, addEvents, addListener, addListener, addListener, addPlugin, addStyleDependentName, addStyleName, afterRender, beforeDestroy, check, checkExtVer, cloneComponent, cloneComponent, cloneConfig, destroy, disable, enable, equals, error, findParentBy, findParentByType, fireEvent, focus, focus, focus, focus, getApplyTo, getAttribute, getAttributeAsBoolean, getAttributeAsFloat, getAttributeAsInt, getAttributeAsJavaScriptObject, getAutoShow, getCls, getComponentJS, getConfig, getConfigAsString, getCtCls, getDisabledClass, getEl, getElement, getElement, getElement, getHideMode, getHideParent, getId, getItemId, getJsObj, getOffsetHeight, getOffsetWidth, getOrCreateJsObj, getOwnerContainer, getRenderTo, getStateEvents, getStateId, getXTypes, hashCode, hide, initComponent, isCreated, isDisabled, isHidden, isRendered, isVisible, isXType, isXType, onDestroy, purgeListeners, removeClass, removeStyleDependentName, removeStyleName, render, render, render, render, render, render, resumeEvents, setApplyTo, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAutoEl, setAutoEl, setAutoShow, setCls, setCtCls, setDisabled, setDisabledClass, setEl, setEl, setElement, setHideMode, setHideParent, setId, setRenderTo, setRenderToID, setStateEvents, setStateId, setStyle, setStyle, setStyleName, setStylePrimaryName, setVisible, show, suspendEvents, toString
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
doAttachChildren, doDetachChildren, getParent, isAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, isVisible, onEnsureDebugId, setElement, setPixelSize, setStyleName, setStyleName, setStylePrimaryName, setVisible, sinkEvents, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SYNTAX_CPP

public static final java.lang.String SYNTAX_CPP
See Also:
Constant Field Values

SYNTAX_CSHARP

public static final java.lang.String SYNTAX_CSHARP
See Also:
Constant Field Values

SYNTAX_CSS

public static final java.lang.String SYNTAX_CSS
See Also:
Constant Field Values

SYNTAX_PASCAL

public static final java.lang.String SYNTAX_PASCAL
See Also:
Constant Field Values

SYNTAX_DELPHI

public static final java.lang.String SYNTAX_DELPHI
See Also:
Constant Field Values

SYNTAX_JAVA

public static final java.lang.String SYNTAX_JAVA
See Also:
Constant Field Values

SYNTAX_JAVASCRIPT

public static final java.lang.String SYNTAX_JAVASCRIPT
See Also:
Constant Field Values

SYNTAX_PHP

public static final java.lang.String SYNTAX_PHP
See Also:
Constant Field Values

SYNTAX_PYTHON

public static final java.lang.String SYNTAX_PYTHON
See Also:
Constant Field Values

SYNTAX_RUBY

public static final java.lang.String SYNTAX_RUBY
See Also:
Constant Field Values

SYNTAX_SQL

public static final java.lang.String SYNTAX_SQL
See Also:
Constant Field Values

SYNTAX_VB

public static final java.lang.String SYNTAX_VB
See Also:
Constant Field Values

SYNTAX_XML

public static final java.lang.String SYNTAX_XML
See Also:
Constant Field Values

SYNTAX_HTML

public static final java.lang.String SYNTAX_HTML
See Also:
Constant Field Values
Constructor Detail

SyntaxHighlightPanel

public SyntaxHighlightPanel()
Create a new SyntaxHighlightPanel.


SyntaxHighlightPanel

public SyntaxHighlightPanel(java.lang.String code,
                            java.lang.String syntaxType)
Create a new SyntaxHighlightPanel.

Parameters:
code - the code to show in the panel
syntaxType - is one of the available types:
  • SyntaxHighlightPanel.SYNTAX_CPP
  • SyntaxHighlightPanel.SYNTAX_CSHARP
  • SyntaxHighlightPanel.SYNTAX_CSS
  • SyntaxHighlightPanel.SYNTAX_PASCAL
  • SyntaxHighlightPanel.SYNTAX_DELPHI
  • SyntaxHighlightPanel.SYNTAX_JAVA
  • SyntaxHighlightPanel.SYNTAX_JAVASCRIPT
  • SyntaxHighlightPanel.SYNTAX_PHP
  • SyntaxHighlightPanel.SYNTAX_PYTHON
  • SyntaxHighlightPanel.SYNTAX_RUBY
  • SyntaxHighlightPanel.SYNTAX_SQL
  • SyntaxHighlightPanel.SYNTAX_VB
  • SyntaxHighlightPanel.SYNTAX_XML
  • SyntaxHighlightPanel.SYNTAX_HTML
Method Detail

setHtml

public void setHtml(java.lang.String code)
sets the code to the SyntaxHighlightPanel. This is the code that will be displayed in the panel

Overrides:
setHtml in class Panel
Parameters:
code - is the code to display in the panel

updateHtml

public void updateHtml(java.lang.String html,
                       java.lang.String syntaxType)
This method can be called after the component is rendered so that it can update the code

Parameters:
html - the code fragment to hightlight
syntaxType - the syntax type

updateHtml

public void updateHtml(java.lang.String html)
This method can be called after the component is rendered so that it can update the code

Parameters:
html - the code fragment to hightlight

setSyntaxHighlight

protected java.lang.String setSyntaxHighlight()
This method is called internally to set the html to use the textarea with a specific name and classname for the library to use its specific css

Returns:
the String that will be used for the setHtml.

create

protected com.google.gwt.core.client.JavaScriptObject create(com.google.gwt.core.client.JavaScriptObject config)
Overrides:
create in class Panel

createJ

protected com.google.gwt.core.client.JavaScriptObject createJ(com.google.gwt.core.client.JavaScriptObject config)

setShowGutter

public void setShowGutter(boolean showGutter)
Method to show gutter

Parameters:
showGutter - true or false to show gutter

setShowControls

public void setShowControls(boolean showControls)
Method to show controls

Parameters:
showControls - true or false to show controls

setCollapseAll

public void setCollapseAll(boolean collapseAll)
Method to collapse the code

Parameters:
collapseAll - true or false to collapse or not the code

setFirstLine

public void setFirstLine(int firstLine)
Method to set what line to start showing

Parameters:
firstLine - integer of the line to show first

setShowColumns

public void setShowColumns(boolean showColumns)
Method to show columns

Parameters:
showColumns - true or false to show columns or not