Search in sources :

Example 1 with FieldsTableModel

use of org.knime.base.node.jsnippet.ui.FieldsTableModel in project knime-core by knime.

the class JavaEditVarNodeDialog method createOutFieldsTable.

/**
 * {@inheritDoc}
 */
@Override
protected OutFieldsTable createOutFieldsTable() {
    OutFieldsTable table = new OutFieldsTable(true);
    FieldsTableModel model = (FieldsTableModel) table.getTable().getModel();
    model.setColumnName(model.getIndex(Column.COLUMN), "Flow Variable");
    table.getTable().getColumnModel().getColumn(model.getIndex(Column.REPLACE_EXISTING)).setPreferredWidth(15);
    return table;
}
Also used : OutFieldsTable(org.knime.base.node.jsnippet.ui.OutFieldsTable) FieldsTableModel(org.knime.base.node.jsnippet.ui.FieldsTableModel)

Example 2 with FieldsTableModel

use of org.knime.base.node.jsnippet.ui.FieldsTableModel in project knime-core by knime.

the class JavaEditVarNodeDialog method createInFieldsTable.

/**
 * {@inheritDoc}
 */
@Override
protected InFieldsTable createInFieldsTable() {
    InFieldsTable table = new InFieldsTable();
    FieldsTableModel model = (FieldsTableModel) table.getTable().getModel();
    model.setColumnName(model.getIndex(Column.COLUMN), "Flow Variable");
    return table;
}
Also used : InFieldsTable(org.knime.base.node.jsnippet.ui.InFieldsTable) FieldsTableModel(org.knime.base.node.jsnippet.ui.FieldsTableModel)

Example 3 with FieldsTableModel

use of org.knime.base.node.jsnippet.ui.FieldsTableModel in project knime-core by knime.

the class JavaSnippetNodeDialog method saveSettingsTo.

@Override
protected void saveSettingsTo(final NodeSettingsWO settings) throws InvalidSettingsException {
    ViewUtils.invokeAndWaitInEDT(() -> {
        // pressed.
        if (null != m_inFieldsTable.getTable().getCellEditor()) {
            m_inFieldsTable.getTable().getCellEditor().stopCellEditing();
        }
        if (null != m_outFieldsTable.getTable().getCellEditor()) {
            m_outFieldsTable.getTable().getCellEditor().stopCellEditing();
        }
    });
    final JavaSnippetSettings s = m_snippet.getSettings();
    // if settings have less fields than defined in the table it means
    // that the tables contain errors
    final FieldsTableModel inFieldsModel = (FieldsTableModel) m_inFieldsTable.getTable().getModel();
    if (!inFieldsModel.validateValues()) {
        throw new IllegalArgumentException("The input fields table has errors.");
    }
    final FieldsTableModel outFieldsModel = (FieldsTableModel) m_outFieldsTable.getTable().getModel();
    if (!outFieldsModel.validateValues()) {
        throw new IllegalArgumentException("The output fields table has errors.");
    }
    s.setBundles(m_bundleListPanel.getBundles());
    // give subclasses the chance to modify settings
    preSaveSettings(s);
    s.saveSettings(settings);
}
Also used : JavaSnippetSettings(org.knime.base.node.jsnippet.util.JavaSnippetSettings) FieldsTableModel(org.knime.base.node.jsnippet.ui.FieldsTableModel) OutFieldsTableModel(org.knime.base.node.jsnippet.ui.OutFieldsTableModel)

Example 4 with FieldsTableModel

use of org.knime.base.node.jsnippet.ui.FieldsTableModel in project knime-core by knime.

the class JavaSnippetNodeDialog method createOutFieldsTable.

/**
 * Create table do display the output fields.
 *
 * @return the table
 */
protected OutFieldsTable createOutFieldsTable() {
    final OutFieldsTable table = new OutFieldsTable(false);
    final FieldsTableModel model = (FieldsTableModel) table.getTable().getModel();
    final TableColumnModel columnModel = table.getTable().getColumnModel();
    columnModel.getColumn(model.getIndex(Column.FIELD_TYPE)).setPreferredWidth(30);
    columnModel.getColumn(model.getIndex(Column.REPLACE_EXISTING)).setPreferredWidth(15);
    columnModel.getColumn(model.getIndex(Column.IS_COLLECTION)).setPreferredWidth(15);
    return table;
}
Also used : OutFieldsTable(org.knime.base.node.jsnippet.ui.OutFieldsTable) TableColumnModel(javax.swing.table.TableColumnModel) FieldsTableModel(org.knime.base.node.jsnippet.ui.FieldsTableModel) OutFieldsTableModel(org.knime.base.node.jsnippet.ui.OutFieldsTableModel)

Aggregations

FieldsTableModel (org.knime.base.node.jsnippet.ui.FieldsTableModel)4 OutFieldsTable (org.knime.base.node.jsnippet.ui.OutFieldsTable)2 OutFieldsTableModel (org.knime.base.node.jsnippet.ui.OutFieldsTableModel)2 TableColumnModel (javax.swing.table.TableColumnModel)1 InFieldsTable (org.knime.base.node.jsnippet.ui.InFieldsTable)1 JavaSnippetSettings (org.knime.base.node.jsnippet.util.JavaSnippetSettings)1