UI cosmetics

This commit is contained in:
Ralf Wisser
2022-01-13 11:54:41 +01:00
parent 59f813a64e
commit 0ffe480bfa
12 changed files with 175 additions and 66 deletions
@@ -294,7 +294,6 @@ public class Session {
try {
valid = con.isValid(4);
} catch (Throwable t) {
LogUtil.warn(t);
valid = true;
}
if (!valid) {
@@ -68,13 +68,11 @@
<Container class="javax.swing.JPanel" name="jPanel2">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="30" gridWidth="3" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="13" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="1" gridY="30" gridWidth="3" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="4" insetsLeft="4" insetsBottom="4" insetsRight="4" anchor="10" weightX="1.0" weightY="0.0"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout">
<Property name="horizontalGap" type="int" value="2"/>
</Layout>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
<SubComponents>
<Component class="javax.swing.JButton" name="formatButton">
<Properties>
@@ -83,6 +81,11 @@
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="formatButtonActionPerformed"/>
</Events>
<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="2" anchor="10" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JButton" name="resetButton">
<Properties>
@@ -91,11 +94,11 @@
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="resetButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="text" type="java.lang.String" value=" "/>
</Properties>
<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="2" anchor="17" weightX="1.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JButton" name="okButton">
<Properties>
@@ -104,6 +107,11 @@
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="okButtonActionPerformed"/>
</Events>
<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="2" anchor="10" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JButton" name="cancelButton">
<Properties>
@@ -112,6 +120,11 @@
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cancelButtonActionPerformed"/>
</Events>
<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="0" anchor="10" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Container>
@@ -151,7 +151,6 @@ public class ColumnMapperDialog extends javax.swing.JDialog {
jPanel2 = new javax.swing.JPanel();
formatButton = new javax.swing.JButton();
resetButton = new javax.swing.JButton();
jLabel3 = new javax.swing.JLabel();
okButton = new javax.swing.JButton();
cancelButton = new javax.swing.JButton();
paramPanel = new javax.swing.JPanel();
@@ -186,7 +185,7 @@ public class ColumnMapperDialog extends javax.swing.JDialog {
gridBagConstraints.insets = new java.awt.Insets(2, 0, 0, 0);
jPanel1.add(jLabel2, gridBagConstraints);
jPanel2.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 2, 5));
jPanel2.setLayout(new java.awt.GridBagLayout());
formatButton.setText("Format");
formatButton.addActionListener(new java.awt.event.ActionListener() {
@@ -194,7 +193,9 @@ public class ColumnMapperDialog extends javax.swing.JDialog {
formatButtonActionPerformed(evt);
}
});
jPanel2.add(formatButton);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 2);
jPanel2.add(formatButton, gridBagConstraints);
resetButton.setText("Reset");
resetButton.addActionListener(new java.awt.event.ActionListener() {
@@ -202,10 +203,11 @@ public class ColumnMapperDialog extends javax.swing.JDialog {
resetButtonActionPerformed(evt);
}
});
jPanel2.add(resetButton);
jLabel3.setText(" ");
jPanel2.add(jLabel3);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 2);
jPanel2.add(resetButton, gridBagConstraints);
okButton.setText("Ok");
okButton.addActionListener(new java.awt.event.ActionListener() {
@@ -213,7 +215,9 @@ public class ColumnMapperDialog extends javax.swing.JDialog {
okButtonActionPerformed(evt);
}
});
jPanel2.add(okButton);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 2);
jPanel2.add(okButton, gridBagConstraints);
cancelButton.setText("Cancel");
cancelButton.addActionListener(new java.awt.event.ActionListener() {
@@ -221,13 +225,15 @@ public class ColumnMapperDialog extends javax.swing.JDialog {
cancelButtonActionPerformed(evt);
}
});
jPanel2.add(cancelButton);
jPanel2.add(cancelButton, new java.awt.GridBagConstraints());
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 30;
gridBagConstraints.gridwidth = 3;
gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
jPanel1.add(jPanel2, gridBagConstraints);
paramPanel.setMinimumSize(new java.awt.Dimension(150, 0));
@@ -289,7 +295,6 @@ public class ColumnMapperDialog extends javax.swing.JDialog {
private javax.swing.JButton formatButton;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JButton okButton;
@@ -115,7 +115,7 @@
</Component>
<Component class="javax.swing.JButton" name="browseButton">
<Properties>
<Property name="text" type="java.lang.String" value="Browse.."/>
<Property name="text" type="java.lang.String" value="Change.."/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="browseButtonActionPerformed"/>
@@ -1342,7 +1342,7 @@ public abstract class DataModelManagerDialog extends javax.swing.JFrame {
jLabel2.setText(" Base Folder ");
jPanel4.add(jLabel2, new java.awt.GridBagConstraints());
browseButton.setText("Browse..");
browseButton.setText("Change..");
browseButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
browseButtonActionPerformed(evt);
@@ -27,7 +27,7 @@
<Container class="javax.swing.JPanel" name="jPanel2">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="30" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="1" gridY="30" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="2" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
@@ -127,7 +127,7 @@
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="8" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="2" insetsLeft="2" insetsBottom="2" insetsRight="2" anchor="13" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="8" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="2" insetsLeft="2" insetsBottom="2" insetsRight="4" anchor="13" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@@ -252,7 +252,7 @@
</Properties>
<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="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="1.0"/>
<GridBagConstraints gridX="1" gridY="1" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="1.0"/>
</Constraint>
</Constraints>
@@ -16,10 +16,13 @@
package net.sf.jailer.ui;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import java.awt.Rectangle;
import java.awt.Window;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.awt.event.ItemEvent;
@@ -41,6 +44,7 @@ import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.border.BevelBorder;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
@@ -54,6 +58,7 @@ import net.sf.jailer.datamodel.Association;
import net.sf.jailer.datamodel.Column;
import net.sf.jailer.datamodel.DataModel;
import net.sf.jailer.datamodel.Table;
import net.sf.jailer.ui.UIUtil.PLAF;
import net.sf.jailer.ui.databrowser.metadata.MetaDataSource;
import net.sf.jailer.ui.databrowser.sqlconsole.MetaDataBasedSQLCompletionProvider;
import net.sf.jailer.ui.syntaxtextarea.DataModelBasedSQLCompletionProvider;
@@ -82,6 +87,9 @@ public class QueryBuilderDialog extends javax.swing.JDialog {
};
initComponents();
cancelButton.setIcon(UIUtil.scaleIcon(cancelButton, cancelIcon));
sqlEditButton.setIcon(UIUtil.scaleIcon(sqlEditButton, sqlConsoleIcon));
if (jScrollPane1.getHorizontalScrollBar() != null) {
jScrollPane1.getHorizontalScrollBar().setUnitIncrement(16);
}
@@ -276,7 +284,7 @@ public class QueryBuilderDialog extends javax.swing.JDialog {
gridBagConstraints.gridx = 8;
gridBagConstraints.gridy = 1;
gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 4);
jPanel2.add(cancelButton, gridBagConstraints);
jLabel4.setText(" ");
@@ -289,6 +297,7 @@ public class QueryBuilderDialog extends javax.swing.JDialog {
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 30;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 2, 0);
getContentPane().add(jPanel2, gridBagConstraints);
jPanel5.setLayout(new java.awt.GridBagLayout());
@@ -345,6 +354,7 @@ public class QueryBuilderDialog extends javax.swing.JDialog {
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0);
jPanel6.add(relationshipsPanel, gridBagConstraints);
jScrollPane1.setViewportView(jPanel6);
@@ -709,17 +719,30 @@ public class QueryBuilderDialog extends javax.swing.JDialog {
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new Insets(0, 4, 0, 0);
minusLabel.setBorder(BorderFactory.createSoftBevelBorder(BevelBorder.RAISED));
if (UIUtil.plaf != PLAF.FLAT) {
minusLabel.setBorder(BorderFactory.createSoftBevelBorder(BevelBorder.RAISED));
} else {
minusLabel.setOpaque(true);
}
final JComboBox2 combobox = tableCB;
Color bg = minusLabel.getBackground();
minusLabel.addMouseListener(new java.awt.event.MouseAdapter() {
@Override
public void mouseEntered(java.awt.event.MouseEvent evt) {
minusLabel.setBorder(BorderFactory.createSoftBevelBorder(BevelBorder.LOWERED));
if (UIUtil.plaf == PLAF.FLAT) {
minusLabel.setBackground(UIUtil.BG_FLATMOUSEOVER);
} else {
minusLabel.setBorder(BorderFactory.createSoftBevelBorder(BevelBorder.LOWERED));
}
}
@Override
public void mouseExited(java.awt.event.MouseEvent evt) {
minusLabel.setBorder(BorderFactory.createSoftBevelBorder(BevelBorder.RAISED));
if (UIUtil.plaf == PLAF.FLAT) {
minusLabel.setBackground(bg);
} else {
minusLabel.setBorder(BorderFactory.createSoftBevelBorder(BevelBorder.LOWERED));
}
}
@Override
@@ -756,17 +779,30 @@ public class QueryBuilderDialog extends javax.swing.JDialog {
final JComponent finalTCB = tableCB;
finalTCB.setVisible(false);
jlabel.setBorder(BorderFactory.createSoftBevelBorder(BevelBorder.RAISED));
if (UIUtil.plaf != PLAF.FLAT) {
jlabel.setBorder(BorderFactory.createSoftBevelBorder(BevelBorder.RAISED));
} else {
jlabel.setOpaque(true);
}
Color bg = jlabel.getBackground();
jlabel.addMouseListener(new java.awt.event.MouseAdapter() {
@Override
public void mouseEntered(java.awt.event.MouseEvent evt) {
jlabel.setBorder(BorderFactory.createSoftBevelBorder(BevelBorder.LOWERED));
if (UIUtil.plaf == PLAF.FLAT) {
jlabel.setBackground(UIUtil.BG_FLATMOUSEOVER);
} else {
jlabel.setBorder(BorderFactory.createSoftBevelBorder(BevelBorder.LOWERED));
}
}
@Override
public void mouseExited(java.awt.event.MouseEvent evt) {
jlabel.setBorder(BorderFactory.createSoftBevelBorder(BevelBorder.RAISED));
if (UIUtil.plaf == PLAF.FLAT) {
jlabel.setBackground(bg);
} else {
jlabel.setBorder(BorderFactory.createSoftBevelBorder(BevelBorder.LOWERED));
}
}
@Override
@@ -865,7 +901,11 @@ public class QueryBuilderDialog extends javax.swing.JDialog {
checkAliases();
updateSQL();
validate();
Rectangle r = getBounds();
r.width--;
setBounds(r); // force relayouting
r.width++;
setBounds(r);
}
/**
@@ -1463,11 +1503,18 @@ public class QueryBuilderDialog extends javax.swing.JDialog {
private ImageIcon joinImage = null;
private ImageIcon minusImage = null;
private ImageIcon sqlConsoleIcon = null;
{
// load image
joinImage = UIUtil.scaleIcon(UIUtil.readImage("/collapsed.png"), 22, 18);
minusImage = UIUtil.scaleIcon(UIUtil.readImage("/minus.png"), 22, 18);
joinImage = UIUtil.scaleIcon(UIUtil.readImage("/collapsed.png"), 20, 16);
minusImage = UIUtil.scaleIcon(UIUtil.readImage("/minus.png"), 20, 16);
}
private ImageIcon cancelIcon;
{
// load images
cancelIcon = UIUtil.readImage("/buttoncancel.png");
sqlConsoleIcon = UIUtil.readImage("/runall.png");
}
private static final long serialVersionUID = -2801831496446636545L;
}
@@ -226,7 +226,7 @@
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="2" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="11" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="2" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="0" insetsRight="0" anchor="11" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@@ -36,6 +36,7 @@ import java.util.Map;
import java.util.concurrent.LinkedBlockingQueue;
import javax.swing.DefaultCellEditor;
import javax.swing.ImageIcon;
import javax.swing.JCheckBox;
import javax.swing.JDialog;
import javax.swing.JFrame;
@@ -106,6 +107,9 @@ public class AssociationProposerView extends javax.swing.JPanel {
this.executionContext = executionContext;
initComponents();
loadButton.setIcon(UIUtil.scaleIcon(loadButton, loadIcon));
closeButton.setIcon(UIUtil.scaleIcon(closeButton, cancelIcon));
editorPane = new RSyntaxTextAreaWithSQLSyntaxStyle(false, false) {
@Override
@@ -663,6 +667,7 @@ public class AssociationProposerView extends javax.swing.JPanel {
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 1;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0);
panel8.add(applyButton, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
@@ -966,7 +971,15 @@ public class AssociationProposerView extends javax.swing.JPanel {
UIUtil.showException(this, "Error", t);
}
}
private ImageIcon loadIcon;
private ImageIcon cancelIcon;
{
// load images
loadIcon = UIUtil.readImage("/load2.png");
cancelIcon = UIUtil.readImage("/buttoncancel.png");
}
// TODO warning if one of the two PKs is only partially covered.
}
@@ -67,7 +67,7 @@
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="100" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="14" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="1" gridY="100" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="2" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="14" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@@ -31,6 +31,7 @@ import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.LinkedBlockingQueue;
import javax.swing.ImageIcon;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
@@ -79,6 +80,8 @@ public abstract class ConstraintChecker extends javax.swing.JPanel {
public ConstraintChecker(JFrame owner, DataModel dataModel, boolean withViewButton, final Session session) {
initComponents();
closeButton.setIcon(UIUtil.scaleIcon(closeButton, cancelIcon));
viewButton.setVisible(withViewButton);
checksPane = new RSyntaxTextAreaWithSQLSyntaxStyle(false, false);
@@ -441,6 +444,7 @@ public abstract class ConstraintChecker extends javax.swing.JPanel {
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 100;
gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHEAST;
gridBagConstraints.insets = new java.awt.Insets(2, 0, 0, 0);
jPanel1.add(closeButton, gridBagConstraints);
checksTabPanel.setLayout(new java.awt.BorderLayout());
@@ -711,6 +715,12 @@ public abstract class ConstraintChecker extends javax.swing.JPanel {
}
protected abstract void openTableBrowser(Table source, String where);
private ImageIcon cancelIcon;
{
// load images
cancelIcon = UIUtil.readImage("/buttoncancel.png");
}
}
@@ -704,7 +704,7 @@ public abstract class SQLConsole extends javax.swing.JPanel {
status.location = location;
status.linesExecuted = 0;
status.linesExecuting = 0;
status.running = true;
status.setRunning(true);
int lineStartOffset = finalLineStartOffset;
try {
Pattern pattern;
@@ -786,7 +786,7 @@ public abstract class SQLConsole extends javax.swing.JPanel {
restoreHistory();
}
} finally {
status.running = false;
status.setRunning(false);
running.set(false);
status.updateView(true);
UIUtil.invokeLater(new Runnable() {
@@ -1806,6 +1806,11 @@ public abstract class SQLConsole extends javax.swing.JPanel {
Throwable error;
String statement;
Pair<Integer, Integer> location;
Color failedColor = new Color(255, 210, 210);
Color okColor = new Color(220, 255, 220);
Color pendingColor = new Color(235, 235, 255);
Color runningColor = new Color(255, 249, 200);
Color runningStatusLabelColor = new Color(0, 100, 0);
private synchronized void updateView(boolean force) {
if (force || !updatingStatus.get()) {
@@ -1823,7 +1828,7 @@ public abstract class SQLConsole extends javax.swing.JPanel {
if (!failed) {
cancelButton.setEnabled(running);
statusLabel.setVisible(true);
statusLabel.setForeground(running? new Color(0, 100, 0) : Color.BLACK);
statusLabel.setForeground(running? runningStatusLabelColor : Color.BLACK);
statusLabel.setText(getText());
} else {
statusLabel.setVisible(true);
@@ -1856,10 +1861,6 @@ public abstract class SQLConsole extends javax.swing.JPanel {
}
}
}
Color failedColor = new Color(255, 210, 210);
Color okColor = new Color(220, 255, 220);
Color pendingColor = new Color(235, 235, 255);
Color runningColor = new Color(255, 249, 200);
if (location != null) {
editorPane.removeAllLineHighlights();
editorPane.setHighlightCurrentLine(false);
@@ -1873,7 +1874,7 @@ public abstract class SQLConsole extends javax.swing.JPanel {
} else {
if (failed) {
hl = failedColor;
} else if (running){
} else if (running) {
hl = runningColor;
} else {
hl = pendingColor;
@@ -1898,6 +1899,45 @@ public abstract class SQLConsole extends javax.swing.JPanel {
});
}
}
Timer timer = null;
int time;
private void setRunning(boolean r) {
if (r && !running) {
if (timer != null) {
timer.stop();
}
time = 0;
timer = new Timer(50, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (running) {
++time;
Color startColor = runningStatusLabelColor;
double x = Math.sin(2 * Math.PI * time / 50.0);
double f = Math.pow(Math.abs(x), 6);
Color c = new Color(startColor.getRed(), mid(f, startColor.getGreen(), 245), startColor.getBlue());
statusLabel.setForeground(c);
} else {
timer.stop();
}
}
private int mid(double f, int s, int d) {
return (int) (s + f * (d - s));
}
});
timer.setInitialDelay(1000);
timer.setRepeats(true);
timer.start();
} else if (!r && running) {
if (timer != null) {
timer.stop();
}
timer = null;
}
running = r;
}
private String getText() {
String text = "";
@@ -3490,28 +3530,10 @@ public abstract class SQLConsole extends javax.swing.JPanel {
return editorPane;
}
// private SmartHighlightPainter currentStatementHighlightPainter = new SmartHighlightPainter(new Color(0, 0, 255, 15));
// private Object currentStatementHighlightTag = null;
private void hightlight(int a, int b) {
hightlight(editorPane, 0, 0);
// try {
// if (currentStatementHighlightTag != null) {
// editorPane.getHighlighter().removeHighlight(currentStatementHighlightTag);
// }
// if (a == b) {
// currentStatementHighlightTag = null;
// } else {
// currentStatementHighlightTag = editorPane.getHighlighter().addHighlight(a, b, currentStatementHighlightPainter);
// }
// } catch (/*BadLocation*/ Exception e) {
// return;
// }
}
// TODO 1
// TODO kein auto-sync, overlay in console fuer benutzerentscheidung, ob jetzt synced wird oder nicht.
protected abstract void onContentStateChange(File file, boolean dirty);
protected abstract void setReloadLimit(int limit);