Browse Source

Merge pull request #156 in DESIGN/design from ~KERRY/design_10.0:release/10.0 to release/10.0

* commit '80c13ce1e40b2db6045bab08753b80cddab6e48b':
  REPORT-8754 模板设置双向自适应后frm里的网页框里内容显示问题(10.0传一份)
master
kerry 7 years ago
parent
commit
2412ece49d
  1. 12
      designer-form/src/com/fr/design/designer/beans/adapters/layout/FRBodyLayoutAdapter.java
  2. 6
      designer-form/src/com/fr/design/designer/creator/XCreator.java
  3. 3
      designer-form/src/com/fr/design/designer/creator/XWFitLayout.java
  4. 88
      designer-form/src/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java
  5. 4
      designer-form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java
  6. 4
      designer-form/src/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java

12
designer-form/src/com/fr/design/designer/beans/adapters/layout/FRBodyLayoutAdapter.java

@ -620,8 +620,8 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter {
} else {
currentCreator.setLocation(finalX, finalY);
currentCreator.setSize(finalW, finalH);
currentCreator.recalculateChildWidth(finalW);
currentCreator.recalculateChildHeight(finalH);
currentCreator.recalculateChildWidth(finalW, false);
currentCreator.recalculateChildHeight(finalH, false);
child.setLocation(xL, yL);
child.setSize(dim);
}
@ -1078,7 +1078,7 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter {
int offset = comp.getHeight() - length;
comp.setSize(comp.getWidth(), offset);
XCreator creator = (XCreator) comp;
creator.recalculateChildHeight(offset);
creator.recalculateChildHeight(offset, false);
}
}
@ -1100,7 +1100,7 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter {
int offset = comp.getHeight() - length;
comp.setSize(comp.getWidth(), offset);
XCreator creator = (XCreator) comp;
creator.recalculateChildHeight(offset);
creator.recalculateChildHeight(offset, false);
}
}
childY += actualVal;
@ -1134,7 +1134,7 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter {
int offset = comp.getWidth() - length;
comp.setSize(offset, comp.getHeight());
XCreator creator = (XCreator) comp;
creator.recalculateChildWidth(offset);
creator.recalculateChildWidth(offset, false);
}
}
childX += actualVal;
@ -1155,7 +1155,7 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter {
int offset = comp.getWidth() - length;
comp.setSize(offset, comp.getHeight());
XCreator creator = (XCreator) comp;
creator.recalculateChildWidth(offset);
creator.recalculateChildWidth(offset, false);
}
}

6
designer-form/src/com/fr/design/designer/creator/XCreator.java

