Browse Source

Merge pull request #3391 in DESIGN/design from feature/10.0 to feature/x

* commit 'a159bab44e80c35eb5228e371afc72aa6b897d22':
  REPORT-47073 【冒烟】安装插件,本来应该在设计面板右侧显示的现在不显示了 【问题原因】在EastRegionContainerPane中会根据按钮的不同状态,切换其icon后缀,之前的是_normal.png/_disabled.png等,但是在换图标迭代中,主jar里的这部分图标都换成了svg,所以给后缀改成了_normal.svg等,但是某些插件中用的也是这个逻辑,但是插件中没有适配svg图标,所以会造成找不到图标,然后表现为图标显示为空白 【改动思路】在IconUtils中为这种类型的图标做适配,面对带明确后缀.svg的图标,如果没找到资源,就换成.png去获取图标
  REPORT-46971 release->final
  REPORT-46953 GeneralXMLTools 兼容处理
  无jira任务,单元测试误屏蔽
  REPORT-46971 设计面板-普通报表&决策报表-参数面板-插件类控件右侧第四个tab页悬浮时和设置页面上方均显示“组件设置”,应“控件设置”
  无jira任务,新增的方法代码合并重复
  REPORT-46892 切换目录有插件版本不匹配目录配置页面显示问题
  REPORT-46584 【10.0.13冒烟】设计器卡死
  REPORT-46892 【冒烟】切换到本地目录有插件版本不匹配时,远程配置页面会消失的比较慢
  REPORT-46585 fix 单个插件监听逻辑保持与之前一致
  REPORT-46585 切换工作目录时 先移除后添加插件监听
  REPORT-46285 jdk11-背景图标,有一点异常的红色显示 【问题原因】这个问题是由jdk差异造成的,前景色和背景色图标都是由上面的图标+下面的取色矩形组成,下面的取色矩形的位置由整个图标的宽高决定,而在jdk11下,拿到的宽高与jdk8一样,但是最终绘制出来的取色矩形会往左边偏移一点,大概是1px,而背景色图标之前下面的取色矩形初始为红色,在偏移了之后,绘制底下取色矩形不能完全覆盖初始红色,所以漏了一点出来,表现为异常的红色。 【改动思路】与产品确认后,决定先把背景色图标取色矩形设置为透明色,这样就不会漏出一点红色,而取色矩形绘制有点偏移的问题需要去改一下UIColorButton的UI,这个在换完相关图标后再统一修改比较好
  REPORT-45689 加上判空
  CHART-17822 设计器界面内的图形不小心切换到其他图形且不保存,点击撤销键没法返回到切换前的图形
  REPORT-46574 & REPORT-46813 & REPORT-46550
  无jira任务,新增的方法代码合并重复
  REPORT-45689 兼容空类型 无须填充面板
  REPORT-46679 jdk11-设计器内图标优化-目录树图标都模糊,尤其是刷新图标 【问题原因】svg图标漏传到release分支了,所以显示的是之前的png图,比较模糊 【改动思路】补充图标
  REPORT-46234 普通报表\聚合报表,点击para,上方是控件设置,但是下方是组件名称
  REPORT-46779REPORT-46779 修复参数面板高度为负导致前端显示异常的问题
persist/11.0
superman 4 years ago
parent
commit
f2cf418b33
  1. 7
      designer-base/src/main/java/com/fr/base/svg/IconUtils.java
  2. 18
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  3. 38
      designer-base/src/main/java/com/fr/design/PluginClassRefreshManager.java
  4. 3
      designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java
  5. 17
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java
  6. 39
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  7. 6
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileParamSettingPane.java
  8. 44
      designer-base/src/main/java/com/fr/env/PluginErrorRemindDialog.java
  9. 3
      designer-base/src/main/resources/com/fr/design/images/gui/color/background_normal.svg
  10. BIN
      designer-base/src/main/resources/com/fr/design/images/warnings/icon_WarningIcon_normal.png
  11. BIN
      designer-base/src/main/resources/com/fr/design/images/warnings/icon_WarningIcon_normal@2x.png
  12. 283
      designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java
  13. 310
      designer-base/src/test/java/com/fr/design/extra/PluginOperateUtilsTest.java
  14. 1
      designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java
  15. 10
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  16. 14
      designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java
  17. 8
      designer-form/src/main/java/com/fr/design/mainframe/widget/ui/WidgetBasicPropertyPaneFactory.java
  18. 5
      designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java
  19. 11
      designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java
  20. 50
      designer-realize/src/test/java/com/fr/start/module/DesignerWorkspaceProviderTest.java

7
designer-base/src/main/java/com/fr/base/svg/IconUtils.java

