Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public class DataGrid
- Object
- Component
- ScrollSurface
- DataGrid
ImplementsAnimation, Editable, StyleListener
A grid of data for large sets: a TableModel or a tree of rows, with
sorting, filtering, grouping, frozen columns, resizable and movable
columns, selection, keyboard navigation and editing in place.
The grid paints its cells itself, like the com.codename1.ui.scheduler
views. There is no component per cell or per row: only the rows on screen
are painted, sorting and filtering move row numbers in an array and never
the data, and opening a node of a tree costs what it shows. A million rows
scroll as one hundred do. Table, which lays out a component per cell,
is the class for a small form laid out as a table.
TableModel model = new DefaultTableModel(new String[]{"Name", "Team", "Score"}, new Object[][]{
{"dana", "red", 7}, {"Ann", "blue", 3}, {"carl", "red", 9}}, true);
Form form = new Form("Scores", new BorderLayout());
DataGrid grid = new DataGrid(model);
grid.getColumn(0).setFlex(1);
grid.getColumn(2).setKind(GridColumn.Kind.NUMBER).setAggregate(GridAggregate.SUM);
grid.setFrozenColumns(1);
grid.sortBy(grid.getColumn(2), false);
form.add(BorderLayout.CENTER, grid);
form.show();Rows
A row number of the grid is a view row: an index into what is shown
after filtering, sorting, grouping and the opening of nodes. It is not a
row of the model; getModelRow(int) and getNode(int) translate it.
Trees
Built over a TreeTableModel, the grid is a tree table: the tree column
(setTreeColumn, the first visible one by default) shows each node
indented under its parent with an arrow that opens it. Children are asked
of the model when a node is first opened. Sorting orders siblings.
Editing
A cell is edited when its column and its model both allow it. A boolean
toggles with a tap. Any other value is edited by its column’s
GridCellEditor, which supplies a component the grid lays over the cell
while it is edited and removes afterwards: a text field, or a picker for
a date or a choice.
Styles
DataGrid (the background), DataGridHeader, DataGridRow and its
selected state, DataGridRowAlt (every other row), DataGridGroupRow,
DataGridLine (the foreground is the colour of the grid lines),
DataGridCheck and DataGridEditor. Only colours, fonts and paddings are
read; nothing has a border.
Nested types
enum DataGrid.SelectionMode | What a tap selects. |
Constructors
public DataGrid() | A grid with no data. |
public DataGrid(TableModel model) | A grid over the rows of a table model, with a column for each of its columns. |
public DataGrid(TreeTableModel model) | A tree grid over a tree table model, with a column for each of its columns. |
Methods
public final void setModel(TableModel model) | Shows the rows of a table model, with a column for each of its columns. |
public final void setModel(TreeTableModel model) | Shows the nodes of a tree table model, with a column for each of its columns. |
public TableModel getTableModel() | The table model shown, or null for a tree grid. |
public TreeTableModel getTreeModel() | The tree model shown, or null for a flat grid. |
public boolean isTree() | Whether this is a tree grid. |
protected void initComponent() | Allows subclasses to bind functionality that relies on fully initialized and “ready for action” component state |
protected void deinitialize() | Invoked to indicate that the component initialization is being reversed since the component was detached from the container hierarchy. |
public void refresh() | Reads the model again: filters, sorts and groups its rows anew and keeps the selection on the same rows where they are still shown. |
public void refreshNode(Object node) | Asks the tree model again for the children of one node, and shows them. |
public List<GridColumn> getColumns() | The columns, in the order they are shown, hidden ones included. |
public int getColumnCount() | How many columns there are, hidden ones included. |
public GridColumn getColumn(int index) | The column at a place in the order, hidden ones counted. |
public GridColumn getColumnForModel(int modelColumn) | The column showing a column of the model, or null. |
public void setColumns(GridColumn... cols) | Replaces the columns. |
public void addColumn(GridColumn c) | Adds a column at the end. |
public void removeColumn(GridColumn c) | Removes a column. |
public void moveColumn(int from, int to) | Moves the column at from in the order to to, hidden ones counted. |
public void refreshColumns() | Asks the grid to lay its columns out again, after a column’s width, title or visibility changed. |
public int getFrozenColumns() | How many of the first visible columns stay in place while the rest scroll sideways. |
public void setFrozenColumns(int count) | Sets how many of the first visible columns stay in place while the rest scroll sideways; 0 by default. |
public GridColumn getTreeColumn() | The column a tree grid draws the tree in, or null for the first visible one. |
public void setTreeColumn(GridColumn c) | Sets the column a tree grid draws the tree in; null, the default, is the first visible one. |
public void sortBy(GridColumn c, boolean ascending) | Sorts by one column alone. |
public void addSort(GridColumn c, boolean ascending) | Adds a column to sort by after the ones already sorted by, or changes its direction when it is one of them. |
public void clearSort() | Stops sorting: rows are shown in the model’s order. |
public List<GridColumn> getSortColumns() | The columns sorted by, most significant first. |
public int getSortDirection(GridColumn c) | 1 when sorted by c ascending, -1 descending, 0 when not sorted by it. |
public GridFilter getFilter() | The filter of the rows, or null. |
public void setFilter(GridFilter filter) | Shows only the rows a filter accepts; null shows them all. |
public GridColumn getGroupColumn() | The column the rows are grouped by, or null. |
public void setGroupColumn(GridColumn c) | Groups the rows by the values of a column, each group under a row of its own that opens and closes it; null stops grouping. |
public int getRowCount() | How many rows are shown, group rows included. |
public Object getValueAt(int row, GridColumn c) | The value a view row shows in a column. |
public void setValueAt(int row, GridColumn c, Object value) | Sets the value of a view row in a column, through the model. |
public int getModelRow(int row) | The model row a view row shows, or -1 for a group row or in a tree grid. |
public int getViewRow(int modelRow) | The view row showing a model row, or -1 when it is filtered out or in a closed group. |
public Object getNode(int row) | The node a view row of a tree grid shows, or null. |
public int getRowOfNode(Object node) | The view row showing a node, or -1 when it is not shown. |
public boolean isGroupRow(int row) | Whether a view row is a group row. |
public int getDepth(int row) | How deep a view row is in the tree: 0 for a root. |
public boolean isExpandable(int row) | Whether a view row can be opened: a node that is not a leaf, or a group. |
public boolean isExpanded(int row) | Whether a view row is open. |
public void setExpanded(int row, boolean open) | Opens or closes a view row: a node of a tree, or a group. |
public void setNodeExpanded(Object node, boolean open) | Opens or closes a node of a tree grid, whether it is shown or not; a node that is not shown opens the next time it is. |
public boolean isNodeExpanded(Object node) | Whether a node of a tree grid is open. |
public void expandAll() | Opens every row. |
public void collapseAll() | Closes every row. |
public DataGrid.SelectionMode getSelectionMode() | What a tap selects. |
public void setSelectionMode(DataGrid.SelectionMode mode) | Sets what a tap selects; MULTIPLE_ROWS by default. |
public int getSelectedRow() | The row the keyboard is on, the last one chosen, or -1. |
public int getSelectedColumn() | The visible column index of the cell the keyboard is on. |
public int[] getSelectedRows() | The selected view rows, in order. |
public int getSelectedRowCount() | How many rows are selected. |
public boolean isRowSelected(int row) | Whether a view row is selected. |
public void setSelectedRow(int row) | Selects one view row and moves the keyboard to it; -1 clears the selection. |
public void selectRows(int from, int to, boolean add) | Selects a range of view rows, adding to the selection when add. |
public void selectAll() | Selects every row. |
public void clearSelection() | Selects nothing. |
public void addSelectionListener(SelectionListener l) | Listens to changes of the selection. |
public void removeSelectionListener(SelectionListener l) | Stops listening to changes of the selection. |
public void addActionListener(ActionListener l) | Listens to rows being opened: a double tap, or Enter on a cell that is not edited. |
public void removeActionListener(ActionListener l) | Stops listening to rows being opened. |
public float getRowHeightMM() | The height of a row in millimetres, 0 for the height of the font. |
public void setRowHeightMM(float mm) | Sets the height of a row in millimetres; 0, the default, fits the row style’s font and padding. |
public int getRowHeight() | The height of a row, in pixels, as last laid out. |
public boolean isHeaderVisible() | Whether the header row is shown. |
public void setHeaderVisible(boolean v) | Shows or hides the header row. |
public boolean isStriped() | Whether every other row is painted in DataGridRowAlt. |
public void setStriped(boolean striped) | Sets whether every other row is painted in DataGridRowAlt. |
public void setGridLines(boolean horizontal, boolean vertical) | Sets which grid lines are drawn. |
public String getEmptyText() | The text shown when there are no rows. |
public void setEmptyText(String text) | Sets the text shown when there are no rows; empty by default. |
public GridCellRenderer getDefaultRenderer() | The renderer of a column that has none. |
public void setDefaultRenderer(GridCellRenderer r) | Sets the renderer of a column that has none. |
public GridCellEditor getDefaultEditor() | The editor of a column that has none. |
public void setDefaultEditor(GridCellEditor e) | Sets the editor of a column that has none. |
protected void layoutSurface(int width, int height) | Lays the surface out for a size: sets the header sizes and whatever the content’s size depends on. |
protected int getContentWidth() | The width of what scrolls, in pixels, without the left header. |
protected int getContentHeight() | The height of what scrolls, in pixels, without the top header. |
protected Dimension calcPreferredSize() | Calculates the preferred size based on component content. |
protected int getPageStep(int bodyHeight) | How far down a page of content height bodyHeight goes before the next one starts. |
protected void paintContent(Graphics g, int x, int y) | Paints what scrolls. |
protected void paintLeftHeader(Graphics g, int x, int y) | Paints the pinned left column. |
protected void paintTopHeader(Graphics g, int x, int y) | Paints the pinned top row. |
protected void paintCorner(Graphics g, int x, int y) | Paints the corner where the two headers meet, at its top left. |
protected void paintOverlay(Graphics g, int x, int y) | Paints over everything, in the component’s own bounds, whose top left is x, y. |
public void getCellBounds(int row, int column, int[] out) | The bounds of a cell in the grid’s own coordinates: x, y, width, height. |
public GridColumn[] getVisibleColumns() | The columns shown, in order: the ones getSelectedColumn() and getCellBounds count. |
public void scrollToCell(int row, int column) | Scrolls so a view row is shown, and a visible column too when it is 0 or more. |
protected void pressStarted(int x, int y) | The pointer went down at a point, in the component’s coordinates. |
protected void tapped(int x, int y, boolean doubleTap) | A tap that was not a drag or a long press. |
protected boolean editStarted(int x, int y, ScrollSurface.EditTrigger trigger) | Asked when a drag or a long press begins, at the point where the pointer went down, in the component’s coordinates. |
protected void editMoved(int x, int y) | The pointer of an edit moved, or the surface scrolled under it. |
protected void editEnded(boolean committed) | The edit is over. |
protected boolean isEditAutoScroll(int x, int y) | Whether the surface scrolls under an edit dragged near its edge. |
protected void hoverAt(int x, int y) | The pointer rests at a point of the surface without being pressed. |
protected void scrollChanged() | The scroll position changed. |
public boolean handlesInput() | Prevents key events from being grabbed for focus traversal. |
public void keyPressed(int keyCode) | If this Component is focused, the key pressed event will call this method |
public boolean isEditing() | Whether a cell is being edited. |
public int getEditingRow() | The view row being edited, or -1. |
public GridColumn getEditingColumn() | The column being edited, or null. |
public boolean editCellAt(int row, int column) | Edits a cell, when it may be edited. |
public void commitEdit() | Ends the edit, writing the editor’s value to the model. |
public final void cancelEdit() | Ends the edit without changing the model, and any drag in progress. |
Inherited nested types
Inherited fields
From Component
DEFAULT_CURSOR, CROSSHAIR_CURSOR, TEXT_CURSOR, WAIT_CURSOR, SW_RESIZE_CURSOR, SE_RESIZE_CURSOR, NW_RESIZE_CURSOR, NE_RESIZE_CURSOR, N_RESIZE_CURSOR, S_RESIZE_CURSOR, W_RESIZE_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, MOVE_CURSOR, DRAG_REGION_NOT_DRAGGABLE, DRAG_REGION_POSSIBLE_DRAG_X, DRAG_REGION_POSSIBLE_DRAG_Y, DRAG_REGION_POSSIBLE_DRAG_XY, DRAG_REGION_LIKELY_DRAG_X, DRAG_REGION_LIKELY_DRAG_Y, DRAG_REGION_LIKELY_DRAG_XY, DRAG_REGION_IMMEDIATELY_DRAG_X, DRAG_REGION_IMMEDIATELY_DRAG_Y, DRAG_REGION_IMMEDIATELY_DRAG_XY, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_CENTER_OFFSET, BRB_OTHER, CENTER, TOP, LEFT, BOTTOM, RIGHT, BASELINE
Inherited methods
From ScrollSurface
setHeaderSize, getHeaderWidth, getHeaderHeight, longPressed, zoomBy, setDragEdits, isDragEdits, isEditInProgress, isBounded, setBounded, getBodyWidth, getBodyHeight, getMaxOffsetX, getMaxOffsetY, getOffsetX, getOffsetY, scrollTo, setOffsets, refreshLayout, stopFling, currentTime, setAnimationTime, hoverGone, setHoverTarget, setHoverTooltip, getFadingHoverTarget, getHoverTarget, hasHoverFeedback, getHoverLevel, getLiftLevel, startSettle, applySettle, pointerHover, setHovered, requestAnimation, animateSurface, animate, paint, getPageGrid, paintPage, isPrinting, saveZoomState, restoreZoomState, pointerPressed, pointerDragged, longPointerPress, pointerReleased, mouseWheel, pinch, pinchReleased, shouldBlockSideSwipe
From Component
setSameSize, isSetCursorSupported, parsePreferredSize, getDefaultDragTransparency, setDefaultDragTransparency, getEditingDelegate, setEditingDelegate, getCursor, setCursor, showNativeOverlay, hideNativeOverlay, updateNativeOverlay, getNativeOverlay, getAllStyles, getSameWidth, setSameWidth, getSameHeight, setSameHeight, initLaf, getUIManager, getX, setX, getOuterX, getInnerX, getY, setY, getOuterY, getInnerY, isVisible, setVisible, getClientProperty, stripMarginAndPadding, clearClientProperties, putClientProperty, getDirtyRegion, setDirtyRegion, isOpaque, setOpaque, getWidth, setWidth, getOuterWidth, getInnerWidth, getHeight, setHeight, getOuterHeight, getInnerHeight, isDragRegion, getDragRegionStatus, getBaseline, getBaselineResizeBehavior, getPreferredSizeStr, setPreferredSizeStr, getPreferredSize, setPreferredSize, getScrollDimension, calcScrollSize, setScrollSize, getPreferredW, setPreferredW, getPreferredH, setPreferredH, getOuterPreferredH, getInnerPreferredH, getOuterPreferredW, getInnerPreferredW, setSize, getUIID, setUIID, setUIIDFinal, setUIID, getInlineAllStyles, setInlineAllStyles, getInlineSelectedStyles, setInlineSelectedStyles, getInlineUnselectedStyles, setInlineUnselectedStyles, getInlineDisabledStyles, setInlineDisabledStyles, getInlinePressedStyles, setInlinePressedStyles, remove, getParent, getOwner, setOwner, isOwnedBy, containsOrOwns, addFocusListener, removeFocusListener, addScrollListener, removeScrollListener, fireClicked, isSelectableInteraction, getSelectCommandText, setSelectCommandText, getLabelForComponent, setLabelForComponent, focusGained, focusLost, paintBackgrounds, paintShadows, getAbsoluteX, getAbsoluteY, isInClippingRegion, paintIntersectingComponentsAbove, paintScrollbars, paintScrollbarX, getScrollOpacity, getSelectedRect, paintScrollbarY, paintComponent, paintComponent, getBorder, getScrollable, paintBackground, isScrollable, isScrollableX, isScrollableY, getScrollX, setScrollX, getScrollY, setScrollY, onScrollX, onScrollY, getDraggedx, getDraggedy, getBottomGap, getSideGap, contains, visibleBoundsContains, hasFixedPreferredSize, getBounds, getBounds, getVisibleBounds, getVisibleBounds, isFocusable, setFocusable, onSetFocusable, resetFocusable, getTabIndex, setTabIndex, getPreferredTabIndex, setPreferredTabIndex, isTraversable, setTraversable, setShouldCalcPreferredSize, setHandlesInput, consumesRawTextInput, hasFocus, setFocus, getComponentForm, getTopLevelContainer, repaint, repaint, longKeyPress, keyReleased, keyRepeated, registerForAnimation, deregisterFromAnimation, getAnimationManager, getScrollAnimationSpeed, setScrollAnimationSpeed, isBlockLead, setBlockLead, isIgnorePointerEvents, setIgnorePointerEvents, isRippleEffect, setRippleEffect, getInlineStylesTheme, setInlineStylesTheme, shouldRenderComponentSelection, isHideInLandscape, setHideInLandscape, createStyleAnimation, isSmoothScrolling, setSmoothScrolling, stopScrollMomentum, pointerHoverReleased, pointerHoverPressed, pinch, rotation, isPinchBlocksDragAndDrop, setPinchBlocksDragAndDrop, pointerDragged, getDragImage, getDragTransparency, setDragTransparency, toImage, dragInitiated, drawDraggedImage, draggingOver, dragEnter, dragExit, drop, addPullToRefresh, setPullToRefresh, respondsToPointerEvents, isStickyDrag, pointerPressed, isDragAndDropOperation, pointerReleased, setVerticalScrollBounds, setHorizontalScrollBounds, isVScrollThumbGrabbed, isHScrollThumbGrabbed, isVScrollThumbHover, isHScrollThumbHover, isTensileDragEnabled, setTensileDragEnabled, getTextSelectionSupport, addDropListener, removeDropListener, addDragOverListener, removeDragOverListener, isNativeDragSource, setNativeDragSource, getNativeDragOperation, setNativeDragOperation, createNativeDragOperation, isNativeDropTarget, setNativeDropTarget, getAcceptedDropMimeTypes, setAcceptedDropMimeTypes, getAcceptedDropActions, setAcceptedDropActions, canAcceptNativeDrop, nativeDragEnter, nativeDragOver, nativeDragExit, nativeDrop, addNativeDropListener, removeNativeDropListener, addNativeDragOverListener, removeNativeDragOverListener, dragFinished, addDragFinishedListener, addStateChangeListener, removeStateChangeListener, addPointerPressedListener, addLongPressListener, addContextMenuListener, removeContextMenuListener, addMouseWheelListener, removeMouseWheelListener, addStylusListener, removeStylusListener, getContextMenuCommands, setContextMenuCommands, paintRippleOverlay, removePointerPressedListener, removeLongPressListener, removeDragFinishedListener, addPointerReleasedListener, removePointerReleasedListener, addPointerDraggedListener, removePointerDraggedListener, getDragSpeed, getStyle, getPressedStyle, getHoverStyle, setHoverStyle, isHovered, setPressedStyle, initUnselectedStyle, initPressedStyle, initDisabledStyle, initSelectedStyle, getUnselectedStyle, setUnselectedStyle, getSelectedStyle, setSelectedStyle, getDisabledStyle, setDisabledStyle, installDefaultPainter, requestFocus, toString, paramString, refreshTheme, refreshTheme, refreshTheme, isDragActivated, getGridPosY, getGridPosX, scrollRectToVisible, scrollRectToVisible, paintBorder, paintBorderBackground, isCellRenderer, setCellRenderer, isScrollVisible, setScrollVisible, setIsScrollVisible, startEditingAsync, stopEditing, isEditable, laidOut, isInitialized, setInitialized, styleChanged, getNextFocusDown, setNextFocusDown, getNextFocusUp, setNextFocusUp, getNextFocusLeft, setNextFocusLeft, getNextFocusRight, setNextFocusRight, isEnabled, setEnabled, getName, setName, initCustomStyle, deinitializeCustomStyle, isRTL, setRTL, isTactileTouch, isTactileTouch, setTactileTouch, getPropertyNames, getPropertyTypes, getPropertyTypeNames, getPropertyValue, setPropertyValue, paintLockRelease, paintLock, isSnapToGrid, setSnapToGrid, shouldBlockSideSwipeLeft, shouldBlockSideSwipeRight, blocksSideSwipe, isFlatten, setFlatten, getTensileLength, setTensileLength, isGrabsPointerEvents, setGrabsPointerEvents, getScrollOpacityChangeSpeed, setScrollOpacityChangeSpeed, growShrink, isAlwaysTensile, setAlwaysTensile, isDraggable, setDraggable, isDropTarget, setDropTarget, isChildOf, isHideInPortrait, setHideInPortrait, cancelRepaints, getBindablePropertyNames, getBindablePropertyTypes, bindProperty, unbindProperty, getBoundPropertyValue, setBoundPropertyValue, getCloudBoundProperty, setCloudBoundProperty, getCloudDestinationProperty, setCloudDestinationProperty, getComponentState, setComponentState, setHidden, isHidden, setHidden, isHidden, announceForAccessibility, getAccessibilityText, setAccessibilityText, getSemantics, getAccessibilityNode, accessibilityChanged, accessibilityChanged, getTooltip, setTooltip
Constructor details
DataGrid
public DataGrid()DataGrid
public DataGrid(TableModel model)DataGrid
public DataGrid(TreeTableModel model)Method details
setModel
public final void setModel(TableModel model)setModel
public final void setModel(TreeTableModel model)getTableModel
public TableModel getTableModel()getTreeModel
public TreeTableModel getTreeModel()isTree
public boolean isTree()initComponent
protected void initComponent()deinitialize
protected void deinitialize()refresh
public void refresh()refreshNode
public void refreshNode(Object node)refresh() reads
the whole tree again.getColumns
public List<GridColumn> getColumns()getColumnCount
public int getColumnCount()getColumn
public GridColumn getColumn(int index)getColumnForModel
public GridColumn getColumnForModel(int modelColumn)setColumns
public void setColumns(GridColumn... cols)GridColumn is not
shown, and one may be shown twice.addColumn
public void addColumn(GridColumn c)removeColumn
public void removeColumn(GridColumn c)moveColumn
public void moveColumn(int from, int to)from in the order to to, hidden ones counted.refreshColumns
public void refreshColumns()getFrozenColumns
public int getFrozenColumns()setFrozenColumns
public void setFrozenColumns(int count)getTreeColumn
public GridColumn getTreeColumn()setTreeColumn
public void setTreeColumn(GridColumn c)sortBy
public void sortBy(GridColumn c, boolean ascending)addSort
public void addSort(GridColumn c, boolean ascending)clearSort
public void clearSort()getSortColumns
public List<GridColumn> getSortColumns()getSortDirection
public int getSortDirection(GridColumn c)c ascending, -1 descending, 0 when not sorted by it.getFilter
public GridFilter getFilter()setFilter
public void setFilter(GridFilter filter)getGroupColumn
public GridColumn getGroupColumn()setGroupColumn
public void setGroupColumn(GridColumn c)Groups the rows by the values of a column, each group under a row of its own that opens and closes it; null stops grouping. A tree grid is never grouped.
Groups are ordered by their value, in the column’s sort direction
when it is sorted by, and the group rows show the column’s
GridAggregates.
getRowCount
public int getRowCount()getValueAt
public Object getValueAt(int row, GridColumn c)setValueAt
public void setValueAt(int row, GridColumn c, Object value)getModelRow
public int getModelRow(int row)getViewRow
public int getViewRow(int modelRow)getNode
public Object getNode(int row)getRowOfNode
public int getRowOfNode(Object node)isGroupRow
public boolean isGroupRow(int row)getDepth
public int getDepth(int row)isExpandable
public boolean isExpandable(int row)isExpanded
public boolean isExpanded(int row)setExpanded
public void setExpanded(int row, boolean open)setNodeExpanded
public void setNodeExpanded(Object node, boolean open)isNodeExpanded
public boolean isNodeExpanded(Object node)expandAll
public void expandAll()collapseAll
public void collapseAll()getSelectionMode
public DataGrid.SelectionMode getSelectionMode()setSelectionMode
public void setSelectionMode(DataGrid.SelectionMode mode)MULTIPLE_ROWS by default.getSelectedRow
public int getSelectedRow()getSelectedColumn
public int getSelectedColumn()getSelectedRows
public int[] getSelectedRows()getSelectedRowCount
public int getSelectedRowCount()isRowSelected
public boolean isRowSelected(int row)setSelectedRow
public void setSelectedRow(int row)selectRows
public void selectRows(int from, int to, boolean add)add.selectAll
public void selectAll()clearSelection
public void clearSelection()addSelectionListener
public void addSelectionListener(SelectionListener l)removeSelectionListener
public void removeSelectionListener(SelectionListener l)addActionListener
public void addActionListener(ActionListener l)removeActionListener
public void removeActionListener(ActionListener l)getRowHeightMM
public float getRowHeightMM()setRowHeightMM
public void setRowHeightMM(float mm)getRowHeight
public int getRowHeight()isHeaderVisible
public boolean isHeaderVisible()setHeaderVisible
public void setHeaderVisible(boolean v)isStriped
public boolean isStriped()DataGridRowAlt.setStriped
public void setStriped(boolean striped)DataGridRowAlt.setGridLines
public void setGridLines(boolean horizontal, boolean vertical)getEmptyText
public String getEmptyText()setEmptyText
public void setEmptyText(String text)getDefaultRenderer
public GridCellRenderer getDefaultRenderer()setDefaultRenderer
public void setDefaultRenderer(GridCellRenderer r)getDefaultEditor
public GridCellEditor getDefaultEditor()setDefaultEditor
public void setDefaultEditor(GridCellEditor e)layoutSurface
protected void layoutSurface(int width, int height)getContentWidth
protected int getContentWidth()getContentHeight
protected int getContentHeight()calcPreferredSize
protected Dimension calcPreferredSize()Returns
getPageStep
protected int getPageStep(int bodyHeight)bodyHeight goes before the
next one starts. A view of rows answers a whole number of them, so no
page ends in the middle of one.paintContent
protected void paintContent(Graphics g, int x, int y)x and y are where the content’s own origin is
on screen, which is off screen once it has scrolled. The graphics is
clipped to the content region.paintLeftHeader
protected void paintLeftHeader(Graphics g, int x, int y)x is its left; y is where the
content’s origin is.paintTopHeader
protected void paintTopHeader(Graphics g, int x, int y)x is where the content’s origin is; y
is the top of the row.paintCorner
protected void paintCorner(Graphics g, int x, int y)paintOverlay
protected void paintOverlay(Graphics g, int x, int y)x, y. Not painted on a printed page: it is for what a gesture in
progress shows.getCellBounds
public void getCellBounds(int row, int column, int[] out)column is an index among the visible columns.getVisibleColumns
public GridColumn[] getVisibleColumns()getSelectedColumn() and
getCellBounds count.scrollToCell
public void scrollToCell(int row, int column)pressStarted
protected void pressStarted(int x, int y)tapped
protected void tapped(int x, int y, boolean doubleTap)editStarted
protected boolean editStarted(int x, int y, ScrollSurface.EditTrigger trigger)Parameters
xint- Not documented.
yint- Not documented.
triggerScrollSurface.EditTrigger- what kind of gesture it is
Returns
editMoved
protected void editMoved(int x, int y)editEnded
protected void editEnded(boolean committed)committed is false when it was cancelled: by
cancelEdit, a second finger, or the surface leaving the form.isEditAutoScroll
protected boolean isEditAutoScroll(int x, int y)hoverAt
protected void hoverAt(int x, int y)setHoverTarget, naming what is there and the
cursor that says what a press would do.scrollChanged
protected void scrollChanged()handlesInput
public boolean handlesInput()Returns
keyPressed
public void keyPressed(int keyCode)Parameters
keyCodeint- the key code value to indicate a physical key.
isEditing
public boolean isEditing()Returns
getEditingRow
public int getEditingRow()getEditingColumn
public GridColumn getEditingColumn()editCellAt
public boolean editCellAt(int row, int column)column is an index among the
visible columns. A boolean is toggled at once; anything else gets its
column’s editor over the cell.Returns
commitEdit
public void commitEdit()cancelEdit
public final void cancelEdit()