Browse Source

Merge pull request #473 in BA/design from ~ZHOUPING/design:dev to dev

* commit '9b969909a264ff2e8d74f2042cd7b780cc676fcf':
  REPORT-750 表单共创内测问题 bugfix5
master
superman 8 years ago
parent
commit
d33dc6fdc3
  1. 16
      designer_form/src/com/fr/design/designer/creator/XCreator.java
  2. 32
      designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java
  3. 2
      designer_form/src/com/fr/design/designer/creator/XWFitLayout.java

16
designer_form/src/com/fr/design/designer/creator/XCreator.java

@ -601,4 +601,20 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
} }
} }
/**
* 按照比例调整组件的宽度
* @param percent 比例
*/
public void adjustCompWidth(double percent){
return;
}
/**
* 按照比例调整组件的高度
* @param percent 比例
*/
public void adjustCompHeight(double percent) {
return;
}
} }

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

@ -444,4 +444,36 @@ public class XWAbsoluteLayout extends XLayoutContainer {
} }
} }
} }
/**
* body大小手动调整的时候
* 按照比例调整组件的宽度
* @param percent 比例
*/
@Override
public void adjustCompWidth(double percent) {
for (int i = 0; i < getComponentCount(); i++) {
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());
widget.setBounds(xCreator.getBounds());
}
}
/**
* body大小手动调整的时候
* 按照比例调整组件的高度
* @param percent 比例
*/
@Override
public void adjustCompHeight(double percent) {
for (int i = 0; i < getComponentCount(); i++) {
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());
widget.setBounds(xCreator.getBounds());
}
}
} }

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

@ -381,6 +381,7 @@ public class XWFitLayout extends XLayoutContainer {
needAddWidth = Math.max(needAddWidth, MIN_WIDTH-width); needAddWidth = Math.max(needAddWidth, MIN_WIDTH-width);
} }
} }
creator.adjustCompWidth((double) creator.getBounds().width / rec.width);
toData().setBounds(creator.toData(), creator.getBounds()); toData().setBounds(creator.toData(), creator.getBounds());
} }
@ -504,6 +505,7 @@ public class XWFitLayout extends XLayoutContainer {
needAddHeight = Math.max(needAddHeight, MIN_HEIGHT-h); needAddHeight = Math.max(needAddHeight, MIN_HEIGHT-h);
} }
} }
creator.adjustCompHeight((double) creator.getBounds().height / rec.height);
toData().setBounds(creator.toData(), creator.getBounds()); toData().setBounds(creator.toData(), creator.getBounds());
} }

Loading…
Cancel
Save