Browse Source

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

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

* commit '1abc3ecb3ddae47de528922c112d8a3149212028':
  代码修改
  REPORT-57810 固定布局-原布局推荐4.1
research/11.0
kerry 3 years ago
parent
commit
1f354f35fb
  1. 14
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFixLayoutAdapter.java
  2. 9
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FROccupiedLayoutAdapter.java
  3. 4
      designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java
  4. 22
      designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java
  5. 2
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java

14
designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFixLayoutAdapter.java

@ -21,7 +21,7 @@ import java.awt.Graphics;
public class FRFixLayoutAdapter extends AbstractLayoutAdapter {
private static final Icon OCCUPIED_ICON = IconUtils.readIcon("/com/fr/design/form/images/occupied_layout.png");
public FRFixLayoutAdapter(XLayoutContainer container) {
public FRFixLayoutAdapter( XLayoutContainer container) {
super(container);
}
@ -32,12 +32,11 @@ public class FRFixLayoutAdapter extends AbstractLayoutAdapter {
}
child.setLocation(component.getX(), component.getY());
child.setSize(component.getWidth(), component.getHeight());
container.remove(component);
if (child.shouldScaleCreator() || child.hasTitleStyle()) {
XLayoutContainer parentPanel = child.initCreatorWrapper(21);
container.add(parentPanel, child.toData().getWidgetName());
container.replaceXcreator(parentPanel, (XCreator) component);
} else {
container.add(child, child.toData().getWidgetName());
container.replaceXcreator(child, (XCreator) component);
}
if (child.getBackupRectangle() != null && child.getParent() == container) {
Component origin = container.getComponentAt(child.getBackupRectangle().x + 5, child.getBackupRectangle().y + 5);
@ -52,15 +51,20 @@ public class FRFixLayoutAdapter extends AbstractLayoutAdapter {
@Override
public void delete(XCreator creator, int creatorWidth, int creatorHeight) {
//固定布局下不支持移除占位块组件
if (creator.acceptType(XOccupiedLayout.class)){
return;
}
OccupiedLayout occupiedLayout = new OccupiedLayout();
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
XOccupiedLayout xoccupiedLayout = new XOccupiedLayout(occupiedLayout, new Dimension());
ModelUtil.renameWidgetName(formDesigner.getTarget(), xoccupiedLayout);
xoccupiedLayout.setLocation(creator.getX(), creator.getY());
xoccupiedLayout.setSize(creatorWidth, creatorHeight);
container.add(xoccupiedLayout);
container.replaceXcreator(xoccupiedLayout,creator);
}
@Override
public XCreatorTreeCellRender getLayoutTreeCellRender(XCreator creator) {
return new DefaultXCreatorTreeCellRender(creator) {

9
designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FROccupiedLayoutAdapter.java

@ -9,18 +9,15 @@ import com.fr.design.designer.treeview.XCreatorTreeCellRender;
import com.fr.design.utils.gui.LayoutUtils;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Graphics;
public class FROccupiedLayoutAdapter extends AbstractLayoutAdapter {
public FROccupiedLayoutAdapter(XLayoutContainer container) {
super(container);
painter = new FROccupiedLayoutPainter(container);
}
private HoverPainter painter;
@ -29,14 +26,12 @@ public class FROccupiedLayoutAdapter extends AbstractLayoutAdapter {
if (container.getComponentCount() == 0) {
creator.setLocation(container.getLocation().x, container.getLocation().y);
creator.setSize(container.getWidth(), container.getHeight());
//将 xcreator 添加到其父容器中,并删除此
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());
parent.replaceXcreator(parentPanel, container);
} else {
parent.add(creator, creator.toData().getWidgetName());
parent.replaceXcreator(creator, container);
}
LayoutUtils.layoutContainer(parent);
}

4
designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java

@ -608,4 +608,8 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
public boolean supportFixLayout(){
return false;
}
public void replaceXcreator(XCreator newCreator, XCreator oldCreator){
}
}

22
designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java

@ -3,6 +3,7 @@ package com.fr.design.designer.creator;
import com.fr.design.designer.beans.LayoutAdapter;
import com.fr.design.designer.beans.adapters.layout.FRFitLayoutAdapter;
import com.fr.design.designer.beans.adapters.layout.FRFixLayoutAdapter;
import com.fr.design.designer.beans.adapters.layout.FRNoFixLayoutAdapter;
import com.fr.design.designer.beans.location.Direction;
import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
@ -82,6 +83,7 @@ public class XWFitLayout extends XLayoutContainer {
@Override
public LayoutAdapter getLayoutAdapter() {
FRFitLayoutAdapter layoutAdapter = new FRFitLayoutAdapter(this);
if (isFixLayout) {
layoutAdapter.setFrLayoutState(new FRFixLayoutAdapter(this));
}
@ -871,10 +873,22 @@ public class XWFitLayout extends XLayoutContainer {
Widget wgt = xwc.toData();
BoundsWidget bw = (BoundsWidget) wlayout.getBoundsWidget(wgt);
wlayout.removeWidget(bw);
if(!isFixLayout){
updateBoundsWidget();
((FRFitLayoutAdapter)getLayoutAdapter()).updateCreatorBackBound();
}
updateBoundsWidget();
((FRFitLayoutAdapter) getLayoutAdapter()).updateCreatorBackBound();
}
public void replaceXcreator(XCreator newCreator, XCreator oldCreator) {
WFitLayout wlayout = this.toData();
Widget wgt = oldCreator.toData();
BoundsWidget bw = (BoundsWidget) wlayout.getBoundsWidget(wgt);
wlayout.removeWidget(bw);
wlayout.addWidget(new BoundsWidget(newCreator.toData(), bw.getBounds()));
newCreator.setBackupParent(this);
isRefreshing = true;
this.remove(oldCreator);
this.add(newCreator);
isRefreshing = false;
LayoutUtils.layoutContainer(this);
}
/**

2
designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java

@ -8,6 +8,7 @@ import com.fr.base.theme.settings.ThemedComponentStyle;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.properties.items.FRLayoutTypeItems;
import com.fr.design.designer.properties.items.Item;
@ -169,6 +170,7 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane {
stylePane.populateBean((LayoutBorderStyle) ob.getBorderStyle());
boundPane.populate();
watermarkEditor.setValue(ReportUtils.getWatermarkAttrFromTemplate(getCurrentIOFile()));
WidgetPropertyPane.getInstance().getEditingFormDesigner().switchBodyLayout((XLayoutContainer) creator);
}
public WAbsoluteBodyLayout updateSubPane() {

Loading…
Cancel
Save