X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FPCAPanel.java;h=d1216b92a20ddd3373432074696659cf2c156389;hb=7335eb77076ba83a2faebeaf45f0aa03407fdcd1;hp=4266c32290aa7d4e4a78c63e6d2b8494a7e784b1;hpb=b57a02c25e335d033c97f8a6bacd6b54f62bd2b6;p=jalview.git diff --git a/src/jalview/gui/PCAPanel.java b/src/jalview/gui/PCAPanel.java old mode 100755 new mode 100644 index 4266c32..d1216b9 --- a/src/jalview/gui/PCAPanel.java +++ b/src/jalview/gui/PCAPanel.java @@ -1,32 +1,34 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) - * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.1) + * Copyright (C) 2014 The Jalview Authors * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. */ package jalview.gui; import java.util.*; - import java.awt.*; import java.awt.event.*; import java.awt.print.*; + import javax.swing.*; -import jalview.analysis.*; import jalview.datamodel.*; import jalview.jbgui.*; +import jalview.schemes.ResidueProperties; +import jalview.util.MessageManager; import jalview.viewmodel.PCAModel; /** @@ -108,7 +110,35 @@ public class PCAPanel extends GPCAPanel implements Runnable, Thread worker = new Thread(this); worker.start(); } - + @Override + protected void scoreMatrix_menuSelected() + { + scoreMatrixMenu.removeAll(); + for (final String sm:ResidueProperties.scoreMatrices.keySet()) + { + JCheckBoxMenuItem jm=new JCheckBoxMenuItem(); + jm.setText(MessageManager.getStringOrReturn("label.score_model", sm)); + jm.setSelected(pcaModel.getScore_matrix().equals(sm)); + if (pcaModel.isNucleotide()==ResidueProperties.scoreMatrices.get(sm).isDNA()) + { + final PCAPanel us = this; + jm.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + if (!pcaModel.getScore_matrix().equals((String) sm)) + { + pcaModel.setScore_matrix((String) sm); + Thread worker = new Thread(us); + worker.start(); + } + } + }); + scoreMatrixMenu.add(jm); + } + } + } public void bgcolour_actionPerformed(ActionEvent e) { Color col = JColorChooser.showDialog(this, "Select Background Colour", @@ -164,7 +194,7 @@ public class PCAPanel extends GPCAPanel implements Runnable, if (getParent() == null) { addKeyListener(rc); - Desktop.addInternalFrame(this, "Principal component analysis", 475, + Desktop.addInternalFrame(this, MessageManager.getString("label.principal_component_analysis"), 475, 450); } } @@ -175,6 +205,7 @@ public class PCAPanel extends GPCAPanel implements Runnable, if (!pcaModel.isNucleotide()) { pcaModel.setNucleotide(true); + pcaModel.setScore_matrix("DNA"); Thread worker = new Thread(this); worker.start(); } @@ -188,6 +219,7 @@ public class PCAPanel extends GPCAPanel implements Runnable, if (pcaModel.isNucleotide()) { pcaModel.setNucleotide(false); + pcaModel.setScore_matrix("BLOSUM62"); Thread worker = new Thread(this); worker.start(); } @@ -260,7 +292,7 @@ public class PCAPanel extends GPCAPanel implements Runnable, try { cap.setText(pcaModel.getDetails()); - Desktop.addInternalFrame(cap, "PCA details", 500, 500); + Desktop.addInternalFrame(cap, MessageManager.getString("label.pca_details"), 500, 500); } catch (OutOfMemoryError oom) { new OOMWarning("opening PCA details", oom); @@ -334,7 +366,7 @@ public class PCAPanel extends GPCAPanel implements Runnable, // af.addSortByOrderMenuItem(ServiceName + " Ordering", // msaorder); - Desktop.addInternalFrame(af, "Original Data for " + this.title, + Desktop.addInternalFrame(af, MessageManager.formatMessage("label.original_data_for_params", new String[]{this.title}), AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); } } @@ -445,6 +477,7 @@ public class PCAPanel extends GPCAPanel implements Runnable, } } + public void viewMenu_menuSelected() { buildAssociatedViewMenu(); @@ -523,7 +556,7 @@ public class PCAPanel extends GPCAPanel implements Runnable, cap.setText(pcaModel.getPointsasCsv(false, xCombobox.getSelectedIndex(), yCombobox.getSelectedIndex(), zCombobox.getSelectedIndex())); - Desktop.addInternalFrame(cap, "Points for " + getTitle(), 500, 500); + Desktop.addInternalFrame(cap, MessageManager.formatMessage("label.points_for_params", new String[]{this.getTitle()}), 500, 500); } catch (OutOfMemoryError oom) { new OOMWarning("exporting PCA points", oom); @@ -546,7 +579,7 @@ public class PCAPanel extends GPCAPanel implements Runnable, cap.setText(pcaModel.getPointsasCsv(true, xCombobox.getSelectedIndex(), yCombobox.getSelectedIndex(), zCombobox.getSelectedIndex())); - Desktop.addInternalFrame(cap, "Transformed points for " + getTitle(), + Desktop.addInternalFrame(cap, MessageManager.formatMessage("label.transformed_points_for_params", new String[]{this.getTitle()}), 500, 500); } catch (OutOfMemoryError oom) { @@ -625,7 +658,7 @@ public class PCAPanel extends GPCAPanel implements Runnable, final JPanel progressPanel = (JPanel) progressBars.get(new Long(id)); if (handler.canCancel()) { - JButton cancel = new JButton("Cancel"); + JButton cancel = new JButton(MessageManager.getString("action.cancel")); final IProgressIndicator us = this; cancel.addActionListener(new ActionListener() {