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>
CodeUIObject.DebugIdImpl, UIObject.DebugIdImplEnabledIndexedPanel.ForIsWidgetHasWidgets.ForIsWidgetDEBUG_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, wrapadd, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, getChildren, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, insert, insert, iterator, remove, removeadd, adopt, adopt, clear, disown, doAttachChildren, doDetachChildren, orphan, removeaddAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onUnload, removeFromParent, setLayoutData, sinkEventsaddStyleDependentName, 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, unsinkEventspublic CodeBlock()
public void setScrollable(boolean scrollable)
scrollable - true to show scrollbars. Default:
falsepublic void setLinenums(boolean linenums)
linenums - true to show line numbers. Default:
falsepublic void setHTML(String html)
Any HTML content is escaped and displayed as text.
public void setLang(String programmingLanguage)
setLang in interface HasProgrammingLanguageprogrammingLanguage - the programming languageCopyright © 2012-2014 gwtbootstrap. All Rights Reserved.