提供单元格条件属性的扩展,可以在现有的边框、字体、形态、缩进、控件、颜色、列宽、超级链接、新值、行高、背景、分页的基础上,提供更多的条件属性供实际需求使用。
package com.fr.design.fun; import com.fr.design.condition.ConditionAttrSingleConditionPane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.stable.fun.Level; import com.fr.stable.fun.mark.Mutable; /** * 条件属性界面设计接口 */ public interface HighlightProvider extends Mutable{ String MARK_STRING = "HighlightProvider"; int CURRENT_LEVEL = 1; /** * 条件属性的实现类 * @return 实现类 */ Class<?> classForHighlightAction(); /** * 条件属性的界面 * @param conditionAttributesPane 条件界面 * @return 设置界面 */ ConditionAttrSingleConditionPane appearanceForCondition(ConditionAttributesPane conditionAttributesPane); } |
package com.fr.report.cell.cellattr.highlight; import com.fr.general.data.EvalFormulaAction; import com.fr.report.cell.CellElement; import com.fr.script.Calculator; import com.fr.stable.ColumnRow; import com.fr.stable.DependenceProvider; import com.fr.stable.script.CalculatorProvider; import com.fr.stable.script.ExTool; import com.fr.stable.xml.XMLable; public interface HighlightAction extends XMLable, DependenceProvider{ /** * 执行条件属性 * * @param currentCellElement 当前单元格 * @param calculator 当前算子 */ void action(CellElement currentCellElement, Calculator calculator); /** * 执行条件属性 * * @param currentCellElement 当前单元格 * @param calculator 当前算子 * @param evalFormulaAction 公式计算器 */ void action(CellElement currentCellElement, Calculator calculator, EvalFormulaAction evalFormulaAction); /** * 记录高亮中使用的相关格子,当格子值改变后,格子的值需要相应做改变 * * @param calculator 算子 * @param exTool 格子间关系计算工具 * @param currentCr 当前行列 * * * @date 2014-9-21-下午10:23:52 * */ void analyzeCorrelative(CalculatorProvider calculator, ExTool exTool, ColumnRow currentCr); } |
通常根据实际需要,继承com.fr.report.cell.cellattr.highlight.AbstractHighlightAction或者com.fr.report.cell.cellattr.highlight.AbstractStyleHighlightAction类,而不直接实现HighlightAction接口。
<extra-designer> <HighlightProvider class="com.fr.plugin.cell.highlight.AlignCellHighlightBridge"/> </extra-designer> |
同一个扩展格子,可以有不同的对齐效果:
示例源码:http://git.fanruan.com/fanruan/demo-highlight-align
示例插件是一个付费示例插件,如果希望在此基础上改进并发布为免费插件,需要去掉关于插件license判断部分的代码。