From 4bb2d2c1e56748e2d636b1b10edc6973df32cc31 Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Fri, 24 Feb 2023 17:23:52 +0000 Subject: [PATCH] JAL-629 Position GUI widgets for PDF file options. Remove icon from StructureChooser frame. --- src/jalview/gui/StructureChooser.java | 7 +++-- src/jalview/jbgui/GStructureChooser.java | 47 +++++++++++++++++++++++------- 2 files changed, 41 insertions(+), 13 deletions(-) diff --git a/src/jalview/gui/StructureChooser.java b/src/jalview/gui/StructureChooser.java index 04cc94e..aadae01 100644 --- a/src/jalview/gui/StructureChooser.java +++ b/src/jalview/gui/StructureChooser.java @@ -943,6 +943,7 @@ public class StructureChooser extends GStructureChooser AssociateSeqOptions assSeqOpt = (AssociateSeqOptions) fileChooserAssSeqPanel .getCmb_assSeq().getSelectedItem(); lbl_fromFileStatus.setIcon(errorImage); + setPdbOptionsEnabled(false); if (selectedSequences.length == 1 || (assSeqOpt != null && !assSeqOpt .getName().equalsIgnoreCase("-Select Associated Seq-"))) { @@ -951,12 +952,14 @@ public class StructureChooser extends GStructureChooser { btn_add.setEnabled(true); lbl_fromFileStatus.setIcon(goodImage); + setPdbOptionsEnabled(true); } } else { btn_pdbFromFile.setEnabled(false); lbl_fromFileStatus.setIcon(errorImage); + setPdbOptionsEnabled(false); } } @@ -1586,7 +1589,7 @@ public class StructureChooser extends GStructureChooser public static void openStructureFileForSequence(AlignmentPanel ap, SequenceI seq, File sFile) { - //Open the chooser headlessly. Not sure this is actually needed ? + // Open the chooser headlessly. Not sure this is actually needed ? StructureChooser sc = new StructureChooser(new SequenceI[] { seq }, seq, ap, false); StructureSelectionManager ssm = ap.getStructureSelectionManager(); @@ -1607,6 +1610,6 @@ public class StructureChooser extends GStructureChooser new PDBEntry[] { fileEntry }, ap, new SequenceI[] { seq }); - sc.mainFrame.dispose(); + sc.mainFrame.dispose(); } } diff --git a/src/jalview/jbgui/GStructureChooser.java b/src/jalview/jbgui/GStructureChooser.java index 5af9cec..cfb4665 100644 --- a/src/jalview/jbgui/GStructureChooser.java +++ b/src/jalview/jbgui/GStructureChooser.java @@ -27,6 +27,8 @@ import java.awt.Component; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Font; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; import java.awt.GridLayout; import java.awt.Insets; import java.awt.Point; @@ -42,7 +44,6 @@ import java.util.Arrays; import java.util.HashMap; import java.util.Map; -import javax.swing.BoxLayout; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JCheckBox; @@ -124,6 +125,8 @@ public abstract class GStructureChooser extends JPanel protected JButton btn_pdbFromFile = new JButton(); + protected JLabel lbl_chooseTempFacType = new JLabel(); + protected JComboBox combo_tempFacAs = new JComboBox<>(); protected JButton btn_paeMatrixFile = new JButton(); @@ -274,6 +277,7 @@ public abstract class GStructureChooser extends JPanel try { jbInit(); + mainFrame.setFrameIcon(null); mainFrame.setVisible(false); mainFrame.invalidate(); mainFrame.pack(); @@ -554,9 +558,10 @@ public abstract class GStructureChooser extends JPanel } }); - JLabel lbl_chooseTempFacType = new JLabel(new StringBuilder() + lbl_chooseTempFacType.setText(new StringBuilder() .append(MessageManager.getString("label.choose_tempfac_type")) - .append(" ").append("label.optional").toString()); + .append(" ").append(MessageManager.getString("label.optional")) + .toString()); for (TFType t : TFType.values()) { @@ -667,17 +672,30 @@ public abstract class GStructureChooser extends JPanel pnl_fileChooser.add(btn_pdbFromFile); pnl_fileChooser.add(lbl_fromFileStatus); - JPanel pnl_pdbOptions = new JPanel(); - pnl_pdbOptions - .setLayout(new BoxLayout(pnl_pdbOptions, BoxLayout.PAGE_AXIS)); - pnl_pdbOptions.add(lbl_chooseTempFacType); - pnl_pdbOptions.add(combo_tempFacAs); - pnl_pdbOptions.add(btn_paeMatrixFile); + JPanel pnl_fileOptions = new JPanel(); + pnl_fileOptions.setLayout(new GridBagLayout()); + GridBagConstraints gbc = new GridBagConstraints(); + gbc.gridx = 0; + gbc.gridy = 0; + gbc.weightx = 0.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(0, 0, 18, 0); + gbc.fill = GridBagConstraints.NONE; + gbc.anchor = GridBagConstraints.FIRST_LINE_START; + pnl_fileOptions.add(pnl_fileChooser, gbc); + gbc.gridy++; + gbc.insets = new Insets(0, 0, 2, 0); + pnl_fileOptions.add(lbl_chooseTempFacType, gbc); + gbc.gridy++; + gbc.insets = new Insets(0, 0, 18, 0); + pnl_fileOptions.add(combo_tempFacAs, gbc); + gbc.gridy++; + gbc.weighty = 1.0; + pnl_fileOptions.add(btn_paeMatrixFile, gbc); JPanel pnl_fileChooserBL = new JPanel(new BorderLayout()); pnl_fileChooserBL.add(fileChooserAssSeqPanel, BorderLayout.PAGE_START); - pnl_fileChooserBL.add(pnl_fileChooser, BorderLayout.CENTER); - // pnl_fileChooserBL.add(pnl_pdbOptions, BorderLayout.PAGE_END); + pnl_fileChooserBL.add(pnl_fileOptions, BorderLayout.CENTER); JPanel pnl_idInput = new JPanel(new FlowLayout()); pnl_idInput.add(txt_search); @@ -998,4 +1016,11 @@ public abstract class GStructureChooser extends JPanel { return mainFrame; } + + public void setPdbOptionsEnabled(boolean b) + { + lbl_chooseTempFacType.setEnabled(b); + combo_tempFacAs.setEnabled(b); + btn_paeMatrixFile.setEnabled(b); + } } -- 1.7.10.2