Browse Source

Pull request #10197: REPORT-75998 删除搜索服务器公式逻辑、增加搜索高亮、按钮置灰、搜索sheet名称公式

Merge in DESIGN/design from ~DESTINY.LIN/design:feature/x to feature/x

* commit 'dfa49d772c205e419d1473a3df5e497d1f450214':
  REPORT-75998 补充注释
  REPORT-75998 删除搜索服务器公式逻辑、增加搜索高亮、按钮置灰、搜索sheet名称公式
feature/x
Destiny.Lin-林锦龙 2 years ago
parent
commit
f51530a4b9
  1. 15
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaTag.java
  2. 4
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/data/SearchDataFormulaAction.java
  3. 25
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/template/SearchTemplateFormulaAction.java
  4. 5
      designer-realize/src/main/java/com/fr/design/actions/replace/info/base/SearchTag.java
  5. 29
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java
  6. 16
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java

15
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaTag.java

@ -7,6 +7,7 @@ import com.fr.design.actions.replace.info.Info;
import com.fr.design.actions.replace.info.base.SearchTag;
import com.fr.design.actions.replace.utils.ShowValueUtils;
import com.fr.general.GeneralUtils;
import com.fr.main.impl.WorkBook;
import com.fr.plugin.chart.map.data.VanMapReportDefinition;
import com.fr.stable.collections.combination.Pair;
import org.jetbrains.annotations.Nullable;
@ -105,6 +106,20 @@ public enum FormulaTag implements DealWithInfoValue {
item.setMessage(ShowValueUtils.replaceAll(item.getMessage(), findStr, replaceStr));
}
}
},
/**
* sheet名称
*/
SHEET_NAME(SearchTag.SHEET_NAME) {
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
if (info.getContent().getHoldObject() instanceof WorkBook) {
WorkBook workBook = (WorkBook) info.getContent().getHoldObject();
int sheetId = Integer.parseInt(info.getContent().getSheetID());
String name = workBook.getReportName(sheetId);
workBook.setReportName(sheetId, ShowValueUtils.replaceAll(name, findStr, replaceStr));
}
}
};
int index;

4
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/data/SearchDataFormulaAction.java