@ -576,15 +576,17 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
/**
* 重新调整子组件宽度
* @param width 宽度
* @param actualSize 是否按照实际大小计算
*/
public void recalculateChildWidth(int width){
public void recalculateChildWidth(int width, boolean actualSize){
return;
}
/**
* 重新调整子组件高度
* @param height 高度
* @param actualSize 是否按照实际大小计算
*/
public void recalculateChildHeight(int height){
public void recalculateChildHeight(int height, boolean actualSize){
return;
}

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

@ -373,7 +373,7 @@ public class XWFitLayout extends XLayoutContainer {
if (x == 0) {
int width = notHasRightCreator(rec) ? this.getWidth() : rec.width+dw;
creator.setBounds(0, rec.y, width, rec.height);
creator.recalculateChildWidth(width);
creator.recalculateChildWidth(width, true);
} else {
XCreator leftCreator = getCreatorAt(rec.x-1, rec.y);
int posX = getPosX(leftCreator);
@ -502,6 +502,7 @@ public class XWFitLayout extends XLayoutContainer {
if (y==0) {
int height = notHasBottomCreator(rec) ? this.getHeight() : rec.height+dh;
creator.setBounds(rec.x, 0, rec.width, height);
creator.recalculateChildHeight(height, true);
} else {
XCreator topCreator = getCreatorAt(rec.x, rec.y-1);
int posY = getPosY(topCreator);

88
designer-form/src/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java

@ -260,74 +260,90 @@ public class XWCardMainBorderLayout extends XWBorderLayout {
return tabLayoutList;
}
/**
* 重新调整子组件的宽度
* @param width 宽度
*/
@Override
public void recalculateChildWidth(int width){
/**
* 重新调整子组件的宽度
* @param width 宽度
* @param actualSize 是否按照实际大小计算
*/
@Override
public void recalculateChildWidth(int width, boolean actualSize){
ArrayList<?> childrenList = this.getTargetChildrenList();
int size = childrenList.size();
if (size > 0) {
for (int j = 0; j < size; j++) {
XWTabFitLayout tabLayout = (XWTabFitLayout) childrenList
.get(j);
tabLayout.setBackupBound(tabLayout.getBounds());
int refSize = tabLayout.getWidth();
Dimension d = new Dimension(tabLayout.toData().getContainerWidth(), tabLayout.toData().getContainerHeight());
Rectangle rec = actualSize? new Rectangle(d): tabLayout.getBounds();
// 容器大小改变时,设下backupBound为其之前的实际大小
tabLayout.setBackupBound(rec);
int refSize = rec.width;
int offest = width - refSize;
double percent = (double) offest / refSize;
if (percent < 0 && !tabLayout.canReduce(percent)) {
return;
}
tabLayout.setSize(tabLayout.getWidth() + offest,
tabLayout.getHeight());
for (int m = 0; m < tabLayout.getComponentCount(); m++) {
XCreator childCreator = tabLayout.getXCreator(m);
BoundsWidget wgt = (BoundsWidget) tabLayout.toData()
.getBoundsWidget(childCreator.toData());
wgt.setBounds(tabLayout.getComponent(m).getBounds());
tabLayout.setSize(rec.width + offest, rec.height);
if(!actualSize){
updateChildWidgetBounds(tabLayout);
}
tabLayout.adjustCreatorsWidth(percent);
}
}
}
}
/**
* 重新调整子组件的高度
* @param height 高度
*/
@Override
public void recalculateChildHeight(int height){
/**
* 重新调整子组件的高度
* @param height 高度
* @param actualSize 是否按照实际大小计算
*/
@Override
public void recalculateChildHeight(int height, boolean actualSize){
ArrayList<?> childrenList = this.getTargetChildrenList();
int size = childrenList.size();
if (size > 0) {
for (int j = 0; j < size; j++) {
XWTabFitLayout tabLayout = (XWTabFitLayout) childrenList
.get(j);
tabLayout.setBackupBound(tabLayout.getBounds());
int refSize = tabLayout.getHeight();
Dimension d = new Dimension(tabLayout.toData().getContainerWidth(), tabLayout.toData().getContainerHeight());
Rectangle rec = actualSize? new Rectangle(d): tabLayout.getBounds();
// 容器大小改变时,设下backupBound为其之前的实际大小
tabLayout.setBackupBound(rec);
int refSize = rec.height;
int offset = height - refSize - WCardMainBorderLayout.TAB_HEIGHT;
if(offset < 0){
// 缩放时需要备份原tab布局宽高
tabLayout.setReferDim(new Dimension(tabLayout.getWidth(),tabLayout.getHeight()));
}
if(offset < 0){
// 缩放时需要备份原tab布局宽高
tabLayout.setReferDim(new Dimension(rec.width, rec.height));
}
double percent = (double) offset / refSize;
if (percent < 0 && !tabLayout.canReduce(percent)) {
return;
}
tabLayout.setSize(tabLayout.getWidth(),
tabLayout.getHeight() + offset);
for (int m = 0; m < tabLayout.getComponentCount(); m++) {
XCreator childCreator = tabLayout.getXCreator(m);
BoundsWidget wgt = (BoundsWidget) tabLayout.toData()
.getBoundsWidget(childCreator.toData());
wgt.setBounds(tabLayout.getComponent(m).getBounds());
tabLayout.setSize(rec.width, rec.height + offset);
if(!actualSize){
updateChildWidgetBounds(tabLayout);
}
tabLayout.adjustCreatorsHeight(percent);
}
}
}
}
/**
* 更新下子组件bounds
* @param tabLayout tabFit布局
*/
private void updateChildWidgetBounds(XWTabFitLayout tabLayout){
for (int m = 0; m < tabLayout.getComponentCount(); m++) {
XCreator childCreator = tabLayout.getXCreator(m);
BoundsWidget wgt = (BoundsWidget) tabLayout.toData()
.getBoundsWidget(childCreator.toData());
wgt.setBounds(tabLayout.getComponent(m).getBounds());
}
}
@Override
public void paint(Graphics g) {

4
designer-form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java

@ -222,8 +222,8 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr
}
for (int i = 0;i < components.length;i++){
if (components[i] instanceof XWCardMainBorderLayout){
((XWCardMainBorderLayout)components[i]).recalculateChildWidth(components[i].getWidth());
((XWCardMainBorderLayout)components[i]).recalculateChildHeight(components[i].getHeight());
((XWCardMainBorderLayout)components[i]).recalculateChildWidth(components[i].getWidth(), false);
((XWCardMainBorderLayout)components[i]).recalculateChildHeight(components[i].getHeight(), false);
}
xwFitLayout.dealDirections((XCreator)components[i], false);
}

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

@ -232,8 +232,8 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane {
}
for (int i = 0; i < components.length; i++) {
if (components[i] instanceof XWCardMainBorderLayout) {
((XWCardMainBorderLayout) components[i]).recalculateChildWidth(components[i].getWidth());
((XWCardMainBorderLayout) components[i]).recalculateChildHeight(components[i].getHeight());
((XWCardMainBorderLayout) components[i]).recalculateChildWidth(components[i].getWidth(), false);
((XWCardMainBorderLayout) components[i]).recalculateChildHeight(components[i].getHeight(), false);
}
xwFitLayout.dealDirections((XCreator) components[i], false);
}

Loading…
Cancel
Save