/** @see nl.lxtreme.ols.api.Configurable#writePreferences(nl.lxtreme.ols.api.UserSettings) */
 @Override
 public void writePreferences(final UserSettings aSettings) {
   aSettings.putInt("rxd", this.rxd.getSelectedIndex());
   aSettings.putInt("txd", this.txd.getSelectedIndex());
   aSettings.putInt("cts", this.cts.getSelectedIndex());
   aSettings.putInt("rts", this.rts.getSelectedIndex());
   aSettings.putInt("dtr", this.dtr.getSelectedIndex());
   aSettings.putInt("dsr", this.dsr.getSelectedIndex());
   aSettings.putInt("dcd", this.dcd.getSelectedIndex());
   aSettings.putInt("ri", this.ri.getSelectedIndex());
   aSettings.putInt("parity", this.parity.getSelectedIndex());
   aSettings.putInt("bits", this.bits.getSelectedIndex());
   aSettings.putInt("stop", this.stop.getSelectedIndex());
   aSettings.putBoolean("inverted", this.inv.isSelected());
 }
  /** {@inheritDoc} */
  @Override
  public void readPreferences(final UserSettings aSettings) {
    // Issue #114: avoid setting illegal values...
    setComboBoxIndex(this.rxd, aSettings, "rxd");
    setComboBoxIndex(this.txd, aSettings, "txd");
    setComboBoxIndex(this.cts, aSettings, "cts");
    setComboBoxIndex(this.rts, aSettings, "rts");
    setComboBoxIndex(this.dtr, aSettings, "dtr");
    setComboBoxIndex(this.dsr, aSettings, "dsr");
    setComboBoxIndex(this.dcd, aSettings, "dcd");
    setComboBoxIndex(this.ri, aSettings, "ri");

    this.parity.setSelectedIndex(aSettings.getInt("parity", this.parity.getSelectedIndex()));
    this.bits.setSelectedIndex(aSettings.getInt("bits", this.bits.getSelectedIndex()));
    this.stop.setSelectedIndex(aSettings.getInt("stop", this.stop.getSelectedIndex()));
    this.idleLevel.setSelectedIndex(
        aSettings.getInt("idle-state", this.idleLevel.getSelectedIndex()));
    this.bitEncoding.setSelectedIndex(
        aSettings.getInt("bit-encoding", this.bitEncoding.getSelectedIndex()));
    this.bitOrder.setSelectedIndex(aSettings.getInt("bit-order", this.bitOrder.getSelectedIndex()));
    this.baudrate.setSelectedItem(Integer.valueOf(aSettings.getInt("baudrate", 9600)));
    this.autoDetectBaudRate.setSelected(
        aSettings.getBoolean("auto-baudrate", this.autoDetectBaudRate.isSelected()));
  }
 /** @see nl.lxtreme.ols.api.Configurable#writePreferences(nl.lxtreme.ols.api.UserSettings) */
 @Override
 public void writePreferences(final UserSettings aSettings) {
   aSettings.putInt("rxd", this.rxd.getSelectedIndex());
   aSettings.putInt("txd", this.txd.getSelectedIndex());
   aSettings.putInt("cts", this.cts.getSelectedIndex());
   aSettings.putInt("rts", this.rts.getSelectedIndex());
   aSettings.putInt("dtr", this.dtr.getSelectedIndex());
   aSettings.putInt("dsr", this.dsr.getSelectedIndex());
   aSettings.putInt("dcd", this.dcd.getSelectedIndex());
   aSettings.putInt("ri", this.ri.getSelectedIndex());
   aSettings.putInt("parity", this.parity.getSelectedIndex());
   aSettings.putInt("bits", this.bits.getSelectedIndex());
   aSettings.putInt("stop", this.stop.getSelectedIndex());
   aSettings.putInt("idle-state", this.idleLevel.getSelectedIndex());
   aSettings.putInt("bit-encoding", this.bitEncoding.getSelectedIndex());
   aSettings.putInt("bit-order", this.bitOrder.getSelectedIndex());
   aSettings.putInt("baudrate", ((Integer) this.baudrate.getSelectedItem()).intValue());
   aSettings.putBoolean("auto-baudrate", this.autoDetectBaudRate.isSelected());
 }