@Override
public DCPanel render(final AnnotatedRowsResult result) {
DCPanel panel = new DCPanel();
panel.setLayout(new VerticalLayout(4));
final DCTable table = new DCTable();
table.setColumnControlVisible(false);
InputColumn<?>[] highlightedColumns = result.getHighlightedColumns();
List<InputColumn<?>> inputColumns = result.getInputColumns();
DCPanel buttonPanel = new DCPanel();
buttonPanel.setLayout(new HorizontalLayout(4));
if (highlightedColumns.length == 1 && inputColumns.size() > 1) {
final JComboBox comboBox = new JComboBox(VIEWS);
comboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (comboBox.getSelectedItem() == VIEWS[0]) {
applyDetailedView(table, result);
} else {
applyDistinctValuesView(table, result);
}
}
});
comboBox.setSelectedItem(VIEWS[0]);
buttonPanel.add(comboBox);
} else {
applyDetailedView(table, result);
}
final JButton saveToFileButton = new JButton("Save dataset", ImageManager.getInstance().getImageIcon(
"images/actions/save.png"));
saveToFileButton.addActionListener(new SaveDataSetActionListener(result.getInputColumns(), result.getRows(),
userPreferences));
buttonPanel.add(saveToFileButton);
panel.add(buttonPanel);
panel.add(table.toPanel());
return panel;
}