package org.helioviewer.plugins.eveplugin.view.linedataselector.cellrenderer;

import java.awt.Component;

import javax.swing.JProgressBar;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

import org.helioviewer.plugins.eveplugin.view.linedataselector.LineDataSelectorElement;

public class LoadingCellRenderer extends DefaultTableCellRenderer {

    private static final long serialVersionUID = 2173458369966852891L;

    private final JProgressBar downloadProgressBar = new JProgressBar();

    @Override
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        LineDataSelectorElement element = (LineDataSelectorElement) value;
        downloadProgressBar.setIndeterminate(true);
        downloadProgressBar.setVisible(element.isDownloading());
        return downloadProgressBar;
    }
}

package org.helioviewer.plugins.eveplugin.view.linedataselector.cellrenderer;

import java.awt.Component;

import javax.swing.JProgressBar;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

import org.helioviewer.base.logging.Log;
import org.helioviewer.plugins.eveplugin.view.linedataselector.LineDataSelectorElement;

public class LoadingCellRenderer extends DefaultTableCellRenderer {

    private static final long serialVersionUID = 2173458369966852891L;

    private final JProgressBar downloadProgressBar = new JProgressBar();

    @Override
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        LineDataSelectorElement element = (LineDataSelectorElement) value;
        Log.debug("element is downloading : " + element.isDownloading());
        if (element.isDownloading()) {
            downloadProgressBar.setIndeterminate(true);
            downloadProgressBar.setVisible(element.isDownloading());
            return downloadProgressBar;
        } else {
            return null;
        }
    }
}

Remove progress bar if element if not loading anymore
Remove progress bar if element if not loading anymore

git-svn-id: 4e353c0944fe8da334633afc35765ef362dec675@4260 b4e469a2-07ce-4b26-9273-4d7d95a670c7
