Browse Source

REPORT-58389 【FR11二轮回归】设计器-frm模板撤销/切换主题,设计画布都会变小

【问题原因】
1. 主题功能仅负责撤销回退的数据模型修改,不进行界
面刷新,界面刷新依然由原来的撤销回退逻辑完成,优化
撤销回退的效率

2. 设计器修刷新界面后,需要恢复下画布尺寸和滚动条位置

【改动思路】
同上
persist/11.0
Starryi 3 years ago
parent
commit
a242b1cd59
  1. 2
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  2. 15
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  3. 4
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

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

@ -625,8 +625,6 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
*/ */
public void redo() { public void redo() {
this.getUndoManager().redo(); this.getUndoManager().redo();
// 重做前模版使用主题可能已经被删除或修改,需要重置模版样式
checkAndResetTheme();
fireSuperTargetModified(); fireSuperTargetModified();
} }

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

@ -664,9 +664,11 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
@Override @Override
protected void applyUndoState(FormUndoState u) { protected void applyUndoState(FormUndoState u) {
try { try {
Form undoForm = (Form) u.getForm().clone();
undoForm.checkAndResetTheme();
if (this.index == FORM_TAB) { if (this.index == FORM_TAB) {
//JForm的target重置 //JForm的target重置
this.setTarget((Form) u.getForm().clone()); this.setTarget(undoForm);
JForm.this.refreshRoot(); JForm.this.refreshRoot();
this.formDesign.getArea().setAreaSize(u.getAreaSize(), u.getHorizontalValue(), u.getVerticalValue(), u.getWidthValue(), u.getHeightValue(), u.getSlideValue()); this.formDesign.getArea().setAreaSize(u.getAreaSize(), u.getHorizontalValue(), u.getVerticalValue(), u.getWidthValue(), u.getHeightValue(), u.getSlideValue());
//撤销的时候要重新选择的body布局 //撤销的时候要重新选择的body布局
@ -685,7 +687,6 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
} else { } else {
// 只在报表块里撤销是不需要修改外部form对象的, 因为编辑的是当前报表块. // 只在报表块里撤销是不需要修改外部form对象的, 因为编辑的是当前报表块.
// 修改了JForm的Target需要同步修改formDesign的Target. // 修改了JForm的Target需要同步修改formDesign的Target.
Form undoForm = (Form) u.getForm().clone();
String widgetName = this.formDesign.getElementCaseContainerName(); String widgetName = this.formDesign.getElementCaseContainerName();
//这儿太坑了,u.getForm() 与 getTarget内容不一样 //这儿太坑了,u.getForm() 与 getTarget内容不一样
FormElementCaseProvider dataTable = undoForm.getElementCaseByName(widgetName); FormElementCaseProvider dataTable = undoForm.getElementCaseByName(widgetName);
@ -1188,10 +1189,20 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
FormTheme oldTheme = getTarget().getTemplateTheme(); FormTheme oldTheme = getTarget().getTemplateTheme();
boolean shouldCreateUndoState = compatible == TemplateThemeCompatible.NONE && !StringUtils.equals(oldTheme.getName(), newTheme.getName()); boolean shouldCreateUndoState = compatible == TemplateThemeCompatible.NONE && !StringUtils.equals(oldTheme.getName(), newTheme.getName());
FormArea formArea = formDesign.getArea();
int horizontalValue = formArea.getHorizontalValue();
int verticalValue= formArea.getVerticalValue();
Dimension areaSize = formArea.getAreaSize();
double widthValue = formArea.getWidthPaneValue();
double heightValue = formArea.getHeightPaneValue();
double slideValue = formArea.getSlideValue();
getTarget().setTemplateTheme(newTheme, compatible); getTarget().setTemplateTheme(newTheme, compatible);
fireTargetModified(shouldCreateUndoState); fireTargetModified(shouldCreateUndoState);
formDesign.refreshRoot(); formDesign.refreshRoot();
// 刷新界面后恢复原来的尺寸
formDesign.getArea().setAreaSize(areaSize, horizontalValue, verticalValue, widthValue, heightValue, slideValue);
FormHierarchyTreePane.getInstance().refreshRoot(); FormHierarchyTreePane.getInstance().refreshRoot();
if (this.index != FORM_TAB) { if (this.index != FORM_TAB) {
refreshToolArea(); refreshToolArea();

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

@ -774,7 +774,9 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
@Override @Override
protected void applyUndoState(WorkBookUndoState u) { protected void applyUndoState(WorkBookUndoState u) {
try { try {
this.setTarget((WorkBook) u.getWorkBook().clone()); WorkBook undoWorkBook = (WorkBook) u.getWorkBook().clone();
undoWorkBook.checkAndResetTheme();
this.setTarget(undoWorkBook);
if (!DesignerMode.isAuthorityEditing()) { if (!DesignerMode.isAuthorityEditing()) {
if (u.getAuthorityType() != BaseUndoState.NORMAL_STATE) { if (u.getAuthorityType() != BaseUndoState.NORMAL_STATE) {
applyAll(u); applyAll(u);

Loading…
Cancel
Save