public class ComboBoxGuiImpl extends ComboBox<GuiOutputManager> implements AutoResizable<ComboBoxConfig>
| Modifier and Type | Field and Description |
|---|---|
private CoordinatesConversion |
cc
Coordinate converter
|
private static int |
ENTRY_TO_HEIGHT_Y_DIFF
The space difference between item row height and full combo-box height.
|
private EntryFieldGuiImpl |
entryField
Editable entry field for SIMPLE and DROP-DOWN modes.
|
private GuiColorResolver |
gc
Color resolver
|
private GuiDriver |
gd
Screen driver
|
private GuiFontResolver |
gf
Font resolver
|
private KeyInput |
keyToDefer
The key event that must be posted after drop-down exit.
|
private boolean |
pressed
Pressed button state flag.
|
private GuiOutputManager |
screen
Output manager
|
private ScrollableSelectionListGuiImpl |
simpleList
The list for SIMPLE combo-box mode.
|
private ScrollPaneGuiImpl |
simpleListPane
The list for SIMPLE combo-box mode.
|
static int |
TEXT_SHIFT
Shift in X to draw text inside entry.
|
browseColumn, config, deferredProgressTrigger, dropDown, endConditionRaised, initValue, limit, selected, valueChangedinsets, listeners, location, LOG, mousePtr, nativeInsets, physicalLocation| Constructor and Description |
|---|
ComboBoxGuiImpl(WidgetId id,
WidgetConfig cfg)
Special constructor used to restore component using given configuration.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addUISpecificEvents(EventList listToChange)
Adding mouse clicks as exit events.
|
void |
afterConfigUpdate(ComboBoxConfig beforeUpdate)
The method is called after the configuration associated with
the implementor changes.
|
void |
changed()
This method is invoked when selection is changed.
|
private void |
createEntryField()
Clean up the main registry pool from drop-down widgets when it is closing, if the widget is
a container, make recursive call.
|
MnemonicInfo |
createMnemonic()
Creates new
MnemonicInfo instance. |
private void |
createSimpleList()
Creates the list for SIMPLE mode of the combo-box.
|
void |
deferKeyEvent(KeyInput ki)
Saves the key event to be posted into event queue after drop-down is gone.
|
void |
destroy()
Destroy this widget.
|
boolean |
doAutoCompletion(char currentChar,
boolean listOpened)
Handles entry field changes when AUTO-COMPLETION attribute is on.
|
void |
draw()
Draw the combo-box.
|
void |
drawCaret()
Sets position of terminal's cursor to the first char of the combo-box.
|
protected void |
dropDownRequestFocus()
Requesting focus to opened drop-down.
|
void |
entryFieldChanged(java.lang.String newValue)
Posts value changed event to the queue.
|
void |
exitDropDown()
Exit the drop-down (the "selection" mode of the combo-box).
|
protected java.lang.String |
formatValue(java.lang.String selectedItem,
DisplayFormat format,
int width,
boolean right)
Format source string using current settings and make it suitable for GUI display.
|
java.util.Optional<MousePtrWrapper> |
getCustomMousePointer()
Get the current custom mouse pointer if it is set
|
int |
getDropDownScrollBarWidth()
Gets the width of the scrollbar used for drop-down.
|
EntryFieldGuiImpl |
getEntryField()
Gets instance of entry field attached in SIMPLE or DROP-DOWN modes.
|
(package private) int |
getEntryFieldHeight()
Returns entry field height.
|
int |
getFormatLength()
Returns the format length of the data type the combo-box represents.
|
java.lang.String |
getInitialScreenText(BaseDataType initVal)
Gets the initially setted screen value.
|
private int |
getInnerLines()
Returns the inner lines value for combo-box.
|
private int |
getItemMaximalWidth(int font)
Calculates the maximal item width in the pixel units for the given font number.
|
java.lang.Object |
getList()
Returns the list for SIMPLE combo-box mode.
|
int |
getRowHeight()
Gets the current row height depending on choosen font.
|
BaseDataType |
getScreenValue()
Get widget screen value.
|
int |
getSimpleListVisibleHeight()
Returns simple list height without (upper and lower) border.
|
BaseDataType |
getValue()
Gets the currently selected item.
|
BaseDataType |
getValue(boolean initial)
Gets the currently selected item.
|
boolean |
hasFocus()
Check if widget has focus.
|
double |
height()
Get widget height.
|
protected java.util.Set<java.lang.String> |
initEventsSet()
Initializes the event set to return.
|
void |
initialize(WidgetId id,
ComboBoxConfig wcfg)
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.
|
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 |
isSelectionValid()
Check if currently there is some selected text.
|
private void |
layoutSimpleList()
Layout simple list.
|
protected int[] |
mouseActions()
Determine the mouse actions processed by this widget.
|
void |
mousePressed(java.awt.event.MouseEvent e)
Notification of a mouse pressed event occurred for this widget.
|
void |
mouseReleased(java.awt.event.MouseEvent e)
Notification of a mouse released event occurred for this widget.
|
boolean |
moveToBottom()
Moves this widget to the bottom of other widgets in the z-ordering.
|
boolean |
moveToTop()
Moves this widget to the top of other widgets in the z-ordering.
|
void |
onFocusGained(FocusEvent event)
This is called when the combo-box gains the input focus.
|
void |
onFocusLost(FocusEvent focusEvent)
This is called when the combo-box loses the input focus.
|
private void |
positionEntryField(Theme theme,
NativePoint p)
Method that sets the location of the entry field, based on the combo-box's location and the theme
in use.
|
protected void |
postprocessDropDown()
Sometimes it is required to do several action the was deferred during drop-down life cycle.
|
void |
processFocusMoveKey(KeyInput keyEvent)
Process the action associated with the given focus movement key in an independent drawing
bracket.
|
void |
processKeyEvent(KeyInput keyEvent)
Process key events that have been generated by this component.
|
boolean |
processMnemonic(int key)
Process the given key, if this widget's mnemonic matches the key.
|
void |
processSystemKey(KeyInput keyEvent)
Process the action associated with the given key in an independent drawing bracket.
|
void |
refreshItems()
Refresh items in the combo-box after assignment.
|
protected void |
registerDropDownFrame()
Registers drop-down frame in current window system.
|
void |
removeSelectedText()
Removes selected text.
|
void |
setEnabled(boolean enabled)
Enable/disable widget.
|
void |
setHidden(boolean hidden)
Tracks the hidden state of the combo-box and its entry field or simple-list pane.
|
private void |
setNewSelection(int indexNew)
Changes the selected value without opening drop-down.
|
boolean |
setSelection(int start,
int end)
Creates a new selection, eventually dropping the already existing one.
|
void |
setValue(BaseDataType value)
Sets the instance representing the current value.
|
void |
setVisible(boolean visible_)
Shows or hides the combo-box and its label.
|
boolean |
supportsCustomMousePointer()
Check if the widget supports LOAD-MOUSE-POINTER() method
|
void |
updateSize(ComboBoxConfig beforeUpdate)
Update widget's size after config update
|
void |
valueChangedCommon()
Posts value changed event to the queue.
|
double |
width()
Get widget width.
|
activate, addItemListener, calcLimit, canMovetoTop, config, deactivateCode, deleteItem, dimension, fireValueChanged, getBrowse, getColon, getColumnLabelText, getColumnMnemonic, getDColor, getDropDownList, getItemText, getLabelInstance, getLabelText, getMaxLabelLen, getMnemonic, getScrollPaneId, getSelection, getText, getTo, getTriggerWidget, isDropDownActive, isForceLabel, isFormatHonored, isLinkedToBrowse, isModified, isNoLabels, isRightAligned, isSelected, isSimpleMode, lookup, manageSystemActions, minimumSize, model, onSelect, postprocessConfig, processEvent, removeItemListener, requestFocus, setBrowseColumn, setColumnMnemonic, setLabelInstance, setMnemonic, setNoLabels, setWasVisible, valueChangedImpl, wasVisible, widgetRealized_setHidden, _setVisible, activateDirectManipulation, addFocusListener, addKeyListener, afterConfigUpdateBase, ancestor, ancestorId, autoResize, bounds, clear, clearWidget, clipRectangle, clipRectangle, clipWith, copyColors, copyState, createMouseHoverAction, deactivateDirectManipulation, debug, disable, disableTooltip, displayPhysicalLocation, enable, enableTooltip, enclosingFrame, findMouseSource, focusTraversable, forceCursorOnFocus, forceVisibility, getActualBounds, getAndResetBitmap, getAndSetBitmap, getBitmapCopy, getCachedScreenLocation, getCachedScreenPhysicalLocation, 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, insets, isCurrent, isDirectManipulationActive, isDirectManipulationActiveOrInUIB, isDirectManipulationCapable, isDirectManipulationRequired, isDisplayed, isEnabled, isFocusable, isHeader, isMouseDrag, isRealized, isRepaintDisabled, isRMBEntrySupported, isScreenLocationCached, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mouseWheelMoved, name, navigable, oleDoDrop, oleDrag, oleDragging, oleStartDragging, onOleDragging, onOleDropEnd, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalBounds, physicalDimension, physicalLocation, prepParentLocation, preventFocusWhenMouseDownEventDefined, processDirectManipulationEvent, processFocusEvent, processKeyEventForSelectableWidget, processKeyListeners, processMnemonicImpl, raiseLegacyMouseEvents, reflectAncestorChange, reflectLocationChanged, reflectSizeChanged, refresh, registerWidgetListener, repaint, repaint, repaint, requestFocus, requestSync, resetBitmap, resizeTo, resolveFont, resolvePopupMenuId, resolveTitleFont, screen, screenDimension, screenHeight, screenLocation, screenPhysicalLocation, screenWidth, setBitmap, setCachedScreenLocation, setCachedScreenPhysicalLocation, setDirectManipulationActive, setHighlighted, setLocation, setLocation, setMousePointer, setMousePointer, setParent, setPhysicalDimensionInt, setPhysicalLocation, setSensitiveForUIB, setState, setWindow, show, showPopupMenu, sync, topLevelWindow, toString, translate, triggerLocationChanged, unrealize, unregisterWidgetListener, updateSizeWorker, updateSystemParent, widgetStateChanged, windowclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetChangedValueacceptsEscAsAnyKey, acceptTrigger, addFocusListener, addKeyListener, ancestor, ancestorId, bounds, clearWidget, completeTrigger, defaultMousePtr, displayPhysicalLocation, enclosingFrame, enforceDefaultMousePtr, findMouseSource, focusTraversable, forceCursorOnFocus, forceVisibility, getActualBounds, getEffectiveMousePointer, getId, getIdForTrigger, getLegacyWidget, getLoadedMousePointer, getMenuMouse, getMouseActions, getMousePosition, getSelectedText, getState, getTriggerWidget, getVisiblePart, getZOrderClass, hasFocus, hasTooltip, hidden, hide, highlighted, ignoreEnable, initialHeight, initialWidth, insets, isCurrent, isCurrent, isDirectManipulable, isDirectManipulationActive, isDirectManipulationActiveOrInUIB, isDisplayed, isEnabled, isFocusable, isHeader, isInitialValueLayout, isLegacyFocus, isProcessProgressEvent, isRealized, isRepaintDisabled, isRMBEntrySupported, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, maySwitchFocus, name, navigable, oleDrag, parent, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalBounds, physicalDimension, physicalLocation, preventFocusWhenMouseDownEventDefined, processDirectManipulationEvent, processFocusEvent, processKeyListeners, raiseLegacyMouseEvents, refreshWidget, registerWidgetListener, repaint, 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, windowmouseClicked, mouseEntered, mouseExitedgetMnemonicCharacter, getMnemonicKeyCode, getMnemonicLabel, isMnemonicSupported, updateMnemoniceditPaste, isEditCanUndopublic static final int TEXT_SHIFT
private static final int ENTRY_TO_HEIGHT_Y_DIFF
private GuiDriver gd
private GuiOutputManager screen
private CoordinatesConversion cc
private GuiColorResolver gc
private GuiFontResolver gf
private boolean pressed
private EntryFieldGuiImpl entryField
private ScrollableSelectionListGuiImpl simpleList
private ScrollPaneGuiImpl simpleListPane
private KeyInput keyToDefer
public ComboBoxGuiImpl(WidgetId id, WidgetConfig cfg)
id - The widget's ID.cfg - Configuration data.public void initialize(WidgetId id, ComboBoxConfig wcfg)
This API is called after the widget is created and added to the registry.
initialize in interface WidgetWithConfig<ComboBoxConfig>initialize in class ComboBox<GuiOutputManager>id - The widget's ID.wcfg - The config used to initialize this widget.public void afterConfigUpdate(ComboBoxConfig beforeUpdate)
afterConfigUpdate in interface ConfigOwner<ComboBoxConfig>afterConfigUpdate in class ComboBox<GuiOutputManager>beforeUpdate - Config reference capturing the config state before
the owner's config was modified.public void draw()
draw in interface Widget<GuiOutputManager>draw in class ComboBox<GuiOutputManager>public void drawCaret()
drawCaret in interface Widget<GuiOutputManager>drawCaret in class ComboBox<GuiOutputManager>protected java.lang.String formatValue(java.lang.String selectedItem,
DisplayFormat format,
int width,
boolean right)
honor format flag is true then the widget is in "item list" mode and the
super class handles it. Otherwise the string is used unchanged.formatValue in class ComboBox<GuiOutputManager>selectedItem - The source string to format.format - The instance of DisplayFormatwidth - The char widthright - True for right-aligned valuespublic void onFocusGained(FocusEvent event)
onFocusGained in interface FocusListeneronFocusGained in class ComboBox<GuiOutputManager>event - The focus event to be processed.public void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface java.awt.event.MouseListenermousePressed in class AbstractWidget<GuiOutputManager>e - The mouse event.public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased in interface java.awt.event.MouseListenermouseReleased in class AbstractWidget<GuiOutputManager>e - The mouse event.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()
MnemonicInfo instance.createMnemonic in interface MnemonicTrait<GuiOutputManager>public void processKeyEvent(KeyInput keyEvent)
processKeyEvent in interface Widget<GuiOutputManager>processKeyEvent in class ComboBox<GuiOutputManager>keyEvent - The key event to be handled.public void processSystemKey(KeyInput keyEvent)
This must be called only in the context of widget-level event processing.
processSystemKey in class ComboBox<GuiOutputManager>keyEvent - The key to be processed.public void processFocusMoveKey(KeyInput keyEvent)
TAB or BACK_TAB.
This must be called only in SIMPLE or DROP-DOWN mode either from entry field or from attached selection list.
keyEvent - The key to be processed, TAB or BACK_TAB.public BaseDataType getValue()
getValue in interface DataContainergetValue in class ComboBox<GuiOutputManager>public BaseDataType getValue(boolean initial)
initial - true to get the initial value for the entry field.public BaseDataType getScreenValue()
getScreenValue in class ComboBox<GuiOutputManager>public void invalidateSelection()
invalidateSelection in interface TextSelectionpublic boolean isSelectionValid()
isSelectionValid in interface TextSelectiontrue if text is selected.public void removeSelectedText()
removeSelectedText in interface TextSelectionpublic boolean setSelection(int start,
int end)
setSelection in interface TextSelectionstart - The offset of the start of the new selection.end - The offset of the end of the new selection.true is operation is successful.public boolean moveToTop()
The entryField is always on top of the combo-box.
moveToTop in interface Widget<GuiOutputManager>moveToTop in class AbstractWidget<GuiOutputManager>true if operation was successful and false otherwise.public boolean moveToBottom()
moveToBottom in interface Widget<GuiOutputManager>moveToBottom in class AbstractWidget<GuiOutputManager>true if operation was successful and
false otherwise.public void setVisible(boolean visible_)
setVisible in interface Widget<GuiOutputManager>setVisible in class ComboBox<GuiOutputManager>visible_ - true to make the widget visible,
false to hide the widget.public void setHidden(boolean hidden)
setHidden in interface Widget<GuiOutputManager>setHidden in class ComboBox<GuiOutputManager>hidden - New hidden state.public double height()
AbstractWidgetheight in interface Widget<GuiOutputManager>height in class ComboBox<GuiOutputManager>Widget.height()public double width()
AbstractWidgetwidth in interface Widget<GuiOutputManager>width in class ComboBox<GuiOutputManager>Widget.width()public void setValue(BaseDataType value)
setValue in interface DataContainersetValue in class ComboBox<GuiOutputManager>value - The value representing the current widget value.public void changed()
changed in interface SelectionListenerchanged in class ComboBox<GuiOutputManager>public void setEnabled(boolean enabled)
setEnabled in interface Widget<GuiOutputManager>setEnabled in class AbstractWidget<GuiOutputManager>enabled - TRUE to make the widget enabled,
FALSE to disable the widget.public boolean hasFocus()
hasFocus in interface Widget<GuiOutputManager>true if widget has focus.public int getRowHeight()
public int getDropDownScrollBarWidth()
public void destroy()
destroy in interface Widget<GuiOutputManager>destroy in class ComboBox<GuiOutputManager>public void entryFieldChanged(java.lang.String newValue)
newValue - The new value for combo-box.public void deferKeyEvent(KeyInput ki)
ki - The key event to be posted after drop-down become closed.protected void postprocessDropDown()
postprocessDropDown in class ComboBox<GuiOutputManager>public void exitDropDown()
exitDropDown in class ComboBox<GuiOutputManager>public void updateSize(ComboBoxConfig beforeUpdate)
updateSize in interface AutoResizable<ComboBoxConfig>beforeUpdate - previous value of the widget's configpublic boolean isAutoResize()
isAutoResize in interface AutoResizable<ComboBoxConfig>true is AUTO-RESIZE is enabledpublic void onFocusLost(FocusEvent focusEvent)
onFocusLost in interface FocusListeneronFocusLost in class ComboBox<GuiOutputManager>focusEvent - The focus event to be processed.public java.lang.Object getList()
public void refreshItems()
refreshItems in interface ControlSetComponentrefreshItems in class ComboBox<GuiOutputManager>public int getSimpleListVisibleHeight()
public boolean isDroppable()
isDroppable in interface Widget<GuiOutputManager>TRUE if this widget can be droppable at this time,
FALSE otherwise.public boolean doAutoCompletion(char currentChar,
boolean listOpened)
currentChar - The current char from key event causung this call, not yet in entry field
screen buffer.listOpened - The flag indicating if the DROP-DOWN list is opened.TRUE if changes happen in current combo-box status,
FALSE otherwise.public EntryFieldGuiImpl getEntryField()
protected void registerDropDownFrame()
registerDropDownFrame in class ComboBox<GuiOutputManager>protected void dropDownRequestFocus()
dropDownRequestFocus in class ComboBox<GuiOutputManager>public boolean supportsCustomMousePointer()
supportsCustomMousePointer in interface Widget<GuiOutputManager>supportsCustomMousePointer in class AbstractWidget<GuiOutputManager>true if the widget supports
LOAD-MOUSE-POINTER() methodpublic java.util.Optional<MousePtrWrapper> getCustomMousePointer()
getCustomMousePointer in interface Widget<GuiOutputManager>getCustomMousePointer in class AbstractWidget<GuiOutputManager>protected int[] mouseActions()
mouseActions in class AbstractWidget<GuiOutputManager>public void valueChangedCommon()
valueChangedCommon in class ComboBox<GuiOutputManager>protected java.util.Set<java.lang.String> initEventsSet()
initEventsSet in class ComboBox<GuiOutputManager>protected void addUISpecificEvents(EventList listToChange)
addUISpecificEvents in class ComboBox<GuiOutputManager>listToChange - The event list to modify.private void createEntryField()
private void positionEntryField(Theme theme, NativePoint p)
theme - The theme in use.p - The combo-box location.private void createSimpleList()
int getEntryFieldHeight()
private void layoutSimpleList()
private void setNewSelection(int indexNew)
indexNew - The index of the new item to select.public java.lang.String getInitialScreenText(BaseDataType initVal)
initVal - The number of the list items pair or entry for the list item.public int getFormatLength()
private int getItemMaximalWidth(int font)
font - The provided font.private int getInnerLines()