Browse Source

Pull request #5914: REPORT-57810 - 固定布局-原布局推荐4.1

Merge in DESIGN/design from ~KERRY/design_10.0:feature/x to feature/x

* commit 'e4404356c5ef493d01a77c87b65590556511acd8':
  REPORT-57810 - 固定布局-原布局推荐4.1
research/11.0
kerry 3 years ago
parent
commit
6cab40a121
  1. 1
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFixLayoutAdapter.java
  2. 5
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FROccupiedLayoutAdapter.java
  3. 2
      designer-form/src/main/java/com/fr/design/designer/beans/painters/FRFixLayoutPainter.java
  4. 4
      designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java
  5. 4
      designer-form/src/main/java/com/fr/design/designer/creator/XOccupiedLayout.java
  6. 6
      designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java
  7. 2
      designer-form/src/main/java/com/fr/design/designer/creator/operate/DefaultXCreatorBaseOperate.java
  8. 2
      designer-form/src/main/java/com/fr/design/designer/creator/operate/XCreatorBaseOperate.java
  9. 30
      designer-form/src/main/java/com/fr/design/mainframe/FormArea.java
  10. 10
      designer-form/src/main/java/com/fr/design/mainframe/FormUndoState.java
  11. 2
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java

1
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;

5
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());

2
designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFixLayoutPainter.java → 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;

4
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;

4
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;

6
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();
}
}
/**

2
designer-form/src/main/java/com/fr/design/designer/creator/componenttree/DefaultXCreatorBaseOperate.java → 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 {

2
designer-form/src/main/java/com/fr/design/designer/creator/componenttree/XCreatorBaseOperate.java → 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;

30
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();
}
}

10
designer-form/src/main/java/com/fr/design/mainframe/FormUndoState.java

@ -14,6 +14,7 @@ public class FormUndoState extends BaseUndoState<BaseJForm> {
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<BaseJForm> {
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<BaseJForm> {
return this.slideValue;
}
/**
* 返回是否处于固定布局编辑状态下
* @return
*/
public boolean isFixLayout(){
return isFixLayout;
}
@Override
public void applyState() {
this.getApplyTarget().applyUndoState4Form(this);

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

@ -672,6 +672,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
this.setTarget(undoForm);
JForm.this.refreshRoot();
this.formDesign.getArea().setAreaSize(u.getAreaSize(), u.getHorizontalValue(), u.getVerticalValue(), u.getWidthValue(), u.getHeightValue(), u.getSlideValue());
formDesign.getArea().undoFixLayoutState(u.isFixLayout());
//撤销的时候要重新选择的body布局
this.formDesign.getSelectionModel().setSelectedCreators(FormSelectionUtils.rebuildSelection(formDesign.getRootComponent(),
formDesign.getRootComponent() == selectedBodyLayout() ? u.getSelectWidgets() : new Widget[]{selectedBodyLayout().toData()}));
@ -1201,6 +1202,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
formDesign.refreshRoot();
// 刷新界面后恢复原来的尺寸
formDesign.getArea().setAreaSize(areaSize, horizontalValue, verticalValue, widthValue, heightValue, slideValue);
formDesign.getArea().undoFixLayoutState(formArea.isFixLayout());
if (this.index != FORM_TAB) {
refreshToolArea();
} else {

Loading…
Cancel
Save