com.github.gwtbootstrap.client.ui
Class CodeBlock

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.ComplexPanel
                  extended by com.google.gwt.user.client.ui.HTMLPanel
                      extended by com.github.gwtbootstrap.client.ui.CodeBlock
All Implemented Interfaces:
HasProgrammingLanguage, HasAttachHandlers, HasHandlers, EventListener, HasHTML, HasText, HasVisibility, HasWidgets, HasWidgets.ForIsWidget, IndexedPanel, IndexedPanel.ForIsWidget, IsWidget, Iterable<Widget>

public class CodeBlock
extends HTMLPanel
implements HasProgrammingLanguage, HasHTML

Block of Code with syntax highlighting.

Line breaks have to be escaped with "\n".

UiBinder Usage:

 <b:CodeBlock linenums="true">
     public class Person { \n
     \n
     private final String name;\n
     private final int age;\n
     }
 </b:CodeBlock>
 
All arguments are optional.

Since:
2.0.4.0
Author:
Dominik Mayer, Carlos Alexandro Becker
See Also:
Bootstrap documentation, Code

Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
 
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.IndexedPanel
IndexedPanel.ForIsWidget
 
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets
HasWidgets.ForIsWidget
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
CodeBlock()
          Creates an empty widget.
CodeBlock(String content)
          Creates a widget with the content set.
 
Method Summary
 String getHTML()
          
 String getText()
          
protected  void onLoad()
          
 void setHTML(String html)
          Sets the widget's text.
 void setLang(String programmingLanguage)
          Sets the programming language.
 void setLinenums(boolean linenums)
          Sets whether line numbers are shown.
 void setScrollable(boolean scrollable)
          Sets whether the widget should be restricted to a maximum height of 350 px with y-axis scrollbars enabled.
 void setText(String text)
          
 
Methods inherited from class com.google.gwt.user.client.ui.HTMLPanel
add, add, add, addAndReplaceElement, addAndReplaceElement, addAndReplaceElement, addAndReplaceElement, addAndReplaceElement, createUniqueId, getElementById, wrap
 
Methods inherited from class com.google.gwt.user.client.ui.ComplexPanel
add, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, getChildren, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, insert, insert, iterator, remove, remove
 
Methods inherited from class com.google.gwt.user.client.ui.Panel
add, adopt, adopt, clear, disown, doAttachChildren, doDetachChildren, orphan, remove
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onUnload, removeFromParent, setLayoutData, sinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CodeBlock

public CodeBlock()
Creates an empty widget.


CodeBlock

public CodeBlock(String content)
Creates a widget with the content set.

Parameters:
content - the content of the widget
Method Detail

setScrollable

public void setScrollable(boolean scrollable)
Sets whether the widget should be restricted to a maximum height of 350 px with y-axis scrollbars enabled.

Parameters:
scrollable - true to show scrollbars. Default: false

setLinenums

public void setLinenums(boolean linenums)
Sets whether line numbers are shown.

Parameters:
linenums - true to show line numbers. Default: false

getHTML

public String getHTML()

Specified by:
getHTML in interface HasHTML

setHTML

public void setHTML(String html)
Sets the widget's text.

Any HTML content is escaped and displayed as text.

Specified by:
setHTML in interface HasHTML
Parameters:
html - the text to be set

getText

public String getText()

Specified by:
getText in interface HasText

setText

public void setText(String text)

Specified by:
setText in interface HasText

setLang

public void setLang(String programmingLanguage)
Sets the programming language.

Specified by:
setLang in interface HasProgrammingLanguage
Parameters:
programmingLanguage - the programming language

onLoad

protected void onLoad()

Overrides:
onLoad in class Widget


Copyright © 2012 gwtbootstrap. All Rights Reserved.