@ -35,7 +35,12 @@ public class IconUtils {
if (resource.contains(SUFFIX_SEPARATOR)) {
// 判断是否以.svg结尾
if (resource.endsWith(ICON_SUFFIX_SVG)) {
return SVGIcon.readSVGIcon(resource);
if (IOUtils.readResource(resource) != null) {
return SVGIcon.readSVGIcon(resource);
}
// 适配某些插件里是_normal.png、_selected.png的情况
String pngResource = resource.replace(ICON_SUFFIX_SVG, ICON_SUFFIX_PNG);
return IOUtils.readIcon(pngResource);
}
return IOUtils.readIcon(resource);
}

18
designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java

@ -146,7 +146,7 @@ public class EnvChangeEntrance {
template.refreshToolArea();
}
showServiceDialog(selectedEnv);
pluginErrorRemind(selectedEnv);
pluginErrorRemind();
} catch (WorkspaceAuthException | RegistEditionException e) {
// String title = Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Auth_Failed");
// String title = Toolkit.i18nText("Fine-Design_Basic_Lic_Does_Not_Support_Remote");
@ -302,17 +302,23 @@ public class EnvChangeEntrance {
/**
* 插件启动错误信息提示
* @param selectedEnv 选择的工作环境
*/
public void pluginErrorRemind(DesignerWorkspaceInfo selectedEnv) {
if (selectedEnv.getType() == DesignerWorkspaceType.Remote) {
public void pluginErrorRemind() {
if (!WorkContext.getCurrent().isLocal()) {
return;
}
String content = PluginErrorRemindHandler.pluginErrorContent();
if (StringUtils.isNotEmpty(content)) {
PluginErrorRemindDialog dialog = new PluginErrorRemindDialog(DesignerContext.getDesignerFrame(), content);
dialog.setVisible(true);
// 该操作需要在当前awt操作之后执行,使用SwingUtilities.invokeLater将其置于awt操作对列末尾
// 若使用UIUtil.invokeLaterIfNeeded,会立即执行,影响其他UI操作
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
PluginErrorRemindDialog dialog = new PluginErrorRemindDialog(DesignerContext.getDesignerFrame(), content);
dialog.setVisible(true);
}
});
}
}

38
designer-base/src/main/java/com/fr/design/PluginClassRefreshManager.java

@ -39,6 +39,23 @@ public class PluginClassRefreshManager {
}
};
private final PluginEventListener beforeAllPluginActive = new PluginEventListener() {
@Override
public void on(PluginEvent event) {
PluginListenerRegistration.getInstance().stopListen(pluginAfterRunEventListener);
}
};
private final PluginEventListener afterAllPluginsActive = new PluginEventListener() {
@Override
public void on(PluginEvent event) {
PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, pluginAfterRunEventListener);
if (DesignerLaunchStatus.getStatus() != DesignerLaunchStatus.WORKSPACE_INIT_COMPLETE) {
HistoryTemplateListCache.getInstance().reloadAllEditingTemplate();
}
}
};
public static PluginClassRefreshManager getInstance() {
return INSTANCE;
@ -50,29 +67,20 @@ public class PluginClassRefreshManager {
}
private PluginClassRefreshManager() {
PluginListenerRegistration.getInstance().listen(PluginEventType.BeforeAllActive, new PluginEventListener() {
@Override
public void on(PluginEvent event) {
removePluginListener();
}
});
PluginListenerRegistration.getInstance().listen(PluginEventType.AfterAllActive, new PluginEventListener() {
@Override
public void on(PluginEvent event) {
addPluginListener();
if (DesignerLaunchStatus.getStatus() != DesignerLaunchStatus.WORKSPACE_INIT_COMPLETE) {
HistoryTemplateListCache.getInstance().reloadAllEditingTemplate();
}
}
});
PluginListenerRegistration.getInstance().listen(PluginEventType.BeforeAllActive, beforeAllPluginActive);
PluginListenerRegistration.getInstance().listen(PluginEventType.AfterAllActive, afterAllPluginsActive);
}
public void removePluginListener() {
PluginListenerRegistration.getInstance().stopListen(this.pluginAfterRunEventListener);
PluginListenerRegistration.getInstance().stopListen(this.beforeAllPluginActive);
PluginListenerRegistration.getInstance().stopListen(this.afterAllPluginsActive);
}
public void addPluginListener() {
PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, this.pluginAfterRunEventListener);
PluginListenerRegistration.getInstance().listen(PluginEventType.BeforeAllActive, beforeAllPluginActive);
PluginListenerRegistration.getInstance().listen(PluginEventType.AfterAllActive, afterAllPluginsActive);
}
}

3
designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java

@ -166,6 +166,9 @@ public class UIModeControlContainer extends JLayeredPane {
}
// 拖动的距离,为正值表示往下拖动,为负值表示往上拖动
int deltaY = e.getY();
if (toolPaneY < 0) {
toolPaneY = 0;
}
toolPaneY += deltaY;
onResize(toolPaneY);
refreshContainer();

17
designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java

