public class BrowseGuiImpl extends Browse<GuiOutputManager> implements Hoverable
Modifier and Type | Class and Description |
---|---|
private class |
BrowseGuiImpl.ColumnSetContainer
Set of arranged columns.
|
private class |
BrowseGuiImpl.ColumnsScrollPane
Scroll pane for the
scrollableColumnSet . |
private class |
BrowseGuiImpl.HorizontalColumnScroller
Class for handling horizontal scrolling.
|
private class |
BrowseGuiImpl.VerticalRowScroller
Class for handling vertical scrolling.
|
Browse.SelectedRow
Widget.ZOrderClass
Modifier and Type | Field and Description |
---|---|
private static int |
ALLOWED_HIDDEN_CELL_BOTTOM_PART
Part of the cell the can be hidden at bottom.
|
private ColorRgb |
backgroundColor
Background color.
|
static int |
BORDER_THICKNESS
Width of browse/column border.
|
private GuiFontResolver |
browseFontResolver
Font resolver.
|
private CoordinatesConversion |
cc
Coordinates conversion.
|
(package private) static int |
CELL_OFFSET_BOTTOM
Bottom offset for text area in a cell.
|
(package private) static int |
CELL_OFFSET_TOP
Top offset for text area in a cell.
|
private GuiColorResolver |
colorResolver
Browse color resolver.
|
(package private) static int |
COLUMN_RESIZE_AREA_WIDTH
Width of a resize area.
|
(package private) static int |
DATA_OFFSET_LEFT
Left offset for text area in a cell.
|
(package private) static int |
DATA_OFFSET_RIGHT
Right offset for text area in a cell.
|
private static int |
DEFAULT_DYNAMIC_DOWN_SIZE
Default DOWN value for a dynamic browse.
|
private static int |
DEFAULT_DYNAMIC_WIDTH_CHARS
Default width for a dynamic browse.
|
private BrowseColumnGuiImpl |
draggedColumn
Reference to the column which is being dragged.
|
private int |
effectiveRowHeight
Row height (in pixels) excluding borders and separators.
|
private GuiDriver |
gd
Screen driver
|
(package private) static int |
H_BAR_THUMB_WIDTH
Width of the thumb of the horizontal scroll bar.
|
private int |
horizontalColumnScrollMax
Maximum for horizontal scrolling in column scrolling mode.
|
private ScrollBarGuiImpl |
horizontalScrollbar
Horizontal scrollbar.
|
private ScrollBarControllerGuiImpl |
horizontalScroller
Horizontal scroller.
|
private int |
hScrollingStep
Horizontal scrolling step for non-COLUMN-SCROLLING mode.
|
private boolean |
initialRepositionDone
true if initial reposition was done (i.e. |
private int |
labelsHeight
Height of the labels area (in pixels) excluding borders.
|
private int |
leftDragColumnMouseOffset
Offset from the left edge of the column which is being dragged to the position of the
pointer inside the column.
|
private int |
leftDragColumnOffset
Offset from the left edge of the browse (or the edge of the markers column) to the left
edge of the column which is being dragged.
|
private int |
leftResizeColumnOffset
Offset from the left edge of the browse to the left edge of the contour of the column which
is being resized.
|
private BrowseGuiImpl.ColumnSetContainer |
lockedColumnSet
Content pane for browse columns and data (locked part).
|
private int |
lockedColumnsWidth
Total width of the locked columns.
|
private static java.util.logging.Logger |
LOG
Logger.
|
private BrowseColumnGuiImpl |
markersColumn
Markers column (leftmost).
|
static int |
MIN_BROWSE_ROWS
Minimum number of rows in a browse.
|
private boolean |
mouseFocusGained
If browse gained focus by mouse click rather than other ways.
|
(package private) static int |
RESIZE_LINE_VERTICAL_OFFSET
Top or bottom offset for a column resize contour.
|
private BrowseColumnGuiImpl |
resizedColumn
Reference to the column which is being resized.
|
private int |
rightResizeColumnOffset
Offset from the left edge of the browse to the right edge of the contour of the column which
is being resized.
|
private static int |
SCROLL_ROWS_PER_WHEEL_ROTATION
How many rows is scrolled per one mouse wheel rotation.
|
private BrowseGuiImpl.ColumnSetContainer |
scrollableColumnSet
Content pane for browse columns and data (scrollable part).
|
private ScrollPaneGuiImpl |
scrollPane
Scrollable wrapper for content pane (scrollable part).
|
private static ColorRgb |
SEPARATOR_DEFAULT_COLOR
Default separator color.
|
private static ColorRgb |
SEPARATOR_DEFAULT_COLOR2
Default separator color if background browse color matches
SEPARATOR_DEFAULT_COLOR . |
private ColorRgb |
separatorColor
Separator color.
|
private static java.lang.String |
SORT_ARROW_DOWN_IMAGE_NAME
Name of the sorting arrow down image.
|
static int |
SORT_ARROW_HEIGHT
Height of a sort arrow displayed on column labels, in pixels.
|
private static java.lang.String |
SORT_ARROW_UP_IMAGE_NAME
Name of the sorting arrow up image.
|
static int |
SORT_ARROW_WIDTH
Width of a sort arrow displayed on column labels, in pixels.
|
static int |
SORT_NUMBER_HEIGHT
Height of a sort number displayed on column labels, in pixels.
|
private static java.lang.String |
SORT_NUMBER_IMAGE_NAME_TEMPLATE
Template of a sorting number image name.
|
static int |
SORT_NUMBER_WIDTH
Width of a sort number displayed on column labels, in pixels.
|
private ImageWrapper |
sortArrowDownImage
Cached sort arrow down image.
|
private ImageWrapper |
sortArrowUpImage
Cached sort arrow up image.
|
private ImageWrapper[] |
sortNumberImages
Cached images of sort numbers.
|
private GuiFontResolver |
titleFontResolver
Font resolver for the browse title font.
|
private int |
titleHeight
Browse title height (without title borders).
|
private BorderedPanelGuiImpl |
titlePanel
Title panel.
|
private int |
totalColumnsWidth
Total columns width.
|
private static int |
UP_KEY_BOTTOM_OFFSET_ROWS
When the current row is out of the view below, then if we press UP key, the new current row
becomes
max(1, DOWN - UP_KEY_BOTTOM_OFFSET_ROWS) th row in the viewport
(1-based). |
private ScrollBarGuiImpl |
verticalScrollbar
Vertical scrollbar.
|
private ScrollBarControllerGuiImpl |
verticalScroller
Vertical scroller.
|
activeEditor, browseModel, CACHE_SIZE, colorCommon, colorCurrent, colorHSep, columnHelp, config, currColumn, currentRowDisplayStrategy, currRowSelected, currRowUpdates, dcData, drawLabels, editedRow, editedRowIndex, editingExistingRowBefore, hadDraw, ilFirstScrollCol, ilLabelsHeight, intermediateDcData, NEW_ROWS_NUMERATION_START, originalHeight, originalWidth, pseudoFocus, rcLabels, rowCountAssessment, savingRow, scrollColumn, selectedRowIndices, separatorQuirk
location, mousePtr, nativeInsets, physicalLocation
Constructor and Description |
---|
BrowseGuiImpl(WidgetId id,
BrowseConfig cfg)
Constructs the Browse widget.
|
Modifier and Type | Method and Description |
---|---|
protected void |
activateDirectManipulation()
Activates direct manipulation engine for this widget.
|
protected void |
addEditor(Widget editor)
Add editor widget to the browse.
|
private void |
adjustLockedColumnsPanel()
Set the width of the
lockedColumnSet panel according to
lockedColumnsWidth . |
void |
afterConfigUpdate(BrowseConfig beforeUpdate)
The method is called after the configuration associated with the
owner changes.
|
private void |
buildPanels()
Create column panels and widgets.
|
private int |
calcDown()
Calculate DOWN value.
|
int |
calcDown(int rowHeightPixels)
Calculate DOWN value for the browse basing on the given row height.
|
private int |
calcImplicitBrowseHeightNoScrollbar()
Get browse native height if it is not specified explicitly (based on explicit or implicit
DOWN value).
|
private int |
calcRowHeight()
Calculate row height basing on the ROW-HEIGHT-CHARS or font height.
|
private int |
calcTitleHeight()
Calculate title height.
|
protected void |
cleanupEditor(Widget editor)
Clean up editor widget.
|
protected void |
columnToView(int cellColumn)
Setups scrolling to fully (as possible) show the given column.
|
protected ToggleBox |
createEditingToggleBox(boolean useValue,
BaseDataType value)
Create toggle-box editor widget for the current column.
|
protected Widget |
createEditor(boolean useValue,
BaseDataType value)
Create editor widget for the current column.
|
private void |
createMarkersColumn()
Create markers (leftmost) column if it doesn't exist yet.
|
private void |
createTitlePanel()
Create title panel.
|
protected void |
deactivateDirectManipulation()
Deactivates direct manipulation engine for this widget.
|
void |
destroy()
Destroy this widget.
|
void |
doLayout()
Lay out the browse.
|
void |
draw()
Draws the widget: border, header, selection marks and line, internal FillIn etc.
|
void |
drawCaret()
Sets position of terminal's cursor.
|
private boolean |
fitLastColumn()
Fit the last column if FIT-LAST-COLUMN attribute is set.
|
int |
fixupNoLabelsY(int y)
Get Y coordinate minus possible labels height.
|
GuiColorResolver |
getBrowseColorResolver()
Get browse color resolver.
|
(package private) GuiFontResolver |
getBrowseFontResolver()
Get browse font resolver.
|
GuiCellAttributes |
getCellAttr(BrowseRow[] rowCache,
int viewportIndex,
int columnIndex)
Get attribute container for the given cell from the specified row cache.
|
GuiCellAttributes |
getCellAttr(int viewportIndex,
int columnIndex)
Get attribute container for the given cell.
|
GuiCellAttributes |
getCellAttrWithIntermediate(int viewportIndex,
int columnIndex)
Get attribute container for the given cell from the cache containing intermediate rows
(
Browse.intermediateDcData ), if it is available, or normat cache (Browse.dcData )
otherwise. |
java.lang.String |
getCellText(int viewportIndex,
int colIndex)
Get text of the cell.
|
java.lang.String |
getCellTextWithIntermediate(BrowseColumnGuiImpl column,
int viewportIndex)
Get text of the cell from the cache containing intermediate rows
(
Browse.intermediateDcData ), if it is available, or normal cache (Browse.dcData ) |
BaseDataType |
getCellValue(int viewportIndex,
int colIndex)
Get value of the cell.
|
BaseDataType |
getCellValueWithIntermediate(BrowseColumnGuiImpl column,
int viewportIndex)
Get value of the cell from the cache containing intermediate rows
(
Browse.intermediateDcData ), if it is available, or normal cache (Browse.dcData ) |
private BrowseColumnGuiImpl |
getColumn(int index)
Get the browse column with the specific index.
|
private int |
getColumnOffset(int columnIndex)
Get offset of the column from the left edge of the viewport or from the right edge of
the last locked column if there are locked columns (if the is scroll pane is on its initial
position).
|
BaseDataType |
getColumnValue(int ordinal)
Get value of the given column in current row.
|
protected int |
getCurrentEditorX()
Get X coordinate for the current editor (relatively to the containing column set).
|
protected int |
getCurrentEditorY()
Get Y coordinate for the current editor (relatively to the containing column set).
|
BrowseColumnGuiImpl |
getCurrentMarkersColumn()
Obtain the current marker column.
|
private int |
getEffectiveMinColumnWidth()
Get minimum visual width of a column (data width + offsets).
|
MousePtrWrapper |
getEffectiveMousePointer()
Get the current effective custom mouse pointer
|
int |
getLabelLinesNum()
Number of lines in the labels area (matches the number of lines in the tallest multi-line
label).
|
int |
getLabelsHeight()
Get height of the labels area (in pixels), excluding borders.
|
protected int |
getLeftColumnContourLimit()
Returns the left limit for the resize column contour (relative to browse).
|
(package private) int |
getLockedColumnsWidth()
Get total width of the locked columns,
|
private Point |
getLockedPaneLocation()
Get locked panel location.
|
java.lang.String |
getMousePointerImpl()
Get the MOUSE-POINTER attribute
|
protected int |
getPageSize()
Get page size used for Page Up / Page Down.
|
protected int |
getRightColumnContourLimit()
Returns the right limit for the resize column contour (relative to browse).
|
int |
getRowByCoordinates(int y)
Get viewport index of the row which corresponds given vertical position.
|
int |
getRowHeight()
Get row height (in pixels), excluding borders and separators.
|
Widget |
getScrollableColumnSet()
Get the scrollable column widget.
|
private int |
getScrollbarThickness(ScrollBar.Orientation orientation)
Get thickness (width or height) of the corresponding scroll bar.
|
ScrollPaneGuiImpl |
getScrollPane()
Gets scrollpane container to draw something in coordinates related to it.
|
private NativeDimension |
getScrollPaneDimension()
Get scroll pane dimension.
|
private Point |
getScrollPaneLocation()
Get scroll panel location.
|
private int |
getSearchColumn()
Get the search column, i.e.
|
ColorRgb |
getSeparatorColor()
Get separator color.
|
private ScrollPaneGuiImpl.ShowBars |
getShowBars(boolean horizontal,
boolean vertical)
Get
ScrollPaneGuiImpl.ShowBars option which corresponds given visibility of the
scroll bars. |
ImageWrapper |
getSortArrowImage(boolean ascending)
Get cached sorting arrow image.
|
ImageWrapper |
getSortNumImage(int num)
Get image of the given sort number.
|
int |
getTitleHeight()
Get the height of the title, if any.
|
int |
getTopRowOffset(int viewportIndex)
Get top offset of the row (relatively to the place where label drawing starts).
|
int |
getTopYforRow(int rowNdx)
Gets vertical position of the given row related to the browse column vertical start.
|
int |
getTotalColumnsWidth()
Get the total width of the columns of this browse widget.
|
NativeDimension |
getViewportDimension()
Get viewport dimension.
|
protected void |
handleTabKey()
Handle TAB key press.
|
boolean |
hasTitle()
Determines if this browse has title.
|
protected void |
initEditorConfig(BaseConfig cfg)
Initialize editor widget config.
|
void |
initialize(WidgetId id,
BrowseConfig 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.
|
protected boolean |
isAggressiveCurrentRowSelection()
Returns
true if the current row of the single-selection browse is selected on
FOCUS-GAINED and some other events. |
(package private) boolean |
isColumnDrag()
Returns
true if a column is being dragged. |
(package private) boolean |
isColumnResize()
Returns
true if a column is being resized. |
private boolean |
isCtrlModifier(java.awt.event.MouseEvent e)
Returns
true if CTRL key was held down when a mouse button was pressed. |
boolean |
isCurrentEditingColumn(BrowseColumnGuiImpl column)
Returns
true if the given column is the current column and editing is in
progress. |
boolean |
isCurrentRowInView()
Determine if the current row is in the view.
|
protected boolean |
isDirectManipulationRequired()
Checks if direct manipulation feature must be installed or removed in GUI mode.
|
boolean |
isDrawnAsFocused()
Check if the browse should be drawn as a focused widget.
|
(package private) boolean |
isLabelsVisible()
Determine if the labels area is visible.
|
(package private) boolean |
isLastLockedColumnResizeArea(java.awt.event.MouseEvent e)
Returns
true if the mouse pointer is positioned over the resize area after the
right edge of the last locked column. |
(package private) boolean |
isPerformLayout()
Return
true if browse layout needs to be performed. |
protected boolean |
isRefreshedOnEnable()
Determines if browse refreshed on browse widget enabling.
|
private boolean |
isShiftModifier(java.awt.event.MouseEvent e)
Returns
true if SHIFT key was held down when a mouse button was pressed. |
protected int[] |
mouseActions()
Sub-classes will override this to return a list of mouse actions on which the widget
responds.
|
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 dragged event occurred for this widget.
|
void |
mouseWheelMoved(java.awt.event.MouseWheelEvent e)
Notification of a mouse wheel moved event occurred for this widget.
|
void |
moveColumn(int srcIndex,
int destIndex)
Implements the client side of the MOVE-COLUMN() widget method.
|
private void |
moveColumnInArray(java.lang.Object[] array,
int srcIndex,
int destIndex)
Repositions the element in the array.
|
private boolean |
needsColumnFit()
Returns
true if last column should be fit according to FIT-LAST-COLUMN or
NO-EMPTY-SPACE option. |
protected void |
notifyBrowseScrolled()
Notify that the browse has been scrolled (i.e.
|
void |
notifyColumnsUpdated()
Notify the browse that some columns have been added to it.
|
void |
onFocusGained(FocusEvent event)
Handle situation when
Browse widget receives the focus. |
void |
onFocusLost(FocusEvent event)
Handle situation when
Browse widget loses the focus. |
void |
onKeyPressed(KeyInput event)
Process key event.
|
void |
processDirectManipulationEvent(DirectManipulationEvent event)
Process direct manipulation event.
|
void |
processEvent(Event evt)
Intercept special events.
|
void |
queryRepositioned(boolean repositionError,
int targetRepositionRow)
Notify the browse that the underlying query has been repositioned..
|
private void |
rebuildColumns()
Re-initiate column widgets.
|
(package private) void |
resetPressedColumns(boolean trigger)
Set all column in non-pressed state.
|
private void |
resolveColors()
Resolve colors.
|
private void |
resolveFonts()
Resolve fonts.
|
(package private) void |
rowClicked(int viewportRowIndex,
int columnIndex,
java.awt.event.MouseEvent e)
Handle row clicks.
|
protected void |
scrollToColumn(int columnIndex)
Setups scrolling to fully (as possible) show the given column.
|
protected void |
scrollToEditableRow()
Scroll to the editable row if it is out of the view.
|
private void |
searchByKey(char searchChar)
Perform search by key: find the row which starts with the given character.
|
private void |
setColumnScrolling(boolean columnScrolling)
Set COLUMN-SCROLLING or non-COLUMN-SCROLLING modes.
|
private void |
setCurrentSingleRowSelected()
Select current row for single-selection case.
|
void |
setEnabled(boolean enabled)
Enable/disable widget.
|
void |
setIntermediateRows(BrowseRow[] rows)
Set "intermediate" rows (i.e.
|
void |
setMousePointerName(java.lang.String name)
Set the MOUSE-POINTER attribute
|
void |
setSize(double width,
double height)
Set container size.
|
private void |
showHorizontalScrollbar(boolean show)
Show or hide horizontal scrollbar.
|
(package private) void |
startColumnDrag(BrowseColumnGuiImpl column,
int leftDragColumnMouseOffset)
Start column dragging.
|
(package private) void |
startColumnResize(int columnIndex)
Start column resizing.
|
protected void |
startEdit(boolean updateSelection,
boolean useValue,
BaseDataType value)
Creates an editor for the current cell and adds it to the browse.
|
(package private) void |
stopColumnDrag(java.awt.event.MouseEvent e)
Stop column dragging.
|
(package private) void |
stopColumnResize()
Stop column resizing.
|
boolean |
supportsCustomMousePointer()
Check if the widget supports LOAD-MOUSE-POINTER() method
|
private void |
updateBrowseDimensions()
Update browse width and height without actual layout.
|
private void |
updateColumnSetsHeight()
Update height of scrollable and locked column sets in order to to match the viewport height.
|
private void |
updateEditorAfterColumnModification()
Update editor after column moving or resizing.
|
private void |
updateHorizontalColumnScrollMax()
Update maximum for horizontal scrolling in column scrolling mode.
|
protected void |
updateLabelsHeight()
Update height of the labels area.
|
private void |
updateLabelsVisible()
Update value of the
Browse.drawLabels attribute which defines if the labels area is
visible. |
private void |
updateVerticalScrollbarVisibility()
Show or hide vertical scrollbar depending on (NO-)SCROLLBAR-VERTICAL flag state.
|
Window |
window()
Get ancestor Window for this widget.
|
addNewRow, advanceCurrRowOrSelection, advanceRowSelection, cellStartsWith, clearWidget, config, createEditingFillIn, currentFocus, dcGetRow, dcGetRowIndex, defaultFocus, deselectAll, deselectFocusedRow, deselectSelectedRow, displayErrorMessage, executePendingRefresh, fireDefaultAction, fireValueChanged, focusTraversable, generateQuestionMarks, getActiveEditor, getActiveFillIn, getActiveToggleBox, getCachedRowNumber, getCachedRowNumber, getCachedRowNumberWithIntermediate, getCacheSize, getCacheSizeWithIntermediate, getCellText, getCellTextNoError, getColumnCount, getColumns, getColumnText, getCurrentRow, getCurrentRowAsSelected, getDisplayFormat, getDown, getEdgeExistingRow, getEditorValue, getFirstExistingRow, getFocusedRow, getFocusedWidget, getIdsOfColumnWidgets, getLabelVar, getLastAvailableSelectedRow, getLastExistingRow, getLegacyWidget, getMaximalSelectedRowIndex, getModel, getNewRowsBefore, getNextColumn, getPrevColumn, getRepositionedRow, getRowDisplayTriggerId, getRows, getRows, getScreenBufferForTrigger, getScrollRow, getSelectedRowIndex, getSelectedRowIndex, getSelectedRowIndexes, getSelectedRowsCount, getValue, getValue, getViewportRow, getViewportRow, goDown, goDown, goDownWithSelection, goUp, goUp, goUpWithSelection, hasFocusable, hasFocusable, hasRowMarkers, incrementalScroll, incrementalScroll, initQueryAssigned, insertEditingRow, insertRow, invokeRowLeaveTrigger, isConditionalReposition, isCurrentRowModified, isEditing, isEditorFillIn, isEditorModified, isEditorToggleBox, isEditPossible, isFirstBrowseRow, isFirstLastRowCopyQuirk, isFocusedRowSelected, isModified, isNewEditingRowOutOfTheView, isNewRow, isNewRow, isOnePageScrollingMode, isRightAligned, isRowInView, isRowSelected, isSavingRow, isSelectedRowAvailable, isSelectionMultiple, isViewportEdge, leaveRow, nextFocus, nextNewRowNumber, notifyColumnsUpdated, notifyKeyPressedInEditor, onKeyTyped, prevFocus, queryClosed, refresh, refreshAfterDeletion, refreshScrollRow, refreshScrollRow, refreshScrollRow, refreshScrollRow, refreshScrollRow, releaseCurrentRow, removeFromSelection, renderCell, requestFocus, resetColumnsCache, scrollToCurrentRow, scrollToRow, scrollToRow, scrollToRow, scrollToRow, scrollToRow, scrollToRow, scrollToRow, scrollToSelectedRow, selectAll, selectFocusedRow, selectNextRow, selectPreviousRow, selectRow, setColumnValue, setCurrentColumn, setCurrentRow, setCurrentRow, setEditorReadOnly, setEditorValue, setHighlighted, setReadOnly, setSelectionMultiple, show, startEdit, startEdit, stopEdit, switchCurrentRowSelection, switchToNextCell, undoValue, undoValue, updateMaxDataGuess, valid
minimumSize
add, add, add, addDirectly, belongsTo, checkWidget, childrenLocation, clipping, clipRectangle, currentFocus, cycleFocus, detach, dimension, endSizeChange, findMouseSource, firstFocus, focus, focusWorker, get, getClipRect, getEffectiveScrollableSize, getFocusInt, getIgnoreFocus, getLayout, getScrollableSize, getWidgetsList, height, insets, lastFocus, moveAfterTabItem, moveBeforeTabItem, moveToBottom, moveToBottomInClass, moveToTop, moveToTopInClass, moveToZpos, normalizeZOrder, prepareWidgets, processKeyEvent, remove, repaint, replace, setFocus, setFocusInt, setHeight, setIgnoreFocus, setInsets, setLayout, setSize, setWidth, startSizeChange, unrealize, updateSizeWorker, widgets, width
_setHidden, _setVisible, addFocusListener, addKeyListener, afterConfigUpdateBase, ancestor, ancestorId, autoResize, bounds, clear, clipRectangle, clipRectangle, clipWith, createMouseHoverAction, debug, disable, displayPhysicalLocation, enable, enclosingFrame, forceCursorOnFocus, forceVisibility, getActualBounds, getAndResetBitmap, getAndSetBitmap, getBitmapCopy, getCustomMousePointer, getDefaultEvent, getId, getLoadedMousePointer, getMenuMouse, getMouseActions, getPortableMouseEventCoordinates, getSelectedText, getState, getTextHeight, getTextHeightNative, getTextWidth, getTextWidthNative, getVisiblePart, getZOrderClass, hasFocus, hidden, hide, highlighted, ignoreAction, isDirectManipulationCapable, isDisplayed, isEnabled, isFocusable, isHeader, isRealized, isRMBEntrySupported, isTabStop, isThreeD, isTotallyObscured, isVisible, location, manageSystemActions, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, moveToBottom, moveToTop, name, navigable, parent, parent, parentOrSelf, physicalBounds, physicalDimension, physicalLocation, postprocessConfig, prepParentLocation, processFocusEvent, processKeyListeners, processMnemonic, processMnemonicImpl, processSystemKey, raiseLegacyMouseEvents, refresh, registerWidgetStateListener, repaint, requestSync, resetBitmap, resizeTo, resolveFont, resolveTitleFont, screen, screenDimension, screenHeight, screenLocation, screenPhysicalLocation, screenWidth, setBitmap, setHidden, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, setVisible, sync, topLevelWindow, toString, translate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addFocusListener, addKeyListener, ancestor, ancestorId, bounds, defaultMousePtr, displayPhysicalLocation, enclosingFrame, enforceDefaultMousePtr, forceCursorOnFocus, forceVisibility, getActualBounds, getCustomMousePointer, getId, getLoadedMousePointer, getMenuMouse, getMouseActions, getSelectedText, getState, getVisiblePart, getZOrderClass, hasFocus, hidden, hide, highlighted, isDirectManipulable, isDisplayed, isEnabled, isFocusable, isHeader, isRealized, isRMBEntrySupported, isTabStop, isThreeD, isTotallyObscured, isVisible, location, moveToBottom, moveToTop, name, navigable, parent, parent, parentOrSelf, physicalBounds, physicalDimension, physicalLocation, postprocessConfig, processFocusEvent, processKeyListeners, processMnemonic, raiseLegacyMouseEvents, repaint, requestSync, resizeTo, screen, screenLocation, screenPhysicalLocation, setHidden, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, setVisible, topLevelWindow
static final int CELL_OFFSET_TOP
static final int CELL_OFFSET_BOTTOM
public static final int BORDER_THICKNESS
static final int H_BAR_THUMB_WIDTH
static final int DATA_OFFSET_LEFT
static final int DATA_OFFSET_RIGHT
public static final int SORT_ARROW_WIDTH
public static final int SORT_ARROW_HEIGHT
public static final int SORT_NUMBER_WIDTH
public static final int SORT_NUMBER_HEIGHT
public static final int MIN_BROWSE_ROWS
static final int COLUMN_RESIZE_AREA_WIDTH
BrowseColumnGuiImpl
enum ResizeArea for more
information.static final int RESIZE_LINE_VERTICAL_OFFSET
private static final int ALLOWED_HIDDEN_CELL_BOTTOM_PART
private static final ColorRgb SEPARATOR_DEFAULT_COLOR
private static final ColorRgb SEPARATOR_DEFAULT_COLOR2
SEPARATOR_DEFAULT_COLOR
.private static final int DEFAULT_DYNAMIC_DOWN_SIZE
private static final int DEFAULT_DYNAMIC_WIDTH_CHARS
private static final java.lang.String SORT_ARROW_UP_IMAGE_NAME
private static final java.lang.String SORT_ARROW_DOWN_IMAGE_NAME
private static final java.lang.String SORT_NUMBER_IMAGE_NAME_TEMPLATE
private static final java.util.logging.Logger LOG
private static final int UP_KEY_BOTTOM_OFFSET_ROWS
max(1, DOWN - UP_KEY_BOTTOM_OFFSET_ROWS)
th row in the viewport
(1-based).private static final int SCROLL_ROWS_PER_WHEEL_ROTATION
private GuiDriver gd
private GuiFontResolver titleFontResolver
private GuiFontResolver browseFontResolver
private BrowseGuiImpl.ColumnSetContainer scrollableColumnSet
private BrowseGuiImpl.ColumnSetContainer lockedColumnSet
private ScrollPaneGuiImpl scrollPane
private GuiColorResolver colorResolver
private int titleHeight
private CoordinatesConversion cc
private ColorRgb separatorColor
private ColorRgb backgroundColor
private int effectiveRowHeight
effectiveRowHeight =
config.rowHeightPixels + CELL_OFFSET_TOP + CELL_OFFSET_BOTTOM
.private int labelsHeight
private BorderedPanelGuiImpl titlePanel
private int totalColumnsWidth
private int lockedColumnsWidth
private int hScrollingStep
private BrowseColumnGuiImpl markersColumn
private ScrollBarGuiImpl horizontalScrollbar
private ScrollBarGuiImpl verticalScrollbar
private int horizontalColumnScrollMax
private boolean mouseFocusGained
private ScrollBarControllerGuiImpl verticalScroller
private ScrollBarControllerGuiImpl horizontalScroller
private BrowseColumnGuiImpl draggedColumn
private BrowseColumnGuiImpl resizedColumn
private int leftDragColumnMouseOffset
private int leftDragColumnOffset
private int leftResizeColumnOffset
private int rightResizeColumnOffset
private ImageWrapper sortArrowUpImage
private ImageWrapper sortArrowDownImage
private ImageWrapper[] sortNumberImages
private boolean initialRepositionDone
true
if initial reposition was done (i.e. reposition on opening of the first
assigned query). Used in handling of the selection state of the first row on initial display
of a single-selection browse.public BrowseGuiImpl(WidgetId id, BrowseConfig cfg)
Call initialize(com.goldencode.p2j.ui.WidgetId, com.goldencode.p2j.ui.BrowseConfig)
to finish the widget initialization.
id
- The widget's ID.cfg
- Browse config,public void initialize(WidgetId id, BrowseConfig wcfg)
This API is called after the widget is created and added to the registry.
initialize
in interface WidgetWithConfig<BrowseConfig>
initialize
in class Browse<GuiOutputManager>
id
- The widget's ID.wcfg
- The config used to initialize this widget.public void setSize(double width, double height)
setSize
in interface Container<GuiOutputManager>
setSize
in class AbstractContainer<GuiOutputManager>
width
- New width.height
- New height.public void afterConfigUpdate(BrowseConfig 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<BrowseConfig>
beforeUpdate
- Config reference capturing the config state before
the owner's config was modified.public GuiCellAttributes getCellAttr(int viewportIndex, int columnIndex)
viewportIndex
- 0-based row index in the viewport.columnIndex
- 0-based column index.public GuiCellAttributes getCellAttrWithIntermediate(int viewportIndex, int columnIndex)
Browse.intermediateDcData
), if it is available, or normat cache (Browse.dcData
)
otherwise.viewportIndex
- 0-based row index in the viewport.columnIndex
- 0-based column index.public GuiCellAttributes getCellAttr(BrowseRow[] rowCache, int viewportIndex, int columnIndex)
rowCache
- Cache of rows: Browse.dcData
or Browse.intermediateDcData
.viewportIndex
- 0-based row index in the viewport.columnIndex
- 0-based column index.public void notifyColumnsUpdated()
notifyColumnsUpdated
in class Browse<GuiOutputManager>
public void setIntermediateRows(BrowseRow[] rows)
BrowseWidget.getRows(int, int, boolean, int, ScreenBuffer[], RowDisplayStrategy)
),
so these rows can be drawn if a pause occurs in ROW-DISPLAY trigger.setIntermediateRows
in class Browse<GuiOutputManager>
rows
- Rows to set.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 AbstractWidget<GuiOutputManager>
e
- The mouse event.public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
mouseDragged
in class AbstractWidget<GuiOutputManager>
e
- The mouse event.public void mouseWheelMoved(java.awt.event.MouseWheelEvent e)
mouseWheelMoved
in interface java.awt.event.MouseWheelListener
mouseWheelMoved
in class AbstractWidget<GuiOutputManager>
e
- The mouse event.public int getTitleHeight()
public void doLayout()
doLayout
in interface Container<GuiOutputManager>
doLayout
in class Browse<GuiOutputManager>
public int getRowHeight()
public int getLabelsHeight()
public int getLabelLinesNum()
public void drawCaret()
drawCaret
in interface Widget<GuiOutputManager>
drawCaret
in class Browse<GuiOutputManager>
public void draw()
draw
in interface Widget<GuiOutputManager>
draw
in class Browse<GuiOutputManager>
public void destroy()
destroy
in interface Widget<GuiOutputManager>
destroy
in class Browse<GuiOutputManager>
public void onFocusGained(FocusEvent event)
Browse
widget receives the focus.
When a help string is defined for the browse it will be displayed on the status line. This method also sets the selected attribute on.
onFocusGained
in interface FocusListener
onFocusGained
in class Browse<GuiOutputManager>
event
- Reference to the event.public void onFocusLost(FocusEvent event)
Browse
widget loses the focus.
This method clears the focused flag.
onFocusLost
in interface FocusListener
onFocusLost
in class Browse<GuiOutputManager>
event
- Reference to the event.public void processDirectManipulationEvent(DirectManipulationEvent event)
processDirectManipulationEvent
in interface Widget<GuiOutputManager>
processDirectManipulationEvent
in class AbstractWidget<GuiOutputManager>
event
- Event to process.public void setEnabled(boolean enabled)
setEnabled
in interface Widget<GuiOutputManager>
setEnabled
in class Browse<GuiOutputManager>
enabled
- Widget.setEnabled(boolean)
protected void activateDirectManipulation()
activateDirectManipulation
in class AbstractWidget<GuiOutputManager>
protected void deactivateDirectManipulation()
deactivateDirectManipulation
in class AbstractWidget<GuiOutputManager>
protected boolean isDirectManipulationRequired()
isDirectManipulationRequired
in class AbstractWidget<GuiOutputManager>
TRUE
if direct manipulation is need to be installed,
FALSE
if direct manipulation is need to be removed.public int getRowByCoordinates(int y)
y
- Vertical position (in native units in browse coordinates) that is supposed to be
within one of the viewport rows.-1
if position is higher than the first row or can be more
than the index of the last row if position is lower than the last row.public int fixupNoLabelsY(int y)
y
- Vertical position (in native units in browse coordinates) that is supposed to be
within one of the viewport rows.public ScrollPaneGuiImpl getScrollPane()
public int getTopYforRow(int rowNdx)
rowNdx
- 0-base row index to compute the Y coordinate.public ImageWrapper getSortArrowImage(boolean ascending)
ascending
- true
to return soring arrow for ascending sorting (arrow up).
false
to return soring arrow for descending sorting (arrow down).public ImageWrapper getSortNumImage(int num)
num
- Sort number, from 1
to 9
.public boolean supportsCustomMousePointer()
supportsCustomMousePointer
in interface Widget<GuiOutputManager>
supportsCustomMousePointer
in class AbstractWidget<GuiOutputManager>
true
if the widget supports
LOAD-MOUSE-POINTER() methodprotected int getLeftColumnContourLimit()
protected int getRightColumnContourLimit()
protected int[] mouseActions()
MouseEvent
codes and P2J specific
MouseEvt
actions.mouseActions
in class AbstractWidget<GuiOutputManager>
protected void handleTabKey()
handleTabKey
in class Browse<GuiOutputManager>
protected void scrollToEditableRow()
scrollToEditableRow
in class Browse<GuiOutputManager>
GuiFontResolver getBrowseFontResolver()
public GuiColorResolver getBrowseColorResolver()
public ColorRgb getSeparatorColor()
public int getTopRowOffset(int viewportIndex)
viewportIndex
- 0-based index of the row in the viewport.public boolean isDrawnAsFocused()
true
is if the browse should be drawn as a focused widget.boolean isLabelsVisible()
true
if the labels area is visible.boolean isPerformLayout()
true
if browse layout needs to be performed.public NativeDimension getViewportDimension()
void startColumnDrag(BrowseColumnGuiImpl column, int leftDragColumnMouseOffset)
column
- Column which is being dragged.leftDragColumnMouseOffset
- Offset from the left edge of the column which is being dragged to the position of the
pointer inside the column.void stopColumnDrag(java.awt.event.MouseEvent e)
void startColumnResize(int columnIndex)
columnIndex
- Index of the column which is being resized.void stopColumnResize()
boolean isColumnDrag()
true
if a column is being dragged.true
if a column is being dragged.boolean isColumnResize()
true
if a column is being resized.true
if a column is being resized.boolean isLastLockedColumnResizeArea(java.awt.event.MouseEvent e)
true
if the mouse pointer is positioned over the resize area after the
right edge of the last locked column.e
- Mouse event.true
if the mouse pointer is positioned over the resize area after the
right edge of the last locked column.int getLockedColumnsWidth()
protected void columnToView(int cellColumn)
columnToView
in class Browse<GuiOutputManager>
cellColumn
- The cell's column index in model.protected void scrollToColumn(int columnIndex)
columnIndex
- Column index in the model.protected void startEdit(boolean updateSelection, boolean useValue, BaseDataType value)
startEdit
in class Browse<GuiOutputManager>
updateSelection
- For multi-selection browse: if true
, current row becomes the only
selected row.useValue
- Use the specified value for the editor instead of getting it from the browse cache.value
- Value to use in the editor. Can be null
(valid value). Set
useValue
to true
if you want to use this parameter.protected Widget createEditor(boolean useValue, BaseDataType value)
createEditor
in class Browse<GuiOutputManager>
useValue
- Use the specified value for the editor instead of getting it from the browse cache.value
- Value to use in the editor. Can be null
(valid value). Set
useValue
to true
if you want to use this parameter.protected ToggleBox createEditingToggleBox(boolean useValue, BaseDataType value)
useValue
- Use the specified value for the editor instead of getting it from the browse cache.value
- Value to use in the editor. Can be null
(valid value). Set
useValue
to true
if you want to use this parameter.protected void initEditorConfig(BaseConfig cfg)
initEditorConfig
in class Browse<GuiOutputManager>
cfg
- Editor widget config.protected void addEditor(Widget editor)
addEditor
in class Browse<GuiOutputManager>
editor
- Editor widget.protected void cleanupEditor(Widget editor)
cleanupEditor
in class Browse<GuiOutputManager>
editor
- Editor widget.protected boolean isAggressiveCurrentRowSelection()
true
if the current row of the single-selection browse is selected on
FOCUS-GAINED and some other events.isAggressiveCurrentRowSelection
in class Browse<GuiOutputManager>
protected int getPageSize()
getPageSize
in class Browse<GuiOutputManager>
protected void updateLabelsHeight()
updateLabelsHeight
in class Browse<GuiOutputManager>
protected void notifyBrowseScrolled()
notifyBrowseScrolled
in class Browse<GuiOutputManager>
protected int getCurrentEditorY()
protected int getCurrentEditorX()
protected boolean isRefreshedOnEnable()
isRefreshedOnEnable
in class Browse<GuiOutputManager>
false
private void updateLabelsVisible()
Browse.drawLabels
attribute which defines if the labels area is
visible.private int calcTitleHeight()
private void createTitlePanel()
private void buildPanels()
private void rebuildColumns()
public int getTotalColumnsWidth()
public Widget getScrollableColumnSet()
private void adjustLockedColumnsPanel()
lockedColumnSet
panel according to
lockedColumnsWidth
.private boolean fitLastColumn()
true
if width of the last column was updated in order to fit it in the
view.private boolean needsColumnFit()
true
if last column should be fit according to FIT-LAST-COLUMN or
NO-EMPTY-SPACE option.private void updateBrowseDimensions()
private int calcImplicitBrowseHeightNoScrollbar()
public BrowseColumnGuiImpl getCurrentMarkersColumn()
null
.null
if not yet created.private void createMarkersColumn()
private int calcDown()
public int calcDown(int rowHeightPixels)
calcDown
in class Browse<GuiOutputManager>
rowHeightPixels
- Row height in pixels.private Point getScrollPaneLocation()
private Point getLockedPaneLocation()
private NativeDimension getScrollPaneDimension()
private int calcRowHeight()
public boolean hasTitle()
true
if this browse has title.private void resolveColors()
private void resolveFonts()
private BrowseColumnGuiImpl getColumn(int index)
index
- 0-based column index (markers column in not taken in consideration).private int getScrollbarThickness(ScrollBar.Orientation orientation)
orientation
- Target scroll bar.public java.lang.String getCellTextWithIntermediate(BrowseColumnGuiImpl column, int viewportIndex)
Browse.intermediateDcData
), if it is available, or normal cache (Browse.dcData
)column
- The column the target cell belongs to.viewportIndex
- 0-based index of the target row in the viewport the target cell belongs to.public BaseDataType getCellValueWithIntermediate(BrowseColumnGuiImpl column, int viewportIndex)
Browse.intermediateDcData
), if it is available, or normal cache (Browse.dcData
)column
- The column the target cell belongs to.viewportIndex
- 0-based index of the target row in the viewport the target cell belongs to.public BaseDataType getCellValue(int viewportIndex, int colIndex)
viewportIndex
- 0-based index of the target row in the viewport the target cell belongs to.colIndex
- 0-based index of the column the target cell belongs to.public boolean isCurrentEditingColumn(BrowseColumnGuiImpl column)
true
if the given column is the current column and editing is in
progress.column
- Column to check.public java.lang.String getCellText(int viewportIndex, int colIndex)
viewportIndex
- 0-based index of the target row in the viewport the target cell belongs to.colIndex
- 0-based index of the column the target cell belongs to.public boolean isCurrentRowInView()
true
if the current row is the view.void rowClicked(int viewportRowIndex, int columnIndex, java.awt.event.MouseEvent e)
viewportRowIndex
- 0-based viewport index of the clicked row.columnIndex
- 0-based index of the clicked column.e
- Original mouse event.void resetPressedColumns(boolean trigger)
trigger
- If true
and a column was in pressed state, raise END-SEARCH event.private boolean isShiftModifier(java.awt.event.MouseEvent e)
true
if SHIFT key was held down when a mouse button was pressed.e
- Mouse event.true
if SHIFT key was held down when a mouse button was pressed.private boolean isCtrlModifier(java.awt.event.MouseEvent e)
true
if CTRL key was held down when a mouse button was pressed.e
- Mouse event.true
if CTRL key was held down when a mouse button was pressed.private void setColumnScrolling(boolean columnScrolling)
columnScrolling
- true
for COLUMN-SCROLLING mode, false
for
non-COLUMN-SCROLLING mode,private void showHorizontalScrollbar(boolean show)
show
- true
to show, false
to hide.private void updateVerticalScrollbarVisibility()
private ScrollPaneGuiImpl.ShowBars getShowBars(boolean horizontal, boolean vertical)
ScrollPaneGuiImpl.ShowBars
option which corresponds given visibility of the
scroll bars.horizontal
- true
if horizontal scroll bar is visible.vertical
- true
if vertical scroll bar is visible.ScrollPaneGuiImpl.ShowBars
option which corresponds given visibility of
the scroll bars.private void setCurrentSingleRowSelected()
private void searchByKey(char searchChar)
BrowseWidget.getRows(char, int, int, int, int, ScreenBuffer[])
for more
information.searchChar
- Character to be searched for.private int getSearchColumn()
false
, then it is the first column. If
ALLOW-COLUMN-SEARCHING is true
then it is the pressed column.-1
if there is no column to
search.public Window window()
window
in interface Widget<GuiOutputManager>
window
in class AbstractWidget<GuiOutputManager>
null
if the widget is not yet attached to a Window.public BaseDataType getColumnValue(int ordinal)
getColumnValue
in class Browse<GuiOutputManager>
ordinal
- The column ordinal.public void onKeyPressed(KeyInput event)
onKeyPressed
in interface KeyListener
onKeyPressed
in class Browse<GuiOutputManager>
event
- Reference to keyboard event.public void processEvent(Event evt)
processEvent
in interface Widget<GuiOutputManager>
processEvent
in class Browse<GuiOutputManager>
evt
- Event to process.Widget.processEvent(Event)
public void queryRepositioned(boolean repositionError, int targetRepositionRow)
queryRepositioned
in class Browse<GuiOutputManager>
repositionError
- For reposition mode - if an error has happened during reposition.targetRepositionRow
- For reposition mode - row used as the target for reposition. If it was deleted,
reposition with fetching may end up on a different row.public void setMousePointerName(java.lang.String name)
setMousePointerName
in interface Hoverable
name
- the attribute valuepublic java.lang.String getMousePointerImpl()
getMousePointerImpl
in interface Hoverable
public MousePtrWrapper getEffectiveMousePointer()
getEffectiveMousePointer
in interface Widget<GuiOutputManager>
getEffectiveMousePointer
in class AbstractWidget<GuiOutputManager>
public void moveColumn(int srcIndex, int destIndex)
Repositions a column in a browse widget.
moveColumn
in class Browse<GuiOutputManager>
srcIndex
- 0-based position of the column to be moved.destIndex
- 0-based position to which the column is moved.private void moveColumnInArray(java.lang.Object[] array, int srcIndex, int destIndex)
array
- Target array.srcIndex
- 0-based position of the element to be moved.destIndex
- 0-based position to which the element is moved.private int getColumnOffset(int columnIndex)
columnIndex
- 0-based index of the column in the set of columns.private void updateColumnSetsHeight()
private void updateEditorAfterColumnModification()
private void updateHorizontalColumnScrollMax()
horizontalColumnScrollMax
.private int getEffectiveMinColumnWidth()