Announcement Announcement Module
Collapse
No announcement yet.
Anyone can give me a tips using richclient table component? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Anyone can give me a tips using richclient table component?

    Hi all!

    I am confusing to how to code this using richclient table component,give a table sample.

    thinks.

  • #2
    The simplest method to call, assuming you don't mind working with a standard JTable, is TableUtils.createStandardSortableTable(tableModel) . Just define a table model adapter for your data, and pass it in as a parameter to this method. You'll get back a fully multi-column sortable table with default renderers installed for common column types. See the BaseTableModel/BeanTableModel classes for convenient table model superclasses.

    Code:
    public static JTable createStandardSortableTable(TableModel tableModel) {
            JTable table = new JTable();
            ShuttleSortableTableModel sortedModel = new ShuttleSortableTableModel(
                    tableModel);
            table.setAutoCreateColumnsFromModel(true);
            table.setModel(sortedModel);
            table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
            installDefaultRenderers(table);
            TableSortIndicator sortIndicator = new TableSortIndicator(table);
            new SortTableCommand(table, sortIndicator.getColumnSortList());
            sizeColumnsToFitRowData(table);
            return table;
        }

    Comment


    • #3
      I implemented a JTable using the method Keith describes above, only to spend some time trying to figure out why my Boolean would not render as a JCheckBox. That method also overrides the default renderers with ones defined in Spring-RCP. As for my case of trying to get Boolean as a JCheckBox, the Spring-RCP BooleanTableCellRenderer extends DefaultTableCellRenderer (by way of OptimizedTableCellRenderer), which is a JLabel.

      Comment

      Working...
      X