提交 99eb31b3 编写于 作者: S Skylot

fix(gui): add dots for progress titles

上级 287275d8
...@@ -79,7 +79,7 @@ public class BackgroundExecutor { ...@@ -79,7 +79,7 @@ public class BackgroundExecutor {
@Override @Override
protected Boolean doInBackground() throws Exception { protected Boolean doInBackground() throws Exception {
progressPane.changeLabel(this, task.getTitle() + ':'); progressPane.changeLabel(this, task.getTitle() + "… ");
progressPane.changeCancelBtnVisible(this, task.canBeCanceled()); progressPane.changeCancelBtnVisible(this, task.canBeCanceled());
progressPane.changeVisibility(this, true); progressPane.changeVisibility(this, true);
...@@ -125,7 +125,8 @@ public class BackgroundExecutor { ...@@ -125,7 +125,8 @@ public class BackgroundExecutor {
} }
if (isCancelled()) { if (isCancelled()) {
executor.shutdownNow(); executor.shutdownNow();
progressPane.changeLabel(this, task.getTitle() + " (Canceling):"); progressPane.changeLabel(this, task.getTitle() + " (Canceling)… ");
progressPane.changeIndeterminate(this, true);
// force termination // force termination
executor.awaitTermination(5, TimeUnit.SECONDS); executor.awaitTermination(5, TimeUnit.SECONDS);
return false; return false;
......
...@@ -19,6 +19,6 @@ public class DecompileJob extends BackgroundJob { ...@@ -19,6 +19,6 @@ public class DecompileJob extends BackgroundJob {
@Override @Override
public String getInfoString() { public String getInfoString() {
return NLS.str("progress.decompile"); return NLS.str("progress.decompile") + "… ";
} }
} }
...@@ -68,6 +68,6 @@ public class IndexJob extends BackgroundJob { ...@@ -68,6 +68,6 @@ public class IndexJob extends BackgroundJob {
@Override @Override
public String getInfoString() { public String getInfoString() {
return NLS.str("progress.index"); return NLS.str("progress.index") + "… ";
} }
} }
...@@ -79,6 +79,10 @@ public class ProgressPanel extends JPanel implements PropertyChangeListener { ...@@ -79,6 +79,10 @@ public class ProgressPanel extends JPanel implements PropertyChangeListener {
setVisible(((Boolean) evt.getNewValue())); setVisible(((Boolean) evt.getNewValue()));
break; break;
case "indeterminate":
setIndeterminate(((Boolean) evt.getNewValue()));
break;
case "cancel-visible": case "cancel-visible":
cancelButton.setVisible(((Boolean) evt.getNewValue())); cancelButton.setVisible(((Boolean) evt.getNewValue()));
break; break;
...@@ -97,6 +101,10 @@ public class ProgressPanel extends JPanel implements PropertyChangeListener { ...@@ -97,6 +101,10 @@ public class ProgressPanel extends JPanel implements PropertyChangeListener {
task.firePropertyChange("label", null, label); task.firePropertyChange("label", null, label);
} }
public void changeIndeterminate(SwingWorker<?, ?> task, boolean indeterminate) {
task.firePropertyChange("indeterminate", null, indeterminate);
}
public void changeVisibility(SwingWorker<?, ?> task, boolean visible) { public void changeVisibility(SwingWorker<?, ?> task, boolean visible) {
task.firePropertyChange("visible", null, visible); task.firePropertyChange("visible", null, visible);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册