Destiny.Lin
2 years ago
16 changed files with 306 additions and 31 deletions
@ -0,0 +1,91 @@ |
|||||||
|
package com.fr.design.actions.replace.action.content.formula.highlight.present; |
||||||
|
|
||||||
|
import com.fr.base.Formula; |
||||||
|
import com.fr.base.present.DictPresent; |
||||||
|
import com.fr.base.present.FormulaPresent; |
||||||
|
import com.fr.design.actions.replace.action.content.formula.highlight.SearchHighlightFormula; |
||||||
|
import com.fr.design.actions.replace.action.content.formula.highlight.javascript.SearchJSHighlightAction; |
||||||
|
import com.fr.design.actions.replace.action.content.formula.widget.DictionaryType; |
||||||
|
import com.fr.design.actions.replace.info.FormulaInfo; |
||||||
|
import com.fr.design.actions.replace.info.base.ITContent; |
||||||
|
import com.fr.design.i18n.Toolkit; |
||||||
|
import com.fr.report.cell.TemplateCellElement; |
||||||
|
import com.fr.report.cell.cellattr.highlight.HighlightAction; |
||||||
|
import com.fr.report.cell.cellattr.highlight.PresentHighlightAction; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* 条件属性-属性-形态 |
||||||
|
* |
||||||
|
* @author Destiny.Lin |
||||||
|
* @version 11.0 |
||||||
|
* created by Destiny.Lin on 2022-09-27 |
||||||
|
*/ |
||||||
|
public class SearchPresentHighlightAction implements SearchHighlightFormula { |
||||||
|
|
||||||
|
private SearchPresentHighlightAction() { |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public void dealWithHighlightAction(ITContent content, List<FormulaInfo> formulaInfos, HighlightAction highlightAction) { |
||||||
|
if (highlightAction instanceof PresentHighlightAction) { |
||||||
|
ITContent newContent = ITContent.copy(content); |
||||||
|
newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Report_Present")); |
||||||
|
PresentHighlightAction action = (PresentHighlightAction) highlightAction; |
||||||
|
//公式形态
|
||||||
|
if (action.getPresent() instanceof FormulaPresent) { |
||||||
|
newContent.setReplaceObject(action.getPresent()); |
||||||
|
formulaInfos.add(new FormulaInfo(newContent)); |
||||||
|
} else if (action.getPresent() instanceof DictPresent) { |
||||||
|
//数据字典
|
||||||
|
DictPresent present = (DictPresent) action.getPresent(); |
||||||
|
if (present.getDictionary() != null) { |
||||||
|
DictionaryType type = DictionaryType.match(present.getDictionary().getClass().getSimpleName()); |
||||||
|
if (type != null) { |
||||||
|
type.searchFormulaFromDictionary(newContent, formulaInfos, present.getDictionary()); |
||||||
|
} |
||||||
|
} |
||||||
|
} else if (action.getValue() instanceof Formula) { |
||||||
|
//普通
|
||||||
|
newContent.setReplaceObject(action.getValue()); |
||||||
|
formulaInfos.add(new FormulaInfo(newContent)); |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取单例 |
||||||
|
* |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public static SearchPresentHighlightAction getInstance() { |
||||||
|
return SearchPresentHighlightActionEnum.SINGLETON.getInstance(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 枚举实现单例 |
||||||
|
*/ |
||||||
|
private enum SearchPresentHighlightActionEnum { |
||||||
|
/** |
||||||
|
* 单例实现 |
||||||
|
*/ |
||||||
|
SINGLETON; |
||||||
|
private SearchPresentHighlightAction instance; |
||||||
|
|
||||||
|
SearchPresentHighlightActionEnum() { |
||||||
|
instance = new SearchPresentHighlightAction(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 拿到对象 |
||||||
|
* |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public SearchPresentHighlightAction getInstance() { |
||||||
|
return instance; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,70 @@ |
|||||||
|
package com.fr.design.actions.replace.action.content.formula.highlight.value; |
||||||
|
|
||||||
|
import com.fr.base.Formula; |
||||||
|
import com.fr.design.actions.replace.action.content.formula.highlight.SearchHighlightFormula; |
||||||
|
import com.fr.design.actions.replace.action.content.formula.highlight.javascript.SearchMobileHyperlinkFormulaAction; |
||||||
|
import com.fr.design.actions.replace.info.FormulaInfo; |
||||||
|
import com.fr.design.actions.replace.info.base.ITContent; |
||||||
|
import com.fr.design.i18n.Toolkit; |
||||||
|
import com.fr.report.cell.cellattr.highlight.HighlightAction; |
||||||
|
import com.fr.report.cell.cellattr.highlight.ValueHighlightAction; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* 条件属性-新值-公式 |
||||||
|
* |
||||||
|
* @author Destiny.Lin |
||||||
|
* @version 11.0 |
||||||
|
* created by Destiny.Lin on 2022-09-27 |
||||||
|
*/ |
||||||
|
public class SearchValueHighlightAction implements SearchHighlightFormula { |
||||||
|
private SearchValueHighlightAction() { |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void dealWithHighlightAction(ITContent content, List<FormulaInfo> formulaInfos, HighlightAction highlightAction) { |
||||||
|
if (highlightAction instanceof ValueHighlightAction) { |
||||||
|
ValueHighlightAction action = (ValueHighlightAction) highlightAction; |
||||||
|
if (action.getValue() instanceof Formula) { |
||||||
|
ITContent valueContent = ITContent.copy(content); |
||||||
|
valueContent.addOtherPos(Toolkit.i18nText("Fine-Design_Report_New_Value")); |
||||||
|
valueContent.setReplaceObject(action.getValue()); |
||||||
|
formulaInfos.add(new FormulaInfo(valueContent)); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取单例 |
||||||
|
* |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public static SearchValueHighlightAction getInstance() { |
||||||
|
return SearchValueHighlightActionEnum.SINGLETON.getInstance(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 枚举实现单例 |
||||||
|
*/ |
||||||
|
private enum SearchValueHighlightActionEnum { |
||||||
|
/** |
||||||
|
* 单例实现 |
||||||
|
*/ |
||||||
|
SINGLETON; |
||||||
|
private SearchValueHighlightAction instance; |
||||||
|
|
||||||
|
SearchValueHighlightActionEnum() { |
||||||
|
instance = new SearchValueHighlightAction(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 拿到对象 |
||||||
|
* |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public SearchValueHighlightAction getInstance() { |
||||||
|
return instance; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue