From 684b47e4c1ec7989fb59c642ac36aaab5c798b6d Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Mon, 6 Aug 2018 11:00:04 +0800 Subject: [PATCH 1/6] REPORT-10385 --- .../com/fr/start/module/DesignerWorkspaceProvider.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java index bfcb4fefeb..aae7bb2cd2 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java @@ -2,12 +2,16 @@ package com.fr.start.module; import com.fr.design.DesignerEnvManager; import com.fr.design.env.DesignerWorkspaceGenerator; +import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.mainframe.TemplatePane; import com.fr.general.ComparatorUtils; import com.fr.module.Activator; +import com.fr.stable.StableUtils; import com.fr.workspace.WorkContext; import com.fr.workspace.Workspace; +import java.io.File; + /** * Created by juhaoyu on 2018/1/8. * 设计器启动时的环境相关模块activator @@ -24,8 +28,10 @@ public class DesignerWorkspaceProvider extends Activator { } else { try { String current = DesignerEnvManager.getEnvManager().getCurEnvName(); - Workspace workspace = DesignerWorkspaceGenerator.generate(DesignerEnvManager.getEnvManager().getWorkspaceInfo(current)); - if (workspace == null) { + DesignerWorkspaceInfo workspaceInfo = DesignerEnvManager.getEnvManager().getWorkspaceInfo(current); + Workspace workspace = DesignerWorkspaceGenerator.generate(workspaceInfo); + boolean checkValid = workspace == null ? false : workspaceInfo.checkValid(); + if (!checkValid) { TemplatePane.getInstance().dealEvnExceptionWhenStartDesigner(); } else { WorkContext.switchTo(workspace); From 23733ff80c299e477330f34cf2b03674e80b5c19 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Mon, 6 Aug 2018 11:02:03 +0800 Subject: [PATCH 2/6] REPORT-10385 --- .../java/com/fr/start/module/DesignerWorkspaceProvider.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java index aae7bb2cd2..211e67db3e 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java @@ -4,13 +4,11 @@ import com.fr.design.DesignerEnvManager; import com.fr.design.env.DesignerWorkspaceGenerator; import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.mainframe.TemplatePane; -import com.fr.general.ComparatorUtils; import com.fr.module.Activator; -import com.fr.stable.StableUtils; + import com.fr.workspace.WorkContext; import com.fr.workspace.Workspace; -import java.io.File; /** * Created by juhaoyu on 2018/1/8. From c592ad0f6c26603472be1c8244137417fb01431e Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Mon, 6 Aug 2018 11:39:54 +0800 Subject: [PATCH 3/6] =?UTF-8?q?REPORT-10328=20=E3=80=9010.0=E5=86=92?= =?UTF-8?q?=E7=83=9F=E3=80=91=E8=A1=A8=E5=8D=95=E4=BB=8E=E6=A8=AA=E5=90=91?= =?UTF-8?q?=E8=87=AA=E9=80=82=E5=BA=94=E5=88=87=E5=88=B0=E7=BB=9D=E5=AF=B9?= =?UTF-8?q?=E5=B8=83=E5=B1=80=EF=BC=8C=E7=BC=A9=E6=94=BE=E4=BC=9A=E6=9C=89?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widget/ui/designer/layout/FRFitLayoutDefinePane.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java index 2c64976690..3882bbb44c 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java @@ -173,6 +173,9 @@ public class FRFitLayoutDefinePane extends AbstractDataModify { if (value instanceof Integer) { state = (Integer) value; } + //todo 验证下 + layout.setLayoutType(WBodyLayoutType.parse(state)); + layout.setCompState(adaptComboBox.getSelectedIndex()); try { if (state == WBodyLayoutType.ABSOLUTE.getTypeValue()) { WAbsoluteBodyLayout wAbsoluteBodyLayout = new WAbsoluteBodyLayout("body"); @@ -201,9 +204,6 @@ public class FRFitLayoutDefinePane extends AbstractDataModify { FineLoggerFactory.getLogger().error(e.getMessage()); } - //todo 验证下 - layout.setLayoutType(WBodyLayoutType.parse(state)); - layout.setCompState(adaptComboBox.getSelectedIndex()); int intervelValue = (int)componentIntervel.getValue(); if (xWFitLayout.canAddInterval(intervelValue)) { From 8595666a9b9d591ee1b535309148371178e399c9 Mon Sep 17 00:00:00 2001 From: plough Date: Mon, 6 Aug 2018 14:56:39 +0800 Subject: [PATCH 4/6] =?UTF-8?q?REPORT-10383=2010.0=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E3=80=8B=E7=A7=BB=E5=8A=A8=E7=AB=AF=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E3=80=8B=E5=85=B6=E4=BB=96=E5=8A=9F=E8=83=BD=E2=80=9C=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=86=8D=E7=8E=B0=E6=97=B6=E5=88=B7=E6=96=B0=E2=80=9D?= =?UTF-8?q?=E5=92=8C=E2=80=9C=E8=A1=A8=E5=8D=95=E6=9C=AA=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E7=A6=BB=E5=BC=80=E6=8F=90=E7=A4=BA=E2=80=9D=E8=8B=B1=E6=96=87?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/form/mobile/FormMobileOthersPane.java | 4 ++-- .../java/com/fr/design/report/mobile/MobileOthersPane.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/form/mobile/FormMobileOthersPane.java b/designer-form/src/main/java/com/fr/design/form/mobile/FormMobileOthersPane.java index db7e2d67cb..03dae804f4 100644 --- a/designer-form/src/main/java/com/fr/design/form/mobile/FormMobileOthersPane.java +++ b/designer-form/src/main/java/com/fr/design/form/mobile/FormMobileOthersPane.java @@ -28,9 +28,9 @@ public class FormMobileOthersPane extends BasicBeanPane { JPanel borderPane = FRGUIPaneFactory.createTitledBorderPane(this.title4PopupWindow()); JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); contentPane.setBorder(BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L1, 0, 0)); - appearRefreshCheckPane = new MobileRadioCheckPane(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Appear_Refresh")); + appearRefreshCheckPane = new MobileRadioCheckPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Appear_Refresh")); contentPane.add(appearRefreshCheckPane, BorderLayout.WEST); - promptWhenLeaveWithoutSubmitCheckPane = new MobileRadioCheckPane(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Prompt_When_Leave_Without_Submit")); + promptWhenLeaveWithoutSubmitCheckPane = new MobileRadioCheckPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Prompt_When_Leave_Without_Submit")); contentPane.add(promptWhenLeaveWithoutSubmitCheckPane, BorderLayout.CENTER); borderPane.add(contentPane); this.add(borderPane); diff --git a/designer-realize/src/main/java/com/fr/design/report/mobile/MobileOthersPane.java b/designer-realize/src/main/java/com/fr/design/report/mobile/MobileOthersPane.java index b3c3e0fea7..857631c328 100644 --- a/designer-realize/src/main/java/com/fr/design/report/mobile/MobileOthersPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/mobile/MobileOthersPane.java @@ -27,7 +27,7 @@ public class MobileOthersPane extends BasicBeanPane { JPanel borderPane = FRGUIPaneFactory.createTitledBorderPane(this.title4PopupWindow()); JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); contentPane.setBorder(BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L1, 0, 0)); - appearRefreshCheckPane = new MobileRadioCheckPane(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Appear_Refresh")); + appearRefreshCheckPane = new MobileRadioCheckPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Appear_Refresh")); contentPane.add(appearRefreshCheckPane, BorderLayout.WEST); borderPane.add(contentPane); this.add(borderPane); From fabe66bd5e3c480a5277c0519e474f30a895d871 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Mon, 6 Aug 2018 16:03:06 +0800 Subject: [PATCH 5/6] =?UTF-8?q?REPORT-10386=20=E8=BF=9C=E7=A8=8B=E6=9D=83?= =?UTF-8?q?=E9=99=90=E4=BA=A4=E4=BA=92=E9=AA=8C=E6=94=B6=E9=97=AE=E9=A2=98?= =?UTF-8?q?1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/env/RemoteEnvPane.java | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java index ff4ec66608..fc41ae24ab 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -523,9 +523,7 @@ public class RemoteEnvPane extends BasicBeanPane { DesignerEnvManager.getEnvManager().setCertificatePass(connection.getCertSecretKey()); try { return WorkContext.getConnector().testConnection(connection); - } catch (AuthException e) { - message.setText(Toolkit.i18nText("Fine-Designer_Basic_Remote_Connect_Auth_Failed")); - uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon")); + } catch (AuthException ignored) { return null; } } @@ -534,13 +532,18 @@ public class RemoteEnvPane extends BasicBeanPane { protected void done() { okButton.setEnabled(true); try { - if (get()) { - message.setText(Toolkit.i18nText("Fine-Designer_Basic_Remote_Connect_Successful")); - uiLabel.setIcon(UIManager.getIcon("OptionPane.informationIcon")); - } else { - message.setText(Toolkit.i18nText("Fine-Designer_Basic_Remote_Connect_Failed")); + Boolean result = get(); + if (result == null) { + message.setText(Toolkit.i18nText("Fine-Designer_Basic_Remote_Connect_Auth_Failed")); uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon")); - + } else { + if (result) { + message.setText(Toolkit.i18nText("Fine-Designer_Basic_Remote_Connect_Successful")); + uiLabel.setIcon(UIManager.getIcon("OptionPane.informationIcon")); + } else { + message.setText(Toolkit.i18nText("Fine-Designer_Basic_Remote_Connect_Failed")); + uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon")); + } } } catch (InterruptedException | ExecutionException e) { FineLoggerFactory.getLogger().error(e, e.getMessage()); From aedfbf6394b792f90cd8f365cde3bc293b513b0d Mon Sep 17 00:00:00 2001 From: richie Date: Mon, 6 Aug 2018 20:03:17 +0800 Subject: [PATCH 6/6] =?UTF-8?q?CORE-116=20=E6=96=B0=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E7=BB=93=E6=9E=84+=E8=80=81=E7=9A=84=E5=8F=8D=E5=B0=84?= =?UTF-8?q?=E9=83=A8=E5=88=86=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/creator/XCreatorUtils.java | 214 +++++++++++------- .../FormWidgetDefinePaneFactoryBase.java | 78 +++++-- 2 files changed, 191 insertions(+), 101 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java index 3d289a009c..dc7e487739 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java @@ -3,25 +3,70 @@ */ package com.fr.design.designer.creator; -import com.fr.base.FRContext; import com.fr.design.ExtraDesignClassManager; -import com.fr.design.designer.creator.cardlayout.*; +import com.fr.design.designer.creator.cardlayout.XCardAddButton; +import com.fr.design.designer.creator.cardlayout.XCardSwitchButton; +import com.fr.design.designer.creator.cardlayout.XWCardLayout; +import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; +import com.fr.design.designer.creator.cardlayout.XWCardTagLayout; +import com.fr.design.designer.creator.cardlayout.XWCardTitleLayout; +import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.fun.FormWidgetOptionProvider; import com.fr.design.fun.ParameterWidgetOptionProvider; import com.fr.design.module.DesignModuleFactory; import com.fr.design.utils.gui.LayoutUtils; import com.fr.form.parameter.FormSubmitButton; import com.fr.form.ui.Button; -import com.fr.form.ui.*; +import com.fr.form.ui.CardAddButton; +import com.fr.form.ui.CardSwitchButton; +import com.fr.form.ui.CheckBox; +import com.fr.form.ui.CheckBoxGroup; +import com.fr.form.ui.ComboBox; +import com.fr.form.ui.ComboCheckBox; +import com.fr.form.ui.DataTable; +import com.fr.form.ui.DateEditor; +import com.fr.form.ui.EditorHolder; +import com.fr.form.ui.ElementCaseEditor; +import com.fr.form.ui.ErrorMarker; +import com.fr.form.ui.FileEditor; +import com.fr.form.ui.FreeButton; +import com.fr.form.ui.IframeEditor; import com.fr.form.ui.Label; +import com.fr.form.ui.ListEditor; +import com.fr.form.ui.MultiFileEditor; +import com.fr.form.ui.NameWidget; +import com.fr.form.ui.NumberEditor; +import com.fr.form.ui.Password; +import com.fr.form.ui.Radio; +import com.fr.form.ui.RadioGroup; +import com.fr.form.ui.Table; +import com.fr.form.ui.TableTree; import com.fr.form.ui.TextArea; -import com.fr.form.ui.container.*; +import com.fr.form.ui.TextEditor; +import com.fr.form.ui.TreeComboBoxEditor; +import com.fr.form.ui.TreeEditor; +import com.fr.form.ui.Widget; +import com.fr.form.ui.container.WAbsoluteBodyLayout; +import com.fr.form.ui.container.WAbsoluteLayout; +import com.fr.form.ui.container.WBorderLayout; +import com.fr.form.ui.container.WCardLayout; +import com.fr.form.ui.container.WFitLayout; +import com.fr.form.ui.container.WGridLayout; +import com.fr.form.ui.container.WHorizontalBoxLayout; +import com.fr.form.ui.container.WHorizontalSplitLayout; +import com.fr.form.ui.container.WParameterLayout; +import com.fr.form.ui.container.WScaleLayout; +import com.fr.form.ui.container.WTitleLayout; +import com.fr.form.ui.container.WVerticalBoxLayout; +import com.fr.form.ui.container.WVerticalSplitLayout; import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.form.ui.container.cardlayout.WCardTitleLayout; import com.fr.form.ui.container.cardlayout.WTabFitLayout; import com.fr.general.GeneralContext; import com.fr.general.IOUtils; +import com.fr.invoke.Reflect; +import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginContext; import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.manage.PluginFilter; @@ -31,7 +76,6 @@ import com.fr.stable.StringUtils; import javax.swing.*; import java.awt.*; -import java.lang.reflect.Constructor; /** * XCreator的相关处理 @@ -40,47 +84,46 @@ import java.lang.reflect.Constructor; * @since 6.5.3 */ public class XCreatorUtils { - + public static java.util.Map, Class> objectMap = new java.util.HashMap, Class>(); - + private static java.util.Map, Class> extraObjectMap = new java.util.HashMap, Class>(); - + public static java.util.Map, Class> xLayoutMap = new java.util.HashMap, Class>(); - + static { init(); GeneralContext.listenPluginRunningChanged(new PluginEventListener() { - + @Override public void on(PluginEvent event) { - + reInitExtra(); } }, new PluginFilter() { - + @Override public boolean accept(PluginContext context) { - + return context.contain(PluginModule.ExtraDesign, ParameterWidgetOptionProvider.XML_TAG) - || context.contain(PluginModule.ExtraDesign, FormWidgetOptionProvider.XML_TAG); + || context.contain(PluginModule.ExtraDesign, FormWidgetOptionProvider.XML_TAG); } }); } - + private static void init() { - + putDefault(); putExtraEditor(); putDefaultLayouts(); reInitExtra(); } - + private static void putDefaultLayouts() { - + xLayoutMap.put(WAbsoluteLayout.class, XWAbsoluteLayout.class); xLayoutMap.put(WParameterLayout.class, XWParameterLayout.class); xLayoutMap.put(WAbsoluteBodyLayout.class, XWAbsoluteBodyLayout.class); - xLayoutMap.put(WAbsoluteLayout.class, XWAbsoluteLayout.class); xLayoutMap.put(WHorizontalBoxLayout.class, XWHorizontalBoxLayout.class); xLayoutMap.put(WBorderLayout.class, XWBorderLayout.class); xLayoutMap.put(WCardLayout.class, XWCardLayout.class); @@ -88,7 +131,7 @@ public class XCreatorUtils { xLayoutMap.put(WHorizontalSplitLayout.class, XWHorizontalSplitLayout.class); xLayoutMap.put(WVerticalSplitLayout.class, XWVerticalSplitLayout.class); xLayoutMap.put(WGridLayout.class, XWGridLayout.class); - + xLayoutMap.put(WFitLayout.class, XWFitLayout.class); xLayoutMap.put(WScaleLayout.class, XWScaleLayout.class); xLayoutMap.put(WTitleLayout.class, XWTitleLayout.class); @@ -97,9 +140,9 @@ public class XCreatorUtils { xLayoutMap.put(WTabFitLayout.class, XWTabFitLayout.class); xLayoutMap.put(WCardMainBorderLayout.class, XWCardMainBorderLayout.class); } - + private static void putDefault() { - + objectMap.put(TextEditor.class, XTextEditor.class); objectMap.put(TextArea.class, XTextArea.class); objectMap.put(NumberEditor.class, XNumberEditor.class); @@ -112,7 +155,6 @@ public class XCreatorUtils { objectMap.put(FileEditor.class, XFileUploader.class); objectMap.put(Table.class, XTableEditor.class); objectMap.put(IframeEditor.class, XIframeEditor.class); - objectMap.put(FreeButton.class, XButton.class); objectMap.put(FormSubmitButton.class, XButton.class); objectMap.put(Button.class, XButton.class); objectMap.put(Label.class, XLabel.class); @@ -132,23 +174,23 @@ public class XCreatorUtils { objectMap.put(CardAddButton.class, XCardAddButton.class); objectMap.put(ErrorMarker.class, ErrorCreator.class); } - + private static void reInitExtra() { - + extraObjectMap.clear(); extraObjectMap.putAll(ExtraDesignClassManager.getInstance().getParameterWidgetOptionsMap()); extraObjectMap.putAll(ExtraDesignClassManager.getInstance().getFormWidgetOptionsMap()); } - + private static void putExtraEditor() { if (DesignModuleFactory.getChartEditorClass() != null) { objectMap.put(DesignModuleFactory.getChartEditorClass(), XChartEditor.class); } } - + @SuppressWarnings("unchecked") private static Class searchXCreatorClass(Class clazz) { - + Class xClazz = (Class) objectMap.get(clazz); if (xClazz == null) { xClazz = (Class) extraObjectMap.get(clazz); @@ -160,7 +202,8 @@ public class XCreatorUtils { } /** - *创建creator + * 创建creator + * * @param widget 控件 * @return 返回控件的creator */ @@ -170,8 +213,9 @@ public class XCreatorUtils { /** * 带初始大小的Widget转化为XCreator当然XCreator也需要把大小赋值上 + * * @param widget 控件 - * @param d 大小 + * @param d 大小 * @return 返回控件的xcreator */ public static XCreator createXCreator(Widget widget, Dimension d) { @@ -184,23 +228,18 @@ public class XCreatorUtils { widgetClass = widget.getClass(); clazz = XCreatorUtils.searchXCreatorClass(widgetClass); if (clazz == null) { - FRContext.getLogger().error(widget + "'s" + " xcreator doesn't exsit!"); + FineLoggerFactory.getLogger().error(widget + "'s" + " xcreator doesn't exsit!"); clazz = NullCreator.class; } } XCreator creator = null; - Constructor[] constructors = clazz.getConstructors(); - for (Constructor c : constructors) { - try { - creator = (XCreator) c.newInstance(widget, d); - break; - } catch (Exception ignore) { - // richie:这里的错误可以忽略 -// FRContext.getLogger().error(ignore.getMessage()); - } + try { + creator = Reflect.on(clazz).create(widget, d).get(); + } catch (Exception ignore) { + } if (creator == null) { - FRContext.getLogger().error("Error to create xcreator!"); + FineLoggerFactory.getLogger().error("Error to create xcreator!"); creator = new NullCreator(widget, d); } creator.setXDescrption(widget);//设置描述信息 @@ -208,7 +247,8 @@ public class XCreatorUtils { } /** - *刷新所有名字控件 + * 刷新所有名字控件 + * * @param container 布局容器 */ public static void refreshAllNameWidgets(XLayoutContainer container) { @@ -228,52 +268,52 @@ public class XCreatorUtils { } /** - * 获取焦点组件所在的顶层容器,不包括目标本身 - * - * @param creator 组件 - * @return 返回父容器 - */ - public static XLayoutContainer getParentXLayoutContainer(XCreator creator) { - Container c = creator.getParent(); - while (c != null) { - XCreator crea = (XCreator) c; - if(crea.acceptType(XWCardTitleLayout.class)){ - return (XLayoutContainer) c.getParent(); + * 获取焦点组件所在的顶层容器,不包括目标本身 + * + * @param creator 组件 + * @return 返回父容器 + */ + public static XLayoutContainer getParentXLayoutContainer(XCreator creator) { + Container c = creator.getParent(); + while (c != null) { + XCreator crea = (XCreator) c; + if (crea.acceptType(XWCardTitleLayout.class)) { + return (XLayoutContainer) c.getParent(); } - if (crea.isDedicateContainer()) { - return (XLayoutContainer) c.getParent(); - } - if (c instanceof XLayoutContainer) { - return (XLayoutContainer) c; - } - c = c.getParent(); - } - - return null; - } - - /** - * 获取焦点组件所在的顶层容器,可能是目标本身 - * - * @param creator 组件 - * @return 返回顶层容器 - */ - public static XLayoutContainer getHotspotContainer(XCreator creator) { - if (creator.isDedicateContainer()) { - return (XLayoutContainer) creator.getParent(); - } - if (creator instanceof XLayoutContainer) { - return (XLayoutContainer) creator; - } - return getParentXLayoutContainer(creator); - } - - /** - * 返回组件的图标 - * - * @param creator 组件 - * @return 组件icon - */ + if (crea.isDedicateContainer()) { + return (XLayoutContainer) c.getParent(); + } + if (c instanceof XLayoutContainer) { + return (XLayoutContainer) c; + } + c = c.getParent(); + } + + return null; + } + + /** + * 获取焦点组件所在的顶层容器,可能是目标本身 + * + * @param creator 组件 + * @return 返回顶层容器 + */ + public static XLayoutContainer getHotspotContainer(XCreator creator) { + if (creator.isDedicateContainer()) { + return (XLayoutContainer) creator.getParent(); + } + if (creator instanceof XLayoutContainer) { + return (XLayoutContainer) creator; + } + return getParentXLayoutContainer(creator); + } + + /** + * 返回组件的图标 + * + * @param creator 组件 + * @return 组件icon + */ public static Icon getCreatorIcon(XCreator creator) { String iconPath = creator.getIconPath(); if (StringUtils.isEmpty(iconPath)) { diff --git a/designer-form/src/main/java/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java b/designer-form/src/main/java/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java index 0de1e2bdaf..8d43e08e29 100644 --- a/designer-form/src/main/java/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java +++ b/designer-form/src/main/java/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java @@ -1,23 +1,75 @@ package com.fr.design.widget; -import com.fr.base.FRContext; import com.fr.design.designer.creator.XCreator; import com.fr.design.gui.core.WidgetConstants; import com.fr.design.mainframe.FormDesigner; -import com.fr.design.widget.ui.designer.WidgetDefinePane; import com.fr.design.parameter.RootDesignDefinePane; -import com.fr.design.widget.ui.designer.*; -import com.fr.design.widget.ui.designer.layout.*; +import com.fr.design.widget.ui.designer.CheckBoxDefinePane; +import com.fr.design.widget.ui.designer.CheckBoxGroupDefinePane; +import com.fr.design.widget.ui.designer.ComboBoxDefinePane; +import com.fr.design.widget.ui.designer.ComboCheckBoxDefinePane; +import com.fr.design.widget.ui.designer.DateEditorDefinePane; +import com.fr.design.widget.ui.designer.FreeButtonDefinePane; +import com.fr.design.widget.ui.designer.IframeEditorDefinePane; +import com.fr.design.widget.ui.designer.LabelDefinePane; +import com.fr.design.widget.ui.designer.MultiFileEditorPane; +import com.fr.design.widget.ui.designer.NoneWidgetDefinePane; +import com.fr.design.widget.ui.designer.NumberEditorDefinePane; +import com.fr.design.widget.ui.designer.PasswordDefinePane; +import com.fr.design.widget.ui.designer.RadioDefinePane; +import com.fr.design.widget.ui.designer.RadioGroupDefinePane; +import com.fr.design.widget.ui.designer.TextAreaDefinePane; +import com.fr.design.widget.ui.designer.TextFieldEditorDefinePane; +import com.fr.design.widget.ui.designer.TreeComboBoxEditorDefinePane; +import com.fr.design.widget.ui.designer.TreeEditorDefinePane; +import com.fr.design.widget.ui.designer.UserEditorDefinePane; +import com.fr.design.widget.ui.designer.WidgetDefinePane; +import com.fr.design.widget.ui.designer.layout.BorderStyleWidgetDefinePane; +import com.fr.design.widget.ui.designer.layout.ElementEditorDefinePane; +import com.fr.design.widget.ui.designer.layout.FRAbsoluteBodyLayoutDefinePane; +import com.fr.design.widget.ui.designer.layout.FRAbsoluteLayoutDefinePane; +import com.fr.design.widget.ui.designer.layout.FRFitLayoutDefinePane; +import com.fr.design.widget.ui.designer.layout.WCardLayoutDefinePane; +import com.fr.design.widget.ui.designer.layout.WCardMainLayoutDefinePane; +import com.fr.design.widget.ui.designer.layout.WCardTagLayoutDefinePane; +import com.fr.design.widget.ui.designer.layout.WTabFitLayoutDefinePane; import com.fr.form.parameter.FormSubmitButton; -import com.fr.form.ui.*; -import com.fr.form.ui.container.*; +import com.fr.form.ui.AbstractBorderStyleWidget; +import com.fr.form.ui.Button; +import com.fr.form.ui.CheckBox; +import com.fr.form.ui.CheckBoxGroup; +import com.fr.form.ui.ComboBox; +import com.fr.form.ui.ComboCheckBox; +import com.fr.form.ui.DateEditor; +import com.fr.form.ui.ElementCaseEditor; +import com.fr.form.ui.FreeButton; +import com.fr.form.ui.IframeEditor; +import com.fr.form.ui.Label; +import com.fr.form.ui.MultiFileEditor; +import com.fr.form.ui.NameWidget; +import com.fr.form.ui.NoneWidget; +import com.fr.form.ui.NumberEditor; +import com.fr.form.ui.Password; +import com.fr.form.ui.Radio; +import com.fr.form.ui.RadioGroup; +import com.fr.form.ui.TextArea; +import com.fr.form.ui.TextEditor; +import com.fr.form.ui.TreeComboBoxEditor; +import com.fr.form.ui.TreeEditor; +import com.fr.form.ui.Widget; +import com.fr.form.ui.container.WAbsoluteBodyLayout; +import com.fr.form.ui.container.WAbsoluteLayout; +import com.fr.form.ui.container.WCardLayout; +import com.fr.form.ui.container.WFitLayout; +import com.fr.form.ui.container.WParameterLayout; import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.form.ui.container.cardlayout.WTabFitLayout; +import com.fr.invoke.Reflect; +import com.fr.log.FineLoggerFactory; import com.fr.stable.bridge.BridgeMark; import com.fr.stable.bridge.StableFactory; -import java.lang.reflect.Constructor; import java.util.HashMap; import java.util.Map; @@ -45,7 +97,6 @@ public class FormWidgetDefinePaneFactoryBase { defineMap.put(IframeEditor.class, new Appearance(IframeEditorDefinePane.class, WidgetConstants.IFRAME + "")); defineMap.put(TextEditor.class, new Appearance(TextFieldEditorDefinePane.class, WidgetConstants.TEXT + "")); defineMap.put(NameWidget.class, new Appearance(UserEditorDefinePane.class, "UserDefine")); - defineMap.put(ComboCheckBox.class, new Appearance(ComboCheckBoxDefinePane.class, WidgetConstants.COMBOCHECKBOX + "")); defineMap.put(ComboBox.class, new Appearance(ComboBoxDefinePane.class, WidgetConstants.COMBOBOX + "")); defineMap.put(RadioGroup.class, new Appearance(RadioGroupDefinePane.class, WidgetConstants.RADIOGROUP + "")); defineMap.put(CheckBoxGroup.class, new Appearance(CheckBoxGroupDefinePane.class, WidgetConstants.CHECKBOXGROUP + "")); @@ -78,24 +129,23 @@ public class FormWidgetDefinePaneFactoryBase { } public static RN createWidgetDefinePane(XCreator creator, FormDesigner designer, Widget widget, Operator operator) { - if(isExtraXWidget(widget)){ + if (isExtraXWidget(widget)) { WidgetDefinePane widgetDefinePane = new WidgetDefinePane(creator, designer); return new RN(widgetDefinePane, widgetDefinePane.title4PopupWindow()); } Appearance dn = defineMap.get(widget.getClass()); DataModify definePane = null; try { - Constructor con = dn.getDefineClass().getConstructor(XCreator.class); - definePane = (DataModify)con.newInstance(creator); + definePane = Reflect.on(dn.getDefineClass()).create(creator).get(); operator.did(definePane.dataUI(), dn.getDisplayName()); } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } return new RN(definePane, dn.getDisplayName()); } - public static boolean isExtraXWidget(Widget widget){ - return defineMap.get(widget.getClass()) == null; + public static boolean isExtraXWidget(Widget widget) { + return defineMap.get(widget.getClass()) == null; } public static class RN {