diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFixLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFixLayoutAdapter.java index 0c50aa9c2f..798b277f63 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFixLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFixLayoutAdapter.java @@ -4,6 +4,7 @@ import com.fr.base.svg.IconUtils; import com.fr.design.designer.beans.HoverPainter; import com.fr.design.designer.beans.models.ModelUtil; import com.fr.design.designer.beans.models.SelectionModel; +import com.fr.design.designer.beans.painters.FRFixLayoutPainter; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XOccupiedLayout; diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FROccupiedLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FROccupiedLayoutAdapter.java index 91d2c7f49c..6c6aa26471 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FROccupiedLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FROccupiedLayoutAdapter.java @@ -30,9 +30,8 @@ public class FROccupiedLayoutAdapter extends AbstractLayoutAdapter { creator.setLocation(container.getLocation().x, container.getLocation().y); creator.setSize(container.getWidth(), container.getHeight()); //将 xcreator 添加到其父容器中,并删除此 - Container parent = container.getParent(); - parent.remove(container); - + XLayoutContainer parent = (XLayoutContainer) container.getParent(); + parent.getLayoutAdapter().removeBean(container, container.getWidth(), container.getHeight()); if (creator.shouldScaleCreator() || creator.hasTitleStyle()) { XLayoutContainer parentPanel = creator.initCreatorWrapper(21); parent.add(parentPanel, creator.toData().getWidgetName()); diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFixLayoutPainter.java b/designer-form/src/main/java/com/fr/design/designer/beans/painters/FRFixLayoutPainter.java similarity index 99% rename from designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFixLayoutPainter.java rename to designer-form/src/main/java/com/fr/design/designer/beans/painters/FRFixLayoutPainter.java index ffb812000c..f450a437a2 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFixLayoutPainter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/painters/FRFixLayoutPainter.java @@ -1,4 +1,4 @@ -package com.fr.design.designer.beans.adapters.layout; +package com.fr.design.designer.beans.painters; import com.fr.design.designer.beans.painters.AbstractPainter; import com.fr.design.designer.creator.XCreator; diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java index 2507a2aacb..4601c268a6 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java @@ -9,8 +9,8 @@ import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.UpdateAction; import com.fr.design.designer.beans.events.DesignerEditor; import com.fr.design.designer.beans.models.SelectionModel; -import com.fr.design.designer.creator.componenttree.XCreatorBaseOperate; -import com.fr.design.designer.creator.componenttree.DefaultXCreatorBaseOperate; +import com.fr.design.designer.creator.operate.XCreatorBaseOperate; +import com.fr.design.designer.creator.operate.DefaultXCreatorBaseOperate; import com.fr.design.designer.treeview.DefaultXCreatorTreeCellRender; import com.fr.design.designer.treeview.XCreatorTreeCellRender; import com.fr.design.designer.ui.SelectedPopupDialog; diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XOccupiedLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XOccupiedLayout.java index a4f82a849a..561a9437ce 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XOccupiedLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XOccupiedLayout.java @@ -2,8 +2,8 @@ package com.fr.design.designer.creator; import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.adapters.layout.FROccupiedLayoutAdapter; -import com.fr.design.designer.creator.componenttree.DefaultXCreatorBaseOperate; -import com.fr.design.designer.creator.componenttree.XCreatorBaseOperate; +import com.fr.design.designer.creator.operate.DefaultXCreatorBaseOperate; +import com.fr.design.designer.creator.operate.XCreatorBaseOperate; import com.fr.design.form.layout.FRFitLayout; import com.fr.design.form.util.XCreatorConstants; import com.fr.form.ui.container.OccupiedLayout; diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java index 677bb48794..9aacc7c5d0 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java @@ -871,8 +871,10 @@ public class XWFitLayout extends XLayoutContainer { Widget wgt = xwc.toData(); BoundsWidget bw = (BoundsWidget) wlayout.getBoundsWidget(wgt); wlayout.removeWidget(bw); - updateBoundsWidget(); - ((FRFitLayoutAdapter)getLayoutAdapter()).updateCreatorBackBound(); + if(!isFixLayout){ + updateBoundsWidget(); + ((FRFitLayoutAdapter)getLayoutAdapter()).updateCreatorBackBound(); + } } /** diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/componenttree/DefaultXCreatorBaseOperate.java b/designer-form/src/main/java/com/fr/design/designer/creator/operate/DefaultXCreatorBaseOperate.java similarity index 90% rename from designer-form/src/main/java/com/fr/design/designer/creator/componenttree/DefaultXCreatorBaseOperate.java rename to designer-form/src/main/java/com/fr/design/designer/creator/operate/DefaultXCreatorBaseOperate.java index b6f939795d..897b06ce44 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/componenttree/DefaultXCreatorBaseOperate.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/operate/DefaultXCreatorBaseOperate.java @@ -1,4 +1,4 @@ -package com.fr.design.designer.creator.componenttree; +package com.fr.design.designer.creator.operate; public class DefaultXCreatorBaseOperate implements XCreatorBaseOperate { diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/componenttree/XCreatorBaseOperate.java b/designer-form/src/main/java/com/fr/design/designer/creator/operate/XCreatorBaseOperate.java similarity index 82% rename from designer-form/src/main/java/com/fr/design/designer/creator/componenttree/XCreatorBaseOperate.java rename to designer-form/src/main/java/com/fr/design/designer/creator/operate/XCreatorBaseOperate.java index fdcfdab641..3412501b36 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/componenttree/XCreatorBaseOperate.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/operate/XCreatorBaseOperate.java @@ -1,4 +1,4 @@ -package com.fr.design.designer.creator.componenttree; +package com.fr.design.designer.creator.operate; import com.fr.design.designer.beans.adapters.layout.DesignerBaseOperate; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java b/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java index 51a15ff6f0..648a2845d2 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java @@ -95,6 +95,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent { private double START_VALUE = DEFAULT_SLIDER; private double screenValue; private UIButton fixLayoutSwitchButton; + private boolean isFixLayoutEditState; public FormScrollBar getHorScrollBar() { @@ -250,9 +251,23 @@ public class FormArea extends JComponent implements ScrollRulerComponent { slidePane.addValueChangeListener(showValSpinnerChangeListener); } + public void undoFixLayoutState(boolean isFixLayout) { + getFormEditor().getRootComponent().setFixLayout(isFixLayout); + this.switchLayout(isFixLayout); + } + public void switchBodyLayout(XLayoutContainer xLayoutContainer) { this.fixLayoutSwitchButton.setVisible(xLayoutContainer.supportFixLayout()); - this.fixLayoutSwitchButton.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout_No_Fix_Layout")); + this.switchLayout(true); + } + + private void switchLayout(boolean isFixLayout) { + this.isFixLayoutEditState = isFixLayout; + this.fixLayoutSwitchButton.setText(isFixLayout ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout_Fix_Layout") : + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout_No_Fix_Layout")); + FormMobileAttr formMobileAttr = designer.getTarget().getFormMobileAttr(); + widthPane.setEnabled(!isFixLayout && !formMobileAttr.isMobileOnly()); + heightPane.setEnabled(!isFixLayout); } @@ -338,8 +353,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent { if(object instanceof XCreator){ updateCreatorsBackupBound((XCreator) object); } - } - } + } } //设置宽度的控件及响应事件 @@ -956,6 +970,10 @@ public class FormArea extends JComponent implements ScrollRulerComponent { } + public boolean isFixLayout(){ + return this.isFixLayoutEditState; + } + class Switch2NoFixLayoutAction extends UpdateAction{ public Switch2NoFixLayoutAction(){ this.putValue(Action.SMALL_ICON, null); @@ -966,7 +984,8 @@ public class FormArea extends JComponent implements ScrollRulerComponent { @Override public void actionPerformed(ActionEvent e) { getFormEditor().getRootComponent().setFixLayout(false); - fixLayoutSwitchButton.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout_No_Fix_Layout")); + switchLayout(false); + designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED); DesignerContext.getDesignerFrame().refresh(); } } @@ -982,7 +1001,8 @@ public class FormArea extends JComponent implements ScrollRulerComponent { @Override public void actionPerformed(ActionEvent e) { getFormEditor().getRootComponent().setFixLayout(true); - fixLayoutSwitchButton.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout_Fix_Layout")); + switchLayout(true); + designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED); DesignerContext.getDesignerFrame().refresh(); } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormUndoState.java b/designer-form/src/main/java/com/fr/design/mainframe/FormUndoState.java index e4fb5b7552..8a579b8d19 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormUndoState.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormUndoState.java @@ -14,6 +14,7 @@ public class FormUndoState extends BaseUndoState { private double widthValue; private double heightValue; private double slideValue; + private boolean isFixLayout; public FormUndoState(BaseJForm t, FormArea formArea) { super(t); @@ -31,6 +32,7 @@ public class FormUndoState extends BaseUndoState { this.widthValue = formArea.getWidthPaneValue(); this.heightValue = formArea.getHeightPaneValue(); this.slideValue = formArea.getSlideValue(); + this.isFixLayout = formArea.isFixLayout(); } /** @@ -89,6 +91,14 @@ public class FormUndoState extends BaseUndoState { return this.slideValue; } + /** + * 返回是否处于固定布局编辑状态下 + * @return + */ + public boolean isFixLayout(){ + return isFixLayout; + } + @Override public void applyState() { this.getApplyTarget().applyUndoState4Form(this); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index c7f7605a1e..581e289994 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -672,6 +672,7 @@ public class JForm extends JTemplate implements BaseJForm implements BaseJForm