}
JPanel progressPanel;
-
+ ArrayList<JPanel> fileLoadingPanels=new ArrayList<JPanel>();
public void startLoading(final String fileName)
{
if (fileLoadingCount == 0)
{
- addProgressPanel("Loading File: " + fileName + " ");
-
+ fileLoadingPanels.add(addProgressPanel("Loading File: " + fileName + " "));
}
fileLoadingCount++;
}
- private JProgressBar addProgressPanel(String string)
+ private JPanel addProgressPanel(String string)
{
if (progressPanel == null)
{
- progressPanel = new JPanel(new BorderLayout());
+ progressPanel = new JPanel(new GridLayout(1,1));
totalProgressCount = 0;
+ instance.getContentPane().add(progressPanel, BorderLayout.SOUTH);
}
+ JPanel thisprogress=new JPanel(new BorderLayout(10,5));
JProgressBar progressBar = new JProgressBar();
progressBar.setIndeterminate(true);
- progressPanel.add(new JLabel(string), BorderLayout.WEST);
-
- progressPanel.add(progressBar, BorderLayout.CENTER);
+ thisprogress.add(new JLabel(string), BorderLayout.WEST);
- instance.getContentPane().add(progressPanel, BorderLayout.SOUTH);
- totalProgressCount++;
- validate();
- return progressBar;
+ thisprogress.add(progressBar, BorderLayout.CENTER);
+ progressPanel.add(thisprogress);
+ ((GridLayout)progressPanel.getLayout()).setRows(((GridLayout)progressPanel.getLayout()).getRows()+1);
+ ++totalProgressCount;
+ instance.validate();
+ return thisprogress;
}
int totalProgressCount = 0;
- private void removeProgressPanel(JProgressBar progbar)
+ private void removeProgressPanel(JPanel progbar)
{
if (progressPanel != null)
{
progressPanel.remove(progbar);
+ GridLayout gl = (GridLayout) progressPanel.getLayout();
+ gl.setRows(gl.getRows()-1);
if (--totalProgressCount < 1)
{
this.getContentPane().remove(progressPanel);
fileLoadingCount--;
if (fileLoadingCount < 1)
{
- if (progressPanel != null)
+ for (JPanel flp : fileLoadingPanels)
{
- this.getContentPane().remove(progressPanel);
- progressPanel = null;
+ removeProgressPanel(flp);
}
+ fileLoadingPanels.clear();
fileLoadingCount = 0;
}
validate();
if (value == JalviewFileChooser.APPROVE_OPTION)
{
java.io.File choice = chooser.getSelectedFile();
- JProgressBar progpanel = addProgressPanel("Saving VAMSAS Document to "
+ JPanel progpanel = addProgressPanel("Saving VAMSAS Document to "
+ choice.getName());
jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice.getParent());
String warnmsg = null;
}
}
- JProgressBar vamUpdate = null;
+ JPanel vamUpdate = null;
/**
* hide vamsas user gui bits when a vamsas document event is being handled.
/**
* Progress bars managed by the IProgressIndicator method.
*/
- private Hashtable progressBars, progressBarHandlers;
+ private Hashtable<Long,JPanel> progressBars;
+ private Hashtable<Long,IProgressIndicatorHandler> progressBarHandlers;
/*
* (non-Javadoc)
{
if (progressBars == null)
{
- progressBars = new Hashtable();
- progressBarHandlers = new Hashtable();
+ progressBars = new Hashtable<Long,JPanel>();
+ progressBarHandlers = new Hashtable<Long,IProgressIndicatorHandler>();
}
if (progressBars.get(new Long(id)) != null)
{
- JProgressBar progressPanel = (JProgressBar) progressBars
+ JPanel progressPanel = progressBars
.remove(new Long(id));
if (progressBarHandlers.contains(new Long(id)))
{