@ -99,7 +99,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
public enum PropertyMode {
REPORT, // 报表
REPORT_PARA, // 报表参数面板
REPORT_PARA_WIDGET, //报表参数面板中的控件
REPORT_PARA(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Settings")), // 报表参数面板
REPORT_FLOAT, // 报表悬浮元素
FORM(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Settings")), // 表单
FORM_REPORT, // 表单报表块
@ -272,27 +273,27 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
propertyItemMap = new LinkedHashMap<>(); // 有序map
// 单元格元素
PropertyItem cellElement = new PropertyItem(KEY_CELL_ELEMENT, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cell_Element"),
"cellelement", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART},
"cellelement", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART},
new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT});
// 单元格属性
PropertyItem cellAttr = new PropertyItem(KEY_CELL_ATTR, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cell_Attributes"),
"cellattr", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART},
"cellattr", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART},
new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT});
// 悬浮元素
PropertyItem floatElement = new PropertyItem(KEY_FLOAT_ELEMENT, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Float_Element"),
"floatelement", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART},
"floatelement", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART},
new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_FLOAT, PropertyMode.POLY_REPORT});
// 控件设置
PropertyItem widgetSettings = new PropertyItem(KEY_WIDGET_SETTINGS, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Settings"),
"widgetsettings", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.FORM, PropertyMode.POLY},
new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.FORM, PropertyMode.POLY_REPORT, PropertyMode.POLY_CHART});
"widgetsettings", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.FORM, PropertyMode.POLY},
new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.FORM, PropertyMode.POLY_REPORT, PropertyMode.POLY_CHART});
// 条件属性
PropertyItem conditionAttr = new PropertyItem(KEY_CONDITION_ATTR, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Condition_Attributes"),
"conditionattr", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART},
"conditionattr", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART},
new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT});
// 超级链接
PropertyItem hyperlink = new PropertyItem(KEY_HYPERLINK, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Hyperlink"),
"hyperlink", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART},
"hyperlink", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART},
new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_FLOAT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT});
// 组件库
PropertyItem widgetLib = new PropertyItem(KEY_WIDGET_LIB, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Library"),

39
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -47,7 +47,6 @@ import com.fr.design.menu.MenuDef;
import com.fr.design.menu.NameSeparator;
import com.fr.design.menu.ShortCut;
import com.fr.design.preview.PagePreview;
import com.fr.design.ui.util.UIUtil;
import com.fr.design.write.submit.DBManipulationInWidgetEventPane;
import com.fr.design.write.submit.DBManipulationPane;
import com.fr.event.EventDispatcher;
@ -80,6 +79,7 @@ import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JOptionPane;
import javax.swing.SwingWorker;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.undo.UndoManager;
import java.util.ArrayList;
@ -340,17 +340,34 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
public void refreshResource(FILE file) {
try {
this.template = JTemplateFactory.asIOFile(file, this.suffix());
setTarget(this.template);
// 先移除旧的。
removeCenterPane();
// 加入新的
addCenterPane();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception {
setTargetByFile(file);
return null;
}
@Override
public void done() {
try {
get();
// 先移除旧的。
removeCenterPane();
// 加入新的
addCenterPane();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}.execute();
}
private void setTargetByFile(FILE file) {
this.template = JTemplateFactory.asIOFile(file, this.suffix());
setTarget(this.template);
}
private void addCenterPane() {

6
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileParamSettingPane.java

@ -12,6 +12,7 @@ import com.fr.form.ui.mobile.MobileParamStyle;
import com.fr.general.ComparatorUtils;
import com.fr.report.ExtraReportClassManager;
import com.fr.report.fun.MobileParamStyleProvider;
import com.fr.report.mobile.EmptyMobileParamStyle;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
@ -103,7 +104,10 @@ public class MobileParamSettingPane extends BasicPane {
if (ComparatorUtils.equals(mobileParamStyle.disPlayName(), provider.displayName())) {
String displayName = provider.displayName();
paramStyleList.setSelectedIndex(i);
map.get(displayName).populateBean(mobileParamStyle);
// 如果是兼容空类型 无须填充面板
if (!(mobileParamStyle instanceof EmptyMobileParamStyle)) {
map.get(displayName).populateBean(mobileParamStyle);
}
card.show(right, displayName);
return;
}

44
designer-base/src/main/java/com/fr/env/PluginErrorRemindDialog.java vendored

@ -6,7 +6,6 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont;
import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import javax.swing.BorderFactory;
@ -14,52 +13,65 @@ import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextPane;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Locale;
/**
* 插件启动失败提示窗
*/
public class PluginErrorRemindDialog extends JDialog implements ActionListener {
public PluginErrorRemindDialog(Frame parent, String areaText) {
private static final String SIM_HEI = "SimHei";
public PluginErrorRemindDialog(Frame parent, String text) {
super(parent, true);
//上面的标签面板
JPanel topPanel = FRGUIPaneFactory.createBorderLayout_L_Pane();
JPanel imagePanel = new JPanel();
Icon icon = IOUtils.readIcon("com/fr/design/images/warnings/warning5.png");
Icon icon = IOUtils.readIcon("com/fr/design/images/warnings/icon_WarningIcon_normal.png");
JLabel imageLabel = new JLabel();
imageLabel.setIcon(icon);
imagePanel.add(imageLabel);
imagePanel.setPreferredSize(new Dimension(130, 100));
imagePanel.setPreferredSize(new Dimension(48, 48));
JPanel verticalPanel = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true);
JLabel label = new JLabel(Toolkit.i18nText("Fine-Design_Plugin_Error_Remind_Title"));
label.setFont(FRFont.getInstance().applySize(18).applyStyle(1));
label.setPreferredSize(new Dimension(650, 100));
label.setFont(FRFont.getInstance().applySize(16).applyName(SIM_HEI));
label.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20));
verticalPanel.add(label);
topPanel.add(imagePanel, BorderLayout.WEST);
topPanel.add(verticalPanel, BorderLayout.CENTER);
topPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10));
topPanel.setPreferredSize(new Dimension(600, 73));
topPanel.setBorder(BorderFactory.createEmptyBorder(10, 20, 0, 20));
//中间的文本域面板
JPanel centerPanel = FRGUIPaneFactory.createBorderLayout_L_Pane();
centerPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
centerPanel.setPreferredSize(new Dimension(480, 320));
centerPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10));
centerPanel.setPreferredSize(new Dimension(580, 269));
JTextPane textPane = new JTextPane();
SimpleAttributeSet attributeSet = new SimpleAttributeSet();
StyleConstants.setFontFamily(attributeSet, SIM_HEI);
StyleConstants.setLineSpacing(attributeSet, 0.5f);
textPane.setParagraphAttributes(attributeSet, true);
JTextArea checkArea = new JTextArea(areaText);
checkArea.setEnabled(false);
centerPanel.add(checkArea, BorderLayout.CENTER);
textPane.setEditable(false);
textPane.setMargin(new Insets(10, 10, 10, 10));
textPane.setText(text);
centerPanel.add(textPane, BorderLayout.CENTER);
UIButton cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Plugin_Error_Remind_Not_Deal_With"));
UIButton okButton = new UIButton(Toolkit.i18nText("Fine-Design_Plugin_Error_Remind_Deal_With"));
@ -69,7 +81,7 @@ public class PluginErrorRemindDialog extends JDialog implements ActionListener {
// 按钮
JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10));
buttonPanel.add(cancelButton);
buttonPanel.add(okButton);
@ -80,7 +92,7 @@ public class PluginErrorRemindDialog extends JDialog implements ActionListener {
this.add(topPanel, BorderLayout.NORTH);
this.add(centerPanel, BorderLayout.CENTER);
this.add(buttonPanel, BorderLayout.SOUTH);
this.setSize(new Dimension(GeneralContext.getLocale().equals(Locale.US) ? 750 : 600, 500));
this.setSize(new Dimension(600, 400));
GUICoreUtils.centerWindow(this);
}

3
designer-base/src/main/resources/com/fr/design/images/gui/color/background_normal.svg

@ -3,6 +3,5 @@
<title>icon_文本背景色_normal</title>
<g id="icon_文本背景色_normal" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M9,0 L8.9993,1.656 L11.3546845,4.01296053 C12.496044,4.07957725 16,4.48860182 16,7 C16,10 13,12 13,12 C13,12 13.4489375,10.2042499 12.842809,7.81595247 L7.6363,13.021 L1.9793,7.364 L4.9993,4.344 L5,0 L9,0 Z M7.9993,2.756 L3.3933,7.364 L7.6363,11.606 L12.5054659,6.73651111 C12.4728171,6.64900228 12.4386503,6.56099677 12.4029036,6.47254402 L8.9993,3.07 L9,6 L8,6 L7.9993,2.756 Z M7.9993,1 L5.9993,1 L5.9993,3.344 L7.9993,1.344 L7.9993,1 Z" id="Combined-Shape" fill="#333334"></path>
<rect id="Rectangle" fill="#F87777" x="0" y="12" width="16" height="4"></rect>
</g>
</svg>
</svg>

Before

Width:  |  Height:  |  Size: 938 B

After

Width:  |  Height:  |  Size: 850 B

BIN
designer-base/src/main/resources/com/fr/design/images/warnings/icon_WarningIcon_normal.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
designer-base/src/main/resources/com/fr/design/images/warnings/icon_WarningIcon_normal@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

283
designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java

