XdevTable

XdevTable

  1. Insert an XdevTable in the GUI Builder.

  2. Drop an entity, e.g. Products, in the XdevTable by using drag and drop.

  3. Under Properties > Entity > Property, click on....

  4. In the following properties wizard, select the properties (data fields) that should be displayed in a column. 

  5. Click OK.

Note:
  • Data source used: Data source: H2 Northwind > Entity: Products

Result:
  • Properties

    • Entity -  Sets the entity assigned via drag and drop.

      this.table.setContainerDataSource(Products.class, NestedProperty.of("categories.categoryname", String.class), NestedProperty.of("categories.description", String.class));
    • Properties - Generates corresponding columns in the XdevTable for the properties (data fields) set here. 

      this.table.setVisibleColumns("productname", "quantityperunit", "unitprice", "unitsonorder", "reorderlevel", "categories.categoryname", "categories.description");
    • Auto query data - Sets the Auto query data property. Determines that the XdevBeanItemContainer is used as data container.

  • Preview 

Column configuration:

Open XdevTable properties wizard: In the Properties > Entity > Properties click on... .

  • CaptionColumn caption - The specified label is used as column name. This overwrites the label attribute used by default. Internationalization is supported.

  • Generator - Selection of a Generated Column, if already available.

  • Collapsible - The column can be collapsed by invoking the method. For this, the property Properties > ColumnCollapsingAllowed must be set.

  • Collapsed - The column remains collapsed. For this, the property Properties > ColumnCollapsingAllowed must be set.

  • Icon - Assigns an icon to the column that can be selected in the wizard.

  • Alignment - Aligns the text in the column (Left, Center, Right).

  • Width - Sets a fixed column width in pixel.

  • Expand Ratio (Weight) - Defines a weight. As a result, occupies the entire space available in the width. If multiple columns have a weight, then the available space is relatively divided as per specified weight. However, if too little space is available, then (only) columns with weight are clinched in specified ratio. Only when all the columns with weight have reached the minimum size, a horizontal scroller is displayed.

  • Converter - Determines a formatting for the value, e.g. date, currency.

  • Change column sequence - Select a property > click on 

    Move up or 

    Move down.

  • Add Generated Column - Defines a Generated Column, with which random UI components can be integrated in an XdevTable.

Important events:
  • columnReorder - Is triggered if the filter setting is changed.

  • columnResize - Is triggered if the column width is changed.

  • headerClick - Is triggered when you click in the table header.

Important properties:
  • Editable - Allows the editing of the values. For this, corresponding form components are generated in the cells depending on the data type.

  • ColumnCollapsingAllowed - Allows the collapsing and expanding of columns. For this, a corresponding symbol is shown on the top right edge of the table.

  • ColumnReorderingAllowed - With this setting, it is possible to change the arrangement of the columns at runtime using drag and drop.

  • DragMode - Activates drag-and-drop and enables the moving of rows.

  • NON - Deactivates drag-and-drop.

  • ROW - Allows the moving of individual rows. 

  • MULTIROW - Allows the moving of multiple rows selected with multiple selection.

    • MultiSelectMode

  • DEFAULT - With this setting, it is possible to select multiple entries only with pressed shift key.

  • SIMPLE - When this mode is selected, an entry is selected or deselected with a click, whereby the selection of other elements is not affected by it. Multiselect with shift key is not possible.

  • Selectable - Allows a selection.

  • SortEnabled - Allows a sorting of the rows.

    • SortAscending - Sorts the rows in ascending manner.

  • Shortcut

Examples:
  • Read selected row

    Products product = table.getSelectedItem().getBean();

    Saves the values of the selected row in the product variable of Products type.
    Cannot be used for multiple selection.

  • Read individual value

    Products product = table.getSelectedItem().getBean(); String productName = product.getProductname();
  • Multiple selection - Read selected rows

    List<BeanItem<Products>> productList = table.getSelectedItems();
  • Return XdevTable Data-Container - Generates a new XdevBeanItemContainer productContainer of Product type and assigns this to the XdevBeanItemContainer of the XdevTable with the getBeanContainerDataSource method.

    XdevBeanItemContainer<Product> productContainer = table.getBeanContainerDataSource();

     

  • Read XdevTable data

    List<Product> productList = new ArrayList<Product>(); for (Object i : table.getItemIds()) { Product bean = table.getBeanItem(i).getBean(); productList.add(bean); }

     

  • Assign XdevBeanItemContainer to another XdevTable - Assigns the XdevBeanItemContainer productContainer to the XdevTable with the setContainerDataSource method. 

    table2.setContainerDataSource(table1.getBeanContainerDataSource());
  • Table Refresh - Resets the model, generally XdevBeanItemContainer, when AutoQueryData is active. With this, the table is updated.

    table.getBeanContainerDataSource().refresh();
  • Go to XdevTable Javadoc

XDEV Software Corp. - One Embarcadero Center, San Francisco, CA 94111, US
Copyright © 2015. XDEV Software Corp. All rights reserved.