Browse Source

Merge pull request #2309 in DESIGN/design from release/10.0 to bugfix/10.0

* commit 'aebaecce97c352f471a0468bb3014992d284a025':
  考虑到progressDialog目前只在FineEmbedServerMonitor中使用,所以将原本维护在DesignerFrame中的progressDialog放到FineEmbedServerMonitor中,而DesignerFrame原本的成员变量和相应初始化删除,一些相关方法先做成空实现,然后标记为废弃,这些方法具体实现和使用都放到FineEmbedServerMonitor中
  REPORT-39338 【回归】内置服务器启动进度条会先展示上次的进度再初始化 1. 更新修改方案:确定了一直维护同一个进度条dialog没有特殊意义之后,选择在每一次关闭服务器或者服务器启动完成后dialog废弃掉,然后在每一次需要打开对话框的时候,新建一个
  添加修改
  REPORT-39338 【回归】内置服务器启动进度条会先展示上次的进度再初始化 1. bug原因:,每次内置服务器启动使用的进度条弹窗都是同一个,只是在可见与不可见状态之间切换,而在启动成功之后,没有清空上次进度,所以会先显示上次进度 2. 修改方案:为进度条的value置0,并刷新UI
  REPORT-39341 【回归】文件没有读写权限报告弹窗是英文 修改解决方案:经过多位大佬提醒,最好不要直接修改传过来的Locale,因此转变思路为如果接收到了比较奇怪的Locale,尽量找到一个在本项目中使用的最接近的Locale返回,如传入参数为zh-Hans-CN时,返回zh_CN,而不是之前的en_US
  更新单元测试
  更新单元测试
  补充单元测试
  REPORT-39341 【回归】【jdk11】文件没有读写权限报告弹窗是英文 1. bug原因:在中文环境下,这边传过来的Locale是zh-Hans-CN,进入isSupport方法中时会发现不匹配,然后Locale被设置成en_US,然后在报错弹窗里面的内容就都是英文了 2. 修改方案:增加判断,将传过来的Locale的script抹去,只保留language和region,跟代码里面保存的Locale保持一致
bugfix/10.0
superman 4 years ago
parent
commit
d2870e6607
  1. 14
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 24
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  3. 21
      designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java

14
designer-base/src/main/java/com/fr/design/DesignerEnvManager.java

