public class CodeBlock extends com.google.gwt.user.client.ui.HTMLPanel implements HasProgrammingLanguage, com.google.gwt.user.client.ui.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>
Codecom.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled| 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, createUniqueId, getElementById, wrapadjustIndex, 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, setParent, sinkEventsaddStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString, unsinkEventspublic CodeBlock()
public CodeBlock(String content)
content - the content of the widgetpublic void setScrollable(boolean scrollable)
scrollable - true to show scrollbars. Default:
falsepublic void setLinenums(boolean linenums)
linenums - true to show line numbers. Default:
falsepublic String getHTML()
getHTML in interface com.google.gwt.user.client.ui.HasHTMLpublic void setHTML(String html)
Any HTML content is escaped and displayed as text.
setHTML in interface com.google.gwt.user.client.ui.HasHTMLhtml - the text to be setpublic String getText()
getText in interface com.google.gwt.user.client.ui.HasTextpublic void setText(String text)
setText in interface com.google.gwt.user.client.ui.HasTextpublic void setLang(String programmingLanguage)
setLang in interface HasProgrammingLanguageprogrammingLanguage - the programming languageprotected void onLoad()
onLoad in class com.google.gwt.user.client.ui.WidgetCopyright © 2016. All rights reserved.