From: tcofoegbu Date: Thu, 22 Oct 2015 15:14:58 +0000 (+0100) Subject: JAL-1479 implemented preferences for SIFTs / Needleman & Wunsch selection in structur... X-Git-Tag: Release_2_10_0~341^2~11 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=19bbc80d7f0f26dfe749850b7f5acf31b98bd840;p=jalview.git JAL-1479 implemented preferences for SIFTs / Needleman & Wunsch selection in structures preference tab --- diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index 54370d8..e576678 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -1279,3 +1279,6 @@ exception.pdb_rest_service_no_longer_available = PDB rest services no longer ava exception.resource_not_be_found = The requested resource could not be found exception.pdb_server_error = There seems to be an error from the PDB server exception.pdb_server_unreachable = Jalview is unable to reach the PDBe Solr server. \nPlease ensure that you are connected to the internet and try again. +label.nw_mapping = Needleman & Wunsch Alignment +label.sifts_mapping = SIFTs Mapping +label.mapping_method = Sequence \u27f7 Structure mapping method \ No newline at end of file diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index 5cb6512..885a62f 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -313,6 +313,15 @@ public class Preferences extends GPreferences } }); + if (Cache.getDefault("MAP_WITH_SIFTS", false)) + { + siftsMapping.setSelected(true); + } + else + { + nwMapping.setSelected(true); + } + /* * Set Connections tab defaults */ @@ -384,6 +393,7 @@ public class Preferences extends GPreferences * * @param e */ + @Override public void ok_actionPerformed(ActionEvent e) { if (!validateSettings()) @@ -492,6 +502,8 @@ public class Preferences extends GPreferences Cache.applicationProperties.setProperty(STRUCTURE_DISPLAY, structViewer .getSelectedItem().toString()); Cache.setOrRemove(CHIMERA_PATH, chimeraPath.getText()); + Cache.applicationProperties.setProperty("MAP_WITH_SIFTS", + Boolean.toString(siftsMapping.isSelected())); /* * Save Output settings @@ -647,6 +659,7 @@ public class Preferences extends GPreferences /** * DOCUMENT ME! */ + @Override public void startupFileTextfield_mouseClicked() { JalviewFileChooser chooser = new JalviewFileChooser( @@ -676,6 +689,7 @@ public class Preferences extends GPreferences * @param e * DOCUMENT ME! */ + @Override public void cancel_actionPerformed(ActionEvent e) { try @@ -694,6 +708,7 @@ public class Preferences extends GPreferences * @param e * DOCUMENT ME! */ + @Override public void annotations_actionPerformed(ActionEvent e) { conservation.setEnabled(annotations.isSelected()); @@ -707,6 +722,7 @@ public class Preferences extends GPreferences && (identity.isSelected() || showGroupConsensus.isSelected())); } + @Override public void newLink_actionPerformed(ActionEvent e) { @@ -733,6 +749,7 @@ public class Preferences extends GPreferences } } + @Override public void editLink_actionPerformed(ActionEvent e) { GSequenceLink link = new GSequenceLink(); @@ -774,6 +791,7 @@ public class Preferences extends GPreferences } } + @Override public void deleteLink_actionPerformed(ActionEvent e) { int index = linkNameList.getSelectedIndex(); @@ -796,6 +814,7 @@ public class Preferences extends GPreferences linkURLList.setListData(urlLinks); } + @Override public void defaultBrowser_mouseClicked(MouseEvent e) { JFileChooser chooser = new JFileChooser("."); @@ -818,6 +837,7 @@ public class Preferences extends GPreferences * jalview.jbgui.GPreferences#showunconserved_actionPerformed(java.awt.event * .ActionEvent) */ + @Override protected void showunconserved_actionPerformed(ActionEvent e) { // TODO Auto-generated method stub diff --git a/src/jalview/jbgui/GPreferences.java b/src/jalview/jbgui/GPreferences.java index b12355a..b5c1804 100755 --- a/src/jalview/jbgui/GPreferences.java +++ b/src/jalview/jbgui/GPreferences.java @@ -44,6 +44,7 @@ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.BorderFactory; +import javax.swing.ButtonGroup; import javax.swing.DefaultListCellRenderer; import javax.swing.JButton; import javax.swing.JCheckBox; @@ -52,6 +53,7 @@ import javax.swing.JFileChooser; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; +import javax.swing.JRadioButton; import javax.swing.JScrollPane; import javax.swing.JTabbedPane; import javax.swing.JTextField; @@ -156,6 +158,12 @@ public class GPreferences extends JPanel protected JTextField chimeraPath = new JTextField(); + protected ButtonGroup mappingMethod = new ButtonGroup(); + + protected JRadioButton siftsMapping = new JRadioButton(); + + protected JRadioButton nwMapping = new JRadioButton(); + /* * Colours tab components */ @@ -509,6 +517,7 @@ public class GPreferences extends JPanel newLink.setText(MessageManager.getString("action.new")); newLink.addActionListener(new java.awt.event.ActionListener() { + @Override public void actionPerformed(ActionEvent e) { newLink_actionPerformed(e); @@ -518,6 +527,7 @@ public class GPreferences extends JPanel editLink.setText(MessageManager.getString("action.edit")); editLink.addActionListener(new java.awt.event.ActionListener() { + @Override public void actionPerformed(ActionEvent e) { editLink_actionPerformed(e); @@ -527,6 +537,7 @@ public class GPreferences extends JPanel deleteLink.setText(MessageManager.getString("action.delete")); deleteLink.addActionListener(new java.awt.event.ActionListener() { + @Override public void actionPerformed(ActionEvent e) { deleteLink_actionPerformed(e); @@ -535,6 +546,7 @@ public class GPreferences extends JPanel linkURLList.addListSelectionListener(new ListSelectionListener() { + @Override public void valueChanged(ListSelectionEvent e) { int index = linkURLList.getSelectedIndex(); @@ -544,6 +556,7 @@ public class GPreferences extends JPanel linkNameList.addListSelectionListener(new ListSelectionListener() { + @Override public void valueChanged(ListSelectionEvent e) { int index = linkNameList.getSelectedIndex(); @@ -571,6 +584,7 @@ public class GPreferences extends JPanel defaultBrowser.addMouseListener(new MouseAdapter() { + @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() > 1) @@ -585,6 +599,7 @@ public class GPreferences extends JPanel useProxy.setText(MessageManager.getString("label.use_proxy_server")); useProxy.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { useProxy_actionPerformed(); @@ -653,6 +668,7 @@ public class GPreferences extends JPanel ok.setText(MessageManager.getString("action.ok")); ok.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { ok_actionPerformed(e); @@ -662,6 +678,7 @@ public class GPreferences extends JPanel cancel.setText(MessageManager.getString("action.cancel")); cancel.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { cancel_actionPerformed(e); @@ -693,6 +710,7 @@ public class GPreferences extends JPanel minColour.setPreferredSize(new Dimension(40, 20)); minColour.addMouseListener(new MouseAdapter() { + @Override public void mousePressed(MouseEvent e) { minColour_actionPerformed(minColour); @@ -707,6 +725,7 @@ public class GPreferences extends JPanel maxColour.setPreferredSize(new Dimension(40, 20)); maxColour.addMouseListener(new MouseAdapter() { + @Override public void mousePressed(MouseEvent e) { maxColour_actionPerformed(maxColour); @@ -764,7 +783,7 @@ public class GPreferences extends JPanel final int width = 400; final int height = 22; final int lineSpacing = 25; - int ypos = 30; + int ypos = 15; structFromPdb.setFont(LABEL_FONT); structFromPdb @@ -859,13 +878,30 @@ public class GPreferences extends JPanel structureTab.add(chimeraPath); ypos += lineSpacing; - // scrl_pdbDocFieldConfig.setPreferredSize(new Dimension(450, 100)); - // scrl_pdbDocFieldConfig - // .setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - // scrl_pdbDocFieldConfig.setBounds(); + nwMapping.setFont(LABEL_FONT); + nwMapping.setText(MessageManager.getString("label.nw_mapping")); + siftsMapping.setFont(LABEL_FONT); + siftsMapping.setText(MessageManager.getString("label.sifts_mapping")); + mappingMethod.add(nwMapping); + mappingMethod.add(siftsMapping); + JPanel mappingPanel = new JPanel(); + mappingPanel.setFont(LABEL_FONT); + TitledBorder mmTitledBorder = new TitledBorder( + MessageManager.getString("label.mapping_method")); + mmTitledBorder.setTitleFont(LABEL_FONT); + mappingPanel.setBorder(mmTitledBorder); + mappingPanel.setBounds(new Rectangle(10, ypos, 452, 45)); + // GridLayout mappingLayout = new GridLayout(); + mappingPanel.setLayout(new GridLayout()); + mappingPanel.add(nwMapping); + mappingPanel.add(siftsMapping); + structureTab.add(mappingPanel); + + ypos += lineSpacing; + ypos += lineSpacing; PDBDocFieldPreferences docFieldPref = new PDBDocFieldPreferences( PreferenceSource.PREFERENCES); - docFieldPref.setBounds(new Rectangle(10, ypos + 5, 450, 120)); + docFieldPref.setBounds(new Rectangle(10, ypos, 450, 120)); structureTab.add(docFieldPref); return structureTab; @@ -1018,6 +1054,7 @@ public class GPreferences extends JPanel annotations.setBounds(new Rectangle(169, 12, 200, 23)); annotations.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { annotations_actionPerformed(e); @@ -1025,6 +1062,7 @@ public class GPreferences extends JPanel }); identity.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { annotations_actionPerformed(e); @@ -1032,6 +1070,7 @@ public class GPreferences extends JPanel }); showGroupConsensus.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { annotations_actionPerformed(e); @@ -1045,6 +1084,7 @@ public class GPreferences extends JPanel .getString("action.show_unconserved")); showUnconserved.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { showunconserved_actionPerformed(e); @@ -1112,6 +1152,7 @@ public class GPreferences extends JPanel startupFileTextfield.setBounds(new Rectangle(172, 310, 330, 20)); startupFileTextfield.addMouseListener(new MouseAdapter() { + @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() > 1)