Browse Source

Merge branch 'release/10.0' of http://cloud.finedevelop.com:2015/scm/~zheng/C-design into release/10.0

master
zheng 7 years ago
parent
commit
74202116c9
  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 { } else {
currentCreator.setLocation(finalX, finalY); currentCreator.setLocation(finalX, finalY);
currentCreator.setSize(finalW, finalH); currentCreator.setSize(finalW, finalH);
currentCreator.recalculateChildWidth(finalW); currentCreator.recalculateChildWidth(finalW, false);
currentCreator.recalculateChildHeight(finalH); currentCreator.recalculateChildHeight(finalH, false);
child.setLocation(xL, yL); child.setLocation(xL, yL);
child.setSize(dim); child.setSize(dim);
} }
@ -1078,7 +1078,7 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter {
int offset = comp.getHeight() - length; int offset = comp.getHeight() - length;
comp.setSize(comp.getWidth(), offset); comp.setSize(comp.getWidth(), offset);
XCreator creator = (XCreator) comp; 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; int offset = comp.getHeight() - length;
comp.setSize(comp.getWidth(), offset); comp.setSize(comp.getWidth(), offset);
XCreator creator = (XCreator) comp; XCreator creator = (XCreator) comp;
creator.recalculateChildHeight(offset); creator.recalculateChildHeight(offset, false);
} }
} }
childY += actualVal; childY += actualVal;
@ -1134,7 +1134,7 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter {
int offset = comp.getWidth() - length; int offset = comp.getWidth() - length;
comp.setSize(offset, comp.getHeight()); comp.setSize(offset, comp.getHeight());
XCreator creator = (XCreator) comp; XCreator creator = (XCreator) comp;
creator.recalculateChildWidth(offset); creator.recalculateChildWidth(offset, false);
} }
} }
childX += actualVal; childX += actualVal;
@ -1155,7 +1155,7 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter {
int offset = comp.getWidth() - length; int offset = comp.getWidth() - length;
comp.setSize(offset, comp.getHeight()); comp.setSize(offset, comp.getHeight());
XCreator creator = (XCreator) comp; 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 width 宽度
* @param actualSize 是否按照实际大小计算
*/ */
public void recalculateChildWidth(int width){ public void recalculateChildWidth(int width, boolean actualSize){
return; return;
} }
/** /**
* 重新调整子组件高度 * 重新调整子组件高度
* @param height 高度 * @param height 高度
* @param actualSize 是否按照实际大小计算
*/ */
public void recalculateChildHeight(int height){ public void recalculateChildHeight(int height, boolean actualSize){
return; return;
} }

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

@ -373,7 +373,7 @@ public class XWFitLayout extends XLayoutContainer {
if (x == 0) { if (x == 0) {
int width = notHasRightCreator(rec) ? this.getWidth() : rec.width+dw; int width = notHasRightCreator(rec) ? this.getWidth() : rec.width+dw;
creator.setBounds(0, rec.y, width, rec.height); creator.setBounds(0, rec.y, width, rec.height);
creator.recalculateChildWidth(width); creator.recalculateChildWidth(width, true);
} else { } else {
XCreator leftCreator = getCreatorAt(rec.x-1, rec.y); XCreator leftCreator = getCreatorAt(rec.x-1, rec.y);
int posX = getPosX(leftCreator); int posX = getPosX(leftCreator);
@ -502,6 +502,7 @@ public class XWFitLayout extends XLayoutContainer {
if (y==0) { if (y==0) {
int height = notHasBottomCreator(rec) ? this.getHeight() : rec.height+dh; int height = notHasBottomCreator(rec) ? this.getHeight() : rec.height+dh;
creator.setBounds(rec.x, 0, rec.width, height); creator.setBounds(rec.x, 0, rec.width, height);
creator.recalculateChildHeight(height, true);
} else { } else {
XCreator topCreator = getCreatorAt(rec.x, rec.y-1); XCreator topCreator = getCreatorAt(rec.x, rec.y-1);
int posY = getPosY(topCreator); 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; return tabLayoutList;
} }
/** /**
* 重新调整子组件的宽度 * 重新调整子组件的宽度
* @param width 宽度 * @param width 宽度
*/ * @param actualSize 是否按照实际大小计算
@Override */
public void recalculateChildWidth(int width){ @Override
public void recalculateChildWidth(int width, boolean actualSize){
ArrayList<?> childrenList = this.getTargetChildrenList(); ArrayList<?> childrenList = this.getTargetChildrenList();
int size = childrenList.size(); int size = childrenList.size();
if (size > 0) { if (size > 0) {
for (int j = 0; j < size; j++) { for (int j = 0; j < size; j++) {
XWTabFitLayout tabLayout = (XWTabFitLayout) childrenList XWTabFitLayout tabLayout = (XWTabFitLayout) childrenList
.get(j); .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; int offest = width - refSize;
double percent = (double) offest / refSize; double percent = (double) offest / refSize;
if (percent < 0 && !tabLayout.canReduce(percent)) { if (percent < 0 && !tabLayout.canReduce(percent)) {
return; return;
} }
tabLayout.setSize(tabLayout.getWidth() + offest, tabLayout.setSize(rec.width + offest, rec.height);
tabLayout.getHeight()); if(!actualSize){
for (int m = 0; m < tabLayout.getComponentCount(); m++) { updateChildWidgetBounds(tabLayout);
XCreator childCreator = tabLayout.getXCreator(m);
BoundsWidget wgt = (BoundsWidget) tabLayout.toData()
.getBoundsWidget(childCreator.toData());
wgt.setBounds(tabLayout.getComponent(m).getBounds());
} }
tabLayout.adjustCreatorsWidth(percent); tabLayout.adjustCreatorsWidth(percent);
} }
} }
} }
/** /**
* 重新调整子组件的高度 * 重新调整子组件的高度
* @param height 高度 * @param height 高度
*/ * @param actualSize 是否按照实际大小计算
@Override */
public void recalculateChildHeight(int height){ @Override
public void recalculateChildHeight(int height, boolean actualSize){
ArrayList<?> childrenList = this.getTargetChildrenList(); ArrayList<?> childrenList = this.getTargetChildrenList();
int size = childrenList.size(); int size = childrenList.size();
if (size > 0) { if (size > 0) {
for (int j = 0; j < size; j++) { for (int j = 0; j < size; j++) {
XWTabFitLayout tabLayout = (XWTabFitLayout) childrenList XWTabFitLayout tabLayout = (XWTabFitLayout) childrenList
.get(j); .get(j);
tabLayout.setBackupBound(tabLayout.getBounds()); Dimension d = new Dimension(tabLayout.toData().getContainerWidth(), tabLayout.toData().getContainerHeight());
int refSize = tabLayout.getHeight(); Rectangle rec = actualSize? new Rectangle(d): tabLayout.getBounds();
// 容器大小改变时,设下backupBound为其之前的实际大小
tabLayout.setBackupBound(rec);
int refSize = rec.height;
int offset = height - refSize - WCardMainBorderLayout.TAB_HEIGHT; int offset = height - refSize - WCardMainBorderLayout.TAB_HEIGHT;
if(offset < 0){ if(offset < 0){
// 缩放时需要备份原tab布局宽高 // 缩放时需要备份原tab布局宽高
tabLayout.setReferDim(new Dimension(tabLayout.getWidth(),tabLayout.getHeight())); tabLayout.setReferDim(new Dimension(rec.width, rec.height));
} }
double percent = (double) offset / refSize; double percent = (double) offset / refSize;
if (percent < 0 && !tabLayout.canReduce(percent)) { if (percent < 0 && !tabLayout.canReduce(percent)) {
return; return;
} }
tabLayout.setSize(tabLayout.getWidth(), tabLayout.setSize(rec.width, rec.height + offset);
tabLayout.getHeight() + offset); if(!actualSize){
for (int m = 0; m < tabLayout.getComponentCount(); m++) { updateChildWidgetBounds(tabLayout);
XCreator childCreator = tabLayout.getXCreator(m);
BoundsWidget wgt = (BoundsWidget) tabLayout.toData()
.getBoundsWidget(childCreator.toData());
wgt.setBounds(tabLayout.getComponent(m).getBounds());
} }
tabLayout.adjustCreatorsHeight(percent); 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 @Override
public void paint(Graphics g) { 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++){ for (int i = 0;i < components.length;i++){
if (components[i] instanceof XWCardMainBorderLayout){ if (components[i] instanceof XWCardMainBorderLayout){
((XWCardMainBorderLayout)components[i]).recalculateChildWidth(components[i].getWidth()); ((XWCardMainBorderLayout)components[i]).recalculateChildWidth(components[i].getWidth(), false);
((XWCardMainBorderLayout)components[i]).recalculateChildHeight(components[i].getHeight()); ((XWCardMainBorderLayout)components[i]).recalculateChildHeight(components[i].getHeight(), false);
} }
xwFitLayout.dealDirections((XCreator)components[i], 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++) { for (int i = 0; i < components.length; i++) {
if (components[i] instanceof XWCardMainBorderLayout) { if (components[i] instanceof XWCardMainBorderLayout) {
((XWCardMainBorderLayout) components[i]).recalculateChildWidth(components[i].getWidth()); ((XWCardMainBorderLayout) components[i]).recalculateChildWidth(components[i].getWidth(), false);
((XWCardMainBorderLayout) components[i]).recalculateChildHeight(components[i].getHeight()); ((XWCardMainBorderLayout) components[i]).recalculateChildHeight(components[i].getHeight(), false);
} }
xwFitLayout.dealDirections((XCreator) components[i], false); xwFitLayout.dealDirections((XCreator) components[i], false);
} }

Loading…
Cancel
Save