Browse Source

适配10.0

master 3.0
richie 5 years ago
parent
commit
48cb3f39db
  1. 6
      .gitkeep
  2. 23
      build.xml
  3. BIN
      lib/finekit-10.0.jar
  4. 12
      plugin.xml
  5. 61
      pom.xml
  6. 43
      src/com/fr/plugin/lazy/sheet/LazySheetActor.java
  7. 34
      src/com/fr/plugin/lazy/sheet/LazySheetPreview.java
  8. 1
      src/com/fr/plugin/lazy/sheet/locale/lazy.properties
  9. 1
      src/com/fr/plugin/lazy/sheet/locale/lazy_en_US.properties
  10. 1
      src/com/fr/plugin/lazy/sheet/locale/lazy_zh_CN.properties
  11. 6
      src/main/java/com/fr/plugin/lazy/sheet/LazyLocaleBridge.java
  12. 3
      src/main/java/com/fr/plugin/lazy/sheet/LazySheetActorBridge.java
  13. 44
      src/main/java/com/fr/plugin/lazy/sheet/LazySheetPreviewBridge.java
  14. 2
      src/main/java/com/fr/plugin/lazy/sheet/fun/LazyConstants.java
  15. 30
      src/main/java/com/fr/plugin/lazy/sheet/fun/LazySheetActor.java
  16. 19
      src/main/java/com/fr/plugin/lazy/sheet/fun/LazySheetWorkBookExecutor.java
  17. 2
      src/main/resources/com/fr/plugin/lazy/sheet/locale/lazy.properties
  18. 2
      src/main/resources/com/fr/plugin/lazy/sheet/locale/lazy_en_US.properties
  19. 2
      src/main/resources/com/fr/plugin/lazy/sheet/locale/lazy_zh_CN.properties

6
.gitkeep

@ -0,0 +1,6 @@
*.iml
.idea/
.DS_Store
.classpath
target/
lib/report/*.jar

23
build.xml

@ -1,10 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="jar" name="plugin">
<!-- JDK路径,根据自己机器上实际位置修改-->
<property name="jdk.home" value="/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home"/>
<property name="jdk.home" value="/Library/Java/JavaVirtualMachines/jdk1.8/Contents/Home"/>
<property name="libs" value="${basedir}/lib"/>
<property name="publicLibs" value=""/>
<property name="reportLibs" value="${basedir}/../webroot/WEB-INF/lib"/>
<property name="destLoc" value="."/>
<property name="classes" value="classes"/>
<xmlproperty file="${basedir}/plugin.xml"/>
@ -29,6 +30,9 @@
<fileset dir="${publicLibs}">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${reportLibs}">
<include name="**/*.jar"/>
</fileset>
</path>
<patternset id="resources4Jar">
<exclude name="**/.settings/**"/>
@ -44,7 +48,7 @@
<echo message="从${resources_from}拷贝图片,JS,CSS等资源文件"/>
<delete dir="tmp"/>
<copy todir="tmp">
<fileset dir="${resources_from}\src">
<fileset dir="${resources_from}/src/main/resources">
<patternset refid="resources4Jar"/>
</fileset>
</copy>
@ -59,11 +63,15 @@
target="${target_jdk_version}"
fork="true" memoryMaximumSize="512m" listfiles="false" srcdir="${basedir}"
executable="${compile_jdk_version}/bin/javac">
<src path="${basedir}/src"/>
<src path="${basedir}/src/main/java"/>
<exclude name="**/.svn/**"/>
<compilerarg line="-encoding UTF8 "/>
<classpath refid="compile.classpath"/>
</javac>
<taskdef name="pretreatment" classname="com.fr.plugin.pack.PluginPretreatmentTask">
<classpath refid="compile.classpath"/>
</taskdef>
<pretreatment baseDir="${basedir}"/>
</target>
<target name="jar_classes">
@ -93,6 +101,7 @@
<delete dir="${classes}"/>
</target>
<target name="jar" depends="super_jar">
<antcall target="zip"/>
</target>
@ -106,12 +115,16 @@
<include name="${plugin-jar}"/>
<include name="plugin.xml"/>
</fileset>
<fileset dir="${libs}">
<include name="*.jar"/>
<include name="*.dll"/>
</fileset>
</copy>
<zip destfile="${basedir}/${plugin-folder}.zip" basedir=".">
<include name="${plugin-folder}/*.jar"/>
<include name="${plugin-folder}/*.dll"/>
<include name="${plugin-folder}/plugin.xml"/>
</zip>
<xmlproperty file="${basedir}/plugin.xml"/>
<move file="${plugin-folder}.zip" todir="${destLoc}/${plugin.name}"/>
<move file="${plugin-folder}.zip" todir="${destLoc}/install"/>
</target>
</project>

