Browse Source

Merge pull request #10745 in DESIGN/design from bugfix/11.0 to feature/x

* commit 'c69a1a91253ca5cc5901ab6186ec37b4429b8d07':
  REPORT-84427 【查找与替换】切换查找内容会出现无法定位的情况(特殊场景)
  REPORT-85210 && REPORT-85293 1-加载条样式优化 2-启动异常报错优化 3-给异步加载 envmanager 提供配置
  REPORT-84407 修改隐藏面板时组件的宽度、高度
  REPORT-84407 设计面板-单元格元素,国际化显示 【问题原因】UIlabel高度被默认增加3 【改动思路】UIlabel高度减少3 【review建议】无
feature/x
superman 2 years ago
parent
commit
f204f8c23c
  1. 52
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 4
      designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java
  3. 14
      designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java
  4. 55
      designer-base/src/test/java/com/fr/design/gui/iprogressbar/ProgressDialogTest.java
  5. 2
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceSouthPanel.java
  6. 13
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableButton.java
  7. 2
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditor.java
  8. 14
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java
  9. 9
      designer-realize/src/main/java/com/fr/quickeditor/CellQuickEditor.java
  10. 6
      designer-realize/src/main/java/com/fr/start/module/optimized/DesignerStartupPageActivator.java

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

