mirror of
https://github.com/Wisser/Jailer.git
synced 2026-01-29 03:28:56 -06:00
Introduction of the "ConnectionType" concept. First steps.
This commit is contained in:
@@ -25,7 +25,7 @@ public class JailerVersion {
|
||||
/**
|
||||
* The Jailer version.
|
||||
*/
|
||||
public static final String VERSION = "15.2.5.2";
|
||||
public static final String VERSION = "15.2.5.3";
|
||||
|
||||
/**
|
||||
* The Jailer working tables version.
|
||||
@@ -45,3 +45,10 @@ public class JailerVersion {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// TODO
|
||||
// TODO DBConDialog: copy/import creditials mit "Verbindungstyp"
|
||||
|
||||
// TODO
|
||||
// TODO DBConDialog: copy/import creditials: 1. tooltip + "connection-credentials"? 2. tooltip: "paste here"? ???
|
||||
|
||||
@@ -895,6 +895,7 @@ public abstract class DataModelManagerDialog extends javax.swing.JFrame {
|
||||
}
|
||||
|
||||
List<String> model = new ArrayList<String>();
|
||||
Map<String, String> ttipSuffix = new HashMap<>();
|
||||
List<ImageIcon> logos = new ArrayList<ImageIcon>();
|
||||
List<ActionListener> actions = new ArrayList<ActionListener>();
|
||||
|
||||
@@ -929,7 +930,17 @@ public abstract class DataModelManagerDialog extends javax.swing.JFrame {
|
||||
logos.add(UIUtil.scaleIcon(new JLabel(), UIUtil.readImage(dbmsLogoURL, false), 1.0));
|
||||
}
|
||||
|
||||
model.add("<html><nobr>" +
|
||||
String bgc = "";
|
||||
if (connectionInfo != null && connectionInfo.getConnectionType().getBg1() != null) {
|
||||
bgc = Integer.toHexString(connectionInfo.getConnectionType().getBg1().getRGB() & 0xffffff);
|
||||
while (bgc.length() < 6) {
|
||||
bgc = "0" + bgc;
|
||||
}
|
||||
bgc = "<font bgcolor=\"#" + bgc + "\" color=\"#000000\">" + connectionInfo.getConnectionType().displayName + "</font>";
|
||||
}
|
||||
|
||||
String v;
|
||||
model.add(v = "<html><nobr>" +
|
||||
UIUtil.toHTMLFragment(UIUtil.toDateAsString(lastSession.date.getTime()), 0) + " - " +
|
||||
(module.equals("S")?
|
||||
"<font color=\"#0000ff\"><b>" +
|
||||
@@ -940,12 +951,12 @@ public abstract class DataModelManagerDialog extends javax.swing.JFrame {
|
||||
("<font color=\"#006600\">" +
|
||||
UIUtil.toHTMLFragment(((details != null? details.a : lastSession.datamodelFolder)), 0) +
|
||||
"</font> - <font color=\"#663300\">" +
|
||||
(connectionInfo == null? "<i><font color=\"#888888\">offline</font></i>" : UIUtil.toHTMLFragment(connectionInfo.alias, 0) + " - <font color=\"#000000\">" + UIUtil.toHTMLFragment(((userName + " - ") + connectionInfo.url), 0, false) + "</font>") +
|
||||
(connectionInfo == null? "<i><font color=\"#888888\">offline</font></i>" : UIUtil.toHTMLFragment(connectionInfo.alias, 0) + " - <font color=\"#000000\">" + UIUtil.toHTMLFragment(((userName + " - ")), 0, false) + UIUtil.toHTML(connectionInfo.url, 0) + "</font>") +
|
||||
"</font></nobr></html>")
|
||||
:
|
||||
(
|
||||
"<font color=\"#006600\">" +
|
||||
(connectionInfo == null? "<i><font color=\"#888888\">offline</font></i>" : ("<b>" + UIUtil.toHTMLFragment(connectionInfo.alias, 0) + "</b>") + " - <font color=\"#000000\">" +
|
||||
(connectionInfo == null? "<i><font color=\"#888888\">offline</font></i>" : ("<b>" + UIUtil.toHTML(connectionInfo.alias, 0) + "</b>") + " - <font color=\"#000000\">" +
|
||||
"<font color=\"#0000ff\">" +
|
||||
(lastSession.getContentInfo() != null? UIUtil.toHTMLFragment(lastSession.getContentInfo().replaceFirst("^\\d+ Table$", "$0s"), 0) + " - " : "") +
|
||||
"</font>" +
|
||||
@@ -955,6 +966,8 @@ public abstract class DataModelManagerDialog extends javax.swing.JFrame {
|
||||
"</font>")
|
||||
) +
|
||||
"</nobr></html>");
|
||||
ttipSuffix.put(v, "<br>" + bgc);
|
||||
|
||||
final ConnectionInfo finalConnectionInfo = connectionInfo;
|
||||
actions.add(new ActionListener() {
|
||||
@Override
|
||||
@@ -1035,7 +1048,11 @@ public abstract class DataModelManagerDialog extends javax.swing.JFrame {
|
||||
Component render = renderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
String tooltip = null;
|
||||
if (render instanceof JLabel) {
|
||||
((JLabel) render).setToolTipText(tooltip = ((JLabel) render).getText().replace(" - ", "<br>"));
|
||||
tooltip = ((JLabel) render).getText().replace(" - ", "<br>");
|
||||
if (ttipSuffix.containsKey(((JLabel) render).getText())) {
|
||||
tooltip = tooltip.replaceFirst("</nobr></html>", ttipSuffix.get(((JLabel) render).getText()) + "</nobr></html>").replace("</font>", "");
|
||||
}
|
||||
((JLabel) render).setToolTipText(tooltip);
|
||||
if (isSelected) {
|
||||
((JLabel) render).setText(((JLabel) render).getText().replaceAll("<.?font[^>]*>", ""));
|
||||
}
|
||||
@@ -1080,7 +1097,11 @@ public abstract class DataModelManagerDialog extends javax.swing.JFrame {
|
||||
return render;
|
||||
}
|
||||
});
|
||||
recentSessionsComboBox.setToolTipText(model.get(0).replace(" - ", "<br>"));
|
||||
String tooltip = model.get(0).replace(" - ", "<br>");
|
||||
if (ttipSuffix.containsKey(model.get(0))) {
|
||||
tooltip = tooltip.replaceFirst("</nobr></html>", ttipSuffix.get(model.get(0)) + "</nobr></html>").replace("</font>", "");
|
||||
}
|
||||
recentSessionsComboBox.setToolTipText(tooltip);
|
||||
}
|
||||
|
||||
private void hideRecentSessionsPanel() {
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,-6,0,0,1,-91"/>
|
||||
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,2,95,0,0,1,-91"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
|
||||
@@ -622,6 +622,36 @@
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JLabel" name="jLabel13">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value=" Type"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="0" gridY="81" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="2" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JComboBox" name="typeComboBox">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
||||
<StringArray count="4">
|
||||
<StringItem index="0" value="Item 1"/>
|
||||
<StringItem index="1" value="Item 2"/>
|
||||
<StringItem index="2" value="Item 3"/>
|
||||
<StringItem index="3" value="Item 4"/>
|
||||
</StringArray>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/>
|
||||
</AuxValues>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="2" gridY="81" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="2" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
|
||||
@@ -66,6 +66,7 @@ import javax.swing.Icon;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
@@ -83,7 +84,9 @@ import javax.swing.text.StyleConstants;
|
||||
|
||||
import net.sf.jailer.ExecutionContext;
|
||||
import net.sf.jailer.ui.DbConnectionDialog.ConnectionInfo;
|
||||
import net.sf.jailer.ui.DbConnectionDialog.ConnectionType;
|
||||
import net.sf.jailer.ui.UIUtil.PLAF;
|
||||
import net.sf.jailer.ui.databrowser.DBConditionEditor;
|
||||
import net.sf.jailer.ui.util.ConcurrentTaskControl;
|
||||
import net.sf.jailer.ui.util.HttpDownload;
|
||||
import net.sf.jailer.ui.util.LightBorderSmallButton;
|
||||
@@ -235,6 +238,7 @@ public class DbConnectionDetailsEditor extends javax.swing.JDialog {
|
||||
user.setText(ci.user);
|
||||
password.setText(ci.password);
|
||||
driverClass.setText(ci.driverClass);
|
||||
typeComboBox.setSelectedItem(ci.getConnectionType());
|
||||
jar1.setText(ci.jar1);
|
||||
jar2.setText(ci.jar2);
|
||||
jar3.setText(ci.jar3);
|
||||
@@ -323,6 +327,31 @@ public class DbConnectionDetailsEditor extends javax.swing.JDialog {
|
||||
this.needsTest = needsTest;
|
||||
this.dataModelAware = dataModelAware;
|
||||
initComponents(); UIUtil.initComponents(this);
|
||||
|
||||
typeComboBox.setModel(new DefaultComboBoxModel(DbConnectionDialog.ConnectionType.values()));
|
||||
Color dbg = typeComboBox.getBackground();
|
||||
typeComboBox.setRenderer(new DefaultListCellRenderer() {
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected,
|
||||
boolean cellHasFocus) {
|
||||
Component render = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
if (value instanceof ConnectionType && render instanceof JLabel) {
|
||||
if (!isSelected) {
|
||||
Color b1 = ((ConnectionType) value).getBg1();
|
||||
render.setBackground(b1 == null? dbg : b1);
|
||||
render.setForeground(Color.black);
|
||||
}
|
||||
}
|
||||
return render;
|
||||
}
|
||||
});
|
||||
typeComboBox.addItemListener(e -> {
|
||||
if (typeComboBox.getSelectedItem() != null) {
|
||||
Color b1 = ((ConnectionType) typeComboBox.getSelectedItem()).getBg1();
|
||||
typeComboBox.setBackground(b1 == null? dbg : b1);
|
||||
}
|
||||
});
|
||||
|
||||
newDataModelButton.setVisible(!dataModelAware);
|
||||
ImageIcon scaledWarnIcon = UIUtil.scaleIcon(jtdsWarnLabel, warnIcon, 1);
|
||||
jtdsWarnLabel.setIcon(scaledWarnIcon);
|
||||
@@ -898,6 +927,8 @@ public class DbConnectionDetailsEditor extends javax.swing.JDialog {
|
||||
dataModelComboBox = new javax.swing.JComboBox<>();
|
||||
newDataModelButton = new javax.swing.JButton();
|
||||
jPanel11 = new javax.swing.JPanel();
|
||||
jLabel13 = new javax.swing.JLabel();
|
||||
typeComboBox = new javax.swing.JComboBox<>();
|
||||
|
||||
helpjdbc.setText("help");
|
||||
|
||||
@@ -1404,6 +1435,22 @@ public class DbConnectionDetailsEditor extends javax.swing.JDialog {
|
||||
gridBagConstraints.insets = new java.awt.Insets(2, 0, 0, 0);
|
||||
jPanel1.add(jPanel10, gridBagConstraints);
|
||||
|
||||
jLabel13.setText(" Type");
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 81;
|
||||
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
|
||||
gridBagConstraints.insets = new java.awt.Insets(2, 0, 0, 0);
|
||||
jPanel1.add(jLabel13, gridBagConstraints);
|
||||
|
||||
typeComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 2;
|
||||
gridBagConstraints.gridy = 81;
|
||||
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
|
||||
gridBagConstraints.insets = new java.awt.Insets(2, 0, 0, 0);
|
||||
jPanel1.add(typeComboBox, gridBagConstraints);
|
||||
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 1;
|
||||
gridBagConstraints.gridy = 1;
|
||||
@@ -1468,6 +1515,7 @@ public class DbConnectionDetailsEditor extends javax.swing.JDialog {
|
||||
ci.user = user.getText().trim();
|
||||
ci.password = password.getText().trim();
|
||||
ci.dataModelFolder = (String) dataModelComboBox.getSelectedItem();
|
||||
ci.setConnectionType((ConnectionType) typeComboBox.getSelectedItem());
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
@@ -1816,6 +1864,7 @@ public class DbConnectionDetailsEditor extends javax.swing.JDialog {
|
||||
private javax.swing.JLabel jLabel10;
|
||||
private javax.swing.JLabel jLabel11;
|
||||
private javax.swing.JLabel jLabel12;
|
||||
private javax.swing.JLabel jLabel13;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JLabel jLabel3;
|
||||
private javax.swing.JLabel jLabel4;
|
||||
@@ -1853,6 +1902,7 @@ public class DbConnectionDetailsEditor extends javax.swing.JDialog {
|
||||
private javax.swing.JButton renameButton;
|
||||
private javax.swing.JButton selectConnectionButton;
|
||||
private javax.swing.JButton testConnectionButton;
|
||||
private javax.swing.JComboBox<String> typeComboBox;
|
||||
public javax.swing.JTextField user;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
|
||||
@@ -91,6 +91,66 @@ public class DbConnectionDialog extends javax.swing.JDialog {
|
||||
* <code>true</code> if valid connection is available.
|
||||
*/
|
||||
public boolean isConnected = false;
|
||||
|
||||
public enum ConnectionType {
|
||||
Development("Development database") {
|
||||
@Override
|
||||
public Color getBg1() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Color getBg2() {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
Test("Test (QA) database") {
|
||||
@Override
|
||||
public Color getBg1() {
|
||||
return new Color(255, 255, 200);
|
||||
}
|
||||
@Override
|
||||
public Color getBg2() {
|
||||
return new Color(255, 255, 220);
|
||||
}
|
||||
},
|
||||
Staging("Staging database") {
|
||||
@Override
|
||||
public Color getBg1() {
|
||||
return new Color(255, 225, 200);
|
||||
}
|
||||
@Override
|
||||
public Color getBg2() {
|
||||
return new Color(255, 225, 220);
|
||||
}
|
||||
},
|
||||
Production("Production database") {
|
||||
@Override
|
||||
public Color getBg1() {
|
||||
return new Color(255, 190, 190);
|
||||
}
|
||||
@Override
|
||||
public Color getBg2() {
|
||||
return new Color(255, 180, 180);
|
||||
}
|
||||
};
|
||||
|
||||
private ConnectionType(String displayName) {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
public abstract Color getBg1();
|
||||
public abstract Color getBg2();
|
||||
// TODO
|
||||
// TODO bg2 weg oder heller für tabelle?
|
||||
// TODO farben zu ähnlich?
|
||||
// TODO in tabelle die ersten beiden Spalten bei Selection weiterhin in bg-farbe?
|
||||
public final String displayName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds connection information.
|
||||
@@ -116,6 +176,8 @@ public class DbConnectionDialog extends javax.swing.JDialog {
|
||||
public String jar3 = "";
|
||||
public String jar4 = "";
|
||||
public transient String dataModelFolder;
|
||||
private String connectionTypeName;
|
||||
private transient ConnectionType connectionType;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@@ -130,6 +192,26 @@ public class DbConnectionDialog extends javax.swing.JDialog {
|
||||
dataModelFolder = DataModelManager.getCurrentModelSubfolder(executionContext);
|
||||
}
|
||||
|
||||
public ConnectionType getConnectionType() {
|
||||
if (connectionType != null) {
|
||||
return connectionType;
|
||||
}
|
||||
if (connectionTypeName == null) {
|
||||
return connectionType = ConnectionType.Development;
|
||||
}
|
||||
try {
|
||||
connectionType = ConnectionType.valueOf(connectionTypeName);
|
||||
} catch (Exception e) {
|
||||
connectionType = ConnectionType.Development;
|
||||
}
|
||||
return connectionType;
|
||||
}
|
||||
|
||||
public void setConnectionType(ConnectionType type) {
|
||||
connectionType = type;
|
||||
connectionTypeName = type.name();
|
||||
}
|
||||
|
||||
public void assign(ConnectionInfo ci) {
|
||||
encrypted = ci.encrypted;
|
||||
alias = ci.alias;
|
||||
@@ -142,6 +224,8 @@ public class DbConnectionDialog extends javax.swing.JDialog {
|
||||
jar3 = ci.jar3;
|
||||
jar4 = ci.jar4;
|
||||
dataModelFolder = ci.dataModelFolder;
|
||||
connectionType = ci.connectionType;
|
||||
connectionTypeName = ci.connectionTypeName;
|
||||
}
|
||||
|
||||
public boolean encrypt() {
|
||||
@@ -223,7 +307,7 @@ public class DbConnectionDialog extends javax.swing.JDialog {
|
||||
ok = false;
|
||||
try {
|
||||
pack();
|
||||
setSize(Math.max(710, getWidth()), 450);
|
||||
setSize(Math.max(840, getWidth()), 450);
|
||||
if (parent != null && parent.isVisible()) {
|
||||
int os = parent.getWidth() > 800 ? 0 : 80;
|
||||
setLocation(os + parent.getX() + (parent.getWidth() - getWidth()) / 2,
|
||||
@@ -422,6 +506,7 @@ public class DbConnectionDialog extends javax.swing.JDialog {
|
||||
.getTableCellRendererComponent(table, value,
|
||||
isSelected, false /* hasFocus */, row, column);
|
||||
if (render instanceof JLabel) {
|
||||
((JLabel) render).setToolTipText(String.valueOf(value));
|
||||
if (!isSelected) {
|
||||
final Color BG1 = UIUtil.TABLE_BACKGROUND_COLOR_1;
|
||||
final Color BG2 = UIUtil.TABLE_BACKGROUND_COLOR_2;
|
||||
@@ -442,8 +527,24 @@ public class DbConnectionDialog extends javax.swing.JDialog {
|
||||
} else {
|
||||
((JLabel) render).setForeground(Color.gray);
|
||||
}
|
||||
|
||||
Color bg = null;
|
||||
|
||||
ConnectionType connectionType = null;
|
||||
if (selectedRowIndex >= 0 && column == 1 && selectedRowIndex < connectionList.size()) {
|
||||
connectionType = connectionList.get(selectedRowIndex).getConnectionType();
|
||||
}
|
||||
|
||||
if (connectionType != null && connectionType.getBg1() != null) {
|
||||
bg = connectionType.getBg1();
|
||||
// bg = (row % 2 == 0) ? connectionType.getBg1() : connectionType.getBg2();
|
||||
((JLabel) render).setToolTipText("<html>" + UIUtil.toHTMLFragment(((JLabel) render).getToolTipText(), 0) + "<br><hr>" + connectionType.displayName + "</html>");
|
||||
}
|
||||
|
||||
if (bg != null) {
|
||||
((JLabel) render).setBackground(bg);
|
||||
}
|
||||
}
|
||||
((JLabel) render).setToolTipText(String.valueOf(value));
|
||||
render.setFont(column == 0? bold : normal);
|
||||
((JLabel) render).setIcon(null);
|
||||
if (value instanceof String && ((String) value).startsWith("*")) {
|
||||
@@ -455,6 +556,7 @@ public class DbConnectionDialog extends javax.swing.JDialog {
|
||||
}
|
||||
});
|
||||
|
||||
connectionsTable.getTableHeader().setReorderingAllowed(false);
|
||||
try {
|
||||
((DefaultTableCellRenderer) connectionsTable.getTableHeader().getDefaultRenderer()).setHorizontalAlignment(JLabel.LEFT);
|
||||
} catch (Exception e) {
|
||||
@@ -621,7 +723,7 @@ public class DbConnectionDialog extends javax.swing.JDialog {
|
||||
false, false, 0, i);
|
||||
width = Math.max(width, comp.getPreferredSize().width);
|
||||
|
||||
for (int line = 0; line < data.length; ++line) {
|
||||
for (int line = 0; line < data.length && line < 30; ++line) {
|
||||
comp = connectionsTable.getDefaultRenderer(String.class).
|
||||
getTableCellRendererComponent(
|
||||
connectionsTable, data[line][i],
|
||||
@@ -685,7 +787,9 @@ public class DbConnectionDialog extends javax.swing.JDialog {
|
||||
onConnectionListChangedPending = true;
|
||||
UIUtil.invokeLater(() -> {
|
||||
onConnectionListChangedPending = false;
|
||||
onConnectionListChangedAll();
|
||||
onConnectionListChangedReload();
|
||||
notifyConnectionTypeChangeListener();
|
||||
UIUtil.invokeLater(() -> onConnectionListChangedAll());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -701,13 +805,16 @@ public class DbConnectionDialog extends javax.swing.JDialog {
|
||||
private boolean onConnectionListChangedPending = false;
|
||||
|
||||
private void onConnectionListChanged() {
|
||||
loadConnectionList(false);
|
||||
refresh();
|
||||
if (dataModelChanger != null) {
|
||||
dataModelChanger.onConnectionListChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private static void onConnectionListChangedReload() {
|
||||
allDialogs.forEach((a, b) -> a.loadConnectionList(false));
|
||||
}
|
||||
|
||||
private static void onConnectionListChangedAll() {
|
||||
allDialogs.forEach((a, b) -> a.onConnectionListChanged());
|
||||
}
|
||||
@@ -1503,6 +1610,7 @@ public class DbConnectionDialog extends javax.swing.JDialog {
|
||||
if (ci.driverClass != null
|
||||
&& ci.url != null
|
||||
&& ci.user != null) {
|
||||
ci.setConnectionType(retrieveConnectionType(ci));
|
||||
currentConnection = ci;
|
||||
executionContext.setCurrentConnectionAlias(currentConnection.alias);
|
||||
isConnected = true;
|
||||
@@ -1558,5 +1666,34 @@ public class DbConnectionDialog extends javax.swing.JDialog {
|
||||
cancelIcon = UIUtil.readImage("/buttoncancel.png");
|
||||
}
|
||||
|
||||
public ConnectionType retrieveConnectionType(ConnectionInfo ci) {
|
||||
return connectionList.stream().filter(c -> ci.url.equals(c.url) && ci.user.equals(c.user))
|
||||
.map(c -> c.getConnectionType()).findAny().orElseGet(() -> ConnectionType.Development);
|
||||
}
|
||||
|
||||
public interface ConnectionTypeChangeListener {
|
||||
void onConnectionTypeChange();
|
||||
}
|
||||
|
||||
private static void notifyConnectionTypeChangeListener() {
|
||||
for (Window w : Window.getWindows()) {
|
||||
if (w instanceof ConnectionTypeChangeListener) {
|
||||
((ConnectionTypeChangeListener) w).onConnectionTypeChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// TODO
|
||||
// TODO import/export of sets of connections
|
||||
// TODO export no password
|
||||
// TODO ask for password 1. time user wants to use connection and persist that (later if allowed)
|
||||
// TODO ? (generally) allow password to be not persisted. For that connections: always ask for pw (and store it in mem)
|
||||
|
||||
|
||||
// TODO
|
||||
// TODO programmatic SLL certificate import?
|
||||
// TODO https://stackoverflow.com/questions/18889058/programmatically-import-ca-trust-cert-into-existing-keystore-file-without-using
|
||||
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
<Container class="javax.swing.JSplitPane" name="jSplitPane1">
|
||||
<Properties>
|
||||
<Property name="orientation" type="int" value="0"/>
|
||||
<Property name="continuousLayout" type="boolean" value="true"/>
|
||||
<Property name="oneTouchExpandable" type="boolean" value="true"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
@@ -76,7 +75,6 @@
|
||||
<Properties>
|
||||
<Property name="orientation" type="int" value="0"/>
|
||||
<Property name="resizeWeight" type="double" value="1.0"/>
|
||||
<Property name="continuousLayout" type="boolean" value="true"/>
|
||||
<Property name="oneTouchExpandable" type="boolean" value="true"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
@@ -995,6 +993,9 @@
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="legende2">
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
|
||||
</AuxValues>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="4" anchor="13" weightX="1.0" weightY="0.0"/>
|
||||
@@ -1012,7 +1013,7 @@
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="offline"/>
|
||||
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
|
||||
<Color id="Handcursor"/>
|
||||
<Color id="Default Cursor"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
|
||||
@@ -1538,7 +1538,7 @@ public class ExtractionModelEditor extends javax.swing.JPanel {
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
jLabel3 = new javax.swing.JLabel();
|
||||
aggregationCombobox = new javax.swing.JComboBox();
|
||||
aggregationCombobox = new JComboBox2();
|
||||
tagField = new javax.swing.JTextField();
|
||||
jPanel5 = new javax.swing.JPanel();
|
||||
xmlTagApply = new javax.swing.JButton();
|
||||
@@ -1567,7 +1567,6 @@ public class ExtractionModelEditor extends javax.swing.JPanel {
|
||||
setLayout(new java.awt.GridBagLayout());
|
||||
|
||||
jSplitPane1.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
|
||||
jSplitPane1.setContinuousLayout(true);
|
||||
jSplitPane1.setOneTouchExpandable(true);
|
||||
|
||||
jpanel.setLayout(new java.awt.BorderLayout());
|
||||
@@ -1576,7 +1575,6 @@ public class ExtractionModelEditor extends javax.swing.JPanel {
|
||||
|
||||
jSplitPane2.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
|
||||
jSplitPane2.setResizeWeight(1.0);
|
||||
jSplitPane2.setContinuousLayout(true);
|
||||
jSplitPane2.setOneTouchExpandable(true);
|
||||
|
||||
toolBarPanel.setBackground(new java.awt.Color(255, 255, 255));
|
||||
@@ -1673,7 +1671,7 @@ public class ExtractionModelEditor extends javax.swing.JPanel {
|
||||
|
||||
layeredPane.setLayer(focusPanel, javax.swing.JLayeredPane.PALETTE_LAYER);
|
||||
layeredPane.add(focusPanel);
|
||||
focusPanel.setBounds(0, 0, 291, 33);
|
||||
focusPanel.setBounds(0, 0, 359, 32);
|
||||
|
||||
rightBorderPanel.setOpaque(false);
|
||||
rightBorderPanel.setLayout(new java.awt.GridBagLayout());
|
||||
@@ -2179,7 +2177,7 @@ public class ExtractionModelEditor extends javax.swing.JPanel {
|
||||
|
||||
connectivityState.setFont(connectivityState.getFont().deriveFont(connectivityState.getFont().getSize()+1f));
|
||||
connectivityState.setText("offline");
|
||||
connectivityState.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
|
||||
connectivityState.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 1;
|
||||
gridBagConstraints.gridy = 1;
|
||||
@@ -4014,7 +4012,7 @@ public class ExtractionModelEditor extends javax.swing.JPanel {
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton activateDesictionPendingButton;
|
||||
private javax.swing.JButton additionalSubjectsButton;
|
||||
private javax.swing.JComboBox aggregationCombobox;
|
||||
private JComboBox2 aggregationCombobox;
|
||||
private javax.swing.JLabel assocStatsLabel;
|
||||
private javax.swing.JLabel associatedWith;
|
||||
javax.swing.JTextField condition;
|
||||
@@ -4022,7 +4020,7 @@ public class ExtractionModelEditor extends javax.swing.JPanel {
|
||||
private javax.swing.JLabel dependsOn;
|
||||
private javax.swing.JPanel editorPanel;
|
||||
public javax.swing.JButton exportButton;
|
||||
private javax.swing.JComboBox exportFormat;
|
||||
private JComboBox2 exportFormat;
|
||||
private javax.swing.JPanel focusLabelPanel;
|
||||
javax.swing.JPanel focusPanel;
|
||||
private javax.swing.JPanel graphContainer;
|
||||
@@ -4070,7 +4068,7 @@ public class ExtractionModelEditor extends javax.swing.JPanel {
|
||||
private javax.swing.JButton leftButton;
|
||||
private javax.swing.JPanel legende;
|
||||
private javax.swing.JPanel legende1;
|
||||
private javax.swing.JPanel legende2;
|
||||
javax.swing.JPanel legende2;
|
||||
private javax.swing.JToggleButton limitButton;
|
||||
private javax.swing.JLabel limitLabel;
|
||||
private javax.swing.JButton mapColumns;
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package net.sf.jailer.ui;
|
||||
|
||||
import java.awt.CardLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Container;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Point;
|
||||
@@ -82,6 +83,9 @@ import net.sf.jailer.modelbuilder.ModelBuilder;
|
||||
import net.sf.jailer.render.HtmlDataModelRenderer;
|
||||
import net.sf.jailer.subsetting.ScriptFormat;
|
||||
import net.sf.jailer.subsetting.SubsettingEngine;
|
||||
import net.sf.jailer.ui.DbConnectionDialog.ConnectionInfo;
|
||||
import net.sf.jailer.ui.DbConnectionDialog.ConnectionType;
|
||||
import net.sf.jailer.ui.DbConnectionDialog.ConnectionTypeChangeListener;
|
||||
import net.sf.jailer.ui.UIUtil.ResultConsumer;
|
||||
import net.sf.jailer.ui.associationproposer.AssociationProposerView;
|
||||
import net.sf.jailer.ui.commandline.CommandLineInstance;
|
||||
@@ -101,7 +105,7 @@ import net.sf.jailer.util.PrintUtil;
|
||||
*
|
||||
* @author Ralf Wisser
|
||||
*/
|
||||
public class ExtractionModelFrame extends javax.swing.JFrame {
|
||||
public class ExtractionModelFrame extends javax.swing.JFrame implements ConnectionTypeChangeListener {
|
||||
|
||||
/**
|
||||
* The embedded editor.
|
||||
@@ -296,6 +300,10 @@ public class ExtractionModelFrame extends javax.swing.JFrame {
|
||||
}
|
||||
}
|
||||
|
||||
Color origCSBG, origL2BG;
|
||||
boolean origOp;
|
||||
private boolean origKnown = false;
|
||||
|
||||
/**
|
||||
* Updates state of some menu items.
|
||||
*/
|
||||
@@ -303,8 +311,42 @@ public class ExtractionModelFrame extends javax.swing.JFrame {
|
||||
connectDb.setSelected(dbConnectionDialog.isConnected);
|
||||
disconnectDb.setEnabled(dbConnectionDialog.isConnected);
|
||||
extractionModelEditor.connectivityState.setText(getConnectivityState());
|
||||
extractionModelEditor.connectivityState.setToolTipText(getConnectivityStateToolTip());
|
||||
extractionModelEditor.connectivityState.setIcon(getDBMSLogo());
|
||||
|
||||
if (!origKnown) {
|
||||
origKnown = true;
|
||||
origCSBG = extractionModelEditor.connectivityState.getBackground();
|
||||
origL2BG = extractionModelEditor.legende2.getBackground();
|
||||
}
|
||||
ConnectionInfo connection = dbConnectionDialog != null ? dbConnectionDialog.currentConnection : null;
|
||||
if (connection == null) {
|
||||
lastConnectionInfo = null;
|
||||
} else {
|
||||
lastConnectionInfo = new ConnectionInfo();
|
||||
lastConnectionInfo.assign(connection);
|
||||
}
|
||||
onConnectionTypeChange();
|
||||
}
|
||||
|
||||
private ConnectionInfo lastConnectionInfo = null;
|
||||
|
||||
@Override
|
||||
public void onConnectionTypeChange() {
|
||||
ConnectionType connectionType = ConnectionType.Development;
|
||||
if (lastConnectionInfo != null && dbConnectionDialog != null) {
|
||||
lastConnectionInfo.setConnectionType(connectionType = dbConnectionDialog.retrieveConnectionType(lastConnectionInfo));
|
||||
}
|
||||
Color bg = connectionType != null ? connectionType.getBg1() : null;
|
||||
if (bg != null) {
|
||||
extractionModelEditor.connectivityState.setBackground(bg);
|
||||
extractionModelEditor.legende2.setBackground(bg);
|
||||
extractionModelEditor.legende2.setOpaque(true);
|
||||
} else {
|
||||
extractionModelEditor.connectivityState.setBackground(origCSBG);
|
||||
extractionModelEditor.legende2.setBackground(origL2BG);
|
||||
extractionModelEditor.legende2.setOpaque(origOp);
|
||||
}
|
||||
extractionModelEditor.connectivityState.setToolTipText(getConnectivityStateToolTip(lastConnectionInfo));
|
||||
}
|
||||
|
||||
private String getConnectivityState() {
|
||||
@@ -317,7 +359,19 @@ public class ExtractionModelFrame extends javax.swing.JFrame {
|
||||
|
||||
private String getConnectivityStateToolTip() {
|
||||
if (dbConnectionDialog != null && dbConnectionDialog.isConnected) {
|
||||
return dbConnectionDialog.currentConnection.url;
|
||||
ConnectionInfo connectionInfo = dbConnectionDialog.currentConnection;
|
||||
return getConnectivityStateToolTip(connectionInfo);
|
||||
}
|
||||
return getConnectivityStateToolTip(null);
|
||||
}
|
||||
|
||||
private String getConnectivityStateToolTip(ConnectionInfo connectionInfo) {
|
||||
if (connectionInfo != null) {
|
||||
String url = connectionInfo.url;
|
||||
if (connectionInfo.getConnectionType().getBg1() != null) {
|
||||
url = "<html>" + UIUtil.toHTMLFragment(url, 0) + "<br><hr>" + connectionInfo.getConnectionType().displayName + "</html>";
|
||||
}
|
||||
return url;
|
||||
} else {
|
||||
return "offline";
|
||||
}
|
||||
@@ -1791,6 +1845,7 @@ public class ExtractionModelFrame extends javax.swing.JFrame {
|
||||
extractionModelEditor.closureBorderView.refresh();
|
||||
restrictedDependenciesView.refresh();
|
||||
updateTitle(extractionModelEditor.needsSave);
|
||||
updateMenuItems();
|
||||
} catch (Throwable t) {
|
||||
UIUtil.showException(this, "Error", t);
|
||||
} finally {
|
||||
@@ -1823,6 +1878,7 @@ public class ExtractionModelFrame extends javax.swing.JFrame {
|
||||
extractionModelEditor.closureBorderView.refresh();
|
||||
restrictedDependenciesView.refresh();
|
||||
updateTitle(extractionModelEditor.needsSave);
|
||||
updateMenuItems();
|
||||
} catch (Throwable t) {
|
||||
UIUtil.showException(this, "Error", t);
|
||||
} finally {
|
||||
|
||||
@@ -968,7 +968,7 @@
|
||||
<Container class="javax.swing.JPanel" name="schemaNamePanel">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="4" gridY="1" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="2" anchor="17" weightX="0.0" weightY="0.0"/>
|
||||
<GridBagConstraints gridX="4" gridY="1" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
|
||||
@@ -155,6 +155,8 @@ import net.sf.jailer.ui.DataModelManager;
|
||||
import net.sf.jailer.ui.DataModelManagerDialog;
|
||||
import net.sf.jailer.ui.DbConnectionDialog;
|
||||
import net.sf.jailer.ui.DbConnectionDialog.ConnectionInfo;
|
||||
import net.sf.jailer.ui.DbConnectionDialog.ConnectionType;
|
||||
import net.sf.jailer.ui.DbConnectionDialog.ConnectionTypeChangeListener;
|
||||
import net.sf.jailer.ui.DbConnectionDialog.DataModelChanger;
|
||||
import net.sf.jailer.ui.Environment;
|
||||
import net.sf.jailer.ui.ExtractionModelFrame;
|
||||
@@ -208,7 +210,7 @@ import net.sf.jailer.util.SqlUtil;
|
||||
*
|
||||
* @author Ralf Wisser
|
||||
*/
|
||||
public class DataBrowser extends javax.swing.JFrame {
|
||||
public class DataBrowser extends javax.swing.JFrame implements ConnectionTypeChangeListener {
|
||||
|
||||
/**
|
||||
* The desktop.
|
||||
@@ -364,6 +366,7 @@ public class DataBrowser extends javax.swing.JFrame {
|
||||
initComponents(); UIUtil.initComponents(this);
|
||||
jToolBar1.setFloatable(false);
|
||||
jToolBar2.setFloatable(false);
|
||||
|
||||
initMenu();
|
||||
initNavTree();
|
||||
initTabSelectionAnimationManager();
|
||||
@@ -1488,11 +1491,22 @@ public class DataBrowser extends javax.swing.JFrame {
|
||||
|
||||
private void initModelNavigation() {
|
||||
DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer() {
|
||||
boolean gotBG = false;
|
||||
Color bg;
|
||||
boolean opaque;
|
||||
|
||||
@Override
|
||||
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded,
|
||||
boolean leaf, int row, boolean hasFocus) {
|
||||
Component render = super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
|
||||
if (render instanceof JLabel) {
|
||||
if (!gotBG) {
|
||||
gotBG = true;
|
||||
bg = ((JLabel) render).getBackground();
|
||||
opaque = ((JLabel) render).isOpaque();
|
||||
}
|
||||
((JLabel) render).setBackground(bg);
|
||||
((JLabel) render).setOpaque(opaque);
|
||||
Icon icon = null;
|
||||
if (value instanceof DefaultMutableTreeNode
|
||||
&& ((DefaultMutableTreeNode) value).getUserObject() instanceof ConnectionInfo) {
|
||||
@@ -1511,7 +1525,13 @@ public class DataBrowser extends javax.swing.JFrame {
|
||||
}
|
||||
};
|
||||
}
|
||||
Color bgCol = node.getConnectionType().getBg1();
|
||||
|
||||
if (bgCol != null && !sel) {
|
||||
((JLabel) render).setBackground(bgCol);
|
||||
((JLabel) render).setOpaque(true);
|
||||
}
|
||||
|
||||
if (connectedAliases.contains(node.alias)) {
|
||||
((JLabel) render).setText("<html><nobr><b>" + UIUtil.toHTMLFragment(((JLabel) render).getText(), 0) + " </b></html>");
|
||||
} else {
|
||||
@@ -1546,7 +1566,8 @@ public class DataBrowser extends javax.swing.JFrame {
|
||||
modelNavigationTree.setToolTipText(
|
||||
"<html><b>" + UIUtil.toHTMLFragment(ciRender(ci), 0) + "</b><br>" +
|
||||
(ci.user != null && ci.user.length() > 0? UIUtil.toHTMLFragment(ci.user, 0) + "<br>" : "") +
|
||||
UIUtil.toHTMLFragment(ci.url, 0)
|
||||
UIUtil.toHTMLFragment(ci.url, 0) +
|
||||
(ci.getConnectionType().getBg1() != null? "<br>" + ci.getConnectionType().displayName : "")
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -1573,6 +1594,8 @@ public class DataBrowser extends javax.swing.JFrame {
|
||||
if (e.getClickCount() > 1) {
|
||||
connect(DataBrowser.this, o);
|
||||
} else {
|
||||
// TODO
|
||||
// TODO check if necessary
|
||||
dbConnectionDialog.select((ConnectionInfo) o);
|
||||
}
|
||||
}
|
||||
@@ -2041,12 +2064,77 @@ public class DataBrowser extends javax.swing.JFrame {
|
||||
|
||||
private String currentDatabaseName;
|
||||
|
||||
private Color origTBBG, origSNPBG, origCSBG, origL2BG;
|
||||
private boolean origL2Op;
|
||||
private boolean origKnown = false;
|
||||
|
||||
private ConnectionInfo lastConnectionInfo = null;
|
||||
|
||||
@Override
|
||||
public void onConnectionTypeChange() {
|
||||
ConnectionType connectionType = ConnectionType.Development;
|
||||
if (lastConnectionInfo != null && dbConnectionDialog != null) {
|
||||
lastConnectionInfo.setConnectionType(connectionType = dbConnectionDialog.retrieveConnectionType(lastConnectionInfo));
|
||||
}
|
||||
Color bg = connectionType != null ? connectionType.getBg1() : null;
|
||||
if (bg == null) {
|
||||
jToolBar1.setToolTipText(null);
|
||||
jToolBar1.setBackground(origTBBG);
|
||||
schemaNamePanel.setBackground(origSNPBG);
|
||||
connectivityState.setBackground(origCSBG);
|
||||
legende2.setBackground(origL2BG);
|
||||
legende2.setOpaque(origL2Op);
|
||||
} else {
|
||||
jToolBar1.setToolTipText(connectionType.displayName);
|
||||
jToolBar1.setBackground(bg);
|
||||
schemaNamePanel.setBackground(bg);
|
||||
connectivityState.setBackground(bg);
|
||||
legende2.setBackground(bg);
|
||||
legende2.setOpaque(true);
|
||||
}
|
||||
String dburl = lastConnectionInfo != null ? (lastConnectionInfo.url) : " ";
|
||||
if (bg != null) {
|
||||
dburl = "<html>" + UIUtil.toHTMLFragment(dburl, 0) + "<br><hr>" + connectionType.displayName + "</html>";
|
||||
}
|
||||
connectivityState.setToolTipText(dburl);
|
||||
schemaName.setToolTipText(dburl);
|
||||
schemaNamePanel.setToolTipText(dburl);
|
||||
|
||||
for (SQLConsoleWithTitle console: sqlConsoles) {
|
||||
console.updateConnectionType(connectionType);
|
||||
}
|
||||
}
|
||||
|
||||
public void updateStatusBar() {
|
||||
final int MAX_LENGTH = 40;
|
||||
ConnectionInfo connection = dbConnectionDialog != null ? dbConnectionDialog.currentConnection : null;
|
||||
ConnectionType connectionType = connection != null ? connection.getConnectionType() : null;
|
||||
if (connection == null) {
|
||||
lastConnectionInfo = null;
|
||||
} else {
|
||||
lastConnectionInfo = new ConnectionInfo();
|
||||
lastConnectionInfo.assign(connection);
|
||||
}
|
||||
|
||||
if (!origKnown) {
|
||||
origKnown = true;
|
||||
origTBBG = jToolBar1.getBackground();
|
||||
origSNPBG = schemaNamePanel.getBackground();
|
||||
origCSBG = connectivityState.getBackground();
|
||||
origL2BG = legende2.getBackground();
|
||||
origL2Op = legende2.isOpaque();
|
||||
}
|
||||
onConnectionTypeChange();
|
||||
Color bg = connectionType != null ? connectionType.getBg1() : null;
|
||||
|
||||
String dburl = connection != null ? (connection.url) : " ";
|
||||
connectivityState.setToolTipText(dburl);
|
||||
String dbmsLogoURL = UIUtil.getDBMSLogoURL(dburl);
|
||||
if (bg != null) {
|
||||
dburl = "<html>" + UIUtil.toHTMLFragment(dburl, 0) + "<br><hr>" + connectionType.displayName + "</html>";
|
||||
}
|
||||
connectivityState.setToolTipText(dburl);
|
||||
schemaName.setToolTipText(dburl);
|
||||
schemaNamePanel.setToolTipText(dburl);
|
||||
if (dbmsLogoURL == null) {
|
||||
connectivityState.setIcon(null);
|
||||
} else {
|
||||
@@ -2520,7 +2608,6 @@ public class DataBrowser extends javax.swing.JFrame {
|
||||
gridBagConstraints.gridy = 1;
|
||||
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
|
||||
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
|
||||
gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 2);
|
||||
jPanel11.add(schemaNamePanel, gridBagConstraints);
|
||||
|
||||
legende2.setLayout(new java.awt.GridBagLayout());
|
||||
@@ -3866,6 +3953,9 @@ public class DataBrowser extends javax.swing.JFrame {
|
||||
|
||||
private void reconnectMenuItemActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_reconnectMenuItemActionPerformed
|
||||
synchronized (this) {
|
||||
if (lastConnectionInfo != null) {
|
||||
dbConnectionDialog.select(lastConnectionInfo);
|
||||
}
|
||||
if (dbConnectionDialog.connect("Reconnect", true)) {
|
||||
try {
|
||||
setConnection(dbConnectionDialog);
|
||||
@@ -5856,10 +5946,11 @@ public class DataBrowser extends javax.swing.JFrame {
|
||||
private String title;
|
||||
|
||||
private SQLConsoleWithTitle(Session session, MetaDataSource metaDataSource, Reference<DataModel> datamodel,
|
||||
ExecutionContext executionContext, String title, JLabel titleLbl) throws SQLException {
|
||||
ExecutionContext executionContext, String title, JLabel titleLbl, ConnectionType connectionType) throws SQLException {
|
||||
super(session, metaDataSource, datamodel, executionContext);
|
||||
this.initialTitle = title;
|
||||
this.titleLbl = titleLbl;
|
||||
updateConnectionType(connectionType);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -5934,9 +6025,11 @@ public class DataBrowser extends javax.swing.JFrame {
|
||||
String tabName = "SQL Console";
|
||||
++sqlConsoleNr;
|
||||
String title = tabName + (sqlConsoleNr > 1 ? " (" + sqlConsoleNr + ")" : "") + " ";
|
||||
|
||||
ConnectionInfo connection = lastConnectionInfo != null? lastConnectionInfo : dbConnectionDialog != null ? dbConnectionDialog.currentConnection : null;
|
||||
ConnectionType connectionType = connection != null ? connection.getConnectionType() : null;
|
||||
|
||||
final SQLConsoleWithTitle sqlConsole = new SQLConsoleWithTitle(session, metaDataSource, datamodel,
|
||||
executionContext, title, titleLbl);
|
||||
executionContext, title, titleLbl, connectionType);
|
||||
titleLbl.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
|
||||
@@ -156,6 +156,7 @@ import net.sf.jailer.ui.QueryBuilderDialog.Relationship;
|
||||
import net.sf.jailer.ui.SessionForUI;
|
||||
import net.sf.jailer.ui.StringSearchPanel.StringSearchDialog;
|
||||
import net.sf.jailer.ui.UIUtil;
|
||||
import net.sf.jailer.ui.DbConnectionDialog.ConnectionType;
|
||||
import net.sf.jailer.ui.UIUtil.PLAF;
|
||||
import net.sf.jailer.ui.associationproposer.AssociationProposerView;
|
||||
import net.sf.jailer.ui.databrowser.BrowserContentCellEditor;
|
||||
@@ -4362,6 +4363,29 @@ public abstract class SQLConsole extends javax.swing.JPanel {
|
||||
tabContentPanel.repaintShowingAnimatedTables();
|
||||
}
|
||||
}
|
||||
|
||||
private Color origTBBG, origP5BG;
|
||||
private boolean origKnown = false;
|
||||
|
||||
public void updateConnectionType(ConnectionType connectionType) {
|
||||
if (!origKnown) {
|
||||
origKnown = true;
|
||||
origTBBG = jToolBar1.getBackground();
|
||||
origP5BG = jPanel5.getBackground();
|
||||
}
|
||||
Color bg = connectionType == null? null : connectionType.getBg1();
|
||||
if (bg == null) {
|
||||
jToolBar1.setBackground(origTBBG);
|
||||
jPanel5.setBackground(origP5BG);
|
||||
jToolBar1.setToolTipText(null);
|
||||
jPanel5.setToolTipText(null);
|
||||
} else {
|
||||
jToolBar1.setBackground(bg);
|
||||
jPanel5.setBackground(bg);
|
||||
jToolBar1.setToolTipText(connectionType.displayName);
|
||||
jPanel5.setToolTipText(connectionType.displayName);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO 2
|
||||
// TODO ordering per column: break down to SQL?
|
||||
|
||||
Reference in New Issue
Block a user