+ /**
+ * Ensure references to potentially very large objects (the PCA matrices) are
+ * nulled when the frame is closed
+ */
+ protected void close_actionPerformed()
+ {
+ pcaModel = null;
+ }
+
+ /**
+ * Repopulate the options and actions under the score model menu when it is
+ * selected. Options will depend on whether 'nucleotide' or 'peptide'
+ * modelling is selected (and also possibly on whether any additional score
+ * models have been added).
+ */
+ @Override
+ protected void scoreModel_menuSelected()
+ {
+ scoreModelMenu.removeAll();
+ for (final ScoreModelI sm : ScoreModels.getInstance().getModels())
+ {
+ final String name = sm.getName();
+ JCheckBoxMenuItem jm = new JCheckBoxMenuItem(name);
+
+ /*
+ * if the score model doesn't provide a description, try to look one
+ * up in the text bundle, falling back on its name
+ */
+ String tooltip = sm.getDescription();
+ if (tooltip == null)
+ {
+ tooltip = MessageManager.getStringOrReturn("label.score_model_",
+ name);
+ }
+ jm.setToolTipText(tooltip);
+ jm.setSelected(pcaModel.getScoreModelName().equals(name));
+ if ((pcaModel.isNucleotide() && sm.isDNA())
+ || (!pcaModel.isNucleotide() && sm.isProtein()))
+ {
+ jm.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ if (!pcaModel.getScoreModelName().equals(name))
+ {
+ ScoreModelI sm2 = ScoreModels.getInstance().getScoreModel(
+ name, ap);
+ pcaModel.setScoreModel(sm2);
+ Thread worker = new Thread(PCAPanel.this);
+ worker.start();
+ }
+ }
+ });
+ scoreModelMenu.add(jm);
+ }
+ }
+ }
+
+ @Override