JAL-1960 updated unit test to include the test case where a sequences has no PDBId...
[jalview.git] / src / jalview / gui / PCAPanel.java
index cff9104..47add28 100644 (file)
  */
 package jalview.gui;
 
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentView;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.SeqCigar;
+import jalview.datamodel.SequenceI;
+import jalview.jbgui.GPCAPanel;
+import jalview.schemes.ResidueProperties;
+import jalview.util.MessageManager;
+import jalview.viewmodel.AlignmentViewport;
+import jalview.viewmodel.PCAModel;
+
 import java.awt.BorderLayout;
 import java.awt.Color;
 import java.awt.Graphics;
@@ -37,17 +48,6 @@ import javax.swing.JMenuItem;
 import javax.swing.JOptionPane;
 import javax.swing.JRadioButtonMenuItem;
 
-import jalview.datamodel.Alignment;
-import jalview.datamodel.AlignmentView;
-import jalview.datamodel.ColumnSelection;
-import jalview.datamodel.SeqCigar;
-import jalview.datamodel.SequenceI;
-import jalview.jbgui.GPCAPanel;
-import jalview.schemes.ResidueProperties;
-import jalview.util.MessageManager;
-import jalview.viewmodel.AlignmentViewport;
-import jalview.viewmodel.PCAModel;
-
 /**
  * DOCUMENT ME!
  * 
@@ -58,7 +58,7 @@ public class PCAPanel extends GPCAPanel implements Runnable,
         IProgressIndicator
 {
 
-  private ProgressBar progressBar;
+  private IProgressIndicator progressBar;
 
   RotatableCanvas rc;
 
@@ -113,11 +113,10 @@ public class PCAPanel extends GPCAPanel implements Runnable,
 
     if (!sameLength)
     {
-      JOptionPane
-              .showMessageDialog(
-                      Desktop.desktop,
-                      MessageManager.getString("label.pca_sequences_not_aligned"),
-                      MessageManager.getString("label.sequences_not_aligned"), JOptionPane.WARNING_MESSAGE);
+      JOptionPane.showMessageDialog(Desktop.desktop,
+              MessageManager.getString("label.pca_sequences_not_aligned"),
+              MessageManager.getString("label.sequences_not_aligned"),
+              JOptionPane.WARNING_MESSAGE);
 
       return;
     }
@@ -168,9 +167,11 @@ public class PCAPanel extends GPCAPanel implements Runnable,
     }
   }
 
+  @Override
   public void bgcolour_actionPerformed(ActionEvent e)
   {
-    Color col = JColorChooser.showDialog(this, MessageManager.getString("label.select_backgroud_colour"),
+    Color col = JColorChooser.showDialog(this,
+            MessageManager.getString("label.select_backgroud_colour"),
             rc.bgColour);
 
     if (col != null)
@@ -183,6 +184,7 @@ public class PCAPanel extends GPCAPanel implements Runnable,
   /**
    * DOCUMENT ME!
    */
+  @Override
   public void run()
   {
     long progId = System.currentTimeMillis();
@@ -288,6 +290,7 @@ public class PCAPanel extends GPCAPanel implements Runnable,
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   protected void xCombobox_actionPerformed(ActionEvent e)
   {
     doDimensionChange();
@@ -299,6 +302,7 @@ public class PCAPanel extends GPCAPanel implements Runnable,
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   protected void yCombobox_actionPerformed(ActionEvent e)
   {
     doDimensionChange();
@@ -310,11 +314,13 @@ public class PCAPanel extends GPCAPanel implements Runnable,
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   protected void zCombobox_actionPerformed(ActionEvent e)
   {
     doDimensionChange();
   }
 
+  @Override
   public void outputValues_actionPerformed(ActionEvent e)
   {
     CutAndPasteTransfer cap = new CutAndPasteTransfer();
@@ -330,17 +336,20 @@ public class PCAPanel extends GPCAPanel implements Runnable,
     }
   }
 
+  @Override
   public void showLabels_actionPerformed(ActionEvent e)
   {
     rc.showLabels(showLabels.getState());
   }
 
+  @Override
   public void print_actionPerformed(ActionEvent e)
   {
     PCAPrinter printer = new PCAPrinter();
     printer.start();
   }
 
+  @Override
   public void originalSeqData_actionPerformed(ActionEvent e)
   {
     // this was cut'n'pasted from the equivalent TreePanel method - we should
@@ -397,8 +406,8 @@ public class PCAPanel extends GPCAPanel implements Runnable,
         // msaorder);
 
         Desktop.addInternalFrame(af, MessageManager.formatMessage(
-                "label.original_data_for_params", new String[]
-                { this.title }), AlignFrame.DEFAULT_WIDTH,
+                "label.original_data_for_params",
+                new String[] { this.title }), AlignFrame.DEFAULT_WIDTH,
                 AlignFrame.DEFAULT_HEIGHT);
       }
     }
