From 2a0a5eb9b7486e3543ed2751d41ad4d454af6f1e Mon Sep 17 00:00:00 2001 From: kerry Date: Tue, 4 Sep 2018 14:42:46 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-10676=209patch10,=20FR9.0=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E6=94=AF=E6=8C=81=E7=A7=BB=E5=8A=A8=E7=AB=AF?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/actions/file/WebPreviewUtils.java | 3 +- .../com/fr/design/fun/PreviewProvider.java | 10 +++- .../fun/impl/AbstractPreviewProvider.java | 7 +++ .../com/fr/design/mainframe/JTemplate.java | 5 +- .../com/fr/design/preview/FormPreview.java | 34 +++++++++++++ .../com/fr/design/preview/MobilePreview.java | 48 ++++++++++++++++++ .../fr/design/images/buttonicon/mobile.png | Bin 0 -> 550 bytes .../fr/design/images/buttonicon/mobileb24.png | Bin 0 -> 1055 bytes .../java/com/fr/design/mainframe/JForm.java | 48 ++++++++++++++---- .../com/fr/design/mainframe/JWorkBook.java | 3 +- 10 files changed, 144 insertions(+), 14 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/preview/FormPreview.java create mode 100644 designer-base/src/main/java/com/fr/design/preview/MobilePreview.java create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/mobile.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/mobileb24.png diff --git a/designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java b/designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java index 2a73de7a4..5434abc09 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java @@ -9,7 +9,6 @@ import com.fr.design.utils.DesignUtils; import com.fr.file.FILE; import com.fr.file.FileNodeFILE; import com.fr.general.GeneralUtils; -import com.fr.general.web.ParameterConstants; import com.fr.stable.project.ProjectConstants; import com.fr.stable.web.AbstractWebletCreator; @@ -27,7 +26,7 @@ public final class WebPreviewUtils { @SuppressWarnings("unchecked") public static void preview(JTemplate jt, PreviewProvider provider) { String baseRoute = jt.route(); - actionPerformed(jt, baseRoute, provider == null ? Collections.EMPTY_MAP : provider.parametersForPreview(), ParameterConstants.VIEWLET); + actionPerformed(jt, baseRoute, provider == null ? Collections.EMPTY_MAP : provider.parametersForPreview(), provider.getActionType()); } private static void actionPerformed(JTemplate jt, String baseRoute, Map map, String actionType) { diff --git a/designer-base/src/main/java/com/fr/design/fun/PreviewProvider.java b/designer-base/src/main/java/com/fr/design/fun/PreviewProvider.java index 876c7d202..f6e8cb219 100644 --- a/designer-base/src/main/java/com/fr/design/fun/PreviewProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/PreviewProvider.java @@ -11,7 +11,7 @@ import java.util.Map; * @since 8.0 * 自定义预览方式接口 */ -public interface PreviewProvider extends Mutable{ +public interface PreviewProvider extends Mutable { String MARK_STRING = "PreviewProvider"; @@ -54,4 +54,12 @@ public interface PreviewProvider extends Mutable{ */ Map parametersForPreview(); + /** + * 该种预览方式下对模板的处理方式 + * 分页填报等需要计算输出模板,移动端预览直接输出url + * @return 处理方式 + */ + String getActionType(); + + } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractPreviewProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractPreviewProvider.java index 3f824d4bb..f0b780903 100644 --- a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractPreviewProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractPreviewProvider.java @@ -3,6 +3,7 @@ package com.fr.design.fun.impl; import com.fr.design.fun.PreviewProvider; import com.fr.design.mainframe.JTemplate; import com.fr.general.ComparatorUtils; +import com.fr.general.web.ParameterConstants; import com.fr.stable.fun.impl.AbstractProvider; import com.fr.stable.fun.mark.API; @@ -45,4 +46,10 @@ public abstract class AbstractPreviewProvider extends AbstractProvider implement public int hashCode() { return nameForPopupItem().hashCode(); } + + + @Override + public String getActionType() { + return ParameterConstants.VIEWLET; + } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index bf4eb0d0c..6f9383e4d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe; +import com.fr.base.BaseUtils; import com.fr.base.FRContext; import com.fr.base.Parameter; import com.fr.base.ScreenResolution; @@ -1006,7 +1007,9 @@ public abstract class JTemplate> * @return */ public Icon getPreviewLargeIcon() { - return UIConstants.RUN_BIG_ICON; + PreviewProvider provider = getPreviewType(); + String iconPath = provider.iconPathForLarge(); + return BaseUtils.readIcon(iconPath); } /** diff --git a/designer-base/src/main/java/com/fr/design/preview/FormPreview.java b/designer-base/src/main/java/com/fr/design/preview/FormPreview.java new file mode 100644 index 000000000..d6206a2c0 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/preview/FormPreview.java @@ -0,0 +1,34 @@ +package com.fr.design.preview; + +import com.fr.design.fun.impl.AbstractPreviewProvider; +import com.fr.locale.InterProviderFactory; + + +/** + * @author kerry + * @date 2018/5/22 + */ +public class FormPreview extends AbstractPreviewProvider { + private static final int PREVIEW_TYPE = 5; + + @Override + public String nameForPopupItem() { + return InterProviderFactory.getProvider().getLocText("Fine-Design_Form_M_Form_Preview"); + } + + @Override + public String iconPathForPopupItem() { + return "com/fr/design/images/buttonicon/runs.png"; + } + + @Override + public String iconPathForLarge() { + return "com/fr/design/images/buttonicon/run24.png"; + } + + @Override + public int previewTypeCode() { + return PREVIEW_TYPE; + } + +} diff --git a/designer-base/src/main/java/com/fr/design/preview/MobilePreview.java b/designer-base/src/main/java/com/fr/design/preview/MobilePreview.java new file mode 100644 index 000000000..8650ec12b --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/preview/MobilePreview.java @@ -0,0 +1,48 @@ +package com.fr.design.preview; + +import com.fr.design.fun.impl.AbstractPreviewProvider; +import com.fr.general.Inter; + +import java.util.HashMap; +import java.util.Map; + +/** + * @author kerry + * @date 2018/5/11 + */ +public class MobilePreview extends AbstractPreviewProvider { + private static final int PREVIEW_TYPE = 4; + private static final String ACTION_TYPE = "path"; + + @Override + public String nameForPopupItem() { + return Inter.getLocText("Fine-Engine_Mobile_Preview"); + } + + @Override + public String iconPathForPopupItem() { + return "com/fr/design/images/buttonicon/mobile.png"; + } + + @Override + public String iconPathForLarge() { + return "com/fr/design/images/buttonicon/mobileb24.png"; + } + + @Override + public int previewTypeCode() { + return PREVIEW_TYPE; + } + + @Override + public String getActionType() { + return ACTION_TYPE; + } + + @Override + public Map parametersForPreview() { + Map map = new HashMap(); + map.put("op", "mobile"); + return map; + } +} diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/mobile.png b/designer-base/src/main/resources/com/fr/design/images/buttonicon/mobile.png new file mode 100644 index 0000000000000000000000000000000000000000..989111f3dd7c9faa60758ea67a1ecf0c3c6c9d12 GIT binary patch literal 550 zcmV+>0@?kEP)Px$;7LS5R5%fRlR;|}Q51#0NoLZaXu7B%6H1j_xfI6-?S{cC??zuqYRp(Dlkd4EAAW=}wC|qJ8Qk~U$%7IDsg}v*)lQOl z#xbJv%0{ngI^pF(F;Ey0OggCuTG{9@l!dV)dvUK$M+9pN+p7~QH8fx_dqTyek&Xzk z--2rsX*U0Sr@H)-^E+j%?cY+bE$tQDkrZ`5YHCsu%Ai;*;Mdj^T&qB`X8!=S zUo}N2gTKutY5S0ZYXIVNAA%-<{&PfRB>(^b07*qoM6N<$f_(e}4FCWD literal 0 HcmV?d00001 diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/mobileb24.png b/designer-base/src/main/resources/com/fr/design/images/buttonicon/mobileb24.png new file mode 100644 index 0000000000000000000000000000000000000000..c1f62a6fbfbcd203bb3487504a13a62d74bbb534 GIT binary patch literal 1055 zcmV+)1mOFLP)Px&*-1n}R9FeMS9?fPQ5gT-y;QJTTTPwY${spR%CM+R=mn7w6hu~kM35mye?&z= zMS(#{RDVQIdVo<;R76A~81^s>41%Pxl|5GY2>0-nI=9_>+qrtz+gaCeJVlDgn0 z;3LV-6D>}#2!`A#N)q6S$j#4o=s-pyk`RGJ3iG++LSS#Pnmd`b_So>TBY3LgG%F&I zJ%!?Sc6q(z!=sp{A_8LQG)+S_*ag*)o4m!uLS$`mZ$;Dh1E)?sMsssB(o{NV)hw70 z88&S`dUG}acAIQr-WeBx#`+o<-rj?Kb1BNo%HU@7u<0rEd0lu|`y4fw4kF#Z9Y|Wn z*O8oK5+FBuZ?OhX9CTq=2vv>4~lRKd6? zIpkj`S)4c&-2pb}Lv?jE$}4ulXiAp^wpeYbsHlMR#dRQ*BPWUo_?@p|x7(37CtnVe z^A!{nVAgCqQhqne#wsEZaD72ePL3>Kq%$u+A6n1HNRvQUL_p>5M@B}507S}=k!giC z&@JWW?1~7mx(Vp)?34wJboO{Xpw%gnCV{SqfM#koT3cHMAW{bBkM9^xogwAs?1~8J zrY%NGOA9_b9I~Lq>2kTy)c6v9bCGOp%=Z9!_MbTXqaZ0rwr#@Ma~HAeKqbCF9|r%` zL%y6wzMk5>eq0O1&=a%3Bux&-h$)IrfB^U`E8sE|;Y{T|ynFKsEIam-?dMkqPFLF35Y*4cgGcx9@YYor%~{ZBb#Qk$5rh^4wlx@R zug9=&5PokPZeOYbm3ZjC^YrWezXJ2(*Q~meF1=9QdCUf;~nAcYw6ep$I|Xn5_5~Tzej! Z`WJ>eID1=>t}g%p002ovPDHLkV1kt%<9z@C literal 0 HcmV?d00001 diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index df113a7bb..25fc777e6 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -25,6 +25,7 @@ import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.properties.FormWidgetAuthorityEditPane; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; +import com.fr.design.fun.PreviewProvider; import com.fr.design.gui.frpane.HyperlinkGroupPane; import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider; import com.fr.design.gui.ilable.UILabel; @@ -46,6 +47,8 @@ import com.fr.design.menu.MenuDef; import com.fr.design.menu.ShortCut; import com.fr.design.menu.ToolBarDef; import com.fr.design.parameter.ParameterPropertyPane; +import com.fr.design.preview.FormPreview; +import com.fr.design.preview.MobilePreview; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.utils.gui.LayoutUtils; import com.fr.file.FILE; @@ -80,7 +83,9 @@ import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.image.BufferedImage; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; public class JForm extends JTemplate implements BaseJForm { private static final String FORM_CARD = "FORM"; @@ -683,7 +688,7 @@ public class JForm extends JTemplate implements BaseJForm { * */ public Icon getPreviewLargeIcon() { - return UIConstants.RUN_BIG_ICON; + return super.getPreviewLargeIcon(); } @Override @@ -698,14 +703,19 @@ public class JForm extends JTemplate implements BaseJForm { * @return 菜单 */ public UIMenuItem[] createMenuItem4Preview() { - UIMenuItem form = new UIMenuItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_M_Form_Preview"), UIConstants.RUN_SMALL_ICON); - form.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - WebPreviewUtils.preview(JForm.this); - } - }); - return new UIMenuItem[]{form}; + List menuItems = new ArrayList(); + PreviewProvider[] previewProviders = supportPreview(); + for (final PreviewProvider provider : previewProviders) { + UIMenuItem item = new UIMenuItem(provider.nameForPopupItem(), BaseUtils.readIcon(provider.iconPathForPopupItem())); + item.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + provider.onClick(JForm.this); + } + }); + menuItems.add(item); + } + return menuItems.toArray(new UIMenuItem[menuItems.size()]); } /** @@ -922,6 +932,26 @@ public class JForm extends JTemplate implements BaseJForm { return creator.toData(); } + /** + * 支持的预览模式 + * @return 预览模式 + */ + @Override + public PreviewProvider[] supportPreview() { + return new PreviewProvider[]{new FormPreview(), new MobilePreview()}; + } + + /** + * 预览按钮点击事件 + * + * @param provider 预览接口 + */ + @Override + public void previewMenuActionPerformed(PreviewProvider provider) { + super.previewMenuActionPerformed(provider); + } + + @Override public String route() { return ViewRequestConstants.FORM_VIEW_PATH; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java index fc1945daf..e60fa5978 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java @@ -53,6 +53,7 @@ import com.fr.design.menu.ToolBarDef; import com.fr.design.module.DesignModuleFactory; import com.fr.design.parameter.ParameterDefinitePane; import com.fr.design.parameter.ParameterInputPane; +import com.fr.design.preview.MobilePreview; import com.fr.design.preview.PagePreview; import com.fr.design.preview.ViewPreview; import com.fr.design.preview.WriteEnhancePreview; @@ -890,7 +891,7 @@ public class JWorkBook extends JTemplate { public PreviewProvider[] supportPreview() { Set set = ExtraDesignClassManager.getInstance().getArray(PreviewProvider.MARK_STRING); return ArrayUtils.addAll(new PreviewProvider[]{ - new PagePreview(), new WritePreview(), new ViewPreview(), new WriteEnhancePreview() + new PagePreview(), new WritePreview(), new ViewPreview(), new WriteEnhancePreview(), new MobilePreview() }, set.toArray(new PreviewProvider[set.size()])); }