mirror of
https://github.com/Wisser/Jailer.git
synced 2026-05-20 19:38:32 -05:00
ask before opening of many browsers
This commit is contained in:
@@ -1738,25 +1738,28 @@ public abstract class BrowserContentPane extends javax.swing.JPanel {
|
||||
addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
final int MAX_COUNT = 12; // TODO create a dialog to let the user select the items to perform if there are more than that
|
||||
Component parent = SwingUtilities.getWindowAncestor(BrowserContentPane.this);
|
||||
if (parent == null) {
|
||||
parent = BrowserContentPane.this;
|
||||
}
|
||||
UIUtil.setWaitCursor(parent);
|
||||
try {
|
||||
Desktop.noArrangeLayoutOnNewTableBrowser = true;
|
||||
Desktop.noArrangeLayoutOnNewTableBrowserWithAnchor = todoList.size() > 1;
|
||||
Desktop.resetLastArrangeLayoutOnNewTableBrowser();
|
||||
for (int i = 0; i < todoList.size(); ++i) {
|
||||
if (i == todoList.size() - 1) {
|
||||
Desktop.noArrangeLayoutOnNewTableBrowser = false;
|
||||
if (todoList.size() <= MAX_COUNT || JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(parent, "Do you really want to open " + todoList.size() + " table browser?", "Opening a lot of table browsers", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE)) {
|
||||
UIUtil.setWaitCursor(parent);
|
||||
try {
|
||||
Desktop.noArrangeLayoutOnNewTableBrowser = true;
|
||||
Desktop.noArrangeLayoutOnNewTableBrowserWithAnchor = todoList.size() > 1;
|
||||
Desktop.resetLastArrangeLayoutOnNewTableBrowser();
|
||||
for (int i = 0; i < todoList.size(); ++i) {
|
||||
if (i == todoList.size() - 1) {
|
||||
Desktop.noArrangeLayoutOnNewTableBrowser = false;
|
||||
}
|
||||
todoList.get(i).actionPerformed(e);
|
||||
}
|
||||
todoList.get(i).actionPerformed(e);
|
||||
} finally {
|
||||
Desktop.noArrangeLayoutOnNewTableBrowser = false;
|
||||
Desktop.noArrangeLayoutOnNewTableBrowserWithAnchor = false;
|
||||
UIUtil.resetWaitCursor(parent);
|
||||
}
|
||||
} finally {
|
||||
Desktop.noArrangeLayoutOnNewTableBrowser = false;
|
||||
Desktop.noArrangeLayoutOnNewTableBrowserWithAnchor = false;
|
||||
UIUtil.resetWaitCursor(parent);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -825,12 +825,12 @@ public class DataBrowser extends javax.swing.JFrame {
|
||||
int c = 0;
|
||||
for (Frame frame: Frame.getFrames()) {
|
||||
if (frame instanceof DataBrowser && frame.isVisible()) {
|
||||
c = (c + 1) % 10;
|
||||
c = (c + 1) % 6;
|
||||
}
|
||||
}
|
||||
|
||||
setLocation(40 + c * 32, 40 + c * 32);
|
||||
setSize(980, 640);
|
||||
setLocation(40 + c * 32, 32 + c * 32);
|
||||
setSize(980, 800);
|
||||
|
||||
UIUtil.fit(this);
|
||||
|
||||
@@ -3179,6 +3179,7 @@ public class DataBrowser extends javax.swing.JFrame {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
arrangeLayout(true);
|
||||
} finally {
|
||||
UIUtil.resetWaitCursor(this);
|
||||
disableBorderBrowserUpdates = false;
|
||||
|
||||
@@ -296,9 +296,9 @@ public abstract class Desktop extends JDesktopPane {
|
||||
long startTime = System.currentTimeMillis();
|
||||
try {
|
||||
checkAnchorRetension();
|
||||
if (isDesktopVisible()) {
|
||||
if (isAnimationEnabled()) {
|
||||
repaintOutline();
|
||||
if (isAnimationEnabled()) {
|
||||
repaintOutline();
|
||||
if (isDesktopVisible()) {
|
||||
suppressRepaintDesktop = true;
|
||||
desktopAnimation.animate();
|
||||
boolean cl = calculateLinks();
|
||||
@@ -577,11 +577,12 @@ public abstract class Desktop extends JDesktopPane {
|
||||
public void paint(Graphics g) {
|
||||
boolean useBuffer = (desktopAnimation != null && desktopAnimation.isActive()) || desktopOutlineDraggingInProgress();
|
||||
boolean updateBuffer = false;
|
||||
if (currentIFrameBufferGeneration != iFrameBufferGeneration) {
|
||||
if (currentIFrameBufferGeneration != iFrameBufferGeneration || !useBuffer) {
|
||||
currentIFrameBufferGeneration = iFrameBufferGeneration;
|
||||
m_offscreen = null;
|
||||
bufferSize = null;
|
||||
}
|
||||
|
||||
|
||||
Graphics2D g2D = (Graphics2D)g;
|
||||
AffineTransform at = g2D.getTransform();
|
||||
|
||||
@@ -606,6 +607,8 @@ public abstract class Desktop extends JDesktopPane {
|
||||
m_offscreen = null;
|
||||
} else if (Math.abs(bufferSize.getWidth() - getSize().width) > 2 || Math.abs(bufferSize.getHeight() - getSize().height) > 2) {
|
||||
m_offscreen = null;
|
||||
super.paint(g);
|
||||
return;
|
||||
}
|
||||
if (m_offscreen == null || newBuffer) {
|
||||
if (useBuffer) {
|
||||
@@ -2483,6 +2486,7 @@ public abstract class Desktop extends JDesktopPane {
|
||||
setMinimumSize(d);
|
||||
setMaximumSize(d);
|
||||
setPreferredSize(d);
|
||||
revalidate();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -286,7 +286,11 @@ public class DesktopOutline extends JPanel {
|
||||
g2d.clipRect(sx, sy, sw, sh);
|
||||
String title = " " + browser.internalFrame.getTitle();
|
||||
Rectangle2D stringBounds = fontMetrics.getStringBounds(title, g2d);
|
||||
g2d.drawString(title, (int)(offX + scale * rectangle.x + Math.max(0, (sw - stringBounds.getWidth()) / 2)), (int)(offY + scale * rectangle.y + stringBounds.getHeight() * 1.2));
|
||||
double hf = 1.2;
|
||||
if (stringBounds.getHeight() < hf * sh) {
|
||||
hf = 1.0;
|
||||
}
|
||||
g2d.drawString(title, (int)(offX + scale * rectangle.x + Math.max(0, (sw - stringBounds.getWidth()) / 2)), (int)(offY + scale * rectangle.y + stringBounds.getHeight() * hf));
|
||||
g2d.setClip(clip);
|
||||
}
|
||||
if (!browser.isHidden() && browser.internalFrame.isSelected()) {
|
||||
|
||||
@@ -72,6 +72,11 @@ public class TreeLayoutOptimizer<T> {
|
||||
|
||||
public double getMinPosition() {
|
||||
double minPos = position;
|
||||
if (getUserObject() == null) {
|
||||
if (!children.isEmpty()) {
|
||||
minPos = children.get(0).position;
|
||||
}
|
||||
}
|
||||
for (Node<T> child: children) {
|
||||
minPos = Math.min(minPos, child.getMinPosition());
|
||||
}
|
||||
@@ -294,7 +299,6 @@ public class TreeLayoutOptimizer<T> {
|
||||
modifications.addAll(modificationPairs);
|
||||
|
||||
double currentMaxPosition = layoutTree(root, numNodes);
|
||||
// int steps = 0;
|
||||
while (System.currentTimeMillis() - startTime < maxTime) {
|
||||
Modification bestModification = null;
|
||||
double bestMaxPosition = 0;
|
||||
@@ -308,7 +312,6 @@ public class TreeLayoutOptimizer<T> {
|
||||
}
|
||||
}
|
||||
modification.undoIt();
|
||||
// ++steps;
|
||||
}
|
||||
if (bestModification != null) {
|
||||
bestModification.doIt();
|
||||
@@ -317,8 +320,6 @@ public class TreeLayoutOptimizer<T> {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// System.out.println(System.currentTimeMillis() - startTime + " " + steps + " " + modifications.size());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user