public class ColumnHeader<M> extends Component
Modifier and Type | Class and Description |
---|---|
static interface |
ColumnHeader.ColumnHeaderAppearance |
static interface |
ColumnHeader.ColumnHeaderStyles |
class |
ColumnHeader.GridSplitBar |
class |
ColumnHeader.Group |
class |
ColumnHeader.Head |
static interface |
ColumnHeader.HeaderContextMenuFactory
Delegate for external code to define what menu any given column should use
|
class |
ColumnHeader.HiddenHeaderGroupConfig |
protected class |
ColumnHeader.ReorderDragHandler |
Modifier and Type | Field and Description |
---|---|
protected ColumnHeader.GridSplitBar |
bar |
protected ColumnModel<M> |
cm |
protected int[] |
columnToHead
Maps actual column indexes to the TABLE TH and TD index.
|
protected Grid<M> |
container |
protected boolean |
disableSortIcon |
protected List<ColumnHeader.Group> |
groups |
protected boolean |
headerDisabled |
protected List<ColumnHeader.Head> |
heads
The list off all Head instances.
|
protected ColumnHeader.HeaderContextMenuFactory |
menu |
protected int |
minColumnWidth |
protected int |
overrideHeaderHeight
The height of the header is based on the content height in each header.
|
protected Draggable |
reorderer |
protected int |
rows |
protected int |
splitterWidth |
protected FlexTable |
table |
protected GridView.GridTemplates |
tpls |
adjustSize, allowTextSelection, cacheSizes, disableContextMenu, disabled, disabledStyle, ensureVisibilityOnSizing, height, hidden, lastSize, layer, left, mask, maskMessage, monitorWindowResize, pageX, pageY, resizeHandler, shim, tabIndex, toolTip, toolTipConfig, top, width, windowResizeDelay, windowResizeTask
Constructor and Description |
---|
ColumnHeader(Grid<M> container,
ColumnModel<M> cm)
Creates a new column header.
|
ColumnHeader(Grid<M> container,
ColumnModel<M> cm,
ColumnHeader.ColumnHeaderAppearance appearance)
Creates a new column header.
|
Modifier and Type | Method and Description |
---|---|
protected void |
adjustCellWidth(XElement cell,
int width) |
protected void |
adjustColumnWidths(int[] columnWidths) |
protected void |
checkHeaderSizeChange() |
protected void |
cleanCells() |
protected ColumnHeader.Group |
createNewGroup(HeaderGroupConfig config) |
protected ColumnHeader.Head |
createNewHead(ColumnConfig config) |
protected void |
doAttachChildren() |
protected void |
doDetachChildren() |
ColumnHeader.ColumnHeaderAppearance |
getAppearance()
Returns the column header appearance.
|
protected int |
getColumnIndexByDom(int domIndex) |
protected int[] |
getColumnWidths()
Builds an array of the sizes for each column, visible or not
|
Widget |
getContainer()
Returns the header's container widget.
|
protected Menu |
getContextMenu(int column) |
protected int |
getDomIndexByColumn(int column) |
ColumnHeader.Head |
getHead(int column)
Returns the head at the current index.
|
int |
getMinColumnWidth()
Returns the minimum column width.
|
int |
getRightAlignOffset()
Returns the amount of padding in pixels for right aligned columns (defaults to 16).
|
int |
getSplitterWidth()
Returns the splitter width.
|
int |
indexOf(ColumnHeader.Head head)
Returns the index of the given column head.
|
boolean |
isDisableSortIcon()
Returns the state of the sort icon.
|
boolean |
isEnableColumnReorder()
Returns true if column reordering is enabled.
|
protected Draggable |
newColumnReorderingDraggable() |
protected DragHandler |
newColumnReorderingDragHandler() |
protected void |
onAttach() |
protected void |
onDropDownClick(Event ce,
int column) |
protected void |
onHeaderClick(Event event,
int column) |
protected void |
onHeaderDoubleClick(Event event,
int column) |
protected void |
onHeaderMouseDown(Event ce,
int column) |
protected void |
onResize(int width,
int height)
Called after the widget is resized, this method is empty by default but can be implemented by any subclass that
needs to perform custom logic after a resize occurs.
|
void |
refresh()
Refreshes the columns.
|
void |
release()
Do not call.
|
protected SafeHtml |
renderHiddenHeaders(int[] columnWidths) |
void |
setColumnModel(ColumnModel<M> columnModel)
Assigns a new set of columns to the header, but does not yet rebuild the headers.
|
void |
setDisableSortIcon(boolean disableSortIcon)
True to disable the column sort icon (defaults to false).
|
void |
setEnableColumnReorder(boolean enable)
True to enable column reordering.
|
void |
setEnableColumnResizing(boolean enable)
True to enable column resizing.
|
void |
setHeader(int column,
SafeHtml header)
Sets the column's header text.
|
void |
setMenuFactory(ColumnHeader.HeaderContextMenuFactory menuFactory)
Specifies which menu to use for any given column
|
void |
setMinColumnWidth(int minColumnWidth)
Sets the minimum column width (defaults to 25px).
|
void |
setRightAlignOffset(int rightAlignOffset)
Sets the amount of padding in pixels for right aligned columns (defaults to 16).
|
void |
setSplitterWidth(int splitterWidth)
Sets the splitter width.
|
void |
showColumnMenu(int column)
Shows the column's header context menu.
|
void |
updateColumnHidden(int index,
boolean hidden)
Updates the visibility of a column.
|
void |
updateColumnWidth(int column,
int width)
Updates the column width.
|
void |
updateSortIcon(int colIndex,
SortDir dir)
Updates the sort icon of a column.
|
void |
updateTotalWidth(int offset,
int width)
Updates the total width of the header.
|
addBeforeHideHandler, addBeforeShowContextMenuHandler, addBeforeShowHandler, addBlurHandler, addDisableHandler, addEnableHandler, addFocusHandler, addGestureRecognizer, addHideHandler, addMoveHandler, addResizeHandler, addShowContextMenuHandler, addShowHandler, addStyleDependentName, addStyleOnOver, adjustPosition, adjustSize, applyState, assertAfterRender, assertPreRender, blur, clearSizeCache, disable, disableContextMenu, disableEvents, enable, enableEvents, fireCancellableEvent, fireEvent, focus, getData, getElement, getFocusEl, getFocusSupport, getGestureRecognizer, getGestureRecognizerCount, getHideMode, getId, getItemId, getOffsetHeight, getOffsetWidth, getPositionEl, getShadow, getShadowPosition, getStateId, getTabIndex, getToolTip, hide, hideShadow, hideToolTip, isAllowTextSelection, isAutoHeight, isAutoWidth, isDeferHeight, isEnabled, isMonitorWindowResize, isRendered, isStateful, isVisible, isVisible, mask, mask, notifyHide, notifyShow, onAfterFirstAttach, onBlur, onBrowserEvent, onDetach, onDisable, onEnable, onFocus, onHide, onHideContextMenu, onLoad, onPosition, onRightClick, onShow, onShowContextMenu, onTouch, onUnload, onWindowResize, removeStyleDependentName, removeStyleOnOver, removeToolTip, setAllowTextSelection, setBorders, setBounds, setBounds, setContextMenu, setData, setDeferHeight, setEnabled, setHeight, setHeight, setHideMode, setId, setItemId, setMonitorWindowResize, setPagePosition, setPixelSize, setPosition, setShadow, setShadowPosition, setSize, setStateful, setStateId, setStyleDependentName, setTabIndex, setToolTip, setToolTipConfig, setVisible, setWidth, setWidth, show, sync, syncSize, unmask
protected ColumnHeader.GridSplitBar bar
protected ColumnModel<M> cm
protected List<ColumnHeader.Group> groups
protected boolean headerDisabled
protected int overrideHeaderHeight
protected List<ColumnHeader.Head> heads
protected int[] columnToHead
protected boolean disableSortIcon
protected ColumnHeader.HeaderContextMenuFactory menu
protected int minColumnWidth
protected Draggable reorderer
protected int rows
protected int splitterWidth
protected FlexTable table
protected GridView.GridTemplates tpls
public ColumnHeader(Grid<M> container, ColumnModel<M> cm)
container
- the containing widgetcm
- the column modelpublic ColumnHeader(Grid<M> container, ColumnModel<M> cm, ColumnHeader.ColumnHeaderAppearance appearance)
container
- the containing widgetcm
- the column modelappearance
- the column header appearancepublic ColumnHeader.ColumnHeaderAppearance getAppearance()
public Widget getContainer()
public ColumnHeader.Head getHead(int column)
column
- the column indexpublic int getMinColumnWidth()
public int getRightAlignOffset()
public int getSplitterWidth()
public int indexOf(ColumnHeader.Head head)
head
- the column headpublic boolean isDisableSortIcon()
public boolean isEnableColumnReorder()
public void refresh()
public void release()
public void setColumnModel(ColumnModel<M> columnModel)
refresh()
method
must be called to achieve that.columnModel
- the new set of columns to usepublic void setDisableSortIcon(boolean disableSortIcon)
disableSortIcon
- true to disable the sort iconpublic void setEnableColumnReorder(boolean enable)
enable
- true to enablepublic void setEnableColumnResizing(boolean enable)
enable
- true to enable, otherwise falsepublic void setHeader(int column, SafeHtml header)
column
- the column indexheader
- the header textpublic void setMenuFactory(ColumnHeader.HeaderContextMenuFactory menuFactory)
menuFactory
- the instance to use when requesting a menupublic void setMinColumnWidth(int minColumnWidth)
minColumnWidth
- the minimum column width in pixelspublic void setRightAlignOffset(int rightAlignOffset)
rightAlignOffset
- the right align offsetpublic void setSplitterWidth(int splitterWidth)
splitterWidth
- the splitter widthpublic void showColumnMenu(int column)
column
- the column indexpublic void updateColumnHidden(int index, boolean hidden)
index
- the column indexhidden
- true to hide, otherwise falsepublic void updateColumnWidth(int column, int width)
column
- the column indexwidth
- the new widthpublic void updateSortIcon(int colIndex, SortDir dir)
colIndex
- the column indexdir
- the sort directionpublic void updateTotalWidth(int offset, int width)
offset
- the offsetwidth
- the new widthprotected void adjustCellWidth(XElement cell, int width)
protected void adjustColumnWidths(int[] columnWidths)
protected void checkHeaderSizeChange()
protected void cleanCells()
protected ColumnHeader.Group createNewGroup(HeaderGroupConfig config)
protected ColumnHeader.Head createNewHead(ColumnConfig config)
protected void doAttachChildren()
protected void doDetachChildren()
protected int getColumnIndexByDom(int domIndex)
protected int[] getColumnWidths()
protected Menu getContextMenu(int column)
protected int getDomIndexByColumn(int column)
protected Draggable newColumnReorderingDraggable()
protected DragHandler newColumnReorderingDragHandler()
protected void onDropDownClick(Event ce, int column)
protected void onHeaderClick(Event event, int column)
protected void onHeaderDoubleClick(Event event, int column)
protected void onHeaderMouseDown(Event ce, int column)
protected void onResize(int width, int height)
Component
protected SafeHtml renderHiddenHeaders(int[] columnWidths)
Copyright © 2018. All rights reserved.