Search in sources :

Example 1 with LineEnding

use of org.knime.base.node.io.csvwriter.FileWriterSettings.LineEnding in project knime-core by knime.

the class AdvancedPanel method loadValuesIntoPanel.

/**
 * Reads new values from the specified object and puts them into the panel's
 * components.
 *
 * @param settings object holding the new values to show.
 */
void loadValuesIntoPanel(final FileWriterSettings settings) {
    // support \t and \n
    String colSep = settings.getColSeparator();
    colSep = FileWriterSettings.escapeString(colSep);
    m_colSeparator.setText(colSep);
    m_missValuePattern.setText(settings.getMissValuePattern());
    LineEnding leMode = settings.getLineEndingMode();
    switch(leMode) {
        case SYST:
            m_bGroup.setSelected(m_defEnding, true);
            break;
        case LF:
            m_bGroup.setSelected(m_lfEnding, true);
            break;
        case CRLF:
            m_bGroup.setSelected(m_crlfEnding, true);
            break;
        case CR:
            m_bGroup.setSelected(m_crEnding, true);
            break;
    }
}
Also used : LineEnding(org.knime.base.node.io.csvwriter.FileWriterSettings.LineEnding)

Example 2 with LineEnding

use of org.knime.base.node.io.csvwriter.FileWriterSettings.LineEnding in project knime-core by knime.

the class AdvancedPanel method saveValuesFromPanelInto.

/**
 * Writes the current values from the components into the settings object.
 *
 * @param settings the object to write the values into
 */
void saveValuesFromPanelInto(final FileWriterSettings settings) {
    // support \t and \n
    String colSep = m_colSeparator.getText();
    colSep = FileWriterSettings.unescapeString(colSep);
    settings.setColSeparator(colSep);
    settings.setMissValuePattern(m_missValuePattern.getText());
    ButtonModel lf = m_bGroup.getSelection();
    LineEnding mode;
    if (lf == m_defEnding) {
        mode = LineEnding.SYST;
    } else if (lf == m_lfEnding) {
        mode = LineEnding.LF;
    } else if (lf == m_crlfEnding) {
        mode = LineEnding.CRLF;
    } else if (lf == m_crEnding) {
        mode = LineEnding.CR;
    } else {
        mode = LineEnding.SYST;
    }
    settings.setLineEndingMode(mode);
}
Also used : LineEnding(org.knime.base.node.io.csvwriter.FileWriterSettings.LineEnding) ButtonModel(javax.swing.ButtonModel)

Aggregations

LineEnding (org.knime.base.node.io.csvwriter.FileWriterSettings.LineEnding)2 ButtonModel (javax.swing.ButtonModel)1