Extreme Component Documentation

JComponentPack 1.3.0 New Features

October 6, 2008

1. CellSpanModel

Adds new CellSpanModel,the JDataGrid component can merge and split cell
with a plain TableModel, the DataGridModel now refactor to implement the CellSpanModel interface,
Example Code:

        // use a TableModel and a CellSpanModel to implement merging and splitting cell
        dataGrid.setModel(new DefaultTableModel(99, 26));
        dataGrid.setCellSpanModel(new DefaultCellSpanModel());
Demo: The CellSpanModelDemo demonstrate this feature

2. CellEditorListener2

Adds new listener CellEditorListener2, get the notification of the JDataGrid
  cell validate and convert failed message.
Example Code:

        dataGrid.setValueAt("Number Validation", 0, 0);
        dataGrid.getDataGridModel().setColumnClass(Number.class, 0);
        dataGrid.addCellEditorListener(new CellEditorListener2() {
            public void editingStopped(ChangeEvent e) {
            public void editingCanceled(ChangeEvent e) {

            public void editingFailed(ChangeEvent e) {
                int row = dataGrid.getEditingRow();
                int column = dataGrid.getEditingColumn();
                Cell c = new Cell(row, column);
                JOptionPane.showMessageDialog(null, "Invalid value at cell: "+c);

Demo: The ValidationDemo demonstrate this feature

3. DateCellEditor works with JCalendar component.

DateCellEditor support choose Date by using the JCalendar component.
Example Code:

       DefaultDataGridModel model = (DefaultDataGridModel)dataGrid.getModel();
       model.setColumnName("Date AComboBox", 2);
       model.setColumnClass(Date.class, 2);
       dataGrid.setCellEditorComponentTypeByColumn(2, CellEditorComponentType.A_COMBO_BOX);
Demo: The CellEditorDemo2 demonstrates this feature.

4. JDataGrid can change cell editor component type by column or by value class.

Example Code 1:

        // change cell editor component type by column
        DefaultDataGridModel model = (DefaultDataGridModel)dataGrid.getModel();
        model.setColumnName("Boolean CheckBox", 0);
        model.setColumnClass(Boolean.class, 0);
        dataGrid.setCellEditorComponentTypeByColumn(0, CellEditorComponentType.CHECK_BOX);
        dataGrid.setCellRendererComponentTypeByColumn(0, CellRendererComponentType.CHECK_BOX);
Example Code 2:
    // change cell editor component type by class
    model.setColumnName("Date", 1);
    cmodel.setColumnClass(Date.class, 1);
Demo: The CellEditorDemo2 demonstrates the feature changing cell editor component type by column,
         The CellEditorDemo demonstrates the feature changing cell editor component type by class.

5. All cell editor hava new implementation of combo box component type.

Example Code 1:

        // Date editor combo box component type
        model.setColumnName("Date ComboBox", 3);
        model.setColumnClass(Date.class, 3);
        SimpleAttributeSet a = new SimpleAttributeSet();
        List valueList = new ArrayList();
        valueList.add(new Date(2006-1900, 1, 1));
        valueList.add(new Date(2007-1900, 1, 1));
        valueList.add(new Date(2008-1900, 1, 1));
        valueList.add(new Date(2009-1900, 1, 1));
        valueList.add(new Date(2010-1900, 1, 1));
        CellStyle.setValueList(a, valueList);
        model.setColumnAttributes(a, 3);
        dataGrid.setCellEditorComponentTypeByColumn(3, CellEditorComponentType.COMBO_BOX);
Example Code 2:
       // boolean cell editor combo box component type
       model.setColumnName("Boolean ComboBox", 1);
       model.setColumnClass(Boolean.class, 1);
       dataGrid.setCellEditorComponentTypeByColumn(1, CellEditorComponentType.COMBO_BOX);
Demo: The CellEditorDemo2 demonstrates this feature.

6. AComboBox support change the value class.

AComboBox component can change it’s popup icon and popup component based it’s value or a type (For example: Date.class).

7. DateCellRenderer and DateCellEditor use the default date format.

Using the date format as default format in DateCellRenderer and DateCellEditor, keep the same behavior with the JTable component.

8. New API to changes all the cell editor’s component type.

AbstractCellEditor and it’s subclass have the method to change it’s component type:
AbstractCellRenderer and it’s subclass have the method to change it’s component type:

9. Listen the cell editor event from JDataGrid directly.

JDataGrid add new API to receive all cell editor event, such as cell editing stopped, canceled, failed.

10. Many bugs get fixed.

a) When set a new model in LineChart and BarChart, the x and y axis and grid hidden. (Bug Fixed)
    Thanks "Corey Sewell" for reporting this bug.
b) I have a Date column. I do an Excel-style "select & drag the corner" to advance the values in the cells below.
    The day of the month advances correctly, but the month does not change.
    Thank Plamen Petrov for bug report.
c) JBean throws ConcurrentModificationException.
     Thank Harry Dollard for bug report. 

Subscribe RSS >>download

Send Us Feedback

The hottest article