Merge branch 'develop' into spike/JAL-4047/JAL-4048_columns_in_sequenceID
[jalview.git] / src / jalview / jbgui / GStructureChooser.java
index ac623bc..5b04359 100644 (file)
@@ -106,6 +106,8 @@ public abstract class GStructureChooser extends JPanel
    */
   protected static final String VIEWS_LOCAL_PDB = "VIEWS_LOCAL_PDB";
 
+  protected JPanel actionsPanel;
+
   protected JPanel statusPanel = new JPanel();
 
   public JLabel statusBar = new JLabel();
@@ -121,6 +123,8 @@ public abstract class GStructureChooser extends JPanel
 
   protected StringBuilder errorWarning = new StringBuilder();
 
+  protected JButton btn_cancel;
+
   protected JButton btn_add;
 
   protected JButton btn_newView;
@@ -133,6 +137,8 @@ public abstract class GStructureChooser extends JPanel
 
   protected JComboBox<StructureImportSettings.TFType> combo_tempFacAs = new JComboBox<>();
 
+  protected boolean tempFacAsChanged = false;
+
   protected JButton btn_paeMatrixFile = new JButton();
 
   protected JLabel lbl_paeFile = new JLabel();
@@ -289,7 +295,7 @@ public abstract class GStructureChooser extends JPanel
       mainFrame.pack();
     } catch (Exception e)
     {
-      System.out.println(e); // for JavaScript TypeError
+      jalview.bin.Console.outPrintln(e); // for JavaScript TypeError
       e.printStackTrace();
     }
   }
@@ -412,8 +418,7 @@ public abstract class GStructureChooser extends JPanel
       }
     });
 
-    JButton btn_cancel = new JButton(
-            MessageManager.getString("action.cancel"));
+    btn_cancel = new JButton(MessageManager.getString("action.cancel"));
     btn_cancel.setFont(VERDANA_12);
     btn_cancel.addActionListener(new ActionListener()
     {
@@ -567,22 +572,27 @@ public abstract class GStructureChooser extends JPanel
     lbl_pdbFile.setFont(VERDANA_10);
 
     lbl_chooseTempFacType.setFont(VERDANA_12);
-    lbl_chooseTempFacType.setText(new StringBuilder()
-            .append(MessageManager.getString("label.choose_tempfac_type"))
-            .append(" ").append(MessageManager.getString("label.optional"))
-            .toString());
+    lbl_chooseTempFacType.setText(
+            MessageManager.getString("label.interpret_tempfac_as"));
 
     combo_tempFacAs.setFont(VERDANA_12);
     for (TFType t : TFType.values())
     {
       combo_tempFacAs.addItem(t);
     }
+    combo_tempFacAs.addItemListener(new ItemListener()
+    {
+      @Override
+      public void itemStateChanged(ItemEvent e)
+      {
+        // used to determine if we should guess pLDDT or leave a user-choice
+        tempFacAsChanged = true;
+      }
+    });
 
     btn_paeMatrixFile.setFont(VERDANA_12);
-    btn_paeMatrixFile.setText(new StringBuilder()
-            .append(MessageManager.getString("label.add_pae_matrix_file"))
-            .append(" ").append(MessageManager.getString("label.optional"))
-            .toString());
+    btn_paeMatrixFile
+            .setText(MessageManager.getString("label.add_pae_matrix_file"));
     btn_paeMatrixFile.addActionListener(new ActionListener()
     {
       @Override
@@ -674,7 +684,7 @@ public abstract class GStructureChooser extends JPanel
 
     targetView.setVisible(false);
 
-    JPanel actionsPanel = new JPanel(new MigLayout());
+    actionsPanel = new JPanel(new MigLayout());
     actionsPanel.add(targetView, "left");
     actionsPanel.add(btn_add, "wrap");
     actionsPanel.add(chk_superpose, "left");
@@ -716,15 +726,23 @@ public abstract class GStructureChooser extends JPanel
     gbc.insets = new Insets(0, 0, 18, 0);
     pnl_fileOptions.add(lbl_pdbFile, gbc);
     gbc.gridy++;
+
     gbc.insets = new Insets(0, 0, 2, 0);
+    pnl_fileOptions.add(new JLabel(
+            MessageManager.getString("label.structure_import_options")),
+            gbc);
+    gbc.gridy++;
+
+    gbc.insets = new Insets(0, 0, 6, 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.insets = new Insets(0, 0, 2, 0);
+    gbc.insets = new Insets(0, 0, 6, 0);
     pnl_fileOptions.add(btn_paeMatrixFile, gbc);
     gbc.gridy++;
+    gbc.insets = new Insets(0, 0, 2, 0);
     gbc.weighty = 1.0;
     pnl_fileOptions.add(lbl_paeFile, gbc);
 
@@ -831,11 +849,11 @@ public abstract class GStructureChooser extends JPanel
 
   protected void closeAction(int preferredHeight)
   {
-    // System.out.println(">>>>>>>>>> closing internal frame!!!");
-    // System.out.println("width : " + mainFrame.getWidth());
-    // System.out.println("heigh : " + mainFrame.getHeight());
-    // System.out.println("x : " + mainFrame.getX());
-    // System.out.println("y : " + mainFrame.getY());
+    // jalview.bin.Console.outPrintln(">>>>>>>>>> closing internal frame!!!");
+    // jalview.bin.Console.outPrintln("width : " + mainFrame.getWidth());
+    // jalview.bin.Console.outPrintln("heigh : " + mainFrame.getHeight());
+    // jalview.bin.Console.outPrintln("x : " + mainFrame.getX());
+    // jalview.bin.Console.outPrintln("y : " + mainFrame.getY());
     tempUserPrefs.put("structureChooser.width", pnl_filter.getWidth());
     tempUserPrefs.put("structureChooser.height", preferredHeight);
     tempUserPrefs.put("structureChooser.x", mainFrame.getX());
@@ -1059,5 +1077,6 @@ public abstract class GStructureChooser extends JPanel
     lbl_chooseTempFacType.setEnabled(b);
     combo_tempFacAs.setEnabled(b);
     btn_paeMatrixFile.setEnabled(b);
+    lbl_paeFile.setEnabled(b);
   }
 }