Browse Source

REPORT-75998 进入开发者调试&权限编辑模式逻辑处理、完善通配符、优化界面、修复勾选功能

feature/x
Destiny.Lin 2 years ago
parent
commit
2f8216cd83
  1. 8
      designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java
  2. 13
      designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java
  3. 8
      designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java
  4. 4
      designer-realize/src/main/java/com/fr/design/actions/replace/action/ShowSearchResultAction.java
  5. 26
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java
  6. 5
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java
  7. 7
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceSouthPanel.java
  8. 1
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableButton.java
  9. 4
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java
  10. 79
      designer-realize/src/main/java/com/fr/design/actions/replace/utils/ShowValueUtils.java
  11. 2
      designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

8
designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java

@ -4,11 +4,14 @@ import com.fr.base.svg.IconUtils;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
import com.fr.design.module.DesignModuleFactory;
import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.ReportAndFSManagePane;
import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.*; import com.fr.design.mainframe.*;
import com.fr.invoke.Reflect;
import com.fr.log.FineLoggerFactory;
/** /**
* Author : daisy * Author : daisy
@ -61,6 +64,11 @@ public class AllowAuthorityEditAction extends TemplateComponentAction {
DesignerContext.getDesignerFrame().refreshDottedLine(); DesignerContext.getDesignerFrame().refreshDottedLine();
EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance()); EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance());
EastRegionContainerPane.getInstance().removeParameterPane(); EastRegionContainerPane.getInstance().removeParameterPane();
try {
Reflect.on(DesignModuleFactory.getReplacePane().newInstance()).call("close");
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
//画虚线 //画虚线
return true; return true;

13
designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java

@ -50,6 +50,7 @@ public class DesignModuleFactory {
private Class ITReplaceAction; private Class ITReplaceAction;
private Class formParaDesigner; private Class formParaDesigner;
private Class paraPropertyPane; private Class paraPropertyPane;
private Class replacePane;
private Class<? extends HierarchyTreePane> formHierarchyPaneCls; private Class<? extends HierarchyTreePane> formHierarchyPaneCls;
private Class<? extends BaseWidgetPropertyPane> widgetPropertyPane; private Class<? extends BaseWidgetPropertyPane> widgetPropertyPane;
private Class buttonDetailPaneClass; private Class buttonDetailPaneClass;
@ -131,6 +132,18 @@ public class DesignModuleFactory {
return instance.ITReplaceAction; return instance.ITReplaceAction;
} }
/**
* 注册一下查找替换面板
* @param r
*/
public static void registerReplacePane(Class r){
instance.replacePane = r;
}
public static Class getReplacePane(){
return instance.replacePane;
}
public static void registerParaPropertyPaneClass(Class p) { public static void registerParaPropertyPaneClass(Class p) {
instance.paraPropertyPane = p; instance.paraPropertyPane = p;
} }

8
designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java

