return true;
}
@Override
protected JComponent getDialogContent() {
final DCPanel panel = new DCPanel();
int row = 0;
WidgetUtils.addToGridBag(DCLabel.bright("<html><b>Original value:</b></html>"), panel, 1, row);
WidgetUtils.addToGridBag(DCLabel.bright("<html><b>New/mapped value:</b></html>"), panel, 2, row);
row++;
WidgetUtils.addToGridBag(new JLabel(imageManager.getImageIcon("images/model/datastore.png")), panel, 0, row);
WidgetUtils.addToGridBag(DCLabel.bright(_metadata.getDatastoreName()), panel, 1, row, GridBagConstraints.WEST);
DCPanel datastoreButtonPanel = new DCPanel();
datastoreButtonPanel.setLayout(new HorizontalLayout(0));
datastoreButtonPanel.add(_datastoreCombobox);
datastoreButtonPanel.add(Box.createHorizontalStrut(4));
datastoreButtonPanel.add(_autoMapButton);
WidgetUtils.addToGridBag(datastoreButtonPanel, panel, 2, row, GridBagConstraints.WEST);
Set<String> tableNames = _sourceColumnComboBoxes.keySet();
for (final String tableName : tableNames) {
row++;
final JLabel tableLabel = DCLabel.bright("<html><b>" + tableName + "</b></html>");
tableLabel.setIcon(imageManager.getImageIcon("images/model/table.png", IconUtils.ICON_SIZE_SMALL));
WidgetUtils.addToGridBag(tableLabel, panel, 0, row, 2, 1, GridBagConstraints.WEST);
final JButton clearButton = new JButton("Clear");
clearButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
List<SourceColumnComboBox> comboBoxes = _sourceColumnComboBoxes.get(tableName);
for (SourceColumnComboBox comboBox : comboBoxes) {
comboBox.setModel(_datastore, false);
}
}
});
final DCPanel clearButtonPanel = new DCPanel();
clearButtonPanel.add(clearButton);
WidgetUtils.addToGridBag(clearButtonPanel, panel, 2, row, GridBagConstraints.CENTER);
final List<SourceColumnComboBox> comboBoxes = _sourceColumnComboBoxes.get(tableName);
for (SourceColumnComboBox comboBox : comboBoxes) {
row++;
WidgetUtils.addToGridBag(
new JLabel(imageManager.getImageIcon("images/model/column.png", IconUtils.ICON_SIZE_SMALL)), panel,
0, row);
WidgetUtils.addToGridBag(DCLabel.bright(comboBox.getName()), panel, 1, row, GridBagConstraints.WEST);
WidgetUtils.addToGridBag(comboBox, panel, 2, row, GridBagConstraints.WEST);
}
}
row++;
if (!_variableTextFields.isEmpty()) {
final JLabel tableLabel = DCLabel.bright("<html><b>Job-level variables</b></html>");
tableLabel.setIcon(imageManager.getImageIcon("images/filetypes/analysis_job.png", IconUtils.ICON_SIZE_SMALL));
WidgetUtils.addToGridBag(tableLabel, panel, 0, row, 2, 1, GridBagConstraints.WEST);
for (Entry<String, JXTextField> entry : _variableTextFields.entrySet()) {
row++;
String variableId = entry.getKey();
JXTextField textField = entry.getValue();
WidgetUtils.addToGridBag(
new JLabel(imageManager.getImageIcon("images/model/variable.png", IconUtils.ICON_SIZE_SMALL)),
panel, 0, row);
WidgetUtils.addToGridBag(DCLabel.bright(variableId), panel, 1, row, GridBagConstraints.WEST);
WidgetUtils.addToGridBag(textField, panel, 2, row, GridBagConstraints.WEST);
}
row++;
}
final DCPanel openButtonPanel = new DCPanel();
openButtonPanel.add(_openButton);
WidgetUtils.addToGridBag(openButtonPanel, panel, 2, row, GridBagConstraints.EAST);
return WidgetUtils.scrolleable(panel);
}