Browse Source

Pull request #10735: REPORT-85293【启动优化】起始页新增加载进度条视觉效果确认

Merge in DESIGN/design from ~HARRISON/design:release/11.0 to release/11.0

* commit '295d9a8c411fce8f4ba0486de3ce25faebcea422':
  REPORT-85293【启动优化】起始页新增加载进度条视觉效果确认 ProgressDialog 用错了,这个只能是使用的时候才创建 不然大小有问题
release/11.0
Harrison-刘珂 2 years ago
parent
commit
cfe68d3f84
  1. 4
      designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java
  2. 79
      designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java

4
designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java

@ -21,8 +21,8 @@ import java.awt.Frame;
/**
* 加载进度弹窗
* <em>使用注意点:</em>
* 1-需要等到 父frame 启动好之后才能启动进度条
* 2-或者到使用时再初始化不要作为属性存在
* 必须到使用时再初始化不要作为属性存在
* 因为涉及到 大小/位置 相对于 parent 的相对判断
* {@link com.fr.design.gui.iprogressbar.ProgressDialogTest}
*/
public class ProgressDialog extends UIDialog {

79
designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java

@ -81,8 +81,6 @@ public class StartupPageWindow extends JFrame {
private JPanel body;
private StartupLoadingPanel loadingPanel;
public StartupPageWindow(StartupPageModel pageModel) {
patchUIAction(pageModel);
@ -102,9 +100,6 @@ public class StartupPageWindow extends JFrame {
setFullScreen();
// 必须放最后
// 见 https://work.fineres.com/browse/REPORT-85293
loadingPanel = new StartupLoadingPanel(this);
}
private void initCenter(StartupPageModel pageModel) {
@ -232,45 +227,49 @@ public class StartupPageWindow extends JFrame {
private void enterWorkspace(Runnable action) {
UIUtil.invokeAndWaitIfNeeded(() -> {
// 必须直接初始化
// 见 https://work.fineres.com/browse/REPORT-85293
StartupLoadingPanel loadingPanel = new StartupLoadingPanel(this);
loadingPanel.show();
setEnabled(false);
});
SwingWorker<Void, Void> task = new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception {
action.run();
return null;
}
@Override
protected void done() {
try {
Void result = get();
setVisible(false);
} catch (Exception e) {
// 处理错误
UIUtil.invokeLaterIfNeeded(() -> {
UIExpandDialog.Builder()
.owner(StartupPageWindow.this)
.title(Toolkit.i18nText("Fine-Design_Basic_Remote_Env_Try"))
.message(Toolkit.i18nText("Fine-Design_Basic_Connection_Failed"))
.messageType(UIExpandDialog.WARNING_MESSAGE)
.detail(e.getMessage())
.expand(true)
.modal(false)
.build()
.setVisible(true);
setEnabled(true);
});
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} finally {
loadingPanel.hide();
SwingWorker<Void, Void> task = new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception {
action.run();
return null;
}
}
};
task.execute();
@Override
protected void done() {
try {
Void result = get();
setVisible(false);
} catch (Exception e) {
// 处理错误
UIUtil.invokeLaterIfNeeded(() -> {
UIExpandDialog.Builder()
.owner(StartupPageWindow.this)
.title(Toolkit.i18nText("Fine-Design_Basic_Remote_Env_Try"))
.message(Toolkit.i18nText("Fine-Design_Basic_Connection_Failed"))
.messageType(UIExpandDialog.WARNING_MESSAGE)
.detail(e.getMessage())
.expand(true)
.modal(false)
.build()
.setVisible(true);
setEnabled(true);
});
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} finally {
loadingPanel.hide();
}
}
};
task.execute();
});
}
private JPanel generateRecentOpenPanel(StartupPageModel pageModel) {

Loading…
Cancel
Save