Search in sources :

Example 1 with SettingsModelColumnFilter2

use of org.knime.core.node.defaultnodesettings.SettingsModelColumnFilter2 in project knime-core by knime.

the class CollectionCreate2NodeModel method validateSettings.

/**
 * {@inheritDoc}
 */
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
    SettingsModelColumnFilter2 includeModel = m_includeModel == null ? createSettingsModel() : m_includeModel;
    includeModel.validateSettings(settings);
    m_createSet.validateSettings(settings);
    m_removeCols.validateSettings(settings);
    m_newColName.validateSettings(settings);
    try {
        m_ignoreMissing.validateSettings(settings);
    } catch (InvalidSettingsException e) {
    // just catch for the sake of downwards compatibility
    }
}
Also used : SettingsModelColumnFilter2(org.knime.core.node.defaultnodesettings.SettingsModelColumnFilter2) InvalidSettingsException(org.knime.core.node.InvalidSettingsException)

Example 2 with SettingsModelColumnFilter2

use of org.knime.core.node.defaultnodesettings.SettingsModelColumnFilter2 in project knime-core by knime.

the class Unpivot2NodeModel method validateSettings.

/**
 * {@inheritDoc}
 */
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
    // ugly, admitted. we use null assignment to indicate whether node has settings
    final SettingsModelColumnFilter2 retainedColumns = m_retainedColumns == null ? Unpivot2NodeDialogPane.createColumnFilterRetainedColumns() : m_retainedColumns;
    retainedColumns.validateSettings(settings);
    final SettingsModelColumnFilter2 valueColumns = m_valueColumns == null ? Unpivot2NodeDialogPane.createColumnFilterValueColumns() : m_valueColumns;
    valueColumns.validateSettings(settings);
    m_enableHilite.validateSettings(settings);
}
Also used : SettingsModelColumnFilter2(org.knime.core.node.defaultnodesettings.SettingsModelColumnFilter2)

Example 3 with SettingsModelColumnFilter2

use of org.knime.core.node.defaultnodesettings.SettingsModelColumnFilter2 in project knime-core by knime.

the class StringToDateTimeNodeDialog method updatePreview.

/**
 * @param colSelectModel settings model of the column filter
 */
private void updatePreview(final SettingsModelColumnFilter2 colSelectModel) {
    final String[] includes = colSelectModel.applyTo(m_spec).getIncludes();
    Arrays.stream(colSelectModel.applyTo(m_spec).getIncludes()).mapToInt(s -> m_spec.findColumnIndex(s)).toArray();
    m_preview = "";
    if (m_dataTable != null) {
        if (!(includes.length == 0 || m_dataTable.size() == 0)) {
            for (final DataRow row : m_dataTable) {
                final DataCell cell = row.getCell(m_spec.findColumnIndex(includes[0]));
                if (cell.isMissing()) {
                    continue;
                } else {
                    m_preview = ((StringValue) cell).getStringValue();
                    break;
                }
            }
        }
    }
    m_previewLabel.setText("Content of the first cell: " + m_preview);
}
Also used : Color(java.awt.Color) Insets(java.awt.Insets) Arrays(java.util.Arrays) NodeSettingsRO(org.knime.core.node.NodeSettingsRO) DataTableSpec(org.knime.core.data.DataTableSpec) InvalidSettingsException(org.knime.core.node.InvalidSettingsException) ZonedDateTime(java.time.ZonedDateTime) LocalDateTime(java.time.LocalDateTime) DataAwareNodeDialogPane(org.knime.core.node.DataAwareNodeDialogPane) NotConfigurableException(org.knime.core.node.NotConfigurableException) DialogComponentString(org.knime.core.node.defaultnodesettings.DialogComponentString) Locale(java.util.Locale) DialogComponentStringSelection(org.knime.core.node.defaultnodesettings.DialogComponentStringSelection) LocalTime(java.time.LocalTime) DateTimeType(org.knime.time.util.DateTimeType) JComboBox(javax.swing.JComboBox) DataCell(org.knime.core.data.DataCell) DialogComponentBoolean(org.knime.core.node.defaultnodesettings.DialogComponentBoolean) DateTimeException(java.time.DateTimeException) StringValue(org.knime.core.data.StringValue) FlowLayout(java.awt.FlowLayout) JButton(javax.swing.JButton) DialogComponentColumnFilter2(org.knime.core.node.defaultnodesettings.DialogComponentColumnFilter2) Collection(java.util.Collection) SettingsModelBoolean(org.knime.core.node.defaultnodesettings.SettingsModelBoolean) PortObjectSpec(org.knime.core.node.port.PortObjectSpec) BorderFactory(javax.swing.BorderFactory) SettingsModelColumnFilter2(org.knime.core.node.defaultnodesettings.SettingsModelColumnFilter2) GridBagConstraints(java.awt.GridBagConstraints) DataRow(org.knime.core.data.DataRow) SettingsModelString(org.knime.core.node.defaultnodesettings.SettingsModelString) NodeSettingsWO(org.knime.core.node.NodeSettingsWO) Dimension(java.awt.Dimension) BufferedDataTable(org.knime.core.node.BufferedDataTable) DialogComponentButtonGroup(org.knime.core.node.defaultnodesettings.DialogComponentButtonGroup) JLabel(javax.swing.JLabel) LocalDate(java.time.LocalDate) DateTimeFormatter(java.time.format.DateTimeFormatter) GridBagLayout(java.awt.GridBagLayout) PortObject(org.knime.core.node.port.PortObject) JPanel(javax.swing.JPanel) DataCell(org.knime.core.data.DataCell) DialogComponentString(org.knime.core.node.defaultnodesettings.DialogComponentString) SettingsModelString(org.knime.core.node.defaultnodesettings.SettingsModelString) DataRow(org.knime.core.data.DataRow)

Aggregations

SettingsModelColumnFilter2 (org.knime.core.node.defaultnodesettings.SettingsModelColumnFilter2)3 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)2 Color (java.awt.Color)1 Dimension (java.awt.Dimension)1 FlowLayout (java.awt.FlowLayout)1 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 Insets (java.awt.Insets)1 DateTimeException (java.time.DateTimeException)1 LocalDate (java.time.LocalDate)1 LocalDateTime (java.time.LocalDateTime)1 LocalTime (java.time.LocalTime)1 ZonedDateTime (java.time.ZonedDateTime)1 DateTimeFormatter (java.time.format.DateTimeFormatter)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Locale (java.util.Locale)1 BorderFactory (javax.swing.BorderFactory)1 JButton (javax.swing.JButton)1 JComboBox (javax.swing.JComboBox)1