public class AceEditor extends com.google.gwt.user.client.ui.Composite implements com.google.gwt.user.client.ui.RequiresResize, com.google.gwt.user.client.ui.HasText, com.google.gwt.user.client.TakesValue<String>
Constructor and Description |
---|
AceEditor()
Preferred constructor.
|
AceEditor(boolean unused)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
addAnnotation(int row,
int column,
String text,
AceAnnotationType type)
Add an annotation to a the local
annotations JsArray |
static void |
addCompletionProvider(AceCompletionProvider provider)
Add an
AceCompletionProvider to provide
custom code completions. |
void |
addOnChangeHandler(AceEditorCallback callback)
Register a handler for change events generated by the editor.
|
void |
addOnCursorPositionChangeHandler(AceEditorCallback callback)
Register a handler for cursor position change events generated by the editor.
|
void |
clearAnnotations()
Clear any annotations from the editor and reset the local
annotations JsArray |
void |
destroy()
Cleans up the entire editor.
|
AceEditorCursorPosition |
getCursorPosition()
Get the current cursor position.
|
int |
getIndexFromPosition(AceEditorCursorPosition position)
Gets the given document position as a zero-based index.
|
String |
getLine(int row)
Get the line of text at the given row number.
|
AceEditorCursorPosition |
getPositionFromIndex(int index)
Gets a document position from a supplied zero-based index.
|
String |
getText()
Get the complete text in the editor as a String.
|
String |
getValue() |
void |
gotoLine(int line)
Go to given line.
|
void |
insertAtCursor(String text)
Insert given text at the cursor.
|
void |
internalSearch(String id,
String text) |
void |
onResize() |
void |
redisplay()
Call this to force the editor contents to be redisplayed.
|
static void |
removeAllExistingCompleters()
Removes all existing completers from the langtools
This can be used to disable all completers including local completers, which can be very useful when completers are used on very large files (as the local completer tokenizes every word to put in the selected list). NOTE: This method may be removed, and replaced with another solution. |
void |
removeCommand(AceCommand command)
Remove a command from the editor.
|
void |
removeCommandByName(String command)
Remove commands, that may not be required, from the editor
|
void |
search(String text) |
void |
setAnnotations()
Set any annotations which have been added via
addAnnotation on the editor |
void |
setAutocompleteEnabled(boolean b)
Set whether or not autocomplete is enabled.
|
void |
setFontSize(String fontSize)
Set font size.
|
void |
setHighlightSelectedWord(boolean highlightSelectedWord)
Set or unset highlighting of currently selected word.
|
void |
setHScrollBarAlwaysVisible(boolean hScrollBarAlwaysVisible)
Set whether or not the horizontal scrollbar is always visible.
|
void |
setMode(AceEditorMode mode)
Set the mode.
|
void |
setModeByName(String shortModeName)
Set the mode by name.
|
void |
setReadOnly(boolean readOnly)
Set or unset read-only mode.
|
void |
setSearchBox(com.google.gwt.dom.client.Element searchBox) |
void |
setShowGutter(boolean showGutter)
Set whether or not the gutter is shown.
|
void |
setShowPrintMargin(boolean showPrintMargin)
Set or unset the visibility of the print margin.
|
void |
setTabSize(int tabSize)
Set tab size.
|
void |
setText(String text)
Set the complete text in the editor from a String.
|
void |
setTheme(AceEditorTheme theme)
Set the theme.
|
void |
setThemeByName(String themeName)
Set the theme by name.
|
void |
setUseSoftTabs(boolean useSoftTabs)
Set whether or not soft tabs should be used.
|
void |
setUseWrapMode(boolean useWrapMode)
Set whether to use wrap mode or not
|
void |
setValue(String value) |
void |
setVScrollBarVisible(boolean visible) |
void |
startEditor()
Call this method to start the editor.
|
claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString
public AceEditor()
@Deprecated public AceEditor(boolean unused)
public void startEditor()
public void redisplay()
public void destroy()
public void setTheme(AceEditorTheme theme)
theme
- the theme (one of the values in the AceEditorTheme
enumeration)public void setThemeByName(String themeName)
themeName
- the theme name (e.g., "twilight")public void setMode(AceEditorMode mode)
mode
- the mode (one of the values in the
AceEditorMode
enumeration)public void setModeByName(String shortModeName)
shortModeName
- name of mode (e.g., "eclipse")public void addOnChangeHandler(AceEditorCallback callback)
callback
- the change event handlerpublic void addOnCursorPositionChangeHandler(AceEditorCallback callback)
callback
- the cursor position change event handlerpublic void setFontSize(String fontSize)
public String getText()
getText
in interface com.google.gwt.user.client.ui.HasText
public void setText(String text)
setText
in interface com.google.gwt.user.client.ui.HasText
text
- the text to set in the editorpublic String getLine(int row)
row
- the row numberpublic void insertAtCursor(String text)
text
- text to insert at the cursorpublic AceEditorCursorPosition getCursorPosition()
public int getIndexFromPosition(AceEditorCursorPosition position)
position
- the position to obtain the absolute index of (base zero)public AceEditorCursorPosition getPositionFromIndex(int index)
index
- (base zero)public void setUseSoftTabs(boolean useSoftTabs)
useSoftTabs
- true if soft tabs should be used, false otherwisepublic void setTabSize(int tabSize)
tabSize
- the tab size to setpublic void gotoLine(int line)
line
- the line to go topublic void setHScrollBarAlwaysVisible(boolean hScrollBarAlwaysVisible)
hScrollBarAlwaysVisible
- true if the horizontal scrollbar is always
visible, false if it is hidden when not neededpublic void setVScrollBarVisible(boolean visible)
public void setShowGutter(boolean showGutter)
showGutter
- true if the gutter should be shown, false if it should be hiddenpublic void setReadOnly(boolean readOnly)
readOnly
- true if editor should be set to readonly, false if the
editor should be set to read-writepublic void setHighlightSelectedWord(boolean highlightSelectedWord)
highlightSelectedWord
- true to highlight currently selected word, false otherwisepublic void setShowPrintMargin(boolean showPrintMargin)
showPrintMargin
- true if the print margin should be shown, false otherwisepublic void addAnnotation(int row, int column, String text, AceAnnotationType type)
annotations
JsArrayrow
- to which the annotation should be addedcolumn
- to which the annotation appliestext
- to display as a tooltip with the annotationtype
- to be displayed (one of the values in the
AceAnnotationType
enumeration)public void setAnnotations()
addAnnotation
on the editorpublic void clearAnnotations()
annotations
JsArraypublic void removeCommand(AceCommand command)
command
- the command (one of the values in the
AceCommand
enumeration)public void removeCommandByName(String command)
command
- to be removed, one of
"gotoline", "findnext", "findprevious", "find", "replace", "replaceall"public void setUseWrapMode(boolean useWrapMode)
useWrapMode
- true if word wrap should be used, false otherwisepublic void onResize()
onResize
in interface com.google.gwt.user.client.ui.RequiresResize
public void setValue(String value)
setValue
in interface com.google.gwt.user.client.TakesValue<String>
public String getValue()
getValue
in interface com.google.gwt.user.client.TakesValue<String>
public void setAutocompleteEnabled(boolean b)
b
- true if autocomplete should be enabled, false if notpublic static void removeAllExistingCompleters()
public static void addCompletionProvider(AceCompletionProvider provider)
AceCompletionProvider
to provide
custom code completions.
Warning: this is an experimental feature of AceGWT.
It is possible that the API will change in an incompatible way
in future releases.provider
- the AceCompletionProvider
public void setSearchBox(com.google.gwt.dom.client.Element searchBox)
public void search(String text)
Copyright © 2014 JBoss, a division of Red Hat. All rights reserved.