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
Nested ClassesModifier and TypeClassDescriptionprotected classstatic interfaceRepresents an item which allows to toggle column visibility.protected static classNested 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
FieldsModifier and TypeFieldDescriptionprotected org.springframework.context.ApplicationContextprotected static final Stringprotected static final Stringprotected JmixMenuItemprotected com.vaadin.flow.component.grid.Grid<?>protected JmixGridColumnVisibility.Headerprotected com.vaadin.flow.component.icon.Iconprotected List<JmixGridColumnVisibility.MenuItemImpl>protected Messagesprotected MessageToolsprotected MetadataTools -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMenuItem(DataGridColumn<?> column) Adds new menu item, which allows to toggle visibility of specified column, to the end of dropdown menu.voidaddMenuItem(DataGridColumn<?> column, String text) Adds new column item, which allows to toggle visibility of specified column, to the end of dropdown menu.voidaddMenuItem(String columnKey) Adds new menu item, which allows to toggle visibility of the column with specified key, to the end of dropdown menu.voidaddMenuItem(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.voidaddMenuItemAtIndex(DataGridColumn<?> column, int index) Adds new menu item, which allows to toggle visibility of specified column, to dropdown menu.voidaddMenuItemAtIndex(DataGridColumn<?> column, String text, int index) Adds new menu item, which allows to toggle visibility of specified column, to dropdown menu.voidaddMenuItemAtIndex(String columnKey, int index) Adds new menu item, which allows to toggle visibility of the column with specified key, to dropdown menu.voidaddMenuItemAtIndex(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 voidaddMenuItemInternal(DataGridColumn<?> column, String text, Integer index) voidprotected voidprotected voidcheckColumnOwner(DataGridColumn<?> column) protected voidcheckGridType(com.vaadin.flow.component.grid.Grid<?> grid) protected DataGridColumn<?>getColumnByKey(String columnKey) protected StringgetColumnHeaderText(DataGridColumn<?> column) com.vaadin.flow.component.grid.Grid<?>getGrid()com.vaadin.flow.component.icon.IcongetIcon()getMenuItem(String columnKey) protected intgetMenuItemIndexByColumnKey(String columnKey) getText()com.vaadin.flow.component.HasText.WhiteSpaceprotected JmixMenuBarprotected voidbooleanbooleanvoidRemoves all menu itemsvoidremoveMenuItem(DataGridColumn<?> column) Removes menu item from dropdown menu for specified referenced column.voidremoveMenuItem(String columnKey) Removes menu item from dropdown menu by column key of referenced column.protected voidvoidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetGrid(com.vaadin.flow.component.grid.Grid<?> grid) Sets a grid which columns will be managed by this component.voidsetHideAllEnabled(boolean enabled) Sets whether "Hide all" item should be visible.voidsetIcon(com.vaadin.flow.component.icon.Icon icon) Sets component icon.voidsetShowAllEnabled(boolean enabled) Sets whether "Show all" item should be visible.voidvoidsetWhiteSpace(com.vaadin.flow.component.HasText.WhiteSpace value) protected voidprotected voidMethods inherited from class com.vaadin.flow.component.Composite
getChildren, getContent, getElementMethods 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, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.BlurNotifier
addBlurListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.Focusable
addFocusShortcut, blur, focus, getTabIndex, setTabIndexMethods inherited from interface com.vaadin.flow.component.FocusNotifier
addFocusListenerMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabledMethods inherited from interface com.vaadin.flow.component.shared.HasOverlayClassName
getOverlayClassName, setOverlayClassNameMethods 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, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeNameMethods 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:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception
-
autowireDependencies
protected void autowireDependencies() -
initHeader
protected void initHeader() -
initContent
- Overrides:
initContentin 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:
setTextin interfacecom.vaadin.flow.component.HasText
-
getText
- Specified by:
getTextin interfacecom.vaadin.flow.component.HasText
-
setWhiteSpace
public void setWhiteSpace(com.vaadin.flow.component.HasText.WhiteSpace value) - Specified by:
setWhiteSpacein interfacecom.vaadin.flow.component.HasText
-
getWhiteSpace
public com.vaadin.flow.component.HasText.WhiteSpace getWhiteSpace()- Specified by:
getWhiteSpacein interfacecom.vaadin.flow.component.HasText
-