From: tcofoegbu Date: Mon, 10 Apr 2017 11:44:40 +0000 (+0100) Subject: JAL-2473 added improvement to apply default / custom minimum dimension for various... X-Git-Tag: Release_2_10_2~3^2~107^2~3 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=b59839dfda0a767318fc3c89d9604c39ff298d83;p=jalview.git JAL-2473 added improvement to apply default / custom minimum dimension for various Jalview dialogs / windows. This is to prevent some components from disappearing when the dialogs / windows are resized downwards below certain dimensions --- diff --git a/src/jalview/fts/core/GFTSPanel.java b/src/jalview/fts/core/GFTSPanel.java index a69d9f8..6000526 100644 --- a/src/jalview/fts/core/GFTSPanel.java +++ b/src/jalview/fts/core/GFTSPanel.java @@ -146,6 +146,10 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI protected HashSet paginatorCart = new HashSet(); + private static final int MIN_WIDTH = 670; + + private static final int MIN_HEIGHT = 300; + protected static final DecimalFormat totalNumberformatter = new DecimalFormat( "###,###"); @@ -234,6 +238,7 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI try { jbInit(); + mainFrame.setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT)); mainFrame.addFocusListener(new FocusAdapter() { @Override diff --git a/src/jalview/gui/AnnotationColourChooser.java b/src/jalview/gui/AnnotationColourChooser.java index 8500888..253a7ec 100644 --- a/src/jalview/gui/AnnotationColourChooser.java +++ b/src/jalview/gui/AnnotationColourChooser.java @@ -69,6 +69,10 @@ public class AnnotationColourChooser extends AnnotationRowFilter private JCheckBox thresholdIsMin = new JCheckBox(); + protected static final int MIN_WIDTH = 500; + + protected static final int MIN_HEIGHT = 240; + public AnnotationColourChooser(AlignViewport av, final AlignmentPanel ap) { super(av, ap); @@ -90,7 +94,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter Desktop.addInternalFrame(frame, MessageManager.getString("label.colour_by_annotation"), 520, 215); - + frame.setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT)); addSliderChangeListener(); addSliderMouseListeners(); diff --git a/src/jalview/gui/AnnotationColumnChooser.java b/src/jalview/gui/AnnotationColumnChooser.java index 637eb30..fde6ce8 100644 --- a/src/jalview/gui/AnnotationColumnChooser.java +++ b/src/jalview/gui/AnnotationColumnChooser.java @@ -30,6 +30,7 @@ import jalview.viewmodel.annotationfilter.AnnotationFilterParameter; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Color; +import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; @@ -88,6 +89,10 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements private ColumnSelection oldColumnSelection; + protected int MIN_WIDTH = 420; + + protected int MIN_HEIGHT = 430; + public AnnotationColumnChooser(AlignViewport av, final AlignmentPanel ap) { super(av, ap); @@ -97,6 +102,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements Desktop.addInternalFrame(frame, MessageManager.getString("label.select_by_annotation"), 520, 215); + frame.setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT)); addSliderChangeListener(); addSliderMouseListeners(); diff --git a/src/jalview/gui/Console.java b/src/jalview/gui/Console.java index 280b4c0..de7574c 100644 --- a/src/jalview/gui/Console.java +++ b/src/jalview/gui/Console.java @@ -84,6 +84,10 @@ public class Console extends WindowAdapter implements WindowListener, // are we attached to some parent Desktop Desktop parent = null; + private int MIN_WIDTH = 300; + + private int MIN_HEIGHT = 250; + public Console() { // create all components and add them @@ -243,7 +247,9 @@ public class Console extends WindowAdapter implements WindowListener, .getLocalGraphicsEnvironment(); String[] fontNames = ge.getAvailableFontFamilyNames(); for (int n = 0; n < fontNames.length; n++) + { System.out.println(fontNames[n]); + } // Testing part: simple an error thrown anywhere in this JVM will be printed // on the Console // We do it with a seperate Thread becasue we don't wan't to break a Thread @@ -259,9 +265,13 @@ public class Console extends WindowAdapter implements WindowListener, JFrame frame = new JFrame(string); frame.setName(string); if (x == -1) - x = (int) (i / 2); + { + x = i / 2; + } if (y == -1) - y = (int) (j / 2); + { + y = j / 2; + } frame.setBounds(x, y, i, j); return frame; } @@ -298,6 +308,7 @@ public class Console extends WindowAdapter implements WindowListener, frame = initFrame("Jalview Java Console", bounds.width, bounds.height, bounds.x, bounds.y); } + frame.setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT)); // desktop.add(frame); initConsole(false); JalviewAppender jappender = new JalviewAppender(); @@ -345,6 +356,7 @@ public class Console extends WindowAdapter implements WindowListener, // System.exit(0); } + @Override public synchronized void windowClosed(WindowEvent evt) { frame.setVisible(false); @@ -365,6 +377,7 @@ public class Console extends WindowAdapter implements WindowListener, } } + @Override public synchronized void windowClosing(WindowEvent evt) { frame.setVisible(false); // default behaviour of JFrame @@ -373,12 +386,14 @@ public class Console extends WindowAdapter implements WindowListener, // frame.dispose(); } + @Override public synchronized void actionPerformed(ActionEvent evt) { trimBuffer(true); // textArea.setText(""); } + @Override public synchronized void run() { try @@ -410,7 +425,9 @@ public class Console extends WindowAdapter implements WindowListener, // lines++; } if (quit) + { return; + } } while (Thread.currentThread() == reader2) @@ -439,7 +456,9 @@ public class Console extends WindowAdapter implements WindowListener, // lines++; } if (quit) + { return; + } } while (Thread.currentThread() == textAppender) { @@ -531,6 +550,7 @@ public class Console extends WindowAdapter implements WindowListener, long time = System.nanoTime(); javax.swing.SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { displayPipe.append(input); // change to stringBuffer @@ -598,7 +618,9 @@ public class Console extends WindowAdapter implements WindowListener, { int available = in.available(); if (available == 0) + { break; + } byte b[] = new byte[available]; in.read(b); input = input + new String(b, 0, b.length); diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index 7d0eb7f..d6c25a8 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -129,6 +129,9 @@ public class Desktop extends jalview.jbgui.GDesktop implements DropTargetListener, ClipboardOwner, IProgressIndicator, jalview.api.StructureSelectionManagerProvider { + private static int DEFAULT_MIN_WIDTH = 300; + + private static int DEFAULT_MIN_HEIGHT = 250; private JalviewChangeSupport changeSupport = new JalviewChangeSupport(); @@ -833,6 +836,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements openFrameCount++; + frame.setMinimumSize(new Dimension(DEFAULT_MIN_WIDTH, + DEFAULT_MIN_HEIGHT)); frame.setVisible(makeVisible); frame.setClosable(true); frame.setResizable(resizable); diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java index 26f9964..feb09fc 100644 --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@ -40,6 +40,7 @@ import jalview.ws.dbsources.das.api.jalviewSourceI; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; +import java.awt.Dimension; import java.awt.Font; import java.awt.Graphics; import java.awt.GridLayout; @@ -126,6 +127,10 @@ public class FeatureSettings extends JPanel implements JPanel transPanel = new JPanel(new GridLayout(1, 2)); + private static final int MIN_WIDTH = 400; + + private static final int MIN_HEIGHT = 400; + public FeatureSettings(AlignFrame af) { this.af = af; @@ -278,6 +283,7 @@ public class FeatureSettings extends JPanel implements MessageManager.getString("label.sequence_feature_settings"), 400, 450); } + frame.setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT)); frame.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter() { diff --git a/src/jalview/gui/Finder.java b/src/jalview/gui/Finder.java index af23ceb..e44c956 100755 --- a/src/jalview/gui/Finder.java +++ b/src/jalview/gui/Finder.java @@ -28,6 +28,7 @@ import jalview.jbgui.GFinder; import jalview.util.MessageManager; import jalview.viewmodel.AlignmentViewport; +import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.util.Vector; @@ -38,7 +39,6 @@ import javax.swing.AbstractAction; import javax.swing.JComponent; import javax.swing.JInternalFrame; import javax.swing.JLayeredPane; -import javax.swing.JOptionPane; import javax.swing.KeyStroke; /** @@ -54,14 +54,18 @@ import javax.swing.KeyStroke; */ public class Finder extends GFinder { - private static final int HEIGHT = 110; + private static final int HEIGHT = 120; - private static final int WIDTH = 340; + private static final int WIDTH = 400; AlignmentViewport av; AlignmentPanel ap; + private static final int MIN_WIDTH = 350; + + private static final int MIN_HEIGHT = 120; + JInternalFrame frame; int seqIndex = 0; @@ -97,7 +101,7 @@ public class Finder extends GFinder addEscapeHandler(); Desktop.addInternalFrame(frame, MessageManager.getString("label.find"), WIDTH, HEIGHT); - + frame.setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT)); textfield.requestFocus(); } diff --git a/src/jalview/gui/JalviewDialog.java b/src/jalview/gui/JalviewDialog.java index 8742253..3584486 100644 --- a/src/jalview/gui/JalviewDialog.java +++ b/src/jalview/gui/JalviewDialog.java @@ -23,6 +23,7 @@ package jalview.gui; import jalview.util.MessageManager; import java.awt.Container; +import java.awt.Dimension; import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -52,6 +53,10 @@ public abstract class JalviewDialog extends JPanel boolean block = false; + private int DEFAULT_MIN_WIDTH = 300; + + private int DEFAULT_MIN_HEIGHT = 250; + public void waitForInput() { if (!block) @@ -89,6 +94,9 @@ public abstract class JalviewDialog extends JPanel { frame.setSize(width, height); } + int minWidth = width - 100; + int minHeight = height - 100; + frame.setMinimumSize(new Dimension(minWidth, minHeight)); frame.setContentPane(content); this.block = block; diff --git a/src/jalview/gui/PCAPanel.java b/src/jalview/gui/PCAPanel.java index 58ed008..5b1aa37 100644 --- a/src/jalview/gui/PCAPanel.java +++ b/src/jalview/gui/PCAPanel.java @@ -34,6 +34,7 @@ import jalview.viewmodel.PCAModel; import java.awt.BorderLayout; import java.awt.Color; +import java.awt.Dimension; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -70,6 +71,10 @@ public class PCAPanel extends GPCAPanel implements Runnable, PCAModel pcaModel; + private static final int MIN_WIDTH = 470; + + private static final int MIN_HEIGHT = 250; + int top = 0; /** @@ -249,6 +254,7 @@ public class PCAPanel extends GPCAPanel implements Runnable, addKeyListener(rc); Desktop.addInternalFrame(this, MessageManager .getString("label.principal_component_analysis"), 475, 450); + this.setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT)); } } diff --git a/src/jalview/gui/SequenceFetcher.java b/src/jalview/gui/SequenceFetcher.java index 8e1d549..bf0ab70 100755 --- a/src/jalview/gui/SequenceFetcher.java +++ b/src/jalview/gui/SequenceFetcher.java @@ -52,7 +52,6 @@ import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JInternalFrame; import javax.swing.JLabel; -import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; diff --git a/src/jalview/gui/UserDefinedColours.java b/src/jalview/gui/UserDefinedColours.java index 9ab4327..89d26b9 100755 --- a/src/jalview/gui/UserDefinedColours.java +++ b/src/jalview/gui/UserDefinedColours.java @@ -176,7 +176,6 @@ public class UserDefinedColours extends GUserDefinedColours implements Desktop.addInternalFrame(frame, MessageManager.getString("label.user_defined_colours"), MY_FRAME_WIDTH, MY_FRAME_HEIGHT, true); - if (seqGroup != null) { frame.setTitle(frame.getTitle() + " (" + seqGroup.getName() + ")");