@ -163,7 +163,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
* alphafine
*/
private AlphaFineConfigManager alphaFineConfigManager = AlphaFineConfigManager.getInstance();
/**
* 阅后即焚的配置项
*/
@ -1424,7 +1424,9 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
* @return
*/
private Locale checkLocale(Locale locale) {
return SupportLocale.getInstance().isSupport(locale) ? locale : Locale.US;
// Yvan: REPORT-39341,有一些情况下,获取到的是zh-Hans-CN这种,需要找到项目中最匹配的Locale
return SupportLocale.getInstance().isSupport(locale) ?
locale : SupportLocale.getInstance().getSuitableLocale(locale);
}
private void readReportLengthUnit(XMLableReader reader) {
@ -1578,7 +1580,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
}
}
}
private void readSnapChatConfig(XMLableReader reader) {
reader.readXMLObject(this.snapChatConfig = SnapChatConfig.getInstance());
}
@ -1801,14 +1803,14 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
writeSnapChatConfig(writer);
writer.end();
}
private void writeSnapChatConfig(XMLPrintWriter writer) {
if (this.snapChatConfig != null) {
this.snapChatConfig.writeXML(writer);
}
}
private void writeAlphaFineAttr(XMLPrintWriter writer) {
if (this.alphaFineConfigManager != null) {
this.alphaFineConfigManager.writeXML(writer);

24
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java

@ -257,8 +257,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
}
};
private ProgressDialog progressDialog;
public DesignerFrame(ToolBarMenuDock ad) {
setName(DESIGNER_FRAME_NAME);
@ -338,7 +336,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
this.setDropTarget(new DropTarget(this, DnDConstants.ACTION_MOVE, new FileDropTargetListener(), true));
closeMode = UIConstants.CLOSE_OF_AUTHORITY;
initMenuPane();
this.progressDialog = new ProgressDialog(this);
}
public void resizeFrame() {
@ -1264,23 +1261,15 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
}
}
@Deprecated
public ProgressDialog getProgressDialog() {
return progressDialog;
}
public void showProgressDialog() {
progressDialog.setVisible(true);
return new ProgressDialog(this);
}
/**
* 隐藏进度框
*/
public void hideProgressDialog() {
@Deprecated
public void openProgressDialog() {
progressDialog.setVisible(false);
}
/**
@ -1288,17 +1277,17 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
*
* @param progress 进度值
*/
@Deprecated
public void updateProgress(int progress) {
progressDialog.setProgressValue(progress);
}
/**
* 释放进度框
*/
@Deprecated
public void disposeProgressDialog() {
progressDialog.dispose();
}
/**
@ -1309,4 +1298,5 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
public boolean isDesignerOpened() {
return designerOpened;
}
}

21
designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java

@ -32,7 +32,7 @@ public class FineEmbedServerMonitor {
*/
private static final int STEP_HEARTBEAT = 40;
private static volatile FineEmbedServerMonitor monitor;
private static ProgressDialog progressBar = DesignerContext.getDesignerFrame().getProgressDialog();
private static ProgressDialog progressDialog = new ProgressDialog(DesignerContext.getDesignerFrame());
//由于默认值的字体不支持韩文,所以要对韩文单独生成字体
private FRFont font = null;
private static final int FONT_RGB = 333334;
@ -47,7 +47,7 @@ public class FineEmbedServerMonitor {
@Override
public void on(Event event, Null aNull) {
getInstance().reset();
DesignerContext.getDesignerFrame().hideProgressDialog();
progressDialog.dispose();
}
});
}
@ -64,7 +64,7 @@ public class FineEmbedServerMonitor {
}
public int getProgress() {
if (progress == progressBar.getProgressMaximum()) {
if (progress == progressDialog.getProgressMaximum()) {
return progress;
} else {
progress += STEP;
@ -73,7 +73,7 @@ public class FineEmbedServerMonitor {
}
public void setComplete() {
this.progress = progressBar.getProgressMaximum();
this.progress = progressDialog.getProgressMaximum();
}
public void reset() {
@ -81,7 +81,7 @@ public class FineEmbedServerMonitor {
}
public boolean isComplete() {
return this.progress >= progressBar.getProgressMaximum();
return this.progress >= progressDialog.getProgressMaximum();
}
public void monitor() {
@ -92,11 +92,12 @@ public class FineEmbedServerMonitor {
public void run() {
if (isComplete()) {
scheduler.shutdown();
DesignerContext.getDesignerFrame().hideProgressDialog();
progressDialog.dispose();
return;
}
if (!DesignerContext.getDesignerFrame().getProgressDialog().isVisible()) {
DesignerContext.getDesignerFrame().showProgressDialog();
if (!progressDialog.isVisible()) {
progressDialog = new ProgressDialog(DesignerContext.getDesignerFrame());
progressDialog.setVisible(true);
//如果为韩文则改变字体
LocaleCenter.buildAction(new LocaleAction() {
@Override
@ -105,9 +106,9 @@ public class FineEmbedServerMonitor {
}
}, SupportLocaleImpl.SUPPORT_KOREA);
String text = Toolkit.i18nText("Fine-Design_Basic_Loading_Embed_Server");
DesignerContext.getDesignerFrame().getProgressDialog().updateLoadingText(text, font);
progressDialog.updateLoadingText(text, font);
}
DesignerContext.getDesignerFrame().updateProgress(getProgress());
progressDialog.setProgressValue(getProgress());
}
}, 0, STEP_HEARTBEAT, TimeUnit.MILLISECONDS);

Loading…
Cancel
Save