Class ListGrid

All Implemented Interfaces:
Animatable<ListGrid>, CanDrop<ListGrid>, FilterBarFiltering<ListGrid>, Draggable<ListGrid>, Fetchable<ListGrid>, HandleHotKey<ListGrid>, BasedOnDataDescriptor<ListGrid>, Exportable<Fetchable<ListGrid>>, Filterable<ListGrid>

ListGrid component

The ListGrid visualizes data in a grid format. The component is a data visualization component and cannot be used to modify data. Data values are displayed in cells as defined by column settings. The component enables you to format data by using the ListGridCellFormatter. Moreover, you can also specify a custom renderer. The rendered component is displayed in the cell. The rendered component can be either a compound one or a container. This enables you to add several components to the cell. In order to use the renderer, you must implement the ListGridCellRenderer interface. Formatter or renderer classes are passed to the specific column by calling the ListGridColumn.setRenderer(ListGridCellRenderer) and ListGridColumn.setFormatter(ListGridCellFormatter) methods.

The component can be built using a DataDescriptor. Column parameterization is done using the DataDescriptor. The component automatically creates and sets the necessary columns; queries and displays data in the grid.

Displayed data can be sorted by clicking on the grid header. If yes, specify if the sort is done using a single column or multiple columns.

The component enables you to filter data. There are two types of filter: default filter and custom filter. The default one is implemented from code. It is always valid. The user is not allowed to modify the default filter. You can also specify a custom filter for the component. If a filter component is displayed, the user is able to set filter criteria. Custom filter criteria are joined to the default filter criteria with an AND operator. The component supports the use of SimpleFilter, TextFilter, AdvancedFilter and AdaptiveFilter. You can also use a custom filter implementation. Use the method setFilterType(FilterType) to set if the filter is displayed.

The component supports inserting new records, or modifying and deleting previous records. Modifications are saved to the database within a single transaction. Concurrent modifications are only committed to the database if all of them are successful.

The user is allowed to modify column width and order, hide and unhide columns.

The component is capable of querying data from the DataDescriptor automatically or from code. Data query is done using the default lazy fetch implementation. Lazy fetch means getting a small amount of data at a time, to maintain normal operation speed. Once the user scrolls down to the bottom of the component and all the data has been visualized, a new amount of data is queried and visualized. Thus, the user never waits for the data to be visualized, but can access all the necessary data at every time.

You can specify a fixed width and height for the component. By default, the component automatically fits to the screen.

The component enables you to export grid data. In case of data export, all available data in the database is exported. The possible export formats are Microsoft Excel, CSV, TBS or text file. The implementation of data export is included in the grid component, but it is only accessible from code (hidden from the user).

Supported events:

AnimationStart AnimationEnd, Drop, DragStart, DragEnd HotKey, RowClick, RowDoubleClick , HeaderClick , HeaderDoubleClick , NextPageRequest , FetchDone

