Class WAbstractItemView
- java.lang.Object
-
- eu.webtoolkit.jwt.WObject
-
- eu.webtoolkit.jwt.WWidget
-
- eu.webtoolkit.jwt.WCompositeWidget
-
- eu.webtoolkit.jwt.WAbstractItemView
-
- Direct Known Subclasses:
WTableView,WTreeView
public abstract class WAbstractItemView extends WCompositeWidget
An abstract base class for item Views.See
WTableVieworWTreeViewfor a description.i18n
The strings used in this class can be translated by overriding the default values for the following localization keys:
- Wt.WAbstractItemView.PageIOfN: {1} of {2}
- Wt.WAbstractItemView.PageBar.First: 슫 First
- Wt.WAbstractItemView.PageBar.Previous: � Previous
- Wt.WAbstractItemView.PageBar.Next: Next �
- Wt.WAbstractItemView.PageBar.Last: Last 슻
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WObject
WObject.FormData
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.EnumSet<DropLocation>enabledDropLocations_protected WWidgetuDragWidget_-
Fields inherited from class eu.webtoolkit.jwt.WWidget
WT_GETEXTRAMS_JS
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedWAbstractItemView()Creates a new item view.protectedWAbstractItemView(WContainerWidget parentContainer)Creates a new item view.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclearSelection()Clears the selection.Signal2<WModelIndex,WMouseEvent>clicked()Signal emitted when clicked.voidcloseEditor(WModelIndex index)Closes the editor for the given index.voidcloseEditor(WModelIndex index, boolean saveData)Closes the editor for the given index.voidcloseEditors()Closes all open editors.voidcloseEditors(boolean saveData)Closes all open editors.Signal2<java.lang.Integer,WLength>columnResized()Returns the signal emitted when a column is resized by the user.protected WWidgetcreateExtraHeaderWidget(int column)Create an extra widget in the header.protected WWidgetcreateHeaderWidget(int column)Signal2<WModelIndex,WMouseEvent>doubleClicked()Signal emitted when double clicked.protected voiddropEvent(WDropEvent e, WModelIndex index)Handles a drop event (drag & drop).protected voiddropEvent(WDropEvent e, WModelIndex index, Side side)Handles a drop event (drag & drop).voidedit(WModelIndex index)Opens an editor for the given index.protected voidenableAjax()Progresses to an Ajax-enabled widget.protected WWidgetextraHeaderWidget(int column)Returns the extra header widget.AlignmentFlaggetColumnAlignment(int column)Returns the content alignment for a column.WLengthgetColumnWidth(int column)Returns the column width.protected WWidgetgetCreatePageNavigationBar()Returns a page navigation widget.abstract intgetCurrentPage()Returns the current page.java.util.EnumSet<EditOption>getEditOptions()Returns the editing options.java.util.EnumSet<EditTrigger>getEditTriggers()Returns the editing triggers.java.util.EnumSet<DropLocation>getEnabledDropLocations()Returns the enabled drop locations.WLengthgetHeaderHeight()Returns the header height.WAbstractItemDelegategetHeaderItemDelegate()Returns the header item delegate.WAbstractItemDelegategetItemDelegate()Returns the default item delegate.WAbstractItemDelegategetItemDelegate(int column)Returns the delegate for a column.WAbstractItemDelegategetItemDelegate(WModelIndex index)Returns the delegate for rendering an item.WAbstractItemDelegategetItemDelegateForColumn(int column)Returns the delegate that was set for a column.WAbstractItemModelgetModel()Returns the model.abstract intgetPageCount()Returns the number of pages.abstract intgetPageSize()Returns the page size.WModelIndexgetRootIndex()Returns the root index.intgetRowHeaderCount()Returns the number of columns that are used as row headers.WLengthgetRowHeight()Returns the row height.java.util.SortedSet<WModelIndex>getSelectedIndexes()Returns the set of selected items.SelectionBehaviorgetSelectionBehavior()Returns the selection behaviour.SelectionModegetSelectionMode()Returns the selection mode.WItemSelectionModelgetSelectionModel()Returns the selection model.intgetSortColumn()Returns the current sorting columm.SortOrdergetSortOrder()Returns the current sorting order.protected voidhandleTouchEnd(java.util.List<WModelIndex> indices, WTouchEvent event)Handles a touch ended event.protected voidhandleTouchMove(java.util.List<WModelIndex> indices, WTouchEvent event)Handles a touch moved event.protected voidhandleTouchSelect(java.util.List<WModelIndex> indices, WTouchEvent event)Handles a touch select event.protected voidhandleTouchStart(java.util.List<WModelIndex> indices, WTouchEvent event)Handles a touch started event.booleanhasAlternatingRowColors()Returns whether alternating row colors are used.Signal2<java.lang.Integer,WMouseEvent>headerClicked()Signal emitted when a header item is clicked.Signal2<java.lang.Integer,WMouseEvent>headerDoubleClicked()Signal emitted when a header item is double clicked.Signal2<java.lang.Integer,WMouseEvent>headerMouseWentDown()Signal emitted when a mouse button is pressed on a header itemSignal2<java.lang.Integer,WMouseEvent>headerMouseWentUp()Signal emitted when a mouse button is released on a header itemvoidhideColumn(int column)Hides a column.AlignmentFlaghorizontalHeaderAlignment(int column)Returns the horizontal header alignment for a column.booleanisColumnHidden(int column)Returns if a column is hidden.booleanisColumnResizeEnabled()Returns whether column resizing is enabled for new columns.booleanisColumnResizeEnabled(int column)Returns whether column resizing is enabled for a single column.booleanisEditing(WModelIndex index)Returns whether an editor is open for a given index.booleanisSelected(WModelIndex index)Returns wheter an item is selected.booleanisSortEnabled()Returns whether the view is sortable.booleanisSortingEnabled()Returns whether sorting is enabled.booleanisSortingEnabled(int column)Returns whether sorting is enabled for a single column.booleanisValid(WModelIndex index)Returns whether an editor's state is valid.abstract WWidgetitemWidget(WModelIndex index)Returns the widget that renders an item.EventSignal1<WKeyEvent>keyPressed()Event signal emitted when a "character" was entered.EventSignal1<WKeyEvent>keyWentDown()Event signal emitted when a keyboard key is pushed down.EventSignal1<WKeyEvent>keyWentUp()Event signal emitted when a keyboard key is released.protected voidmodelHeaderDataChanged(Orientation orientation, int start, int end)Signal2<WModelIndex,WMouseEvent>mouseWentDown()Signal emitted when a mouse button is pressed down.Signal2<WModelIndex,WMouseEvent>mouseWentUp()Signal emitted when the mouse button is released.SignalpageChanged()Signal emitted when page information was updated.voidremove()Destructor.abstract EventSignal1<WScrollEvent>scrolled()Signal emitted when scrolling.voidscrollTo(WModelIndex index)Scrolls the view to an item.abstract voidscrollTo(WModelIndex index, ScrollHint hint)Scrolls the view to an item.voidselect(WModelIndex index)Selects a single item.voidselect(WModelIndex index, SelectionFlag option)Selects a single item.SignalselectionChanged()Signal emitted when the selection is changed.voidsetAlternatingRowColors(boolean enable)Sets if alternating row colors are to be used.voidsetColumnAlignment(int column, AlignmentFlag alignment)Sets the content alignment for a column.voidsetColumnHidden(int column, boolean hidden)Changes the visibility of a column.voidsetColumnResizeEnabled(boolean enabled)Enables interactive column resizing.voidsetColumnResizeEnabled(boolean enabled, int column)Enables interactive column resizing.abstract voidsetColumnWidth(int column, WLength width)Sets the column width.abstract voidsetCurrentPage(int page)Sets the current page.voidsetDragEnabled(boolean enable)Enables the selection to be dragged (drag & drop).voidsetDropsEnabled(boolean enable)Deprecated.UsesetEnabledDropLocations()instead.voidsetEditOptions(EditOption editOption, EditOption... editOptions)Configures editing options.voidsetEditOptions(java.util.EnumSet<EditOption> editOptions)Configures editing options.voidsetEditTriggers(EditTrigger editTrigger, EditTrigger... editTriggers)Configures what actions should trigger editing.voidsetEditTriggers(java.util.EnumSet<EditTrigger> editTriggers)Configures what actions should trigger editing.voidsetEnabledDropLocations(DropLocation dropLocation, DropLocation... dropLocations)Enables drop operations (drag & drop).voidsetEnabledDropLocations(java.util.EnumSet<DropLocation> dropLocations)Enables drop operations (drag & drop).voidsetHeaderAlignment(int column, AlignmentFlag alignmen, AlignmentFlag... alignment)Sets the header alignment for a column.voidsetHeaderAlignment(int column, java.util.EnumSet<AlignmentFlag> alignment)Sets the header alignment for a column.voidsetHeaderClickSortEnabled(boolean enabled)Alow to sort.voidsetHeaderHeight(WLength height)Sets the header height.voidsetHeaderItemDelegate(WAbstractItemDelegate delegate)Sets the header item delegate.voidsetHeaderWordWrap(int column, boolean enabled)Configures header text wrapping.voidsetItemDelegate(WAbstractItemDelegate delegate)Sets the default item delegate.voidsetItemDelegateForColumn(int column, WAbstractItemDelegate delegate)Sets the delegate for a column.voidsetModel(WAbstractItemModel model)Sets the model.voidsetRootIndex(WModelIndex rootIndex)Sets the root index.voidsetRowHeaderCount(int count)Configures the number of columns that are used as row headers.voidsetRowHeight(WLength rowHeight)Sets the row height.voidsetSelectedIndexes(java.util.SortedSet<WModelIndex> indexes)Sets the selected items.voidsetSelectionBehavior(SelectionBehavior behavior)Changes the selection behaviour.voidsetSelectionMode(SelectionMode mode)Sets the selection mode.voidsetSortingEnabled(boolean enabled)Enables or disables sorting for all columns.voidsetSortingEnabled(int column, boolean enabled)Enables or disables sorting for a single column.protected booleanshiftEditorColumns(WModelIndex parent, int start, int count, boolean persistWhenShifted)protected booleanshiftEditorRows(WModelIndex parent, int start, int count, boolean persistWhenShifted)voidshowColumn(int column)Shows a column.voidsortByColumn(int column, SortOrder order)Sorts the data according to a column.Signal2<java.util.List<WModelIndex>,WTouchEvent>touchEnded()Signal emitted when one or more fingers are removed from the screen.Signal2<java.util.List<WModelIndex>,WTouchEvent>touchMoved()Signal emitted when one or more fingers are moved on the screen.Signal2<WModelIndex,WTouchEvent>touchStart()Deprecated.UsetouchStarted()instead.Signal2<java.util.List<WModelIndex>,WTouchEvent>touchStarted()Signal emitted when one or more fingers are placed on the screen.ValidationStatevalidateEditor(WModelIndex index)Validates the editor for the given index.ValidationStatevalidateEditors()Validates all editors.AlignmentFlagverticalHeaderAlignment(int column)Returns the vertical header alignment for a column.-
Methods inherited from class eu.webtoolkit.jwt.WCompositeWidget
addStyleClass, boxBorder, boxPadding, callJavaScriptMember, doJavaScript, find, findById, getAttributeValue, getBaseZIndex, getChildren, getClearSides, getDecorationStyle, getFloatSide, getHeight, getId, getImplementation, getJavaScriptMember, getLineHeight, getMargin, getMaximumHeight, getMaximumWidth, getMinimumHeight, getMinimumWidth, getObjectName, getOffset, getPositionScheme, getScrollVisibilityMargin, getStyleClass, getTabIndex, getTakeImplementation, getToolTip, getVerticalAlignment, getVerticalAlignmentLength, getWidth, hasFocus, hasStyleClass, isCanReceiveFocus, isDisabled, isEnabled, isHidden, isHiddenKeepsGeometry, isInline, isLoaded, isPopup, isScrollVisibilityEnabled, isScrollVisible, isSetFirstFocus, isThemeStyleEnabled, isVisible, load, propagateSetEnabled, propagateSetVisible, refresh, removeStyleClass, removeWidget, render, resize, scrollVisibilityChanged, setAttributeValue, setCanReceiveFocus, setClearSides, setDecorationStyle, setDeferredToolTip, setDisabled, setFloatSide, setFocus, setHidden, setHiddenKeepsGeometry, setId, setImplementation, setInline, setJavaScriptMember, setLineHeight, setMargin, setMaximumSize, setMinimumSize, setObjectName, setOffsets, setParentWidget, setPopup, setPositionScheme, setScrollVisibilityEnabled, setScrollVisibilityMargin, setSelectable, setStyleClass, setTabIndex, setThemeStyleEnabled, setToolTip, setVerticalAlignment
-
Methods inherited from class eu.webtoolkit.jwt.WWidget
acceptDrops, acceptDrops, addCssRule, addCssRule, addJSignal, addStyleClass, animateHide, animateShow, applyThemeStyles, createJavaScript, disable, dropEvent, enable, getDropTouch, getJsRef, getParent, hide, htmlText, isExposed, isGlobalWidget, isLayoutSizeAware, isRendered, layoutSizeChanged, needsRerender, positionAt, positionAt, positionAt, positionAt, removeFromParent, removeStyleClass, render, resize, scheduleRender, scheduleRender, scheduleRender, scheduleThemeStyleApply, setClearSides, setDeferredToolTip, setFocus, setHeight, setHidden, setLayoutSizeAware, setMargin, setMargin, setMargin, setMargin, setMargin, setOffsets, setOffsets, setOffsets, setOffsets, setOffsets, setToolTip, setVerticalAlignment, setWidth, show, stopAcceptDrops, toggleStyleClass, toggleStyleClass, tr
-
Methods inherited from class eu.webtoolkit.jwt.WObject
setFormData
-
-
-
-
Field Detail
-
enabledDropLocations_
protected java.util.EnumSet<DropLocation> enabledDropLocations_
-
uDragWidget_
protected WWidget uDragWidget_
-
-
Constructor Detail
-
WAbstractItemView
protected WAbstractItemView(WContainerWidget parentContainer)
Creates a new item view.
-
WAbstractItemView
protected WAbstractItemView()
Creates a new item view.
-
-
Method Detail
-
remove
public void remove()
Description copied from class:WWidgetDestructor.Deletes a widget and all contained contents.
- Overrides:
removein classWCompositeWidget- See Also:
WWidget.removeWidget(WWidget widget)
-
setModel
public void setModel(WAbstractItemModel model)
Sets the model.The View will display data of the given
modeland changes in the model are reflected by the View.The initial model is
null.- See Also:
setRootIndex(WModelIndex rootIndex)
-
getModel
public WAbstractItemModel getModel()
Returns the model.- See Also:
setModel(WAbstractItemModel model)
-
setRootIndex
public void setRootIndex(WModelIndex rootIndex)
Sets the root index.The root index is the model index that is considered the root node. This node itself is not rendered, but its children are.
The default value is
null, corresponding to the model's root node.- See Also:
setModel(WAbstractItemModel model)
-
getRootIndex
public WModelIndex getRootIndex()
Returns the root index.- See Also:
setRootIndex(WModelIndex rootIndex)
-
setItemDelegate
public void setItemDelegate(WAbstractItemDelegate delegate)
Sets the default item delegate.The previous delegate is not deleted. This item delegate is for all columns for which no specific item delegate is set.
The default item delegate is a
WItemDelegate.
-
getItemDelegate
public WAbstractItemDelegate getItemDelegate()
Returns the default item delegate.
-
setItemDelegateForColumn
public void setItemDelegateForColumn(int column, WAbstractItemDelegate delegate)Sets the delegate for a column.A delegate previously set (if any) is not deleted.
-
getItemDelegateForColumn
public WAbstractItemDelegate getItemDelegateForColumn(int column)
Returns the delegate that was set for a column.Returns
nullif no delegate was set for the column.
-
getItemDelegate
public WAbstractItemDelegate getItemDelegate(WModelIndex index)
Returns the delegate for rendering an item.
-
getItemDelegate
public WAbstractItemDelegate getItemDelegate(int column)
Returns the delegate for a column.Returns either the delegate that was set for the column, or the default delegate.
-
itemWidget
public abstract WWidget itemWidget(WModelIndex index)
Returns the widget that renders an item.This returns the widget that renders the given item. This may return 0 if the item is currently not rendered.
This widget has been created by an item delegate, and usually an item delegate is involved when updating it.
-
setHeaderItemDelegate
public void setHeaderItemDelegate(WAbstractItemDelegate delegate)
Sets the header item delegate.This item delegate is used for rendering items in the header.
The previous delegate is not deleted. This item delegate is for all columns for which no specific item delegate is set.
The default item delegate is a
WItemDelegate.
-
getHeaderItemDelegate
public WAbstractItemDelegate getHeaderItemDelegate()
Returns the header item delegate.
-
setColumnAlignment
public void setColumnAlignment(int column, AlignmentFlag alignment)Sets the content alignment for a column.The default value is
AlignmentFlag.Left.
-
getColumnAlignment
public AlignmentFlag getColumnAlignment(int column)
Returns the content alignment for a column.
-
setHeaderAlignment
public void setHeaderAlignment(int column, java.util.EnumSet<AlignmentFlag> alignment)Sets the header alignment for a column.The default alignemnt is horizontally left, and vertically centered. (
AlignmentFlag.Left|AlignmentFlag.Middle).Valid options for horizontal alignment are
AlignmentFlag.Left,AlignmentFlag.CenterorAlignmentFlag.Right.Valid options for vertical alignment are
AlignmentFlag.MiddleorAlignmentFlag.Top. In the latter case, other contents may be added below the label increateExtraHeaderWidget().
-
setHeaderAlignment
public final void setHeaderAlignment(int column, AlignmentFlag alignmen, AlignmentFlag... alignment)Sets the header alignment for a column.Calls
setHeaderAlignment(column, EnumSet.of(alignmen, alignment))
-
horizontalHeaderAlignment
public AlignmentFlag horizontalHeaderAlignment(int column)
Returns the horizontal header alignment for a column.
-
verticalHeaderAlignment
public AlignmentFlag verticalHeaderAlignment(int column)
Returns the vertical header alignment for a column.
-
setHeaderWordWrap
public void setHeaderWordWrap(int column, boolean enabled)Configures header text wrapping.This setting only affects a multiline header, and the default value is
true. When set tofalse, the header itself will not wrap (as with a vertically centered header), and thus extra widgets will not shift down when there is a long header label.
-
setAlternatingRowColors
public void setAlternatingRowColors(boolean enable)
Sets if alternating row colors are to be used.Configure whether rows get alternating background colors, defined by the current CSS theme.
The default value is
false.
-
hasAlternatingRowColors
public boolean hasAlternatingRowColors()
Returns whether alternating row colors are used.When enabled, rows are displayed in alternating row colors, according to the current theme's definition.
- See Also:
setAlternatingRowColors(boolean enable)
-
sortByColumn
public void sortByColumn(int column, SortOrder order)Sorts the data according to a column.Sorts the data according to data in column
columnand sort orderorder.The default sorting column is -1: the model is unsorted.
-
getSortColumn
public int getSortColumn()
Returns the current sorting columm.
-
getSortOrder
public SortOrder getSortOrder()
Returns the current sorting order.
-
setSortingEnabled
public void setSortingEnabled(boolean enabled)
Enables or disables sorting for all columns.Enable or disable sorting by the user on all columns.
Sorting is enabled by default.
-
setSortingEnabled
public void setSortingEnabled(int column, boolean enabled)Enables or disables sorting for a single column.Enable or disable sorting by the user for a specific column.
Sorting is enabled by default.
-
isSortingEnabled
public boolean isSortingEnabled()
Returns whether sorting is enabled.- See Also:
setSortingEnabled(boolean enabled)
-
isSortingEnabled
public boolean isSortingEnabled(int column)
Returns whether sorting is enabled for a single column.- See Also:
setSortingEnabled(boolean enabled)
-
setColumnResizeEnabled
public void setColumnResizeEnabled(boolean enabled)
Enables interactive column resizing.Enable or disable column resize handles for interactive resizing of the columns.
Column resizing is enabled by default when JavaScript is available.
- See Also:
setColumnResizeEnabled(boolean enabled)
-
setColumnResizeEnabled
public void setColumnResizeEnabled(boolean enabled, int column)Enables interactive column resizing.Enable or disable column resize handles for interactive resizing of a single column. The
columnthat is passed indicated the column index in the view. The indices start from 0.Column resizing is enabled by default when JavaScript is available.
- See Also:
setColumnResizeEnabled(boolean enabled)
-
isColumnResizeEnabled
public boolean isColumnResizeEnabled()
Returns whether column resizing is enabled for new columns.- See Also:
setColumnResizeEnabled(boolean enabled)
-
isColumnResizeEnabled
public boolean isColumnResizeEnabled(int column)
Returns whether column resizing is enabled for a single column.The
columnthat is passed indicated the column index in the view. The indices start from 0.- See Also:
setColumnResizeEnabled(boolean enabled)
-
setSelectionBehavior
public void setSelectionBehavior(SelectionBehavior behavior)
Changes the selection behaviour.The selection behavior indicates whether whole rows or individual items can be selected. It is a property of the
getSelectionModel().By default, selection operates on rows (
SelectionBehavior.Rows), in which case model indexes will always be in the first column (columnnull).Alternatively, you can allow selection for individual items (
SelectionBehavior.Items)
-
getSelectionBehavior
public SelectionBehavior getSelectionBehavior()
Returns the selection behaviour.
-
setSelectionMode
public void setSelectionMode(SelectionMode mode)
Sets the selection mode.By default selection is disabled (
SelectionMode.None).
-
getSelectionMode
public SelectionMode getSelectionMode()
Returns the selection mode.- See Also:
setSelectionMode(SelectionMode mode)
-
getSelectionModel
public WItemSelectionModel getSelectionModel()
Returns the selection model.The selection model keeps track of the currently selected items.
-
setSelectedIndexes
public void setSelectedIndexes(java.util.SortedSet<WModelIndex> indexes)
Sets the selected items.Replaces the current selection with
indexes.When selection operates on rows (
SelectionBehavior.Rows), it is sufficient to pass the first element in a row (columnnull) to select the entire row.
-
clearSelection
public void clearSelection()
Clears the selection.- See Also:
setSelectedIndexes(SortedSet indexes)
-
select
public void select(WModelIndex index, SelectionFlag option)
Selects a single item.
-
select
public final void select(WModelIndex index)
Selects a single item.
-
isSelected
public boolean isSelected(WModelIndex index)
Returns wheter an item is selected.When selection operates on rows (
SelectionBehavior.Rows), this method returns true for each element in a selected row.This is a convenience method for:
selectionModel().isSelected(index)
-
getSelectedIndexes
public java.util.SortedSet<WModelIndex> getSelectedIndexes()
Returns the set of selected items.The model indexes are returned as a set, topologically ordered (in the order they appear in the view).
When selection operates on rows (
SelectionBehavior.Rows), this method only returns the model index of first column's element of the selected rows.This is a convenience method for:
selectionModel().selectedIndexes()- See Also:
setSelectedIndexes(SortedSet indexes)
-
setDragEnabled
public void setDragEnabled(boolean enable)
Enables the selection to be dragged (drag & drop).To enable dragging of the selection, you first need to enable selection using
setSelectionMode().Whether an individual item may be dragged is controlled by the item's
ItemFlag.DragEnabledflag. The selection can be dragged only if all items currently selected can be dragged.- See Also:
setDropsEnabled(boolean enable)
-
setDropsEnabled
public void setDropsEnabled(boolean enable)
Deprecated.UsesetEnabledDropLocations()instead. This method now enablesDropLocation.OnItem.Enables drop operations (drag & drop).When drop is enabled, the tree view will indicate that something may be dropped when the mime-type of the dragged object is compatible with one of the model's accepted drop mime-types (see
WAbstractItemModel.getAcceptDropMimeTypes()) or this widget's accepted drop mime-types (seeWWidget#acceptDrops()), and the target item has drop enabled (which is controlled by the item'sItemFlag.DropEnabledflag).Drop events must be handled in dropEvent().
- See Also:
setDragEnabled(boolean enable)
-
setEnabledDropLocations
public void setEnabledDropLocations(java.util.EnumSet<DropLocation> dropLocations)
Enables drop operations (drag & drop).When drop is enabled, the tree view will indicate that something may be dropped when the mime-type of the dragged object is compatible with one of the model's accepted drop mime-types (see
WAbstractItemModel.getAcceptDropMimeTypes()) or this widget's accepted drop mime-types (seeWWidget#acceptDrops()).When
DropLocation.OnItemis enabled, the view will allow drops on items that have theItemFlag.DropEnabledflag set. WhenDropLocation.BetweenRowsis enabled, the view will indicate that something may be dropped between any two rows. WhenDropLocation.OnItemandDropLocation.BetweenRowsare both enabled, the drop indication differs depending on whetherItemFlag.DropEnabledis set on the item.Drop events must be handled in dropEvent().
-
setEnabledDropLocations
public final void setEnabledDropLocations(DropLocation dropLocation, DropLocation... dropLocations)
Enables drop operations (drag & drop).Calls
setEnabledDropLocations(EnumSet.of(dropLocation, dropLocations))
-
getEnabledDropLocations
public java.util.EnumSet<DropLocation> getEnabledDropLocations()
Returns the enabled drop locations.
-
setRowHeight
public void setRowHeight(WLength rowHeight)
Sets the row height.The view renders all rows with a same height. This method configures this row height.
The default value is 20 pixels.
Note: The height must be specified in
LengthUnit.Pixelunits.
-
getRowHeight
public WLength getRowHeight()
Returns the row height.
-
setColumnWidth
public abstract void setColumnWidth(int column, WLength width)Sets the column width.The default column width is 150 pixels.
Note: The width must be specified in
LengthUnit.Pixelunits.Note: The actual space occupied by each column is the column width augmented by 7 pixels for internal padding and a border.
-
getColumnWidth
public WLength getColumnWidth(int column)
Returns the column width.
-
setColumnHidden
public void setColumnHidden(int column, boolean hidden)Changes the visibility of a column.- See Also:
isColumnHidden(int column)
-
isColumnHidden
public boolean isColumnHidden(int column)
Returns if a column is hidden.
-
hideColumn
public void hideColumn(int column)
Hides a column.
-
showColumn
public void showColumn(int column)
Shows a column.
-
setHeaderHeight
public void setHeaderHeight(WLength height)
Sets the header height.The default value is 20 pixels.
Note: The height must be specified in
LengthUnit.Pixelunits.
-
getHeaderHeight
public WLength getHeaderHeight()
Returns the header height.- See Also:
setHeaderHeight(WLength height)
-
getPageCount
public abstract int getPageCount()
Returns the number of pages.When Ajax/JavaScript is not available, the view will use a paging navigation bar to allow scrolling through the data. This returns the number of pages currently shown.
- See Also:
getCreatePageNavigationBar(),pageChanged()
-
getPageSize
public abstract int getPageSize()
Returns the page size.When Ajax/JavaScript is not available, the view will use a paging navigation bar to allow scrolling through the data. This returns the number of items per page.
- See Also:
getCreatePageNavigationBar(),pageChanged()
-
getCurrentPage
public abstract int getCurrentPage()
Returns the current page.When Ajax/JavaScript is not available, the view will use a paging navigation bar to allow scrolling through the data. This returns the current page (between 0 and
getPageCount()- 1).- See Also:
getCreatePageNavigationBar(),pageChanged()
-
setCurrentPage
public abstract void setCurrentPage(int page)
Sets the current page.When Ajax/JavaScript is not available, the view will use a paging navigation bar to allow scrolling through the data. This method can be used to change the current page.
- See Also:
getCreatePageNavigationBar(),pageChanged()
-
scrollTo
public abstract void scrollTo(WModelIndex index, ScrollHint hint)
Scrolls the view to an item.Scrolls the view to ensure that the item which represents the provided
indexis visible. Ahintmay indicate how the item should appear in the viewport (if possible).Note: Currently only implemented to scroll to the correct row, not taking into account the column.
-
scrollTo
public final void scrollTo(WModelIndex index)
Scrolls the view to an item.
-
setEditTriggers
public void setEditTriggers(java.util.EnumSet<EditTrigger> editTriggers)
Configures what actions should trigger editing.The default value is DoubleClicked.
- See Also:
edit(WModelIndex index)
-
setEditTriggers
public final void setEditTriggers(EditTrigger editTrigger, EditTrigger... editTriggers)
Configures what actions should trigger editing.Calls
setEditTriggers(EnumSet.of(editTrigger, editTriggers))
-
getEditTriggers
public java.util.EnumSet<EditTrigger> getEditTriggers()
Returns the editing triggers.- See Also:
setEditTriggers(EnumSet editTriggers)
-
setEditOptions
public void setEditOptions(java.util.EnumSet<EditOption> editOptions)
Configures editing options.The default value is SingleEditor;
-
setEditOptions
public final void setEditOptions(EditOption editOption, EditOption... editOptions)
Configures editing options.
-
getEditOptions
public java.util.EnumSet<EditOption> getEditOptions()
Returns the editing options.- See Also:
setEditOptions(EnumSet editOptions)
-
edit
public void edit(WModelIndex index)
Opens an editor for the given index.Unless multiple editors are enabled, any other open editor is closed first.
-
closeEditor
public void closeEditor(WModelIndex index, boolean saveData)
Closes the editor for the given index.If
saveDatais true, then the currently edited value is saved first to the model.- See Also:
edit(WModelIndex index)
-
closeEditor
public final void closeEditor(WModelIndex index)
Closes the editor for the given index.Calls
closeEditor(index, true)
-
closeEditors
public void closeEditors(boolean saveData)
Closes all open editors.If
saveDatais true, then the currently edited values are saved to the model before closing the editor.
-
closeEditors
public final void closeEditors()
Closes all open editors.Calls
closeEditors(true)
-
validateEditor
public ValidationState validateEditor(WModelIndex index)
Validates the editor for the given index.Validation is done by invoking
WAbstractItemDelegate#validate().
-
validateEditors
public ValidationState validateEditors()
Validates all editors.- See Also:
validateEditor(WModelIndex index)
-
isEditing
public boolean isEditing(WModelIndex index)
Returns whether an editor is open for a given index.- See Also:
edit(WModelIndex index)
-
isValid
public boolean isValid(WModelIndex index)
Returns whether an editor's state is valid.
-
clicked
public Signal2<WModelIndex,WMouseEvent> clicked()
Signal emitted when clicked.When the event happened over an item, the first argument indicates the item that was clicked on.
- See Also:
doubleClicked()
-
doubleClicked
public Signal2<WModelIndex,WMouseEvent> doubleClicked()
Signal emitted when double clicked.When the event happened over an item, the first argument indicates the item that was double clicked on.
- See Also:
clicked()
-
mouseWentDown
public Signal2<WModelIndex,WMouseEvent> mouseWentDown()
Signal emitted when a mouse button is pressed down.This signal is emitted only when 'over' an item (the model index is passed as first argument is never invalid).
- See Also:
mouseWentUp()
-
mouseWentUp
public Signal2<WModelIndex,WMouseEvent> mouseWentUp()
Signal emitted when the mouse button is released.When the event happened over an item, the first argument indicates the item where the mouse went up.
- See Also:
mouseWentDown()
-
touchStart
public Signal2<WModelIndex,WTouchEvent> touchStart()
Deprecated.UsetouchStarted()instead.Signal emitted when a finger is placed on the screen.When the event happened over an item, the first argument indicates the item that was touched.
-
touchStarted
public Signal2<java.util.List<WModelIndex>,WTouchEvent> touchStarted()
Signal emitted when one or more fingers are placed on the screen.When the event happened over an item, the first argument indicates the items that were touched. The indices in the model index vector match the indices in the
WTouchEvent.getChangedTouches().
-
touchMoved
public Signal2<java.util.List<WModelIndex>,WTouchEvent> touchMoved()
Signal emitted when one or more fingers are moved on the screen.When the event happened over an item, the first argument indicates the items that were touched. The indices in the model index vector match the indices in the
WTouchEvent.getChangedTouches().
-
touchEnded
public Signal2<java.util.List<WModelIndex>,WTouchEvent> touchEnded()
Signal emitted when one or more fingers are removed from the screen.When the event happened over an item, the first argument indicates the items where the touch ended. The indices in the model index vector match the indices in the
WTouchEvent.getChangedTouches().Note: When JavaScript is disabled, the signal will never fire.
-
selectionChanged
public Signal selectionChanged()
Signal emitted when the selection is changed.
-
pageChanged
public Signal pageChanged()
Signal emitted when page information was updated.When Ajax/JavaScript is not available, the view will use a paging navigation bar to allow scrolling through the data. This signal is emitted when page-related information changed (e.g. the current page was changed, or the number of rows was changed).
- See Also:
getCreatePageNavigationBar()
-
columnResized
public Signal2<java.lang.Integer,WLength> columnResized()
Returns the signal emitted when a column is resized by the user.The arguments of the signal are: the column index and the new width of the column.
-
isSortEnabled
public boolean isSortEnabled()
Returns whether the view is sortable.When enabeld the view can be sorted by clicking on the header.
-
setHeaderClickSortEnabled
public void setHeaderClickSortEnabled(boolean enabled)
Alow to sort.When enabeld the view can be sorted by clicking on the header.
-
headerClicked
public Signal2<java.lang.Integer,WMouseEvent> headerClicked()
Signal emitted when a header item is clicked.The argument that is passed is the column number.
- See Also:
clicked()
-
headerDoubleClicked
public Signal2<java.lang.Integer,WMouseEvent> headerDoubleClicked()
Signal emitted when a header item is double clicked.The argument that is passed is the column number.
- See Also:
doubleClicked(),headerClicked()
-
headerMouseWentDown
public Signal2<java.lang.Integer,WMouseEvent> headerMouseWentDown()
Signal emitted when a mouse button is pressed on a header itemThe argument that is passed is the column number.
-
headerMouseWentUp
public Signal2<java.lang.Integer,WMouseEvent> headerMouseWentUp()
Signal emitted when a mouse button is released on a header itemThe argument that is passed is the column number.
- See Also:
headerMouseWentDown()
-
scrolled
public abstract EventSignal1<WScrollEvent> scrolled()
Signal emitted when scrolling.Note: Works only if ajax is available.
-
setRowHeaderCount
public void setRowHeaderCount(int count)
Configures the number of columns that are used as row headers.An item view does not use the vertical header data from the model in any way, but instead you can configure data in the first column(s) to be used as a row headers.
These columns will not scroll horizontally together with the rest of the model.
The default value is 0.
Note: Currently, this property must be set before any other settings of the view and only a value of 0 or 1 is supported.
-
getRowHeaderCount
public int getRowHeaderCount()
Returns the number of columns that are used as row headers.- See Also:
setRowHeaderCount(int count)
-
keyWentDown
public EventSignal1<WKeyEvent> keyWentDown()
Event signal emitted when a keyboard key is pushed down.The keyWentDown signal is the first signal emitted when a key is pressed (before the keyPressed signal). Unlike
keyPressed()however it is also emitted for modifier keys (such as "shift", "control", ...) or keyboard navigation keys that do not have a corresponding character.- See Also:
keyPressed(),keyWentUp()
-
keyPressed
public EventSignal1<WKeyEvent> keyPressed()
Event signal emitted when a "character" was entered.The keyPressed signal is emitted when a key is pressed, and a character is entered. Unlike
keyWentDown(), it is emitted only for key presses that result in a character being entered, and thus not for modifier keys or keyboard navigation keys.- See Also:
keyWentDown()
-
keyWentUp
public EventSignal1<WKeyEvent> keyWentUp()
Event signal emitted when a keyboard key is released.This is the counter-part of the
keyWentDown()event. Every key-down has its corresponding key-up.- See Also:
keyWentDown()
-
dropEvent
protected void dropEvent(WDropEvent e, WModelIndex index)
Handles a drop event (drag & drop).The
eventobject contains details about the drop operation, identifying the source (which provides the data) and the mime-type of the data. The drop was received on thetargetitem.The drop event can be handled either by the view itself, or by the model. The default implementation checks if the mime-type is accepted by the model, and if so passes the drop event to the model. If the source is the view's own selection model, then the drop event will be handled as a
DropAction.Move, otherwise the drop event will be handled as aDropAction.Copy.
-
dropEvent
protected void dropEvent(WDropEvent e, WModelIndex index, Side side)
Handles a drop event (drag & drop).The
eventobject contains details about the drop operation, identifying the source (which provides the data) and the mime-type of the data. The drop was received relative to theindexitem and thesideparameter will only be Wt::Top or Wt::Bottom.A drop below the lowest item or on an empty view will result in a call to this method with an invalid index and side Wt::Bottom.
The drop event can be handled either by the view itself, or by the model. The default implementation checks if the mime-type is accepted by the model, and if so passes the drop event to the model as a
DropAction.Move.
-
createExtraHeaderWidget
protected WWidget createExtraHeaderWidget(int column)
Create an extra widget in the header.You may reimplement this method to provide an extra widget to be placed below the header label. The extra widget will be visible only if a multi-line header is configured using
setHeaderHeight().The widget is created only once, but this method may be called repeatedly for a column for which prior calls returned
null(i.e. each time the header is rerendered).The default implementation returns
null.
-
extraHeaderWidget
protected WWidget extraHeaderWidget(int column)
Returns the extra header widget.Returns the widget previously created using
createExtraHeaderWidget()- See Also:
createExtraHeaderWidget(int column)
-
getCreatePageNavigationBar
protected WWidget getCreatePageNavigationBar()
Returns a page navigation widget.When Ajax/JavaScript is not available, the view will use a paging navigation bar to allow scrolling through the data, created by this method. The default implementation displays a simple navigation bar with (First, Prevous, Next, Last) buttons and a page counter.
You may want to reimplement this method to provide a custom page navigation bar. You can use the
getCurrentPage(),getPageCount(), andsetCurrentPage()methods to set or get the page information, and listen to thepageChanged()signal to react to changes.
-
modelHeaderDataChanged
protected void modelHeaderDataChanged(Orientation orientation, int start, int end)
-
createHeaderWidget
protected WWidget createHeaderWidget(int column)
-
handleTouchSelect
protected void handleTouchSelect(java.util.List<WModelIndex> indices, WTouchEvent event)
Handles a touch select event.
-
handleTouchStart
protected void handleTouchStart(java.util.List<WModelIndex> indices, WTouchEvent event)
Handles a touch started event.
-
handleTouchMove
protected void handleTouchMove(java.util.List<WModelIndex> indices, WTouchEvent event)
Handles a touch moved event.
-
handleTouchEnd
protected void handleTouchEnd(java.util.List<WModelIndex> indices, WTouchEvent event)
Handles a touch ended event.
-
enableAjax
protected void enableAjax()
Description copied from class:WWidgetProgresses to an Ajax-enabled widget.This method is called when the progressive bootstrap method is used, and support for AJAX has been detected. The default behavior will upgrade the widget's event handling to use AJAX instead of full page reloads, and propagate the call to its children.
You may want to reimplement this method if you want to make changes to widget when AJAX is enabled. You should always call the base implementation.
- Overrides:
enableAjaxin classWCompositeWidget- See Also:
WApplication.enableAjax()
-
shiftEditorRows
protected boolean shiftEditorRows(WModelIndex parent, int start, int count, boolean persistWhenShifted)
-
shiftEditorColumns
protected boolean shiftEditorColumns(WModelIndex parent, int start, int count, boolean persistWhenShifted)
-
-