Make sure that the Loading indicator is visible if a Preset is being executed

This commit is contained in:
Reinhard Pointner 2016-12-20 00:57:02 +08:00
parent 51d748d4bb
commit 4852ca4292
2 changed files with 4 additions and 15 deletions

View File

@ -861,6 +861,7 @@ public class RenamePanel extends JComponent {
// select files
List<File> files = getFiles(evt);
if (files == null) {
namesList.firePropertyChange(LOADING_PROPERTY, true, false);
return;
}
@ -872,6 +873,7 @@ public class RenamePanel extends JComponent {
if (isMacSandbox()) {
if (!MacAppUtilities.askUnlockFolders(getWindow(RenamePanel.this), remainingFiles)) {
namesList.firePropertyChange(LOADING_PROPERTY, true, false);
return;
}
}

View File

@ -1,15 +1,10 @@
package net.filebot.util.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";
@ -20,12 +15,10 @@ public class LoadingOverlayPane extends JComponent {
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"));
@ -36,23 +29,17 @@ public class LoadingOverlayPane extends JComponent {
add(component, "grow");
if (propertyChangeSource != null) {
propertyChangeSource.addPropertyChangeListener(LOADING_PROPERTY, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
setOverlayVisible((Boolean) evt.getNewValue());
}
propertyChangeSource.addPropertyChangeListener(LOADING_PROPERTY, evt -> {
setOverlayVisible((Boolean) evt.getNewValue());
});
}
}
@Override
public boolean isOptimizedDrawingEnabled() {
return false;
}
public void setOverlayVisible(boolean b) {
overlayEnabled = b;