Since:
4.0
Author:
JBStrap
See Also:
  • Field Details

  • Constructor Details

    • ListGrid

      public ListGrid()
      Creates an empty list grid.
    • ListGrid

      public ListGrid(String language)
      Creates an empty list grid using the specified language code.
      Parameters:
      language - Language code according to which the component is created If not specified or null is set, the framework’s default language code is used. The default language of the framework is set via the JBStrap parameter JBStrapParamType.DEFAULT_LANGUAGE.
    • ListGrid

      public ListGrid(String id, String language)
      Creates an empty list grid using the specified language code.
      Parameters:
      id - The component ID. The ID specified here will appear in the HTML tag as an ID attribute. If there are multiple components displayed, that have the same ID, the ID numbers will be numbered, in the order they are displayed. (For example, if the ID is 'COMPONENT' then it will be numbered like this: COMPONENT, COMPONENT_1, COMPONENT_2 etc.)
      language - Language code according to which the component is created If not specified or null is set, the framework’s default language code is used. The default language of the framework is set via the JBStrap parameter JBStrapParamType.DEFAULT_LANGUAGE.
    • ListGrid

      public ListGrid(DataDescriptor dataDescriptor)

      Creates a list grid based on the language code specified in the DataDescriptor.

      The method creates the list grid component and adds the DataDescriptor columns to the grid.

      DataDescriptor columns are created based on the following:

      The column type is determined using the DataDescriptor type as in the below table:

      Data source column typeCreated column
      DataDescriptorColumnDatatype.DATEThe created column has the type ListGridColumnType.DATE. By default, dates are center-aligned and displayed using the formatter ListGridDateFormatter.
      DataDescriptorColumnDatatype.DATETIMEThe created column has the type ListGridColumnType.DATETIME. By default, time is center-aligned and displayed using the formatter ListGridDateTimeFormatter.
      DataDescriptorColumnDatatype.INTEGER
      DataDescriptorColumnDatatype.LONG
      DataDescriptorColumnDatatype.DOUBLE
      The created column has the type ListGridColumnType.NUMBER. Numbers are aligned to the right and displayed using the formatter ListGridNumberFormatter.
      DataDescriptorColumnDatatype.BOOLEANThe created column has the type ListGridColumnType.BOOLEAN. Dates are center-aligned and displayed using the formatter ListGridBooleanFormatter.
      DataDescriptorColumnDatatype.TEXTThe created column has the type ListGridColumnType.TEXT. Texts are aligned to the left and no formatter is used to display the column.
      You can use DataDescriptor parameters to specify the default settings of the column and other settings. The component uses the following parameters of the DataDescriptor column:
      • DataDescriptorColumn.getColumnName() - The name of the created list grid column is the same as the DataDescriptor column name
      • DataDescriptorColumn.getTitle(String) - List grid column header text corresponding to the DataDescriptor header text
      • DataDescriptorColumn.getDatatype() - The column type is determined using the DataDescriptor. DataDescriptor column type is set using the enum ListGridColumnType.
      • MetaParamName.FORMATTER - You can specify a custom formatter using this parameter. Specify the full name of formatter in the parameter. If the parameter is not specified, the default formatter for the column data type is used.
      • MetaParamName.DATE_FORMAT - This parameter specifies the displayed date format. If the column has the type DATE or DATETIME and the column’s formatter implements the ListGridCellFormatterCustomFormat interface, the format specified in the parameter is passed to the formatter. If the parameter is not specified, the default date format set in the parameter JBStrapParamType.DATE_FORMAT is used for a DATE column. The default date time format set by the JBStrapParamType.DATETIME_FORMAT parameter is used for the DATETIME column.
      • MetaParamName.FORMATTER - You can specify the column width by setting this parameter. Width is specified using the CSS3. If the parameter is not specified, column width is automatically defined. All columns are set to the same width and fit to the width of the grid. Columns are set to a minimum width of 150 pixels. If you have many columns in the grid, it is horizontally scrollable.
      • MetaParamName.ALIGN - This parameter specifies the alignment of data within the columns. If the parameter is not specified, data alignment is done based on the default alignment for the column data type. You can use the parameter to provide the following values:

        Parameters:
        dataDescriptor - DataDescriptor instance used for building the ListGrid component
      • ListGrid

        public ListGrid(String id, DataDescriptor dataDescriptor)

        Creates a list grid based on the language code specified in the DataDescriptor.

        The method creates the list grid component and adds the DataDescriptor columns to the grid.

        DataDescriptor columns are created based on the following:

        The column type is determined using the DataDescriptor type as in the below table:

      Data source column typeCreated column
      DataDescriptorColumnDatatype.DATEThe created column has the type ListGridColumnType.DATE. By default, dates are center-aligned and displayed using the formatter ListGridDateFormatter.
      DataDescriptorColumnDatatype.DATETIMEThe created column has the type ListGridColumnType.DATETIME. By default, time is center-aligned and displayed using the formatter ListGridDateTimeFormatter.
      DataDescriptorColumnDatatype.INTEGER
      DataDescriptorColumnDatatype.LONG
      DataDescriptorColumnDatatype.DOUBLE
      The created column has the type ListGridColumnType.NUMBER. Numbers are aligned to the right and displayed using the formatter ListGridNumberFormatter.
      DataDescriptorColumnDatatype.BOOLEANThe created column has the type ListGridColumnType.BOOLEAN. Dates are center-aligned and displayed using the formatter ListGridBooleanFormatter.
      DataDescriptorColumnDatatype.TEXTThe created column has the type ListGridColumnType.TEXT. Texts are aligned to the left and no formatter is used to display the column.
      You can use DataDescriptor parameters to specify the default settings of the column and other settings. The component uses the following parameters of the DataDescriptor column:
      • DataDescriptorColumn.getColumnName() - The name of the created list grid column is the same as the DataDescriptor column name
      • DataDescriptorColumn.getTitle(String) - List grid column header text corresponding to the DataDescriptor header text
      • DataDescriptorColumn.getDatatype() - The column type is determined using the DataDescriptor. DataDescriptor column type is set using the enum ListGridColumnType.
      • MetaParamName.FORMATTER - You can specify a custom formatter using this parameter. Specify the full name of formatter in the parameter. If the parameter is not specified, the default formatter for the column data type is used.
      • MetaParamName.DATE_FORMAT - This parameter specifies the displayed date format. If the column has the type DATE or DATETIME and the column’s formatter implements the ListGridCellFormatterCustomFormat interface, the format specified in the parameter is passed to the formatter. If the parameter is not specified, the default date format set in the parameter JBStrapParamType.DATE_FORMAT is used for a DATE column. The default date time format set by the JBStrapParamType.DATETIME_FORMAT parameter is used for the DATETIME column.
      • MetaParamName.FORMATTER - You can specify the column width by setting this parameter. Width is specified using the CSS3. If the parameter is not specified, column width is automatically defined. All columns are set to the same width and fit to the width of the grid. Columns are set to a minimum width of 150 pixels. If you have many columns in the grid, it is horizontally scrollable.
      • MetaParamName.ALIGN - This parameter specifies the alignment of data within the columns. If the parameter is not specified, data alignment is done based on the default alignment for the column data type. You can use the parameter to provide the following values:

        Parameters:
        id - The component ID. The ID specified here will appear in the HTML tag as an ID attribute. If there are multiple components displayed, that have the same ID, the ID numbers will be numbered, in the order they are displayed. (For example, if the ID is 'COMPONENT' then it will be numbered like this: COMPONENT, COMPONENT_1, COMPONENT_2 etc.)
        dataDescriptor - DataDescriptor instance used for building the ListGrid component
      • ListGrid

        public ListGrid(DataDescriptor dataDescriptor, String language)

        Creates a list grid based on the language code specified in the DataDescriptor.

        The method creates the list grid component and adds the DataDescriptor columns to the grid.

        DataDescriptor columns are created based on the following:

        The column type is determined using the DataDescriptor type as in the below table:

      Data source column typeCreated column
      DataDescriptorColumnDatatype.DATEThe created column has the type ListGridColumnType.DATE. By default, dates are center-aligned and displayed using the formatter ListGridDateFormatter.
      DataDescriptorColumnDatatype.DATETIMEThe created column has the type ListGridColumnType.DATETIME. By default, time is center-aligned and displayed using the formatter ListGridDateTimeFormatter.
      DataDescriptorColumnDatatype.INTEGER
      DataDescriptorColumnDatatype.LONG
      DataDescriptorColumnDatatype.DOUBLE
      The created column has the type ListGridColumnType.NUMBER. Numbers are aligned to the right and displayed using the formatter ListGridNumberFormatter.
      DataDescriptorColumnDatatype.BOOLEANThe created column has the type ListGridColumnType.BOOLEAN. Dates are center-aligned and displayed using the formatter ListGridBooleanFormatter.
      DataDescriptorColumnDatatype.TEXTThe created column has the type ListGridColumnType.TEXT. Texts are aligned to the left and no formatter is used to display the column.
      You can use DataDescriptor parameters to specify the default settings of the column and other settings. The component uses the following parameters of the DataDescriptor column:
      • DataDescriptorColumn.getColumnName() - The name of the created list grid column is the same as the DataDescriptor column name
      • DataDescriptorColumn.getTitle(String) - List grid column header text corresponding to the DataDescriptor header text
      • DataDescriptorColumn.getDatatype() - The column type is determined using the DataDescriptor. DataDescriptor column type is set using the enum ListGridColumnType.
      • MetaParamName.FORMATTER - You can specify a custom formatter using this parameter. Specify the full name of formatter in the parameter. If the parameter is not specified, the default formatter for the column data type is used.
      • MetaParamName.DATE_FORMAT - This parameter specifies the displayed date format. If the column has the type DATE or DATETIME and the column’s formatter implements the ListGridCellFormatterCustomFormat interface, the format specified in the parameter is passed to the formatter. If the parameter is not specified, the default date format set in the parameter JBStrapParamType.DATE_FORMAT is used for a DATE column. The default date time format set by the JBStrapParamType.DATETIME_FORMAT parameter is used for the DATETIME column.
      • MetaParamName.FORMATTER - You can specify the column width by setting this parameter. Width is specified using the CSS3. If the parameter is not specified, column width is automatically defined. All columns are set to the same width and fit to the width of the grid. Columns are set to a minimum width of 150 pixels. If you have many columns in the grid, it is horizontally scrollable.
      • MetaParamName.ALIGN - This parameter specifies the alignment of data within the columns. If the parameter is not specified, data alignment is done based on the default alignment for the column data type. You can use the parameter to provide the following values:

        Parameters:
        dataDescriptor - DataDescriptor instance used for building the ListGrid component
        language - Language code according to which the component is created If not specified or null is set, the framework’s default language code is used. The default language of the framework is set via the JBStrap parameter JBStrapParamType.DEFAULT_LANGUAGE.
      • ListGrid

        public ListGrid(String id, DataDescriptor dataDescriptor, String language)

        Creates a list grid based on the language code specified in the DataDescriptor.

        The method creates the list grid component and adds the DataDescriptor columns to the grid.

        DataDescriptor columns are created based on the following:

        The column type is determined using the DataDescriptor type as in the below table:

      Data source column typeCreated column
      DataDescriptorColumnDatatype.DATEThe created column has the type ListGridColumnType.DATE. By default, dates are center-aligned and displayed using the formatter ListGridDateFormatter.
      DataDescriptorColumnDatatype.DATETIMEThe created column has the type ListGridColumnType.DATETIME. By default, time is center-aligned and displayed using the formatter ListGridDateTimeFormatter.
      DataDescriptorColumnDatatype.INTEGER
      DataDescriptorColumnDatatype.LONG
      DataDescriptorColumnDatatype.DOUBLE
      The created column has the type ListGridColumnType.NUMBER. Numbers are aligned to the right and displayed using the formatter ListGridNumberFormatter.
      DataDescriptorColumnDatatype.BOOLEANThe created column has the type ListGridColumnType.BOOLEAN. Dates are center-aligned and displayed using the formatter ListGridBooleanFormatter.
      DataDescriptorColumnDatatype.TEXTThe created column has the type ListGridColumnType.TEXT. Texts are aligned to the left and no formatter is used to display the column.
      You can use DataDescriptor parameters to specify the default settings of the column and other settings. The component uses the following parameters of the DataDescriptor column:
      • DataDescriptorColumn.getColumnName() - The name of the created list grid column is the same as the DataDescriptor column name
      • DataDescriptorColumn.getTitle(String) - List grid column header text corresponding to the DataDescriptor header text
      • DataDescriptorColumn.getDatatype() - The column type is determined using the DataDescriptor. DataDescriptor column type is set using the enum ListGridColumnType.
      • MetaParamName.FORMATTER - You can specify a custom formatter using this parameter. Specify the full name of formatter in the parameter. If the parameter is not specified, the default formatter for the column data type is used.
      • MetaParamName.DATE_FORMAT - This parameter specifies the displayed date format. If the column has the type DATE or DATETIME and the column’s formatter implements the ListGridCellFormatterCustomFormat interface, the format specified in the parameter is passed to the formatter. If the parameter is not specified, the default date format set in the parameter JBStrapParamType.DATE_FORMAT is used for a DATE column. The default date time format set by the JBStrapParamType.DATETIME_FORMAT parameter is used for the DATETIME column.
      • MetaParamName.FORMATTER - You can specify the column width by setting this parameter. Width is specified using the CSS3. If the parameter is not specified, column width is automatically defined. All columns are set to the same width and fit to the width of the grid. Columns are set to a minimum width of 150 pixels. If you have many columns in the grid, it is horizontally scrollable.
      • MetaParamName.ALIGN - This parameter specifies the alignment of data within the columns. If the parameter is not specified, data alignment is done based on the default alignment for the column data type. You can use the parameter to provide the following values:

        Parameters:
        id - The component ID. The ID specified here will appear in the HTML tag as an ID attribute. If there are multiple components displayed, that have the same ID, the ID numbers will be numbered, in the order they are displayed. (For example, if the ID is 'COMPONENT' then it will be numbered like this: COMPONENT, COMPONENT_1, COMPONENT_2 etc.)
        dataDescriptor - DataDescriptor instance used for building the ListGrid component
        language - Language code according to which the component is created If not specified or null is set, the framework’s default language code is used. The default language of the framework is set via the JBStrap parameter JBStrapParamType.DEFAULT_LANGUAGE.
    • Method Details

      • init

        public void init() throws JavaScriptLoadError
        Description copied from class: Component
        The component initialization method.

        Empty method, only needs to be overwritten when making a custom component, that needs to call an initializing JavaScript on the client side. The method is called by the framework after the component is drawn, but before the afterDraw() method. The use of this method during application development is not allowed. This method is meant for inner use only.

        Overrides:
        init in class Component<ListGrid>
        Throws:
        JavaScriptLoadError - If there was a JavaScript error during the initialization.
      • setDataDescriptor

        public final ListGrid setDataDescriptor(DataDescriptor dataDescriptor)
        Sets a DataDescriptor for the list grid component, creates and adds the DataDescriptor columns to the grid. If a new DataDescriptor is added to the list grid, all the columns are removed from the grid and only those in the specified DataDescriptor are displayed.

        The column type is determined using the DataDescriptor type as in the below table:

    • Data source column typeCreated column
      DataDescriptorColumnDatatype.DATEThe created column has the type ListGridColumnType.DATE. By default, dates are center-aligned and displayed using the formatter ListGridDateFormatter.
      DataDescriptorColumnDatatype.DATETIMEThe created column has the type ListGridColumnType.DATETIME. By default, time is center-aligned and displayed using the formatter ListGridDateTimeFormatter.
      DataDescriptorColumnDatatype.INTEGER
      DataDescriptorColumnDatatype.LONG
      DataDescriptorColumnDatatype.DOUBLE
      The created column has the type ListGridColumnType.NUMBER. Numbers are aligned to the right and displayed using the formatter ListGridNumberFormatter.
      DataDescriptorColumnDatatype.BOOLEANThe created column has the type ListGridColumnType.BOOLEAN. Dates are center-aligned and displayed using the formatter ListGridBooleanFormatter.
      DataDescriptorColumnDatatype.TEXTThe created column has the type ListGridColumnType.TEXT. Texts are aligned to the left and the column does not have a formatter class.
      DataDescriptor column parameters are used to override the default settings of the newly created column and also to specify other settings. The component uses the following parameters of the DataDescriptor column:
      • DataDescriptorColumn.getColumnName() - The name of the created list grid column is the same as the DataDescriptor column name
      • DataDescriptorColumn.getTitle(String) - List grid column header text corresponding to the DataDescriptor header text
      • DataDescriptorColumn.getDatatype() - The column type is determined using the DataDescriptor. DataDescriptor column type is set using the enum ListGridColumnType.
      • MetaParamName.FORMATTER - You can specify a custom formatter using this parameter. Specify the full name of the formatter in the parameter. If the parameter is not specified, the default formatter for the column’s data type is used.
      • MetaParamName.DATE_FORMAT - This parameter specifies the displayed date format. If the column has the type DATE or DATETIME and the column’s formatter implements the ListGridCellFormatterCustomFormat interface, the format specified in the parameter is passed to the formatter. If the parameter is not specified, the default date format set in the parameter JBStrapParamType.DATE_FORMAT is used for a DATE column. The default date time format set by the JBStrapParamType.DATETIME_FORMAT parameter is used for the DATETIME column.
      • MetaParamName.WIDTH - This parameter specifies column width. Width is specified using the CSS3. If the parameter is not specified, column width is automatically defined. All columns will have the same width and fit to the total width of the grid. The minimum width for the columns is 150 pixels. If there is a large amount of columns, the grid can be horizontally scrolled.
      • MetaParamName.ALIGN - This parameter specifies the alignment of data within the columns. If the parameter is not specified, data alignment is done using the default alignment for the column. You can use the parameter to provide the following values:

        Specified by:
        setDataDescriptor in interface BasedOnDataDescriptor<ListGrid>
        Parameters:
        dataDescriptor - DataDescriptor instance used for building the ListGrid component
        Returns:
        List grid component
      • setDataDescriptor

        public final ListGrid setDataDescriptor(DataDescriptor dataDescriptor, boolean buildColumns)
        Sets the DataDescriptor for the list grid and checks if the columns for the list grid should be created.

        The column type is determined using the DataDescriptor column type as in the following table:

      Data source column typeCreated column
      DataDescriptorColumnDatatype.DATEThe created column has the type ListGridColumnType.DATE. By default, dates are center-aligned and displayed using the formatter ListGridDateFormatter.
      DataDescriptorColumnDatatype.DATETIMEThe created column has the type ListGridColumnType.DATETIME. By default, time is center-aligned and displayed using the formatter ListGridDateTimeFormatter.
      DataDescriptorColumnDatatype.INTEGER
      DataDescriptorColumnDatatype.LONG
      DataDescriptorColumnDatatype.DOUBLE
      The created column has the type ListGridColumnType.NUMBER. Numbers are aligned to the right and displayed using the formatter ListGridNumberFormatter.
      DataDescriptorColumnDatatype.BOOLEANThe created column has the type ListGridColumnType.BOOLEAN. Dates are center-aligned and displayed using the formatter ListGridBooleanFormatter.
      DataDescriptorColumnDatatype.TEXTThe created column has the type ListGridColumnType.TEXT. Texts by default are aligned to the left and no formatter class is set.
      DataDescriptor column parameters are used to override the default settings of the newly created column and also to specify other settings. The component uses the following DataDescriptor column parameters:
      • DataDescriptorColumn.getColumnName() - The name of the created list grid column is the same as the DataDescriptor column name
      • DataDescriptorColumn.getTitle(String) - List grid column header text corresponding to the DataDescriptor header text
      • DataDescriptorColumn.getDatatype() - The column type is determined using the DataDescriptor. DataDescriptor column type is set using the enum ListGridColumnType.
      • MetaParamName.FORMATTER - You can specify a custom formatter using this parameter. Specify the full name of the formatter in the parameter. If you do not specify a parameter, the default formatter for the column data type is used.
      • MetaParamName.DATE_FORMAT - This parameter specifies the displayed date format. If the column has the type DATE or DATETIME and the column’s formatter implements the ListGridCellFormatterCustomFormat interface, the format specified in the parameter is passed to the formatter. If the parameter is not specified, the default date format set in the parameter JBStrapParamType.DATE_FORMAT is used for a DATE column. The default date time format set by the JBStrapParamType.DATETIME_FORMAT parameter is used for the DATETIME column.
      • MetaParamName.WIDTH - This parameter specifies column width. Width is specified using the CSS3. If the parameter is not specified, the column width is automatically set. All columns will have a uniform width value and fit to the overall width of the grid. Columns have a minimum width of 150 pixels. If there is a large amount of columns, the grid can be scrolled horizontally.
      • MetaParamName.ALIGN - This parameter specifies the alignment of data within the columns. If the parameter is not specified, data alignment is done using the default alignment for the column. You can use the parameter to provide the following values:

        Parameters:
        dataDescriptor - DataDescriptor instance used for building the ListGrid component
        buildColumns - If true is specified, the columns in the DataDescriptor are built Otherwise, they are not built.
        Returns:
        List grid component
      • getDataDescriptor

        public DataDescriptor getDataDescriptor()
        Gets list grid DataDescriptor.
        Specified by:
        getDataDescriptor in interface BasedOnDataDescriptor<ListGrid>
        Returns:
        The DataDescriptor instance containing the list grid data, or null if no DataDescriptor is set for the list grid
      • addColumn

        public ListGrid addColumn(ListGridColumn column)
        Adds a new column to the list grid component.
        Parameters:
        column - An instance of the column to be added to the component The column specified here is displayed as the last one, following all other columns.
        Returns:
        List grid component
      • getColumns

        public final Collection<ListGridColumn> getColumns()
        Gets list grid columns.
        Returns:
        A list of columns in the list grid component, or null if the list grid does not contain any columns
      • getColumn

        public final ListGridColumn getColumn(String columnName)
        Gets a column of the list grid by its name.
        Parameters:
        columnName - Column name
        Returns:
        Column object with the specified name or null if there are no columns in the list grid by the specified name
      • getColumnNames

        public final List<String> getColumnNames()
        Gets all the column names in the list grid.
        Returns:
        A list of columns in the list grid component, or null if the list grid does not contain any columns
      • removeColumn

        public final ListGrid removeColumn(String columnName)
        Removes a column from the list grid row by referencing its name.
        Parameters:
        columnName - Name of the column to be removed
        Returns:
        List grid component
      • hideColumn

        public final ListGrid hideColumn(String columnName)
        Hides a column in the grid. If a column is hidden, it is not visible to the user, but it is made visible again by using the context menu.
        Parameters:
        columnName - Column name to be hidden
        Returns:
        List grid component
      • showColumn

        public final ListGrid showColumn(String columnName)
        Unhides a previously hidden column in the grid. Once a column has been unhidden, it is visible to the user, but can be hidden again by using the context menu.
        Parameters:
        columnName - Column name to be displayed
        Returns:
        List grid component
      • setFilterType

        public final ListGrid setFilterType(FilterType filterType)
        Sets the grid filter type. If the filter type is specified, the filter component is displayed above the list grid. The user is able to filter the data with the help of the filter component.
        Parameters:
        filterType - Filter type for the list grid data Available filter types are listed in the enum FilterType. If null is specified, the user is unable to filter the list grid data.
        Returns:
        List grid component
      • isFilterable

        public final boolean isFilterable()
        Checks if the user is allowed to filter list grid data.
        Returns:
        If true, the user is allowed to filter list grid data. Otherwise false.
      • getFilterType

        public FilterType getFilterType()
        Gets the list grid filter type.
        Returns:
        List grid filter type
      • disableFilter

        public ListGrid disableFilter()
        Disables the list grid filter. If the method is called, the user will be unable to filter the displayed data and the filter component disappears.
        Returns:
        List grid component
      • setCustomFilter

        public final ListGrid setCustomFilter(Class<? extends BaseFilter<?>> filterClass)
        Sets a custom filter component for the list grid.
        Parameters:
        filterClass - Class implementing a custom filter component
        Returns:
        List grid component
        Throws:
        NullPointerException - Thrown if the specified name is null
        See Also:
      • showHeader

        public final ListGrid showHeader(boolean showHeader)
        Sets the list grid header visibility. By default, the list grid is visible. If set to invisible, column headers and the adaptive filter disappear.
        Parameters:
        showHeader - If true is set, the header is visible. If false, the header is hidden.
        Returns:
        List grid component
      • isHeaderShown

        public final boolean isHeaderShown()
        Checks if the header is visible.
        Returns:
        If true, the list grid header is visible, otherwise false
      • setMultiselect

        public final ListGrid setMultiselect(boolean multiselect)
        Sets the multiple selection option. By default, multiselect is disabled and the user is able to select only a single row. If enabled, the user is allowed to select multiple rows.
        Parameters:
        multiselect - If true is set, the multiselect option is enabled and the user is allowed to select multiple rows If false is set, the multiselect is disabled and the user is allowed to select only a single row
        Returns:
        List grid component
      • isMultiselect

        public final boolean isMultiselect()
        Sets if the multiselect option is enabled.
        Returns:
        If true, the multiselect option is enabled and the user is allowed the select multiple rows If false, the multiselect option is disabled and the user is allowed to select only a single row.
      • setAutoFetchData

        public ListGrid setAutoFetchData(boolean autoFetch)
        Sets automatic data fetch from the database. By default, this option is disabled and data fetch is performed automatically after the grid is displayed.
        Specified by:
        setAutoFetchData in interface Fetchable<ListGrid>
        Specified by:
        setAutoFetchData in interface Filterable<ListGrid>
        Parameters:
        autoFetch - If true is set, data fetch is automatically performed; otherwise data fetch must be implemented from code by calling the fetchData() method
        Returns:
        List grid component
      • isAutoFetchData

        public boolean isAutoFetchData()
        Sets the automatic data fetch.
        Specified by:
        isAutoFetchData in interface Fetchable<ListGrid>
        Specified by:
        isAutoFetchData in interface Filterable<ListGrid>
        Returns:
        If true is set, the data fetch is performed automatically, otherwise false is set
      • setHeaderContextMenuOrder

        public final ListGrid setHeaderContextMenuOrder(ListGridContextMenuOrder order)
        Sets the order of the columns in the context menu. By default, columns are displayed in the order they were added to the grid.
        Parameters:
        order - Column display order Available ordering sequences are listed in the enum ListGridContextMenuOrder. If null is set, the default order is used. Columns are displayed in the order they were added to the grid.
        Returns:
        List grid component
      • getHeaderContextMenuOrder

        public ListGridContextMenuOrder getHeaderContextMenuOrder()
        Gets the display order of the columns in the context menu.
        Returns:
        Column order in the context menu
      • setColumnResizable

        public ListGrid setColumnResizable(boolean columnResizable)
        Sets the column resize option. The default setting is that the user is allowed to resize columns.
        Parameters:
        columnResizable - If true, the user is allowed to resize columns
        Returns:
        List grid component
      • isColumnResizable

        public boolean isColumnResizable()
        Checks the resize option.
        Returns:
        If true, the user is allowed to resize columns
      • setColumnMovable

        public ListGrid setColumnMovable(boolean columnMovable)
        Sets the column rearrange option. The default setting is that the user is allowed to move the columns from one position to the other.
        Parameters:
        columnMovable - If true is set, the user is allowed to move columns in the grid Otherwise the columns cannot be moved.
        Returns:
        List grid component
      • isColumnMovable

        public boolean isColumnMovable()
        Checks the column rearrange option.
        Returns:
        If true, the user is allowed to move columns in the grid, otherwise false
      • setColumnListFilterable

        public ListGrid setColumnListFilterable(boolean filterable)
        Sets the column filter option in the context menu by specifying the column name. By default, the user is allowed to filter the columns in the context menu.
        Parameters:
        filterable - If true is set, the user is allowed to filter the columns in the context menu Otherwise, false is set.
        Returns:
        List grid component
      • isColumnListFilterable

        public boolean isColumnListFilterable()
        Sets column filter option to enabled.
        Returns:
        If true, the user is allowed to filter the columns in the context menu, otherwise false
      • setColumnListAutoClose

        public ListGrid setColumnListAutoClose(boolean autoClose)
        Sets if the context menu should automatically close if the user selects a column in the context menu. By default, the context menu automatically closes after a column is selected.
        Parameters:
        autoClose - If true is set, the context menu closes automatically after selecting a column If false was set, the context menu remains open and you can close it only by clicking on the “Close” button.
        Returns:
        List grid component
      • isColumnListAutoClose

        public boolean isColumnListAutoClose()
        Gets the automatic close option for the context menu.
        Returns:
        If true is set, the context menu automatically closes after selecting a column. Otherwise false.
      • setFetchType

        public ListGrid setFetchType(ListGridFetchType fetchType)
        List grid data fetch type. The default fetch setting is the ListGridFetchType.LAZY fetch type.
        Parameters:
        fetchType - Data fetch type Data fetch types are listed in the method ListGridFetchType. If null is specified, the default LAZY fetch type is used.
        Returns:
        List grid component
      • getFetchType

        public ListGridFetchType getFetchType()
        Gets the list grid fetch type.
        Returns:
        List grid fetch type
      • setDefaultCriteria

        public ListGrid setDefaultCriteria(Criteria defaultCriteria)
        Sets the filter criterion used to filter data. The filter criterion specified here cannot be modified by filter components. The criterion is used in all filter operations, joined to the user’s custom filter criterion with an AND operator.
        Parameters:
        defaultCriteria - Default filter criterion If null is set, there is no default filter criterion for the grid.
        Returns:
        List grid component
        See Also:
      • getDefaultCriteria

        public Criteria getDefaultCriteria()
        Gets list grid default filter criteria.
        Returns:
        The default filter citerion for the list grid or null if there are no filter criteria defined for the grid
      • setFilterCriteria

        public ListGrid setFilterCriteria(Criteria criteria)
        Sets the filter criterion used to query the data. The filter criterion specified here can be modified or overwritten using the filter component. If a criterion is specified and there is a filter component in the grid, the filter component is displayed using the specified criterion. The filter criterion specified here is joined to the default filter criterion with an AND operator.
        Specified by:
        setFilterCriteria in interface Filterable<ListGrid>
        Parameters:
        criteria - Filter criterion used to query the data If null is set, there is no default filter criterion for the grid.
        Returns:
        List grid component
        Throws:
        IllegalArgumentException - Thrown if the specified filter criterion does not correspond to the displayed filter component
      • getFilterCriteria

        public Criteria getFilterCriteria()
        Gets the filter criterion used for the query.
        Returns:
        The filter criterion specified by the user or null if the user has not specified any filter criteria
      • setDefaultOrder

        public final ListGrid setDefaultOrder(Order order)
        Sets the default sort type for the list grid. The sort type specified here is applied if the user does not sort the data in a different way.
        Parameters:
        order - Default sort order If null is set, the default sort order is deleted.
        Returns:
        List grid component
      • setDefaultOrders

        public final ListGrid setDefaultOrders(Order... orders)
        Sets the default sort order for the list grid. The sort rules specified here is applied if the user does not sort the data in a different way.
        Parameters:
        orders - An enumeration of default sort rules. Rules are listed in the order of their application. If null is specified, the default sort rules are deleted.
        Returns:
        List grid component
      • setDefaultOrders

        public final ListGrid setDefaultOrders(List<Order> orders)
        Sets the default sort order for the list grid. The sort rules specified here is applied if the user does not sort the data in a different way.
        Parameters:
        orders - An enumeration of default sort rules. Rules are listed in the order of their application. If not specified or null is set, the default sort rules are deleted.
        Returns:
        List grid component
      • getDefaultOrders

        public final List<Order> getDefaultOrders()
        Gets the default sort rules for the list grid.
        Returns:
        A list of default sort rules for the list grid or null if there is no default sort rule defined for the list grid
      • getRowCount

        public int getRowCount()
        Gets list grid rows. The returned value is not the count of data records, but the count of rows in the list grid.
        Returns:
        List grid row count
      • isEmpty

        public boolean isEmpty()
        Checks if the list grid is empty (does not contain any data rows).
        Returns:
        If true, the list grid is empty, otherwise false
      • addRecord

        public final ListGrid addRecord(Record newRecord)
        Adds a new record to the list grid. Data of the newly added record are displayed only on the interface, but are not added to the database.
        Parameters:
        newRecord - An instance of the record we want to add to the grid
        Returns:
        List grid component
        Throws:
        IllegalArgumentException - Thrown if you want to add a record to a grid with no columns
      • addRecord

        public final ListGrid addRecord(Record newRecord, boolean persisted)
        Parameters:
        newRecord - An instance of the record we want to add to the grid
        persisted - If true is specified, the grid takes the record as persisted and will not save it to the database If false is specified, records are not persisted and will not be saved to the database.
        Returns:
        List grid component
        Throws:
        IllegalArgumentException - Thrown if you want to add a record to a grid with no columns
      • addRecords

        public final ListGrid addRecords(List<Record> records)
        Adds multiple records to the grid. Data of the newly added record are displayed only on the interface, but are not added to the database.
        Parameters:
        records - A list of records to be added to the grid
        Returns:
        List grid component
        Throws:
        IllegalArgumentException - Thrown if you want to add a record to a grid with no columns
      • addRecords

        public final ListGrid addRecords(List<Record> records, boolean persisted)
        Parameters:
        records - A list of records to be added to the grid
        persisted - If true is set, the grid takes the record as persisted and will not save it to the database If false is specified, records are not persisted and will be saved to the database.
        Returns:
        List grid component
        Throws:
        IllegalArgumentException - Thrown if you want to add a record to a grid with no columns
      • fetchData

        public ListGrid fetchData()
        Queries data from the database The query uses the sort order, the default and custom filter criteria. All the previous rows and records are removed from the grid. The grid is populated with the records returned by the query.
        Specified by:
        fetchData in interface Fetchable<ListGrid>
        Specified by:
        fetchData in interface Filterable<ListGrid>
        Returns:
        List grid component
        Throws:
        IllegalStateException - Thrown if the method is called by a list grid with no DataDescriptor specified
      • clear

        public final ListGrid clear()
        Empties the list grid component; removes all rows and records from the list grid.
        Returns:
        List grid component
      • scrollToTop

        public ListGrid scrollToTop()
        Scrolls to the top of the list grid; displays the top of the data queried.
        Returns:
        List grid component
      • scrollToRow

        public final ListGrid scrollToRow(int rowindex)
        Scrolls down the list grid to the specified row. If the specified row is not on the interface, the grid automatically queries the data from the database until the requested row is available, then it scrolls down to the specific row. If the specified row is not available, the method does nothing, all the data is retrieved. Note that if you specify a large number, a lot of data values will be retrieved and this results in a long data retrieval time.
        Parameters:
        rowindex - Row index until which the grid is scrolled Start index is 0.
        Returns:
        List grid component
      • setHeight

        public final ListGrid setHeight(String height)
        Sets the grid height
        Parameters:
        height - Grid height as defined in the CSS3 standard
        Returns:
        List grid component
      • setWidth

        public final ListGrid setWidth(String width)
        Sets the grid width
        Parameters:
        width - Grid width as defined in the CSS3 standard
        Returns:
        List grid component
      • getRowByIndex

        public ListGridRow getRowByIndex(long index)
        Gets a row by row index.
        Parameters:
        index - Index of the row we want to get Start index is 0.
        Returns:
        Row object corresponding to the specified index or null if there is no row in the grid by the specified index
      • selectRow

        public ListGrid selectRow(int rowIndex)
        Selects a row in the grid.
        Parameters:
        rowIndex - Index of the row to be selected If there is no row in the grid by the specified row index, the method does nothing.
        Returns:
        List grid component
      • selectRow

        public ListGrid selectRow(ListGridRow row)
        Selects a row in the grid.
        Parameters:
        row - An instance of the row to be selected If the specified instance is not in the grid, or it is deleted or null is specified, the method does nothing.
        Returns:
        List grid component
      • deselectRow

        public ListGrid deselectRow(int rowIndex)
        Removes a row from the grid. Data from the deleted row disappear from the grid, but the record is not deleted. The record is stored in the memory as a deleted record.
        Parameters:
        rowIndex - The index of the row to be deleted If there is no row in the grid by the specified row index, the method does nothing.
        Returns:
        List grid component
      • deselectRow

        public ListGrid deselectRow(ListGridRow row)
        Removes a row from the grid. Data from the deleted row disappear from the grid, but the record is not deleted. The record is stored in the memory as a deleted record.
        Parameters:
        row - Row instance to be deleted If the specified instance is not in the grid, or null is specified, the method does nothing.
        Returns:
        List grid component
      • invertSelection

        public ListGrid invertSelection(int rowIndex)
        Inverts row selection. Inverting a selection means deselecting the row. Contrarily, if the row has been selected, it will be selected.
        Parameters:
        rowIndex - Row index used to invert the selection
        Returns:
        List grid component
      • invertSelection

        public ListGrid invertSelection(ListGridRow row)
        Inverts row selection. Inverting a selection means deselecting the row. Contrarily, if the row has been selected, it will be selected.
        Parameters:
        row - Instance of the row used to invert the selection
        Returns:
        List grid component
      • selectAllRows

        public ListGrid selectAllRows()
        Selects all rows in the grid.
        Returns:
        List grid component
      • deselectAllRows

        public ListGrid deselectAllRows()
        Deselecting all rows in the grid.
        Returns:
        List grid component
      • invertAllRows

        public ListGrid invertAllRows()
        Inverts the selection of all rows in the grid. The method deselects all selected rows in the grid and selects all unselected rows.
        Returns:
        List grid component
      • selectRange

        public ListGrid selectRange(int firstRow, int lastRow)
        Selects all rows that fall within the specified range. The range is specified by row indices. Start index is 0. Selects all the rows that fall within the range, lower and upper boundaries of the range.
        Parameters:
        firstRow - The start index of the selection range
        lastRow - The end index of the selection range
        Returns:
        List grid component
      • deselectRange

        public ListGrid deselectRange(int firstRow, int lastRow)
        Deselects all rows that fall within the specified range. The range is specified by row indices. Start index is 0. Deselects all rows that fall within the specified range, including the lower and upper boundaries of the range. Deselect row range in a grid.
        Parameters:
        firstRow - The start index of the selection range
        lastRow - The end index of the selection range
        Returns:
        List grid component
      • invertSelectionRange

        public ListGrid invertSelectionRange(int firstRow, int lastRow)
        Inverts the selection of all rows within the specified range. The range is specified by row indices. Start index is 0. Inverts the selection of all rows within the specified range, including the lower and upper boundaries of the range. Inverting the selection means deselecting previously selected rows. Contrarily, previously unselected rows will be selected.
        Parameters:
        firstRow - The start index of the selection range
        lastRow - The end index of the selection range
        Returns:
        List grid component
      • getSelectedRow

        public final ListGridRow getSelectedRow()
        Gets the selected row in the grid.
        Returns:
        Instance of the row selected in the grid If multiple rows are selected in the grid, the method returns the instance of the first row. If no rows are selected, the return value is null.
      • getSelectedRows

        public final List<ListGridRow> getSelectedRows()
        Gets all selected rows from the grid.
        Returns:
        A list of instances of all selected rows If the grid does not contain any selected rows, the return value is an empty list.
      • addRowClickHandler

        public ListGrid addRowClickHandler(ListGridRowClickHandler handler)
        Row click even handler for the grid.
        Parameters:
        handler - Row click event handler implementation
        Returns:
        List grid component
      • addRowDoubleClickHandler

        public final ListGrid addRowDoubleClickHandler(ListGridRowDoubleClickHandler handler)
        Adds a double-click event handler for the grid row.
        Parameters:
        handler - Double-click event handler implementation for the row
        Returns:
        List grid component
      • addHeaderClickHandler

        public final ListGrid addHeaderClickHandler(ListGridHeaderClickHandler handler)
        Adds an event handler to the grid for the grid header click event.
        Parameters:
        handler - Grid header click event handler implementation
        Returns:
        List grid component
      • addHeaderDoubleClickHandler

        public final ListGrid addHeaderDoubleClickHandler(ListGridHeaderDoubleClickHandler handler)
        Adds an event handler to the grid for the grid header double-click event.
        Parameters:
        handler - Grid header double-click event handler implementation
        Returns:
        List grid component
      • addNextPageRequestHandler

        public final ListGrid addNextPageRequestHandler(ListGridNextPageEventHandler handler)
        Adds an event handler to the grid. The event is raised when the next page is requested.
        Parameters:
        handler - Event handler implementation for the next page
        Returns:
        List grid component
      • setOrder

        public final ListGrid setOrder(Order order)
        Sets the order of the grid. The previous sort order is deleted and the grid is sorted using the rule specified here.
        Parameters:
        order - Grid sort rule If not specified or null is set, the grid is displayed unsorted.
        Returns:
        List grid component
      • setOrders

        public final ListGrid setOrders(List<Order> orders)
        Sets the grid order using several rules. The previous sort order is deleted and the grid is sorted using the rule specified here. Rules are processed in their respective order in the specified list.
        Parameters:
        orders - List containing sort rules If not specified or null is set, the grid is displayed unsorted.
        Returns:
        List grid component
      • addOrder

        public final ListGrid addOrder(Order order)
        Adds a sorting rule to the previous grid sorting rules.
        Parameters:
        order - Sorting rule to be added to the grid
        Returns:
        List grid component
      • removeOrder

        public final ListGrid removeOrder(Order order)
        Removes a sorting rule from the grid.
        Parameters:
        order - Sorting rule to be removed from the grid
        Returns:
        List grid component
      • clearOrders

        public final ListGrid clearOrders()
        Removes all sorting rules from the grid.
        Returns:
        List grid component
      • getOrders

        public final List<Order> getOrders()
        Gets all sorting rules.
        Returns:
        A list of all specified sorting rules If the grid does not contain any sorting rules, an empty list is returned.
      • setDefaultFormatter

        public ListGrid setDefaultFormatter(ListGridColumnType type, ListGridCellFormatter formatter)
        Sets the default formatter for the grid using the specified column type.
        Parameters:
        type - Column type for which the default formatter is set Available types are listed in the enum ListGridColumnType.
        formatter - Default formatter implementation for the specified column If null is specified, the column type’s default formatter is deleted.
        Returns:
        List grid component
        Throws:
        NullPointerException - Thrown if the specified column type is null
      • getDefaultFormatter

        public ListGridCellFormatter getDefaultFormatter(ListGridColumnType type)
        Gets the default formatter for the specified column.
        Parameters:
        type - Column type for the default formatter Available column types are listed in the enum ListGridColumnType.
        Returns:
        Default formatter implementation for the specified column type or null, if there is no default formatter for the column type
      • removeDefaultFormatter

        public final ListGrid removeDefaultFormatter(ListGridColumnType type)
        Deletes the default formatter for the column type.
        Parameters:
        type - Column type whose default formatter is to be deleted
        Returns:
        List grid component
      • getRows

        public List<ListGridRow> getRows()
        Gets all rows in a list grid.
        Returns:
        A list containing all rows in a list grid. If the list does not contain any rows, an empty list is returned.
      • exportData

        public ListGrid exportData(Parameters params)
        Description copied from interface: Exportable
        Exports the data using the settings specified in the Parameters parameter. This method implements a general file export process by default. A custom export process can be implemented in any class by overwriting this method.
        During the export process, data are retrieved using lazy fetch. The number of records in a query can be set by specifying the JBStrapParamType.EXPORT_FETCH_SIZE. The maximum number of rows to be exported can be specified using the JBStrapParamType.MAX_EXPORTED_ROW_COUNT parameter.
        Specified by:
        exportData in interface Exportable<Fetchable<ListGrid>>
        Parameters:
        params - Parameters to be specified: (asterisk means required):
      Parameter name Parameter value Default parameter value Parameter description
      client* Client No The client initiating the export process, the exported file is downloaded to this client
      type ExportTypes ExportTypes.CSV Export file type. It is required to specify the type or customExporterClass
      customExportClass DataExporter interface implementation No If this parameter is specified, the type parameter is not processed either. It is required to specify the type or customExporterClass
      criteria Criteria No Filter criterion for export data
      order List<Order> No Determines the order of data values to be exported; specify multiple order criteria
      columns* Map<String, String> No Specifies the export fields. Key: field name, value: field label. If this parameter is not specified, the returned query records are used. If the number of records is 0 (no records fulfil the query criteria), an exception is thrown
      filename String export.unnamed.file message resource by default: Exported file Export file name
      skipUntitledColumns boolean true Sets whether unlabeled fields should be included in the export file
      dateFormats Map<String, String> No In case of date type fields, you can specify the field pattern. Key: field name, value: field pattern. Use the SimpleDateFormat to process the pattern
      autoSizeColumns boolean false Sets auto column size in the export file
      Returns:
      The component
    • deleteRow

      public ListGrid deleteRow(int rowIndex)
      Removes a row from the grid. The specified row is deleted from the interface, but the records itself is not deleted from the database. The record’s state is changed to ‘deleted’.
      Parameters:
      rowIndex - The index of the row to be deleted from the grid Start index is 0.
      Returns:
      List grid component
    • updateRow

      public ListGrid updateRow(int rowIndex, Record newRecord)
      Modifies a row in the grid. All data values in a row are modified on the interface, but the data values are not modified in the database. The record state is changed to ‘modified’.
      Parameters:
      rowIndex - The index of the row to be modified Start index is 0. If there is no row in the list grid by the specified index, or the index references a previously deleted row, the method does nothing.
      newRecord - An instance of the record containing new data All data values in this record are inserted into row data. If both records have the same attribute, the previous one is overwritten with data from the specified record. If the previous record contains an attribute which is not included in the record specified here, it remains the same.
      Returns:
      List grid component
    • updateRow

      public ListGrid updateRow(int rowIndex, String columnName, Object newValue)
      Modifies a cell in the grid. The modified record is inserted into the grid row, but is not modified in the database. The record state is changed to ‘modified’.
      Parameters:
      rowIndex - Row index of the cell to be modified If an index is specified which does not identify a row in the grid, or the specified row has been previously deleted, the method does nothing.
      columnName - Column name of the cell to be modified If a non-existent column name is entered, the data is inserted into the record, but no visible change is made to the interface.
      newValue - New value which overwrites the previous one
      Returns:
      List grid component
    • isModified

      public final boolean isModified()
      Checks if grid data has been modified since the last query.
      Returns:
      If true, grid data has been changed since the last query, otherwise false
    • getNewRows

      public final List<ListGridRow> getNewRows()
      Gets all newly added grid rows (persisted records).
      Returns:
      A list of new records; if there are no new rows in the grid, an empty list is returned
    • getDeletedRows

      public final List<ListGridRow> getDeletedRows()
      Gets deleted grid rows.
      Returns:
      A list of deleted grid rows If there are no deleted rows in the grid, an empty list is returned.
    • getModifiedRows

      public final List<ListGridRow> getModifiedRows()
      Gets modified grid rows.
      Returns:
      A list of modified grid rows If there are no modified rows in the grid, an empty list is returned.
    • getRowState

      public ListGridRecordState getRowState(int rowIndex)
      Gets the state of a row.
      Parameters:
      rowIndex - Row index
      Returns:
      The state of the row specified by the row index or null if there is no grid row associated identified by the index
    • save

      Saves all grid modifications to the database within a single database transaction. The save takes place if all modifications have been successfully saved. A single unsuccessful modification causes all modifications to be reverted. Modifications are not saved.
      Returns:
      List grid component
      Throws:
      SaveException - Thrown if the saving of modifications or new rows was unsuccessful
      RemoveException - Thrown if removing the specified rows was unsuccessful
      DataAccessException - Thrown if the authenticated database user has no write access to the database
      ConnectionException - Thrown if the database connection is unavailable
    • save

      Saves all grid modifications to the database within a single database transaction. The save takes place if all modifications have been successfully saved. A single unsuccessful modification causes all modifications to be reverted. Modifications are not saved.
      Parameters:
      transaction - Database transaction handling the save operation
      Returns:
      List grid component
      Throws:
      SaveException - Thrown if the saving of modifications or new rows was unsuccessful
      RemoveException - Thrown if removing the specified rows was unsuccessful
      DataAccessException - Thrown if the authenticated database user has no write access to the database
      ConnectionException - Thrown if the database connection is unavailable
    • setEnabled

      public ListGrid setEnabled(boolean enabled)
      Enabling/disabling the grid on the interface. If a grid is enabled/disabled on the interface, all of the enclosed components are also enabled/disabled.
      Overrides:
      setEnabled in class Component<ListGrid>
      Parameters:
      enabled - If true is specified, the grid and all the enclosed components are enabled, otherwise disabled
      Returns:
      List grid component
    • getCellValue

      public <T> T getCellValue(int rowIndex, String columnName)
      Gets the cell value.
      Type Parameters:
      T - The type which gets the value
      Parameters:
      rowIndex - Row index of the referenced column Start index is 0.
      columnName - Column name for data query
      Returns:
      Column value If the specified cell is a rendered one, an instance of the component in the cell is returned, otherwise cell data is returned. If the specified row index does not identify any rows, or the specified column is not contained in the row, null is returned.
    • getCellValue

      public <T> T getCellValue(ListGridRow row, String columnName)
      Gets the cell value.
      Type Parameters:
      T - The type which gets the value
      Parameters:
      row - Row instance containing the data
      columnName - Column name for data query
      Returns:
      Column value If the specified cell is a rendered one, an instance of the component in the cell is returned, otherwise cell data is returned. If the specified row is null or the specified column is not included in the row, null is returned.
    • onShow

      public void onShow()
      Description copied from class: Component
      The operations to be executed after the component is displayed on the client

      By default, this is an empty method. It has to be overwritten on a component or page, if additional operations have to be executed after the component is displayed. This method is nearly identical to the afterDraw() method, they differ in when they are executed. This method runs after the component is displayed on the client. Meaning that it is executed even if the component isn't redrawn, but only set to be visible after being hidden.

      Overrides:
      onShow in class Component<ListGrid>
    • onNextPageRequest

      public void onNextPageRequest(ListGridNextPageRequestEvent event)
      Parameters:
      event - Event object
    • onRefreshData

      public void onRefreshData(ListGridRefreshDataEvent event)
    • onColumnShowHide

      public void onColumnShowHide(ListGridColumnShowEvent event)
    • onRowClick

      public void onRowClick(ListGridRowClickEvent event)
      Parameters:
      event - Original row click event object
    • onColumnResize

      protected void onColumnResize(ListGridColumnResizeEvent event)
      Parameters:
      event - Event object
    • onColumnMove

      protected void onColumnMove(ListGridColumnMoveEvent event)
      Parameters:
      event - Event object
    • onSort

      public void onSort(ListGridSortEvent event)
    • addComponent

      public final ListGrid addComponent(Component<?> component)
      No further components can be added to the grid.
      Overrides:
      addComponent in class Component<ListGrid>
      Parameters:
      component - The component to be added
      Returns:
      The component
      Throws:
      UnsupportedOperationException - Thrown every time the method is called
    • drawComponent

      protected String drawComponent(Component<?> component)
    • writeHTML

      public boolean writeHTML(StringWriter writer)
      Description copied from class: Component
      Creates the component's HTML equivalent

      This method doesn't need to be used during application development. This method is used when developing a custom component. When creating a custom component, this method needs to be implemented. In the parameter (StringWriter class) the component's HTML equivalent must be specified, and the method has to return with a Boolean value. This boolean value determines if the component was drawn. If the user doesn't have access right to the component, or if the component couldn't be drawn, it should return with false. Otherwise, it must return with true.

      Specified by:
      writeHTML in class Component<ListGrid>
      Returns:
      If the componentwas drawn, true, otherwise false
    • afterDraw

      public void afterDraw()
      Description copied from class: Component
      The operations to be executed after the drawing of the component

      By default, this is an empty method. It has to be overwritten on a component or page if additional operations have to be executed after the drawing process. One such operation is data retrieval, which shouldn't run in constructors so that the user could see results of an operation or navigation process.

      Overrides:
      afterDraw in class Component<ListGrid>
    • getCriteria

      public Criteria getCriteria()
      Gets list grid filter criteria.
      Specified by:
      getCriteria in interface Filterable<ListGrid>
      Returns:
      List grid filter criterion containing default filter criteria and custom filter criteria If null is set, no filter criterion is defined for the list grid.
    • setEmptyPlaceholderTitle

      public ListGrid setEmptyPlaceholderTitle(String title)
      Sets the placeholder for an empty header. By default, the placeholder has no text.
      Parameters:
      title - Placeholder text If null is set, no text is displayed in the placeholder.
      Returns:
      List grid component
    • getEmptyPlaceholderTitle

      public String getEmptyPlaceholderTitle()
      Gets the placeholder for an empty header.
      Returns:
      The empty header placeholder title or null if not setted
    • setFixedScrollbarPosition

      public ListGrid setFixedScrollbarPosition(boolean fixedScrollbarPosition)
      Sets the list grid scrollbar position. By default, the list grid scrollbar is displayed on the list grid margin after the last column. If the grid is wider than the page and is horizontally scrollable, the vertical scrollbar is displayed on the page margin.
      Parameters:
      fixedScrollbarPosition - If true is set, the vertical scrollbar is displayed on the page margin Otherwise, the vertical scrollbar is displayed on the list grid margin.
      Returns:
      List grid component
    • isFixedScrollbarPosition

      public boolean isFixedScrollbarPosition()
      Checks if the vertical scrollbar is displayed on the page margin.
      Returns:
      If true is set, the vertical scrollbar is displayed on the page margin Otherwise, the vertical scrollbar is displayed on the list grid margin.
    • getComponents

      public List<Component<?>> getComponents()
      Description copied from class: Component
      Gets every previously added subcomponent
      Overrides:
      getComponents in class Component<ListGrid>
      Returns:
      A collection of every subcomponent that was added to the component. If there are none, the collection will be empty
    • setSortable

      public ListGrid setSortable(boolean sortable)
    • isSortable

      public boolean isSortable()
    • setStriped

      public ListGrid setStriped(boolean stripped)
    • getFilterComponent

      public BaseFilter<?> getFilterComponent()
      Gets the filter component of ListGrid
      Returns:
      The list grid filter component or null, if filtering is switched of on the list grid component
    • onFilter

      public void onFilter(FilterbarFilteringEvent event)
      Filter handling
      Parameters:
      event - Filter event
    • onFilter

      public ListGrid onFilter(Criteria criteria)
      Description copied from interface: FilterBarFiltering
      This method is called if the user starts filtering via the filter component
      Specified by:
      onFilter in interface FilterBarFiltering<ListGrid>
      Parameters:
      criteria - Criterion created by the filter component to perform filtering
      See Also:
    • setCustomFetch

      public ListGrid setCustomFetch(FetchEvent fetchEvent)
      Sets a custom query. When calling the fetchData method, the specified FetchEvent implementation is called, then callback methods are run on records returned by the onFetch method.
      Parameters:
      fetchEvent - Custom query implementation
    • fetch

      public List<Record> fetch(int startRow, int endRow, Criteria criteria, List<Order> orders, Client client) throws FindException, DataAccessException
      Description copied from interface: Fetchable
      This method implements actual data retrieval. The Fetchable.fetchData() function runs callback methods on the returned records.
      Specified by:
      fetch in interface Fetchable<ListGrid>
      Parameters:
      startRow - The first row of the query that appears in the returned list
      endRow - The last row of the query that appears in the returned list
      criteria - The criteria used during the query If null, no criteria will be used, every record is queried.
      orders - The orderings that will be applied to the query results. If null, the data will not be ordered.
      client - The client that started the query. If null, the query will happen without checking for access rights.
      Returns:
      The list of records that meet the specified filter criteria.
      Throws:
      FindException - Occurs if an error was encountered during the query
      DataAccessException - Occurs if the user in the specified client has no access to read the data