public class EditorImpl extends Editor<ChuiOutputManager>
| Modifier and Type | Class and Description |
|---|---|
protected class |
EditorImpl.LocalChuiFocusListener
Some actions on focus hanging.
|
Editor.Line, Editor.LocalFocusListener| Modifier and Type | Field and Description |
|---|---|
private static int |
EDITOR_TAB_SIZE
Editor widget TAB size in spaces.
|
private boolean |
fakeInsert
If true then the editor is into read-only mode and INSERT key hasn't
been pressed.
|
CR, forceRedraw, insert, LF, lineBuilder, maxSizes, parsedText, SPACE, SPACE_LF, widgetFocusedconfiglisteners, location, mousePtr, nativeInsets, physicalLocation| Constructor and Description |
|---|
EditorImpl(WidgetId id,
EditorConfig cfg)
Special constructor used to restore component using given configuration.
|
| Modifier and Type | Method and Description |
|---|---|
protected int |
absoluteX()
Get absolute horizontal position in text.
|
void |
afterConfigUpdate(EditorConfig beforeUpdate)
The method is called after the configuration associated with
the implementor changes.
|
private void |
appendLine()
Handle APPEND-LINE event.
|
protected double |
calcHpos(double size)
Calculate horizontal position of the scroll-bar thumb.
|
protected double |
calcVpos(double size)
Calculate vertical position of the scroll-bar thumb.
|
protected void |
cursorEndOfLine()
Move cursor to the end of line.
|
protected void |
cursorLeft()
Move cursor one char left, if possible.
|
protected void |
cursorPos(int pos)
Split absolute horizontal cursor position into two components - position
of the first visible character and relative cursor position in the
visible region.
|
protected void |
cursorRight()
Move cursor one char right.
|
private boolean |
deleteLineWorker()
Delete the line of text in which the cursor currently resides.
|
private void |
deleteWord()
Delete word.
|
void |
draw(Color color)
Actual drawing routine.
|
void |
drawCaretUnconditionally()
Sets position of terminal's cursor unconditionally (even if this editor
is not in focus).
|
private void |
editorBackTab()
Handle EDITOR-BACKTAB event.
|
private void |
editorTab()
Handle EDITOR-TAB event.
|
protected FocusListener |
getFocusListener()
Get the focus listener instance.
|
private boolean |
getInsertMode()
Returns the insert mode state.
|
protected int |
getNextSplitPosition(java.lang.String line,
int splitAfter)
Get the next split position of this line, so that it fits the editor.
|
private int |
getNextWordSize()
Get length of the first word in the next row.
|
protected boolean |
goToNewLine(java.lang.String subtext,
boolean placeChar)
Check if the given text needs to output on a new line.
|
protected boolean |
insertBlankLineOnLF()
Determine if a blank line needs to be inserted when RETURN key is pressed on a empty line.
|
protected void |
mergeLines(int row)
Merge line with subsequent one(s) if possible
|
private void |
openLineAbove()
Insert empty line above current line.
|
protected void |
placeLF()
Place new line character at current cursor position.
|
private java.lang.String |
prepareTextRow(boolean uninit,
int width,
java.lang.String space,
int line)
Prepare text for display.
|
protected java.lang.String |
processEOLChars(java.lang.String src)
Processing for unusual EOL characters in ChUI mode.
|
void |
processKeyEvent(KeyInput ke)
Process KeyEvents for this widget.
|
boolean |
setCursorChar(int pos,
boolean redraw)
Sets the cursor position in the current line
|
protected void |
setCursorX(int pos)
Calculate and set the cursor X position.
|
protected void |
setInsertMode(boolean mode)
Changes the insert mode state in the window.
|
void |
setLabelInstance(Label<ChuiOutputManager> label)
Assign new instance of
Label to the fill-in widget. |
protected <C extends WidgetConfig> |
updateSizeWorker(C beforeUpdate)
Instructs the widget that its size may have changed.
|
private void |
wordLeft()
Move cursor one word left.
|
private void |
wordRight()
Move cursor one word right.
|
absoluteY, addIndent, backspace, bell, canMovetoTop, canPlaceChar, clear, contentLength, currentFocus, cursorBeginOfLine, cursorDown, cursorEndOfPrevLine, cursorHome, cursorRightTo, cursorUp, defaultFocus, deleteCharacter, deleteCharacterKey, deleteLine, deleteToEndOfLine, draw, drawCaret, editorReadFile, editorSaveFile, fireValueChanged, focusTraversable, fullHeight, getChangedValue, getCursorChar, getCursorLine, getCursorOffset, getIndentSize, getLength, getLine, getLineCount, getLineText, getMaxSize, getText, getValue, initialize, insertFile, insertString, lastRow, manageSystemActions, parseContent, parseContentImpl, placeChar, placeChar, refresh, replaceSelectionText, replaceString, requestFocus, resolveContent, rtrim, search, setCursorChar, setCursorLine, setCursorLineAndChar, setCursorOffset, setCursorOffset, setSelection, setValue, splitLine, updateOffsetconfig, copyState, defaultMousePtr, destroy, getColon, getColumnLabelText, getColumnMnemonic, getLabelInstance, getLabelText, getMnemonic, getTo, isForceLabel, isModified, isNoLabels, isRightAligned, postprocessConfig, setColumnMnemonic, setHidden, setMnemonic, setNoLabels, setVisible, setWasVisible, wasVisibleminimumSize, requestFocusadd, add, add, addContainerStateListener, addDirectly, belongsTo, checkWidget, childrenLocation, clipping, clipRectangle, currentFocus, cycleFocus, deregisterSelectedWidget, detach, dimension, doLayout, dumpCurrentWidgets, dumpWidgets, endSizeChange, findMouseSource, firstFocus, focus, focusWorker, formatDump, get, getAllSelectedWidgets, getClipRect, getEffectiveScrollableSize, getFocusInt, getIgnoreFocus, getLayout, getScrollableSize, getTabItemList, hasFocusable, height, insets, lastFocus, moveAfterTabItem, moveBeforeTabItem, moveToBottom, moveToBottomInClass, moveToTop, moveToTopInClass, moveToZpos, nextFocus, normalizeZOrder, onWidgetAdded, onWidgetRemoved, paintOnTop, parentOf, prepareWidgets, prevFocus, reflectAncestorChange, reflectLocationChanged, registerSelectedWidget, remove, removeContainerStateListener, repaint, replace, requestFocus, setFocus, setFocusInt, setHeight, setIgnoreFocus, setInsets, setLayout, setPhysicalDimensionInt, setSize, setSize, setTabItemList, setWidth, startSizeChange, swap, triggerContainerStateRedrawEnabled, unrealize, widgets, widgetsAsList, widgetStateChanged, width_setHidden, _setVisible, activateDirectManipulation, addFocusListener, addKeyListener, afterConfigUpdateBase, ancestor, ancestorId, autoResize, bounds, clear, clearWidget, clipRectangle, clipRectangle, clipWith, copyColors, createMouseHoverAction, deactivateDirectManipulation, debug, disable, disableTooltip, displayPhysicalLocation, enable, enableTooltip, enclosingFrame, forceCursorOnFocus, forceVisibility, getActualBounds, getAndResetBitmap, getAndSetBitmap, getBitmapCopy, getCachedScreenLocation, getCachedScreenPhysicalLocation, getCustomMousePointer, getDefaultEvent, getEffectiveMousePointer, getId, getLoadedMousePointer, getMenuMouse, getMouseActions, getMousePosition, getPortableMouseEventCoordinates, getSelectedText, getState, getTextHeight, getTextHeightNative, getTextHeightNative, getTextWidth, getTextWidth, getTextWidthNative, getTextWidthNative, getVisiblePart, getZOrderClass, hasFocus, hasTooltip, hidden, hide, highlighted, ignoreAction, initialHeight, initialWidth, isCurrent, isDirectManipulationActive, isDirectManipulationActiveOrInUIB, isDirectManipulationCapable, isDirectManipulationRequired, isDisplayed, isEnabled, isFocusable, isHeader, isMouseDrag, isRealized, isRepaintDisabled, isRMBEntrySupported, isScreenLocationCached, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, mouseActions, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, moveToBottom, moveToTop, name, navigable, oleDoDrop, oleDrag, oleDragging, oleStartDragging, onOleDragging, onOleDropEnd, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalBounds, physicalDimension, physicalLocation, prepParentLocation, preventFocusWhenMouseDownEventDefined, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyEventForSelectableWidget, processKeyListeners, processMnemonic, processMnemonicImpl, processSystemKey, raiseLegacyMouseEvents, reflectSizeChanged, refresh, registerWidgetListener, repaint, repaint, requestSync, resetBitmap, resizeTo, resolveFont, resolvePopupMenuId, resolveTitleFont, screen, screenDimension, screenHeight, screenLocation, screenPhysicalLocation, screenWidth, setBitmap, setCachedScreenLocation, setCachedScreenPhysicalLocation, setDirectManipulationActive, setEnabled, setHighlighted, setLocation, setLocation, setMousePointer, setMousePointer, setParent, setPhysicalLocation, setSensitiveForUIB, setState, setWindow, show, showPopupMenu, supportsCustomMousePointer, sync, topLevelWindow, toString, translate, triggerLocationChanged, unregisterWidgetListener, updateSystemParent, widgetRealized, windowclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waiteditPaste, invalidateSelection, isEditCanUndo, isSelectionValid, removeSelectedTextacceptsEscAsAnyKey, acceptTrigger, addFocusListener, addKeyListener, ancestor, ancestorId, bounds, clearWidget, completeTrigger, dimension, displayPhysicalLocation, enclosingFrame, enforceDefaultMousePtr, findMouseSource, forceCursorOnFocus, forceVisibility, getActualBounds, getCustomMousePointer, getEffectiveMousePointer, getId, getIdForTrigger, getLegacyWidget, getLoadedMousePointer, getMenuMouse, getMouseActions, getMousePosition, getSelectedText, getState, getTriggerWidget, getTriggerWidget, getVisiblePart, getZOrderClass, hasFocus, hasFocus, hasTooltip, height, hidden, hide, highlighted, ignoreEnable, initialHeight, initialWidth, insets, isCurrent, isCurrent, isDirectManipulable, isDirectManipulationActive, isDirectManipulationActiveOrInUIB, isDisplayed, isDroppable, isEnabled, isFocusable, isHeader, isInitialValueLayout, isLegacyFocus, isProcessProgressEvent, isRealized, isRepaintDisabled, isRMBEntrySupported, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, maySwitchFocus, minimumSize, moveToBottom, moveToTop, name, navigable, oleDrag, parent, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalBounds, physicalDimension, physicalLocation, preventFocusWhenMouseDownEventDefined, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyListeners, processMnemonic, raiseLegacyMouseEvents, refreshWidget, registerWidgetListener, repaint, repaint, repaint, requestFocus, requestFocus, requestSync, resizeTo, resolvePopupMenuId, screen, screenLocation, screenPhysicalLocation, setDirectManipulationActive, setEnabled, setHighlighted, setLocation, setLocation, setMousePointer, setMousePointer, setParent, setPhysicalLocation, setSensitiveForUIB, setState, setWindow, show, startTrigger, supportsCustomMousePointer, systemFocusGrabbed, topLevelWindow, unrealize, unregisterWidgetListener, validateDisplayValue, widgetStateChanged, width, windowmouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleasedcreateMnemonic, getMnemonicCharacter, getMnemonicKeyCode, getMnemonicLabel, isMnemonicSupported, updateMnemonicwidgetsAsListprivate static final int EDITOR_TAB_SIZE
private boolean fakeInsert
public EditorImpl(WidgetId id, EditorConfig cfg)
id - The widget's ID.cfg - Configuration data.public void processKeyEvent(KeyInput ke)
processKeyEvent in interface Widget<ChuiOutputManager>processKeyEvent in class Editor<ChuiOutputManager>ke - Key event structure.public void afterConfigUpdate(EditorConfig beforeUpdate)
afterConfigUpdate in interface ConfigOwner<EditorConfig>afterConfigUpdate in class LabeledDataContainer<ChuiOutputManager,EditorConfig>beforeUpdate - The previous configuration.public void setLabelInstance(Label<ChuiOutputManager> label)
Label to the fill-in widget.setLabelInstance in interface LabeledWidget<ChuiOutputManager>setLabelInstance in class LabeledDataContainer<ChuiOutputManager,EditorConfig>label - Reference to new Label instance.public void drawCaretUnconditionally()
drawCaretUnconditionally in class Editor<ChuiOutputManager>public void draw(Color color)
draw in class Editor<ChuiOutputManager>color - Color for drawing.public boolean setCursorChar(int pos,
boolean redraw)
setCursorChar in class Editor<ChuiOutputManager>pos - the new cursor position value, 0-basedredraw - request redraw/synctrue if the cursor position is valid and setprotected double calcHpos(double size)
size - The width of the scroll-bar.protected double calcVpos(double size)
size - The height of the scroll-bar.protected int absoluteX()
absoluteX in class Editor<ChuiOutputManager>protected boolean goToNewLine(java.lang.String subtext,
boolean placeChar)
goToNewLine in class Editor<ChuiOutputManager>subtext - The text.placeChar - flag indicating if this call is from Editor.placeChar(char).true if the text will output on a new line.protected void mergeLines(int row)
mergeLines in class Editor<ChuiOutputManager>row - line's rowprotected void setInsertMode(boolean mode)
mode - New state.
false- overwrite mode,
true- insert mode.
protected void placeLF()
placeLF in class Editor<ChuiOutputManager>protected boolean insertBlankLineOnLF()
insertBlankLineOnLF in class Editor<ChuiOutputManager>false.protected void cursorRight()
cursorRight in class Editor<ChuiOutputManager>protected void cursorEndOfLine()
cursorEndOfLine in class Editor<ChuiOutputManager>protected void cursorLeft()
cursorLeft in class Editor<ChuiOutputManager>protected void setCursorX(int pos)
pos - New cursor position (0-based).protected void cursorPos(int pos)
cursorPos in class Editor<ChuiOutputManager>pos - The new absolute cursor position.protected FocusListener getFocusListener()
getFocusListener in class Editor<ChuiOutputManager>protected int getNextSplitPosition(java.lang.String line,
int splitAfter)
getNextSplitPosition in class Editor<ChuiOutputManager>line - The line to be split.splitAfter - minimal split position.protected <C extends WidgetConfig> void updateSizeWorker(C beforeUpdate)
This implementation ignores the supplied config instance. Instead it relies
on AbstractContainer.size and LabeledDataContainer.config() to detect whether size has changed.
updateSizeWorker in class AbstractContainer<ChuiOutputManager>C - Widget config type.beforeUpdate - BaseConfig reference or null.protected java.lang.String processEOLChars(java.lang.String src)
processEOLChars in class Editor<ChuiOutputManager>src - the string to be processed.private void wordLeft()
private void wordRight()
private int getNextWordSize()
private void editorBackTab()
private void editorTab()
private void appendLine()
private boolean getInsertMode()
false- overwrite mode,
true- insert mode.
private void openLineAbove()
private java.lang.String prepareTextRow(boolean uninit,
int width,
java.lang.String space,
int line)
uninit - true if the widget is uninitialized.width - Width of the displayed area.space - Prepared string filled with spaces.line - Index in the array of parsed strings.private boolean deleteLineWorker()
true if anything is deleted.private void deleteWord()