From d5cd33159687806dbab2c975eda7daf2d6b59f4b Mon Sep 17 00:00:00 2001 From: Heyman Date: Thu, 19 Aug 2021 11:21:01 +0800 Subject: [PATCH] =?UTF-8?q?MOBILE-32704=2011.0=E9=83=A8=E5=88=86=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E5=86=85=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/ExtraDesignClassManager.java | 9 ++-- .../mobile/ui/MobileParamSettingPane.java | 6 +-- .../mainframe/mobile/ui/MobileStylePane.java | 47 +------------------ .../utils/MobileStyleProviderManager.java | 41 ++++++++++++++++ 4 files changed, 52 insertions(+), 51 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/mobile/utils/MobileStyleProviderManager.java diff --git a/designer-base/src/main/java/com/fr/design/ExtraDesignClassManager.java b/designer-base/src/main/java/com/fr/design/ExtraDesignClassManager.java index c25d7d80a3..4d1493e01b 100644 --- a/designer-base/src/main/java/com/fr/design/ExtraDesignClassManager.java +++ b/designer-base/src/main/java/com/fr/design/ExtraDesignClassManager.java @@ -18,6 +18,7 @@ import com.fr.design.fun.TableDataDefineProvider; import com.fr.design.fun.ToolbarItemProvider; import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.core.WidgetOptionFactory; +import com.fr.design.mainframe.mobile.utils.MobileStyleProviderManager; import com.fr.design.menu.ShortCut; import com.fr.design.widget.Appearance; import com.fr.design.widget.mobile.WidgetMobilePane; @@ -267,15 +268,17 @@ public class ExtraDesignClassManager extends AbstractExtraClassManager implement return map; } - public List getMobileStyleOfWidget(String xType) { + public MobileWidgetStyleProvider[] getMobileStyleOfWidget(String xType) { Set set = getArray(MobileWidgetStyleProvider.XML_TAG); + Set allSet = MobileStyleProviderManager.getArray(MobileWidgetStyleProvider.XML_TAG); + allSet.addAll(set); List providers = new ArrayList<>(); - for (MobileWidgetStyleProvider provider : set) { + for (MobileWidgetStyleProvider provider : allSet) { if (ComparatorUtils.equalsIgnoreCase(provider.xTypeForWidget(), xType)) { providers.add(provider); } } - return providers; + return providers.toArray(new MobileWidgetStyleProvider[providers.size()]); } @Override diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileParamSettingPane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileParamSettingPane.java index ae29a57e23..eb7496607d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileParamSettingPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileParamSettingPane.java @@ -7,8 +7,7 @@ import com.fr.design.fun.MobileParamUIProvider; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.mobile.provider.DefaultMobileParamUIProvider; import com.fr.design.mainframe.mobile.provider.EmptyMobileParamUIProvider; -import com.fr.design.mainframe.mobile.provider.topparam.MobileTopParamStyleProvider; -import com.fr.design.mainframe.mobile.ui.MobileParamDefinePane; +import com.fr.design.mainframe.mobile.utils.MobileStyleProviderManager; import com.fr.form.ui.mobile.MobileParamStyle; import com.fr.general.ComparatorUtils; import com.fr.report.ExtraReportClassManager; @@ -137,10 +136,11 @@ public class MobileParamSettingPane extends BasicPane { private MobileParamUIProvider[] getMobileParamUIProviders() { Set paramUIProviders = ExtraDesignClassManager.getInstance().getArray(MobileParamUIProvider.XML_TAG); + Set otherParamUIProviders = MobileStyleProviderManager.getArray(MobileParamUIProvider.XML_TAG); List result = new ArrayList<>(); result.add(new DefaultMobileParamUIProvider()); - result.add(new MobileTopParamStyleProvider()); result.addAll(paramUIProviders); + result.addAll(otherParamUIProviders); Set nameSets = paramUIProviders.stream().map(MobileParamUIProvider::displayName).collect(Collectors.toSet()); // 兼容老接口 Set paramStyleProviders = ExtraReportClassManager.getInstance().getArray(MobileParamStyleProvider.MARK_STRING); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStylePane.java index 9a344b8cb7..3573427ca9 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStylePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStylePane.java @@ -5,19 +5,10 @@ import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.BasicPane; import com.fr.design.fun.MobileWidgetStyleProvider; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.mainframe.mobile.provider.combo.SimpleComboCheckBoxStyleProvider; -import com.fr.design.mainframe.mobile.provider.combo.SimpleComboStyleProvider; -import com.fr.design.mainframe.mobile.provider.date.NavigationStyleProvider; -import com.fr.design.mainframe.mobile.provider.date.SimpleDateStyleProvider; -import com.fr.design.mainframe.mobile.provider.date.SimpleStyleProvider; -import com.fr.design.mainframe.mobile.provider.radiogroup.CapsuleRadioGroupStyleProvider; -import com.fr.design.mainframe.mobile.provider.radiogroup.ImageRadioGroupStyleProvider; -import com.fr.design.mainframe.mobile.provider.radiogroup.UnitedRadioGroupStyleProvider; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WScaleLayout; import com.fr.form.ui.mobile.MobileStyle; import com.fr.form.ui.widget.CRBoundsWidget; -import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; @@ -25,12 +16,8 @@ import javax.swing.*; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import java.awt.*; -import java.util.ArrayList; import java.util.HashMap; -import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Set; public class MobileStylePane extends BasicPane { @@ -40,26 +27,6 @@ public class MobileStylePane extends BasicPane { private CardLayout card; private JList styleList; private Map> map = new HashMap<>(); - private static Set set = new HashSet<>(); - - static { - SimpleStyleProvider simpleStyleProvider = new SimpleStyleProvider(); - NavigationStyleProvider navigationStyleProvider = new NavigationStyleProvider(); - SimpleDateStyleProvider simpleDateStyleProvider = new SimpleDateStyleProvider(); - SimpleComboStyleProvider simpleComboStyleProvider = new SimpleComboStyleProvider(); - SimpleComboCheckBoxStyleProvider simpleComboCheckBoxStyleProvider = new SimpleComboCheckBoxStyleProvider(); - CapsuleRadioGroupStyleProvider capsuleRadioGroupStyleProvider = new CapsuleRadioGroupStyleProvider(); - UnitedRadioGroupStyleProvider unitedRadioGroupStyleProvider = new UnitedRadioGroupStyleProvider(); - ImageRadioGroupStyleProvider imageRadioGroupStyleProvider = new ImageRadioGroupStyleProvider(); - set.add(simpleStyleProvider); - set.add(navigationStyleProvider); - set.add(simpleDateStyleProvider); - set.add(simpleComboStyleProvider); - set.add(simpleComboCheckBoxStyleProvider); - set.add(capsuleRadioGroupStyleProvider); - set.add(unitedRadioGroupStyleProvider); - set.add(imageRadioGroupStyleProvider); - } public MobileStylePane(Widget widget) { if(widget instanceof WScaleLayout) { @@ -162,18 +129,8 @@ public class MobileStylePane extends BasicPane { private MobileWidgetStyleProvider[] getMobileWidgetStyleProviders() { DefaultMobileWidgetStyleProvider defaultMobileWidgetStyleProvider = new DefaultMobileWidgetStyleProvider(); - - List providers = new ArrayList<>(); - for (MobileWidgetStyleProvider provider : set) { - if (ComparatorUtils.equalsIgnoreCase(provider.xTypeForWidget(), widget.getXType())) { - providers.add(provider); - } - } - List otherProviders = ExtraDesignClassManager.getInstance().getMobileStyleOfWidget(widget.getXType()); - providers.addAll(otherProviders); - MobileWidgetStyleProvider[] styleProviders = providers.toArray(new MobileWidgetStyleProvider[providers.size()]); - - styleProviders = ArrayUtils.insert(0, styleProviders, defaultMobileWidgetStyleProvider); + MobileWidgetStyleProvider[] styleProviders = ExtraDesignClassManager.getInstance().getMobileStyleOfWidget(widget.getXType()); + styleProviders = ArrayUtils.insert(0, styleProviders, defaultMobileWidgetStyleProvider); return styleProviders; } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/utils/MobileStyleProviderManager.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/utils/MobileStyleProviderManager.java new file mode 100644 index 0000000000..7c3194ba61 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/utils/MobileStyleProviderManager.java @@ -0,0 +1,41 @@ +package com.fr.design.mainframe.mobile.utils; + +import com.fr.design.mainframe.mobile.provider.combo.SimpleComboCheckBoxStyleProvider; +import com.fr.design.mainframe.mobile.provider.combo.SimpleComboStyleProvider; +import com.fr.design.mainframe.mobile.provider.date.NavigationStyleProvider; +import com.fr.design.mainframe.mobile.provider.date.SimpleDateStyleProvider; +import com.fr.design.mainframe.mobile.provider.date.SimpleStyleProvider; +import com.fr.design.mainframe.mobile.provider.radiogroup.CapsuleRadioGroupStyleProvider; +import com.fr.design.mainframe.mobile.provider.radiogroup.ImageRadioGroupStyleProvider; +import com.fr.design.mainframe.mobile.provider.radiogroup.UnitedRadioGroupStyleProvider; +import com.fr.design.mainframe.mobile.provider.topparam.MobileTopParamStyleProvider; +import com.fr.stable.fun.mark.Mutable; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +public class MobileStyleProviderManager { + private static Set mobileWidgetStyleProviderSet = new HashSet() {{ + add(new SimpleStyleProvider()); + add(new NavigationStyleProvider()); + add(new SimpleDateStyleProvider()); + add(new SimpleComboStyleProvider()); + add(new SimpleComboCheckBoxStyleProvider()); + add(new CapsuleRadioGroupStyleProvider()); + add(new UnitedRadioGroupStyleProvider()); + add(new ImageRadioGroupStyleProvider()); + }}; + private static Set mobileParamUIProviderSet = new HashSet() {{ + add(new MobileTopParamStyleProvider()); + }}; + private static Map> map = new HashMap>() {{ + put("MobileWidgetStyleProvider", mobileWidgetStyleProviderSet); + put("MobileParamUIProvider", mobileParamUIProviderSet); + }}; + + public static Set getArray(String mark) { + return (Set) map.get(mark); + } +}