BIN
lib/finekit-10.0.jar

Binary file not shown.

12
plugin.xml

@ -3,21 +3,23 @@
<id>com.fr.plugin.report.lazysheet</id>
<name><![CDATA[多sheet懒加载]]></name>
<active>yes</active>
<version>2.1</version>
<env-version>8.0</env-version>
<version>3.0</version>
<env-version>10.0</env-version>
<jartime>2015-08-09</jartime>
<vendor email="solution@finereport.com">solution.richie</vendor>
<description><![CDATA[多sheet报表仅仅只加载当前sheet(不支持sheet间运算)]]></description>
<change-notes><![CDATA[
[2019-10-12]适配10.0版本以及完全依赖FineKit。<br/>
[2016-04-11]增加插件API兼容性检测<br/>
]]></change-notes>
<extra-core>
<LocaleFinder class="com.fr.plugin.lazy.sheet.locale.LazyLocaleFinder"/>
<LocaleFinder class="com.fr.plugin.lazy.sheet.LazyLocaleBridge"/>
</extra-core>
<extra-report>
<ActorProvider class="com.fr.plugin.lazy.sheet.LazySheetActorMark"/>
<ActorProvider class="com.fr.plugin.lazy.sheet.LazySheetActorBridge"/>
</extra-report>
<extra-designer>
<PreviewProvider class="com.fr.plugin.lazy.sheet.LazySheetPreview"/>
<PreviewProvider class="com.fr.plugin.lazy.sheet.LazySheetPreviewBridge"/>
</extra-designer>
<function-recorder class="com.fr.plugin.lazy.sheet.fun.LazySheetActor"/>
</plugin>

61
pom.xml

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.fr.plugin</groupId>
<artifactId>starter</artifactId>
<version>10.0</version>
</parent>
<packaging>jar</packaging>
<artifactId>plugin-lazysheet</artifactId>
<dependencies>
<dependency>
<groupId>com.fanruan.api</groupId>
<artifactId>finekit</artifactId>
<version>10.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/finekit-10.0.jar</systemPath>
</dependency>
</dependencies>
<build>
<!---如果要更改调试插件,改这里的配置就可以了-->
<outputDirectory>${project.basedir}/../webroot/WEB-INF/plugins/plugin-com.fr.plugin.report.lazysheet-1.0/classes</outputDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>6</source>
<target>6</target>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>fanruan</id>
<name>fanruan</name>
<url>http://mvn.finedevelop.com/repository/maven-public/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>fanruan</id>
<name>fanruan</name>
<url>http://mvn.finedevelop.com/repository/maven-public/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>

43
src/com/fr/plugin/lazy/sheet/LazySheetActor.java

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

34
src/com/fr/plugin/lazy/sheet/LazySheetPreview.java

@ -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<String, Object> parametersForPreview() {
Map<String, Object> map = super.parametersForPreview();
map.put("__lazy__", true);
return map;
}
}

1
src/com/fr/plugin/lazy/sheet/locale/lazy.properties

@ -1 +0,0 @@
Plugin-Lazy_Load_Sheet=Lazy Load Sheet

1
src/com/fr/plugin/lazy/sheet/locale/lazy_en_US.properties

@ -1 +0,0 @@
Plugin-Lazy_Load_Sheet=Lazy Load Sheet

1
src/com/fr/plugin/lazy/sheet/locale/lazy_zh_CN.properties

@ -1 +0,0 @@
Plugin-Lazy_Load_Sheet=\u61D2\u52A0\u8F7D\u591Asheet

6
src/com/fr/plugin/lazy/sheet/locale/LazyLocaleFinder.java → 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

3
src/com/fr/plugin/lazy/sheet/LazySheetActorMark.java → 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() {

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

2
src/com/fr/plugin/lazy/sheet/LazyConstants.java → 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.

30
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();
}
}

19
src/com/fr/plugin/lazy/sheet/LazySheetWorkBookExecutor.java → 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<String, Object> parameterMap, int sheetIndex) {
public LazySheetWorkBookExecutor(TemplateWorkBook workBook, Map<String, Object> parameterMap, int sheetIndex) {
super(workBook, parameterMap);
this.sheetIndex = sheetIndex;
}
@Override
public ResultWorkBook initResultBook(Map<String, Object> 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++) {

2
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

2
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

2
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
Loading…
Cancel
Save