@ -4,6 +4,7 @@
package com.fr.design;
import com.fr.base.BaseXMLUtils;
import com.fr.base.OptimizeUtil;
import com.fr.base.Utils;
import com.fr.collections.api.Callback;
import com.fr.design.actions.help.alphafine.AlphaFineConfigManager;
@ -95,6 +96,7 @@ import java.util.ListIterator;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* The manager of Designer GUI.
@ -263,19 +265,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
designerEnvManager = new DesignerEnvManager();
//REPORT-15332有一个国际化调用比较早,需要在这边就设置好locale,由于后台GeneralContext默认是China
GeneralContext.setLocale(designerEnvManager.getLanguage());
try {
designerEnvManager.initElements(designerEnvManager.getDesignerEnvFile());
} catch (Exception retryEx) {
FineLoggerFactory.getLogger().debug("try async init DesignerEnvManager failed", retryEx);
try {
XMLTools.readFileXML(designerEnvManager, designerEnvManager.getDesignerEnvFile());
} catch (FileNotFoundException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
XmlHandler.Self.handle(e);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
if (!asyncInitEnvManager()) {
// 如果异步读取失败, 则恢复原来的逻辑
compatibleInitEnvManager();
}
// james:如果没有env定义,要设置一个默认的
@ -292,6 +285,39 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
return designerEnvManager;
}
private static void compatibleInitEnvManager() {
try {
XMLTools.readFileXML(designerEnvManager, designerEnvManager.getDesignerEnvFile());
} catch (FileNotFoundException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
XmlHandler.Self.handle(e);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
/**
* 异步初始化环境管理, 提供配置, 帮助处理预期外的问题
* 1-当优化开启时才走异步逻辑
* 2-如果异步执行中出错则返回异常 false, 否则返回 true
*
* @return /
*/
private static boolean asyncInitEnvManager() {
AtomicBoolean noEx = new AtomicBoolean(false);
OptimizeUtil.open(DesignerEnvManager.class.getSimpleName().toLowerCase(), OptimizeUtil.Module.COMMON, () -> {
try {
designerEnvManager.initElements(designerEnvManager.getDesignerEnvFile());
noEx.set(true);
} catch (Throwable retryEx) {
FineLoggerFactory.getLogger().debug("try async init DesignerEnvManager failed", retryEx);
}
});
return noEx.get();
}
public ColorSelectConfigManager getColorConfigManager() {
return this.configManager;

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

@ -20,6 +20,10 @@ import java.awt.Frame;
/**
* 加载进度弹窗
* <em>使用注意点:</em>
* 1-需要等到 父frame 启动好之后才能启动进度条
* 2-或者到使用时再初始化不要作为属性存在
* {@link com.fr.design.gui.iprogressbar.ProgressDialogTest}
*/
public class ProgressDialog extends UIDialog {
protected static final FRFont font = DesignUtils

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

@ -91,8 +91,6 @@ public class StartupPageWindow extends JFrame {
initCenter(pageModel);
loadingPanel = new StartupLoadingPanel(this);
// Workspace-detail
setSize(SCREEN_SIZE);
setDefaultTitle();
@ -103,7 +101,10 @@ public class StartupPageWindow extends JFrame {
revalidate();
setFullScreen();
// 必须放最后
// 见 https://work.fineres.com/browse/REPORT-85293
loadingPanel = new StartupLoadingPanel(this);
}
private void initCenter(StartupPageModel pageModel) {
@ -230,7 +231,11 @@ public class StartupPageWindow extends JFrame {
private void enterWorkspace(Runnable action) {
loadingPanel.show();
UIUtil.invokeAndWaitIfNeeded(() -> {
loadingPanel.show();
setEnabled(false);
});
SwingWorker<Void, Void> task = new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception {
@ -257,6 +262,7 @@ public class StartupPageWindow extends JFrame {
.modal(false)
.build()
.setVisible(true);
setEnabled(true);
});
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} finally {

55
designer-base/src/test/java/com/fr/design/gui/iprogressbar/ProgressDialogTest.java

@ -0,0 +1,55 @@
package com.fr.design.gui.iprogressbar;
import com.fr.design.utils.DevUtils;
import java.awt.Dimension;
import java.awt.Frame;
import java.util.function.Consumer;
/**
* @author Harrison
* @version 11.0
* Created by Harrison on 2022/11/23
*/
public class ProgressDialogTest {
public static void main(String[] args) {
mockInitSize();
}
/**
* 模拟 frame 的大小未初始化好的情况
*/
private static void mockNotInitSize() {
DevUtils.show(new Consumer<Frame>() {
@Override
public void accept(Frame frame) {
Dimension origin = frame.getSize();
frame.setSize(0, 0);
ProgressDialog progressDialog = new ProgressDialog(frame);
progressDialog.setVisible(true);
progressDialog.updateLoadingText("test");
frame.setSize(origin);
}
});
}
/**
* 模拟 frame 的大小初始化好的情况
*/
private static void mockInitSize() {
DevUtils.show(new Consumer<Frame>() {
@Override
public void accept(Frame frame) {
ProgressDialog progressDialog = new ProgressDialog(frame);
progressDialog.setVisible(true);
progressDialog.updateLoadingText("test");
}
});
}
}

2
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceSouthPanel.java

@ -29,7 +29,7 @@ public class ITReplaceSouthPanel {
RowSorter<ITTableEditor> sorter = new TableRowSorter<ITTableEditor>(itTableEditor) {
@Override
public boolean isSortable(int column) {
return column != CHECKBOX_INDEX || column != CONTENT_INDEX;
return column != CHECKBOX_INDEX && column != CONTENT_INDEX;
}
};
tableEditorPane.getEditTable().setRowSorter(sorter);

13
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableButton.java

@ -38,19 +38,6 @@ public class ITTableButton extends AbstractCellEditor implements TableCellEditor
paraButton = new UIButton("<html><font color = 'rgb(61,153,249)'>" + Toolkit.i18nText("Fine-Design_Chart_Location") + "</font> ");
paraButton.setVisible(true);
paraButton.setBorderPainted(false);
paraButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ITContent content = (ITContent) getEditTable().getValueAt(getEditTable().getEditingRow(), ITReplaceSouthPanel.CONTENT_INDEX);
if (StringUtils.isNotEmpty(GeneralUtils.objectToString(content.getTrlString()))) {
ITReplaceMainDialog.setITReplaceFlag(true);
TRL trl = new TRL(GeneralUtils.objectToString(content.getTrlString()));
DesignerContext.getDesignerFrame().openOrActiveTemplate(content.getTemplatePath());
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().navigate(trl);
}
ITReplaceMainDialog.setITReplaceFlag(false);
}
});
}

2
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditor.java

@ -94,7 +94,7 @@ public class ITTableEditor extends UITableModelAdapter {
*/
@Override
public boolean isCellEditable(int row, int col) {
return col == ITReplaceSouthPanel.CONTENT_INDEX || col == ITReplaceSouthPanel.CHECKBOX_INDEX;
return col == ITReplaceSouthPanel.CHECKBOX_INDEX;
}
/**

14
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java

@ -1,17 +1,21 @@
package com.fr.design.actions.replace.ui;
import com.fr.base.TRL;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itableeditorpane.UITableEditAction;
import com.fr.design.gui.itableeditorpane.UITableModelAdapter;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.share.ui.base.MouseClickListener;
import com.fr.general.GeneralUtils;
import com.fr.stable.StringUtils;
@ -75,6 +79,16 @@ public class ITTableEditorPane<T> extends BasicPane {
//改变面板的各个状态
changeComponentStatus(content, row, col);
}
if (col == ITReplaceSouthPanel.CONTENT_INDEX) {
ITContent content = (ITContent) editTable.getValueAt(row, ITReplaceSouthPanel.CONTENT_INDEX);
if (StringUtils.isNotEmpty(GeneralUtils.objectToString(content.getTrlString()))) {
ITReplaceMainDialog.setITReplaceFlag(true);
TRL trl = new TRL(GeneralUtils.objectToString(content.getTrlString()));
DesignerContext.getDesignerFrame().openOrActiveTemplate(content.getTemplatePath());
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().navigate(trl);
}
ITReplaceMainDialog.setITReplaceFlag(false);
}
}
});

9
designer-realize/src/main/java/com/fr/quickeditor/CellQuickEditor.java

@ -58,6 +58,9 @@ import java.util.Set;
public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
protected static final Dimension LABEL_DIMENSION = new Dimension(GraphHelper.getWidth(Toolkit.i18nText("Fine-Design_Report_Insert_Cell_Element")), 20);
// 使用UILabel.getPreferredSize时,若文本为html高度被默认增加3
protected static final Dimension HIDDEN_LABEL_DIMENSION = new Dimension(0, -3);
protected static final int VGAP = 10, HGAP = 8, VGAP_INNER = 3;
/**
@ -285,10 +288,10 @@ public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
if (selectedOneCell) {
columnRowTextField.setPreferredSize(null);
cellLabel.setPreferredSize(null);
multipleLabelTip.setPreferredSize(new Dimension());
multipleLabelTip.setPreferredSize(HIDDEN_LABEL_DIMENSION);
} else {
columnRowTextField.setPreferredSize(new Dimension());
cellLabel.setPreferredSize(new Dimension());
columnRowTextField.setPreferredSize(HIDDEN_LABEL_DIMENSION);
cellLabel.setPreferredSize(HIDDEN_LABEL_DIMENSION);
multipleLabelTip.setPreferredSize(null);
}
}

6
designer-realize/src/main/java/com/fr/start/module/optimized/DesignerStartupPageActivator.java

@ -149,7 +149,11 @@ public class DesignerStartupPageActivator extends Activator {
StopWatch stopWatch = StopWatch.createStarted();
try {
DesignerStartupContext.getRecorder().resume();
StopWatch recorder = DesignerStartupContext.getRecorder();
if (recorder.isSuspended()) {
recorder.resume();
}
// 等待中切换
DesignerStartupContext.getInstance().setOnWaiting(false);

Loading…
Cancel
Save