Browse Source

REPORT-1092 两个一样的表单demo,预览的效果不一样

dev上测试验收过了,同步到master
master
zhouping 8 years ago
parent
commit
d3e9ff80ab
  1. 1
      designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java
  2. 29
      designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java

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

@ -235,6 +235,7 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter {
}
XWAbsoluteLayout layout = (XWAbsoluteLayout) container;
layout.updateBoundsWidget(creator);
updateCreatorBackBound();
LayoutUtils.layoutRootContainer(container);
}else{
fixAbsolute(creator, x, y);

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

@ -96,7 +96,6 @@ public class XWAbsoluteLayout extends XLayoutContainer {
if(screenValue != FormArea.DEFAULT_SLIDER){
this.setContainerPercent(screenValue / FormArea.DEFAULT_SLIDER);
}
widget.setDesigningResolution(scrnsize);
}
/**
@ -209,6 +208,32 @@ public class XWAbsoluteLayout extends XLayoutContainer {
}
}
/**
* 更新子组件的Bound
* 这边主要用于绝对布局子组件在适应区域选项时
* 涉及到的不同分辨率下缩放
* @param minHeight 最小高度
*/
@Override
public void updateChildBound(int minHeight) {
double prevContainerPercent = FRScreen.getByDimension(toData().getDesigningResolution()).getValue() / FormArea.DEFAULT_SLIDER;
if (toData().getCompState() == 0 && prevContainerPercent != containerPercent) {
for (int i = 0; i < this.getComponentCount(); i++) {
XCreator creator = getXCreator(i);
Rectangle rec = new Rectangle(creator.getBounds());
rec.x = (int)(rec.x / prevContainerPercent * containerPercent);
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());
wgt.setBounds(rec);
creator.setBounds(rec);
creator.updateChildBound(minHeight);
}
}
toData().setDesigningResolution(Toolkit.getDefaultToolkit().getScreenSize());
}
/**
* 增加对齐线
* @param connector 对齐线
@ -418,7 +443,7 @@ public class XWAbsoluteLayout extends XLayoutContainer {
);
g2d.setColor(Color.BLACK);
//画编辑文字
g2d.drawString(Inter.getLocText("Edit"), x + w / 2 - 2, y + h / 2 + 5);
g2d.drawString(Inter.getLocText("FR-Designer_Edit"), x + w / 2 - 2, y + h / 2 + 5);
}
}

Loading…
Cancel
Save