Browse Source

Merge branch 'release/11.0' of https://code.fineres.com/scm/~harrison/design into release/11.0

newui
Harrison 2 years ago
parent
commit
7afc041186
  1. 6
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  2. 6
      designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java
  3. 37
      designer-base/src/main/java/com/fr/design/mainframe/authority/AuthorityTargetObjectCollector.java
  4. 80
      designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java
  5. 8
      designer-form/src/main/java/com/fr/design/designer/creator/XWParameterLayout.java
  6. 7
      designer-form/src/main/java/com/fr/design/mainframe/FormArea.java
  7. 1
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  8. 1
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

6
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -201,7 +201,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
} else if (!DesignModeContext.isVcsMode() && !DesignModeContext.isAuthorityEditing() && !DesignModeContext.isDuchampMode()) { } else if (!DesignModeContext.isVcsMode() && !DesignModeContext.isAuthorityEditing() && !DesignModeContext.isDuchampMode()) {
DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.NORMAL); DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.NORMAL);
} }
this.template = t; this.template = getTarget();
this.previewType = parserPreviewProvider(t.getPreviewType()); this.previewType = parserPreviewProvider(t.getPreviewType());
this.editingFILE = file; this.editingFILE = file;
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
@ -213,10 +213,6 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
} }
addCenterPane(); addCenterPane();
isNewCreateTpl = isNewFile; isNewCreateTpl = isNewFile;
if (isNewCreateTpl) {
// REPORT-58486: 必须在初始的UndoState创建前设置主题,使得初始的UndoState就包含了主题效果
setUpTheme4NewTemplate();
}
this.undoState = createUndoState(); this.undoState = createUndoState();
initAndStartPlugin(); initAndStartPlugin();

6
designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java

@ -39,11 +39,7 @@ public final class JTemplateFactory {
String[] defaultAppExtensions = app.defaultExtensions(); String[] defaultAppExtensions = app.defaultExtensions();
for (String defaultAppExtension : defaultAppExtensions) { for (String defaultAppExtension : defaultAppExtensions) {
if (defaultAppExtension.equalsIgnoreCase(fileExtension)) { if (defaultAppExtension.equalsIgnoreCase(fileExtension)) {
JTemplate<?, ?> jt = app.openTemplate(file); return app.openTemplate(file);
if (jt != null) {
jt.checkAndResetTheme();
return jt;
}
} }
} }
} }

37
designer-base/src/main/java/com/fr/design/mainframe/authority/AuthorityTargetObjectCollector.java

@ -0,0 +1,37 @@
package com.fr.design.mainframe.authority;
import com.fr.base.CloneCollector;
import com.fr.base.Formula;
import com.fr.data.impl.NameDatabaseConnection;
import com.fr.data.impl.NameTableData;
import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.stable.FCloneable;
import java.util.ArrayList;
import java.util.List;
public class AuthorityTargetObjectCollector extends CloneCollector {
List<Object> targetObject = new ArrayList<>();
public AuthorityTargetObjectCollector(FCloneable rootObject) {
super(rootObject);
}
@Override
public void collect(Object object) {
if (object instanceof DSColumn || object instanceof Formula
|| object instanceof NameDatabaseConnection || object instanceof NameTableData) {
targetObject.add(object);
}
}
public List<Object> collectTargetObject() {
CloneCollector.setCollector(this);
this.targetObject = new ArrayList<>();
this.collect();
CloneCollector.clearCollector();
return targetObject;
}
}

80
designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java