@ -31,8 +31,8 @@ public class SearchDataFormulaAction implements SearchFormula {
//模板数据集
dealTemplateData(jTemplate, formulaInfos);
//服务器数据集
dealServerData(formulaInfos);
////服务器数据集二期再考虑
//dealServerData(formulaInfos);
}
private void dealServerData(List<FormulaInfo> fomulaInfos) {

25
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/template/SearchTemplateFormulaAction.java

@ -10,8 +10,13 @@ import com.fr.data.VerifyItem;
import com.fr.design.actions.replace.action.content.formula.highlight.javascript.SearchCommit2DBJSFormulaAction;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.actions.replace.info.base.SearchTag;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.ReportComponentComposite;
import com.fr.design.mainframe.SheetNameTabPane;
import com.fr.main.impl.WorkBook;
import com.fr.report.core.ReportUtils;
import com.fr.report.report.Report;
@ -50,6 +55,26 @@ public class SearchTemplateFormulaAction implements SearchTemplateFormula {
searchTemplateWaterMarkFormula(jTemplate, formulaInfos, content);
//报表填报属性
searchTemplateWriteAttrFormula(jTemplate, formulaInfos, content);
//sheet名称
searchTemplateSheetNameFormula(jTemplate, formulaInfos, content);
}
private void searchTemplateSheetNameFormula(JTemplate jTemplate, List<FormulaInfo> formulaInfos, ITContent content) {
if (jTemplate.getTarget() instanceof WorkBook) {
WorkBook workBook = (WorkBook) jTemplate.getTarget();
for (int i = 0, len = workBook.getReportCount(); i < len; i++) {
String name = workBook.getReportName(i);
if (CommonUtils.canBeFormula(name)) {
ITContent sheetContent = ITContent.copy(content);
sheetContent.addOtherPos(Toolkit.i18nText("Fine-Design_Replace_Sheet"));
sheetContent.setReplaceObject(name);
sheetContent.setHoldObject(workBook);
sheetContent.setTag(SearchTag.SHEET_NAME);
sheetContent.setSheetID(String.valueOf(i));
formulaInfos.add(new FormulaInfo(sheetContent));
}
}
}
}
private void searchTemplateWriteAttrFormula(JTemplate jTemplate, List<FormulaInfo> formulaInfos, ITContent content) {

5
designer-realize/src/main/java/com/fr/design/actions/replace/info/base/SearchTag.java

@ -36,6 +36,11 @@ public class SearchTag {
* 模板填报属性数据校验提示
*/
public static final int WRITE_ATTR_MESSAGE = 6;
/**
* sheet名称
*/
public static final int SHEET_NAME = 7;
}

29
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java

@ -51,6 +51,8 @@ public class ITReplaceMainDialog extends UIDialog {
private ITReplaceWestPanel westPanel;
private boolean searchFlag;
private String searchStr;
private static final int FIRST_ROW = 0;
public static int selectCount = 0;
public ITReplaceMainDialog() {
super(DesignerContext.getDesignerFrame());
@ -117,6 +119,7 @@ public class ITReplaceMainDialog extends UIDialog {
northPane.getFindInputCombobox().setEditable(true);
northPane.getReplaceInputCombobox().setEditable(false);
northPane.getReplaceButton().setEnabled(false);
((UITextField) (northPane.getFindInputCombobox().getEditor().getEditorComponent())).setPlaceholder(Toolkit.i18nText("Fine-Design_Replace_Search_Input"));
((UITextField) (northPane.getReplaceInputCombobox().getEditor().getEditorComponent())).setPlaceholder(Toolkit.i18nText("Fine-Design_Replace_Input"));
@ -282,9 +285,13 @@ public class ITReplaceMainDialog extends UIDialog {
templateID = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTarget().getTemplateID();
itTableEditor.clear();
String searchStr = ((UITextField) (northPane.getFindInputCombobox().getEditor().getEditorComponent())).getText();
//更新搜索内容
setSearchStr(searchStr);
//处理通配符的regexStr
ShowValueUtils.containPattern = Pattern.compile(ShowValueUtils.changeRegex(searchStr));
//获取搜索目标
ShowSearchResultAction searchAction = ShowSearchResultAction.match(GeneralUtils.objectToString(northPane.getFindCombobox().getSelectedItem()));
//搜索
if (searchAction != null) {
searchResultList = searchAction.addMatchResult(searchStr, searchAction.showSearchValue(jTemplate));
itTableEditor.add(searchResultList);
@ -295,7 +302,15 @@ public class ITReplaceMainDialog extends UIDialog {
itTableEditor.fireTableDataChanged();
northPane.refreshFindInputComboBoxItems();
setSearchFlag(true);
selectCount = searchResultList.size();
//如果有结果,默认选中第一行
if (searchResultList.size() > 0){
getEditTable().addRowSelectionInterval(FIRST_ROW,FIRST_ROW);
northPane.getReplaceButton().setEnabled(true);
}
//设置替换输入框的可用性
if (StringUtils.isNotEmpty(searchStr)) {
((UITextField) (northPane.getReplaceInputCombobox().getEditor().getEditorComponent())).setEditable(true);
northPane.getReplaceInputCombobox().setEditable(true);
@ -309,7 +324,21 @@ public class ITReplaceMainDialog extends UIDialog {
}
public ITReplaceSouthPanel getSouthPanel() {
return southPanel;
}
public void setSouthPanel(ITReplaceSouthPanel southPanel) {
this.southPanel = southPanel;
}
public ITReplaceNorthPanel getNorthPane() {
return northPane;
}
public void setNorthPane(ITReplaceNorthPanel northPane) {
this.northPane = northPane;
}
/**
* 检测结果是否合法

16
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java

@ -75,9 +75,13 @@ public class ITTableEditorPane<T> extends BasicPane {
if (content.isSelected()) {
content.setSelected(false);
editTable.setValueAt(content.isSelected(), row, col);
ITReplaceMainDialog.selectCount--;
ITReplaceMainDialog.getInstance().getNorthPane().getReplaceButton().setEnabled(ITReplaceMainDialog.selectCount > 0);
} else {
content.setSelected(true);
editTable.setValueAt(content.isSelected(), row, col);
ITReplaceMainDialog.selectCount++;
ITReplaceMainDialog.getInstance().getNorthPane().getReplaceButton().setEnabled(true);
}
}
@ -120,6 +124,11 @@ public class ITTableEditorPane<T> extends BasicPane {
boolean value = !selectBox.isSelected();
selectBox.setSelected(value);
selectAllOrNull(value);
if (value) {
ITReplaceMainDialog.selectCount = getEditTable().getRowCount();
} else {
ITReplaceMainDialog.selectCount = 0;
}
tableHeader.repaint();
table.repaint();
}
@ -130,6 +139,7 @@ public class ITTableEditorPane<T> extends BasicPane {
/**
* 刷新表头
*
* @param table
*/
public void refreshHeader(JTable table) {
@ -186,7 +196,11 @@ public class ITTableEditorPane<T> extends BasicPane {
* @param value
*/
public static void selectAllOrNull(Boolean value) {
for (int i = 0; i < getEditTable().getRowCount(); i++) {
int len = getEditTable().getRowCount();
if (len > 0) {
ITReplaceMainDialog.getInstance().getNorthPane().getReplaceButton().setEnabled(value);
}
for (int i = 0; i < len; i++) {
((ITContent) (getEditTable().getValueAt(i, ITReplaceSouthPanel.CONTENT_INDEX))).setSelected(value);
}
}

Loading…
Cancel
Save