1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-24 08:48:51 -05:00

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

View File

@ -1,15 +1,10 @@
package net.filebot.util.ui; package net.filebot.util.ui;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.JComponent; import javax.swing.JComponent;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
public class LoadingOverlayPane extends JComponent { public class LoadingOverlayPane extends JComponent {
public static final String LOADING_PROPERTY = "loading"; public static final String LOADING_PROPERTY = "loading";
@ -20,12 +15,10 @@ public class LoadingOverlayPane extends JComponent {
private int millisToOverlay = 400; private int millisToOverlay = 400;
public LoadingOverlayPane(JComponent component, JComponent propertyChangeSource) { public LoadingOverlayPane(JComponent component, JComponent propertyChangeSource) {
this(component, propertyChangeSource, null, null); this(component, propertyChangeSource, null, null);
} }
public LoadingOverlayPane(JComponent component, JComponent propertyChangeSource, String offsetX, String offsetY) { public LoadingOverlayPane(JComponent component, JComponent propertyChangeSource, String offsetX, String offsetY) {
setLayout(new MigLayout("insets 0, fill")); setLayout(new MigLayout("insets 0, fill"));
@ -36,23 +29,17 @@ public class LoadingOverlayPane extends JComponent {
add(component, "grow"); add(component, "grow");
if (propertyChangeSource != null) { if (propertyChangeSource != null) {
propertyChangeSource.addPropertyChangeListener(LOADING_PROPERTY, new PropertyChangeListener() { propertyChangeSource.addPropertyChangeListener(LOADING_PROPERTY, evt -> {
@Override
public void propertyChange(PropertyChangeEvent evt) {
setOverlayVisible((Boolean) evt.getNewValue()); setOverlayVisible((Boolean) evt.getNewValue());
}
}); });
} }
} }
@Override @Override
public boolean isOptimizedDrawingEnabled() { public boolean isOptimizedDrawingEnabled() {
return false; return false;
} }
public void setOverlayVisible(boolean b) { public void setOverlayVisible(boolean b) {
overlayEnabled = b; overlayEnabled = b;