several bug fixes

This commit is contained in:
Wisser
2018-04-30 09:11:11 +02:00
parent 609e4c823c
commit cb5c31cc20
11 changed files with 43 additions and 30 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
7.8.1
7.8.2
- The new feature "Analyze SQL" analyzes SQL statements and proposes association definitions.
This allows to reverse-engineer the data model based on existing SQL queries.
- Improved render quality on high resolution screens.
@@ -25,7 +25,7 @@ public class JailerVersion {
/**
* The Jailer version.
*/
public static final String VERSION = "7.8.1";
public static final String VERSION = "7.8.2";
/**
* The Jailer working tables version.
@@ -100,7 +100,7 @@ public class KnownIdentifierMap {
}
private String normalizeColumnName(String tableName, String columnName) {
return "C" + Quoting.normalizeIdentifier(tableName) + "(.)" + Quoting.staticUnquote(columnName);
return "C" + Quoting.normalizeIdentifier(tableName) + "(.)" + Quoting.normalizeIdentifier(columnName);
}
private Pattern columnComparisionPattern = Pattern.compile("(A|a|B|b)( *\\. *)((?:[\"][^\"]+[\"])|(?:[`][^`]+[`])|(?:['][^']+['])|(?:[\\w]+))");
+18
View File
@@ -944,4 +944,22 @@ public class UIUtil {
clipboard.setContents(selection, selection);
}
/**
* Pair of Icon and Text.
*/
public static class IconWithText {
public final String text;
public final ImageIcon icon;
public IconWithText(String text, ImageIcon icon) {
this.text = text;
this.icon = icon;
}
@Override
public String toString() {
return text;
}
}
}
@@ -795,9 +795,9 @@ public abstract class BrowserContentPane extends javax.swing.JPanel {
if (r != null) {
renderRowAsPK = renderRowAsPK(r);
Object cellContent = r.values.length > column? r.values[column] : null;
if (cellContent instanceof JLabel) {
((JLabel) render).setIcon(((JLabel) cellContent).getIcon());
((JLabel) render).setText(((JLabel) cellContent).getText());
if (cellContent instanceof UIUtil.IconWithText) {
((JLabel) render).setIcon(((UIUtil.IconWithText) cellContent).icon);
((JLabel) render).setText(((UIUtil.IconWithText) cellContent).text);
}
}
}
@@ -190,8 +190,8 @@ public abstract class DetailsView extends javax.swing.JPanel {
}
if (selectableFields) {
JTextArea f = new JTextArea();
if (v instanceof JLabel) {
f.setText(((JLabel) v).getText());
if (v instanceof UIUtil.IconWithText) {
f.setText(((UIUtil.IconWithText) v).text);
} else {
f.setText(v == null? "" : v.toString());
}
@@ -201,9 +201,9 @@ public abstract class DetailsView extends javax.swing.JPanel {
} else {
JLabel f = new JLabel();
String text;
if (v instanceof JLabel) {
text = ((JLabel) v).getText() + " ";
f.setIcon(((JLabel) v).getIcon());
if (v instanceof UIUtil.IconWithText) {
text = ((UIUtil.IconWithText) v).text + " ";
f.setIcon(((UIUtil.IconWithText) v).icon);
} else {
text = (v == null? "null" : v.toString()) + " ";
}
@@ -33,11 +33,11 @@ import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import org.apache.log4j.Logger;
import net.sf.jailer.modelbuilder.MemorizedResultSet;
import net.sf.jailer.ui.UIUtil;
import net.sf.jailer.util.Quoting;
/**
@@ -328,8 +328,8 @@ public class MDSchema extends MDObject {
}
private static Map<String, ImageIcon> constraintTypeIcons = Collections.synchronizedMap(new HashMap<String, ImageIcon>());
public static JLabel getConstraintTypeIcon(final String type) {
public static UIUtil.IconWithText getConstraintTypeIcon(final String type) {
ImageIcon icon = null;
if (type != null) {
String iconURL = "constraint_" + (type.replaceAll(" +", "").toLowerCase()) + ".png";
@@ -342,14 +342,7 @@ public class MDSchema extends MDObject {
}
constraintTypeIcons.put(iconURL, icon);
}
JLabel label = new JLabel(type) {
@Override
public String toString() {
return type;
}
};
label.setIcon(icon);
return label;
return new UIUtil.IconWithText(type, icon);
}
}
@@ -104,6 +104,8 @@ import net.sf.jailer.modelbuilder.ModelBuilder;
import net.sf.jailer.ui.AutoCompletion;
import net.sf.jailer.ui.JComboBox;
import net.sf.jailer.ui.StringSearchPanel;
import net.sf.jailer.ui.UIUtil;
import net.sf.jailer.ui.UIUtil.IconWithText;
import net.sf.jailer.util.Quoting;
/**
@@ -350,7 +352,7 @@ public abstract class MetaDataPanel extends javax.swing.JPanel {
DatabaseObjectRenderingDescription desc = new DatabaseObjectRenderingDescription();
desc.setItemDescription(new DatabaseObjectRenderingDescription());
final MemorizedResultSet listPerType = new MemorizedResultSet(rowsPerType, theList.getMetaData());
final JLabel label = MDSchema.getConstraintTypeIcon(e.getKey() + "s");
final UIUtil.IconWithText label = MDSchema.getConstraintTypeIcon(e.getKey() + "s");
result.add(new MDDescriptionBasedGeneric(e.getValue(), getMetaDataSource(), schema, dataModel, desc) {
@Override
protected MemorizedResultSet retrieveList(Session session) throws SQLException {
@@ -365,18 +367,18 @@ public abstract class MetaDataPanel extends javax.swing.JPanel {
@Override
protected MDDescriptionBasedGeneric createDetailDescription(final Object[] row, DatabaseObjectRenderingDescription detailDesc) {
final JLabel label = (JLabel) row[0];
final IconWithText label = (IconWithText) row[0];
return new MDDescriptionBasedGeneric(row[1] + " on " + row[2] + (row[3] != null && row[3].toString().trim().length() > 0? "(" + row[3] + ")" : ""), getMetaDataSource(), schema, dataModel, detailDesc) {
@Override
public Icon getIcon() {
return label == null? null : label.getIcon();
return label == null? null : label.icon;
}
};
}
@Override
public Icon getIcon() {
return label == null? null : label.getIcon();
return label == null? null : label.icon;
}
});
}
@@ -466,7 +466,7 @@ public class QueryTypeAnalyser {
if (strict) {
return a.equals(b);
}
return Quoting.normalizeIdentifier(a).equals(Quoting.staticUnquote(b));
return Quoting.normalizeIdentifier(a).equals(Quoting.normalizeIdentifier(b));
}
private static ExpressionVisitor createExpressionVisitor(final boolean[] noSubexpression, final Column[] column) {
@@ -28,7 +28,7 @@ public class DataModelBasedSQLCompletionProvider extends SQLCompletionProvider<D
String schema = table.getSchema("");
String name = table.getUnqualifiedName();
schemaPerUUCName.put(Quoting.normalizeIdentifier(schema), schema);
schemaTablePerUUCName.put(Quoting.normalizeIdentifier(schema) + "." + Quoting.staticUnquote(name), table);
schemaTablePerUUCName.put(Quoting.normalizeIdentifier(schema) + "." + Quoting.normalizeIdentifier(name), table);
List<Table> tps = tablesPerSchema.get(schema);
if (tps == null) {
tps = new ArrayList<Table>();
@@ -59,7 +59,7 @@ public class DataModelBasedSQLCompletionProvider extends SQLCompletionProvider<D
@Override
protected Table findTable(String schema, String name) {
return schemaTablePerUUCName.get(Quoting.normalizeIdentifier(schema) + "." + Quoting.staticUnquote(name));
return schemaTablePerUUCName.get(Quoting.normalizeIdentifier(schema) + "." + Quoting.normalizeIdentifier(name));
}
@Override
@@ -1314,7 +1314,7 @@ public abstract class SQLCompletionProvider<SOURCE, SCHEMA, TABLE> extends Defau
TABLE context;
context = null;
for (Entry<String, TABLE> entry: aliases.entrySet()) {
if (Quoting.normalizeIdentifier(entry.getKey()).equals(Quoting.staticUnquote(aliasName))) {
if (Quoting.normalizeIdentifier(entry.getKey()).equals(Quoting.normalizeIdentifier(aliasName))) {
context = entry.getValue();
break;
}