JAL-3453 Some tests require different Desktop constructor
[jalview.git] / src / jalview / gui / PCAPanel.java
index 0a23517..bebc7f0 100644 (file)
@@ -36,6 +36,7 @@ import jalview.jbgui.GPCAPanel;
 import jalview.math.RotatableMatrix.Axis;
 import jalview.util.ImageMaker;
 import jalview.util.MessageManager;
+import jalview.util.Platform;
 import jalview.viewmodel.AlignmentViewport;
 import jalview.viewmodel.PCAModel;
 
@@ -66,7 +67,7 @@ public class PCAPanel extends GPCAPanel
 
   private static final int MIN_HEIGHT = 250;
 
-  private RotatableCanvas rc;
+  RotatableCanvas rc;
 
   AlignmentPanel ap;
 
@@ -131,8 +132,6 @@ public class PCAPanel extends GPCAPanel
 
     addKeyListener(getRotatableCanvas());
     validate();
-
-    this.setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT));
   }
 
   /**
@@ -202,10 +201,13 @@ public class PCAPanel extends GPCAPanel
     repaint();
     if (getParent() == null)
     {
+
+      Dimension dim = Platform.getDimIfEmbedded(this, 475, 450);
       Desktop.addInternalFrame(this,
               MessageManager.formatMessage("label.calc_title", "PCA",
                       getPcaModel().getScoreModelName()),
-              475, 450);
+              dim.width, dim.height);
+      setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT));
     }
     working = false;
   }
@@ -412,6 +414,7 @@ public class PCAPanel extends GPCAPanel
     }
   }
 
+  @Override
   public void makePCAImage(ImageMaker.TYPE type)
   {
     int width = getRotatableCanvas().getWidth();
@@ -505,13 +508,6 @@ public class PCAPanel extends GPCAPanel
 
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see
-   * jalview.jbgui.GPCAPanel#outputPoints_actionPerformed(java.awt.event.ActionEvent
-   * )
-   */
   @Override
   protected void outputPoints_actionPerformed()
   {
@@ -531,13 +527,6 @@ public class PCAPanel extends GPCAPanel
     }
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see
-   * jalview.jbgui.GPCAPanel#outputProjPoints_actionPerformed(java.awt.event
-   * .ActionEvent)
-   */
   @Override
   protected void outputProjPoints_actionPerformed()
   {
@@ -557,58 +546,10 @@ public class PCAPanel extends GPCAPanel
     }
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see jalview.gui.IProgressIndicator#setProgressBar(java.lang.String, long)
-   */
   @Override
   public void setProgressBar(String message, long id)
   {
     progressBar.setProgressBar(message, id);
-    // if (progressBars == null)
-    // {
-    // progressBars = new Hashtable();
-    // progressBarHandlers = new Hashtable();
-    // }
-    //
-    // JPanel progressPanel;
-    // Long lId = new Long(id);
-    // GridLayout layout = (GridLayout) statusPanel.getLayout();
-    // if (progressBars.get(lId) != null)
-    // {
-    // progressPanel = (JPanel) progressBars.get(new Long(id));
-    // statusPanel.remove(progressPanel);
-    // progressBars.remove(lId);
-    // progressPanel = null;
-    // if (message != null)
-    // {
-    // statusBar.setText(message);
-    // }
-    // if (progressBarHandlers.contains(lId))
-    // {
-    // progressBarHandlers.remove(lId);
-    // }
-    // layout.setRows(layout.getRows() - 1);
-    // }
-    // else
-    // {
-    // progressPanel = new JPanel(new BorderLayout(10, 5));
-    //
-    // JProgressBar progressBar = new JProgressBar();
-    // progressBar.setIndeterminate(true);
-    //
-    // progressPanel.add(new JLabel(message), BorderLayout.WEST);
-    // progressPanel.add(progressBar, BorderLayout.CENTER);
-    //
-    // layout.setRows(layout.getRows() + 1);
-    // statusPanel.add(progressPanel);
-    //
-    // progressBars.put(lId, progressPanel);
-    // }
-    // // update GUI
-    // // setMenusForViewport();
-    // validate();
   }
 
   @Override
@@ -616,31 +557,6 @@ public class PCAPanel extends GPCAPanel
           final IProgressIndicatorHandler handler)
   {
     progressBar.registerHandler(id, handler);
-    // if (progressBarHandlers == null || !progressBars.contains(new Long(id)))
-    // {
-    // throw new
-    // Error(MessageManager.getString("error.call_setprogressbar_before_registering_handler"));
-    // }
-    // progressBarHandlers.put(new Long(id), handler);
-    // final JPanel progressPanel = (JPanel) progressBars.get(new Long(id));
-    // if (handler.canCancel())
-    // {
-    // JButton cancel = new JButton(
-    // MessageManager.getString("action.cancel"));
-    // final IProgressIndicator us = this;
-    // cancel.addActionListener(new ActionListener()
-    // {
-    //
-    // @Override
-    // public void actionPerformed(ActionEvent e)
-    // {
-    // handler.cancelActivity(id);
-    // us.setProgressBar(MessageManager.formatMessage("label.cancelled_params",
-    // new String[]{((JLabel) progressPanel.getComponent(0)).getText()}), id);
-    // }
-    // });
-    // progressPanel.add(cancel, BorderLayout.EAST);
-    // }
   }
 
   /**