Browse Source

Pull request #10215: REPORT-81336 FR11决策报表报表块-编辑退出,编辑内容丢失

Merge in DESIGN/design from ~STARRYI/design:release/11.0 to release/11.0

* commit '5d8d998af3079ef02d7e77d22a8d31be716fb912':
  REPORT-81336 FR11决策报表报表块-编辑退出,编辑内容丢失
release/11.0
starryi-关昆 2 years ago
parent
commit
8b0aa2e721
  1. 63
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java

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

@ -704,8 +704,8 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
} }
} }
} else { } else {
// 只在报表块里撤销是不需要修改外部form对象的, 因为编辑的是当前报表块.
// 修改了JForm的Target需要同步修改formDesign的Target. // 修改了JForm的Target需要同步修改formDesign的Target.
this.setTarget(undoForm);
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);
@ -1249,29 +1249,47 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
@Override @Override
public void setTemplateTheme(TemplateTheme newTheme, TemplateThemeCompatible compatible) { public void setTemplateTheme(TemplateTheme newTheme, TemplateThemeCompatible compatible) {
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(); Form target = getTarget();
int horizontalValue = formArea.getHorizontalValue(); target.setTemplateTheme(newTheme, compatible);
int verticalValue = formArea.getVerticalValue(); target = (Form) FineColorSynchronizer.flush(target, target.getTemplateTheme());
Dimension areaSize = formArea.getAreaSize();
double widthValue = formArea.getWidthPaneValue(); refreshTarget(target);
double heightValue = formArea.getHeightPaneValue();
double slideValue = formArea.getSlideValue(); super.setTemplateTheme(newTheme, compatible);
fireTargetModified(shouldCreateUndoState);
}
getTarget().setTemplateTheme(newTheme, compatible); private void refreshTarget(Form form) {
setTarget((Form) FineColorSynchronizer.flush(getTarget(), newTheme, compatible)); setTarget(form);
if (HistoryTemplateListCache.getInstance().getCurrentEditingTemplate() == this) { if (HistoryTemplateListCache.getInstance().getCurrentEditingTemplate() == this) {
fireTargetModified(shouldCreateUndoState); if (this.index == FORM_TAB) {
formDesign.refreshRoot(); // save state
// 刷新界面后恢复原来的尺寸 FormArea formArea = formDesign.getArea();
formDesign.getArea().setAreaSize(areaSize, horizontalValue, verticalValue, widthValue, heightValue, slideValue); int horizontalValue = formArea.getHorizontalValue();
formDesign.getArea().undoFixLayoutState(formArea.isFixLayout()); int verticalValue = formArea.getVerticalValue();
if (this.index != FORM_TAB) { Dimension areaSize = formArea.getAreaSize();
double widthValue = formArea.getWidthPaneValue();
double heightValue = formArea.getHeightPaneValue();
double slideValue = formArea.getSlideValue();
Widget[] selectedWidgets = formArea.getFormEditor().getSelectionModel().getSelection().getSelectedWidgets();
// refresh ui
JForm.this.refreshRoot();
// restore state
formDesign.getArea().setAreaSize(areaSize, horizontalValue, verticalValue, widthValue, heightValue, slideValue);
formDesign.getArea().undoFixLayoutState(formArea.isFixLayout());
this.formDesign.getSelectionModel().setSelectedCreators(FormSelectionUtils.rebuildSelection(formDesign.getRootComponent(),
formDesign.getRootComponent() == selectedBodyLayout() ? selectedWidgets : new Widget[]{selectedBodyLayout().toData()}));
refreshToolArea(); refreshToolArea();
} else {
// CHART-20568: 当图表块处于编辑状态时,任何界面内容的修改都会导致其进行截图操作,进而引起设计器界面再次重绘,导致死循环,因而需要停止编辑 恢复浮层展示 // 停止编辑 恢复浮层展示
TreePath[] treePaths = FormHierarchyTreePane.getInstance(formDesign).getComponentTree().getSelectedTreePath(); TreePath[] treePaths = FormHierarchyTreePane.getInstance(formDesign).getComponentTree().getSelectedTreePath();
if (treePaths != null) { if (treePaths != null) {
for (TreePath path : treePaths) { for (TreePath path : treePaths) {
@ -1280,11 +1298,14 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
} }
} }
} }
} else {
String widgetName = this.formDesign.getElementCaseContainerName();
FormElementCaseProvider dataTable = form.getElementCaseByName(widgetName);
this.reportComposite.setSelectedWidget(dataTable);
formDesign.setElementCase(dataTable);
} }
FormHierarchyTreePane.getInstance().refreshRoot(); TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).refreshDockingView();
} }
super.setTemplateTheme(newTheme, compatible);
} }
@Override @Override

Loading…
Cancel
Save