Performance and GUI improvements

git-svn-id: https://svn.code.sf.net/p/jailer/code/trunk@1433 3dd849cd-670e-4645-a7cd-dd197c8d0e81
This commit is contained in:
rwisser
2017-10-19 09:48:48 +00:00
parent 264a49ee8d
commit 60f80085f3
13 changed files with 1006 additions and 823 deletions
BIN
View File
Binary file not shown.
+3
View File
@@ -1,3 +1,6 @@
3.7.3
- Performance and GUI improvements.
3.7.2
- Table search feature.
- Minor GUI improvements.
+3
View File
@@ -1,3 +1,6 @@
7.5.3
- Performance and GUI improvements.
7.5.2
- https://github.com/Wisser/Jailer/pull/5 "Include the column names in the first statement to avoid ORA-00918: column ambiguously defined"
- Table search feature.
@@ -25,7 +25,7 @@ public class JailerVersion {
/**
* The Jailer version.
*/
public static final String VERSION = "7.5.2";
public static final String VERSION = "7.5.3";
/**
* The Jailer working tables version.
+63 -6
View File
@@ -24,7 +24,6 @@ import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.event.ActionEvent;
@@ -104,10 +103,13 @@ public abstract class ClosureView extends javax.swing.JDialog {
* Holds infos about a cell in the closure-table.
*/
private class CellInfo {
public int row, column;
public int row, column, level;
boolean ignored = false;
Set<CellInfo> parents = new HashSet<CellInfo>(4);
boolean selected;
CellInfo(int level) {
this.level = level;
}
void select() {
if (!selected) {
selected = true;
@@ -393,7 +395,7 @@ public abstract class ClosureView extends javax.swing.JDialog {
((JLabel) render).setFont(normal);
String text = ((JLabel) render).getText();
if (!"".equals(text)) {
((JLabel) render).setToolTipText(text);
((JLabel) render).setToolTipText(toolTip(text, cellInfo));
} else {
((JLabel) render).setToolTipText(null);
}
@@ -444,6 +446,61 @@ public abstract class ClosureView extends javax.swing.JDialog {
setAlwaysOnTop(true);
}
protected String toolTip(String tableName, CellInfo theCellInfo) {
if (theCellInfo == null || theCellInfo.table == null|| theCellInfo.level >= Integer.MAX_VALUE / 2) {
return tableName;
}
Set<String> nb_up = new TreeSet<String>();
Set<String> nb_same = new TreeSet<String>();
Set<String> nb_down = new TreeSet<String>();
for (Association a: theCellInfo.table.associations) {
Table dest = a.destination;
String destName = getDataModel().getDisplayName(dest);
CellInfo destInfo = cellInfo.get(destName);
if (destInfo != null) {
int dif = destInfo.level - theCellInfo.level;
if (dif == -1) {
nb_up.add(destName);
} else if (dif == 0) {
nb_same.add(destName);
} else if (dif == 1) {
nb_down.add(destName);
}
}
}
nb_same.add("<b>" + tableName + "</b>");
int maxWidth = 6;
String sep = "";
if (nb_up.size() > maxWidth || nb_same.size() > maxWidth || nb_down.size() > maxWidth) {
sep = "<tr><td></td></tr>";
}
String tip = "<html>"
+ "<table cellspacing=0 cellpadding=0>"
+ tipJoin(nb_up, theCellInfo.level - 1)
+ sep
+ tipJoin(nb_same, theCellInfo.level)
+ sep
+ tipJoin(nb_down, theCellInfo.level + 1)
+ "</table>";
return tip;
}
private String tipJoin(Set<String> tipList, int level) {
StringBuilder sb = new StringBuilder();
int w = 0;
for (String tip: tipList) {
if (++w > 6) {
w = 0;
sb.append("</tr><tr><td></td>");
}
sb.append("<td>&nbsp;" + tip + "&nbsp;</td>");
}
if (sb.length() == 0) {
return "";
}
return "<tr><td>&nbsp;&nbsp;" + (level + 1) + "&nbsp;</td>" + sb.toString() + "</tr>";
}
protected SortedMap<String, Association> sortedNamed(List<Association> aList) {
SortedMap<String, Association> result = new TreeMap<String, Association>();
@@ -594,7 +651,7 @@ public abstract class ClosureView extends javax.swing.JDialog {
String displayName = getDataModel().getDisplayName(selectedTable);
currentLine.add(displayName);
visited.add(displayName);
CellInfo cellInfo = new CellInfo();
CellInfo cellInfo = new CellInfo(-1);
cellInfo.column = 1;
cellInfo.row = 0;
cellInfo.table = selectedTable;
@@ -668,7 +725,7 @@ public abstract class ClosureView extends javax.swing.JDialog {
if (!visited.contains(displayName)) {
nextLine.add(displayName);
visited.add(displayName);
CellInfo cellInfo = new CellInfo();
CellInfo cellInfo = new CellInfo(distance);
cellInfo.parents.add(cellInfoT);
cellInfo.table = association.destination;
if (association.isInsertDestinationBeforeSource()) {
@@ -706,7 +763,7 @@ public abstract class ClosureView extends javax.swing.JDialog {
cellInfoT = this.cellInfo.get(destName);
CellInfo cellInfo = this.cellInfo.get(displayName);
if (cellInfo == null) {
cellInfo = new CellInfo();
cellInfo = new CellInfo(distance);
cellInfo.table = table;
nextLine.add(displayName);
visited.add(displayName);
File diff suppressed because it is too large Load Diff
@@ -27,7 +27,7 @@ import net.sf.jailer.JailerVersion;
public class DataBrowserContext {
private static String STANDALONE_APP_NAME = "DBeauty";
private static String STANDALONE_APP_VERSION = "3.7.2";
private static String STANDALONE_APP_VERSION = "3.7.3";
private static boolean supportsDataModelUpdates = true;
private static Boolean standAlone = null;
@@ -26,7 +26,6 @@ import java.util.List;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.SwingUtilities;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
@@ -45,6 +45,7 @@ public class MDTable extends MDObject {
private List<String> primaryKey;
private List<String> columns;
private AtomicBoolean loading = new AtomicBoolean(false);
private AtomicBoolean loaded = new AtomicBoolean(false);
private final boolean isView;
private final boolean isSynonym;
@@ -131,19 +132,23 @@ public class MDTable extends MDObject {
if (columns == null) {
columns = new ArrayList<String>();
primaryKey = new ArrayList<String>();
MetaDataSource metaDataSource = getMetaDataSource();
synchronized (metaDataSource.getSession().getMetaData()) {
ResultSet rs = JDBCMetaDataBasedModelElementFinder.getColumns(getSchema().getMetaDataSource().getSession(), getSchema().getMetaDataSource().getSession().getMetaData(), Quoting.staticUnquote(getSchema().getName()), Quoting.staticUnquote(getName()), "%", false);
while (rs.next()) {
columns.add(metaDataSource.getQuoting().quote(rs.getString(4)));
}
rs.close();
rs = JDBCMetaDataBasedModelElementFinder.getPrimaryKeys(getSchema().getMetaDataSource().getSession(), getSchema().getMetaDataSource().getSession().getMetaData(), getSchema().getName(), getName(), false);
while (rs.next()) {
primaryKey.add(rs.getString(4));
}
rs.close();
try {
MetaDataSource metaDataSource = getMetaDataSource();
synchronized (metaDataSource.getSession().getMetaData()) {
ResultSet rs = JDBCMetaDataBasedModelElementFinder.getColumns(getSchema().getMetaDataSource().getSession(), getSchema().getMetaDataSource().getSession().getMetaData(), Quoting.staticUnquote(getSchema().getName()), Quoting.staticUnquote(getName()), "%", false);
while (rs.next()) {
columns.add(metaDataSource.getQuoting().quote(rs.getString(4)));
}
rs.close();
rs = JDBCMetaDataBasedModelElementFinder.getPrimaryKeys(getSchema().getMetaDataSource().getSession(), getSchema().getMetaDataSource().getSession().getMetaData(), getSchema().getName(), getName(), false);
while (rs.next()) {
primaryKey.add(rs.getString(4));
}
rs.close();
}
} finally {
loaded.set(true);
}
}
}
@@ -183,7 +188,7 @@ public class MDTable extends MDObject {
}
public boolean isLoaded() {
return columns != null;
return loaded.get();
}
private static final BlockingQueue<Runnable> queue = new LinkedBlockingQueue<Runnable>();
@@ -30,6 +30,7 @@ import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -84,6 +85,7 @@ public abstract class MetaDataPanel extends javax.swing.JPanel {
private final DataModel dataModel;
private final MetaDataDetailsPanel metaDataDetailsPanel;
private final Frame parent;
private final JButton searchButton;
private abstract class ExpandingMutableTreeNode extends DefaultMutableTreeNode {
@@ -131,7 +133,7 @@ public abstract class MetaDataPanel extends javax.swing.JPanel {
gridBagConstraints.gridy = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.NONE;
gridBagConstraints.weightx = 0;
JButton searchButton = StringSearchPanel.createSearchButton(parent, tablesComboBox, "Select Table", new Runnable() {
searchButton = StringSearchPanel.createSearchButton(parent, tablesComboBox, "Select Table", new Runnable() {
@Override
public void run() {
onSelectTable();
@@ -319,7 +321,7 @@ public abstract class MetaDataPanel extends javax.swing.JPanel {
if (path != null) {
final Object last = path.getLastPathComponent();
if (metaDataTree.getModel().getRoot() == last) {
openNewTableBrowser();
// searchButton.doClick();
}
if (last instanceof DefaultMutableTreeNode) {
final Object uo = ((DefaultMutableTreeNode) last).getUserObject();
@@ -355,13 +357,15 @@ public abstract class MetaDataPanel extends javax.swing.JPanel {
Set<String> tableSet = new HashSet<String>();
for (Table table: dataModel.getTables()) {
String displayName = dataModel.getDisplayName(table);
tableSet.add(displayName);
if (metaDataSource.toMDTable(table) == null) {
String displayName = dataModel.getDisplayName(table);
tableSet.add(displayName);
}
}
for (MDSchema schema: metaDataSource.getSchemas()) {
if (schema.isLoaded()) {
for (MDTable table: schema.getTables()) {
if (metaDataSource.toTable(table) == null && !ModelBuilder.isJailerTable(table.getName())) {
if (!ModelBuilder.isJailerTable(table.getName())) {
String name;
if (!schema.isDefaultSchema) {
name = schema.getName() + "." + table.getName();
@@ -375,7 +379,12 @@ public abstract class MetaDataPanel extends javax.swing.JPanel {
}
}
List<String> tables = new ArrayList<String>(tableSet);
Collections.sort(tables);
Collections.sort(tables, new Comparator<String>() {
@Override
public int compare(String o1, String o2) {
return o1.compareToIgnoreCase(o2);
}
});
ComboBoxModel model = new DefaultComboBoxModel(new Vector(tables));
tablesComboBox.setModel(model);
@@ -224,8 +224,10 @@ public abstract class SQLConsole extends javax.swing.JPanel {
});
RTextScrollPane jScrollPane = new RTextScrollPane();
jScrollPane.setViewportView(editorPane);
editorPane.setGutter(jScrollPane.getGutter());
consoleContainerPanel.add(jScrollPane);
jScrollPane.setLineNumbersEnabled(true);
jScrollPane.setIconRowHeaderEnabled(true);
runSQLButton.setAction(editorPane.runBlock);
runnAllButton.setAction(editorPane.runAll);
@@ -618,6 +620,7 @@ public abstract class SQLConsole extends javax.swing.JPanel {
Color runningColor = new Color(255, 255, 210);
if (location != null) {
editorPane.removeAllLineHighlights();
editorPane.setHighlightCurrentLine(false);
try {
for (int i = location.a; i <= location.b; ++i) {
Color hl;
Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

@@ -15,7 +15,6 @@
*/
package net.sf.jailer.ui.syntaxtextarea;
import java.awt.Color;
import java.awt.Dialog;
import java.awt.Frame;
import java.awt.Window;
@@ -30,6 +29,7 @@ import java.util.regex.Pattern;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.ActionMap;
import javax.swing.ImageIcon;
import javax.swing.InputMap;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
@@ -49,10 +49,12 @@ import org.fife.rsta.ui.search.SearchEvent;
import org.fife.rsta.ui.search.SearchListener;
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
import org.fife.ui.rsyntaxtextarea.SyntaxConstants;
import org.fife.ui.rtextarea.Gutter;
import org.fife.ui.rtextarea.SearchContext;
import org.fife.ui.rtextarea.SearchEngine;
import org.fife.ui.rtextarea.SearchResult;
import net.sf.jailer.ui.databrowser.metadata.MetaDataPanel;
import net.sf.jailer.util.Pair;
/**
@@ -150,8 +152,9 @@ public class RSyntaxTextAreaWithSQLSyntaxStyle extends RSyntaxTextArea implement
}
});
setHighlightCurrentLine(false);
setHighlightCurrentLine(true);
setFadeCurrentLineHighlight(true);
createPopupMenu();
updateMenuItemState();
}
@@ -469,13 +472,25 @@ public class RSyntaxTextAreaWithSQLSyntaxStyle extends RSyntaxTextArea implement
if (allowRun && setLineHighlights) {
if (!pending.get()) {
removeAllLineHighlights();
for (int l = loc.a; l <= loc.b; ++l) {
setHighlightCurrentLine(true);
if (gutter != null) {
gutter.removeAllTrackingIcons();
try {
addLineHighlight(l, new Color(235, 240, 255));
if (loc.a != loc.b || !getText(loc.a, loc.b, true).trim().isEmpty()) {
for (int l = loc.a; l <= loc.b; ++l) {
gutter.addLineTrackingIcon(l, icon);
}
}
} catch (BadLocationException e) {
e.printStackTrace();
}
}
// for (int l = loc.a; l <= loc.b; ++l) {
// try {
// addLineHighlight(l, new Color(235, 255, 245));
// } catch (BadLocationException e) {
// e.printStackTrace();
// }
// }
if (loc.b - loc.a > 10000) {
stopped.set(false);
pending.set(true);
@@ -533,5 +548,22 @@ public class RSyntaxTextAreaWithSQLSyntaxStyle extends RSyntaxTextArea implement
private final AtomicBoolean stopped = new AtomicBoolean(false);
private final AtomicBoolean pending = new AtomicBoolean(false);
private Gutter gutter;
public void setGutter(Gutter gutter) {
this.gutter = gutter;
}
private static ImageIcon icon;
static {
String dir = "/net/sf/jailer/ui/resource";
// load images
try {
icon = new ImageIcon(MetaDataPanel.class.getResource(dir + "/sqlconsole.png"));
} catch (Exception e) {
e.printStackTrace();
}
}
}