private void populateUnitCombo() {

    if (comboWidthUnits.getItemCount() != 0) {
      return; // this collection is inmutable, only populates the first
      // time
    }

    final Unit<?> defaultUnit = Preferences.bufferUnits();
    final Set<Unit<?>> commonLengthUnits = UnitList.getCommonLengthUnits();

    SortedMap<String, Unit<?>> units = new TreeMap<String, Unit<?>>();
    for (Unit<?> unit : commonLengthUnits) {
      units.put(UnitList.getUnitName(unit), unit);
    }

    bufferUnits = new ArrayList<Unit<?>>(units.values());

    int index = 0;
    Set<Entry<String, Unit<?>>> unitset = units.entrySet();
    for (Entry<String, Unit<?>> entry : unitset) {

      String unitName = entry.getKey();
      comboWidthUnits.add(unitName, index);
      if (defaultUnit.equals(units.get(unitName))) {
        comboWidthUnits.select(index);
      }
      index++;
    }
  }
  /** Populates the default options */
  @Override
  protected final void populate() {

    // set default distance
    if (this.defaultDistance == null) {

      this.defaultDistance = Preferences.bufferWidth();
    }
    if (this.currentDistance == null) {
      this.currentDistance = this.defaultDistance;
    }

    textBufferWidth.setText(String.valueOf(this.currentDistance));

    // sets the units
    populateUnitCombo();

    if (this.defaultUnits == null) {

      // sets the maps units as default

      this.defaultUnits = getMapUnits();
    }
    this.currentUnits = this.defaultUnits;

    String unitName = UnitList.getUnitName(this.currentUnits);

    comboWidthUnits.setText(unitName);

    if (this.defaultRadioUnitOption == null) {
      setSelectionUnitOption(this.radioMapUnits);
      this.defaultRadioUnitOption = this.radioMapUnits;
    } else {
      setSelectionUnitOption(this.defaultRadioUnitOption);
    }
  }
  @Override
  protected void populate() {

    switchShowHideDemo(Preferences.showDemo());
  }