public class LineEditor extends FillInGuiImpl
FillInGuiImpl
. It will notify the listeners when the user
validates the content by pressing the RETURN key.
Other features that lacks in standard FillInGuiImpl
:
- catches focus on click
- improved mouse selection
- validates changes on focus lost (Windows explorer specific, might need to make it togglable)
- notifies listeners for ENTER and ESCAPE key pressedLightweightTextWidget.TextLineSelection
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
AC_CANCEL_EDIT
The action that is fired when ESCAPE key is pressed while editing the text.
|
static java.lang.String |
AC_TEXT_VALIDATED
The action that is fired when ENTER/RETURN key is pressed while editing the text.
|
private java.util.List<ActionListener> |
actionListeners
The list of active listeners.
|
private boolean |
validateOnFocusLost
The editor will emit fire
AC_TEXT_VALIDATED on focus lost only if this flag is set
to true (default value). |
disabledFore, disabledForeFixedColor
browse, drawLine, editScroller, justActivated, leftAnchor, rightAnchor, selected, useUnderline
config
location, mousePtr, nativeInsets, physicalLocation
Constructor and Description |
---|
LineEditor(WidgetId fid,
FillInConfig fcfg)
Special constructor used to restore component using given configuration.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(ActionListener listener)
Adds an
ActionListener to this editor. |
boolean |
isValidateOnFocusLost()
Checks if this editor will emit
AC_TEXT_VALIDATED action event when it loses focus. |
void |
mouseClicked(java.awt.event.MouseEvent e)
Notification of a mouse clicked event occurred for this widget.
|
void |
mousePressed(java.awt.event.MouseEvent e)
Notification of a mouse pressed event occurred for this widget.
|
void |
processKeyEvent(KeyInput key)
Process specific keys.
|
void |
removeListener(ActionListener listener)
Removes an
ActionListener from the list of listeners. |
void |
setValidateOnFocusLost(boolean valid)
Sets whether this editor will emit
AC_TEXT_VALIDATED action event when it loses
focus. |
adjustEditScroller, blankScreenValue, convertToStreamable, createLeftAnchor, createMnemonic, createRightAnchor, draw, drawBorder, drawCaret, drawCaretInt, drawCursor, editableNativeDimension, getCursorColumnOffset, getCursorRowOffset, getFontCache, getInitialCursorPos, getInsertMode, getLastOffset, getNativeCursorPos, getScreenText, getScreenText, getScrollColumnOffset, getScrollRowOffset, getSelectedText, getTextLookAndFeel, getTextSelection, getValidCursorPos, initialize, invalidateSelection, isAutoResize, isDroppable, isRMBEntrySupported, isTextSelectionDisplayed, mouseActions, mouseDragged, mouseWheelMoved, moveCursorToLast, nativeHeight, nativeWidth, nativeWidth, processMnemonic, refresh, removeSelectedText, resetEditScroller, setSelection, showPopupMenu, supportsCustomMousePointer, updateSize
activate, activate, adjustCursor, afterConfigUpdate, clear, clear, copyState, currentFocus, defaultFocus, display, draw, focusTraversable, getCurrentFormat, getCursorOffset, getDataEntryReturn, getDrawText, getEditScroller, getFirstInGroup, getFormat, getScreenValue, getText, getText, getValue, getVariable, height, isAtField, isDrawLine, isFormatCheck, isInAutoReturn, isLeftEdgeWidget, isLinkedToBrowse, isRightAligned, isRightAlignedInt, isRightEdgeWidget, isSelected, isSelectionValid, isZapActive, isZapToBeApplied, refresh, requestFocus, reset, resetCaret, setAttrFormat, setBrowse, setCursorOffset, setDataType, setEnabled, setForceLeft, setFormatCheck, setHeaderParm, setInAutoReturn, setInsertMode, setPendingNoZap, setSize, setTextGroup, setUnderline, setValue, setValue, setZapMode, setZapMode, silentActivation, toString, update, updateCursorOffsetValue, updateSize, updateZapState, width
config, defaultMousePtr, destroy, getColon, getColumnLabelText, getColumnMnemonic, getLabelInstance, getLabelText, getMnemonic, getTo, isForceLabel, isModified, isNoLabels, postprocessConfig, setColumnMnemonic, setHidden, setLabelInstance, setMnemonic, setNoLabels, setVisible, setWasVisible, wasVisible
minimumSize
add, add, add, addContainerStateListener, addDirectly, belongsTo, checkWidget, childrenLocation, clipping, clipRectangle, currentFocus, cycleFocus, detach, dimension, doLayout, dumpCurrentWidgets, dumpWidgets, endSizeChange, findMouseSource, firstFocus, focus, focusWorker, formatDump, get, getClipRect, getEffectiveScrollableSize, getFocusInt, getIgnoreFocus, getLayout, getScrollableSize, getTabItemList, hasFocusable, insets, lastFocus, moveAfterTabItem, moveBeforeTabItem, moveToBottom, moveToBottomInClass, moveToTop, moveToTopInClass, moveToZpos, nextFocus, normalizeZOrder, onWidgetAdded, onWidgetRemoved, prepareWidgets, prevFocus, reflectAncestorChange, reflectLocationChange, remove, removeContainerStateListener, repaint, replace, requestFocus, setFocus, setFocusInt, setHeight, setIgnoreFocus, setInsets, setLayout, setSize, setTabItemList, setWidth, startSizeChange, triggerContainerStateRedrawEnabled, unrealize, updateSizeWorker, widgets, widgetsAsList
_setHidden, _setVisible, activateDirectManipulation, addFocusListener, addKeyListener, afterConfigUpdateBase, ancestor, ancestorId, autoResize, bounds, clear, clearWidget, clipRectangle, clipRectangle, clipWith, copyColors, createMouseHoverAction, deactivateDirectManipulation, debug, disable, displayPhysicalLocation, enable, enclosingFrame, forceCursorOnFocus, forceVisibility, getActualBounds, getAndResetBitmap, getAndSetBitmap, getBitmapCopy, getCachedScreenLocation, getCachedScreenPhysicalLocation, getCustomMousePointer, getDefaultEvent, getEffectiveMousePointer, getId, getLoadedMousePointer, getMenuMouse, getMouseActions, getPortableMouseEventCoordinates, getState, getTextHeight, getTextHeightNative, getTextWidth, getTextWidth, getTextWidthNative, getTextWidthNative, getVisiblePart, getZOrderClass, hasFocus, hidden, hide, highlighted, ignoreAction, isCurrent, isDirectManipulationCapable, isDirectManipulationRequired, isDisplayed, isEnabled, isFocusable, isHeader, isRealized, isRepaintDisabled, isScreenLocationCached, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, manageSystemActions, mouseEntered, mouseExited, mouseMoved, mouseReleased, moveToBottom, moveToTop, name, navigable, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalBounds, physicalDimension, physicalLocation, prepParentLocation, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyListeners, processMnemonicImpl, processSystemKey, raiseLegacyMouseEvents, refresh, registerWidgetStateListener, repaint, requestSync, resetBitmap, resizeTo, resolveFont, resolvePopupMenuId, resolveTitleFont, screen, screenDimension, screenHeight, screenLocation, screenPhysicalLocation, screenWidth, setBitmap, setCachedScreenLocation, setCachedScreenPhysicalLocation, setHighlighted, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, show, sync, topLevelWindow, translate, window
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
convertToStreamable
addFocusListener, addKeyListener, ancestor, ancestorId, bounds, clearWidget, dimension, displayPhysicalLocation, enclosingFrame, enforceDefaultMousePtr, findMouseSource, forceCursorOnFocus, forceVisibility, getActualBounds, getCustomMousePointer, getEffectiveMousePointer, getId, getLegacyWidget, getLoadedMousePointer, getMenuMouse, getMouseActions, getState, getVisiblePart, getZOrderClass, hasFocus, hidden, hide, highlighted, insets, isCurrent, isDirectManipulable, isDisplayed, isEnabled, isFocusable, isHeader, isRealized, isRepaintDisabled, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, maySwitchFocus, minimumSize, moveToBottom, moveToTop, name, navigable, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalBounds, physicalDimension, physicalLocation, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyListeners, raiseLegacyMouseEvents, repaint, repaint, requestFocus, requestSync, resizeTo, resolvePopupMenuId, screen, screenLocation, screenPhysicalLocation, setHighlighted, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, show, topLevelWindow, unrealize, window
mouseEntered, mouseExited, mouseReleased
getMnemonicCharacter, getMnemonicKeyCode, getMnemonicLabel, isMnemonicSupported, updateMnemonic
public static final java.lang.String AC_TEXT_VALIDATED
public static final java.lang.String AC_CANCEL_EDIT
private boolean validateOnFocusLost
AC_TEXT_VALIDATED
on focus lost only if this flag is set
to true
(default value).private java.util.List<ActionListener> actionListeners
public LineEditor(WidgetId fid, FillInConfig fcfg)
Call FillInGuiImpl.initialize(com.goldencode.p2j.ui.WidgetId, com.goldencode.p2j.ui.FillInConfig)
to finish the widget initialization.
fid
- The widget's ID.fcfg
- Configuration data.public void mousePressed(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.
mousePressed
in interface java.awt.event.MouseListener
mousePressed
in class FillInGuiImpl
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.MouseListener
mouseClicked
in class FillInGuiImpl
e
- The mouse event.public void processKeyEvent(KeyInput key)
processKeyEvent
in interface Widget<GuiOutputManager>
processKeyEvent
in class FillInGuiImpl
key
- Key event structure.public void addListener(ActionListener listener)
ActionListener
to this editor. It will be notified when user confirms the
current text by typing RETURN
.listener
- The ActionListener
to be added.public void removeListener(ActionListener listener)
ActionListener
from the list of listeners. The listener will not be
notified any more when user confirms the current text by typing RETURN
.listener
- The ActionListener
to be removed.public boolean isValidateOnFocusLost()
AC_TEXT_VALIDATED
action event when it loses focus.validateOnFocusLost
flag.public void setValidateOnFocusLost(boolean valid)
AC_TEXT_VALIDATED
action event when it loses
focus.valid
- new value for validateOnFocusLost
flag.