Search in sources :

Example 41 with SettingsModelString

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

the class PivotNodeDialogPane method createSettingsAggregationMethod.

/**
 * @return a settings model string as aggregation method
 */
static final SettingsModelString createSettingsAggregationMethod() {
    SettingsModelString model = new SettingsModelString("aggregation_method", "SUM");
    model.setEnabled(false);
    return model;
}
Also used : SettingsModelString(org.knime.core.node.defaultnodesettings.SettingsModelString)

Example 42 with SettingsModelString

use of org.knime.core.node.defaultnodesettings.SettingsModelString in project GenericKnimeNodes by genericworkflownodes.

the class MimeFileImporterNodeModel method validateSettings.

/**
 * {@inheritDoc}
 */
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
    SettingsModelString tmp_filename = m_filename.createCloneWithValidatedValue(settings);
    if (tmp_filename.getStringValue().isEmpty()) {
        throw new InvalidSettingsException("No File selected.");
    }
    convertToURL(tmp_filename);
    SettingsModelOptionalString tmp_file_extension = m_file_extension.createCloneWithValidatedValue(settings);
    if (tmp_file_extension.isActive()) {
        if (tmp_file_extension.getStringValue().equals("")) {
            throw new InvalidSettingsException("No File extension (override) provided.");
        } else if (MIMETypeHelper.getMIMEtypeByExtension(tmp_file_extension.getStringValue()) == null) {
            throw new InvalidSettingsException("No MIME type registered for file extension: " + tmp_file_extension.getStringValue());
        }
    } else if (MIMETypeHelper.getMIMEtype(tmp_filename.getStringValue()) == null) {
        throw new InvalidSettingsException("File of unknown MIME type selected: " + tmp_filename.getStringValue());
    }
}
Also used : InvalidSettingsException(org.knime.core.node.InvalidSettingsException) SettingsModelOptionalString(org.knime.core.node.defaultnodesettings.SettingsModelOptionalString) SettingsModelString(org.knime.core.node.defaultnodesettings.SettingsModelString)

Example 43 with SettingsModelString

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

the class CreateBitVectorNodeModel method createSingleColumnModel.

/**
 * @return the settings model holding the selected string column name
 */
static SettingsModelString createSingleColumnModel() {
    final SettingsModelString model = new SettingsModelString("singleColumnName", null);
    model.setEnabled(!ColumnType.getDefault().isMultiColumn());
    return model;
}
Also used : SettingsModelString(org.knime.core.node.defaultnodesettings.SettingsModelString)

Example 44 with SettingsModelString

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

the class CreateBitVectorNodeModel method validateSettings.

/**
 * {@inheritDoc}
 */
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
    final ColumnType columnType = ColumnType.getType(((SettingsModelString) m_columnType.createCloneWithValidatedValue(settings)).getStringValue());
    final DataColumnSpecFilterConfiguration tmpMultiColumnConfig = createMultiColumnConfig(null);
    tmpMultiColumnConfig.loadConfigurationInModel(settings);
    m_mscPattern.validateSettings(settings);
    m_mscHasWildcards.validateSettings(settings);
    m_mscCaseSensitiv.validateSettings(settings);
    m_mscRegex.validateSettings(settings);
    SetMatching.get(((SettingsModelString) m_mscSetMatching.createCloneWithValidatedValue(settings)).getStringValue());
    m_threshold.validateSettings(settings);
    m_useMean.validateSettings(settings);
    m_meanPercentage.validateSettings(settings);
    final String singleCol = ((SettingsModelString) m_singleColumn.createCloneWithValidatedValue(settings)).getStringValue();
    if (!columnType.isMultiColumn() && singleCol == null) {
        throw new InvalidSettingsException("Please select the single column to process");
    }
    m_singleStringColumnType.validateSettings(settings);
    m_remove.validateSettings(settings);
    final String outCol = ((SettingsModelString) m_outputColumn.createCloneWithValidatedValue(settings)).getStringValue();
    if (outCol == null || outCol.trim().isEmpty()) {
        throw new InvalidSettingsException("Please specify the name of the output column");
    }
    m_failOnError.validateSettings(settings);
    BitVectorType.getType(((SettingsModelString) m_vectorType.createCloneWithValidatedValue(settings)).getStringValue());
}
Also used : DataColumnSpecFilterConfiguration(org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration) InvalidSettingsException(org.knime.core.node.InvalidSettingsException) SettingsModelString(org.knime.core.node.defaultnodesettings.SettingsModelString) SettingsModelString(org.knime.core.node.defaultnodesettings.SettingsModelString)

Example 45 with SettingsModelString

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

the class CreateBitVectorNodeModel method createMSCSetMatchingModel.

/**
 *@return the multi string column set matching model
 */
static SettingsModelString createMSCSetMatchingModel() {
    final SettingsModelString m = new SettingsModelString("multiStringColumnSetMatching", SetMatching.MATCHING.getActionCommand());
    m.setEnabled(false);
    return m;
}
Also used : SettingsModelString(org.knime.core.node.defaultnodesettings.SettingsModelString)

Aggregations

SettingsModelString (org.knime.core.node.defaultnodesettings.SettingsModelString)99 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)39 SettingsModelBoolean (org.knime.core.node.defaultnodesettings.SettingsModelBoolean)15 ChangeListener (javax.swing.event.ChangeListener)13 ChangeEvent (javax.swing.event.ChangeEvent)12 IOException (java.io.IOException)8 CanceledExecutionException (org.knime.core.node.CanceledExecutionException)8 DialogComponentString (org.knime.core.node.defaultnodesettings.DialogComponentString)7 Duration (java.time.Duration)5 Period (java.time.Period)5 DateTimeParseException (java.time.format.DateTimeParseException)5 SettingsModelDateTime (org.knime.time.util.SettingsModelDateTime)5 File (java.io.File)4 LocalDate (java.time.LocalDate)4 LocalDateTime (java.time.LocalDateTime)4 ZonedDateTime (java.time.ZonedDateTime)4 Temporal (java.time.temporal.Temporal)4 TemporalAmount (java.time.temporal.TemporalAmount)4 DateTimeType (org.knime.time.util.DateTimeType)4 DateTimeException (java.time.DateTimeException)3