diff --git a/.gitkeep b/.gitkeep new file mode 100644 index 0000000..038c2a6 --- /dev/null +++ b/.gitkeep @@ -0,0 +1,6 @@ +*.iml +.idea/ +.DS_Store +.classpath +target/ +lib/report/*.jar \ No newline at end of file diff --git a/build.xml b/build.xml index 49325d9..7eef8d6 100644 --- a/build.xml +++ b/build.xml @@ -1,10 +1,11 @@ - + + @@ -29,6 +30,9 @@ + + + @@ -44,7 +48,7 @@ - + @@ -59,11 +63,15 @@ target="${target_jdk_version}" fork="true" memoryMaximumSize="512m" listfiles="false" srcdir="${basedir}" executable="${compile_jdk_version}/bin/javac"> - + + + + + @@ -93,6 +101,7 @@ + @@ -106,12 +115,16 @@ + + + + + - - + - + \ No newline at end of file diff --git a/lib/finekit-10.0.jar b/lib/finekit-10.0.jar new file mode 100644 index 0000000..3e35e75 Binary files /dev/null and b/lib/finekit-10.0.jar differ diff --git a/plugin.xml b/plugin.xml index 63b1eff..636baa9 100644 --- a/plugin.xml +++ b/plugin.xml @@ -3,21 +3,23 @@ com.fr.plugin.report.lazysheet yes - 2.1 - 8.0 + 3.0 + 10.0 2015-08-09 solution.richie [2016-04-11]增加插件API兼容性检测
]]>
- + - + - + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..f6528b9 --- /dev/null +++ b/pom.xml @@ -0,0 +1,61 @@ + + + 4.0.0 + + + com.fr.plugin + starter + 10.0 + + jar + plugin-lazysheet + + + com.fanruan.api + finekit + 10.0 + system + ${project.basedir}/lib/finekit-10.0.jar + + + + + ${project.basedir}/../webroot/WEB-INF/plugins/plugin-com.fr.plugin.report.lazysheet-1.0/classes + + + org.apache.maven.plugins + maven-compiler-plugin + + 6 + 6 + + + + + + + fanruan + fanruan + http://mvn.finedevelop.com/repository/maven-public/ + + true + always + warn + + + + + + fanruan + fanruan + http://mvn.finedevelop.com/repository/maven-public/ + + true + always + warn + + + + \ No newline at end of file diff --git a/src/com/fr/plugin/lazy/sheet/LazySheetActor.java b/src/com/fr/plugin/lazy/sheet/LazySheetActor.java deleted file mode 100644 index 58d2b4f..0000000 --- a/src/com/fr/plugin/lazy/sheet/LazySheetActor.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.fr.plugin.lazy.sheet; - -import com.fr.general.Inter; -import com.fr.main.impl.WorkBook; -import com.fr.main.workbook.ResultWorkBook; -import com.fr.plugin.ExtraClassManager; -import com.fr.stable.ViewActor; -import com.fr.stable.fun.FunctionHelper; -import com.fr.stable.fun.FunctionProcessor; -import com.fr.stable.fun.impl.AbstractFunctionProcessor; - -import java.util.Map; - -/** - * Created by richie on 15/7/17. - */ -public class LazySheetActor extends ViewActor { - - private static final FunctionProcessor PPP = new AbstractFunctionProcessor() { - @Override - public int getId() { - return FunctionHelper.generateFunctionID(LazyConstants.PLUGIN_ID); - } - - @Override - public String getLocaleKey() { - return Inter.getLocText("Plugin-Lazy_Load_Sheet"); - } - }; - - @Override - public ResultWorkBook executeWorkBook(WorkBook workBook, Map parameterMap, int sheetIndex) { - if (parameterMap.containsKey("__lazy__")) { - FunctionProcessor processor = ExtraClassManager.getInstance().getFunctionProcessor(); - if (processor != null) { - processor.recordFunction(PPP); - } - return new LazySheetWorkBookExecutor(workBook, parameterMap, sheetIndex).execute(); - } else { - return super.executeWorkBook(workBook, parameterMap, sheetIndex); - } - } -} \ No newline at end of file diff --git a/src/com/fr/plugin/lazy/sheet/LazySheetPreview.java b/src/com/fr/plugin/lazy/sheet/LazySheetPreview.java deleted file mode 100644 index 1d786a3..0000000 --- a/src/com/fr/plugin/lazy/sheet/LazySheetPreview.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.fr.plugin.lazy.sheet; - -import com.fr.design.preview.ViewPreview; - -import java.util.HashMap; -import java.util.Map; - -/** - * Created by richie on 15/7/17. - */ -public class LazySheetPreview extends ViewPreview { - - @Override - public int currentAPILevel() { - return CURRENT_LEVEL; - } - - @Override - public String nameForPopupItem() { - return "懒加载多sheet"; - } - - @Override - public int previewTypeCode() { - return 18; - } - - @Override - public Map parametersForPreview() { - Map map = super.parametersForPreview(); - map.put("__lazy__", true); - return map; - } -} \ No newline at end of file diff --git a/src/com/fr/plugin/lazy/sheet/locale/lazy.properties b/src/com/fr/plugin/lazy/sheet/locale/lazy.properties deleted file mode 100644 index 91ae042..0000000 --- a/src/com/fr/plugin/lazy/sheet/locale/lazy.properties +++ /dev/null @@ -1 +0,0 @@ -Plugin-Lazy_Load_Sheet=Lazy Load Sheet \ No newline at end of file diff --git a/src/com/fr/plugin/lazy/sheet/locale/lazy_en_US.properties b/src/com/fr/plugin/lazy/sheet/locale/lazy_en_US.properties deleted file mode 100644 index 91ae042..0000000 --- a/src/com/fr/plugin/lazy/sheet/locale/lazy_en_US.properties +++ /dev/null @@ -1 +0,0 @@ -Plugin-Lazy_Load_Sheet=Lazy Load Sheet \ No newline at end of file diff --git a/src/com/fr/plugin/lazy/sheet/locale/lazy_zh_CN.properties b/src/com/fr/plugin/lazy/sheet/locale/lazy_zh_CN.properties deleted file mode 100644 index b00b88b..0000000 --- a/src/com/fr/plugin/lazy/sheet/locale/lazy_zh_CN.properties +++ /dev/null @@ -1 +0,0 @@ -Plugin-Lazy_Load_Sheet=\u61D2\u52A0\u8F7D\u591Asheet \ No newline at end of file diff --git a/src/com/fr/plugin/lazy/sheet/locale/LazyLocaleFinder.java b/src/main/java/com/fr/plugin/lazy/sheet/LazyLocaleBridge.java similarity index 67% rename from src/com/fr/plugin/lazy/sheet/locale/LazyLocaleFinder.java rename to src/main/java/com/fr/plugin/lazy/sheet/LazyLocaleBridge.java index d199a4f..6fd344f 100644 --- a/src/com/fr/plugin/lazy/sheet/locale/LazyLocaleFinder.java +++ b/src/main/java/com/fr/plugin/lazy/sheet/LazyLocaleBridge.java @@ -1,15 +1,15 @@ -package com.fr.plugin.lazy.sheet.locale; +package com.fr.plugin.lazy.sheet; import com.fr.stable.fun.impl.AbstractLocaleFinder; /** * Created by richie on 16/4/11. */ -public class LazyLocaleFinder extends AbstractLocaleFinder { +public class LazyLocaleBridge extends AbstractLocaleFinder { @Override public int currentAPILevel() { - return 1; + return CURRENT_LEVEL; } @Override diff --git a/src/com/fr/plugin/lazy/sheet/LazySheetActorMark.java b/src/main/java/com/fr/plugin/lazy/sheet/LazySheetActorBridge.java similarity index 76% rename from src/com/fr/plugin/lazy/sheet/LazySheetActorMark.java rename to src/main/java/com/fr/plugin/lazy/sheet/LazySheetActorBridge.java index 173ac70..bc81a41 100644 --- a/src/com/fr/plugin/lazy/sheet/LazySheetActorMark.java +++ b/src/main/java/com/fr/plugin/lazy/sheet/LazySheetActorBridge.java @@ -1,12 +1,13 @@ package com.fr.plugin.lazy.sheet; +import com.fr.plugin.lazy.sheet.fun.LazySheetActor; import com.fr.report.fun.impl.AbstractActorProvider; import com.fr.report.stable.fun.Actor; /** * Created by richie on 15/7/17. */ -public class LazySheetActorMark extends AbstractActorProvider { +public class LazySheetActorBridge extends AbstractActorProvider { @Override public int currentAPILevel() { diff --git a/src/main/java/com/fr/plugin/lazy/sheet/LazySheetPreviewBridge.java b/src/main/java/com/fr/plugin/lazy/sheet/LazySheetPreviewBridge.java new file mode 100644 index 0000000..067fdd6 --- /dev/null +++ b/src/main/java/com/fr/plugin/lazy/sheet/LazySheetPreviewBridge.java @@ -0,0 +1,44 @@ +package com.fr.plugin.lazy.sheet; + +import com.fanruan.api.i18n.I18nKit; +import com.fr.design.fun.impl.AbstractPreviewProvider; + +import java.util.HashMap; +import java.util.Map; + +/** + * Created by richie on 15/7/17. + */ +public class LazySheetPreviewBridge extends AbstractPreviewProvider { + + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + public String iconPathForPopupItem() { + return "com/fr/design/images/buttonicon/anas.png"; + } + + public String iconPathForLarge() { + return "com/fr/design/images/buttonicon/anab24.png"; + } + + @Override + public String nameForPopupItem() { + return I18nKit.getLocText("Plugin-Lazy_Load_Preview"); + } + + @Override + public int previewTypeCode() { + return 18; + } + + @Override + public Map parametersForPreview() { + Map map = new HashMap(); + map.put("op", "view"); + map.put("__lazy__", true); + return map; + } +} \ No newline at end of file diff --git a/src/com/fr/plugin/lazy/sheet/LazyConstants.java b/src/main/java/com/fr/plugin/lazy/sheet/fun/LazyConstants.java similarity index 79% rename from src/com/fr/plugin/lazy/sheet/LazyConstants.java rename to src/main/java/com/fr/plugin/lazy/sheet/fun/LazyConstants.java index e94f8dc..527c1ec 100644 --- a/src/com/fr/plugin/lazy/sheet/LazyConstants.java +++ b/src/main/java/com/fr/plugin/lazy/sheet/fun/LazyConstants.java @@ -1,4 +1,4 @@ -package com.fr.plugin.lazy.sheet; +package com.fr.plugin.lazy.sheet.fun; /** * Created by richie on 16/4/11. diff --git a/src/main/java/com/fr/plugin/lazy/sheet/fun/LazySheetActor.java b/src/main/java/com/fr/plugin/lazy/sheet/fun/LazySheetActor.java new file mode 100644 index 0000000..f4d810c --- /dev/null +++ b/src/main/java/com/fr/plugin/lazy/sheet/fun/LazySheetActor.java @@ -0,0 +1,30 @@ +package com.fr.plugin.lazy.sheet.fun; + +import com.fanruan.api.report.view.BaseViewActor; +import com.fr.intelli.record.Focus; +import com.fr.main.TemplateWorkBook; +import com.fr.main.workbook.ResultWorkBook; +import com.fr.record.analyzer.EnableMetrics; + +import java.util.Map; + +/** + * Created by richie on 15/7/17. + */ +@EnableMetrics +public class LazySheetActor extends BaseViewActor { + + @Override + @Focus(id = LazyConstants.PLUGIN_ID, text = "Plugin-Lazy_Load_Sheet") + public ResultWorkBook run(TemplateWorkBook workBook, Map parameterMap, int sheetIndex) { + if (parameterMap.containsKey("__lazy__")) { + return lazyExecute(workBook, parameterMap, sheetIndex); + } else { + return super.executeWorkBook(workBook, parameterMap, sheetIndex); + } + } + + private ResultWorkBook lazyExecute(TemplateWorkBook workBook, Map parameterMap, int sheetIndex) { + return new LazySheetWorkBookExecutor(workBook, parameterMap, sheetIndex).execute(); + } +} \ No newline at end of file diff --git a/src/com/fr/plugin/lazy/sheet/LazySheetWorkBookExecutor.java b/src/main/java/com/fr/plugin/lazy/sheet/fun/LazySheetWorkBookExecutor.java similarity index 65% rename from src/com/fr/plugin/lazy/sheet/LazySheetWorkBookExecutor.java rename to src/main/java/com/fr/plugin/lazy/sheet/fun/LazySheetWorkBookExecutor.java index 28f61a5..472308d 100644 --- a/src/com/fr/plugin/lazy/sheet/LazySheetWorkBookExecutor.java +++ b/src/main/java/com/fr/plugin/lazy/sheet/fun/LazySheetWorkBookExecutor.java @@ -1,37 +1,30 @@ -package com.fr.plugin.lazy.sheet; +package com.fr.plugin.lazy.sheet.fun; -import com.fr.main.impl.WorkBook; -import com.fr.main.workbook.AnalyRWorkBook; -import com.fr.main.workbook.ResultWorkBook; +import com.fanruan.api.report.executor.ViewWorkBookExecutor; +import com.fr.main.TemplateWorkBook; import com.fr.report.report.ResultReport; import com.fr.report.report.TemplateReport; import com.fr.report.stable.fun.Actor; -import com.fr.view.cal.sheet.AnalyWorkBookExecutor; import java.util.Map; /** * Created by richie on 15/7/17. */ -public class LazySheetWorkBookExecutor extends AnalyWorkBookExecutor { +public class LazySheetWorkBookExecutor extends ViewWorkBookExecutor { private int sheetIndex; - public LazySheetWorkBookExecutor(WorkBook workBook, Map parameterMap, int sheetIndex) { + public LazySheetWorkBookExecutor(TemplateWorkBook workBook, Map parameterMap, int sheetIndex) { super(workBook, parameterMap); this.sheetIndex = sheetIndex; } - @Override - public ResultWorkBook initResultBook(Map parameterMap) { - return new AnalyRWorkBook(parameterMap); - } - @Override public Actor getExeType() { return new LazySheetActor(); } - protected void _execute(){ + protected void _execute() { // 先按顺序来,其实这里就一个个塞进去,然后在这里面开始统一分步计算 TemplateReport report; for (int i = 0, len = this.nameListMap.size(); i < len; i++) { diff --git a/src/main/resources/com/fr/plugin/lazy/sheet/locale/lazy.properties b/src/main/resources/com/fr/plugin/lazy/sheet/locale/lazy.properties new file mode 100644 index 0000000..fc69a6b --- /dev/null +++ b/src/main/resources/com/fr/plugin/lazy/sheet/locale/lazy.properties @@ -0,0 +1,2 @@ +Plugin-Lazy_Load_Sheet=Lazy Load Sheet +Plugin-Lazy_Load_Preview=Lazy Preview \ No newline at end of file diff --git a/src/main/resources/com/fr/plugin/lazy/sheet/locale/lazy_en_US.properties b/src/main/resources/com/fr/plugin/lazy/sheet/locale/lazy_en_US.properties new file mode 100644 index 0000000..fc69a6b --- /dev/null +++ b/src/main/resources/com/fr/plugin/lazy/sheet/locale/lazy_en_US.properties @@ -0,0 +1,2 @@ +Plugin-Lazy_Load_Sheet=Lazy Load Sheet +Plugin-Lazy_Load_Preview=Lazy Preview \ No newline at end of file diff --git a/src/main/resources/com/fr/plugin/lazy/sheet/locale/lazy_zh_CN.properties b/src/main/resources/com/fr/plugin/lazy/sheet/locale/lazy_zh_CN.properties new file mode 100644 index 0000000..9d7129d --- /dev/null +++ b/src/main/resources/com/fr/plugin/lazy/sheet/locale/lazy_zh_CN.properties @@ -0,0 +1,2 @@ +Plugin-Lazy_Load_Sheet=\u61D2\u52A0\u8F7D\u591Asheet +Plugin-Lazy_Load_Preview=\u61D2\u52A0\u8F7D\u591Asheet \ No newline at end of file