@@ -414,6 +423,7 @@ public class PCAPanel extends GPCAPanel implements Runnable,
 
   class PCAPrinter extends Thread implements Printable
   {
+    @Override
     public void run()
     {
       PrinterJob printJob = PrinterJob.getPrinterJob();
@@ -433,6 +443,7 @@ public class PCAPanel extends GPCAPanel implements Runnable,
       }
     }
 
+    @Override
     public int print(Graphics pg, PageFormat pf, int pi)
             throws PrinterException
     {
@@ -462,6 +473,7 @@ public class PCAPanel extends GPCAPanel implements Runnable,
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void eps_actionPerformed(ActionEvent e)
   {
     makePCAImage(jalview.util.ImageMaker.TYPE.EPS);
@@ -473,6 +485,7 @@ public class PCAPanel extends GPCAPanel implements Runnable,
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void png_actionPerformed(ActionEvent e)
   {
     makePCAImage(jalview.util.ImageMaker.TYPE.PNG);
@@ -488,21 +501,20 @@ public class PCAPanel extends GPCAPanel implements Runnable,
     if (type == jalview.util.ImageMaker.TYPE.PNG)
     {
       im = new jalview.util.ImageMaker(this,
-              jalview.util.ImageMaker.TYPE.PNG,
-              "Make PNG image from PCA", width, height, null, null);
+              jalview.util.ImageMaker.TYPE.PNG, "Make PNG image from PCA",
+              width, height, null, null, null, 0, false);
     }
     else if (type == jalview.util.ImageMaker.TYPE.EPS)
     {
       im = new jalview.util.ImageMaker(this,
-              jalview.util.ImageMaker.TYPE.EPS,
-              "Make EPS file from PCA", width, height, null,
-              this.getTitle());
+              jalview.util.ImageMaker.TYPE.EPS, "Make EPS file from PCA",
+              width, height, null, this.getTitle(), null, 0, false);
     }
     else
     {
       im = new jalview.util.ImageMaker(this,
               jalview.util.ImageMaker.TYPE.SVG, "Make SVG file from PCA",
-              width, height, null, this.getTitle());
+              width, height, null, this.getTitle(), null, 0, false);
 
     }
 
@@ -518,6 +530,7 @@ public class PCAPanel extends GPCAPanel implements Runnable,
     }
   }
 
+  @Override
   public void viewMenu_menuSelected()
   {
     buildAssociatedViewMenu();
@@ -553,6 +566,7 @@ public class PCAPanel extends GPCAPanel implements Runnable,
       buttonGroup.add(item);
       item.addActionListener(new ActionListener()
       {
+        @Override
         public void actionPerformed(ActionEvent evt)
         {
           rc.applyToAllViews = false;
@@ -572,6 +586,7 @@ public class PCAPanel extends GPCAPanel implements Runnable,
     itemf.setSelected(rc.applyToAllViews);
     itemf.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent evt)
       {
         rc.applyToAllViews = itemf.isSelected();
@@ -588,6 +603,7 @@ public class PCAPanel extends GPCAPanel implements Runnable,
    * jalview.jbgui.GPCAPanel#outputPoints_actionPerformed(java.awt.event.ActionEvent
    * )
    */
+  @Override
   protected void outputPoints_actionPerformed(ActionEvent e)
   {
     CutAndPasteTransfer cap = new CutAndPasteTransfer();
@@ -597,8 +613,8 @@ public class PCAPanel extends GPCAPanel implements Runnable,
               xCombobox.getSelectedIndex(), yCombobox.getSelectedIndex(),
               zCombobox.getSelectedIndex()));
       Desktop.addInternalFrame(cap, MessageManager.formatMessage(
-              "label.points_for_params", new String[]
-              { this.getTitle() }), 500, 500);
+              "label.points_for_params", new String[] { this.getTitle() }),
+              500, 500);
     } catch (OutOfMemoryError oom)
     {
       new OOMWarning("exporting PCA points", oom);
@@ -613,6 +629,7 @@ public class PCAPanel extends GPCAPanel implements Runnable,
    * jalview.jbgui.GPCAPanel#outputProjPoints_actionPerformed(java.awt.event
    * .ActionEvent)
    */
+  @Override
   protected void outputProjPoints_actionPerformed(ActionEvent e)
   {
     CutAndPasteTransfer cap = new CutAndPasteTransfer();
@@ -622,14 +639,15 @@ public class PCAPanel extends GPCAPanel implements Runnable,
               xCombobox.getSelectedIndex(), yCombobox.getSelectedIndex(),
               zCombobox.getSelectedIndex()));
       Desktop.addInternalFrame(cap, MessageManager.formatMessage(
-              "label.transformed_points_for_params", new String[]
-              { this.getTitle() }), 500, 500);
+              "label.transformed_points_for_params",
+              new String[] { this.getTitle() }), 500, 500);
     } catch (OutOfMemoryError oom)
     {
       new OOMWarning("exporting transformed PCA points", oom);
       cap.dispose();
     }
   }
+
   /*
    * (non-Javadoc)
    *