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 Classes
    Modifier and Type
    Class
    Description
    protected 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

    Fields
    Modifier and Type
    Field
    Description
    protected org.springframework.context.ApplicationContext
     
    protected static final String
     
    protected static final String
     
    protected JmixMenuItem
     
    protected com.vaadin.flow.component.grid.Grid<?>
     
     
    protected com.vaadin.flow.component.icon.Icon
     
     
    protected Messages
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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
     
    void
     
    protected void
     
    protected void
     
    protected void
    checkGridType(com.vaadin.flow.component.grid.Grid<?> grid)
     
    protected DataGridColumn<?>
     
    protected String
     
    com.vaadin.flow.component.grid.Grid<?>
     
    com.vaadin.flow.component.icon.Icon
     
    getMenuItem(String columnKey)
     
    protected int
     
     
     
    com.vaadin.flow.component.HasText.WhiteSpace
     
    protected JmixMenuBar
     
    protected void
     
    boolean
     
    boolean
     
    void
    Removes all menu items
    void
    Removes menu item from dropdown menu for specified referenced column.
    void
    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

    Methods inherited from interface io.jmix.flowui.kit.component.HasTitle

    getTitle, setTitle
  • Field Details

  • 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 interface org.springframework.context.ApplicationContextAware
      Throws:
      org.springframework.beans.BeansException
    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      Exception
    • autowireDependencies

      protected void autowireDependencies()
    • initHeader

      protected void initHeader()
    • initContent

      protected JmixMenuBar initContent()
      Overrides:
      initContent in class com.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

      public void addMenuItem(DataGridColumn<?> column)
      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

      protected void checkColumnOwner(DataGridColumn<?> column)
    • getColumnHeaderText

      protected String getColumnHeaderText(DataGridColumn<?> column)
    • addMenuItemInternal

      protected void addMenuItemInternal(DataGridColumn<?> column, String text, @Nullable Integer index)
    • addMenuItem

      public void addMenuItem(DataGridColumn<?> column, String text)
      Adds new column item, which allows to toggle visibility of specified column, to the end of dropdown menu.
      Parameters:
      column - column to manage
      text - item text
    • addMenuItemAtIndex

      public void addMenuItemAtIndex(DataGridColumn<?> column, int index)
      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 manage
      index - index of new item
    • addMenuItemAtIndex

      public void addMenuItemAtIndex(DataGridColumn<?> column, String text, int index)
      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 manage
      index - index of new item
      text - item text
    • addMenuItem

      public 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. Item text will be copied from column header text.
      Parameters:
      columnKey - key of a column to manage
    • getColumnByKey

      protected DataGridColumn<?> getColumnByKey(String columnKey)
    • addMenuItem

      public 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.
      Parameters:
      columnKey - key of a column to manage
      text - item text
    • addMenuItemAtIndex

      public void addMenuItemAtIndex(String columnKey, int index)
      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 manage
      index - index of new item
    • addMenuItemAtIndex

      public 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. The item will be placed using specified index.
      Parameters:
      columnKey - key of a column to manage
      text - item text
      index - 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

      public void removeMenuItem(String columnKey)
      Removes menu item from dropdown menu by column key of referenced column.
      Parameters:
      columnKey - column key of data grid column
    • removeMenuItemFromMenu

      protected void removeMenuItemFromMenu(JmixGridColumnVisibility.MenuItemImpl menuItem)
    • getMenuItemIndexByColumnKey

      protected int getMenuItemIndexByColumnKey(String columnKey)
      Returns:
      index of menu item or -1 if no item was found for the column key
    • removeMenuItem

      public void removeMenuItem(DataGridColumn<?> column)
      Removes menu item from dropdown menu for specified referenced column.
      Parameters:
      column - referenced data grid column
    • getMenuItem

      @Nullable public JmixGridColumnVisibility.MenuItem getMenuItem(String columnKey)
      Parameters:
      columnKey - column key of referenced data grid column
      Returns:
      menu item by column key of referenced data grid column
    • getMenuItems

      public List<JmixGridColumnVisibility.MenuItem> getMenuItems()
      Returns:
      all menu items
    • removeAllMenuItems

      public void removeAllMenuItems()
      Removes all menu items
    • setText

      public void setText(String text)
      Specified by:
      setText in interface com.vaadin.flow.component.HasText
    • getText

      public String getText()
      Specified by:
      getText in interface com.vaadin.flow.component.HasText
    • setWhiteSpace

      public void setWhiteSpace(com.vaadin.flow.component.HasText.WhiteSpace value)
      Specified by:
      setWhiteSpace in interface com.vaadin.flow.component.HasText
    • getWhiteSpace

      public com.vaadin.flow.component.HasText.WhiteSpace getWhiteSpace()
      Specified by:
      getWhiteSpace in interface com.vaadin.flow.component.HasText