Package org.eobjects.datacleaner.widgets

Examples of org.eobjects.datacleaner.widgets.SourceColumnComboBox


      // this tablePath will be used to group together columns from the
      // same original table
      final String tablePath = columnPath.substring(0, columnDelim);

      final SourceColumnComboBox comboBox = new SourceColumnComboBox();
      comboBox.setEnabled(false);
      comboBox.setName(columnPath);
      comboBox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
          Column col = comboBox.getSelectedItem();
          if (col != null) {
            // make sure all comboboxes in a group use the same
            // table
            List<SourceColumnComboBox> comboBoxes = _sourceColumnComboBoxes.get(tablePath);
            for (SourceColumnComboBox sameTableComboBox : comboBoxes) {
              sameTableComboBox.setModel(_datastore, col.getTable());
            }
          }
          refreshOpenButtonVisibility();
        }
      });

      if (!_sourceColumnComboBoxes.containsKey(tablePath)) {
        _sourceColumnComboBoxes.put(tablePath, new ArrayList<SourceColumnComboBox>());
      }

      _sourceColumnComboBoxes.get(tablePath).add(comboBox);
    }

    for (Entry<String, String> variableEntry : metadata.getVariables().entrySet()) {
      String id = variableEntry.getKey();
      String value = variableEntry.getValue();
      JXTextField textField = WidgetFactory.createTextField("Original: " + value);
      textField.setText(value);
      _variableTextFields.put(id, textField);
    }

    _openButton.setEnabled(false);
    _datastoreCatalog = configuration.getDatastoreCatalog();

    final String[] datastoreNames = _datastoreCatalog.getDatastoreNames();
    // the combobox will contain all datastore names and a null for
    // "not selected"
    final String[] comboBoxModel = CollectionUtils.array(new String[1], datastoreNames);
    _datastoreCombobox = new JComboBox(comboBoxModel);
    _datastoreCombobox.setEditable(false);
    _datastoreCombobox.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        final String datastoreName = (String) _datastoreCombobox.getSelectedItem();
        _datastore = _datastoreCatalog.getDatastore(datastoreName);

        _sourceColumnMapping.setDatastore(_datastore);

        refreshOpenButtonVisibility();

        for (List<SourceColumnComboBox> comboBoxes : _sourceColumnComboBoxes.values()) {
          for (SourceColumnComboBox comboBox : comboBoxes) {
            comboBox.setModel(_datastore);
            if (_datastore == null) {
              // no datastore selected
              comboBox.setEnabled(false);
            } else {
              comboBox.setEnabled(true);
            }
          }
        }

        if (_datastore == null) {
          _autoMapButton.setVisible(false);
        } else {
          _autoMapButton.setVisible(true);
        }
      }
    });

    _autoMapButton = new JButton("Map automatically");
    _autoMapButton.setVisible(false);
    _autoMapButton.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        _sourceColumnMapping.autoMap(_datastore);
        Set<String> paths = _sourceColumnMapping.getPaths();
        for (String path : paths) {
          for (List<SourceColumnComboBox> comboBoxes : _sourceColumnComboBoxes.values()) {
            for (SourceColumnComboBox comboBox : comboBoxes) {
              if (path.equals(comboBox.getName())) {
                comboBox.setSelectedItem(_sourceColumnMapping.getColumn(path));
              }
            }
          }
        }
      }
View Full Code Here


    _injectorBuilder = injectorBuilder;
    _nameTextField = WidgetFactory.createTextField("Synonym catalog name");
    String[] comboBoxModel = CollectionUtils.array(new String[1], _datastoreCatalog.getDatastoreNames());

    _datastoreComboBox = new JComboBox(comboBoxModel);
    _masterTermColumnComboBox = new SourceColumnComboBox();
    _synonymColumnsPanel = new MultiSourceColumnComboBoxPanel();
    _datastoreComboBox.setEditable(false);
    _treePanel = new DCPanel(WidgetUtils.BG_COLOR_BRIGHT, WidgetUtils.BG_COLOR_BRIGHTEST);
    _treePanel.setLayout(new BorderLayout());
View Full Code Here

    // add a single uninitialized combo box to begin with
    createSourceColumnComboBox(null);
  }

  private void createSourceColumnComboBox(Column column) {
    SourceColumnComboBox sourceColumnComboBox = (_table == null) ? new SourceColumnComboBox(_datastore)
        : new SourceColumnComboBox(_datastore, _table);
    sourceColumnComboBox.setSelectedItem(column);
    _sourceColumnComboBoxes.add(sourceColumnComboBox);
    _sourceComboBoxPanel.add(sourceColumnComboBox);
    _sourceComboBoxPanel.updateUI();
  }
View Full Code Here

  public List<Column> getColumns() {
    List<Column> columns = new ArrayList<Column>();
    Component[] components = _sourceComboBoxPanel.getComponents();
    for (Component component : components) {
      if (component instanceof SourceColumnComboBox) {
        SourceColumnComboBox sourceColumnComboBox = (SourceColumnComboBox) component;
        columns.add(sourceColumnComboBox.getSelectedItem());
      }
    }
    return columns;
  }
View Full Code Here

        if (!it.hasNext()) {
          return;
        }

        Column column = it.next();
        SourceColumnComboBox sourceColumnComboBox = (SourceColumnComboBox) component;
        sourceColumnComboBox.setSelectedItem(column);
      }
    }

    while (it.hasNext()) {
      createSourceColumnComboBox(it.next());
View Full Code Here

TOP

Related Classes of org.eobjects.datacleaner.widgets.SourceColumnComboBox

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.