X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fjbgui%2FGPreferences.java;h=8a6e8ae3bcc2619b7b24652f25b3b689213a9fd8;hb=c794c5033adeee182b03a5ea92c0a7495a29661f;hp=5685e844bb8bd7220f1a7ec1e1c3996f8f458fa5;hpb=e0eedaf4fedaaa46439f40226637376c8eb268be;p=jalview.git diff --git a/src/jalview/jbgui/GPreferences.java b/src/jalview/jbgui/GPreferences.java index 5685e84..8a6e8ae 100755 --- a/src/jalview/jbgui/GPreferences.java +++ b/src/jalview/jbgui/GPreferences.java @@ -34,6 +34,7 @@ import jalview.io.BackupFiles; import jalview.io.BackupFilesPresetEntry; import jalview.io.IntKeyStringValueEntry; import jalview.util.MessageManager; +import jalview.util.Platform; import java.awt.BorderLayout; import java.awt.Color; @@ -48,19 +49,23 @@ import java.awt.Insets; import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.awt.event.FocusEvent; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.util.Arrays; +import java.util.List; +import javax.swing.AbstractButton; import javax.swing.AbstractCellEditor; import javax.swing.BorderFactory; +import javax.swing.BoxLayout; import javax.swing.ButtonGroup; import javax.swing.DefaultListCellRenderer; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JComboBox; +import javax.swing.JComponent; import javax.swing.JFileChooser; import javax.swing.JLabel; import javax.swing.JPanel; @@ -84,6 +89,8 @@ import javax.swing.event.ChangeListener; import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellRenderer; +import net.miginfocom.swing.MigLayout; + /** * Base class for the Preferences panel. * @@ -158,10 +165,15 @@ public class GPreferences extends JPanel protected JCheckBox showConsensLogo = new JCheckBox(); + protected JCheckBox showInformationHistogram = new JCheckBox(); + + protected JCheckBox showHMMLogo = new JCheckBox(); + protected JCheckBox showDbRefTooltip = new JCheckBox(); protected JCheckBox showNpTooltip = new JCheckBox(); + /* * Structure tab and components */ @@ -247,6 +259,10 @@ public class GPreferences extends JPanel */ protected JComboBox epsRendering = new JComboBox<>(); + protected JComboBox htmlRendering = new JComboBox<>(); + + protected JComboBox svgRendering = new JComboBox<>(); + protected JLabel userIdWidthlabel = new JLabel(); protected JCheckBox autoIdWidth = new JCheckBox(); @@ -281,6 +297,23 @@ public class GPreferences extends JPanel protected JCheckBox sortByTree = new JCheckBox(); /* + * hmmer tab and components + */ + protected JPanel hmmerTab; + + protected JCheckBox hmmrTrimTermini; + + protected AbstractButton hmmerBackgroundUniprot; + + protected AbstractButton hmmerBackgroundAlignment; + + protected JTextField hmmerSequenceCount; + + protected JTextField hmmerPath; + + protected JTextField cygwinPath; + + /* * Web Services tab */ protected JPanel wsTab = new JPanel(); @@ -301,7 +334,7 @@ public class GPreferences extends JPanel protected JButton revertButton = new JButton(); - protected JComboBox backupfilesPresetsCombo = new JComboBox<>(); + protected JComboBox backupfilesPresetsCombo = new JComboBox<>(); private int backupfilesPresetsComboLastSelected = 0; @@ -373,8 +406,11 @@ public class GPreferences extends JPanel tabbedPane.add(initConnectionsTab(), MessageManager.getString("label.connections")); - tabbedPane.add(initBackupsTab(), - MessageManager.getString("label.backups")); + if (!Platform.isJS()) + { + tabbedPane.add(initBackupsTab(), + MessageManager.getString("label.backups")); + } tabbedPane.add(initLinksTab(), MessageManager.getString("label.urllinks")); @@ -385,15 +421,20 @@ public class GPreferences extends JPanel tabbedPane.add(initEditingTab(), MessageManager.getString("label.editing")); + tabbedPane.add(initHMMERTab(), MessageManager.getString("label.hmmer")); + /* * See WsPreferences for the real work of configuring this tab. */ - wsTab.setLayout(new BorderLayout()); - tabbedPane.add(wsTab, MessageManager.getString("label.web_services")); + if (!Platform.isJS()) + { + wsTab.setLayout(new BorderLayout()); + tabbedPane.add(wsTab, MessageManager.getString("label.web_services")); + } /* * Handler to validate a tab before leaving it - currently only for - * Structure. + * Structure */ tabbedPane.addChangeListener(new ChangeListener() { @@ -447,6 +488,134 @@ public class GPreferences extends JPanel } /** + * Initialises the hmmer tabbed panel + * + * @return + */ + private JPanel initHMMERTab() + { + hmmerTab = new JPanel(); + hmmerTab.setLayout(new BoxLayout(hmmerTab, BoxLayout.Y_AXIS)); + hmmerTab.setLayout(new MigLayout("flowy")); + + /* + * path to hmmer binaries folder + */ + JPanel installationPanel = new JPanel(new MigLayout("flowy")); + // new FlowLayout(FlowLayout.LEFT)); + JvSwingUtils.createTitledBorder(installationPanel, + MessageManager.getString("label.installation"), true); + hmmerTab.add(installationPanel); + JLabel hmmerLocation = new JLabel( + MessageManager.getString("label.hmmer_location")); + hmmerLocation.setFont(LABEL_FONT); + final int pathFieldLength = 40; + hmmerPath = new JTextField(pathFieldLength); + hmmerPath.addMouseListener(new MouseAdapter() + { + @Override + public void mouseClicked(MouseEvent e) + { + if (e.getClickCount() == 2) + { + String chosen = openFileChooser(true); + if (chosen != null) + { + hmmerPath.setText(chosen); + validateHmmerPath(); + } + } + } + }); + installationPanel.add(hmmerLocation); + installationPanel.add(hmmerPath); + + /* + * path to Cygwin binaries folder (for Windows) + */ + if (Platform.isWindowsAndNotJS()) + { + JLabel cygwinLocation = new JLabel( + MessageManager.getString("label.cygwin_location")); + cygwinLocation.setFont(LABEL_FONT); + cygwinPath = new JTextField(pathFieldLength); + cygwinPath.addMouseListener(new MouseAdapter() + { + @Override + public void mouseClicked(MouseEvent e) + { + if (e.getClickCount() == 2) + { + String chosen = openFileChooser(true); + if (chosen != null) + { + cygwinPath.setText(chosen); + validateCygwinPath(); + } + } + } + }); + installationPanel.add(cygwinLocation); + installationPanel.add(cygwinPath); + } + + /* + * preferences for hmmalign + */ + JPanel alignOptionsPanel = new JPanel(new MigLayout()); + // new FlowLayout(FlowLayout.LEFT)); + JvSwingUtils.createTitledBorder(alignOptionsPanel, + MessageManager.getString("label.hmmalign_options"), true); + hmmerTab.add(alignOptionsPanel); + hmmrTrimTermini = new JCheckBox(); + hmmrTrimTermini.setFont(LABEL_FONT); + hmmrTrimTermini.setText(MessageManager.getString("label.trim_termini")); + alignOptionsPanel.add(hmmrTrimTermini); + + /* + * preferences for hmmsearch + */ + JPanel searchOptions = new JPanel(new MigLayout()); + // FlowLayout(FlowLayout.LEFT)); + JvSwingUtils.createTitledBorder(searchOptions, + MessageManager.getString("label.hmmsearch_options"), true); + hmmerTab.add(searchOptions); + JLabel sequencesToKeep = new JLabel( + MessageManager.getString("label.no_of_sequences")); + sequencesToKeep.setFont(LABEL_FONT); + searchOptions.add(sequencesToKeep); + hmmerSequenceCount = new JTextField(5); + searchOptions.add(hmmerSequenceCount); + + /* + * preferences for Information Content annotation + */ + // JPanel dummy = new JPanel(new FlowLayout(FlowLayout.LEFT)); + JPanel annotationOptions = new JPanel(new MigLayout("left")); + JvSwingUtils.createTitledBorder(annotationOptions, + MessageManager.getString("label.information_annotation"), true); + // dummy.add(annotationOptions); + hmmerTab.add(annotationOptions); + ButtonGroup backgroundOptions = new ButtonGroup(); + hmmerBackgroundUniprot = new JRadioButton( + MessageManager.getString("label.freq_uniprot")); + hmmerBackgroundUniprot.setFont(LABEL_FONT); + hmmerBackgroundAlignment = new JRadioButton( + MessageManager.getString("label.freq_alignment")); + hmmerBackgroundAlignment.setFont(LABEL_FONT); + backgroundOptions.add(hmmerBackgroundUniprot); + backgroundOptions.add(hmmerBackgroundAlignment); + backgroundOptions.setSelected(hmmerBackgroundUniprot.getModel(), true); + // disable buttons for now as annotation only uses Uniprot background + hmmerBackgroundAlignment.setEnabled(false); + hmmerBackgroundUniprot.setEnabled(false); + annotationOptions.add(hmmerBackgroundUniprot, "wrap"); + annotationOptions.add(hmmerBackgroundAlignment); + + return hmmerTab; + } + + /** * Initialises the Output tabbed panel. * * @return @@ -455,18 +624,35 @@ public class GPreferences extends JPanel { JPanel outputTab = new JPanel(); outputTab.setLayout(null); - JLabel epsLabel = new JLabel(); + + JLabel epsLabel = new JLabel( + MessageManager.formatMessage("label.rendering_style", "EPS")); epsLabel.setFont(LABEL_FONT); epsLabel.setHorizontalAlignment(SwingConstants.RIGHT); - epsLabel.setText(MessageManager.getString("label.eps_rendering_style")); - epsLabel.setBounds(new Rectangle(9, 31, 140, 24)); + epsLabel.setBounds(new Rectangle(9, 31, 160, 24)); epsRendering.setFont(LABEL_FONT); - epsRendering.setBounds(new Rectangle(154, 34, 187, 21)); + epsRendering.setBounds(new Rectangle(174, 34, 187, 21)); + JLabel htmlLabel = new JLabel( + MessageManager.formatMessage("label.rendering_style", "HTML")); + htmlLabel.setFont(LABEL_FONT); + htmlLabel.setHorizontalAlignment(SwingConstants.RIGHT); + htmlLabel.setBounds(new Rectangle(9, 55, 160, 24)); + htmlRendering.setFont(LABEL_FONT); + htmlRendering.setBounds(new Rectangle(174, 58, 187, 21)); + JLabel svgLabel = new JLabel( + MessageManager.formatMessage("label.rendering_style", "SVG")); + svgLabel.setFont(LABEL_FONT); + svgLabel.setHorizontalAlignment(SwingConstants.RIGHT); + svgLabel.setBounds(new Rectangle(9, 79, 160, 24)); + svgRendering.setFont(LABEL_FONT); + svgRendering.setBounds(new Rectangle(174, 82, 187, 21)); + JLabel jLabel1 = new JLabel(); jLabel1.setFont(LABEL_FONT); jLabel1.setHorizontalAlignment(SwingConstants.CENTER); jLabel1.setText(MessageManager.getString("label.append_start_end")); jLabel1.setFont(LABEL_FONT); + fastajv.setFont(LABEL_FONT); fastajv.setHorizontalAlignment(SwingConstants.LEFT); clustaljv.setText(MessageManager.getString("label.clustal") + " "); @@ -483,7 +669,7 @@ public class GPreferences extends JPanel TitledBorder titledBorder2 = new TitledBorder( MessageManager.getString("label.file_output")); jPanel11.setBorder(titledBorder2); - jPanel11.setBounds(new Rectangle(30, 72, 196, 182)); + jPanel11.setBounds(new Rectangle(30, 120, 196, 182)); GridLayout gridLayout3 = new GridLayout(); jPanel11.setLayout(gridLayout3); gridLayout3.setRows(8); @@ -502,7 +688,7 @@ public class GPreferences extends JPanel MessageManager.getString("label.automatically_set_id_width")); autoIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager .getString("label.adjusts_width_generated_eps_png"))); - autoIdWidth.setBounds(new Rectangle(228, 96, 188, 23)); + autoIdWidth.setBounds(new Rectangle(228, 144, 320, 23)); autoIdWidth.addActionListener(new ActionListener() { @@ -520,10 +706,10 @@ public class GPreferences extends JPanel userIdWidthlabel.setToolTipText( JvSwingUtils.wrapTooltip(true, MessageManager.getString( "label.manually_specify_width_left_column"))); - userIdWidthlabel.setBounds(new Rectangle(236, 120, 168, 23)); + userIdWidthlabel.setBounds(new Rectangle(236, 168, 320, 23)); userIdWidth.setFont(JvSwingUtils.getTextAreaFont()); userIdWidth.setText(""); - userIdWidth.setBounds(new Rectangle(232, 144, 84, 23)); + userIdWidth.setBounds(new Rectangle(232, 192, 84, 23)); userIdWidth.addActionListener(new ActionListener() { @@ -536,10 +722,10 @@ public class GPreferences extends JPanel modellerOutput.setFont(LABEL_FONT); modellerOutput .setText(MessageManager.getString("label.use_modeller_output")); - modellerOutput.setBounds(new Rectangle(228, 226, 168, 23)); + modellerOutput.setBounds(new Rectangle(228, 274, 320, 23)); embbedBioJSON.setFont(LABEL_FONT); embbedBioJSON.setText(MessageManager.getString("label.embbed_biojson")); - embbedBioJSON.setBounds(new Rectangle(228, 200, 250, 23)); + embbedBioJSON.setBounds(new Rectangle(228, 248, 250, 23)); jPanel11.add(jLabel1); jPanel11.add(blcjv); @@ -553,9 +739,19 @@ public class GPreferences extends JPanel outputTab.add(userIdWidth); outputTab.add(userIdWidthlabel); outputTab.add(modellerOutput); - outputTab.add(embbedBioJSON); - outputTab.add(epsLabel); - outputTab.add(epsRendering); + if (!Platform.isJS()) + { + /* + * JalviewJS doesn't support Lineart option or SVG output + */ + outputTab.add(embbedBioJSON); + outputTab.add(epsLabel); + outputTab.add(epsRendering); + outputTab.add(htmlLabel); + outputTab.add(htmlRendering); + outputTab.add(svgLabel); + outputTab.add(svgRendering); + } outputTab.add(jPanel11); return outputTab; } @@ -627,6 +823,8 @@ public class GPreferences extends JPanel GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 2, 5, 5), 70, 1)); + versioncheck.setVisible(false); + // Add padding so the panel doesn't look ridiculous JPanel spacePanel = new JPanel(); connectTab.add(spacePanel, @@ -1002,7 +1200,7 @@ public class GPreferences extends JPanel protColourLabel.setHorizontalAlignment(SwingConstants.LEFT); protColourLabel.setText( MessageManager.getString("label.prot_alignment_colour") + " "); - JvSwingUtils.addtoLayout(coloursTab, + GPreferences.addtoLayout(coloursTab, MessageManager .getString("label.default_colour_scheme_for_alignment"), protColourLabel, protColour); @@ -1014,7 +1212,7 @@ public class GPreferences extends JPanel nucColourLabel.setHorizontalAlignment(SwingConstants.LEFT); nucColourLabel.setText( MessageManager.getString("label.nuc_alignment_colour") + " "); - JvSwingUtils.addtoLayout(coloursTab, + GPreferences.addtoLayout(coloursTab, MessageManager .getString("label.default_colour_scheme_for_alignment"), nucColourLabel, nucColour); @@ -1023,11 +1221,11 @@ public class GPreferences extends JPanel annotationShding.setBorder(new TitledBorder( MessageManager.getString("label.annotation_shading_default"))); annotationShding.setLayout(new GridLayout(1, 2)); - JvSwingUtils.addtoLayout(annotationShding, + GPreferences.addtoLayout(annotationShding, MessageManager.getString( "label.default_minimum_colour_annotation_shading"), mincolourLabel, minColour); - JvSwingUtils.addtoLayout(annotationShding, + GPreferences.addtoLayout(annotationShding, MessageManager.getString( "label.default_maximum_colour_annotation_shading"), maxcolourLabel, maxColour); @@ -1278,7 +1476,7 @@ public class GPreferences extends JPanel { if (e.getClickCount() == 2) { - String chosen = openFileChooser(); + String chosen = openFileChooser(false); if (chosen != null) { chimeraPath.setText(chosen); @@ -1315,6 +1513,17 @@ public class GPreferences extends JPanel docFieldPref.setBounds(new Rectangle(10, ypos, 450, 120)); structureTab.add(docFieldPref); + /* + * hide Chimera options in JalviewJS + */ + if (Platform.isJS()) + { + pathLabel.setVisible(false); + chimeraPath.setVisible(false); + viewerLabel.setVisible(false); + structViewer.setVisible(false); + } + return structureTab; } @@ -1333,10 +1542,14 @@ public class GPreferences extends JPanel * * @return */ - protected String openFileChooser() + protected String openFileChooser(boolean forFolder) { String choice = null; JFileChooser chooser = new JFileChooser(); + if (forFolder) + { + chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + } // chooser.setFileView(new JalviewFileView()); chooser.setDialogTitle( @@ -1352,21 +1565,6 @@ public class GPreferences extends JPanel return choice; } - /** - * Validate the structure tab preferences; if invalid, set focus on this tab. - * - * @param e - */ - protected boolean validateStructure(FocusEvent e) - { - if (!validateStructure()) - { - e.getComponent().requestFocusInWindow(); - return false; - } - return true; - } - protected boolean validateStructure() { return false; @@ -1691,6 +1889,13 @@ public class GPreferences extends JPanel visualTab.add(fontNameCB); visualTab.add(fontSizeCB); visualTab.add(fontStyleCB); + + if (Platform.isJS()) + { + startupCheckbox.setVisible(false); + startupFileTextfield.setVisible(false); + } + return visualTab; } @@ -1703,7 +1908,7 @@ public class GPreferences extends JPanel BackupFilesPresetEntry savedPreset = BackupFilesPresetEntry .getSavedBackupEntry(); enableBackupFiles - .setSelected(Cache.getDefault(BackupFiles.ENABLED, true)); + .setSelected(Cache.getDefault(BackupFiles.ENABLED, !Platform.isJS())); BackupFilesPresetEntry backupfilesCustomEntry = BackupFilesPresetEntry .createBackupFilesPresetEntry(Cache @@ -1720,27 +1925,13 @@ public class GPreferences extends JPanel setComboIntStringKey(backupfilesPresetsCombo, Cache.getDefault(BackupFiles.NS + "_PRESET", BackupFilesPresetEntry.BACKUPFILESSCHEMEDEFAULT)); - // backupsTabUpdatePresets(); - System.out - .println("LOADLASTSAVEDBACKUPSOPTIONS SETTING BACKUPS OPTIONS"); backupsSetOptions(savedPreset); backupsOptionsSetEnabled(); updateBackupFilesExampleLabel(); } - private void setBackupfilesCustomPreset() - { - if (customiseCheckbox.isSelected() && getComboIntStringKey( - backupfilesPresetsCombo) == BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM) - { - BackupFilesPresetEntry.backupfilesPresetEntriesValues - .put(BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM, - getBackupfilesCurrentEntry()); - } - } - private boolean warnAboutSuffixReverseChange() { BackupFilesPresetEntry bfpe = BackupFilesPresetEntry @@ -1867,11 +2058,19 @@ public class GPreferences extends JPanel presetsComboLabel = new JLabel(title + ":"); presetsPanel.add(presetsComboLabel, gbc); + List entries = Arrays + .asList((Object[]) BackupFilesPresetEntry.backupfilesPresetEntries); + List tooltips = Arrays.asList( + BackupFilesPresetEntry.backupfilesPresetEntryDescriptions); + backupfilesPresetsCombo = JvSwingUtils.buildComboWithTooltips(entries, + tooltips); + /* for (int i = 0; i < BackupFilesPresetEntry.backupfilesPresetEntries.length; i++) { backupfilesPresetsCombo .addItem(BackupFilesPresetEntry.backupfilesPresetEntries[i]); } + */ backupfilesPresetsCombo.addActionListener(new ActionListener() { @@ -1910,6 +2109,8 @@ public class GPreferences extends JPanel presetsPanel.add(backupfilesPresetsCombo, gbc); revertButton.setText(MessageManager.getString("label.cancel_changes")); + revertButton.setToolTipText( + MessageManager.getString("label.cancel_changes_description")); revertButton.addActionListener(new ActionListener() { @Override @@ -1947,6 +2148,8 @@ public class GPreferences extends JPanel backupfilesCustomOptionsSetEnabled(); } }); + customiseCheckbox.setToolTipText( + MessageManager.getString("label.customise_description")); // customise checkbox gbc.gridx = 0; @@ -1963,7 +2166,7 @@ public class GPreferences extends JPanel private JPanel initBackupsTabFilenameExamplesPanel() { String title = MessageManager - .getString("label.summary_of_backups_scheme"); + .getString("label.scheme_examples"); TitledBorder tb = new TitledBorder(title); exampleFilesPanel.setBorder(tb); exampleFilesPanel.setLayout(new GridBagLayout()); @@ -1989,8 +2192,8 @@ public class GPreferences extends JPanel { IntKeyStringValueEntry entry = (IntKeyStringValueEntry) backupfilesPresetsCombo .getSelectedItem(); - int key = entry.getKey(); - String value = entry.getValue(); + int key = entry.k; + String value = entry.v; if (BackupFilesPresetEntry.backupfilesPresetEntriesValues .containsKey(key)) @@ -2001,7 +2204,7 @@ public class GPreferences extends JPanel } else { - System.out.println( + Cache.log.error( "Preset '" + value + "' [key:" + key + "] not implemented"); } @@ -2011,21 +2214,42 @@ public class GPreferences extends JPanel updateBackupFilesExampleLabel(); } - protected int getComboIntStringKey(JComboBox c) + protected int getComboIntStringKey( + JComboBox backupfilesPresetsCombo2) { - IntKeyStringValueEntry e = (IntKeyStringValueEntry) c.getSelectedItem(); - return e != null ? e.getKey() : 0; + IntKeyStringValueEntry e; + try + { + e = (IntKeyStringValueEntry) backupfilesPresetsCombo2 + .getSelectedItem(); + } catch (Exception ex) + { + Cache.log.error( + "Problem casting Combo entry to IntKeyStringValueEntry."); + e = null; + } + return e != null ? e.k : 0; } - protected void setComboIntStringKey(JComboBox c, + protected void setComboIntStringKey( + JComboBox backupfilesPresetsCombo2, int key) { - for (int i = 0; i < c.getItemCount(); i++) + for (int i = 0; i < backupfilesPresetsCombo2.getItemCount(); i++) { - IntKeyStringValueEntry e = c.getItemAt(i); - if (e.getKey() == key) + IntKeyStringValueEntry e; + try + { + e = (IntKeyStringValueEntry) backupfilesPresetsCombo2.getItemAt(i); + } catch (Exception ex) + { + Cache.log.error( + "Problem casting Combo entry to IntKeyStringValueEntry. Skipping item. "); + continue; + } + if (e.k == key) { - c.setSelectedIndex(i); + backupfilesPresetsCombo2.setSelectedIndex(i); break; } } @@ -2076,7 +2300,6 @@ public class GPreferences extends JPanel @Override public void keyTyped(KeyEvent e) { - int count = 300; char c = e.getKeyChar(); if (c == ':' || c == '/' || c == '\\') { @@ -2465,10 +2688,10 @@ public class GPreferences extends JPanel { try { - i = Integer.parseInt((String) s.getValue()); + i = ((Integer) s.getValue()).intValue(); } catch (Exception e) { - System.out.println( + Cache.log.error( "Exception casting the initial value of s.getValue()"); } } @@ -2484,6 +2707,10 @@ public class GPreferences extends JPanel { max = def; } + if (def < min) + { + def = min; + } SpinnerModel sModel = new SpinnerNumberModel(def, min, max, 1); s.setModel(sModel); @@ -2500,7 +2727,7 @@ public class GPreferences extends JPanel i = (Integer) s.getValue(); } catch (Exception e) { - System.out.println("Failed casting (Integer) JSpinner s.getValue()"); + Cache.log.error("Failed casting (Integer) JSpinner s.getValue()"); } return i; } @@ -2810,5 +3037,41 @@ public class GPreferences extends JPanel } } + + protected void validateHmmerPath() + { + } + + protected void validateCygwinPath() + { + } + + /** + * A helper method to add a panel containing a label and a component to a + * panel + * + * @param panel + * @param tooltip + * @param label + * @param valBox + */ + protected static void addtoLayout(JPanel panel, String tooltip, + JComponent label, JComponent valBox) + { + JPanel laypanel = new JPanel(new GridLayout(1, 2)); + JPanel labPanel = new JPanel(new BorderLayout()); + JPanel valPanel = new JPanel(); + labPanel.setBounds(new Rectangle(7, 7, 158, 23)); + valPanel.setBounds(new Rectangle(172, 7, 270, 23)); + labPanel.add(label, BorderLayout.WEST); + valPanel.add(valBox); + laypanel.add(labPanel); + laypanel.add(valPanel); + valPanel.setToolTipText(tooltip); + labPanel.setToolTipText(tooltip); + valBox.setToolTipText(tooltip); + panel.add(laypanel); + panel.validate(); + } }