From e4404356c5ef493d01a77c87b65590556511acd8 Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 17 Sep 2021 17:21:59 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-57810=20-=20=E5=9B=BA=E5=AE=9A=E5=B8=83?= =?UTF-8?q?=E5=B1=80-=E5=8E=9F=E5=B8=83=E5=B1=80=E6=8E=A8=E8=8D=904.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adapters/layout/FRFixLayoutAdapter.java | 1 + .../layout/FROccupiedLayoutAdapter.java | 5 ++-- .../FRFixLayoutPainter.java | 2 +- .../fr/design/designer/creator/XCreator.java | 4 +-- .../designer/creator/XOccupiedLayout.java | 4 +-- .../design/designer/creator/XWFitLayout.java | 6 ++-- .../DefaultXCreatorBaseOperate.java | 2 +- .../XCreatorBaseOperate.java | 2 +- .../com/fr/design/mainframe/FormArea.java | 30 +++++++++++++++---- .../fr/design/mainframe/FormUndoState.java | 10 +++++++ .../java/com/fr/design/mainframe/JForm.java | 2 ++ 11 files changed, 51 insertions(+), 17 deletions(-) rename designer-form/src/main/java/com/fr/design/designer/beans/{adapters/layout => painters}/FRFixLayoutPainter.java (99%) rename designer-form/src/main/java/com/fr/design/designer/creator/{componenttree => operate}/DefaultXCreatorBaseOperate.java (90%) rename designer-form/src/main/java/com/fr/design/designer/creator/{componenttree => operate}/XCreatorBaseOperate.java (82%) 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 0c50aa9c2..798b277f6 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 91d2c7f49..6c6aa2647 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 ffb812000..f450a437a 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 2507a2aac..4601c268a 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 a4f82a849..561a9437c 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 677bb4879..9aacc7c5d 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 b6f939795..897b06ce4 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 fdcfdab64..3412501b3 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 51a15ff6f..648a2845d 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 e4fb5b755..8a579b8d1 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 c7f7605a1..581e28999 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