for (int j = 0; j < rowButtonsRename.length; j++) {
final int row = j;
final JButton buttonRename = new JButton("Rename");
buttonRename.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
final Variable toBeRenamed = (Variable) (variables
.toArray()[row]);
final String newName = JOptionPane.showInputDialog(
AdvancedQueryEditor.this,
"Please enter a new variable name for "
+ toBeRenamed.toString() + ":",
toBeRenamed.toString());
statusBar.setText("Rename variable " + toBeRenamed
+ "...");
final String newQuery = determineNewQueryRenamedVariable(
currentBrowserQuery, toBeRenamed, newName);
System.out.println(newQuery);
updateAll(newQuery);
statusBar.clear();
}
});
final JPanel panelRename = new JPanel(new FlowLayout());
panelRename.add(buttonRename);
panelRename.setBackground(Color.WHITE);
rowButtonsRename[j] = panelRename;
}
rows[0] = rowButtonsRename;
final Object[] rowButtonsSort = new Object[variables.size()];
for (int j = 0; j < rowButtonsSort.length; j++) {
final int row = j;
final JButton buttonSort = new JButton("Sort");
buttonSort.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
final Variable toBeSorted = (Variable) (variables
.toArray()[row]);
statusBar.setText("Sort according to variable "
+ toBeSorted + "...");
final String newQuery = determineNewQuerySortAccordingToVariable(
currentBrowserQuery, toBeSorted);
System.out.println(newQuery);
updateAll(newQuery);
statusBar.clear();
}
});
final JPanel panelSort = new JPanel(new FlowLayout());
panelSort.add(buttonSort);
panelSort.setBackground(Color.WHITE);
rowButtonsSort[j] = panelSort;
}
rows[1] = rowButtonsSort;
final Object[] rowButtonsExclude = new Object[variables.size()];
for (int j = 0; j < rowButtonsExclude.length; j++) {
final int row = j;
final JButton buttonExclude = new JButton("Exclude");
buttonExclude.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
final Variable toBeExcluded = (Variable) (variables
.toArray()[row]);
statusBar.setText("Exclude variable " + toBeExcluded
+ "...");
final String newQuery = determineNewQueryProjectionWithoutVariable(
currentBrowserQuery, toBeExcluded);
System.out.println(newQuery);
updateAll(newQuery);
statusBar.clear();
}
});
final JPanel panelExclude = new JPanel(new FlowLayout());
panelExclude.add(buttonExclude);
panelExclude.setBackground(Color.WHITE);
rowButtonsExclude[j] = panelExclude;
}
rows[2] = rowButtonsExclude;
final Object[] rowButtonsRefine = new Object[variables.size()];
for (int j = 0; j < rowButtonsRefine.length; j++) {
final int row = j;
final JButton buttonRefine = new JButton("Refine");
buttonRefine.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
final Variable toBeRefined = (Variable) (variables
.toArray()[row]);
statusBar.setText("Refine variable " + toBeRefined
+ "...");
refineQuery(currentBrowserQuery, toBeRefined);
statusBar.clear();