Search in sources :

Example 6 with ValueRenderer

use of org.knime.base.data.aggregation.dialogutil.AggregationFunctionRowTableCellRenderer.ValueRenderer in project knime-core by knime.

the class DBColumnAggregationFunctionPanel method adaptTableColumnModel.

/**
 * {@inheritDoc}
 */
@Override
protected void adaptTableColumnModel(final TableColumnModel columnModel) {
    columnModel.getColumn(0).setCellRenderer(new AggregationFunctionRowTableCellRenderer<>(new ValueRenderer<DBColumnAggregationFunctionRow>() {

        @Override
        public void renderComponent(final DefaultTableCellRenderer c, final DBColumnAggregationFunctionRow row) {
            final DataColumnSpec spec = row.getColumnSpec();
            c.setText(spec.getName());
            c.setIcon(spec.getType().getIcon());
        }
    }, true, "Double click to remove column. Right mouse click for context menu."));
    m_aggregationFunctionCellEditor = new DBColumnAggregationFunctionRowTableCellEditor(null);
    columnModel.getColumn(1).setCellEditor(m_aggregationFunctionCellEditor);
    columnModel.getColumn(1).setCellRenderer(new AggregationFunctionAndRowTableCellRenderer());
    columnModel.getColumn(0).setPreferredWidth(170);
    columnModel.getColumn(1).setPreferredWidth(150);
}
Also used : DataColumnSpec(org.knime.core.data.DataColumnSpec) AggregationFunctionAndRowTableCellRenderer(org.knime.base.data.aggregation.dialogutil.AggregationFunctionAndRowTableCellRenderer) ValueRenderer(org.knime.base.data.aggregation.dialogutil.AggregationFunctionRowTableCellRenderer.ValueRenderer) DefaultTableCellRenderer(javax.swing.table.DefaultTableCellRenderer)

Aggregations

DefaultTableCellRenderer (javax.swing.table.DefaultTableCellRenderer)6 AggregationFunctionAndRowTableCellRenderer (org.knime.base.data.aggregation.dialogutil.AggregationFunctionAndRowTableCellRenderer)6 ValueRenderer (org.knime.base.data.aggregation.dialogutil.AggregationFunctionRowTableCellRenderer.ValueRenderer)6 BooleanCellRenderer (org.knime.base.data.aggregation.dialogutil.BooleanCellRenderer)2 DataColumnSpec (org.knime.core.data.DataColumnSpec)2 DataType (org.knime.core.data.DataType)2 ColumnAggregator (org.knime.base.data.aggregation.ColumnAggregator)1