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 {
// 只在报表块里撤销是不需要修改外部form对象的, 因为编辑的是当前报表块.
// 修改了JForm的Target需要同步修改formDesign的Target.
this.setTarget(undoForm);
String widgetName = this.formDesign.getElementCaseContainerName();
//这儿太坑了,u.getForm() 与 getTarget内容不一样
FormElementCaseProvider dataTable = undoForm.getElementCaseByName(widgetName);
@ -1249,29 +1249,47 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
@Override
public void setTemplateTheme(TemplateTheme newTheme, TemplateThemeCompatible compatible) {
FormTheme oldTheme = getTarget().getTemplateTheme();
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();
Form target = getTarget();
target.setTemplateTheme(newTheme, compatible);
target = (Form) FineColorSynchronizer.flush(target, target.getTemplateTheme());
refreshTarget(target);
super.setTemplateTheme(newTheme, compatible);
fireTargetModified(shouldCreateUndoState);
}
getTarget().setTemplateTheme(newTheme, compatible);
setTarget((Form) FineColorSynchronizer.flush(getTarget(), newTheme, compatible));
private void refreshTarget(Form form) {
setTarget(form);
if (HistoryTemplateListCache.getInstance().getCurrentEditingTemplate() == this) {
fireTargetModified(shouldCreateUndoState);
formDesign.refreshRoot();
// 刷新界面后恢复原来的尺寸
formDesign.getArea().setAreaSize(areaSize, horizontalValue, verticalValue, widthValue, heightValue, slideValue);
formDesign.getArea().undoFixLayoutState(formArea.isFixLayout());
if (this.index != FORM_TAB) {
if (this.index == FORM_TAB) {
// save state
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();
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();
} else {
// CHART-20568: 当图表块处于编辑状态时,任何界面内容的修改都会导致其进行截图操作,进而引起设计器界面再次重绘,导致死循环,因而需要停止编辑 恢复浮层展示
// 停止编辑 恢复浮层展示
TreePath[] treePaths = FormHierarchyTreePane.getInstance(formDesign).getComponentTree().getSelectedTreePath();
if (treePaths != null) {
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

Loading…
Cancel
Save