Browse Source

Merge pull request #770 in BA/design from ~FANGLEI/design:master to master

* commit '65c3c951bc9c356a383400c9757db910e8d52054':
  对import BoundsWidget进行修改以兼容老版本自适应插件和表单导出
master
superman 8 years ago
parent
commit
75697db914
  1. 2
      designer_form/src/com/fr/design/designer/beans/ConnectorCreator.java
  2. 2
      designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java
  3. 4
      designer_form/src/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java
  4. 2
      designer_form/src/com/fr/design/designer/beans/location/AccessDirection.java
  5. 2
      designer_form/src/com/fr/design/designer/beans/location/Inner.java
  6. 12
      designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java
  7. 22
      designer_form/src/com/fr/design/designer/creator/XWFitLayout.java
  8. 2
      designer_form/src/com/fr/design/designer/creator/XWScaleLayout.java
  9. 2
      designer_form/src/com/fr/design/designer/creator/XWTitleLayout.java
  10. 6
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java
  11. 4
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java
  12. 2
      designer_form/src/com/fr/design/mainframe/ConnectorHelper.java

2
designer_form/src/com/fr/design/designer/beans/ConnectorCreator.java

@ -6,7 +6,7 @@ import java.util.ArrayList;
import java.util.PriorityQueue;
import com.fr.form.ui.container.WLayout;
import com.fr.form.ui.widget.BoundsWidget;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
public class ConnectorCreator {

2
designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java

@ -12,8 +12,8 @@ import com.fr.design.designer.properties.FRAbsoluteLayoutPropertiesGroupModel;
import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.design.utils.ComponentUtils;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.widget.BoundsWidget;
import com.fr.general.ComparatorUtils;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.general.FRLogger;
public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter {

4
designer_form/src/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java

@ -28,8 +28,8 @@ import com.fr.design.utils.ComponentUtils;
import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.container.WLayout;
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import com.fr.form.ui.widget.BoundsWidget;
import com.fr.general.ComparatorUtils;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
/**
* 自适应布局的容器适配器
@ -1026,7 +1026,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
setAdjustedSize(tabLayout, offset, isHor);
for (int m = 0; m < tabLayout.getComponentCount(); m++) {
XCreator childCreator = tabLayout.getXCreator(m);
BoundsWidget wgt = tabLayout.toData().getBoundsWidget(childCreator.toData());
BoundsWidget wgt = (BoundsWidget) tabLayout.toData().getBoundsWidget(childCreator.toData());
wgt.setBounds(tabLayout.getComponent(m).getBounds());
}
adjustCreatorsSize(percent, tabLayout, isHor);

2
designer_form/src/com/fr/design/designer/beans/location/AccessDirection.java

@ -14,7 +14,7 @@ import com.fr.design.utils.ComponentUtils;
import com.fr.form.main.Form;
import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WParameterLayout;
import com.fr.form.ui.widget.BoundsWidget;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
/**
* @author richer

2
designer_form/src/com/fr/design/designer/beans/location/Inner.java

@ -9,8 +9,8 @@ import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormSelection;
import com.fr.design.utils.ComponentUtils;
import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.widget.BoundsWidget;
import com.fr.stable.ArrayUtils;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import java.awt.*;
import java.awt.Rectangle;

12
designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java

@ -23,7 +23,7 @@ import com.fr.form.ui.Connector;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WLayout;
import com.fr.form.ui.widget.BoundsWidget;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.general.FRScreen;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
@ -154,7 +154,7 @@ public class XWAbsoluteLayout extends XLayoutContainer {
if (xCreator.acceptType(XWAbsoluteLayout.class)){
((XWAbsoluteLayout) xCreator).updateBoundsWidget();
}
BoundsWidget boundsWidget = layout.getBoundsWidget(xCreator.toData());
BoundsWidget boundsWidget = (BoundsWidget) layout.getBoundsWidget(xCreator.toData());
Rectangle rectangle = dealWidgetBound(xCreator.getBounds());
}
@ -179,7 +179,7 @@ public class XWAbsoluteLayout extends XLayoutContainer {
double percentH = ((double) backupBound.height / (double) currentBound.height);
for (int index = 0, n = this.getComponentCount(); index < n; index++){
XCreator creator = (XCreator) this.getComponent(index);
BoundsWidget wgt = layout.getBoundsWidget(creator.toData());
BoundsWidget wgt = (BoundsWidget) layout.getBoundsWidget(creator.toData());
// 用当前的显示大小计算后调正具体位置
Rectangle wgtBound = creator.getBounds();
Rectangle rec = calculateBound(wgtBound, percentW, percentH);
@ -211,7 +211,7 @@ public class XWAbsoluteLayout extends XLayoutContainer {
rec.y = (int)(rec.y / prevContainerPercent * containerPercent);
rec.height = (int)(rec.height / prevContainerPercent * containerPercent);
rec.width = (int)(rec.width / prevContainerPercent * containerPercent);
BoundsWidget wgt = toData().getBoundsWidget(creator.toData());
BoundsWidget wgt = (BoundsWidget) toData().getBoundsWidget(creator.toData());
wgt.setBounds(rec);
creator.setBounds(rec);
creator.updateChildBound(minHeight);
@ -467,7 +467,7 @@ public class XWAbsoluteLayout extends XLayoutContainer {
XCreator xCreator = (XCreator) getComponent(i);
Rectangle rectangle = xCreator.getBounds();
xCreator.setBounds((int) (rectangle.x * percent), rectangle.y, (int) (rectangle.width * percent), rectangle.height);
BoundsWidget widget = toData().getBoundsWidget(xCreator.toData());
BoundsWidget widget = (BoundsWidget) toData().getBoundsWidget(xCreator.toData());
widget.setBounds(xCreator.getBounds());
}
}
@ -483,7 +483,7 @@ public class XWAbsoluteLayout extends XLayoutContainer {
XCreator xCreator = (XCreator) getComponent(i);
Rectangle rectangle = xCreator.getBounds();
xCreator.setBounds(rectangle.x, (int) (rectangle.y * percent), rectangle.width, (int) (rectangle.height * percent));
BoundsWidget widget = toData().getBoundsWidget(xCreator.toData());
BoundsWidget widget = (BoundsWidget) toData().getBoundsWidget(xCreator.toData());
widget.setBounds(xCreator.getBounds());
}
}

22
designer_form/src/com/fr/design/designer/creator/XWFitLayout.java

@ -23,8 +23,8 @@ import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WBodyLayoutType;
import com.fr.form.ui.container.WFitLayout;
import com.fr.form.ui.container.WLayout;
import com.fr.form.ui.widget.BoundsWidget;
import com.fr.general.FRScreen;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.general.Inter;
import com.fr.stable.ArrayUtils;
@ -351,7 +351,7 @@ public class XWFitLayout extends XLayoutContainer {
}
for (int i=0, size=comps.size(); i<size; i++) {
XCreator creator = (XCreator) comps.get(i);
BoundsWidget widget = toData().getBoundsWidget(creator.toData());
BoundsWidget widget = (BoundsWidget) toData().getBoundsWidget(creator.toData());
Rectangle rec = widget.getBounds();
Rectangle backRec = widget.getBackupBounds();
if (backRec.x<x) {
@ -415,7 +415,7 @@ public class XWFitLayout extends XLayoutContainer {
protected void modifyEdgemostCreator(boolean isHor) {
for (int i=0, size=this.getComponentCount(); i<size; i++) {
XCreator creator = (XCreator) this.getComponent(i);
BoundsWidget widget = toData().getBoundsWidget(creator.toData());
BoundsWidget widget = (BoundsWidget) toData().getBoundsWidget(creator.toData());
Rectangle rec = widget.getBackupBounds();
if (isHor && notHasRightCreator(rec)) {
creator.setSize(creator.getWidth()+needAddWidth, creator.getHeight());
@ -480,7 +480,7 @@ public class XWFitLayout extends XLayoutContainer {
}
for (int i=0, size=comps.size(); i<size; i++) {
XCreator creator = (XCreator) comps.get(i);
BoundsWidget widget = toData().getBoundsWidget(creator.toData());
BoundsWidget widget = (BoundsWidget) toData().getBoundsWidget(creator.toData());
Rectangle rec = widget.getBounds();
Rectangle backRec = widget.getBackupBounds();
if (backRec.y < y) {
@ -519,7 +519,7 @@ public class XWFitLayout extends XLayoutContainer {
for (int i=0; i<size; i++) {
Component comp = this.getComponent(i);
XCreator creator = (XCreator) comp;
BoundsWidget widget = toData().getBoundsWidget(creator.toData());
BoundsWidget widget = (BoundsWidget) toData().getBoundsWidget(creator.toData());
Rectangle rec = widget.getBackupBounds();
//rec.x小于x,右侧大于x
boolean isLowX = rec.x<x && x<rec.x+rec.width;
@ -535,7 +535,7 @@ public class XWFitLayout extends XLayoutContainer {
for (int i=0,size=this.getComponentCount(); i<size; i++) {
Component comp = this.getComponent(i);
XCreator creator = (XCreator) comp;
BoundsWidget widget = toData().getBoundsWidget(creator.toData());
BoundsWidget widget = (BoundsWidget) toData().getBoundsWidget(creator.toData());
Rectangle rec = widget.getBackupBounds();
boolean isLowY = rec.y<y && y<rec.y+rec.height;
if (isLowY || rec.y==y) {
@ -574,7 +574,7 @@ public class XWFitLayout extends XLayoutContainer {
public XCreator getCreatorAt(int x, int y) {
for (int i=0,size=this.getComponentCount(); i<size; i++) {
XCreator creator = (XCreator) this.getComponent(i);
BoundsWidget widget = toData().getBoundsWidget(creator.toData());
BoundsWidget widget = (BoundsWidget) toData().getBoundsWidget(creator.toData());
Rectangle rec = widget.getBackupBounds();
boolean isCurrent = rec.x<=x && x<rec.x+rec.width && rec.y<=y && y<rec.y+rec.height;
if (isCurrent) {
@ -591,7 +591,7 @@ public class XWFitLayout extends XLayoutContainer {
for (int i=0, size=this.getComponentCount(); i<size; i++) {
Component comp = this.getComponent(i);
XCreator creator = (XCreator) comp;
BoundsWidget widget = toData().getBoundsWidget(creator.toData());
BoundsWidget widget = (BoundsWidget) toData().getBoundsWidget(creator.toData());
widget.setBackupBounds(widget.getBounds());
}
}
@ -736,7 +736,7 @@ public class XWFitLayout extends XLayoutContainer {
int containerHeight = 0;
for (int index=0, n=this.getComponentCount(); index<n; index++) {
XCreator creator = (XCreator) this.getComponent(index);
BoundsWidget wgt = layout.getBoundsWidget(creator.toData());
BoundsWidget wgt = (BoundsWidget) layout.getBoundsWidget(creator.toData());
// 用当前的显示大小计算后调正具体位置
Rectangle wgtBound = dealWidgetBound(creator.getBounds());
Rectangle rec = recalculateWidgetBounds(wgtBound, hors, veris);
@ -814,7 +814,7 @@ public class XWFitLayout extends XLayoutContainer {
WFitLayout wlayout = this.toData();
XWidgetCreator xwc = ((XWidgetCreator) e.getChild());
Widget wgt = xwc.toData();
BoundsWidget bw = wlayout.getBoundsWidget(wgt);
BoundsWidget bw = (BoundsWidget) wlayout.getBoundsWidget(wgt);
wlayout.removeWidget(bw);
updateBoundsWidget();
((FRFitLayoutAdapter)getLayoutAdapter()).updateCreatorBackBound();
@ -992,7 +992,7 @@ public class XWFitLayout extends XLayoutContainer {
int val = toData().getCompInterval()/2;
for (int i=0, len=this.getComponentCount(); i<len; i++) {
XCreator creator = (XCreator) this.getComponent(i);
BoundsWidget widget = toData().getBoundsWidget(creator.toData());
BoundsWidget widget = (BoundsWidget) toData().getBoundsWidget(creator.toData());
Rectangle rec = widget.getBounds();
Dimension d = new Dimension(this.getBackupBound().width, this.getBackupBound().height);
Rectangle bound = dealBound(rec, d, val, percent);

2
designer_form/src/com/fr/design/designer/creator/XWScaleLayout.java

@ -12,7 +12,7 @@ import com.fr.design.designer.beans.adapters.layout.FRScaleLayoutAdapter;
import com.fr.design.form.layout.FRScaleLayout;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WScaleLayout;
import com.fr.form.ui.widget.BoundsWidget;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
/**
* 自适应布局中添加组件时部分控件如数字文本下拉等需要保持控件默认高度21 用此容器来实现

2
designer_form/src/com/fr/design/designer/creator/XWTitleLayout.java

@ -11,8 +11,8 @@ import com.fr.form.ui.Label;
import com.fr.form.ui.Widget;
import com.fr.form.ui.WidgetTitle;
import com.fr.form.ui.container.WTitleLayout;
import com.fr.form.ui.widget.BoundsWidget;
import com.fr.general.ComparatorUtils;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import java.awt.*;
import java.awt.event.ContainerEvent;

6
designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java

@ -19,8 +19,8 @@ import com.fr.design.mainframe.EditingMouseListener;
import com.fr.design.mainframe.FormDesigner;
import com.fr.form.ui.container.WBorderLayout;
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import com.fr.form.ui.widget.BoundsWidget;
import com.fr.general.IOUtils;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.general.Inter;
/**
@ -154,7 +154,7 @@ public class XWCardMainBorderLayout extends XWBorderLayout{
tabLayout.getHeight());
for (int m = 0; m < tabLayout.getComponentCount(); m++) {
XCreator childCreator = tabLayout.getXCreator(m);
BoundsWidget wgt = tabLayout.toData()
BoundsWidget wgt = (BoundsWidget) tabLayout.toData()
.getBoundsWidget(childCreator.toData());
wgt.setBounds(tabLayout.getComponent(m).getBounds());
}
@ -189,7 +189,7 @@ public class XWCardMainBorderLayout extends XWBorderLayout{
tabLayout.getHeight() + offset);
for (int m = 0; m < tabLayout.getComponentCount(); m++) {
XCreator childCreator = tabLayout.getXCreator(m);
BoundsWidget wgt = tabLayout.toData()
BoundsWidget wgt = (BoundsWidget) tabLayout.toData()
.getBoundsWidget(childCreator.toData());
wgt.setBounds(tabLayout.getComponent(m).getBounds());
}

4
designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java

@ -18,7 +18,7 @@ import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.CardSwitchButton;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.form.ui.widget.BoundsWidget;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.general.Background;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
@ -425,7 +425,7 @@ public class XWTabFitLayout extends XWFitLayout {
private void updateCompsWidget(){
for(int m=0;m<this.getComponentCount();m++){
XCreator childCreator = this.getXCreator(m);
BoundsWidget wgt = this.toData().getBoundsWidget(childCreator.toData());
BoundsWidget wgt = (BoundsWidget) this.toData().getBoundsWidget(childCreator.toData());
wgt.setBounds(this.getComponent(m).getBounds());
wgt.setBackupBounds(this.getComponent(m).getBounds());
}

2
designer_form/src/com/fr/design/mainframe/ConnectorHelper.java

@ -7,7 +7,7 @@ import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import com.fr.form.ui.widget.BoundsWidget;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.stable.Constants;
import com.fr.base.GraphHelper;
import com.fr.design.designer.beans.ConnectorCreator;

Loading…
Cancel
Save