Browse Source

Merge pull request #391 in DESIGN/design from ~KERRY/design_10.0:feature/10.0 to feature/10.0

* commit 'c04544037683fc516d8e7f808173a7acb05c2a70':
  添加注释
  无
  REPORT-10676 9patch10, FR9.0设计器支持移动端预览效果
research/10.0
kerry 6 years ago
parent
commit
e671e1e2ef
  1. 2
      designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java
  2. 8
      designer-base/src/main/java/com/fr/design/fun/PreviewProvider.java
  3. 7
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractPreviewProvider.java
  4. 5
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  5. 34
      designer-base/src/main/java/com/fr/design/preview/FormPreview.java
  6. 48
      designer-base/src/main/java/com/fr/design/preview/MobilePreview.java
  7. BIN
      designer-base/src/main/resources/com/fr/design/images/buttonicon/mobile.png
  8. BIN
      designer-base/src/main/resources/com/fr/design/images/buttonicon/mobileb24.png
  9. 47
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  10. 3
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

2
designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java

@ -27,7 +27,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<String, Object> map, String actionType) {

8
designer-base/src/main/java/com/fr/design/fun/PreviewProvider.java

@ -54,4 +54,12 @@ public interface PreviewProvider extends Mutable{
*/
Map<String, Object> parametersForPreview();
/**
* 该种预览方式下对模板的处理方式
* 分页填报等需要计算输出模板移动端预览直接输出url
* @return 处理方式
*/
String getActionType();
}

7
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;
}
}

5
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<T extends BaseBook, U extends BaseUndoState<?>>
* @return
*/
public Icon getPreviewLargeIcon() {
return UIConstants.RUN_BIG_ICON;
PreviewProvider provider = getPreviewType();
String iconPath = provider.iconPathForLarge();
return BaseUtils.readIcon(iconPath);
}
/**

34
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;
}
}

48
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<String, Object> parametersForPreview() {
Map<String, Object> map = new HashMap<String, Object>();
map.put("op", "mobile");
return map;
}
}

BIN
designer-base/src/main/resources/com/fr/design/images/buttonicon/mobile.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 550 B

BIN
designer-base/src/main/resources/com/fr/design/images/buttonicon/mobileb24.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

47
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;
@ -78,7 +81,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<Form, FormUndoState> implements BaseJForm {
private static final String FORM_CARD = "FORM";
@ -678,7 +683,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
*
*/
public Icon getPreviewLargeIcon() {
return UIConstants.RUN_BIG_ICON;
return super.getPreviewLargeIcon();
}
@Override
@ -693,14 +698,19 @@ public class JForm extends JTemplate<Form, FormUndoState> 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<UIMenuItem> menuItems = new ArrayList<UIMenuItem>();
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()]);
}
/**
@ -917,6 +927,25 @@ public class JForm extends JTemplate<Form, FormUndoState> 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;

3
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<WorkBook, WorkBookUndoState> {
public PreviewProvider[] supportPreview() {
Set<PreviewProvider> 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()]));
}

Loading…
Cancel
Save