@ -1,24 +1,24 @@
package com.fr.design.mainframe.authority; package com.fr.design.mainframe.authority;
import com.fr.base.CloneCollector;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.mod.ModClassFilter;
import com.fr.file.ConnectionConfig; import com.fr.file.ConnectionConfig;
import com.fr.file.TableDataConfig; import com.fr.file.TableDataConfig;
import com.fr.invoke.ClassHelper;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.Filter;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.server.authority.user.UserAuthority; import com.fr.workspace.server.authority.user.UserAuthority;
import java.util.Collection;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -77,24 +77,21 @@ public class JTemplateAuthorityChecker {
public boolean isAuthority() { public boolean isAuthority() {
long s = System.currentTimeMillis(); long s = System.currentTimeMillis();
//遍历模板对象,根据checkerMap.keySet()把感兴趣的对象找出来 List<Object> targetObjects = getTargetObjects();
Map<String, Collection<Object>> targetObjects = ClassHelper.searchObject(jTemplate.getTarget(), checkerMap.keySet(), ClassFilter.getInstance());
//找到对应的checker,对对象进行检查 //找到对应的checker,对对象进行检查
for (String name : targetObjects.keySet()) { for (Object targetObject : targetObjects) {
String name = targetObject.getClass().getName();
ElementAuthorityChecker checker = checkerMap.get(name); ElementAuthorityChecker checker = checkerMap.get(name);
for (Object object : targetObjects.get(name)) { if (authConnectionNames != null) {
if (authConnectionNames != null) { Set<String> noAuthName = checker.getNoAuthConnectionNames(targetObject, authConnectionNames);
Set<String> noAuthName = checker.getNoAuthConnectionNames(object, authConnectionNames); if (noAuthName != null) {
if (noAuthName != null) { authFailConnectionNames.addAll(noAuthName);
authFailConnectionNames.addAll(noAuthName);
}
} }
if (authDatasetNames != null) { }
Set<String> noAuthName = checker.getNoAuthDatasetNames(object, authDatasetNames); if (authDatasetNames != null) {
if (noAuthName != null) { Set<String> noAuthName = checker.getNoAuthDatasetNames(targetObject, authDatasetNames);
authFailDatasetNames.addAll(noAuthName); if (noAuthName != null) {
} authFailDatasetNames.addAll(noAuthName);
} }
} }
} }
@ -104,6 +101,18 @@ public class JTemplateAuthorityChecker {
return authFailConnectionNames.size() == 0 && authFailDatasetNames.size() == 0; return authFailConnectionNames.size() == 0 && authFailDatasetNames.size() == 0;
} }
private List<Object> getTargetObjects() {
List<Object> targetObjects = new ArrayList<>();
try {
AuthorityTargetObjectCollector authorityTargetObjectCollector
= new AuthorityTargetObjectCollector(jTemplate.getTarget());
targetObjects = authorityTargetObjectCollector.collectTargetObject();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
}
return targetObjects;
}
public void showAuthorityFailPromptDialog() { public void showAuthorityFailPromptDialog() {
StringBuffer stringBuffer = new StringBuffer(); StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(Toolkit.i18nText("Fine-Design-Basic_Save_Failure")); stringBuffer.append(Toolkit.i18nText("Fine-Design-Basic_Save_Failure"));
@ -151,38 +160,5 @@ public class JTemplateAuthorityChecker {
return stringBuffer.toString(); return stringBuffer.toString();
} }
static class ClassFilter implements Filter<String> {
private static final Set<String> FILTER_SET = new HashSet<>();
private static final Set<String> START_WITH_SET = new HashSet<>();
private static final Filter<String> INSTANCE = new ModClassFilter();
public static Filter<String> getInstance() {
return INSTANCE;
}
static {
FILTER_SET.add("java.awt.image.BufferedImage");
FILTER_SET.add("sun.awt.AppContext");
FILTER_SET.add("com.fr.poly.creator.ECBlockCreator");
FILTER_SET.add("io.netty.channel.nio.SelectedSelectionKeySet");
FILTER_SET.add("com.fr.form.ui.ElementCaseImage");
FILTER_SET.add("this$0");
START_WITH_SET.add("com.fr.design");
}
@Override
public boolean accept(String s) {
if (FILTER_SET.contains(s)) {
return true;
}
for (String start : START_WITH_SET) {
if (s.startsWith(start)) {
return true;
}
}
return false;
}
}
} }

8
designer-form/src/main/java/com/fr/design/designer/creator/XWParameterLayout.java

@ -272,13 +272,11 @@ public class XWParameterLayout extends XWAbsoluteLayout {
} }
/** /**
* 修改form布局的宽度时需要同时修改表单参数界面的布局的宽度 * 修改参数面板宽度
* */ * */
@Override public void setParaWidth(int width) {
public void doLayout() {
layout();
if (data != null && data instanceof WParameterLayout) { if (data != null && data instanceof WParameterLayout) {
((WParameterLayout) data).setDesignWidth(getWidth()); ((WParameterLayout) data).setDesignWidth(width);
} }
} }

7
designer-form/src/main/java/com/fr/design/mainframe/FormArea.java

@ -12,6 +12,7 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIButtonUI; import com.fr.design.gui.ibutton.UIButtonUI;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.gui.itextfield.UINumberField; import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
@ -402,6 +403,12 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
} }
doReCalculateRoot(width, rec.height, layout); doReCalculateRoot(width, rec.height, layout);
} }
// REPORT-66771, 调整参数面板宽度
XLayoutContainer para = FormArea.this.designer.getParaComponent();
if (para != null && para instanceof XWParameterLayout) {
((XWParameterLayout) para).setParaWidth(width);
}
} }
private void reCalculateHeight(int height) { private void reCalculateHeight(int height) {

1
designer-form/src/main/java/com/fr/design/mainframe/JForm.java

@ -664,6 +664,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
try { try {
Form undoForm = (Form) u.getForm().clone(); Form undoForm = (Form) u.getForm().clone();
undoForm.checkAndResetTheme(); undoForm.checkAndResetTheme();
undoForm = (Form) FineColorSynchronizer.flush(undoForm, undoForm.getTemplateTheme());
if (this.index == FORM_TAB) { if (this.index == FORM_TAB) {
//JForm的target重置 //JForm的target重置
this.setTarget(undoForm); this.setTarget(undoForm);

1
designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

@ -794,6 +794,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
try { try {
WorkBook undoWorkBook = (WorkBook) u.getWorkBook().clone(); WorkBook undoWorkBook = (WorkBook) u.getWorkBook().clone();
undoWorkBook.checkAndResetTheme(); undoWorkBook.checkAndResetTheme();
undoWorkBook = (WorkBook) FineColorSynchronizer.flush(undoWorkBook, undoWorkBook.getTemplateTheme());
this.setTarget(undoWorkBook); this.setTarget(undoWorkBook);
if (!DesignerMode.isAuthorityEditing()) { if (!DesignerMode.isAuthorityEditing()) {
if (u.getAuthorityType() != BaseUndoState.NORMAL_STATE) { if (u.getAuthorityType() != BaseUndoState.NORMAL_STATE) {

Loading…
Cancel
Save