mirror of
https://github.com/mitb-archive/filebot
synced 2025-01-13 14:58:02 -05:00
ac9473ff07
* added SeriesNameMatcher * added SeasonEpisodeMatcher * access Preferences via new Settings class * adapt TVDotComClient to site changes (episodes no longer ordered in reverse) * added ActionPopup (inspired by the eclipse quickfix popup) refactoring: * renamed *Util classes to *Utilities * renamed HyperlinkLabel to LinkButton as it extends JButton now * refactored FileBotUtilities and FileUtilities
76 lines
1.7 KiB
Java
76 lines
1.7 KiB
Java
|
|
package net.sourceforge.tuned.ui;
|
|
|
|
|
|
import java.beans.PropertyChangeEvent;
|
|
import java.beans.PropertyChangeListener;
|
|
|
|
import javax.swing.JComponent;
|
|
|
|
import net.miginfocom.swing.MigLayout;
|
|
|
|
|
|
public class LoadingOverlayPane extends JComponent {
|
|
|
|
public static final String LOADING_PROPERTY = "loading";
|
|
|
|
private final JComponent animationComponent;
|
|
|
|
private boolean overlayEnabled = false;
|
|
|
|
private int millisToOverlay = 400;
|
|
|
|
|
|
public LoadingOverlayPane(JComponent component, JComponent propertyChangeSource) {
|
|
this(component, propertyChangeSource, null, null);
|
|
}
|
|
|
|
|
|
public LoadingOverlayPane(JComponent component, JComponent propertyChangeSource, String offsetX, String offsetY) {
|
|
setLayout(new MigLayout("insets 0, fill"));
|
|
|
|
animationComponent = new ProgressIndicator();
|
|
animationComponent.setVisible(false);
|
|
|
|
add(animationComponent, String.format("pos n %s 100%%-%s n", offsetY != null ? offsetY : "8px", offsetX != null ? offsetX : "18px"));
|
|
add(component, "grow");
|
|
|
|
if (propertyChangeSource != null) {
|
|
propertyChangeSource.addPropertyChangeListener(LOADING_PROPERTY, new PropertyChangeListener() {
|
|
|
|
@Override
|
|
public void propertyChange(PropertyChangeEvent evt) {
|
|
setOverlayVisible((Boolean) evt.getNewValue());
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
public boolean isOptimizedDrawingEnabled() {
|
|
return false;
|
|
}
|
|
|
|
|
|
public void setOverlayVisible(boolean b) {
|
|
overlayEnabled = b;
|
|
|
|
if (overlayEnabled) {
|
|
TunedUtilities.invokeLater(millisToOverlay, new Runnable() {
|
|
|
|
@Override
|
|
public void run() {
|
|
if (overlayEnabled) {
|
|
animationComponent.setVisible(true);
|
|
}
|
|
}
|
|
|
|
});
|
|
} else {
|
|
animationComponent.setVisible(false);
|
|
}
|
|
}
|
|
|
|
}
|