public class EditorGuiImpl extends Editor<GuiOutputManager> implements AutoResizable<EditorConfig>, LightweightTextWidget
| Modifier and Type | Class and Description |
|---|---|
private class |
EditorGuiImpl.EditorContent
Worker class which is responsible of drawing the editor's text.
|
private class |
EditorGuiImpl.EditorScrollContainer
The editor's scroll container.
|
private static class |
EditorGuiImpl.UndoableEditor
This class implements the editor's undo (CTRL-Z) behavior.
|
Editor.Line, Editor.LocalFocusListenerLightweightTextWidget.TextLineSelection| Modifier and Type | Field and Description |
|---|---|
private int |
barScrollX
Offset when scrolling horizontally via the scrollbar (the cursor does not move).
|
private int |
barScrollY
Offset when scrolling vertically via the scrollbar (the cursor does not move).
|
private Border<GuiOutputManager> |
border
Cached border instance.
|
private static int |
BORDER_SIZE
Total size of the editor border 1 pixel on each side.
|
private CoordinatesConversion |
cc
Coordinate converter
|
private EditorGuiImpl.EditorScrollContainer |
contentPane
The scrollable container to place inside the ScrollPane.
|
private EditorGuiImpl.EditorContent |
editor
The editor content, where the text is actually drawn.
|
private BorderedPanel<GuiOutputManager> |
editorBorder
Editor border.
|
private ScrollPaneGuiImpl |
editorScroll
Scroll pane which is actual container.
|
private GuiColorResolver |
gc
Color resolver
|
private GuiDriver |
gd
Screen driver
|
private GuiFontResolver |
gf
Font resolver
|
private int[] |
lineSplitIndexes
Indexes where the content must be split.
|
private static int |
MAX_CACHED_LINE_WIDTH
MAximum length for line to compute cached substring values.
|
private static int |
MAX_LARGE_SIZE
Maximum capacity of the large mode editor (8M).
|
private java.util.Set<java.lang.Integer> |
newLineIndexes
It holds indexes from
lineSplitIndexes, for which the split was caused by a
new-line character. |
private GuiOutputManager |
screen
Output manager
|
private NativePoint |
selectionEnd
The location of last selected character (regardless of where the cursor is).
|
private NativePoint |
selectionStart
The location of first selected character (regardless of where the cursor is).
|
private EditorGuiImpl.UndoableEditor |
undo
Instance which manages the editor's UNDO/CTRL-Z.
|
CR, forceRedraw, insert, LF, lineBuilder, maxSizes, parsedText, SPACE, SPACE_LF, widgetFocusedconfiglisteners, location, mousePtr, nativeInsets, physicalLocation| Constructor and Description |
|---|
EditorGuiImpl(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.
|
private void |
adjustCursorX(int prevY,
int prevX,
int setCaretTo)
Adjust the horizontal cursor so that it preservers the pixel-column, when moving up or down.
|
private void |
adjustInnerLines(int heightPixels)
Recalculates inner lines value depending on current height and font size.
|
private void |
adjustScrollY()
If we are removing the last line in the editor, then all content needs to "scroll up" one
row so that the editor's last line is on the bottom.
|
private void |
adjustSelection()
Adjust the selection interval so that the SELECTION-START and SELECTION-END attributes
reflect the current selection.
|
protected void |
adjustSize(boolean init)
Adjust Editor.
|
protected void |
adjustSize(boolean init,
boolean forceEditorChars)
Adjust Editor.
|
void |
afterConfigUpdate(EditorConfig beforeUpdate)
The method is called after the configuration associated with
the implementor changes.
|
protected void |
backspace()
Handle BACKSPACE key.
|
protected boolean |
canPlaceChar()
Determine if a character can be placed in the editor.
|
private void |
clearLinesWidths()
Clears all cached line widths.
|
private int |
computeHorizontalDelta(int absY,
int barX)
Compute the full horizontal delta (i.e.
|
private int |
computeHorizontalScrollDelta(int barX)
Compute the horizontal scroll delta, based on how far the scroll bar was moved via mouse to
the left or the right, relative to the current
EditorConfig.scrollX value. |
private void |
computeLineWidths(Editor.Line l)
Compute the widths for this line (if not already computed).
|
private void |
computeLineWidths(int from,
int to)
Compute the line widths (if not already computed) in the given interval.
|
private void |
computeSplitIndexes(java.lang.String source,
int start,
int offset,
boolean placeChar)
Compute the split indexes for the given text.
|
MnemonicInfo |
createMnemonic()
Creates new
MnemonicInfoGuiImpl instance. |
protected MouseHoverAction |
createMouseHoverAction()
Create handler for processing mouse hover events
|
protected void |
cursorDown()
Move cursor one row down, if possible.
|
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.
|
protected void |
cursorUp()
Move cursor one row up, if possible.
|
protected void |
deleteCharacterKey()
Delete character at current cursor position - called by
processKeyEvent(com.goldencode.p2j.ui.client.event.KeyInput). |
void |
destroy()
Destroy this widget.
|
void |
draw(Color color)
Render this editor.
|
void |
drawCaretUnconditionally()
Sets position of terminal's cursor unconditionally (even if this editor is not in focus).
|
void |
drawCursor()
Draws a special cursor relative to the current origin.
|
boolean |
editPaste()
Performs GUI driver specific operations for PASTE software generated command.
|
Widget<GuiOutputManager> |
findMouseSource(NativePoint p)
Find the widget positioned just bellow the specified mouse position (in physical units).
|
private int |
findScrollOffset(int width)
Find a scroll offset to set the
EditorConfig.scrollX value. |
protected void |
fireValueChanged()
Fire VALUE-CHANGED event.
|
void |
firstFocus()
Set focus to first focusable widget.
|
private void |
fixLowHeight(int fontHeight)
If editor has low height, force text to be displayed if the font height permits.
|
private GuiFontResolver |
fontResolver()
Get the font resolver
|
NativeRectangle |
getActualBounds()
Get the widget's actual bounds
|
int |
getCursorColumnOffset()
Gets the current cursor column within its text content.
|
int |
getCursorRowOffset()
Gets the current cursor row within its text content.
|
GuiFontResolver.FontCache |
getFontCache()
Returns the current font cache.
|
private Editor.Line |
getMaximalLine()
Gets the first maximal line in this editor.
|
protected int |
getMaxSize()
Maximal size of the content in chars.
|
protected int |
getNextSplitPosition(java.lang.String line,
int splitAfter)
Get the next split position of this line, so that it fits the editor.
|
java.lang.String |
getScreenText()
Gets the screen text content at the current line.
|
java.lang.String |
getScreenText(int line)
Gets the screen text content.
|
Dimension |
getScrollableSize()
Returns the size of the scrollable area of this widget in character
units.
|
int |
getScrollColumnOffset()
Gets the current scroll offset within its text content.
|
int |
getScrollRowOffset()
Gets the current scroll offset within its text content.
|
java.lang.String |
getSelectedText()
Obtain any selected text in the widget for copying to the clipboard.
|
private java.lang.String |
getSelectedText(boolean remove)
Get the currently selected sub-text.
|
LightweightTextWidget.TextLineSelection |
getTextSelection(int line)
Gets the current text selection object for the given line.
|
int |
getTextWidthNative(Editor.Line line,
int start,
int end,
int font)
Get the width of the specified substring, in the given line.
|
int |
getTextWidthNative(int lineNo,
int start,
int end,
int font)
Get the width of the specified substring, in the given line.
|
protected boolean |
goToNewLine(java.lang.String subtext,
boolean placeChar)
Check if the given text needs to output on a new line.
|
void |
initialize(WidgetId id,
EditorConfig cfg)
Replacement API for the logic which should exist in the widget's c'tor, but the logic
can't be executed as it depends on the widget being registered into the official registry.
|
protected boolean |
insertBlankLineOnLF()
Determine if a blank line needs to be inserted when RETURN key is pressed on a empty line.
|
void |
invalidateSelection()
Invalidate the editor's selection.
|
boolean |
isAutoResize()
Get the AUTO-RESIZE status
|
boolean |
isDroppable()
Checks if the given widget is able to be the target of the drop operation.
|
boolean |
isEditCanUndo()
Check if the UNDO operation is possible for current widget.
|
boolean |
isRMBEntrySupported()
Check if this widget gains ENTRY event when right/middle mouse button is clicked.
|
boolean |
isSelectionValid()
Determine if the editor has selected text.
|
private int |
maxLineWidthNative()
Compute the maximum line width in this editor, in native units.
|
protected void |
mergeLines(int row)
Merge line with subsequent one(s) if possible
|
protected int[] |
mouseActions()
Determine the mouse actions processed by this widget.
|
void |
mouseClicked(java.awt.event.MouseEvent e)
Notification of a mouse clicked event occurred for this widget.
|
void |
mouseDragged(java.awt.event.MouseEvent e)
Notification of a mouse pressed event occurred for this widget.
|
void |
mousePressed(java.awt.event.MouseEvent e)
Notification of a mouse pressed event occurred for this widget.
|
void |
mouseWheelMoved(java.awt.event.MouseWheelEvent e)
Notification of a mouse wheel event occurred for this widget.
|
protected java.util.List<Editor.Line> |
parseContentImpl(java.lang.String source,
int start,
int offset,
boolean placeChar)
Worker to parse content of the editor and prepare array of displayable values.
|
protected void |
placeLF()
Place new line character at current cursor position.
|
protected java.lang.String |
processEOLChars(java.lang.String src)
Processing for unusual EOL characters in GUI mode.
|
void |
processKeyEvent(KeyInput ke)
Process KeyEvents for this widget.
|
boolean |
processMnemonic(int key)
Process the given key, if this widget's mnemonic matches the key.
|
private void |
processScrollPane()
Resize editor scroll pane, and other scroll-related processing (colors for the child
widgets, scrollbars, etc).
|
void |
removeSelectedText()
Removes (deletes) the selected text.
|
void |
repaint()
Updates the line widths if the current font has been changed and repaint.
|
private Window<?> |
resolveWindow()
Get the parent window
|
protected java.lang.String |
rtrim(java.lang.String value)
Remove trailing whitespaces.
|
java.lang.Boolean |
search(java.lang.String pattern,
int mode)
Searches for a specified string starting from the current text caret position.
|
boolean |
setCursorChar(int pos,
boolean redraw)
Sets the cursor position in the current line
|
boolean |
setCursorLine(int line)
Sets the cursor line
|
boolean |
setCursorOffset(int offset)
Sets the cursor offset.
|
boolean |
setCursorOffset(int offset,
boolean shouldInvalidateSelection)
Sets the cursor offset.
|
void |
setEnabled(boolean enable)
Enable/disable the widget for editing.
|
protected void |
setPhysicalDimensionInt(int width,
int height)
Set widget physical dimension.
|
private void |
setScrollPosition()
Adjust the scroll position.
|
boolean |
setSelection(int start,
int end)
Selects text in a widget between start and end points.
|
void |
setValue(BaseDataType value)
Sets the new variable value in the editor.
|
Menu<GuiOutputManager> |
showPopupMenu(java.awt.event.MouseEvent e,
java.lang.Runnable dismissHandler)
The method shows the popup menu for this widget.
|
protected void |
splitLine(java.lang.String line,
int row,
int splitAfter)
Replace line, splitting it if necessary
|
boolean |
supportsCustomMousePointer()
Check if the widget supports LOAD-MOUSE-POINTER() method
|
void |
updateSize(EditorConfig beforeUpdate)
Update widget's size after config update
|
private void |
wordLeft()
Move cursor one word left.
|
private void |
wordRight()
Move cursor one word right.
|
absoluteY, addIndent, bell, canMovetoTop, clear, contentLength, currentFocus, cursorBeginOfLine, cursorEndOfPrevLine, cursorHome, cursorRightTo, defaultFocus, deleteCharacter, deleteLine, deleteToEndOfLine, draw, drawCaret, editorReadFile, editorSaveFile, focusTraversable, fullHeight, getChangedValue, getCursorChar, getCursorLine, getCursorOffset, getFocusListener, getIndentSize, getLength, getLine, getLineCount, getLineText, getText, getValue, insertFile, insertString, lastRow, manageSystemActions, parseContent, placeChar, placeChar, refresh, replaceSelectionText, replaceString, requestFocus, resolveContent, setCursorChar, setCursorLineAndChar, updateOffsetconfig, copyState, defaultMousePtr, getColon, getColumnLabelText, getColumnMnemonic, getLabelInstance, getLabelText, getMnemonic, getTo, isForceLabel, isModified, isNoLabels, isRightAligned, postprocessConfig, setColumnMnemonic, setHidden, setLabelInstance, setMnemonic, setNoLabels, setVisible, setWasVisible, wasVisibleminimumSize, requestFocusadd, add, add, addContainerStateListener, addDirectly, belongsTo, checkWidget, childrenLocation, clipping, clipRectangle, currentFocus, cycleFocus, deregisterSelectedWidget, detach, dimension, doLayout, dumpCurrentWidgets, dumpWidgets, endSizeChange, focus, focusWorker, formatDump, get, getAllSelectedWidgets, getClipRect, getEffectiveScrollableSize, getFocusInt, getIgnoreFocus, getLayout, 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, replace, requestFocus, setFocus, setFocusInt, setHeight, setIgnoreFocus, setInsets, setLayout, setSize, setSize, setTabItemList, setWidth, startSizeChange, swap, triggerContainerStateRedrawEnabled, unrealize, updateSizeWorker, widgets, widgetsAsList, widgetStateChanged, width_setHidden, _setVisible, activateDirectManipulation, addFocusListener, addKeyListener, afterConfigUpdateBase, ancestor, ancestorId, autoResize, bounds, clear, clearWidget, clipRectangle, clipRectangle, clipWith, copyColors, deactivateDirectManipulation, debug, disable, disableTooltip, displayPhysicalLocation, enable, enableTooltip, enclosingFrame, forceCursorOnFocus, forceVisibility, getAndResetBitmap, getAndSetBitmap, getBitmapCopy, getCachedScreenLocation, getCachedScreenPhysicalLocation, getCustomMousePointer, getDefaultEvent, getEffectiveMousePointer, getId, getLoadedMousePointer, getMenuMouse, getMouseActions, getMousePosition, getPortableMouseEventCoordinates, 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, isScreenLocationCached, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, mouseEntered, mouseExited, mouseMoved, mouseReleased, 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, processMnemonicImpl, processSystemKey, raiseLegacyMouseEvents, reflectSizeChanged, refresh, registerWidgetListener, repaint, repaint, requestSync, resetBitmap, resizeTo, resolveFont, resolvePopupMenuId, resolveTitleFont, screen, screenDimension, screenHeight, screenLocation, screenPhysicalLocation, screenWidth, setBitmap, setCachedScreenLocation, setCachedScreenPhysicalLocation, setDirectManipulationActive, setHighlighted, setLocation, setLocation, setMousePointer, setMousePointer, setParent, setPhysicalLocation, setSensitiveForUIB, setState, setWindow, show, sync, topLevelWindow, toString, translate, triggerLocationChanged, unregisterWidgetListener, updateSystemParent, widgetRealized, windowclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitacceptsEscAsAnyKey, acceptTrigger, addFocusListener, addKeyListener, ancestor, ancestorId, bounds, clearWidget, completeTrigger, dimension, displayPhysicalLocation, enclosingFrame, enforceDefaultMousePtr, forceCursorOnFocus, forceVisibility, getCustomMousePointer, getEffectiveMousePointer, getId, getIdForTrigger, getLegacyWidget, getLoadedMousePointer, getMenuMouse, getMouseActions, getMousePosition, getState, getTriggerWidget, getTriggerWidget, getVisiblePart, getZOrderClass, hasFocus, hasFocus, hasTooltip, height, hidden, hide, highlighted, ignoreEnable, initialHeight, initialWidth, insets, isCurrent, isCurrent, isDirectManipulable, isDirectManipulationActive, isDirectManipulationActiveOrInUIB, isDisplayed, isEnabled, isFocusable, isHeader, isInitialValueLayout, isLegacyFocus, isProcessProgressEvent, isRealized, isRepaintDisabled, 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, raiseLegacyMouseEvents, refreshWidget, registerWidgetListener, repaint, repaint, requestFocus, requestFocus, requestSync, resizeTo, resolvePopupMenuId, screen, screenLocation, screenPhysicalLocation, setDirectManipulationActive, setHighlighted, setLocation, setLocation, setMousePointer, setMousePointer, setParent, setPhysicalLocation, setSensitiveForUIB, setState, setWindow, show, startTrigger, systemFocusGrabbed, topLevelWindow, unrealize, unregisterWidgetListener, validateDisplayValue, widgetStateChanged, width, windowmouseEntered, mouseExited, mouseReleasedgetMnemonicCharacter, getMnemonicKeyCode, getMnemonicLabel, isMnemonicSupported, updateMnemonicwidgetsAsListprivate final GuiDriver gd
private final GuiOutputManager screen
private final CoordinatesConversion cc
private GuiColorResolver gc
private GuiFontResolver gf
private EditorGuiImpl.EditorScrollContainer contentPane
private ScrollPaneGuiImpl editorScroll
private BorderedPanel<GuiOutputManager> editorBorder
private final EditorGuiImpl.EditorContent editor
private int barScrollX
private int barScrollY
private NativePoint selectionStart
private NativePoint selectionEnd
private final EditorGuiImpl.UndoableEditor undo
private Border<GuiOutputManager> border
private int[] lineSplitIndexes
private java.util.Set<java.lang.Integer> newLineIndexes
lineSplitIndexes, for which the split was caused by a
new-line character.private static final int BORDER_SIZE
private static int MAX_LARGE_SIZE
private static int MAX_CACHED_LINE_WIDTH
public EditorGuiImpl(WidgetId id, EditorConfig cfg)
id - The widget's ID.cfg - Configuration data.public void initialize(WidgetId id, EditorConfig cfg)
This API is called after the widget is created and added to the registry.
initialize in interface WidgetWithConfig<EditorConfig>initialize in class Editor<GuiOutputManager>id - The widget's ID.cfg - The config used to initialize this widget.public void firstFocus()
firstFocus in interface Container<GuiOutputManager>firstFocus in class AbstractContainer<GuiOutputManager>public boolean processMnemonic(int key)
processMnemonic in interface Widget<GuiOutputManager>processMnemonic in class AbstractWidget<GuiOutputManager>key - The pressed mnemonic key code.true if this widget accepted this mnemonic key. Not enabled or not
visible widget will not accept it.public MnemonicInfo createMnemonic()
MnemonicInfoGuiImpl instance.createMnemonic in interface MnemonicTrait<GuiOutputManager>MnemonicInfoGuiImpl instance.public void processKeyEvent(KeyInput ke)
processKeyEvent in interface Widget<GuiOutputManager>processKeyEvent in class Editor<GuiOutputManager>ke - Key event structure.public void setValue(BaseDataType value)
setValue in interface DataContainersetValue in class Editor<GuiOutputManager>value - New value for the screen buffer.public void drawCaretUnconditionally()
drawCaretUnconditionally in class Editor<GuiOutputManager>public void draw(Color color)
draw in class Editor<GuiOutputManager>color - Color for drawing. Ignored.public void destroy()
destroy in interface Widget<GuiOutputManager>destroy in class LabeledDataContainer<GuiOutputManager,EditorConfig>public java.lang.String getSelectedText()
getSelectedText in interface Widget<GuiOutputManager>getSelectedText in class AbstractWidget<GuiOutputManager>null if there is no selected text or if the
widget type does not support clipboard operations.public boolean editPaste()
editPaste in interface TextSelectiontrue if operation was successfull.public void setEnabled(boolean enable)
RECALL key.
In GUI, it registers this widget with the driver, to allow responsive actions when the mouse is hovered over the widget.
setEnabled in interface Widget<GuiOutputManager>setEnabled in class AbstractWidget<GuiOutputManager>enable - true to enable editing in this widget.public void mousePressed(java.awt.event.MouseEvent e)
If the editor is enabled, it will position the caret.
mousePressed in interface java.awt.event.MouseListenermousePressed in class AbstractWidget<GuiOutputManager>e - The mouse event.public void mouseDragged(java.awt.event.MouseEvent e)
If the editor is enabled and has focus, it will re-adjust the selected text depending on where the mouse is moving.
mouseDragged in interface java.awt.event.MouseMotionListenermouseDragged in class AbstractWidget<GuiOutputManager>e - The mouse event.public void mouseClicked(java.awt.event.MouseEvent e)
If the widget is not already focused, it forces the focus to it. After the focus was received, it computes the caret location, based on the mouse position over the widget's content.
mouseClicked in interface java.awt.event.MouseListenermouseClicked in class AbstractWidget<GuiOutputManager>e - The mouse event.public void mouseWheelMoved(java.awt.event.MouseWheelEvent e)
If the editor is vertically scrollable, enabled and has focus, it will scroll the content vertically or horizontally.
mouseWheelMoved in interface java.awt.event.MouseWheelListenermouseWheelMoved in class AbstractWidget<GuiOutputManager>e - The mouse event.public Dimension getScrollableSize()
The scrollable area is the total area including the hidden parts that must be scrolled in order to be visible.
getScrollableSize in class AbstractContainer<GuiOutputManager>public void afterConfigUpdate(EditorConfig beforeUpdate)
afterConfigUpdate in interface ConfigOwner<EditorConfig>afterConfigUpdate in class LabeledDataContainer<GuiOutputManager,EditorConfig>beforeUpdate - The previous configuration.public boolean setCursorChar(int pos,
boolean redraw)
setCursorChar in class Editor<GuiOutputManager>pos - The new cursor position value.redraw - request redraw/synctrue if the cursor position is valid and setpublic void removeSelectedText()
removeSelectedText in interface TextSelectionprivate void clearLinesWidths()
public void repaint()
repaint in interface Widget<GuiOutputManager>repaint in class AbstractContainer<GuiOutputManager>public boolean setSelection(int start,
int end)
setSelection in interface TextSelectionsetSelection in class Editor<GuiOutputManager>start - Starting offset.end - Ending offset.true if the operation succeeded.public java.lang.Boolean search(java.lang.String pattern,
int mode)
search in class Editor<GuiOutputManager>pattern - The string to be search. No wildcard allowed.mode - a combinations of flags that specifies the type of search to be performed. The
following values are accepted:
| Type of search | Flag value |
|---|---|
| EditorWidget.FIND_NEXT_OCCURRENCE | 1 |
| EditorWidget.FIND_PREV_OCCURRENCE | 2 |
| EditorWidget.FIND_CASE_SENSITIVE | 4 |
| EditorWidget.FIND_WRAP_AROUND | 16 |
| EditorWidget.FIND_SELECT | 32 |
yes.public boolean isAutoResize()
isAutoResize in interface AutoResizable<EditorConfig>true is AUTO-RESIZE is enabledpublic void updateSize(EditorConfig beforeUpdate)
updateSize in interface AutoResizable<EditorConfig>beforeUpdate - previous value of the widget's configpublic Widget<GuiOutputManager> findMouseSource(NativePoint p)
For editors, if the sources is either editor or contentPane, then return
this widget.
findMouseSource in interface Widget<GuiOutputManager>findMouseSource in class AbstractContainer<GuiOutputManager>p - The mouse physical location.null if none found.public NativeRectangle getActualBounds()
getActualBounds in interface Widget<GuiOutputManager>getActualBounds in class AbstractWidget<GuiOutputManager>public boolean isRMBEntrySupported()
isRMBEntrySupported in interface Widget<GuiOutputManager>isRMBEntrySupported in class AbstractWidget<GuiOutputManager>true if this widget gains ENTRY event
when right/middle mouse button is clicked.public boolean isDroppable()
isDroppable in interface Widget<GuiOutputManager>TRUE if this widget can be droppable at this time,
FALSE otherwise.public boolean isEditCanUndo()
isEditCanUndo in interface TextSelectiontrue if text is undoable.protected int[] mouseActions()
mouseActions in class AbstractWidget<GuiOutputManager>protected void adjustSize(boolean init)
init - true if this is called from initialize(com.goldencode.p2j.ui.WidgetId, com.goldencode.p2j.ui.EditorConfig).protected void adjustSize(boolean init,
boolean forceEditorChars)
init - true if this is called from initialize(com.goldencode.p2j.ui.WidgetId, com.goldencode.p2j.ui.EditorConfig).forceEditorChars - Force calculation of width/height from the INNER-CHARS and INNER-LINES attributes.protected boolean goToNewLine(java.lang.String subtext,
boolean placeChar)
goToNewLine in class Editor<GuiOutputManager>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 boolean insertBlankLineOnLF()
insertBlankLineOnLF in class Editor<GuiOutputManager>true for GUI mode.protected void cursorPos(int pos)
cursorPos in class Editor<GuiOutputManager>pos - The new absolute cursor position.protected void mergeLines(int row)
mergeLines in class Editor<GuiOutputManager>row - line's rowprotected int getNextSplitPosition(java.lang.String line,
int splitAfter)
getNextSplitPosition in class Editor<GuiOutputManager>line - The line to be split.splitAfter - minimal split position.protected void splitLine(java.lang.String line,
int row,
int splitAfter)
splitLine in class Editor<GuiOutputManager>line - line's contentrow - line's rowsplitAfter - minimal split positionprotected java.util.List<Editor.Line> parseContentImpl(java.lang.String source, int start, int offset, boolean placeChar)
It uses computeSplitIndexes(String, int, int, boolean) to determine the text's
split indexes.
parseContentImpl in class Editor<GuiOutputManager>source - Source string to parse.start - Row index to start parsing from.offset - Text offset to start parsing from.placeChar - Set to true if called from Editor.placeChar(char) method in insert mode.protected void cursorRight()
cursorRight in class Editor<GuiOutputManager>protected void cursorDown()
cursorDown in class Editor<GuiOutputManager>protected void cursorUp()
cursorUp in class Editor<GuiOutputManager>protected void cursorLeft()
cursorLeft in class Editor<GuiOutputManager>protected void cursorEndOfLine()
cursorEndOfLine in class Editor<GuiOutputManager>protected void placeLF()
placeLF in class Editor<GuiOutputManager>public boolean setCursorLine(int line)
setCursorLine in class Editor<GuiOutputManager>line - the new cursor line valuetrue if the cursor line is valid and setprotected void backspace()
backspace in class Editor<GuiOutputManager>protected void deleteCharacterKey()
processKeyEvent(com.goldencode.p2j.ui.client.event.KeyInput).deleteCharacterKey in class Editor<GuiOutputManager>protected java.lang.String rtrim(java.lang.String value)
rtrim in class Editor<GuiOutputManager>value - the string to be truncatedprotected int absoluteX()
absoluteX in class Editor<GuiOutputManager>protected boolean canPlaceChar()
canPlaceChar in class Editor<GuiOutputManager>true if the editor content is less than the EditorConfig.maxChars
value (or MAX-CHARS attribute is not set).protected java.lang.String processEOLChars(java.lang.String src)
processEOLChars in class Editor<GuiOutputManager>src - the string to be processed.public Menu<GuiOutputManager> showPopupMenu(java.awt.event.MouseEvent e, java.lang.Runnable dismissHandler)
AbstractWidget.resolvePopupMenuId().showPopupMenu in class AbstractWidget<GuiOutputManager>e - The related mouse event that caused a popup to be shown.dismissHandler - When not null, the runnable instance is executed when the popup menu is dismissed, regardless
whether an item is chosen or not.null if no popup is resolved for this widget.public boolean supportsCustomMousePointer()
supportsCustomMousePointer in interface Widget<GuiOutputManager>supportsCustomMousePointer in class AbstractWidget<GuiOutputManager>true if the widget supports LOAD-MOUSE-POINTER() methodprotected MouseHoverAction createMouseHoverAction()
createMouseHoverAction in class AbstractWidget<GuiOutputManager>public boolean setCursorOffset(int offset,
boolean shouldInvalidateSelection)
setCursorOffset in class Editor<GuiOutputManager>offset - The new offset value. Use -1 to move the caret at the end (MOVE-TO-EOF).shouldInvalidateSelection - The flag that shows if we should invalidate selection.true if the cursor offset is valid and set.public boolean setCursorOffset(int offset)
setCursorOffset in class Editor<GuiOutputManager>offset - the new offset value. Use -1 to move the caret at the end (MOVE-TO-EOF).true if the cursor offset is valid and set.protected void setPhysicalDimensionInt(int width,
int height)
setPhysicalDimensionInt in class AbstractContainer<GuiOutputManager>width - Widget physical width.height - Widget physical height.private void computeSplitIndexes(java.lang.String source,
int start,
int offset,
boolean placeChar)
source - Source string to parse.start - Row index to start parsing from.offset - Text offset to start parsing from.placeChar - Set to true if called from Editor.placeChar(char) method in insert mode.private void adjustCursorX(int prevY,
int prevX,
int setCaretTo)
This is also used on mouse click, when the content is scrolled via the scroll bar
(barScrollX is non zero). In this case, the setCaretTo parameter will
be set to a value other than Integer.MIN_VALUE, and will represent the relative
pixel column (to the editor) where the mouse was clicked. Using this, it will preserve the
mouse scroll (so that the left-edge character will be referenced by
EditorConfig.scrollX) and the cursor X will be adjusted to represent the clicked
character.
prevY - Absolute line before the up/down key was processed.prevX - Absolute column before the up/down key was processed.setCaretTo - The pixels position relative to the view port.private void wordLeft()
private void wordRight()
private void processScrollPane()
private void setScrollPosition()
private void adjustInnerLines(int heightPixels)
heightPixels - The editor view port height in pixels.private void fixLowHeight(int fontHeight)
fontHeight - Font height in pixels.private int computeHorizontalDelta(int absY,
int barX)
The absY represents the line index to which the EditorConfig.scrollX
will be applied. The length of the this prefix text (from 0 to scroll X) will be computed
for this line, and to this value the mouse scroll
delta.
absY - The reference line from where to take the caret-scrolled prefix.barX - The physical delta scrolled by mouse, in number of clicks.private int computeHorizontalScrollDelta(int barX)
EditorConfig.scrollX value. This is
always computed using the font's width multiplied by the given delta.barX - The physical delta scrolled by mouse, in number of clicks.private int maxLineWidthNative()
private Editor.Line getMaximalLine()
private int findScrollOffset(int width)
EditorConfig.scrollX value.width - The pixel width for the text to be scrolled.private void adjustScrollY()
public void invalidateSelection()
invalidateSelection in interface TextSelectionpublic boolean isSelectionValid()
isSelectionValid in interface TextSelectiontrue if the selectionStart and selectionEnd are set.private void adjustSelection()
private java.lang.String getSelectedText(boolean remove)
remove parameter is set to
true, this text is also removed.remove - Flag determining if the selected text needs to be removed.private Window<?> resolveWindow()
private GuiFontResolver fontResolver()
private void computeLineWidths(int from,
int to)
from - Start index in the parsed content.to - End index in the parsed content (inclusive).private void computeLineWidths(Editor.Line l)
l - The line for which the widths need to be computed.public int getTextWidthNative(int lineNo,
int start,
int end,
int font)
If the line's intermediate widths were computed, use these to compute the substring's width.
Otherwise, default to the AbstractWidget.getTextWidthNative(java.lang.String, int).
lineNo - The line number (0-base).start - The start index in the line.end - The end index in the line (exclusive).font - The font.public int getTextWidthNative(Editor.Line line, int start, int end, int font)
If the line's intermediate widths were computed, use these to compute the substring's width.
Otherwise, default to the AbstractWidget.getTextWidthNative(java.lang.String, int).
line - The line instance.start - The start index in the line.end - The end index in the line (exclusive).font - The font.protected void fireValueChanged()
fireValueChanged in class Editor<GuiOutputManager>protected int getMaxSize()
getMaxSize in class Editor<GuiOutputManager>public java.lang.String getScreenText(int line)
getScreenText in interface LightweightTextWidgetline - The given line numberpublic java.lang.String getScreenText()
getScreenText in interface LightweightTextWidgetpublic int getCursorColumnOffset()
getCursorColumnOffset in interface LightweightTextWidgetpublic int getCursorRowOffset()
getCursorRowOffset in interface LightweightTextWidgetpublic void drawCursor()
drawCursor in interface LightweightTextWidgetpublic int getScrollColumnOffset()
getScrollColumnOffset in interface LightweightTextWidgetpublic int getScrollRowOffset()
getScrollRowOffset in interface LightweightTextWidgetpublic GuiFontResolver.FontCache getFontCache()
getFontCache in interface LightweightTextWidgetpublic LightweightTextWidget.TextLineSelection getTextSelection(int line)
getTextSelection in interface LightweightTextWidgetline - The given line number