X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fjbgui%2FGStructureChooser.java;h=5b04359db6e2c0f0f5c0a62f2f5201652a354255;hb=3a6dc40b8dd1b8d811fd4c70f4145e6e6102c9c8;hp=0c5af9558191c1d3339bf815d45adfbf51a126bb;hpb=282aa9129a74235dc8d6c22b123d51eb1abd2f55;p=jalview.git diff --git a/src/jalview/jbgui/GStructureChooser.java b/src/jalview/jbgui/GStructureChooser.java index 0c5af95..5b04359 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; @@ -73,6 +75,8 @@ import jalview.gui.AlignmentPanel; import jalview.gui.Desktop; import jalview.gui.JvSwingUtils; import jalview.gui.StructureViewer; +import jalview.structure.StructureImportSettings; +import jalview.structure.StructureImportSettings.TFType; import jalview.util.MessageManager; import jalview.util.Platform; import net.miginfocom.swing.MigLayout; @@ -89,6 +93,8 @@ public abstract class GStructureChooser extends JPanel { private static final Font VERDANA_12 = new Font("Verdana", 0, 12); + private static final Font VERDANA_10 = new Font("Verdana", 0, 10); + public static final String VIEWS_FILTER = "VIEWS_FILTER"; protected static final String VIEWS_FROM_FILE = "VIEWS_FROM_FILE"; @@ -100,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(); @@ -115,12 +123,26 @@ public abstract class GStructureChooser extends JPanel protected StringBuilder errorWarning = new StringBuilder(); + protected JButton btn_cancel; + protected JButton btn_add; protected JButton btn_newView; protected JButton btn_pdbFromFile = new JButton(); + protected JLabel lbl_pdbFile = new JLabel(); + + protected JLabel lbl_chooseTempFacType = new JLabel(); + + protected JComboBox combo_tempFacAs = new JComboBox<>(); + + protected boolean tempFacAsChanged = false; + + protected JButton btn_paeMatrixFile = new JButton(); + + protected JLabel lbl_paeFile = new JLabel(); + // holder for icon and button protected JPanel pnl_queryTDB; @@ -158,7 +180,7 @@ public abstract class GStructureChooser extends JPanel protected JLabel lbl_pdbManualFetchStatus = new JLabel(errorImage); - protected JLabel lbl_fromFileStatus = new JLabel(errorImage); + // protected JLabel lbl_fromFileStatus = new JLabel(errorImage); protected AssociateSeqPanel idInputAssSeqPanel = new AssociateSeqPanel(); @@ -267,12 +289,13 @@ public abstract class GStructureChooser extends JPanel try { jbInit(); + mainFrame.setFrameIcon(null); mainFrame.setVisible(false); mainFrame.invalidate(); mainFrame.pack(); } catch (Exception e) { - System.out.println(e); // for JavaScript TypeError + jalview.bin.Console.outPrintln(e); // for JavaScript TypeError e.printStackTrace(); } } @@ -395,10 +418,9 @@ 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 java.awt.event.ActionListener() + btn_cancel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) @@ -479,7 +501,7 @@ public abstract class GStructureChooser extends JPanel MessageManager.formatMessage("action.new_structure_view_with", StructureViewer.getViewerType().toString())); btn_newView.setFont(VERDANA_12); - btn_newView.addActionListener(new java.awt.event.ActionListener() + btn_newView.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) @@ -504,7 +526,7 @@ public abstract class GStructureChooser extends JPanel btn_add = new JButton(MessageManager.getString("action.add")); btn_add.setFont(VERDANA_12); - btn_add.addActionListener(new java.awt.event.ActionListener() + btn_add.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) @@ -527,7 +549,7 @@ public abstract class GStructureChooser extends JPanel btn_pdbFromFile.setFont(VERDANA_12); String btn_title = MessageManager.getString("label.select_pdb_file"); btn_pdbFromFile.setText(btn_title + " "); - btn_pdbFromFile.addActionListener(new java.awt.event.ActionListener() + btn_pdbFromFile.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) @@ -546,6 +568,51 @@ public abstract class GStructureChooser extends JPanel } } }); + lbl_pdbFile.setFont(VERDANA_10); + lbl_pdbFile.setFont(VERDANA_10); + + lbl_chooseTempFacType.setFont(VERDANA_12); + 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(MessageManager.getString("label.add_pae_matrix_file")); + btn_paeMatrixFile.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + paeMatrixFile_actionPerformed(); + } + }); + btn_paeMatrixFile.addKeyListener(new KeyAdapter() + { + @Override + public void keyPressed(KeyEvent evt) + { + if (evt.getKeyCode() == KeyEvent.VK_ENTER) + { + paeMatrixFile_actionPerformed(); + } + } + }); + lbl_paeFile.setFont(VERDANA_10); JScrollPane scrl_foundStructures = new JScrollPane(tbl_summary); scrl_foundStructures.setPreferredSize(new Dimension(width, height)); @@ -600,14 +667,11 @@ public abstract class GStructureChooser extends JPanel if (Platform.isMac()) { // needed to make icon button have round corners in vaqua - btn_queryTDB.putClientProperty("JButton.buttonType","bevel"); - btn_queryTDB.setMargin(new Insets(0, 16, 0, 20)); - } - else - { - btn_queryTDB.setMargin(new Insets(2, 16, 2, 20)); + btn_queryTDB.putClientProperty("JButton.buttonType", "bevel"); } - btn_queryTDB.setText(MessageManager.getString("label.search_3dbeacons")); + btn_queryTDB.setMargin(new Insets(0, 16, 0, 20)); + btn_queryTDB + .setText(MessageManager.getString("label.search_3dbeacons")); btn_queryTDB.setIconTextGap(12); btn_queryTDB.setIcon(tdbImage); btn_queryTDB.setVerticalTextPosition(SwingConstants.CENTER); @@ -620,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"); @@ -642,12 +706,49 @@ public abstract class GStructureChooser extends JPanel pnl_main.add(pnl_controls, BorderLayout.CENTER); lbl_loading.setVisible(false); - JPanel pnl_fileChooser = new JPanel(new FlowLayout()); - pnl_fileChooser.add(btn_pdbFromFile); - pnl_fileChooser.add(lbl_fromFileStatus); + // JPanel pnl_fileChooser = new JPanel(new FlowLayout()); + // pnl_fileChooser.add(btn_pdbFromFile); + // pnl_fileChooser.add(lbl_fromFileStatus); + + 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, 2, 0); + gbc.fill = GridBagConstraints.NONE; + gbc.anchor = GridBagConstraints.FIRST_LINE_START; + // pnl_fileOptions.add(pnl_fileChooser, gbc); + pnl_fileOptions.add(btn_pdbFromFile, gbc); + gbc.gridy++; + 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, 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); + JPanel pnl_fileChooserBL = new JPanel(new BorderLayout()); - pnl_fileChooserBL.add(fileChooserAssSeqPanel, BorderLayout.NORTH); - pnl_fileChooserBL.add(pnl_fileChooser, BorderLayout.CENTER); + pnl_fileChooserBL.add(fileChooserAssSeqPanel, BorderLayout.PAGE_START); + pnl_fileChooserBL.add(pnl_fileOptions, BorderLayout.CENTER); JPanel pnl_idInput = new JPanel(new FlowLayout()); pnl_idInput.add(txt_search); @@ -748,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()); @@ -952,6 +1053,8 @@ public abstract class GStructureChooser extends JPanel protected abstract void pdbFromFile_actionPerformed(); + protected abstract void paeMatrixFile_actionPerformed(); + protected abstract void txt_search_ActionPerformed(); protected abstract void populateCmbAssociateSeqOptions( @@ -968,4 +1071,12 @@ 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); + lbl_paeFile.setEnabled(b); + } }