public class CodeBlock extends HTMLPanel implements HasProgrammingLanguage, HasHTML
Line breaks have to be escaped with "\n".
All arguments are optional.<b:CodeBlock linenums="true">
public class Person { \n \n private final String name;\n private final int age;\n }</b:CodeBlock>
Code
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
IndexedPanel.ForIsWidget
HasWidgets.ForIsWidget
DEBUG_ID_PREFIX
Constructor and Description |
---|
CodeBlock()
Creates an empty widget.
|
CodeBlock(String content)
Creates a widget with the content set.
|
Modifier and Type | Method and Description |
---|---|
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) |
add, add, add, addAndReplaceElement, addAndReplaceElement, addAndReplaceElement, addAndReplaceElement, addAndReplaceElement, createUniqueId, getElementById, wrap
add, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, getChildren, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, insert, insert, iterator, remove, remove
add, adopt, adopt, clear, disown, doAttachChildren, doDetachChildren, orphan, remove
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onUnload, removeFromParent, setLayoutData, sinkEvents
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
public CodeBlock()
public void setScrollable(boolean scrollable)
scrollable
- true
to show scrollbars. Default:
false
public void setLinenums(boolean linenums)
linenums
- true
to show line numbers. Default:
false
public void setHTML(String html)
Any HTML content is escaped and displayed as text.
public void setLang(String programmingLanguage)
setLang
in interface HasProgrammingLanguage
programmingLanguage
- the programming languageCopyright © 2012-2014 gwtbootstrap. All Rights Reserved.