@ -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,8 +1249,26 @@ 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 ( ) ) ;
Form target = getTarget ( ) ;
target . setTemplateTheme ( newTheme , compatible ) ;
target = ( Form ) FineColorSynchronizer . flush ( target , target . getTemplateTheme ( ) ) ;
refreshTarget ( target ) ;
super . setTemplateTheme ( newTheme , compatible ) ;
fireTargetModified ( shouldCreateUndoState ) ;
}
private void refreshTarget ( Form form ) {
setTarget ( form ) ;
if ( HistoryTemplateListCache . getInstance ( ) . getCurrentEditingTemplate ( ) = = this ) {
if ( this . index = = FORM_TAB ) {
// save state
FormArea formArea = formDesign . getArea ( ) ;
int horizontalValue = formArea . getHorizontalValue ( ) ;
int verticalValue = formArea . getVerticalValue ( ) ;
@ -1258,20 +1276,20 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
double widthValue = formArea . getWidthPaneValue ( ) ;
double heightValue = formArea . getHeightPaneValue ( ) ;
double slideValue = formArea . getSlideValue ( ) ;
Widget [ ] selectedWidgets = formArea . getFormEditor ( ) . getSelectionModel ( ) . getSelection ( ) . getSelectedWidgets ( ) ;
getTarget ( ) . setTemplateTheme ( newTheme , compatible ) ;
setTarget ( ( Form ) FineColorSynchronizer . flush ( getTarget ( ) , newTheme , compatible ) ) ;
// refresh ui
JForm . this . refreshRoot ( ) ;
if ( HistoryTemplateListCache . getInstance ( ) . getCurrentEditingTemplate ( ) = = this ) {
fireTargetModified ( shouldCreateUndoState ) ;
formDesign . refreshRoot ( ) ;
// 刷新界面后恢复原来的尺寸
// restore state
formDesign . getArea ( ) . setAreaSize ( areaSize , horizontalValue , verticalValue , widthValue , heightValue , slideValue ) ;
formDesign . getArea ( ) . undoFixLayoutState ( formArea . isFixLayout ( ) ) ;
if ( this . index ! = FORM_TAB ) {
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 ( ) ;
TableData TreePane. getInstance ( DesignModelAdapter . getCurrentModelAdapter ( ) ) . refreshDockingView ( ) ;
}
super . setTemplateTheme ( newTheme , compatible ) ;
}
@Override