@ -1,143 +1,140 @@
//package com.fr.design;
//
////import com.fr.decision.webservice.v10.plugin.helper.PluginErrorRemindHandler;
//import com.fr.design.env.DesignerWorkspaceInfo;
//import com.fr.design.env.DesignerWorkspaceType;
//import com.fr.design.env.LocalDesignerWorkspaceInfo;
//import com.fr.design.env.RemoteDesignerWorkspaceInfo;
//import com.fr.env.CheckServiceDialog;
//import com.fr.env.PluginErrorRemindDialog;
//import com.fr.invoke.Reflect;
//import com.fr.workspace.connect.WorkspaceConnectionInfo;
//import com.fr.workspace.engine.channel.http.FunctionalHttpRequest;
//import org.easymock.EasyMock;
//import org.junit.Assert;
//import org.junit.Test;
//import org.junit.runner.RunWith;
//import org.powermock.api.easymock.PowerMock;
//import org.powermock.core.classloader.annotations.PrepareForTest;
//import org.powermock.modules.junit4.PowerMockRunner;
//
//import java.awt.Frame;
//
///**
// * @author: Maksim
// * @Date: Created in 2020/3/5
// * @Description:
// */
//@RunWith(PowerMockRunner.class)
//@PrepareForTest({FunctionalHttpRequest.class,
// EnvChangeEntrance.class,
// CheckServiceDialog.class,
// DesignerEnvManager.class,
// PluginErrorRemindHandler.class})
//public class EnvChangeEntranceTest {
//
// @Test
// public void showServiceDialog() throws Exception {
// try {
// EnvChangeEntrance entrance = EnvChangeEntrance.getInstance();
// DesignerWorkspaceInfo selectedEnv = EasyMock.mock(DesignerWorkspaceInfo.class);
// WorkspaceConnectionInfo connectionInfo = EasyMock.mock(WorkspaceConnectionInfo.class);
//
// String remoteBranch = "Build#persist-2020.02.15.01.01.12.12";
// EasyMock.expect(selectedEnv.getConnection()).andReturn(connectionInfo);
// EasyMock.expect(selectedEnv.getType()).andReturn(DesignerWorkspaceType.Remote);
// EasyMock.expect(selectedEnv.getRemindTime()).andReturn(null);
//
// FunctionalHttpRequest request = EasyMock.mock(FunctionalHttpRequest.class);
// EasyMock.expect(request.getServiceList()).andReturn(null);
//
// PowerMock.expectNew(FunctionalHttpRequest.class, connectionInfo).andReturn(request).anyTimes();
// EasyMock.expect(request.getServerBranch()).andReturn(remoteBranch);
//
// CheckServiceDialog dialog = EasyMock.mock(CheckServiceDialog.class);
// PowerMock.expectNew(CheckServiceDialog.class, EasyMock.anyObject(Frame.class), EasyMock.anyString(), EasyMock.anyString(), EasyMock.anyString()).andReturn(dialog);
//
// EasyMock.replay(request, selectedEnv, connectionInfo);
// PowerMock.replayAll();
//
// entrance.showServiceDialog(selectedEnv);
//
// }catch (Exception e){
// Assert.fail();
// }
// }
//
// @Test
// public void testUpdateNotRememberPwdEnv() {
//
// DesignerEnvManager manager = new DesignerEnvManager();
//
// PowerMock.mockStatic(DesignerEnvManager.class);
// EasyMock.expect(DesignerEnvManager.getEnvManager()).andReturn(manager).anyTimes();
//
// PowerMock.replayAll();
//
// EnvChangeEntrance entrance = EnvChangeEntrance.getInstance();
//
// manager.putEnv("test1", RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", true)));
// manager.putEnv("test2", RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", false)));
// manager.putEnv("test3", LocalDesignerWorkspaceInfo.create("name", "path"));
//
// Reflect.on(entrance).call("updateNotRememberPwdEnv");
//
// Assert.assertEquals(manager.getWorkspaceInfo("test1").getConnection(), RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", true)).getConnection());
// Assert.assertEquals(manager.getWorkspaceInfo("test2").getConnection(), RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "", "", "", false)).getConnection());
// Assert.assertEquals(manager.getWorkspaceInfo("test3").getName(), "name");
// Assert.assertEquals(manager.getWorkspaceInfo("test3").getPath(), "path");
//
// PowerMock.verifyAll();
//
// }
//
// @Test
// public void testIsNotRememberPwd() {
// EnvChangeEntrance entrance = EnvChangeEntrance.getInstance();
//
// DesignerWorkspaceInfo info1 = RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", true));
// DesignerWorkspaceInfo info2 = RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "111", "", "", false));
// DesignerWorkspaceInfo info3 = LocalDesignerWorkspaceInfo.create("name", "path");
// DesignerWorkspaceInfo info4 = null;
//
// Assert.assertFalse(Reflect.on(entrance).call("isNotRememberPwd", info1).get());
// Assert.assertTrue(Reflect.on(entrance).call("isNotRememberPwd", info2).get());
// Assert.assertFalse(Reflect.on(entrance).call("isNotRememberPwd", info3).get());
// Assert.assertFalse(Reflect.on(entrance).call("isNotRememberPwd", info4).get());
// }
//
// @Test
// public void testPluginErrorRemind() throws Exception {
//
// try {
// DesignerWorkspaceInfo selectedEnv = EasyMock.mock(DesignerWorkspaceInfo.class);
// EasyMock.expect(selectedEnv.getType()).andReturn(DesignerWorkspaceType.Remote).once();
// EasyMock.expect(selectedEnv.getType()).andReturn(DesignerWorkspaceType.Local).times(2);
//
// PowerMock.mockStatic(PluginErrorRemindHandler.class);
// EasyMock.expect(PluginErrorRemindHandler.pluginErrorContent()).andReturn("").once();
// EasyMock.expect(PluginErrorRemindHandler.pluginErrorContent()).andReturn("111").once();
//
// PluginErrorRemindDialog dialog = EasyMock.mock(PluginErrorRemindDialog.class);
// PowerMock.expectNew(PluginErrorRemindDialog.class, EasyMock.anyObject(Frame.class), EasyMock.anyString()).andReturn(dialog).once();
//
// dialog.setVisible(true);
// EasyMock.expectLastCall();
//
// EasyMock.replay(selectedEnv, dialog);
// PowerMock.replayAll();
//
// EnvChangeEntrance entrance = EnvChangeEntrance.getInstance();
//
// entrance.pluginErrorRemind(selectedEnv);
// entrance.pluginErrorRemind(selectedEnv);
// entrance.pluginErrorRemind(selectedEnv);
//
//
// EasyMock.verify(selectedEnv, dialog);
// PowerMock.verifyAll();
// } catch (Exception e) {
// Assert.fail();
// }
// }
//}
package com.fr.design;
import com.fr.decision.webservice.v10.plugin.helper.PluginErrorRemindHandler;
import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.DesignerWorkspaceType;
import com.fr.design.env.LocalDesignerWorkspaceInfo;
import com.fr.design.env.RemoteDesignerWorkspaceInfo;
import com.fr.env.CheckServiceDialog;
import com.fr.env.PluginErrorRemindDialog;
import com.fr.invoke.Reflect;
import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace;
import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.engine.channel.http.FunctionalHttpRequest;
import org.easymock.EasyMock;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.easymock.PowerMock;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import java.awt.Frame;
/**
* @author: Maksim
* @Date: Created in 2020/3/5
* @Description:
*/
@RunWith(PowerMockRunner.class)
@PrepareForTest({FunctionalHttpRequest.class,
EnvChangeEntrance.class,
CheckServiceDialog.class,
DesignerEnvManager.class,
PluginErrorRemindHandler.class,
WorkContext.class})
public class EnvChangeEntranceTest {
@Test
public void showServiceDialog() throws Exception {
try {
EnvChangeEntrance entrance = EnvChangeEntrance.getInstance();
DesignerWorkspaceInfo selectedEnv = EasyMock.mock(DesignerWorkspaceInfo.class);
WorkspaceConnectionInfo connectionInfo = EasyMock.mock(WorkspaceConnectionInfo.class);
String remoteBranch = "Build#persist-2020.02.15.01.01.12.12";
EasyMock.expect(selectedEnv.getConnection()).andReturn(connectionInfo);
EasyMock.expect(selectedEnv.getType()).andReturn(DesignerWorkspaceType.Remote);
EasyMock.expect(selectedEnv.getRemindTime()).andReturn(null);
FunctionalHttpRequest request = EasyMock.mock(FunctionalHttpRequest.class);
EasyMock.expect(request.getServiceList()).andReturn(null);
PowerMock.expectNew(FunctionalHttpRequest.class, connectionInfo).andReturn(request).anyTimes();
EasyMock.expect(request.getServerBranch()).andReturn(remoteBranch);
CheckServiceDialog dialog = EasyMock.mock(CheckServiceDialog.class);
PowerMock.expectNew(CheckServiceDialog.class, EasyMock.anyObject(Frame.class), EasyMock.anyString(), EasyMock.anyString(), EasyMock.anyString()).andReturn(dialog);
EasyMock.replay(request, selectedEnv, connectionInfo);
PowerMock.replayAll();
entrance.showServiceDialog(selectedEnv);
}catch (Exception e){
Assert.fail();
}
}
@Test
public void testUpdateNotRememberPwdEnv() {
DesignerEnvManager manager = new DesignerEnvManager();
PowerMock.mockStatic(DesignerEnvManager.class);
EasyMock.expect(DesignerEnvManager.getEnvManager()).andReturn(manager).anyTimes();
PowerMock.replayAll();
EnvChangeEntrance entrance = EnvChangeEntrance.getInstance();
manager.putEnv("test1", RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", true)));
manager.putEnv("test2", RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", false)));
manager.putEnv("test3", LocalDesignerWorkspaceInfo.create("name", "path"));
Reflect.on(entrance).call("updateNotRememberPwdEnv");
Assert.assertEquals(manager.getWorkspaceInfo("test1").getConnection(), RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", true)).getConnection());
Assert.assertEquals(manager.getWorkspaceInfo("test2").getConnection(), RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "", "", "", false)).getConnection());
Assert.assertEquals(manager.getWorkspaceInfo("test3").getName(), "name");
Assert.assertEquals(manager.getWorkspaceInfo("test3").getPath(), "path");
PowerMock.verifyAll();
}
@Test
public void testIsNotRememberPwd() {
EnvChangeEntrance entrance = EnvChangeEntrance.getInstance();
DesignerWorkspaceInfo info1 = RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", true));
DesignerWorkspaceInfo info2 = RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "111", "", "", false));
DesignerWorkspaceInfo info3 = LocalDesignerWorkspaceInfo.create("name", "path");
DesignerWorkspaceInfo info4 = null;
Assert.assertFalse(Reflect.on(entrance).call("isNotRememberPwd", info1).get());
Assert.assertTrue(Reflect.on(entrance).call("isNotRememberPwd", info2).get());
Assert.assertFalse(Reflect.on(entrance).call("isNotRememberPwd", info3).get());
Assert.assertFalse(Reflect.on(entrance).call("isNotRememberPwd", info4).get());
}
@Test
public void testPluginErrorRemind() {
try {
Workspace workspace = EasyMock.mock(Workspace.class);
EasyMock.expect(workspace.isLocal()).andReturn(false).once();
EasyMock.expect(workspace.isLocal()).andReturn(true).once();
PowerMock.mockStatic(WorkContext.class);
EasyMock.expect(WorkContext.getCurrent()).andReturn(workspace).anyTimes();
PowerMock.mockStatic(PluginErrorRemindHandler.class);
EasyMock.expect(PluginErrorRemindHandler.pluginErrorContent()).andReturn("").once();
EasyMock.replay(workspace);
PowerMock.replayAll();
EnvChangeEntrance entrance = EnvChangeEntrance.getInstance();
entrance.pluginErrorRemind();
entrance.pluginErrorRemind();
EasyMock.verify(workspace);
PowerMock.verifyAll();
} catch (Exception e) {
Assert.fail();
}
}
}

