Class JmixGridColumnVisibility
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.Composite<JmixMenuBar>
io.jmix.flowui.component.gridcolumnvisibility.JmixGridColumnVisibility
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier
,com.vaadin.flow.component.BlurNotifier<AbstractDropdownButton>
,com.vaadin.flow.component.DetachNotifier
,com.vaadin.flow.component.Focusable<AbstractDropdownButton>
,com.vaadin.flow.component.FocusNotifier<AbstractDropdownButton>
,com.vaadin.flow.component.HasElement
,com.vaadin.flow.component.HasEnabled
,com.vaadin.flow.component.HasSize
,com.vaadin.flow.component.HasStyle
,com.vaadin.flow.component.HasText
,com.vaadin.flow.component.HasTheme
,com.vaadin.flow.component.shared.HasOverlayClassName
,com.vaadin.flow.component.shared.HasThemeVariant<GridColumnVisibilityVariant>
,HasTitle
,Serializable
,org.springframework.beans.factory.Aware
,org.springframework.beans.factory.InitializingBean
,org.springframework.context.ApplicationContextAware
public class JmixGridColumnVisibility
extends com.vaadin.flow.component.Composite<JmixMenuBar>
implements com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.InitializingBean, HasTitle, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.shared.HasThemeVariant<GridColumnVisibilityVariant>, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.shared.HasOverlayClassName, com.vaadin.flow.component.HasText, com.vaadin.flow.component.Focusable<AbstractDropdownButton>
A component which allows to manage visibility of data grid columns
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected class
static interface
Represents an item which allows to toggle column visibility.protected static class
Nested classes/interfaces inherited from interface com.vaadin.flow.component.BlurNotifier
com.vaadin.flow.component.BlurNotifier.BlurEvent<C extends com.vaadin.flow.component.Component>
Nested classes/interfaces inherited from interface com.vaadin.flow.component.FocusNotifier
com.vaadin.flow.component.FocusNotifier.FocusEvent<C extends com.vaadin.flow.component.Component>
Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasText
com.vaadin.flow.component.HasText.WhiteSpace
-
Field Summary
Modifier and TypeFieldDescriptionprotected org.springframework.context.ApplicationContext
protected static final String
protected static final String
protected JmixMenuItem
protected com.vaadin.flow.component.grid.Grid<?>
protected JmixGridColumnVisibility.Header
protected com.vaadin.flow.component.icon.Icon
protected List<JmixGridColumnVisibility.MenuItemImpl>
protected Messages
protected MessageTools
protected MetadataTools
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addMenuItem
(DataGridColumn<?> column) Adds new menu item, which allows to toggle visibility of specified column, to the end of dropdown menu.void
addMenuItem
(DataGridColumn<?> column, String text) Adds new column item, which allows to toggle visibility of specified column, to the end of dropdown menu.void
addMenuItem
(String columnKey) Adds new menu item, which allows to toggle visibility of the column with specified key, to the end of dropdown menu.void
addMenuItem
(String columnKey, String text) Adds new menu item, which allows to toggle visibility of the column with specified key, to the end of dropdown menu.void
addMenuItemAtIndex
(DataGridColumn<?> column, int index) Adds new menu item, which allows to toggle visibility of specified column, to dropdown menu.void
addMenuItemAtIndex
(DataGridColumn<?> column, String text, int index) Adds new menu item, which allows to toggle visibility of specified column, to dropdown menu.void
addMenuItemAtIndex
(String columnKey, int index) Adds new menu item, which allows to toggle visibility of the column with specified key, to dropdown menu.void
addMenuItemAtIndex
(String columnKey, String text, int index) Adds new menu item, which allows to toggle visibility of the column with specified key, to dropdown menu.protected void
addMenuItemInternal
(DataGridColumn<?> column, String text, Integer index) void
protected void
protected void
checkColumnOwner
(DataGridColumn<?> column) protected void
checkGridType
(com.vaadin.flow.component.grid.Grid<?> grid) protected DataGridColumn<?>
getColumnByKey
(String columnKey) protected String
getColumnHeaderText
(DataGridColumn<?> column) com.vaadin.flow.component.grid.Grid<?>
getGrid()
com.vaadin.flow.component.icon.Icon
getIcon()
getMenuItem
(String columnKey) protected int
getMenuItemIndexByColumnKey
(String columnKey) getText()
com.vaadin.flow.component.HasText.WhiteSpace
protected JmixMenuBar
protected void
boolean
boolean
void
Removes all menu itemsvoid
removeMenuItem
(DataGridColumn<?> column) Removes menu item from dropdown menu for specified referenced column.void
removeMenuItem
(String columnKey) Removes menu item from dropdown menu by column key of referenced column.protected void
void
setApplicationContext
(org.springframework.context.ApplicationContext applicationContext) void
setGrid
(com.vaadin.flow.component.grid.Grid<?> grid) Sets a grid which columns will be managed by this component.void
setHideAllEnabled
(boolean enabled) Sets whether "Hide all" item should be visible.void
setIcon
(com.vaadin.flow.component.icon.Icon icon) Sets component icon.void
setShowAllEnabled
(boolean enabled) Sets whether "Show all" item should be visible.void
void
setWhiteSpace
(com.vaadin.flow.component.HasText.WhiteSpace value) protected void
protected void
Methods inherited from class com.vaadin.flow.component.Composite
getChildren, getContent, getElement
Methods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisible
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListener
Methods inherited from interface com.vaadin.flow.component.BlurNotifier
addBlurListener
Methods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListener
Methods inherited from interface com.vaadin.flow.component.Focusable
addFocusShortcut, blur, focus, getTabIndex, setTabIndex
Methods inherited from interface com.vaadin.flow.component.FocusNotifier
addFocusListener
Methods inherited from interface com.vaadin.flow.component.HasElement
getElement
Methods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabled
Methods inherited from interface com.vaadin.flow.component.shared.HasOverlayClassName
getOverlayClassName, setOverlayClassName
Methods inherited from interface com.vaadin.flow.component.HasSize
getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull
Methods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
Methods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeName
Methods inherited from interface com.vaadin.flow.component.shared.HasThemeVariant
addThemeVariants, removeThemeVariants
-
Field Details
-
ATTRIBUTE_JMIX_ROLE_NAME
- See Also:
-
ATTRIBUTE_JMIX_ROLE_VALUE
- See Also:
-
applicationContext
protected org.springframework.context.ApplicationContext applicationContext -
messages
-
messageTools
-
metadataTools
-
dropdownItem
-
icon
protected com.vaadin.flow.component.icon.Icon icon -
grid
protected com.vaadin.flow.component.grid.Grid<?> grid -
header
-
-
Constructor Details
-
JmixGridColumnVisibility
public JmixGridColumnVisibility()
-
-
Method Details
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContext
in interfaceorg.springframework.context.ApplicationContextAware
- Throws:
org.springframework.beans.BeansException
-
afterPropertiesSet
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
Exception
-
autowireDependencies
protected void autowireDependencies() -
initHeader
protected void initHeader() -
initContent
- Overrides:
initContent
in classcom.vaadin.flow.component.Composite<JmixMenuBar>
-
setIcon
public void setIcon(@Nullable com.vaadin.flow.component.icon.Icon icon) Sets component icon.- Parameters:
icon
- icon to set
-
updateIconSlot
protected void updateIconSlot() -
updateTheme
protected void updateTheme() -
getIcon
@Nullable public com.vaadin.flow.component.icon.Icon getIcon()- Returns:
- icon of the component
-
setGrid
public void setGrid(com.vaadin.flow.component.grid.Grid<?> grid) Sets a grid which columns will be managed by this component. The grid must be an instance of DataGrid or TreeDataGrid.- Parameters:
grid
- the grid to set
-
checkGridType
protected void checkGridType(com.vaadin.flow.component.grid.Grid<?> grid) -
getGrid
public com.vaadin.flow.component.grid.Grid<?> getGrid()- Returns:
- grid instance which columns are managed by this component
-
addMenuItem
Adds new menu item, which allows to toggle visibility of specified column, to the end of dropdown menu. Item text will be copied from column header text.- Parameters:
column
- column to manage
-
checkColumnOwner
-
getColumnHeaderText
-
addMenuItemInternal
-
addMenuItem
Adds new column item, which allows to toggle visibility of specified column, to the end of dropdown menu.- Parameters:
column
- column to managetext
- item text
-
addMenuItemAtIndex
Adds new menu item, which allows to toggle visibility of specified column, to dropdown menu. The item will be placed using specified index. Item text will be copied from column header text.- Parameters:
column
- column to manageindex
- index of new item
-
addMenuItemAtIndex
Adds new menu item, which allows to toggle visibility of specified column, to dropdown menu. The item will be placed using specified index.- Parameters:
column
- column to manageindex
- index of new itemtext
- item text
-
addMenuItem
Adds new menu item, which allows to toggle visibility of the column with specified key, to the end of dropdown menu. Item text will be copied from column header text.- Parameters:
columnKey
- key of a column to manage
-
getColumnByKey
-
addMenuItem
Adds new menu item, which allows to toggle visibility of the column with specified key, to the end of dropdown menu.- Parameters:
columnKey
- key of a column to managetext
- item text
-
addMenuItemAtIndex
Adds new menu item, which allows to toggle visibility of the column with specified key, to dropdown menu. The item will be placed using specified index. Item text will be copied from column header text.- Parameters:
columnKey
- key of a column to manageindex
- index of new item
-
addMenuItemAtIndex
Adds new menu item, which allows to toggle visibility of the column with specified key, to dropdown menu. The item will be placed using specified index.- Parameters:
columnKey
- key of a column to managetext
- item textindex
- index of new item
-
setShowAllEnabled
public void setShowAllEnabled(boolean enabled) Sets whether "Show all" item should be visible.- Parameters:
enabled
- flag indicating whether "Show all" item should be visible
-
isShowAllEnabled
public boolean isShowAllEnabled()- Returns:
- true/false if "Show all" item is visible/not visible
-
setHideAllEnabled
public void setHideAllEnabled(boolean enabled) Sets whether "Hide all" item should be visible.- Parameters:
enabled
- flag indicating whether "Hide all" item should be visible
-
isHideAllEnabled
public boolean isHideAllEnabled()- Returns:
- true/false if "Hide all" item is visible/not visible
-
removeMenuItem
Removes menu item from dropdown menu by column key of referenced column.- Parameters:
columnKey
- column key of data grid column
-
removeMenuItemFromMenu
-
getMenuItemIndexByColumnKey
- Returns:
- index of menu item or -1 if no item was found for the column key
-
removeMenuItem
Removes menu item from dropdown menu for specified referenced column.- Parameters:
column
- referenced data grid column
-
getMenuItem
- Parameters:
columnKey
- column key of referenced data grid column- Returns:
- menu item by column key of referenced data grid column
-
getMenuItems
- Returns:
- all menu items
-
removeAllMenuItems
public void removeAllMenuItems()Removes all menu items -
setText
- Specified by:
setText
in interfacecom.vaadin.flow.component.HasText
-
getText
- Specified by:
getText
in interfacecom.vaadin.flow.component.HasText
-
setWhiteSpace
public void setWhiteSpace(com.vaadin.flow.component.HasText.WhiteSpace value) - Specified by:
setWhiteSpace
in interfacecom.vaadin.flow.component.HasText
-
getWhiteSpace
public com.vaadin.flow.component.HasText.WhiteSpace getWhiteSpace()- Specified by:
getWhiteSpace
in interfacecom.vaadin.flow.component.HasText
-