public class TreeListGuiImpl extends TreeGuiImpl
Modifier and Type | Class and Description |
---|---|
static class |
TreeListGuiImpl.ColumnCache
Column cache.
|
TreeGuiImpl.TreeEditor, TreeGuiImpl.TreeNode
Modifier and Type | Field and Description |
---|---|
(package private) TreeListCaption |
caption
Caption
|
java.util.List<TreeListGuiImpl.ColumnCache> |
columns
Cached column definitions
|
private java.time.format.DateTimeFormatter |
dateTimeParser
Parser to parse strings passed from application for columns of DATETIME data type to
use for sorting dates.
|
body, config, currentNode, dropHighlightNode, gc, gd, gf, hModel, LOGGER, rootNode, scrollableContainer, topNode, treeEditor, vModel
border
location, mousePtr, nativeInsets, physicalLocation
Constructor and Description |
---|
TreeListGuiImpl(WidgetId id,
TreeListConfig cfg)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
afterConfigUpdate(TreeConfig beforeUpdate)
The method is called after the configuration associated with the
owner changes.
|
protected void |
buildTreeModel()
Builds tree model from the config's flat list.
|
private static <T extends java.lang.Comparable<T>> |
convertCompare(int index,
java.util.function.Function<java.lang.String,T> parser,
boolean descending,
T defaultValue)
Create a comparator suitable for comparing cell values in the sorting column with datatypes
other than STRING or ICON.
|
protected TreeBodyGuiImpl |
createBody()
Creates new body implementation.
|
private static <T extends java.lang.Comparable<T>> |
directCompare(int index,
java.util.function.Function<java.lang.Object,T> parser,
boolean descending)
Create a comparator suitable for comparing cell values in the sorting column with datatypes
STRING and ICON.
|
void |
doLayout()
Lay out container.
|
private java.time.format.DateTimeFormatter |
getDateTimeParser()
Get datetime parser to use when sorting columns of DATETIME type.
|
int |
getFirstVisibleColumnIndex()
Returns the column index of the first visible column.
|
protected java.lang.String |
getNodeText(TreeGuiImpl.TreeNode node)
Returns the node text.
|
void |
initialize(WidgetId id,
TreeConfig 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 java.util.Comparator<TreeGuiImpl.TreeNode> |
nodeComparator()
Create a comparator capable to compare nodes based on current sorting column.
|
private double |
parseDecimal(java.lang.String s)
Parse a decimal number, honor the group and decimal separators.
|
private int |
parseInteger(java.lang.String s)
Parse an integer number, honor the group separator.
|
(package private) void |
relocateColumn(TreeListGuiImpl.ColumnCache targetColumn,
TreeListGuiImpl.ColumnCache sourceColumn)
Update config column positions after a column position was changed
by the user.
|
boolean |
singleColumn()
Test if there is exactly one column in the tree.
|
private TreeListConfig |
treeListConfig()
Get config cast to the actual type.
|
void |
triggerColumnSorting(int index,
boolean resetSorting)
Trigger sorting by column.
|
java.lang.Iterable<TreeListGuiImpl.ColumnCache> |
visibleColumns()
Iterable for all visible columns.
|
config, currentFocus, defaultFocus, drawEditor, ensureVisible, findNodeById, fireAfterLabelEdit, fireNodeExpansionTrigger, firstFocus, getCurrentNode, getDropHighlightNode, getId, getNodeCheckBoxBounds, getNodeImage, getNodeLabelBounds, getText, getValue, getViewportFitRowCount, getVisibleNodeCount, hasFocusable, hitTest, isEditorActivated, isLabelsEditingSupported, isModified, lastFocus, makeNodeConfigDirty, preventFocusWhenMouseDownEventDefined, processKeyEvent, repaintTree, resolveFontCache, setCurrentNode, setCurrentNode, setNodeExpansion, setValue, sortNodes, systemFocusGrabbed, toggleCurrentNodeExpansion, toggleNodeCheck, toggleNodeExpansion, visibleNodes
draw, drawPanel, is3DBorder, isRMBEntrySupported, set3DBorder, setColorResolver, setCustomDraw, setId, setOptionalDraw
border, insets, isTransparent, setBorder, setTransparent
add, add, add, addContainerStateListener, addDirectly, belongsTo, checkWidget, childrenLocation, clipping, clipRectangle, copyState, currentFocus, cycleFocus, deregisterSelectedWidget, destroy, detach, dimension, dumpCurrentWidgets, dumpWidgets, endSizeChange, findMouseSource, focus, focusTraversable, focusWorker, formatDump, get, getAllSelectedWidgets, getClipRect, getEffectiveScrollableSize, getFocusInt, getIgnoreFocus, getLayout, getScrollableSize, getTabItemList, height, minimumSize, moveAfterTabItem, moveBeforeTabItem, moveToBottom, moveToBottomInClass, moveToTop, moveToTopInClass, moveToZpos, nextFocus, normalizeZOrder, onWidgetAdded, onWidgetRemoved, paintOnTop, parentOf, prepareWidgets, prevFocus, reflectAncestorChange, reflectLocationChange, registerSelectedWidget, remove, removeContainerStateListener, repaint, replace, requestFocus, requestFocus, setFocus, setFocusInt, setHeight, setIgnoreFocus, setInsets, setLayout, setSize, setSize, setTabItemList, setWidth, startSizeChange, triggerContainerStateRedrawEnabled, unrealize, updateSizeWorker, 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, drawCaret, enable, enableTooltip, enclosingFrame, forceCursorOnFocus, forceVisibility, getActualBounds, getAndResetBitmap, getAndSetBitmap, getBitmapCopy, getCachedScreenLocation, getCachedScreenPhysicalLocation, getCustomMousePointer, getDefaultEvent, getEffectiveMousePointer, getLoadedMousePointer, getMenuMouse, getMouseActions, getMousePosition, getPortableMouseEventCoordinates, getSelectedText, getState, getTextHeight, getTextHeightNative, getTextHeightNative, getTextWidth, getTextWidth, getTextWidthNative, getTextWidthNative, getVisiblePart, getZOrderClass, hasFocus, hidden, hide, highlighted, ignoreAction, initialHeight, initialWidth, isCurrent, isDirectManipulationActive, isDirectManipulationCapable, isDirectManipulationRequired, isDisplayed, isEnabled, isFocusable, isHeader, isMouseDrag, isRealized, isRepaintDisabled, isScreenLocationCached, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, manageSystemActions, 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, postprocessConfig, prepParentLocation, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyEventForSelectableWidget, processKeyListeners, processMnemonic, processMnemonicImpl, processSystemKey, raiseLegacyMouseEvents, refresh, registerWidgetStateListener, repaint, repaint, requestSync, resetBitmap, resizeTo, resolveFont, resolvePopupMenuId, resolveTitleFont, screen, screenDimension, screenHeight, screenLocation, screenPhysicalLocation, screenWidth, setBitmap, setCachedScreenLocation, setCachedScreenPhysicalLocation, setEnabled, setHidden, setHighlighted, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, setVisible, show, showPopupMenu, supportsCustomMousePointer, sync, topLevelWindow, toString, translate, unregisterWidgetStateListener, window
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
widgetsAsList
addFocusListener, addKeyListener, ancestor, ancestorId, bounds, canMovetoTop, clearWidget, defaultMousePtr, displayPhysicalLocation, drawCaret, enclosingFrame, enforceDefaultMousePtr, forceCursorOnFocus, forceVisibility, getActualBounds, getCustomMousePointer, getEffectiveMousePointer, getLegacyWidget, getLoadedMousePointer, getMenuMouse, getMouseActions, getMousePosition, getSelectedText, getState, getTriggerWidget, getTriggerWidget, getVisiblePart, getZOrderClass, hasFocus, hasFocus, hidden, hide, highlighted, ignoreEnable, initialHeight, initialWidth, isCurrent, isDirectManipulable, isDirectManipulationActive, isDisplayed, isDroppable, isEnabled, isFocusable, isHeader, isInitialValueLayout, isLegacyFocus, isRealized, isRepaintDisabled, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, maySwitchFocus, moveToBottom, moveToTop, name, navigable, oleDrag, parent, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalBounds, physicalDimension, physicalLocation, postprocessConfig, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyListeners, processMnemonic, raiseLegacyMouseEvents, refreshWidget, registerWidgetStateListener, repaint, repaint, requestFocus, requestSync, resizeTo, resolvePopupMenuId, screen, screenLocation, screenPhysicalLocation, setEnabled, setHidden, setHighlighted, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, setVisible, show, supportsCustomMousePointer, topLevelWindow, unregisterWidgetStateListener, validateDisplayValue, window
public final java.util.List<TreeListGuiImpl.ColumnCache> columns
final TreeListCaption caption
private java.time.format.DateTimeFormatter dateTimeParser
TreeListConfig.shortDateFormat
.
If no value was parsed from the application before this field is user, the default 4gl date format
"99/99/99" is used, with the component order used in date.getDateComponentOrder()
.public TreeListGuiImpl(WidgetId id, TreeListConfig cfg)
id
- Widget id.cfg
- Config instance.public void afterConfigUpdate(TreeConfig beforeUpdate)
The implemented logic must be idempotent - the method must produce the same results if executed once or multiple times not relying on any particular call sequence or related state. This is necessary so that the method can be repeated or retried as often as necessary without causing unintended effects
afterConfigUpdate
in interface ConfigOwner<TreeConfig>
afterConfigUpdate
in class TreeGuiImpl
beforeUpdate
- Config reference capturing the config state before the owner's config was modified.public final void doLayout()
doLayout
in interface Container<GuiOutputManager>
doLayout
in class AbstractContainer<GuiOutputManager>
public final int getFirstVisibleColumnIndex()
public void initialize(WidgetId id, TreeConfig cfg)
This API is called after the widget is created and added to the registry.
initialize
in interface WidgetWithConfig<TreeConfig>
initialize
in class TreeGuiImpl
id
- The widget's ID.cfg
- The config used to initialize this widget.public final boolean singleColumn()
public final void triggerColumnSorting(int index, boolean resetSorting)
index
- the column indexresetSorting
- if true
, then reset column sortingpublic final java.lang.Iterable<TreeListGuiImpl.ColumnCache> visibleColumns()
final void relocateColumn(TreeListGuiImpl.ColumnCache targetColumn, TreeListGuiImpl.ColumnCache sourceColumn)
targetColumn
- Target column, must differ from the source column.sourceColumn
- Source column.protected final void buildTreeModel()
buildTreeModel
in class TreeGuiImpl
protected TreeBodyGuiImpl createBody()
createBody
in class TreeGuiImpl
protected java.lang.String getNodeText(TreeGuiImpl.TreeNode node)
getNodeText
in class TreeGuiImpl
node
- Tree node.protected final java.util.Comparator<TreeGuiImpl.TreeNode> nodeComparator()
nodeComparator
in class TreeGuiImpl
null
if no sorting column is set in the tree.private TreeListConfig treeListConfig()
private static <T extends java.lang.Comparable<T>> java.util.Comparator<TreeGuiImpl.TreeNode> convertCompare(int index, java.util.function.Function<java.lang.String,T> parser, boolean descending, T defaultValue)
For such columns, the cell values should be compared according to their types. So, the value string representations shall first be parsed into the corresponding types before the values can be compared.
The parsed values are cached in the TreeListNodeEntry.cellSortingValues
.
T
- the type of values to compare.index
- the column indexparser
- the parsing function to try to parse stringdescending
- true
if sorting order should be reverseddefaultValue
- the value to use if parse was not successfulprivate static <T extends java.lang.Comparable<T>> java.util.Comparator<TreeGuiImpl.TreeNode> directCompare(int index, java.util.function.Function<java.lang.Object,T> parser, boolean descending)
TreeListNodeEntry.cellValues
can be directly compared.T
- the type of values to compare.index
- the column indexparser
- the parsing function to try to parse stringdescending
- true
if sorting order should be reversedprivate final java.time.format.DateTimeFormatter getDateTimeParser()
private double parseDecimal(java.lang.String s) throws ErrorConditionException
s
- the string to parseErrorConditionException
- if the value cannot parseprivate int parseInteger(java.lang.String s) throws ErrorConditionException
The values of the group separator are taken from the tree list config or, if missing, from the 4gl session configuration.
s
- the string to parseErrorConditionException
- if the value cannot be parsed