JAL-2587 tidies
authorkiramt <k.mourao@dundee.ac.uk>
Tue, 8 Aug 2017 14:03:17 +0000 (15:03 +0100)
committerkiramt <k.mourao@dundee.ac.uk>
Tue, 8 Aug 2017 14:03:17 +0000 (15:03 +0100)
src/jalview/gui/OverviewPanel.java
src/jalview/gui/ProgressPanel.java

index af80725..791de99 100755 (executable)
@@ -86,7 +86,7 @@ public class OverviewPanel extends JPanel implements Runnable,
             (av.isShowAnnotation() && av
                     .getAlignmentConservationAnnotation() != null));
 
-    setSize(od.getWidth(), od.getHeight());
+
 
     setLayout(new BorderLayout());
     progressPanel = new ProgressPanel(OverviewRenderer.UPDATE,
@@ -95,7 +95,7 @@ public class OverviewPanel extends JPanel implements Runnable,
     oviewCanvas = new OverviewCanvas(od, av, progressPanel);
 
     add(oviewCanvas, BorderLayout.CENTER);
-
+    setSize(od.getWidth(), od.getHeight());
 
     av.getRanges().addPropertyChangeListener(this);
 
@@ -272,15 +272,14 @@ public class OverviewPanel extends JPanel implements Runnable,
       od.setHeight(getHeight());
     }
     
-    setPreferredSize(new Dimension(od.getWidth(), od.getHeight()));
+    setPreferredSize(new Dimension(od.getWidth(),
+            od.getHeight()));
 
     if (oviewCanvas.restartDraw())
     {
       return;
     }
 
-    // oviewCanvas.addPropertyChangeListener(OverviewRenderer.UPDATE, this);
-
     Thread thread = new Thread(this);
     thread.start();
     repaint();
@@ -333,32 +332,4 @@ public class OverviewPanel extends JPanel implements Runnable,
       od = null;
     }
   }
-
-  /*  private void addProgressBar()
-  {
-    progressPanel = new JPanel(new BorderLayout(10, 0));
-    progressPanel.setBorder(new EmptyBorder(0, 3, 0, 20));
-  
-    this.add(progressPanel, BorderLayout.SOUTH);
-  
-    progressBar = new OvProgressBar();
-    progressBar.setMinimum(0);
-  
-    progressPanel.add(new JLabel("Recalculating overview..."),
-            BorderLayout.WEST);
-    progressPanel.add(progressBar, BorderLayout.CENTER);
-  }
-  
-  private void removeProgressBar()
-  {
-    if (progressPanel != null)
-    {
-      synchronized (progressPanel)
-      {
-        progressPanel.remove(progressBar);
-        this.remove(progressPanel);
-        progressPanel = null;
-      }
-    }
-  }*/
 }
index f69f0cf..6a70f6a 100644 (file)
@@ -49,6 +49,8 @@ public class ProgressPanel extends JPanel implements RendererListenerI
 
   private JLabel progressLabel;
 
+  private String labelText;
+
   /**
    * Construct a JPanel containing a progress bar and a label.
    * 
@@ -63,10 +65,11 @@ public class ProgressPanel extends JPanel implements RendererListenerI
     setBorder(new EmptyBorder(0, 3, 0, 20));
 
     eventName = eventPropertyName;
+    labelText = label;
 
     progressBar = new JProgressBar();
     progressBar.setMinimum(0);
-    progressLabel = new JLabel(label);
+    progressLabel = new JLabel(labelText);
   
     add(progressLabel, BorderLayout.WEST);
     add(progressBar, BorderLayout.CENTER);
@@ -89,12 +92,12 @@ public class ProgressPanel extends JPanel implements RendererListenerI
       if (progress < MAXVALUE && !progressBar.isVisible())
       {
         progressBar.setVisible(true);
-        progressLabel.setVisible(true);
+        progressLabel.setText(labelText);
       }
       else if (progress >= MAXVALUE)
       {
         progressBar.setVisible(false);
-        progressLabel.setVisible(false);
+        progressLabel.setText(" "); // keep visible so panel stays visible
       }
     }
   }