mirror of
https://github.com/Wisser/Jailer.git
synced 2026-05-24 11:39:31 -05:00
Database-side filtering of ad hoc queries in SQL Console.
This commit is contained in:
@@ -777,7 +777,7 @@ public abstract class BrowserContentPane extends javax.swing.JPanel {
|
||||
/**
|
||||
* Indexes of primary key columns.
|
||||
*/
|
||||
private Set<Integer> pkColumns = new HashSet<Integer>();
|
||||
protected Set<Integer> pkColumns = new HashSet<Integer>();
|
||||
|
||||
/**
|
||||
* Indexes of foreign key columns.
|
||||
@@ -7117,13 +7117,13 @@ public abstract class BrowserContentPane extends javax.swing.JPanel {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private Reference<JTable> currentRowsTableReference = null;
|
||||
public Reference<JTable> currentRowsTableReference = null;
|
||||
|
||||
public void setCurrentRowsTable(Reference<JTable> reference) {
|
||||
currentRowsTableReference = reference;
|
||||
}
|
||||
|
||||
private Reference<Boolean> currentRowsSortedReference = null;
|
||||
public Reference<Boolean> currentRowsSortedReference = null;
|
||||
|
||||
public void setCurrentRowsSorted(Reference<Boolean> reference) {
|
||||
currentRowsSortedReference = reference;
|
||||
@@ -7131,7 +7131,7 @@ public abstract class BrowserContentPane extends javax.swing.JPanel {
|
||||
|
||||
private StringSearchPanel searchPanel;
|
||||
|
||||
private void findColumns(final int x, final int y, final JTable contextJTable, boolean columnsSorted, Runnable onClose) {
|
||||
public void findColumns(final int x, final int y, final JTable contextJTable, boolean columnsSorted, Runnable onClose) {
|
||||
TableColumnModel columnModel = rowsTable.getColumnModel();
|
||||
List<String> columNames = new ArrayList<String>();
|
||||
Map<String, Integer> columNamesCount = new HashMap<String, Integer>();
|
||||
@@ -7363,7 +7363,8 @@ public abstract class BrowserContentPane extends javax.swing.JPanel {
|
||||
result.x -= 2;
|
||||
if (result.y >= 8) {
|
||||
result.y = 2;
|
||||
} else if (Environment.nimbus) {
|
||||
}
|
||||
if (Environment.nimbus) {
|
||||
RowSorter<? extends TableModel> rowSorter = rowsTable.getRowSorter();
|
||||
boolean withSortIcon = false;
|
||||
if (rowSorter != null) {
|
||||
|
||||
@@ -1138,9 +1138,18 @@ public abstract class SQLConsole extends javax.swing.JPanel {
|
||||
tabContentPanel.controlsPanel1.add(findButton);
|
||||
tabContentPanel.controlsPanel1.add(new JLabel(" "));
|
||||
tabContentPanel.controlsPanel1.add(rb.sortColumnsCheckBox);
|
||||
tabContentPanel.controlsPanel1.add(rb.findColumnsPanel);
|
||||
JToggleButton findColumnsButton = new JToggleButton(rb.findColumnsLabel.getText());
|
||||
findColumnsButton.setFocusable(false);
|
||||
findColumnsButton.setIcon(UIUtil.scaleIcon(findColumnsButton, searchCIcon));
|
||||
findColumnsButton.addActionListener(e -> {
|
||||
if (findColumnsButton.isSelected()) {
|
||||
Point point = new Point(0, findColumnsButton.getHeight());
|
||||
SwingUtilities.convertPointToScreen(point, findColumnsButton);
|
||||
rb.findColumns((int) point.getX(), (int) point.getY(), rb.currentRowsTableReference == null? rb.rowsTable : rb.currentRowsTableReference.get(), rb.currentRowsSortedReference == null? rb.sortColumnsCheckBox.isSelected() : rb.currentRowsSortedReference.get(), () -> { findColumnsButton.setSelected(false); });
|
||||
}
|
||||
});
|
||||
tabContentPanel.controlsPanel1.add(findColumnsButton);
|
||||
tabContentPanel.controlsPanel1.add(new JLabel(" "));
|
||||
rb.findColumnsLabel.setIcon(UIUtil.scaleIcon(rb.findColumnsLabel, searchCIcon));
|
||||
rb.sortColumnsCheckBox.addActionListener(new java.awt.event.ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
@@ -1153,6 +1162,7 @@ public abstract class SQLConsole extends javax.swing.JPanel {
|
||||
}
|
||||
});
|
||||
final JButton loadButton = new JButton(rb.loadButton.getText(), rb.loadButton.getIcon());
|
||||
loadButton.setFocusable(false);
|
||||
tabContentPanel.loadButton = loadButton;
|
||||
loadButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
@@ -2082,7 +2092,9 @@ public abstract class SQLConsole extends javax.swing.JPanel {
|
||||
openConditionEditor(null, 0, null);
|
||||
}
|
||||
public Set<Integer> getPkColumnsConsole() {
|
||||
return pkColumnsConsole;
|
||||
HashSet<Integer> result = new HashSet<Integer>(pkColumns);
|
||||
result.addAll(pkColumnsConsole);
|
||||
return result;
|
||||
}
|
||||
@Override
|
||||
protected Table getWhereClauseEditorBaseTable() {
|
||||
|
||||
Reference in New Issue
Block a user