private void updateMappedColumns() {
    final Table table = _tableRef.get();
    final Set<Entry<InputColumn<?>, SourceColumnComboBox>> entrySet =
        _mappedColumnComboBoxes.entrySet();

    batchUpdateWidget(
        new Runnable() {
          @Override
          public void run() {
            for (Entry<InputColumn<?>, SourceColumnComboBox> entry : entrySet) {
              InputColumn<?> inputColumn = entry.getKey();
              SourceColumnComboBox comboBox = entry.getValue();

              if (table == null) {
                comboBox.setEmptyModel();
              } else {
                comboBox.setModel(table);
                if (comboBox.getSelectedItem() == null) {
                  Column column = getDefaultMappedColumn(inputColumn, table);
                  if (column != null) {
                    comboBox.setEditable(true);
                    comboBox.setSelectedItem(column);
                    comboBox.setEditable(false);
                  }
                }
              }
            }
          }
        });
  }
  private SourceColumnComboBox createComboBox(InputColumn<?> inputColumn, Column mappedColumn) {
    final SourceColumnComboBox sourceColumnComboBox = new SourceColumnComboBox();
    _mappedColumnComboBoxes.put(inputColumn, sourceColumnComboBox);

    Table table = _tableRef.get();
    if (mappedColumn == null && table != null) {
      mappedColumn = getDefaultMappedColumn(inputColumn, table);
    }

    if (mappedColumn == null) {
      logger.info("No default mapping found for column: {}", inputColumn);
    } else {
      sourceColumnComboBox.setEditable(true);
      sourceColumnComboBox.setSelectedItem(mappedColumn);
      sourceColumnComboBox.setEditable(false);
    }
    sourceColumnComboBox.addListener(
        new Listener<Column>() {
          @Override
          public void onItemSelected(Column item) {
            if (isBatchUpdating()) {
              return;
            }
            _sourceColumnUpdating = true;
            fireValueChanged();
            _mappedColumnNamesPropertyWidget.fireValueChanged();
            _sourceColumnUpdating = false;
          }
        });
    return sourceColumnComboBox;
  }
  @Override
  protected JComponent decorateCheckBox(final DCCheckBox<InputColumn<?>> checkBox) {
    final SourceColumnComboBox sourceColumnComboBox;
    final InputColumn<?> inputColumn = checkBox.getValue();
    if (_mappedColumnComboBoxes.containsKey(inputColumn)) {
      sourceColumnComboBox = _mappedColumnComboBoxes.get(inputColumn);
    } else {
      sourceColumnComboBox = createComboBox(inputColumn, null);
    }

    final JComponent decoratedSourceColumnComboBox =
        decorateSourceColumnComboBox(inputColumn, sourceColumnComboBox);

    checkBox.addListenerToHead(
        new DCCheckBox.Listener<InputColumn<?>>() {
          @Override
          public void onItemSelected(InputColumn<?> item, boolean selected) {
            _sourceColumnUpdating = true;
            decoratedSourceColumnComboBox.setVisible(selected);
          }
        });
    checkBox.addListener(
        new DCCheckBox.Listener<InputColumn<?>>() {
          @Override
          public void onItemSelected(InputColumn<?> item, boolean selected) {
            if (isBatchUpdating()) {
              return;
            }
            _mappedColumnNamesPropertyWidget.fireValueChanged();
            _sourceColumnUpdating = false;
          }
        });

    Table table = _tableRef.get();
    if (table != null) {
      sourceColumnComboBox.setModel(table);
    }

    decoratedSourceColumnComboBox.setVisible(checkBox.isSelected());

    final DCPanel panel = new DCPanel();
    panel.setLayout(new BorderLayout());
    panel.add(checkBox, BorderLayout.CENTER);
    panel.add(decoratedSourceColumnComboBox, BorderLayout.EAST);
    return panel;
  }
 public void setTable(Table table) {
   if (table != _tableRef.get()) {
     _tableRef.set(table);
     updateMappedColumns();
   }
 }