diff --git a/releasenotes.txt b/releasenotes.txt index a87254833..df7114d12 100644 --- a/releasenotes.txt +++ b/releasenotes.txt @@ -1,3 +1,11 @@ +14.1 + - Database connection navigation has been introduced in the Data Bowser + to allow easy and fast switching between data models and/or database connections. + - The links between related rows between the selected table browsers are now rendered highlighted. + This increases clarity in complex table networks. + - Fixed "Postgres SQL Export File Not Casting to Enum Type On Enum Column Export", + https://sourceforge.net/p/jailer/discussion/700499/thread/92389c5a0f + 12.8.4 - A bug in metadata acquisition could cause the GUI to freeze for a short time. diff --git a/src/main/gui/net/sf/jailer/ui/databrowser/Desktop.java b/src/main/gui/net/sf/jailer/ui/databrowser/Desktop.java index 07378f6de..9990311f0 100644 --- a/src/main/gui/net/sf/jailer/ui/databrowser/Desktop.java +++ b/src/main/gui/net/sf/jailer/ui/databrowser/Desktop.java @@ -125,7 +125,6 @@ import net.sf.jailer.ui.UIUtil.PLAF; import net.sf.jailer.ui.databrowser.BrowserContentPane.RowsClosure; import net.sf.jailer.ui.databrowser.BrowserContentPane.SqlStatementTable; import net.sf.jailer.ui.databrowser.BrowserContentPane.UserAction; -import net.sf.jailer.ui.databrowser.Desktop.RowBrowser; import net.sf.jailer.ui.databrowser.TreeLayoutOptimizer.Node; import net.sf.jailer.ui.databrowser.metadata.MDTable; import net.sf.jailer.ui.databrowser.metadata.MetaDataSource; @@ -4413,14 +4412,7 @@ public abstract class Desktop extends JDesktopPane { // TODO display names for associations? (using unique fk-column list?) // TODO - // TODO anchor dialog initially less transparent? - // TODO 1st sec full, than as it is now? - // TODO wie bei < 12.1? (nur "hAlign", ohne Transparenz)? - - // TODO - // TODO transparency is not ergonomic? + // TODO transp. col.search, panel nach auswah wert sofort weg // TODO column filter UI component: do user understand, that underlying transparent comp. is editable? - - } diff --git a/src/main/gui/net/sf/jailer/ui/databrowser/DesktopAnchorManager.java b/src/main/gui/net/sf/jailer/ui/databrowser/DesktopAnchorManager.java index 8d844e440..7ceeca76c 100644 --- a/src/main/gui/net/sf/jailer/ui/databrowser/DesktopAnchorManager.java +++ b/src/main/gui/net/sf/jailer/ui/databrowser/DesktopAnchorManager.java @@ -62,6 +62,9 @@ public abstract class DesktopAnchorManager { private Long disabledUntil; private Long showedAt; private boolean fadeDown; + private float lastAlpha; + private long fadeDelay; + private Long initFadeStartedAt = null; private RowBrowser currentBrowser; private RowBrowser newestBrowser; private int height = 5 * 18; @@ -70,35 +73,42 @@ public abstract class DesktopAnchorManager { @SuppressWarnings("serial") public DesktopAnchorManager(JPanel topLayerPanel) { this.anchorPanel = new JPanel(null) { - Long initFadeStartedAt = null; RowBrowser initFadeBrowser = null; @Override public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g.create(); + if (ft) { + g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, lastAlpha = 0)); + super.paint(g2); + return; + } + lastAlpha = 0; try { if (initFadeStartedAt != null) { double r1 = 0.65f; double t1 = System.currentTimeMillis() - initFadeStartedAt - MAX_RETENDION * (1 - r1); if (t1 < 0 && initFadeBrowser == currentBrowser) { - g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, (float) (t1 / (-MAX_RETENDION * (1 - r1))) / 2f + 0.5f)); + g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, lastAlpha = (float) Math.min(1f, (t1 / (-MAX_RETENDION * (1 - r1))) / 2f + 0.5f))); super.paint(g2); return; } else { initFadeStartedAt = null; initFadeBrowser = null; fadeDown = false; + fadeDelay = 0; + showedAt = System.currentTimeMillis(); } } if (showedAt != null) { if (fadeDown && initFadeStartedAt == null) { - initFadeStartedAt = System.currentTimeMillis(); + initFadeStartedAt = System.currentTimeMillis() + fadeDelay; initFadeBrowser = currentBrowser; super.paint(g2); return; } else { double r = 0.75f; double t = System.currentTimeMillis() - showedAt - MAX_RETENDION * r; - g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, (float) ((1 - Math.max(0f, Math.min(1f, ((t / (MAX_RETENDION * (1 - r))))))) * 0.5f))); + g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, lastAlpha = (float) ((1 - Math.max(0f, Math.min(1f, ((t / (MAX_RETENDION * (1 - r))))))) * 0.5f))); } super.paint(g2); return; @@ -156,6 +166,7 @@ public abstract class DesktopAnchorManager { public void mouseEntered(MouseEvent e) { showedAt = null; fadeDown = false; + initFadeStartedAt = null; anchorPanel.repaint(); } @Override @@ -212,6 +223,7 @@ public abstract class DesktopAnchorManager { public void mouseEntered(MouseEvent e) { showedAt = null; fadeDown = false; + initFadeStartedAt = null; anchorPanel.repaint(); } @Override @@ -237,8 +249,9 @@ public abstract class DesktopAnchorManager { public void onTableBrowserNeared(RowBrowser tableBrowser) { if (isAvailable()) { anchorButton.setEnabled(isApplicable(tableBrowser)); + boolean wasVisible = anchorPanel.isVisible(); reset(); - showButton(tableBrowser); + showButton(tableBrowser, wasVisible); } } @@ -284,8 +297,9 @@ public abstract class DesktopAnchorManager { double dx = SwingUtilities.convertPoint(e.getComponent(), e.getX(), e.getY(), tableBrowser.internalFrame).getX(); if (dx <= 180) { anchorButton.setEnabled(isApplicable(tableBrowser)); + boolean wasVisible = anchorPanel.isVisible(); reset(); - showButton(tableBrowser); + showButton(tableBrowser, wasVisible); } } } @@ -349,15 +363,27 @@ public abstract class DesktopAnchorManager { }); reset(); } + + private boolean ft = true; + private void showButton(RowBrowser tableBrowser, boolean wasVisible) { + showButton0(tableBrowser, wasVisible); + if (ft) { + UIUtil.invokeLater(2, () -> { + ft = false; + showButton0(tableBrowser, wasVisible); + }); + } + } - protected void showButton(RowBrowser tableBrowser) { + private void showButton0(RowBrowser tableBrowser, boolean wasVisible) { if (disabledUntil != null && disabledUntil > System.currentTimeMillis()) { return; } anchorPanel.removeAll(); anchorPanel.add(anchorButton); - boolean fadeDown = this.fadeDown && currentBrowser == tableBrowser; + boolean nBrChg = currentBrowser == tableBrowser; + boolean fadeDown = this.fadeDown && nBrChg; currentBrowser = tableBrowser; anchorButton.setSize(anchorButton.getPreferredSize()); anchorPanel.setSize(anchorButton.getPreferredSize()); @@ -371,6 +397,7 @@ public abstract class DesktopAnchorManager { Point locO = new Point(); locO = SwingUtilities.convertPoint(tableBrowser.internalFrame.getParent().getParent(), locO, anchorPanel); loc = new Point(Math.max(locO.x - anchorPanel.getWidth(), loc.x) - 1, Math.max(locO.y, loc.y + 1)); + if (anchorPanel.getComponentCount() > 1 && !anchorPanel.getComponents()[0].isEnabled() && !anchorPanel.getComponents()[1].isEnabled()) { loc = new Point(loc.x, loc.y + anchorPanel.getComponents()[0].getHeight()); anchorPanel.setSize(anchorPanel.getWidth(), anchorPanel.getHeight() - anchorPanel.getComponents()[0].getHeight()); @@ -385,12 +412,18 @@ public abstract class DesktopAnchorManager { anchorPanel.setVisible(true); topLayerPanel.setVisible(true); height = anchorPanel.getHeight(); - initShowedAt(fadeDown); + if (!wasVisible || !nBrChg || lastAlpha >= 0.8f) { + initFadeStartedAt = null; + fadeDelay = 350; + initShowedAt(true); + } else { + initShowedAt(fadeDown); + } } private void initShowedAt(boolean fadeDownP) { this.fadeDown = fadeDownP; - showedAt = System.currentTimeMillis(); + showedAt = System.currentTimeMillis() + fadeDelay; int delay = 30; Timer timer = new Timer(delay, null); timer.addActionListener(e -> { @@ -432,7 +465,7 @@ public abstract class DesktopAnchorManager { public void checkRetention() { long now = System.currentTimeMillis(); - if (showedAt != null && showedAt + MAX_RETENDION < now) { + if (anchorPanel.isVisible() && showedAt != null && showedAt + MAX_RETENDION < now) { reset(); } } diff --git a/src/main/gui/net/sf/jailer/ui/databrowser/whereconditioneditor/WhereConditionEditorPanel.java b/src/main/gui/net/sf/jailer/ui/databrowser/whereconditioneditor/WhereConditionEditorPanel.java index 373dba0d0..50485b0f6 100644 --- a/src/main/gui/net/sf/jailer/ui/databrowser/whereconditioneditor/WhereConditionEditorPanel.java +++ b/src/main/gui/net/sf/jailer/ui/databrowser/whereconditioneditor/WhereConditionEditorPanel.java @@ -124,8 +124,8 @@ import net.sf.jailer.util.SqlUtil; public abstract class WhereConditionEditorPanel extends javax.swing.JPanel { private static final float REDUCED_OPACITY = 0.5f; - private static final float REDUCED_OPACITY_FADE_START = REDUCED_OPACITY + 0.15f; - private static final float REDUCED_OPACITY_RETENTION_TIME = 1.5f; + private static final float REDUCED_OPACITY_FADE_START = 0; // REDUCED_OPACITY + 0.15f; + private static final float REDUCED_OPACITY_RETENTION_TIME = 0; // 1.5f; private final int MAX_NUM_DISTINCTEXISTINGVALUES = 100_000; private final int MAX_SIZE_DISTINCTEXISTINGVALUES = 500_000; @@ -1679,6 +1679,9 @@ public abstract class WhereConditionEditorPanel extends javax.swing.JPanel { if (theSearchPanel.get(0).isExplictlyClosed()) { accept(comparison, theSearchPanel.get(0).getPlainValue(), comparison.operator); if (initialColumn >= 0 && popupOnTop) { + if (REDUCED_OPACITY_FADE_START == 0) { + setVisible(false); + } fadeStep = 0; setOpacity(REDUCED_OPACITY_FADE_START); startOpacityTimer();