310
designer-base/src/test/java/com/fr/design/extra/PluginOperateUtilsTest.java

@ -1,155 +1,155 @@
//package com.fr.design.extra;
//
//import com.fr.invoke.Reflect;
//import com.fr.json.JSONObject;
//import com.fr.plugin.context.PluginContext;
//import com.fr.plugin.context.PluginMarker;
//import com.fr.plugin.context.PluginMarkerAdapter;
//import com.fr.plugin.error.PluginErrorCode;
//import com.fr.plugin.manage.PluginManager;
//import com.fr.plugin.manage.control.PluginTask;
//import com.fr.plugin.manage.control.PluginTaskResult;
//import org.easymock.EasyMock;
//import org.junit.Assert;
//import org.junit.Test;
//import org.junit.runner.RunWith;
//import org.powermock.api.easymock.PowerMock;
//import org.powermock.core.classloader.annotations.PrepareForTest;
//import org.powermock.modules.junit4.PowerMockRunner;
//
//import java.util.ArrayList;
//import java.util.List;
//
///**
// * @author Lucian.Chen
// * @version 10.0
// * Created by Lucian.Chen on 2020/12/17
// */
//@RunWith(PowerMockRunner.class)
//@PrepareForTest({PluginManager.class, PluginUtils.class})
//public class PluginOperateUtilsTest {
//
// @Test
// public void testGetSuccessInfo() {
// PluginTaskResult pluginTaskResult = EasyMock.mock(PluginTaskResult.class);
// PluginTaskResult pluginTaskResult1 = EasyMock.mock(PluginTaskResult.class);
// PluginTaskResult pluginTaskResult2 = EasyMock.mock(PluginTaskResult.class);
//
// List<PluginTaskResult> pluginTaskResults1 = new ArrayList<>();
// pluginTaskResults1.add(pluginTaskResult1);
// List<PluginTaskResult> pluginTaskResults2 = new ArrayList<>();
// pluginTaskResults2.add(pluginTaskResult1);
// pluginTaskResults2.add(pluginTaskResult2);
//
// PluginMarker pluginMarker1 = PluginMarker.create("plugin-1", "1.0");
// PluginMarker pluginMarker2 = PluginMarkerAdapter.create("plugin-2", "2.0", "name-2");
// PluginTask pluginTask1 = PluginTask.installTask(pluginMarker1);
// PluginTask pluginTask2 = PluginTask.installTask(pluginMarker2);
//
// EasyMock.expect(pluginTaskResult.asList()).andReturn(pluginTaskResults1).times(2);
// EasyMock.expect(pluginTaskResult.asList()).andReturn(pluginTaskResults2).times(2);
// EasyMock.expect(pluginTaskResult1.getCurrentTask()).andReturn(pluginTask1).anyTimes();
// EasyMock.expect(pluginTaskResult2.getCurrentTask()).andReturn(pluginTask2).anyTimes();
//
// EasyMock.expect(pluginTaskResult1.errorCode()).andReturn(PluginErrorCode.BelowSystem).anyTimes();
// EasyMock.expect(pluginTaskResult2.errorCode()).andReturn(PluginErrorCode.BeyondSystem).anyTimes();
//
// PluginContext plugin1 = EasyMock.mock(PluginContext.class);
// PluginContext plugin2 = EasyMock.mock(PluginContext.class);
// EasyMock.expect(plugin1.getName()).andReturn("context-1").anyTimes();
// EasyMock.expect(plugin2.getName()).andReturn("context-2").anyTimes();
// PowerMock.mockStatic(PluginManager.class);
// EasyMock.expect(PluginManager.getContext(pluginMarker1.getPluginID()))
// .andReturn(plugin1).once().andReturn(null).once().andReturn(plugin1).once().andReturn(null).once();
// EasyMock.expect(PluginManager.getContext(pluginMarker2.getPluginID()))
// .andReturn(plugin2).once().andReturn(null).once();
//
// EasyMock.replay(pluginTaskResult, pluginTaskResult1, pluginTaskResult2, plugin1, plugin2);
// PowerMock.replayAll();
//
// // 1个
// Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "context-1Fine-Core_Plugin_Error_BelowSystem");
// Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "plugin-1Fine-Core_Plugin_Error_BelowSystem");
//
//
// // 2个
// Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "context-1Fine-Core_Plugin_Error_BelowSystem\ncontext-2Fine-Core_Plugin_Error_BeyondSystem");
// Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "plugin-1Fine-Core_Plugin_Error_BelowSystem\nname-2Fine-Core_Plugin_Error_BeyondSystem");
//
// EasyMock.verify(pluginTaskResult, pluginTaskResult1, pluginTaskResult2, plugin1, plugin2);
// PowerMock.verifyAll();
//
// }
//
//
// @Test
// public void testGetPluginName() {
// PluginContext pluginContext = EasyMock.mock(PluginContext.class);
// EasyMock.expect(pluginContext.getName()).andReturn("pluginContext").once();
//
// PluginMarker pluginMarker1 = PluginMarker.create("id-1", "1");
// PluginMarker pluginMarker2 = PluginMarkerAdapter.create("id-2", "2", "name-2");
//
// EasyMock.replay(pluginContext);
//
// Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", null, null).get(), "");
// Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", pluginContext, pluginMarker1).get(), "pluginContext");
// Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", null, pluginMarker1).get(), "id-1");
// Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", null, pluginMarker2).get(), "name-2");
//
// EasyMock.verify(pluginContext);
// }
//
// @Test
// public void testUpdateMarker2Online() {
//
// try {
// PluginMarker pluginMarker = PluginMarker.create("plugin-1", "1.0");
// String pluginJson = "{\"id\": plugin-1,\"name\": \"图表(新特性)\",\"version\": \"8.6.16\"}";
// JSONObject object = new JSONObject(pluginJson);
//
// PowerMock.mockStatic(PluginUtils.class);
// EasyMock.expect(PluginUtils.getLatestPluginInfo("plugin-1")).andReturn(object).once();
// EasyMock.expect(PluginUtils.getLatestPluginInfo("plugin-1")).andThrow(new NullPointerException()).once();
//
// PowerMock.replayAll();
//
// PluginMarker marker1 = PluginOperateUtils.updateMarker2Online(pluginMarker);
// PluginMarker marker2 = PluginOperateUtils.updateMarker2Online(pluginMarker);
//
// Assert.assertTrue(marker1 instanceof PluginMarkerAdapter);
// Assert.assertEquals(marker1.getPluginID(), "plugin-1");
// Assert.assertEquals(marker1.getVersion(), "1.0");
// Assert.assertEquals(((PluginMarkerAdapter) marker1).getPluginName(), "图表(新特性)");
// Assert.assertEquals(marker2, pluginMarker);
//
// PowerMock.verifyAll();
// } catch (Exception e) {
// Assert.fail();
// }
//
// }
//
//
// @Test
// public void testUpdatePluginOnline() {
// try {
// PluginMarker pluginMarker = PluginMarker.create("plugin-1", "1.0");
// String pluginJson = "{\"id\": plugin-1,\"name\": \"图表(新特性)\",\"version\": \"8.6.16\"}";
// JSONObject object = new JSONObject(pluginJson);
//
// PowerMock.mockStatic(PluginUtils.class);
// EasyMock.expect(PluginUtils.getLatestPluginInfo("plugin-1")).andReturn(object).once();
// EasyMock.expect(PluginUtils.getInstalledPluginMarkerByID("plugin-1")).andReturn(pluginMarker).once();
//
// PowerMock.replayAll();
//
// PluginOperateUtils.updatePluginOnline(pluginMarker, null);
//
// PowerMock.verifyAll();
// } catch (Exception e) {
// Assert.fail();
// }
// }
//
//}
package com.fr.design.extra;
import com.fr.invoke.Reflect;
import com.fr.json.JSONObject;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.context.PluginMarkerAdapter;
import com.fr.plugin.error.PluginErrorCode;
import com.fr.plugin.manage.PluginManager;
import com.fr.plugin.manage.control.PluginTask;
import com.fr.plugin.manage.control.PluginTaskResult;
import org.easymock.EasyMock;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.easymock.PowerMock;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import java.util.ArrayList;
import java.util.List;
/**
* @author Lucian.Chen
* @version 10.0
* Created by Lucian.Chen on 2020/12/17
*/
@RunWith(PowerMockRunner.class)
@PrepareForTest({PluginManager.class, PluginUtils.class})
public class PluginOperateUtilsTest {
@Test
public void testGetSuccessInfo() {
PluginTaskResult pluginTaskResult = EasyMock.mock(PluginTaskResult.class);
PluginTaskResult pluginTaskResult1 = EasyMock.mock(PluginTaskResult.class);
PluginTaskResult pluginTaskResult2 = EasyMock.mock(PluginTaskResult.class);
List<PluginTaskResult> pluginTaskResults1 = new ArrayList<>();
pluginTaskResults1.add(pluginTaskResult1);
List<PluginTaskResult> pluginTaskResults2 = new ArrayList<>();
pluginTaskResults2.add(pluginTaskResult1);
pluginTaskResults2.add(pluginTaskResult2);
PluginMarker pluginMarker1 = PluginMarker.create("plugin-1", "1.0");
PluginMarker pluginMarker2 = PluginMarkerAdapter.create("plugin-2", "2.0", "name-2");
PluginTask pluginTask1 = PluginTask.installTask(pluginMarker1);
PluginTask pluginTask2 = PluginTask.installTask(pluginMarker2);
EasyMock.expect(pluginTaskResult.asList()).andReturn(pluginTaskResults1).times(2);
EasyMock.expect(pluginTaskResult.asList()).andReturn(pluginTaskResults2).times(2);
EasyMock.expect(pluginTaskResult1.getCurrentTask()).andReturn(pluginTask1).anyTimes();
EasyMock.expect(pluginTaskResult2.getCurrentTask()).andReturn(pluginTask2).anyTimes();
EasyMock.expect(pluginTaskResult1.errorCode()).andReturn(PluginErrorCode.BelowSystem).anyTimes();
EasyMock.expect(pluginTaskResult2.errorCode()).andReturn(PluginErrorCode.BeyondSystem).anyTimes();
PluginContext plugin1 = EasyMock.mock(PluginContext.class);
PluginContext plugin2 = EasyMock.mock(PluginContext.class);
EasyMock.expect(plugin1.getName()).andReturn("context-1").anyTimes();
EasyMock.expect(plugin2.getName()).andReturn("context-2").anyTimes();
PowerMock.mockStatic(PluginManager.class);
EasyMock.expect(PluginManager.getContext(pluginMarker1.getPluginID()))
.andReturn(plugin1).once().andReturn(null).once().andReturn(plugin1).once().andReturn(null).once();
EasyMock.expect(PluginManager.getContext(pluginMarker2.getPluginID()))
.andReturn(plugin2).once().andReturn(null).once();
EasyMock.replay(pluginTaskResult, pluginTaskResult1, pluginTaskResult2, plugin1, plugin2);
PowerMock.replayAll();
// 1个
Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "context-1Fine-Core_Plugin_Error_BelowSystem");
Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "plugin-1Fine-Core_Plugin_Error_BelowSystem");
// 2个
Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "context-1Fine-Core_Plugin_Error_BelowSystem\ncontext-2Fine-Core_Plugin_Error_BeyondSystem");
Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "plugin-1Fine-Core_Plugin_Error_BelowSystem\nname-2Fine-Core_Plugin_Error_BeyondSystem");
EasyMock.verify(pluginTaskResult, pluginTaskResult1, pluginTaskResult2, plugin1, plugin2);
PowerMock.verifyAll();
}
@Test
public void testGetPluginName() {
PluginContext pluginContext = EasyMock.mock(PluginContext.class);
EasyMock.expect(pluginContext.getName()).andReturn("pluginContext").once();
PluginMarker pluginMarker1 = PluginMarker.create("id-1", "1");
PluginMarker pluginMarker2 = PluginMarkerAdapter.create("id-2", "2", "name-2");
EasyMock.replay(pluginContext);
Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", null, null).get(), "");
Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", pluginContext, pluginMarker1).get(), "pluginContext");
Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", null, pluginMarker1).get(), "id-1");
Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", null, pluginMarker2).get(), "name-2");
EasyMock.verify(pluginContext);
}
@Test
public void testUpdateMarker2Online() {
try {
PluginMarker pluginMarker = PluginMarker.create("plugin-1", "1.0");
String pluginJson = "{\"id\": plugin-1,\"name\": \"图表(新特性)\",\"version\": \"8.6.16\"}";
JSONObject object = new JSONObject(pluginJson);
PowerMock.mockStatic(PluginUtils.class);
EasyMock.expect(PluginUtils.getLatestPluginInfo("plugin-1")).andReturn(object).once();
EasyMock.expect(PluginUtils.getLatestPluginInfo("plugin-1")).andThrow(new NullPointerException()).once();
PowerMock.replayAll();
PluginMarker marker1 = PluginOperateUtils.updateMarker2Online(pluginMarker);
PluginMarker marker2 = PluginOperateUtils.updateMarker2Online(pluginMarker);
Assert.assertTrue(marker1 instanceof PluginMarkerAdapter);
Assert.assertEquals(marker1.getPluginID(), "plugin-1");
Assert.assertEquals(marker1.getVersion(), "1.0");
Assert.assertEquals(((PluginMarkerAdapter) marker1).getPluginName(), "图表(新特性)");
Assert.assertEquals(marker2, pluginMarker);
PowerMock.verifyAll();
} catch (Exception e) {
Assert.fail();
}
}
@Test
public void testUpdatePluginOnline() {
try {
PluginMarker pluginMarker = PluginMarker.create("plugin-1", "1.0");
String pluginJson = "{\"id\": plugin-1,\"name\": \"图表(新特性)\",\"version\": \"8.6.16\"}";
JSONObject object = new JSONObject(pluginJson);
PowerMock.mockStatic(PluginUtils.class);
EasyMock.expect(PluginUtils.getLatestPluginInfo("plugin-1")).andReturn(object).once();
EasyMock.expect(PluginUtils.getInstalledPluginMarkerByID("plugin-1")).andReturn(pluginMarker).once();
PowerMock.replayAll();
PluginOperateUtils.updatePluginOnline(pluginMarker, null);
PowerMock.verifyAll();
} catch (Exception e) {
Assert.fail();
}
}
}

