diff --git a/designer-base/src/main/java/com/fr/design/fun/MobileTemplateStyleProvider.java b/designer-base/src/main/java/com/fr/design/fun/MobileTemplateStyleProvider.java new file mode 100644 index 0000000000..770e65a9ee --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/MobileTemplateStyleProvider.java @@ -0,0 +1,25 @@ +package com.fr.design.fun; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.general.cardtag.mobile.MobileTemplateStyle; +import com.fr.stable.fun.mark.Mutable; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/3/31 + */ +public interface MobileTemplateStyleProvider extends Mutable { + + String XML_TAG = "MobileTemplateStyleProvider"; + + int CURRENT_LEVEL = 1; + + Class classFroMobileTemplateStyle(); + + + Class> classFroMobileTemplateStyleAppearance(); + + String displayName(); + +} diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractMobileTemplateStyleProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractMobileTemplateStyleProvider.java new file mode 100644 index 0000000000..54c947c57a --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractMobileTemplateStyleProvider.java @@ -0,0 +1,25 @@ +package com.fr.design.fun.impl; + +import com.fr.design.fun.MobileTemplateStyleProvider; +import com.fr.design.fun.MobileWidgetStyleProvider; +import com.fr.stable.fun.impl.AbstractProvider; +import com.fr.stable.fun.mark.API; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/3/31 + */ +@API(level = MobileWidgetStyleProvider.CURRENT_LEVEL) +public abstract class AbstractMobileTemplateStyleProvider extends AbstractProvider implements MobileTemplateStyleProvider { + + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + @Override + public String mark4Provider() { + return getClass().getName(); + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java index 76434545ed..9c52673d7f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java @@ -1,11 +1,14 @@ package com.fr.design.mainframe.widget.accessibles; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.fun.MobileTemplateStyleProvider; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.mobile.ui.TemplateStyleDefinePaneFactory; import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.general.cardtag.mobile.MobileTemplateStyle; import com.fr.general.cardtag.mobile.MobileTemplateStyleType; +import com.fr.invoke.Reflect; import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListModel; import javax.swing.JList; @@ -18,9 +21,12 @@ import java.awt.Dimension; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; public class MobileTemplateStylePane extends AbstractTemplateStylePane { private static final List STYLE_LIST = new ArrayList(); @@ -36,6 +42,7 @@ public class MobileTemplateStylePane extends AbstractTemplateStylePane> map = new HashMap<>(); private JPanel right; private CardLayout card; + private Set> extraStyle = new HashSet<>(); public MobileTemplateStylePane(WCardTagLayout tagLayout){ init(tagLayout); } @@ -52,6 +59,7 @@ public class MobileTemplateStylePane extends AbstractTemplateStylePane list = getMobileTemplateStyleProvider(); + for (MobileTemplateStyleProvider provider : list) { + String displayName = provider.displayName(); + Class> clazz = provider.classFroMobileTemplateStyleAppearance(); + BasicBeanPane styleBasicBeanPane = Reflect.on(clazz).create().get(); + listModel.addElement(displayName); + map.put(displayName, styleBasicBeanPane); + right.add(displayName, styleBasicBeanPane); + extraStyle.add(provider.classFroMobileTemplateStyle()); + } + } + public static ListCellRenderer render = new DefaultListCellRenderer() { @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { @@ -97,16 +119,31 @@ public class MobileTemplateStylePane extends AbstractTemplateStylePane getMobileTemplateStyleProvider() { + List list = new ArrayList<>(); + Set sets = ExtraDesignClassManager.getInstance().getArray(MobileTemplateStyleProvider.XML_TAG); + list.addAll(sets); + return Collections.unmodifiableList(list); + } } diff --git a/designer-base/src/main/java/com/fr/exit/DesignerExiter.java b/designer-base/src/main/java/com/fr/exit/DesignerExiter.java index e7189511a1..b9067a22ee 100644 --- a/designer-base/src/main/java/com/fr/exit/DesignerExiter.java +++ b/designer-base/src/main/java/com/fr/exit/DesignerExiter.java @@ -22,7 +22,7 @@ public class DesignerExiter { public void execute() { beforeExit(); if (FineProcessContext.getParentPipe() != null) { - FineProcessContext.getParentPipe().fire(FineProcessEngineEvent.DESTROY); + FineProcessContext.getParentPipe().syncFire(FineProcessEngineEvent.DESTROY); } System.exit(0); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/template/info/JWorkBookProcessInfo.java b/designer-realize/src/main/java/com/fr/design/mainframe/template/info/JWorkBookProcessInfo.java index eec7773282..85266b7cd8 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/template/info/JWorkBookProcessInfo.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/template/info/JWorkBookProcessInfo.java @@ -5,6 +5,7 @@ import com.fr.main.impl.WorkBook; import com.fr.main.parameter.ReportParameterAttr; import com.fr.report.cellcase.CellCase; import com.fr.report.poly.PolyWorkSheet; +import com.fr.report.report.Report; import com.fr.report.worksheet.WorkSheet; import java.util.Iterator; @@ -61,8 +62,12 @@ public class JWorkBookProcessInfo extends TemplateProcessInfo { int blockCount = 0; if (!template.isElementCaseBook()) { // 如果是聚合报表 for (int i = 0; i < template.getReportCount(); i++) { - PolyWorkSheet r = (PolyWorkSheet) template.getReport(i); - blockCount += r.getBlockCount(); + Report report = template.getReport(i); + // 考虑多个sheet下 包含WorkSheet的情况 需要判断下 + if (report instanceof PolyWorkSheet) { + PolyWorkSheet r = (PolyWorkSheet) report; + blockCount += r.getBlockCount(); + } } } return blockCount;