Search in sources :

Example 1 with CayenneCellEditor

use of org.apache.cayenne.modeler.util.CayenneCellEditor in project cayenne by apache.

the class ProcedureParameterTab method rebuildTable.

protected void rebuildTable(Procedure procedure) {
    ProcedureParameterTableModel model = new ProcedureParameterTableModel(procedure, eventController, this);
    table.setModel(model);
    table.setRowHeight(25);
    table.setRowMargin(3);
    // number column tweaking
    TableColumn numberColumn = table.getColumnModel().getColumn(ProcedureParameterTableModel.PARAMETER_NUMBER);
    DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
    renderer.setHorizontalAlignment(SwingConstants.CENTER);
    numberColumn.setCellRenderer(renderer);
    TableColumn typesColumn = table.getColumnModel().getColumn(ProcedureParameterTableModel.PARAMETER_TYPE);
    JComboBox typesEditor = Application.getWidgetFactory().createComboBox(TypesMapping.getDatabaseTypes(), true);
    AutoCompletion.enable(typesEditor);
    typesColumn.setCellEditor(Application.getWidgetFactory().createCellEditor(typesEditor));
    // direction column tweaking
    TableColumn directionColumn = table.getColumnModel().getColumn(ProcedureParameterTableModel.PARAMETER_DIRECTION);
    JComboBox directionEditor = Application.getWidgetFactory().createComboBox(ProcedureParameterTableModel.PARAMETER_DIRECTION_NAMES, false);
    directionEditor.setEditable(false);
    directionColumn.setCellEditor(new CayenneCellEditor(directionEditor));
    moveUp.setEnabled(false);
    moveDown.setEnabled(false);
    tablePreferences.bind(table, null, null, null);
}
Also used : JComboBox(javax.swing.JComboBox) TableColumn(javax.swing.table.TableColumn) DefaultTableCellRenderer(javax.swing.table.DefaultTableCellRenderer) CayenneCellEditor(org.apache.cayenne.modeler.util.CayenneCellEditor)

Aggregations

JComboBox (javax.swing.JComboBox)1 DefaultTableCellRenderer (javax.swing.table.DefaultTableCellRenderer)1 TableColumn (javax.swing.table.TableColumn)1 CayenneCellEditor (org.apache.cayenne.modeler.util.CayenneCellEditor)1