1
designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java

@ -55,7 +55,6 @@ public interface LayoutAdapter {
*/
boolean addBean(XCreator creator, int x, int y, boolean accept);
/**
* 返回该布局管理适配器的Painter为容器提供放置位置的标识
*/

10
designer-form/src/main/java/com/fr/design/mainframe/JForm.java

@ -97,6 +97,7 @@ import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import javax.swing.tree.TreePath;
public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<Form> {
private static final String FORM_CARD = "FORM";
@ -623,6 +624,15 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
this.formDesign.getSelectionModel().setSelectedCreators(FormSelectionUtils.rebuildSelection(formDesign.getRootComponent(),
formDesign.getRootComponent() == selectedBodyLayout() ? u.getSelectWidgets() : new Widget[]{selectedBodyLayout().toData()}));
refreshToolArea();
// 停止编辑 恢复浮层展示
TreePath[] treePaths = FormHierarchyTreePane.getInstance(formDesign).getComponentTree().getSelectedTreePath();
if (treePaths != null) {
for (TreePath path : treePaths) {
if (path != null) {
formDesign.stopEditing(path);
}
}
}
} else {
// 只在报表块里撤销是不需要修改外部form对象的, 因为编辑的是当前报表块.
// 修改了JForm的Target需要同步修改formDesign的Target.

14
designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java

@ -14,13 +14,16 @@ import com.fr.design.designer.creator.XWTitleLayout;
import com.fr.design.designer.creator.cardlayout.XWCardTagLayout;
import com.fr.design.dialog.AttrScrollPane;
import com.fr.design.dialog.BasicScrollPane;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.JForm;
import com.fr.design.widget.DataModify;
import com.fr.design.widget.FormWidgetDefinePaneFactoryBase;
import com.fr.design.widget.Operator;
@ -147,6 +150,7 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
}
};
freshPropertyMode(innerCreator);
if (isExtraWidget) {
return;
}
@ -159,6 +163,16 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
}
private static void freshPropertyMode(XCreator xCreator) {
if (!(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate() instanceof JForm)) {
if (xCreator instanceof XWParameterLayout) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_PARA);
} else {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_PARA_WIDGET);
}
}
}
private void initDefinePane() {
currentEditorDefinePane = null;
XCreator creator = getXCreatorDedicated();

8
designer-form/src/main/java/com/fr/design/mainframe/widget/ui/WidgetBasicPropertyPaneFactory.java

@ -7,13 +7,13 @@ import com.fr.design.designer.creator.XCreator;
*/
public class WidgetBasicPropertyPaneFactory {
public static FormBasicPropertyPane createBasicPropertyPane(XCreator xCreator){
if(xCreator.supportSetVisible() && xCreator.supportSetEnable()){
public static FormBasicPropertyPane createBasicPropertyPane(XCreator xCreator) {
if (xCreator.supportSetVisible() && xCreator.supportSetEnable()) {
return new FormBasicWidgetPropertyPane();
}
if(xCreator.supportSetVisible()){
if (xCreator.supportSetVisible()) {
return new BasicSetVisiblePropertyPane();
}else{
} else {
return new FormBasicPropertyPane();
}

5
designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

@ -99,7 +99,6 @@ import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.report.cell.painter.BiasTextPainter;
import com.fr.report.cell.painter.CellImagePainter;
import com.fr.stable.ArrayUtils;
import com.fr.stable.EssentialUtils;
import com.fr.stable.ParameterProvider;
import com.fr.stable.bridge.StableFactory;
import com.fr.stable.os.support.OSBasedAction;
@ -192,8 +191,8 @@ public class DesignerActivator extends Activator {
justStartModules4Designer();
CalculatorProviderContext.setValueConverter(valueConverter());
EssentialUtils.Object_Tokenizer = startXMLReadObjectTokenizer();
EssentialUtils.Object_XML_Writer_Finder = startObjectXMLWriterFinder();
GeneralXMLTools.Object_Tokenizer = startXMLReadObjectTokenizer();
GeneralXMLTools.Object_XML_Writer_Finder = startObjectXMLWriterFinder();
addAdapterForPlate();
designerRegister();

11
designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java

@ -71,7 +71,6 @@ public class DesignerWorkspaceProvider extends Activator {
} catch (Exception e) {
FineLoggerFactory.getLogger().warn("Check Service Failed");
}
EnvChangeEntrance.getInstance().pluginErrorRemind(selectEnv);
}
});
}
@ -88,6 +87,16 @@ public class DesignerWorkspaceProvider extends Activator {
EnvChangeEntrance.getInstance().dealEvnExceptionWhenStartDesigner();
}
}
pluginErrorRemind();
}
private void pluginErrorRemind() {
EventDispatcher.listen(DesignerLaunchStatus.STARTUP_COMPLETE, new Listener<Null>() {
@Override
public void on(Event event, Null aNull) {
EnvChangeEntrance.getInstance().pluginErrorRemind();
}
});
}
@Override

50
designer-realize/src/test/java/com/fr/start/module/DesignerWorkspaceProviderTest.java

@ -0,0 +1,50 @@
package com.fr.start.module;
import com.fr.design.constants.DesignerLaunchStatus;
import com.fr.event.EventDispatcher;
import com.fr.invoke.Reflect;
import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace;
import org.easymock.EasyMock;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.easymock.PowerMock;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
/**
* @author Lucian.Chen
* @version 10.0
* Created by Lucian.Chen on 2021/1/7
*/
@RunWith(PowerMockRunner.class)
@PrepareForTest({WorkContext.class})
public class DesignerWorkspaceProviderTest {
@Test
public void testPluginErrorRemind() {
try {
Workspace workspace = EasyMock.mock(Workspace.class);
EasyMock.expect(workspace.isLocal()).andReturn(false).once();
PowerMock.mockStatic(WorkContext.class);
EasyMock.expect(WorkContext.getCurrent()).andReturn(workspace).anyTimes();
EasyMock.replay(workspace);
PowerMock.replayAll();
DesignerWorkspaceProvider provider = new DesignerWorkspaceProvider();
Reflect.on(provider).call("pluginErrorRemind");
EventDispatcher.fire(DesignerLaunchStatus.STARTUP_COMPLETE);
EasyMock.verify(workspace);
PowerMock.verifyAll();
} catch (Exception e) {
Assert.fail(e.getMessage());
}
}
}
Loading…
Cancel
Save