Browse Source

补充更多的API

remotes/1611766341912730171/master
richie 5 years ago
parent
commit
5aff955ed7
  1. 2
      src/main/java/com/fanruan/api/query/QueryConditionKit.java
  2. 3
      src/main/java/com/fanruan/api/report/PaintKit.java
  3. 25
      src/main/java/com/fanruan/api/report/SundryKit.java
  4. 43
      src/main/java/com/fanruan/api/report/export/BaseAppExporter.java
  5. 40
      src/main/java/com/fanruan/api/report/export/BaseOperate.java
  6. 5
      src/main/java/com/fanruan/api/report/page/PageKit.java

2
src/main/java/com/fanruan/api/query/QueryConditionKit.java

@ -20,7 +20,7 @@ public class QueryConditionKit {
* *
* @return 查询条件 * @return 查询条件
*/ */
public QueryCondition newQueryCondition() { public static QueryCondition newQueryCondition() {
return new QueryConditionImpl(); return new QueryConditionImpl();
} }
} }

3
src/main/java/com/fanruan/api/report/PaintKit.java

@ -9,6 +9,7 @@ public class PaintKit {
/** /**
* 如果value是ImageWithSuffix类的一个实例则创建一个宽为width高为height,类型为TYPE_4BYTE_ABGR的image,并将其按照比例和Style绘制 * 如果value是ImageWithSuffix类的一个实例则创建一个宽为width高为height,类型为TYPE_4BYTE_ABGR的image,并将其按照比例和Style绘制
*
* @param value 传入的需要判断为是否是ImageWithSuffix实例的对象 * @param value 传入的需要判断为是否是ImageWithSuffix实例的对象
* @param resolution 缩放比例的分母缩放比例为1/resolution * @param resolution 缩放比例的分母缩放比例为1/resolution
* @param style 绘制image的style * @param style 绘制image的style
@ -16,7 +17,7 @@ public class PaintKit {
* @param height 绘制image的高 * @param height 绘制image的高
* @return 返回宽为width高为height,类型为TYPE_4BYTE_ABGR的image * @return 返回宽为width高为height,类型为TYPE_4BYTE_ABGR的image
*/ */
public static Image value2Image(Object value, int resolution, Style style, int width, int height){ public static Image value2Image(Object value, int resolution, Style style, int width, int height) {
return CellUtils.value2Image(value, resolution, style, width, height); return CellUtils.value2Image(value, resolution, style, width, height);
} }
} }

25
src/main/java/com/fanruan/api/report/SundryKit.java

@ -0,0 +1,25 @@
package com.fanruan.api.report;
import com.fanruan.api.util.IOKit;
import com.fr.base.Icon;
import com.fr.base.IconManager;
/**
* @author richie
* @version 10.0
* Created by richie on 2019/9/26
* 一些比较杂项的工具类
*/
public class SundryKit {
/**
* 将图标加载到内存中可以供插件使用
*
* @param name 图标的名字
* @param path 图标的地址
*/
public static void loadToolbarIcon(String name, String path) {
Icon icon = new Icon(name, IOKit.readImage(path));
IconManager.getIconManager().addIcon(icon, true);
}
}

43
src/main/java/com/fanruan/api/report/export/BaseAppExporter.java

@ -0,0 +1,43 @@
package com.fanruan.api.report.export;
import com.fr.io.exporter.AbstractAppExporter;
import com.fr.main.workbook.ResultWorkBook;
import com.fr.page.PageSetProvider;
import java.io.OutputStream;
/**
* @author richie
* @version 10.0
* Created by richie on 2019/9/26
* 导出接口
*/
public abstract class BaseAppExporter<T> extends AbstractAppExporter<T> {
public BaseAppExporter() {
}
/**
* 导出
*
* @param outputStream 输出流
* @param pageSetProvider 分页对象
* @throws Exception 导出失败则抛出此异常
*/
@Override
public void export(OutputStream outputStream, PageSetProvider pageSetProvider) throws Exception {
throw new UnsupportedOperationException();
}
/**
* 导出
*
* @param outputStream 输出流
* @param resultWorkBook 结果报表
* @throws Exception 导出失败则抛出此异常
*/
@Override
public abstract void export(OutputStream outputStream, ResultWorkBook resultWorkBook) throws Exception;
}

40
src/main/java/com/fanruan/api/report/export/BaseOperate.java

@ -0,0 +1,40 @@
package com.fanruan.api.report.export;
import com.fr.io.collection.ExportCollection;
import com.fr.stable.web.SessionProvider;
import com.fr.web.core.reserve.Operate;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* @author richie
* @version 10.0
* Created by richie on 2019/9/26
* 导出接口的抽象类
*/
public abstract class BaseOperate implements Operate {
@Override
public void setContent(HttpServletRequest req, HttpServletResponse res, String fileName, boolean isEmbed) {
}
@Override
public void setContent(HttpServletRequest req, HttpServletResponse res, SessionProvider sessionProvider, String fileName, boolean isEmbed) {
this.setContent(req, res, fileName, isEmbed);
}
/**
* 导出的实体操作
*
* @param req http请求
* @param res http响应
* @param sessionProvider 模板访问会话信息
* @param fileName 文件名
* @return 导出实体操作对象
*/
@Override
public abstract ExportCollection newExportCollection(HttpServletRequest req, HttpServletResponse res, SessionProvider sessionProvider, String fileName);
}

5
src/main/java/com/fanruan/api/report/page/PageKit.java

@ -1,8 +1,8 @@
package com.fanruan.api.report.page; package com.fanruan.api.report.page;
import com.fanruan.api.report.PrintKit;
import com.fr.main.workbook.ResultWorkBook; import com.fr.main.workbook.ResultWorkBook;
import com.fr.page.PaperSettingProvider; import com.fr.page.PaperSettingProvider;
import com.fr.report.core.ReportUtils;
import java.util.List; import java.util.List;
@ -16,11 +16,12 @@ public class PageKit {
/** /**
* 获取报表的打印纸张设置信息 * 获取报表的打印纸张设置信息
*
* @param rb 结果报表 * @param rb 结果报表
* @return 打印纸张设置信息集合 * @return 打印纸张设置信息集合
*/ */
public static PaperSettingProvider[] getPaperSettingListFromWorkBook(ResultWorkBook rb) { public static PaperSettingProvider[] getPaperSettingListFromWorkBook(ResultWorkBook rb) {
List<PaperSettingProvider> list = ReportUtils.getPaperSettingListFromWorkBook(rb); List<PaperSettingProvider> list = PrintKit.getPaperSettings(rb);
return list == null ? new PaperSettingProvider[0] : list.toArray(new PaperSettingProvider[0]); return list == null ? new PaperSettingProvider[0] : list.toArray(new PaperSettingProvider[0]);
} }
} }

Loading…
Cancel
Save