@ -6,9 +6,12 @@ import com.fr.design.fun.impl.AbstractPreviewProvider;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JForm; import com.fr.design.mainframe.JForm;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.module.DesignModuleFactory;
import com.fr.design.worker.WorkerManager; import com.fr.design.worker.WorkerManager;
import com.fr.design.worker.save.CallbackSaveWorker; import com.fr.design.worker.save.CallbackSaveWorker;
import com.fr.general.web.ParameterConstants; import com.fr.general.web.ParameterConstants;
import com.fr.invoke.Reflect;
import com.fr.log.FineLoggerFactory;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -47,6 +50,11 @@ public class DeveloperPreview extends AbstractPreviewProvider {
@Override @Override
public void onClick(JTemplate<?, ?> jt) { public void onClick(JTemplate<?, ?> jt) {
super.onClick(jt); super.onClick(jt);
try {
Reflect.on(DesignModuleFactory.getReplacePane().newInstance()).call("close");
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
SwingWorker worker = WorkerManager.getInstance().getWorker(jt.getRuntimeId()); SwingWorker worker = WorkerManager.getInstance().getWorker(jt.getRuntimeId());
if (worker instanceof CallbackSaveWorker) { if (worker instanceof CallbackSaveWorker) {
CallbackSaveWorker callbackSaveWorker = (CallbackSaveWorker) worker; CallbackSaveWorker callbackSaveWorker = (CallbackSaveWorker) worker;

4
designer-realize/src/main/java/com/fr/design/actions/replace/action/ShowSearchResultAction.java

@ -75,7 +75,7 @@ public enum ShowSearchResultAction implements ShowValue {
} else { } else {
Map<String, String> stringHashMap = info.getValue(); Map<String, String> stringHashMap = info.getValue();
String content = stringHashMap.getOrDefault(objectContentKey, StringUtils.EMPTY); String content = stringHashMap.getOrDefault(objectContentKey, StringUtils.EMPTY);
if (content.contains(str) && StringUtils.isNotEmpty(content)) { if (ShowValueUtils.contains(content,str) && StringUtils.isNotEmpty(content)) {
info.getContent().setShowStr(ShowValueUtils.getCommonString(content, str)); info.getContent().setShowStr(ShowValueUtils.getCommonString(content, str));
info.getContent().setOldShowStr(content); info.getContent().setOldShowStr(content);
info.getContent().setOperatorArray(ShowValueUtils.getStringStartAndEndIndex(content, str)); info.getContent().setOperatorArray(ShowValueUtils.getStringStartAndEndIndex(content, str));
@ -416,6 +416,6 @@ public enum ShowSearchResultAction implements ShowValue {
* @return * @return
*/ */
public boolean isTitleNameValid(Title title, String str){ public boolean isTitleNameValid(Title title, String str){
return title != null && GeneralUtils.objectToString(title.getTextObject()).contains(str) && StringUtils.isNotEmpty(GeneralUtils.objectToString(title.getTextObject())); return title != null && ShowValueUtils.contains(GeneralUtils.objectToString(title.getTextObject()),str) && StringUtils.isNotEmpty(GeneralUtils.objectToString(title.getTextObject()));
} }
} }

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

@ -52,8 +52,9 @@ public class ITReplaceMainDialog extends UIDialog {
private ITReplaceWestPanel westPanel; private ITReplaceWestPanel westPanel;
private boolean searchFlag; private boolean searchFlag;
private String searchStr; private String searchStr;
private static boolean existed = false;
private ITReplaceMainDialog() { public ITReplaceMainDialog() {
super(DesignerContext.getDesignerFrame()); super(DesignerContext.getDesignerFrame());
init(); init();
} }
@ -66,6 +67,7 @@ public class ITReplaceMainDialog extends UIDialog {
initFrame(); initFrame();
fitScreen(); fitScreen();
ITReplaceFlag = true; ITReplaceFlag = true;
existed = true;
} }
/** /**
@ -309,6 +311,28 @@ public class ITReplaceMainDialog extends UIDialog {
} }
} }
/**
* 面板是否存在
* @return
*/
public static boolean isExisted() {
return existed;
}
public static void setExisted(boolean existed) {
ITReplaceMainDialog.existed = existed;
}
/**
* 进入权限编辑状态&开发者调试时关闭面板
*/
public static void close(){
if (isExisted()){
getInstance().dispose();
setExisted(false);
}
}
/** /**
* 检测结果是否合法 * 检测结果是否合法
*/ */

5
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java

@ -47,6 +47,7 @@ public class ITReplaceNorthPanel {
private static final int HEIGHT = 161; private static final int HEIGHT = 161;
private static final int BUTTON_WIDTH = 60; private static final int BUTTON_WIDTH = 60;
private static final int BUTTON_GAP = 20; private static final int BUTTON_GAP = 20;
private static final int MATCH_WIDTH = 70;
private int findLabelX, findLabelY, findLabelWidth, findLabelHeight; private int findLabelX, findLabelY, findLabelWidth, findLabelHeight;
@ -83,7 +84,7 @@ public class ITReplaceNorthPanel {
resultLabel = new UILabel(); resultLabel = new UILabel();
String[] rangeItems = new String[]{Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template_Current")}; String[] rangeItems = new String[]{Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template_Current")};
String[] replaceInputItems = new String[]{""}; String[] replaceInputItems = new String[]{StringUtils.EMPTY};
findCombobox = new UIComboBox(findItems.toArray()); findCombobox = new UIComboBox(findItems.toArray());
rangeCombobox = new UIComboBox(rangeItems); rangeCombobox = new UIComboBox(rangeItems);
findInputCombobox = new UIComboBox(findInputItems.toArray()) { findInputCombobox = new UIComboBox(findInputItems.toArray()) {
@ -247,7 +248,7 @@ public class ITReplaceNorthPanel {
private void setUIRadioButtonBounds(int x, int y, int templateWidth) { private void setUIRadioButtonBounds(int x, int y, int templateWidth) {
matchX = x + templateWidth / 60; matchX = x + templateWidth / 60;
matchY = y + 90; matchY = y + 90;
matchWidth = templateWidth; matchWidth = MATCH_WIDTH;
matchHeight = 25; matchHeight = 25;
matchRadioButton.setBounds(matchX, matchY, matchWidth, matchHeight); matchRadioButton.setBounds(matchX, matchY, matchWidth, matchHeight);
} }

7
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceSouthPanel.java

@ -18,7 +18,12 @@ public class ITReplaceSouthPanel {
public ITReplaceSouthPanel() { public ITReplaceSouthPanel() {
itTableEditor = new ITTableEditor(); itTableEditor = new ITTableEditor();
tableEditorPane = new ITTableEditorPane<>(itTableEditor); tableEditorPane = new ITTableEditorPane<>(itTableEditor);
RowSorter<ITTableEditor> sorter = new TableRowSorter<ITTableEditor>(itTableEditor); RowSorter<ITTableEditor> sorter = new TableRowSorter<ITTableEditor>(itTableEditor){
@Override
public boolean isSortable(int column) {
return column != 0 || column != 6;
}
};
tableEditorPane.getEditTable().setRowSorter(sorter); tableEditorPane.getEditTable().setRowSorter(sorter);
tableEditorPane.getEditTable().setSelectionBackground(new Color(217, 235, 254)); tableEditorPane.getEditTable().setSelectionBackground(new Color(217, 235, 254));
tableEditorPane.getEditTable().setRowHeight(tableEditorPane.getEditTable().getRowHeight() / 2 + tableEditorPane.getEditTable().getRowHeight()); tableEditorPane.getEditTable().setRowHeight(tableEditorPane.getEditTable().getRowHeight() / 2 + tableEditorPane.getEditTable().getRowHeight());

1
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableButton.java

@ -43,7 +43,6 @@ public class ITTableButton extends AbstractCellEditor implements TableCellEditor
if (StringUtils.isNotEmpty(GeneralUtils.objectToString(content.getTrlString()))) { if (StringUtils.isNotEmpty(GeneralUtils.objectToString(content.getTrlString()))) {
ITReplaceMainDialog.setITReplaceFlag(true); ITReplaceMainDialog.setITReplaceFlag(true);
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().navigate(new TRL(GeneralUtils.objectToString(content.getTrlString()))); HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().navigate(new TRL(GeneralUtils.objectToString(content.getTrlString())));
ReportComponentComposite composite = (ReportComponentComposite) HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getCurrentReportComponentPane();
} }
ITReplaceMainDialog.setITReplaceFlag(false); ITReplaceMainDialog.setITReplaceFlag(false);
} }

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

@ -71,7 +71,7 @@ public class ITTableEditorPane<T> extends BasicPane {
int row = ((JTable) e.getSource()).rowAtPoint(e.getPoint()); int row = ((JTable) e.getSource()).rowAtPoint(e.getPoint());
int col = ((JTable) e.getSource()).columnAtPoint(e.getPoint()); int col = ((JTable) e.getSource()).columnAtPoint(e.getPoint());
if (col == 0) { if (col == 0) {
ITContent content = (ITContent) editTable.getValueAt(row, 7); ITContent content = (ITContent) editTable.getValueAt(row, 6);
if (content.isSelected()) { if (content.isSelected()) {
content.setSelected(false); content.setSelected(false);
editTable.setValueAt(content.isSelected(), row, col); editTable.setValueAt(content.isSelected(), row, col);
@ -187,7 +187,7 @@ public class ITTableEditorPane<T> extends BasicPane {
*/ */
public static void selectAllOrNull(Boolean value) { public static void selectAllOrNull(Boolean value) {
for (int i = 0; i < getEditTable().getRowCount(); i++) { for (int i = 0; i < getEditTable().getRowCount(); i++) {
((ITContent) (getEditTable().getValueAt(i, 7))).setSelected(value); ((ITContent) (getEditTable().getValueAt(i, 6))).setSelected(value);
} }
} }

79
designer-realize/src/main/java/com/fr/design/actions/replace/utils/ShowValueUtils.java

@ -1,9 +1,8 @@
package com.fr.design.actions.replace.utils; package com.fr.design.actions.replace.utils;
import com.fr.design.actions.replace.info.Info;
import com.fr.design.actions.replace.ui.ITReplaceMainDialog;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.collections.combination.Pair; import com.fr.stable.collections.combination.Pair;
@ -30,6 +29,20 @@ public class ShowValueUtils {
public static final String ANY_THING_REGEX = "."; public static final String ANY_THING_REGEX = ".";
public static final String NUMBER_REGEX = "[0-9]"; public static final String NUMBER_REGEX = "[0-9]";
public static final String ENGLISH_REGEX = "[a-zA-Z]"; public static final String ENGLISH_REGEX = "[a-zA-Z]";
private static List<String> specialCharList = new ArrayList<>();
static {
//正则特殊字符:? * () [] {} ^ $
//如果是? 并采用通配符 ,会自动转成“.” 所以 ? 不用处理
//$同理
specialCharList.add("*");
specialCharList.add("(");
specialCharList.add(")");
specialCharList.add("[");
specialCharList.add("]");
specialCharList.add("{");
specialCharList.add("}");
specialCharList.add("^");
}
/** /**
* 获取除内容外其他一次性展示所有的内容名称水印... * 获取除内容外其他一次性展示所有的内容名称水印...
@ -42,9 +55,7 @@ public class ShowValueUtils {
if (StringUtils.isEmpty(searchStr)) { if (StringUtils.isEmpty(searchStr)) {
return str; return str;
} else { } else {
return "<html><body><div><nobr>" + return updateHighlight(str, searchStr);
replaceAll(str, searchStr, "<font color = 'rgb(61,153,249)'>" + searchStr + "</font>") +
"</nobr></div></body></html>";
} }
} }
@ -57,7 +68,11 @@ public class ShowValueUtils {
* @return 替换后的字符串 * @return 替换后的字符串
*/ */
public static String replaceAll(String str, String regex, String replacement) { public static String replaceAll(String str, String regex, String replacement) {
return str.replace(regex, replacement); if (ITReplaceMainDialog.isMatched()) {
return str.replaceAll(changeRegex(regex), replacement);
} else {
return str.replace(regex, replacement);
}
} }
/** /**
@ -70,6 +85,10 @@ public class ShowValueUtils {
regex = regex.replace(NUMBER, NUMBER_REGEX); regex = regex.replace(NUMBER, NUMBER_REGEX);
regex = regex.replace(ENGLISH, ENGLISH_REGEX); regex = regex.replace(ENGLISH, ENGLISH_REGEX);
regex = regex.replace(ANY_THING, ANY_THING_REGEX); regex = regex.replace(ANY_THING, ANY_THING_REGEX);
String change = "\\";
for (int i = 0 ; i < specialCharList.size() ; i ++){
regex = regex.replace(specialCharList.get(i),change + specialCharList.get(i));
}
return regex; return regex;
} }
@ -101,18 +120,36 @@ public class ShowValueUtils {
return pairs; return pairs;
} }
/** /**
* 更新高亮状态 * 更新高亮
* *
* @param info * @param str
* @param replaceStr * @param searchStr
* @return
*/ */
public static void updateHighlight(Info info, String replaceStr) { public static String updateHighlight(String str, String searchStr) {
String s = info.getInfoShowStr(info); if (ITReplaceMainDialog.isMatched()) {
s = s.replace(info.getContent().getLastSearchStr(), "<font color = 'rgb(61,153,249)'>" + replaceStr + "</font>"); String result = str;
info.getContent().setShowStr( Pattern pattern = Pattern.compile(changeRegex(searchStr));
"<html><body><div><nobr>" + s + "</nobr></div></body></html>" Matcher matcher = pattern.matcher(str);
); String head = "<font color = 'rgb(61,153,249)'>";
String tail = "</font>";
int size = head.length() + tail.length();
int index = 0;
StringBuilder builder = new StringBuilder(str);
while (matcher.find()) {
builder.replace(matcher.start() + index, matcher.end() + index, head + matcher.group() + tail);
index += size;
}
return "<html><body><div><nobr>" +
builder.toString() +
"</nobr></div></body></html>";
} else {
return "<html><body><div><nobr>" +
replaceAll(str, searchStr, "<font color = 'rgb(61,153,249)'>" + searchStr + "</font>") +
"</nobr></div></body></html>";
}
} }
@ -146,4 +183,16 @@ public class ShowValueUtils {
} }
return failReturn; return failReturn;
} }
public static boolean contains(String originStr, String matchStr) {
if (ITReplaceMainDialog.isMatched()) {
String str = changeRegex(matchStr);
Pattern pattern = Pattern.compile(str);
Matcher matcher = pattern.matcher(originStr);
return matcher.find();
} else {
return originStr.contains(matchStr);
}
}
} }

2
designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

@ -32,6 +32,7 @@ import com.fr.design.actions.insert.flot.FormulaFloatAction;
import com.fr.design.actions.insert.flot.ImageFloatAction; import com.fr.design.actions.insert.flot.ImageFloatAction;
import com.fr.design.actions.insert.flot.TextBoxFloatAction; import com.fr.design.actions.insert.flot.TextBoxFloatAction;
import com.fr.design.actions.replace.ITReplaceAction; import com.fr.design.actions.replace.ITReplaceAction;
import com.fr.design.actions.replace.ui.ITReplaceMainDialog;
import com.fr.design.bridge.DesignToolbarProvider; import com.fr.design.bridge.DesignToolbarProvider;
import com.fr.design.constants.DesignerLaunchStatus; import com.fr.design.constants.DesignerLaunchStatus;
import com.fr.design.env.DesignerWorkspaceLoader; import com.fr.design.env.DesignerWorkspaceLoader;
@ -466,6 +467,7 @@ public class DesignerActivator extends Activator implements Prepare {
DesignModuleFactory.registerNewFormActionClass(NewFormAction.class); DesignModuleFactory.registerNewFormActionClass(NewFormAction.class);
DesignModuleFactory.registerReplaceActionClass(ITReplaceAction.class); DesignModuleFactory.registerReplaceActionClass(ITReplaceAction.class);
DesignModuleFactory.registerReplacePane(ITReplaceMainDialog.class);
DesignModuleFactory.registerFormParaDesignerClass(FormParaDesigner.class); DesignModuleFactory.registerFormParaDesignerClass(FormParaDesigner.class);
DesignModuleFactory.registerParaPropertyPaneClass(ParameterPropertyPane.class); DesignModuleFactory.registerParaPropertyPaneClass(ParameterPropertyPane.class);
DesignModuleFactory.registerFormHierarchyPaneClass(FormHierarchyTreePane.class); DesignModuleFactory.registerFormHierarchyPaneClass(FormHierarchyTreePane.class);

Loading…
Cancel
Save